I’m currently investigating how to override the way a slice gets pasted depending on where the paste/drop ‘selection target’ is.
As an example, when pasting content into a table - rather than splitting the node in half when pasting content like:
I’d rather override the pasting behaviour to unwrap the table-cell contents and show the content in a list like:
To get this behaviour, I can’t use
transformPasted as there’s way no to access the state / selection so I’m forced to override both
handleDrop and reimplement all of the logic
prosemirror-view already does for these handlers to iterate through the slice and unwrap the table/tableCell.
I’m wondering what people think is the best course of action, either:
- Do nothing, and just copy across the handlePaste/handleDrop handlers from prosemirror-view (at the risk of not getting bug fixes / incurring the maintenance cost of owning this code)
- Try and get the logic to paste / drop a slice (like https://github.com/ProseMirror/prosemirror-view/blob/8363b38d52a08035feae71459b49895916fd84f6/src/input.js#L512) to their own commands in PM-View
- Try and change transformPasted to have the signature:
transformPasted:: ?(slice: Slice, view: EditorView, event: dom.Event) → Slicebut the argument ordering is strange when compared to
- A better idea?