-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(core): fix new lines being added via elementFromString #4767
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Co-authored-by: bdbch <[email protected]>
|
||
removeWhitespaces(html) | ||
|
||
return removeWhitespaces(html) |
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.
Sorry, but does it have to be two calls of removeWhitespaces
?
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.
Good catch - going to remove this for the next patch release.
Updated @tiptap/core to v2.2.1 and this issue is still there. |
What kind of content do you try to insert into the editor? @Marvelousy20 |
I created some custom nodes, so I am passing them like this. The name of the node here is textarea.
|
Any updates regarding this issue? editor.commands.insertContentAt(
insertAfter,
{
type: "paragraph",
content: [{ type: "text", text: modifiedContent }],
},
{ parseOptions: { preserveWhitespace: false } },
) |
Please describe your changes
This PR fixes an issue that adds new lines on the parser level of the browser. It traverses through the actual dom instead of using string replacements removing all newlines added additionally by the parser.
How did you accomplish your changes
See above
How have you tested your changes
I added a new test to check if newlines are kept in pre tags.
How can we verify your changes
Check out the local demo of Issue #2720
Checklist