-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Update node's attrs without affect history. #918
Comments
https://nightingale-editor.netlify.com/ Here's the demo. |
Assuming that when you say The recommended way to do placeholder nodes it to have an addon create a widget decoration for the placeholder, and not actually add it to the document, as in this example. Is there a reason that doesn't work for you? |
Yes No, decoration doesn't satisfy my needs. I want to make it selectable, draggable, and editable (e.g. could be align to left / right) even during uploading. |
Ran into this. If you set "addToHistory" to false, the undo stack is essentially blocked because "setNodeMarkup" creates a new Node. The way we got around it was to use @marijnh's example at https://discuss.prosemirror.net/t/preventing-image-placeholder-replacement-from-being-undone/1394 You essentially create a custom step that updates the attributes without creating a brand new node. Then, it should work as intended. |
@jljorgenson18 Thanks a lot! @marijnh Could you please add this step into the core library? Thanks! |
What I want to do
{ uploader: {...} }
{ uploader: null, image: '...' }
(w/ or w/o
.setMeta("addToHistory", true)
)Expected behavior
Undo should delete the image node.
Actual behavior
Undo will let that image node back to uploading status / do nothing. (depends on the value of
addToHistory
)Problem
There's no way to change attributes of a node. Instead, it will replace it with a new node. Because that,
saveToHistory
doesn't work as what I expected.The text was updated successfully, but these errors were encountered: