Closed ioleo closed 11 years ago
Okay, it seems it's a CKEditor vs JqueryUI issue. I solved my problem with this code
var ckeConfigs = [];
$('#sortable-container').sortable({
start:function (event,ui) {
// save each ckeditor config, create ckeditor html's clone
// destroy ckeditor, hide the textarea and insert the clone to create an illusion that cke is still there
$('textarea', ui.item).each(function(){
var tagId = $(this).attr('id');
var ckeClone = $(this).next('.cke').clone().addClass('cloned');
ckeConfigs[tagId] = CKEDITOR.instances[tagId].config;
CKEDITOR.instances[tagId].destroy();
$(this).hide().after(ckeClone);
});
},
stop: function(event, ui) {
// for each textarea init ckeditor anew and remove the clone
$('textarea', ui.item).each(function(){
var tagId = $(this).attr('id');
CKEDITOR.replace(tagId, ckeConfigs[tagId]);
$(this).next('.cloned').remove();
});
}
});
doesn't work for me. it gives an error on stop at line CKEDITOR.replace(tagId, ckeConfigs[tagId]); saying Uncaught TypeError: Cannot call method 'push' of undefined
Please ensure all your javascript files are loaded correctly.
I have another type of element along with CKEditor, I used the above code and that is working when I move the CKEditor but when i move other elements at that time CKEditor content lost. @ioleo Can you please help to fix this?
After dragging & dropping with Jquery UI Sortable the plugin goes dead. The content disappears only an empty ckeditor shell (not working buttons, white content space).
Does anyone have an idea how to fix it? Is it CKEditor issue, or the way TrsteelCkeditorBundle initiates Ckeditor could affect this?