Hey,
my schema has a node called rect
with a style
attribute. Since browsers use the style
attribute on DOM nodes for inline styles, I can conveniently use it to style individual rect
nodes, and persist values in my PM document.
I would like to be able to use my browser’s Web Inspector to manipulate these styles. Right now, when I make changes to a rect
with the inspector, the changes get reverted to the PM document’s value instantly. From the way the inspector behaves, it looks like the node is tossed out and replaced with one that represents the last known value from the document.
Outside of ProseMirror, I know I can use a MutationObserver to watch a DOM node’s style
attribute change.
(tl;dr) My question is: Can I write a PM NodeView
(or something else) that captures these mutations and turns them into proper transactions effecting the style
attribute on the PM doc, which in turn should result in the DOM representing the change I made in the inspector?
Thank you!