I have defined a complex node type to represent references to data structures.
Dragging and dropping a selection that contains this Node within the editor works well, despite the node not having a correct
parseDOM function. Somehow, drag and drop from within the editor do not trigger
parseDOM, I suspect it simply move nodes around so it avoids reparsing the HTML content => it works even for nodes without a correct
This might be related to the
But when pasting content,
parseDOM is triggered. That’s problematic because this component is very complex and thus slightly annoying to parse, it’s not the ideal solution to me. I’d like to avoid parsing altogether, as it’s already the case for dragging and ropping.
First question: how can I get the same behaviour when drag and dropping and when copy-pasting, when the copy or the drag comes from the editor itself (so the event
clipboardData can be controlled)?
If that’s not possible, my second idea is to tweak the copy-paste system as follow:
instead of having only
text/html, I also want to add something like
application/prosemirrorwhen copying content from prosemirror
I’d like the
application/prosemirrorformat to be, well, prosemirror friendly, in the sense that it should be easy to generate when copying some content, and easy to parse when pasting some content
when pasting, detect this
application/prosemirrorformat in priority and use it
and 3) shouldn’t be too hard, there are a few methods to do so But for 2), is there already an appropriate format that can easily be encoded/decoded by prosemirror? A bit like when we display slices in prosemirror text format, can we parse this string back to generate a node?