I’m trying to allow to drag/drop a single textMark. But it looks like I miss something.
When I select a textMark and part of the text coming after or before the textMark I can drag them together and it works fine - editor allows me to drag the text and I rebuild its content after ‘changes’ event.
The issue is I’m unable to drag a textMark without selecting nearby text.
p.s. Just curious. Can you point me to why the “onDragStart” doesn’t invoke when I’m dragging textMark? As I see from the code “dragstart” event listener is added to the “cm.display.scroller” element. Textmarks are inside of it, but why it’s not called for textMark? Can’t see the reason and I’m really curious to see it
I suspect the mousedown is being preventDefault-ed by the library, which prevents browser native dragging from happening at all. The handleMouseEvents option to markText can be used to turn off built-in event handling for your widget.
I don’t think you’ll be able to get CodeMirror’s own drag-drop handling to do what you want here. You’ll just have to register custom event handlers that override it.