David Silva
David Silva

Reputation: 1091

How do I create a CKEditor plug-in to support dragging and dropping within an editor instance?

I was surprised to find that dragging and dropping text or images within a CKEditor editor instance doesn't trigger CKEditor's "change" event. I came up with a stop-gap solution, which was to have code triggered by the "dragend" event. However, I'd like to have something in a CKEditor plug-in, so that in all of my apps that use CKEditor I could include the plug-in in the configuration, rather than have to add a separate block of code in each app. Basically, I'm wondering whether there's a way add another event to what CKEditor considers a change -- without modifying core CKEditor code.

FWIW, here's my code, which is basically the same as my code for handling the "change" event, except with the "change" event I get data from e.sender.getData():

$('.content').on('dragend', '.ckeditor', function(e) {
    var editor = $(e.currentTarget).ckeditorGet();
    var data = editor.getData();
    ...
    //if the new data is different from the stored data, save it
});

Upvotes: 1

Views: 372

Answers (1)

Wiktor Walc
Wiktor Walc

Reputation: 5550

Not an exact answer, but check ticket 11437 targeted into upcoming 4.5 release. In short, d&d is a complex topic and we're working on it right now.

Upvotes: 0

Related Questions