Hello,
Please consider the following scenario:
You enter a node edit form, with a text area with its text format select box. The default selected text format does not have ckeditor inserted. You thus enter in:
Drupal.behaviors.ckeditor = {
attach:
function (context) {
[...]
$(context).find("textarea.ckeditor-mod:not(.ckeditor-processed)").each(function () {
[..]
$('#'+sel_format+':not(.ckeditor-processed)').addClass('').change(function(){
But no ckeditor was inserted, because of the text format configuration. So far, so good.
Now, you interact with a field widget that do AJAX interaction, e.g. filefield. The JS behaviors are called again. Since the ckeditor was not inserted, there is no "ckeditor-processed" class. And thus we reenter in the code quoted above, including the last line.
So
$('#'+sel_format+':not(.ckeditor-processed)').addClass('').change(function(){
gets called twice, and two ckeditors will be inserted when I will choose another text format.
The patch will follow.
Nicolas
Comment | File | Size | Author |
---|---|---|---|
#1 | ckeditor-inserted-multiple-times-1557526.patch | 786 bytes | ndeschildre |
Comments
Comment #1
ndeschildre CreditAttribution: ndeschildre commentedHere is the patch for 7.x-dev, tested on 7.x-1.8. Looks to be still valid for 7.x-dev. (and it is pretty trivial).
Comment #2
mkesicki CreditAttribution: mkesicki commented@ndeschildre,
thank you for patch. We try check it as son as possible.
Comment #3
dczepierga CreditAttribution: dczepierga commented@ndeschildre, really thx for your patch and review.
I make it in some other way and commit it to GIT (diff).
Pls update to last DEV version and if it doesn't help pls reopen this issue.
Greetings
Comment #4
dczepierga CreditAttribution: dczepierga commentedComment #5
ndeschildre CreditAttribution: ndeschildre commentedGreat, thanks!
Comment #7
mkesicki CreditAttribution: mkesicki commented