fix(table): preserve hardBreak nodes during markdown cell serialization - #7738
Closed
sahiee-dev wants to merge 1 commit into
Closed
sahiee-dev wants to merge 1 commit into
sahiee-dev wants to merge 1 commit into
Conversation
|
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
6 tasks
Member
|
Closing this in favor for #8012 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes Overview
Fixes data loss where
<br>tags inside markdown table cells are silently dropped during re serialization viaeditor.storage.markdown.getMarkdown(), collapsing multi line cell content into a single line.Implementation Approach
extension-hard-breakcorrectly serializes<br>as\n(CommonMark spec). The data loss occurs inextension-table'scollapseWhitespace(), which strips all\s+including that\nbefore writing the cell back to markdown.The fix intercepts
hardBreak's exact output (\n) and converts it to<br>beforecollapseWhitespace()runs:I investigated passing table cell context down to
hardBreakso it could emit<br>directly, buth.renderChildrendoes not propagatemetaacross recursion boundaries that would require a broaderMarkdownManagerrefactor.Also updated
DEFAULT_CELL_LINE_SEPARATORfrom\u001Fto<br>for consistency with the preserved output format.Testing Done
Added a round trip test in
packages/extension-table/__tests__/tableMarkdown.spec.ts, withHardBreakregistered in the test markdown manager:All
extension-tabletests pass.Verification Steps
editor.storage.markdown.getMarkdown()foo<br>barand notfoo barAdditional Notes
packages/markdown/__tests__/paragraph.spec.tshas a pre existing failure on the upstreamdevelopbranch unrelated to this change verified by running it against a cleandevelopbranch before and after applying this fix.Checklist
Related Issues
Closes #7731