When having textareas with CKEditor enabled inside table row with Drupal tableDrag behavior attached to it (like textarea field with several values or Imagefield with Title attribute as a textarea) and trying to swap the rows - the text disappears from the CKEditor (and from the corresponding textarea); it swaps fine if you first switch to the plain text editor.
So I added these lines just to the end of the ckeditor.utils.js file:
if (Drupal.tableDrag) {
Drupal.tableDrag.prototype.onDrag = function() {
$(this.rowObject.element).find('textarea.ckeditor-processed').each(
function() {
if (typeof(CKEDITOR.instances) != 'undefined' && typeof(CKEDITOR.instances[$(this).attr('id')]) != 'undefined') {
Drupal.ckeditorOff($(this).attr('id'));
}
}
);
};
Drupal.tableDrag.prototype.onDrop = function() {
$(this.rowObject.element).find('textarea.ckeditor-mod:not(.ckeditor-processed)').each(
function() {
if ((typeof(Drupal.settings.ckeditor.autostart) != 'undefined') && (typeof(Drupal.settings.ckeditor.autostart[$(this).attr('id')]) != 'undefined')) {
Drupal.ckeditorOn($(this).attr('id'));
}
}
);
};
}
It overrides the onDrag and onDrop functions as advised by the tabledrag.js file from Drupal.core:
Created tableDrag instances may be modified with custom behaviors by
overriding the .onDrag, .onDrop, .row.onSwap, and .row.onIndent methods.
See blocks.js for an example of adding additional functionality to tableDrag.
Hopefully, it is just what needs to be done - I'm not that well versed in JavaScript :)
As a reference, for the TinyMCE editor the same issue is addressed by the TinyMCE Drag and Drop Integration module (it doesn't use the above functions, but requires some other dependencies).
Let me know if it is fine and I will create a patch then.
Thanks
AndyB
Comment | File | Size | Author |
---|---|---|---|
#2 | 0001-1296804-Tabledrag-compatibility.patch | 1.31 KB | duozersk |
Comments
Comment #1
duozerskMoving to active as there is no patch yet ;)
Comment #2
duozerskAnd here is that patch against 6.x-1.x-dev (at least I believe so).
Comment #3
duozerskIs this of any interest? This issue really should be resolved, one way or another.
Please review, will appreciate any feedback.
AndyB
Comment #4
mkesicki CreditAttribution: mkesicki commentedI commited patch to repo. Please test DEV version.
Comment #5
duozerskthx!
Comment #6.0
(not verified) CreditAttribution: commentedcorrected link to the TynyMCE module