I'm following the tutorial on http://tinymce.moxiecode.com/tryit/custom_toolbar_button.php but need to add multiple custom buttons.
Here is my block for adding one button, but I need to add more than one button 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 your help
Just call fn.addButton multiple 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}');
}
});
}
If you are defining the toolbar layout, eg
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | firstname",
remember to add the new id (eg. lastname)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With