Adding this in the widget form method:
wp_editor($text, $this->get_field_id('text'));
seems to work. But after you press the “Save” button the widget goes funky…
Adding _WP_Editors::editor_js();
makes it show after you press the save button, but then other things start to act weird. I think it has something to do with the javascript from the footer.
Has anyone successfully integrated wp_editor inside a widget?
As said I think it’s quite hard to find a reliable solution because you have to take care of so many things.
I go either for the way proposed by Danny van Kooten:
http://dannyvankooten.com/450/tinymce-wysiwyg-editor-in-wordpress-plugin/
add and open the editor in a thickbox or another way I’ve used once, using the widget “accessibility mode” for “advanced” stuff as seen in this screenr: http://www.screenr.com/sY5s
this example is buggy but the overall concept works fine, even if it’s quite funny that you have to use js to get and add the link to the corresponding (non-js fallback) widget-edit page 🙂
But on the other hand, on this seperate page you can actually do whatever you want.
I haven’t dug into its code, but at first glance Spots may be using the built-in
wp_editor()
.I’m new to WP so I’m not entirely sure of this solution but I did read recently that there are issues with using
wp_editor()
(I can’t remember where I read this, though). However, I also remember reading thatthe_editor()
is a better solution, especially with draggable elements.I hope that helps.