Hm, hopefully this lends inspiration, but something hacky I’m doing to automatically transform links on regular paste is by defining a transformPasted
which ‘linkifies’ the slice, along with Change transformPasted behaviour when shift key is pressed to detect if its a regular keyboard paste or plain text paste. If shift is detected, then we just return false in transformPasted
.
Again this does not work if a person is using the context menu, as you brought up.
For the more general case of marks besides links, I would probably look at EditorState.storedMarks
and EditorProps.handlePaste
: storedMarks
tells you which marks are “active” / “inclusive”, and handlePaste
is more lower level than transformPasted
but gives you access to the view and clipboard event.
Edit: In addition to storedMarks
, for a TextSelection
, there is also $cursor.marks()
.