Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you use multiple instance of CKEditor in the same page, the variable "Drupal.settings.ckeditor.theme" is an Array instead of a String. It seems to be a Bug since the "marinelli" CSS fix is affected. If you try to compare that variable with a String, it will join all elements in the array to make a String with it, so you will get something like "marinelli,marinelli" or "mytheme,mytheme". I wrote a little fix for that:
var themeName = Drupal.settings.ckeditor.theme;
if (typeof Drupal.settings.ckeditor.theme == "object") {
themeName = Drupal.settings.ckeditor.theme[0];
}
After that, you can use the themeName variable instead of the String/Array stuff:
if (themeName == "marinelli") {
config.bodyClass = 'singlepage';
config.bodyId = 'primary';
}
if (themeName == "mytheme") {
config.bodyClass = 'singlepage';
config.bodyId = 'primary';
}
I can submit a patch if you need one.
Comments
Comment #1
gaellafond CreditAttribution: gaellafond commentedComment #2
savgoran CreditAttribution: savgoran commentedSuppose you have form element defined like this:
This will produce following html:
Take attention on id of this element, it is prefixed with edit-.
When page is loaded, CKEDITOR.instances object will contain edit-message object, firebug can prove it, but that object is inaccessible because object and function names in javascript can contain only alphanumeric and underscores. So, every attempt to write in javascript something like this:
will fail, because object edit-message is undefined.
Comment #3
gaellafond CreditAttribution: gaellafond commented@savgoran
Thanks for your input, but it seems to be a different issues. I don't know exactly what you are doing, but I think you should try something like this:
If it doesn't work, feel free to open a new issues for it.
My issues is about having multiple instances of CKEditor in a Node. It cause problems when I try to use the CSS fix (http://drupal.ckeditor.com/tricks).
It should work if I add something like that to ckeditor.config.js
But, in fact, since I have multiple instance of CKEditor with some nodes, I have to add this as well:
My little fix in the description of the issue can solve that.
Comment #4
dczepierga CreditAttribution: dczepierga commentedI mark is as a fix to next CKEditor module release.
Comment #5
dczepierga CreditAttribution: dczepierga commentedI fix it and commit to GIT.
Please check the latest dev release and let me know if you notice any poblems with it. Remember to clear Drupal cache and browsers cache before testing.
Greetings