The forum operates in read-only mode. Please head to StackOverflow for support.
CKEDITOR.on('instanceReady', function (ev) { // Prevent drag-and-drop. ev.editor.document.on('drop', function (ev) { ev.data.preventDefault(true); }); });
var dragstart_outside = true; ev.editor.document.on('dragstart', function (ev) { dragstart_outside = false; }); ev.editor.document.on('drop', function (ev) { if (dragstart_outside) { ev.data.preventDefault(true); } dragstart_outside = true; });
Between 'instanceReady' and 'drop', you need to add 'contentDom'...Something like this:
CKEDITOR.on('instanceCreated', function(ev) { ev.editor.on('contentDom', function() { ev.editor.document.on('drop', function(ev) { ev.data.preventDefault(true); } ); }); });
CKEDITOR.plugins.add('myplugin', { init: function (editor) { function onDragStart(event) { console.log("onDragStart"); }; editor.on('contentDom', function (e) { editor.document.on('dragstart', onDragStart); // editor.document.on('drop', onDrop); // etc. }); } });
If this thread is still relevant, this worked in a plugin...
Re: Drag and drop event ckeditor
Re: Drag and drop event ckeditor
viewtopic.php?f=5&t=6155
http://dev.ckeditor.com/ticket/338
Re: Drag and drop event ckeditor
CKEDITOR.on('instanceReady', function (ev) { // Prevent drag-and-drop. ev.editor.document.on('drop', function (ev) { ev.data.preventDefault(true); }); });Re: Drag and drop event ckeditor
var dragstart_outside = true; ev.editor.document.on('dragstart', function (ev) { dragstart_outside = false; }); ev.editor.document.on('drop', function (ev) { if (dragstart_outside) { ev.data.preventDefault(true); } dragstart_outside = true; });Between 'instanceReady' and
Between 'instanceReady' and 'drop', you need to add 'contentDom'...Something like this:
CKEDITOR.plugins.add(
CKEDITOR.plugins.add('myplugin', { init: function (editor) { function onDragStart(event) { console.log("onDragStart"); }; editor.on('contentDom', function (e) { editor.document.on('dragstart', onDragStart); // editor.document.on('drop', onDrop); // etc. }); } });If this thread is still relevant, this worked in a plugin...