-
-
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
[Bug]: Difference in behavior of setContent and insertContent commands #4034
Comments
In order to maintain consistency between the behaviors of "insertContent" and "setContent", this is what I did:
|
Experiencing the same issue. Even when replacing the newline characters the commands do not produce the same results for more complex html imports. Seems like quite a core functionality that is important to have reliable import. Is it still on the roadmap? @bdbch |
Thanks for reporting. I'll take a look tomorrow |
Could this have any relation to #4862? Edit: Oh sorry, probably not given the issue's creation date - although it may be related to what @kaikun213 is saying specifically? |
#4895 created a fix here which should bring setContent and insertContent in line with each other. |
Should be resolved with the latest beta, let us know: v2.5.0-beta.5 |
Not OP, but I did a quick test in our editor and it looks good to me. It's always possible our custom code is interfering but I think this can be closed unless someone reports otherwise. |
|
Which packages did you experience the bug in?
core
What Tiptap version are you using?
latest
What’s the bug you are facing?
In our application, we are using
insertContent
andsetContent
command. The issue we are facing is the final output for the same content is different for the two commands.Example to this:
For above content, output of


setContent
is:But, for
insertContent
it is coming with two blank lines in-between the contentif I pass
parseOptions
ininsertContent
command asIt will still come with one blank line like this:

Ideally, behavior should be same for both the cases.
I have some observations regarding this:
Behavior will be same for both
insertContent
andsetContent
.setContent
is using parseSlice andinsertContent
is using parse function from Prosmirror.Since, external content can possibly have new lines in them, we want behavior of both the commands to be same (Ideally the behavior of
setContent
)What browser are you using?
Chrome
Code example
https://codesandbox.io/s/green-monad-surcnd?file=/src/App.js
What did you expect to happen?
setContent
andinsertContent
should produce same output for given content.Anything to add? (optional)
NA
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: