-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add Node linebreakReplacement support and enable on hardBreak nodes #5821
Add Node linebreakReplacement support and enable on hardBreak nodes #5821
Conversation
Support the [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) property on Nodes, allowing a node to be used wherever a newline character is, when converting between blocks that don't support the linebreak node, but have their whitespace set to "pre". This is useful, for example, when converting between code blocks & normal paragraphs. Code blocks don't support the linebreak node, but do allow newline characters ('\n'). Marking the `hardBreak` node as the `linebreakReplacement` will mean the newline characters within codeBlock nodes will be converted to `hardBreak` nodes in the paragraph.
When converting between codeBlocks and normal paragraphs, the hardBreak node should be used in place of newline '\n' characters.
🦋 Changeset detectedLatest commit: 35c2dcc The changes in this PR will be included in the next version bump. This PR includes changesets to release 54 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition!
Released with 2.10.0 |
Changes Overview
hardBreak
node as thelinebreakReplacement
node, by default.Implementation Approach
whitespace
Testing Done
Before:
CleanShot.2024-11-11.at.10.17.52.mp4
After:
CleanShot.2024-11-11.at.10.15.02.mp4
Verification Steps
tiptap/demos/src/Nodes/CodeBlock/React/index.jsx
) add theHardBreak
extensionChecklist
Related Issues