-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Bug]: insertContent does not preserve marks on inserted TextNodes #5540
Comments
In these cases I'm starting to think I have an incorrect expectation about the command's capabilities. In any event I can presumably handle this at the ProseMirror level, but it would be nice if it could be done with a single call to |
insertContent is for HTML or JSON content not Prosemirror nodes. This is reflected in its types. I do not think we should be adding prosemirror nodes because if they are generated from another schema they will not be valid in this schema. This leads to complexity that makes it easy to do the wrong thing. Literally all you would need to do is to do Fragment.from(contentYouAreInserting).toJSON() and insertContent with that. |
Ended up just doing a Studying the underlying types might indeed have made it more clear, but in the IDE it just says it accepts, |
Affected Packages
core
Version(s)
2.5.6
Bug Description
We're trying to slice part of the document and re-insert it to preserve marks but I find
insertContent
loses those marks.Browser Used
Chrome
Code Example URL
No response
Expected Behavior
Inserted ProseMirror nodes preserve marks as is currently possible when feeding
insertContent
an HTML string.Additional Context (Optional)
This occurs whether you try to insert one node or multiple nodes.
Dependency Updates
The text was updated successfully, but these errors were encountered: