Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error when rendering widgets inside table (fix #3198) #3261

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jgskillable
Copy link

fix: Widgets inside of table cells causing data loss

Please check if the PR fulfills these requirements

  • It's the right issue type on the title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has a description of the breaking change

Description

This PR addresses an issue where rendering widgets inside a table causes an error, resulting in the table cell being removed from both the visual and markdown views when switching modes. This leads to data loss. The fix is based on a previous bug report and potential solution found here.

Business Case

Fixing this issue is crucial for users who rely on the accurate rendering of widgets within tables. The current bug leads to data loss, which can significantly impact user productivity and trust in the application. By resolving this issue, we ensure a more reliable and seamless user experience, which is essential for maintaining user satisfaction and retention.

Steps to Reproduce

  1. Open the TOAST UI Editor Demo:

    • Navigate to the TOAST UI Editor demo page.
  2. Switch to Markdown Mode:

    • Ensure the editor is in Markdown mode.
  3. Add a Table with a Widget:

    • Insert the following markdown into the editor:
      | Header 1 | Header 2 |
      |----------|----------|
      | Cell 1   | [@Widget](widget) |
      | Cell 3   | Cell 4   |
  4. Switch to Visual Mode:

    • Change the editor mode to Visual (WYSIWYG) mode.
  5. Observe the Table:

    • Check if the cell containing the widget (@Widget) is still present.
  6. Switch Back to Markdown Mode:

    • Change the editor mode back to Markdown mode.
  7. Check the Markdown Content:

    • Call editor.getMarkdown() and observe the output.

Expected Result

  • The cell containing the widget (@Widget) should be present in both Visual and Markdown modes.
  • The editor.getMarkdown() output should include the cell with the widget.

Actual Result

  • The cell containing the widget is removed when switching to Visual mode.
  • The editor.getMarkdown() output does not include the cell with the widget, resulting in data loss.

fix: resolve a bug completely (#3198)


Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

- Updated the Prettier configuration to automatically handle end-of-line settings. This ensures consistent line endings across different operating systems.
- Added the isCustomInline function to the HTML to WWConverter. This function helps in identifying custom inline elements, improving the conversion process.
- Updated the tableCell function in the toWwConverter to support checking if the node is a custom inline node. This fix addresses the issue of widgets inside table cells not being handled correctly.
- Updated the editor demo to support showcasing a widget inside a table cell. This addresses the issue where widgets were not supported correctly inside table cells.
- Bumped the package version to 3.2.3. This update includes fixing an issue where widgets weren't supported inside of table cells.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant