0

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?

4

1 回答 1

0

是的,事实证明:

$('.foo').draggable({
    helper: "clone"
});

是答案,但如果一开始不起作用,请尝试将overflow:auto; 在另一个元素上。

于 2015-07-20T20:54:56.817 回答