You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a prosemirror plugin that replaces the current paragraph with a bulleted list using transaction.replaceWith(). However, I unexpectedly do not see the list item applied. It remains a paragraph in prosemirror, even though I see a list-item in the list of computed patches for automerge's intercept() function.
Follow the README instructions to install and start the dev server
Attempt to type "- " before the phrase "Welcome" in the editor
Notice the "- " is correctly removed, but the element type remains the same
I've also noticed exceptions thrown in the console attempting to delete nonexistent characters after the above reproduction. My guess is that automerge generated a tree that prosemirror failed to render correctly, so edits are running on a bad state.
This plugin was tested using prosemirror without automerge, and the list item was applied without issue.
Possible causes
It's possible the parent.content.cut is causing automerge to create a diff that assumes the same text block has stayed the same, and it fails to create the correct parent for that text. Note that .cut(1, ...) is used to omit the "- " in the outputted list item. I see this is interpreted as a delete patch in automerge's intercept() function.
The text was updated successfully, but these errors were encountered:
bholmesdev
changed the title
Unexpected output using replaceWith()
Unexpected output using replaceWith() from a plugin
Aug 31, 2024
I created a prosemirror plugin that replaces the current paragraph with a bulleted list using
transaction.replaceWith()
. However, I unexpectedly do not see the list item applied. It remains a paragraph in prosemirror, even though I see alist-item
in the list of computed patches for automerge'sintercept()
function.Steps to reproduce
I've also noticed exceptions thrown in the console attempting to delete nonexistent characters after the above reproduction. My guess is that automerge generated a tree that prosemirror failed to render correctly, so edits are running on a bad state.
Plugin implementation
See the plugin implementation here. Snippet pasted below for convenience:
This plugin was tested using prosemirror without automerge, and the list item was applied without issue.
Possible causes
It's possible the
parent.content.cut
is causing automerge to create a diff that assumes the same text block has stayed the same, and it fails to create the correct parent for that text. Note that.cut(1, ...)
is used to omit the "- " in the outputted list item. I see this is interpreted as a delete patch in automerge'sintercept()
function.The text was updated successfully, but these errors were encountered: