Atomic(non-editable) Nodes and ReplaceSteps


We have implemented a few components in our PM editor where we use atom Nodes along with custom NodeViews to support interactive components that are not editable within ProseMirror but can be edited within a separate editor. The authored data is assigned to the Node’s attributes and in order to update the EditorState we are using Transaction.replaceWith(), passing the updated Node when the custom Editor is closed.

This approach seems to be working fine except for fact that Undo/Redo steps are not generated. I was navigating the source code and it seems to be due to the fact that ReplaceSteps are not created when the replaced slice is “empty”.

Since the approach we’re using makes the Nodes “empty” (as all the data is stored in its attributes), this condition is not met and a ReplaceStep is not created, preventing the undo/redo from being enabled.

Any sugestions on how to “circumvent” this? I also wonder if the approach with atom Nodes storing data in attributes make sense for the purpose I describe above (content edited in an editor external to PM).


and the range that is replaced is empty. A replace step that replaces nothing with nothing would have no effect, and can’t change attributes either, so I think you might be misdiagnosing the issue here?