Closed (fixed)
Project:
CKEditor 4 - WYSIWYG HTML editor
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Apr 2010 at 23:21 UTC
Updated:
1 Apr 2011 at 21:01 UTC
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 commentedComment #2
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 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 commentedI mark is as a fix to next CKEditor module release.
Comment #5
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