-
-
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
Inserting a block node as first node marks it as selected (adding nodes afterwards deletes the block node) #3355
Comments
Tiptap `setImage()` marks the added image as selected in some cases (especially when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly changing selection to the end of the current text block (`selectTextblockEnd()`) in command chain between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
It's possible to workaround this bug by adding this.editor.chain().insertContent({ type: 'horizontalRule' }).selectTextblockEnd().insertContent("abc").focus().run(); |
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Well, turned out that this.editor.commands.insertContent({ type: 'horizontalRule' })
if (!this.editor.view.state.selection.empty) {
this.editor.chain().focus(this.editor.view.state.selection.to).insertContent("abc").focus().run()
} |
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
Tiptap `setImage()` marks the added image as selected when added as first element in the document), which leads to the image being overwritten by subsequent `insertContent()` command. See ueberdosis/tiptap#3355 for the relevant upstream bug. Mitigate this bug by explicitly placing the cursor at the end of the selection between adding the image and the line break. Signed-off-by: Jonas <jonas@freesources.org>
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days |
The issue unfortunately still exists. |
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Unfortunately this issue still exists. I fixed the codesandbox example (missing dependency on |
What’s the bug you are facing?
When inserting a block node as first node into an empty editor using `insertContent(), the inserted node is marked as selected (focused) afterwards. The result is that insertions happening directly after the first one overwrite the content of the first one.
Interestingly, this only happens on empty content. As soon as the editor has some content, the bug is no longer reproducible.
I tested this with block nodes of type
horizontalRule
andimage
.Which browser was this experienced in? Are any special extensions installed?
Latest Firefox and Chromium.
How can we reproduce the bug on our side?
Doing the following on
editor
with empty content will insert a horizontal line, mark it as selected and overwrite it with the text 'abc' afterwards:Can you provide a CodeSandbox?
https://codesandbox.io/s/tiptap-block-node-bug-1cetce?file=/src/App.vue
What did you expect to happen?
The second
insertContent()
should append content after the first one instead of replacing it.Anything to add? (optional)
Seems like
tr.replaceWith()
ininsertContentAt()
results in the new content being marked as selected in some cases.Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: