Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to add a rich text editor to a widget and am using CKEditor ( http://ckeditor.com/download ) with a simple toolbar.

Everything works fine until I try to save. When clicking on "save" the textarea (and texteditor) vanish and it fails to save.

Removing the texteditor allows the textarea to work and save normally.

You can see the widgets code here: http://pastebin.com/C7VbxBSG

and of course I did add the required wp_register_script and wp_enqueue_script

I use the same code to add the text editor to text areas n meta boxes for pages and posts and it works fine. It's just on the widget the problem comes up something to do with the way the widget saves: via javascript which is beyond my skills at present

share|improve this question

2 Answers 2

I had the same problem when adding tinymce to widgets a few months ago. Add all your javascript code with enqueue script, instead of adding it in each widget instance.

Here is my tinymce implementation: http://gist.github.com/600616

share|improve this answer
    
That would be awesome, please do! –  Ash G Sep 28 '10 at 7:42
    
Actually, can you enqueue scripts that are meant to be called inline? The script in question is on line 101 in the pastebin link: ( pastebin.com/C7VbxBSG ) Can that be enqueued? –  Ash G Sep 28 '10 at 8:26
    
I added a link to my code in the answer. You can see how I added the code in the header (I could have used an enqueue script instead). To do it, you will have to use a class instead of the id to call the script (since the field id is dynamically generated). –  sorich87 Sep 28 '10 at 8:36
    
Brilliant, I am going to dig into this tonight. Thanks! –  Ash G Sep 28 '10 at 9:15
    
You are welcome. –  sorich87 Sep 28 '10 at 9:29

You may want to try the Black Studio TinyMCE Widget plugin, which adds a WYSIWYG text widget based on the standard TinyMCE WordPress editor (not CKEditor).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.