Forum closed. New forum available at http://community.wymeditor.org/

Custom toolbar buttons

Support forum for WYMeditor.

Custom toolbar buttons

Postby pspace on Tue Jul 31, 2007 5:02 pm

Hello,

Can anyone help or point me in the direction of some documentation that demonstrates how to create custom toolbar buttons for 0.4?

I would like to create buttons which insert preset text/html at the cursor position and also one's which display custom dialogs.

I worked a little on WYMEditor 0.2 a while ago and these requirements seemed quite easy to do. But I have no idea in 0.4.

Thanks for any help!
pspace
 
Posts: 2
Joined: Tue Jul 31, 2007 4:27 pm

Postby jfh on Thu Aug 02, 2007 9:42 am

Please take a look at the Tidy plugin, provided in the package.
You can start with something like:
Code: Select all
jQuery('.wymeditor').wymeditor({

    postInit: function(wym) {

        var html = "<li class='wym_tools_newbutton'>"
                 + "<a name='NewButton' href='#'"
                 + " style='background-image:"
                 + " url(newbutton.png)'>"
                 + "Do something"
                 + "</a></li>";

        jQuery(wym._box)
        .find(wym._options.toolsSelector + wym._options.toolsListSelector)
        .append(html);

        //handle click event
        jQuery(wym._box)
        .find('li.wym_tools_newbutton a').click(function() {
            //do something
            return(false);
        });
    }
});
User avatar
jfh
Site Admin
 
Posts: 370
Joined: Sat Sep 23, 2006 8:43 pm
Location: Belgium

Postby pspace on Thu Aug 02, 2007 9:46 am

Fantastic.

Merci beaucoup
pspace
 
Posts: 2
Joined: Tue Jul 31, 2007 4:27 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest