TinyMCE adds a few custom toolbar buttons

I follow the guide http://tinymce.moxiecode.com/tryit/custom_toolbar_button.php , but you need to add some custom buttons.

Here is my block for adding one button, but I need to add some buttons and don’t know how

setup : function(fn) {
    // Add a custom button
    fn.addButton('firstname', {
        title : 'Member First Name',
        image : 'resources/scripts/tiny_mce/themes/advanced/img/firstname.gif',
        onclick : function() {
            // Add you own code to execute something on click
            fn.focus();
            fn.selection.setContent('{firstname}');
        }
    });
}

thanks for the help

+3
source share
1 answer

Just call fn.addButton a few times:

setup : function(fn) {
    // Add a custom button
    fn.addButton('firstname', {
        title : 'Member First Name',
        image : 'resources/scripts/tiny_mce/themes/advanced/img/firstname.gif',
        onclick : function() {
            // Add you own code to execute something on click
            fn.focus();
            fn.selection.setContent('{firstname}');
        }
    });
    fn.addButton('lastname', {
        title : 'Member Last Name',
        image : 'resources/scripts/tiny_mce/themes/advanced/img/lastname.gif',
        onclick : function() {
            // Add you own code to execute something on click
            fn.focus();
            fn.selection.setContent('{lastname}');
        }
    });
}
+6
source

All Articles