У меня есть последняя версия ckeditor 4.5.7 с API перетаскивания и у меня есть случай, когда мне нужно перетащить виджет из одного редактора в другой. Поскольку этот билет говорит, что предлагаемое функциональное свойство - терпеть неудачу молча и ничего не делать.ckeditor drag drop widgets
В моем случае мне нужно скопировать виджет, если он потащил в другой редактор и двигаться, если он тащится в том же editor.Second случае уже работает
Любые мысли о как это сделать?
editor.on('contentDom', function() {
var dropTarget = CKEDITOR.plugins.clipboard.getDropTarget(editor);
editor.editable().attachListener(dropTarget, 'drop', function(evt) {
// The target may be some element inside the draggable div (e.g. the image), so get the div.h-card.
var target = evt.data.getTarget().getAscendant('div', true);
// Initialization of CKEditor data transfer facade is a necessary step to extend and unify native
// browser capabilities. For instance, Internet Explorer does not support any other data type than 'text' and 'URL'.
// Note: evt is an instance of CKEDITOR.dom.event, not a native event.
CKEDITOR.plugins.clipboard.initDragDataTransfer(evt);
var dataTransfer = evt.data.dataTransfer;
// Pass an object with contact details. Based on it, the editor#paste listener in the hcard plugin
// will create HTML to be inserted into the editor. We could set text/html here as well, but:
// * It is a more elegant and logical solution that this logic is kept in the hcard plugin.
// * We do not know now where the content will be dropped and the HTML to be inserted
// might vary depending on the drop target.
dataTransfer.setData('contact', CONTACTS[ target.data('contact') ]);
// We need to set some normal data types to backup values for two reasons:
// * In some browsers this is necessary to enable drag and drop into text in editor.
// * The content may be dropped in another place than the editor.
dataTransfer.setData('text/html', target.getText());
});
});
Кроме того, если CKEditor доступен только для чтения через READONLY вариант я могу выбрать некоторое содержимое и перетащите его в другой редактор в результате удаления из редактора исходного кода