I'd like to have an image or div that I can drag and drop into the CKEditor 4. How can I achieve this?
My DOMElement has the full path to the image - pretend it is an with a src attribute. The image has alredy been uploaded to the server, so all I want to do is get the URL of the image being dragged into the CKEditor and insert an image tag with the scr set.
I am listening to both drop and paste events, but my data is always empty...
CKEDITOR.on('instanceCreated', function (e) {
e.editor.on('paste', function (event) {
event.stop();
var data = event.data.dataValue;
if (window.chrome || window.safari) {
// removing span wrapper on webkit browsers.
data = $(data).html();
}
//This is always empty...
console.log(event.editor.getData());
event.editor.insertHtml(data);
});
e.editor.on('drop', function (ev) {
console.log("drop", ev);
});
});
Any ideas?