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

mkesicki’s picture

@dblais thanx for your patch. We will check this.

dczepierga’s picture

Title: WYSIWYG toolbar does not show up - intermitent problem - Drupal is undefined » Rewrite loading of CKEditor libraries files
Status: Patch (to be ported) » Fixed

@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

jcisio’s picture

I 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.

dczepierga’s picture

@jcisio, so what u suggest to do with it?

Greeting

jcisio’s picture

http://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.

mkesicki’s picture

Status: Fixed » Needs work
dczepierga’s picture

Status: Needs work » Fixed

Ok 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

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.