views:

825

answers:

2

OK, I'm using greasemonkey to replace an editor on a site that is using KTML (from 2006!) with CKEditor. I first get rid of KTML, then I load jQuery and then ckeditor.js and that works, apparently. But when I go to replace the textarea, firebug reports "CKEDITOR is not defined" and my textarea stays normal. Am I loading them in the wrong order?

I can replace it after the page loads using the firebug console with

CKEDITOR.replace('editor1');
A: 

Your problem might be that the browser didn't finish loading (and thus didn't parse) the CKEditor js file at the time you're trying the .replace.

Prody
I tried making the script wait for up to 1.5 seconds, but even that doesn't help...
A: 

Are you loading the textarea and the script that executes the 'replace' via ajax?

Try this:

parent.CKEDITOR.replace('editor1');

or

top.document.CKEDITOR.replace('editor1');
Koen Schmeets