Customize multicarret copy/paste

Hello,

I would like to customize multiselection copy/cut/paste behavior of CM6. Copy and cut behaviors seems to fit what I need as it writes each selections separated by OEL into the clipboard.

Regarding paste, I would like to compare number of carets/selections to number of ‘lines’ in clipboard then if it matches, copy each line to appropriate caret/selection.

I planned to use an EditorView.domEventHandlers extensions, but as handers are not linked to editable content element, I cannot use ‘paste’ handler. Other solution would be to use a custom command on Ctrl+V, it works but as expected, it doesn’t change paste behavior from “system” event (e.g. context menu).

I think, linking custom handler to “paste” event of the editable content element, should work.
Any idea how I could achieve this ?

Thanks

Isn’t that how the default behavior works?

I’m not sure what this means. What kind of element would you want your handler to be linked to?

My bad, I don’t know how I did my test but default behavior seems to work perfectly and fit my needs.
I thought having the possibility to link handlers to ‘cm-content’ div would solve the “issue” but no need anymore.

Sorry to disturb.
Have a nice day

That is precisely where the event handlers specified through domEventHandlers are registered.

Exactly, it seems I completely misread the documentation.