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.
Some time we receive a Javascript error in the file ckeditor.utils.js line 2:
Drupal.ckeditor = (typeof(CKEDITOR) != 'undefined');
Error "Drupal is undefined".
After searching, i saw the javascript ckeditor.js was loaded beford drupal.js which can cause bug. ckeditor.js is included in the file ckeditor.module line 576:
drupal_set_html_head('
');
I changed this line which include the JS at the start of the HEAD. I replaced this line with:
drupal_add_js($editor_local_path .'/' .$conf['ckeditor_load_method']);
Now the JS is in the good place and i dont have any error.
David
Comments
Comment #1
mkesicki CreditAttribution: mkesicki commented@dblais thanx for your patch. We will check this.
Comment #2
dczepierga CreditAttribution: dczepierga commented@dblais, really thx for report it... i make some more changes of loading CKEditor libraries files and commit to GIT.
Pls check last DEV version of CKEditor module.
Greetings
Comment #3
jcisio CreditAttribution: jcisio commentedI think it needs more test because this makes the 300 KB ckeditor.js included in the JS aggregate file, something that we don't want to do.
Comment #4
dczepierga CreditAttribution: dczepierga commented@jcisio, so what u suggest to do with it?
Greeting
Comment #5
jcisio CreditAttribution: jcisio commentedhttp://api.drupal.org/api/function/drupal_add_js/6
By default we have $preprocess = TRUE, so I think what we want to do is to set $preprocess = FALSE.
What I'm not sure is that why this module used drupal_set_html_head() instead of drupal_add_js(). I investigated once, but I don't remember now. The reason could be that with drupal_set_html_head(), it is possible to load CKEditor from a CDN in D6.
Comment #6
mkesicki CreditAttribution: mkesicki commentedComment #7
dczepierga CreditAttribution: dczepierga commentedOk i change this, and now ckeditor.js isn't aggregated...
Before we used drupal_set_html_head(), becuase CKEditor now work with aggregation and was problem with place where is loaded... When we fix problem with Google Page Speed we also remove problem with aggregation, so now everything works fine :)
Greetings