WordPress.org

Ready to get started?Download WordPress

Forums

Creating a custom widget that uses Tinymce (2 posts)

  1. scripty
    Member
    Posted 4 years ago #

    I am trying to create a custom widget that uses tinymce for a textarea in the widget. I'm using the new widget class in 2.8. I've downloaded tinymce and included it in my plugin folder (trying to use the tinymce bundled with wordpress - it wouldn't let me use the "simple" theme otherwise). I'm including the javascript on the widgets page by creating a function that calls pulls in the javascript and calls the tinymce init and then hooking it into the widgets page with:
    add_action(’admin_print_scripts-widgets.php’, ‘mytinymcecallfunction’);

    When I pull up the widget - the tinymce displays on the textarea the way it's supposed to. The problem comes when I try to SAVE the widget...

    The changes aren't saved - and the textarea reverts back to it's "non-tinymce" view.

    Strangely, changes I make in the textarea AFTER it's reverted back to the non-tinymce view ARE saved... it just doesn't seem to want to save it with the tinymce "on"...

    Any thoughts?

  2. scripty
    Member
    Posted 4 years ago #

    So just an update on this - hoping someone can come up with a better solution. I've added the "add/remove" editor function in tinymce - I can make the changes in the wysiwyg view, click the link to "remove the editor" so it shows all the HTML in the textarea, THEN save the widget - it saves it no problem, AND it lets me click the link to "show editor" again. There's got to be a way to run that behind the scenes and/or be able to grab the html tinymce is creating... but at least I have a temporary workaround...

Topic Closed

This topic has been closed to new replies.

About this Topic