我正在关注http://tinymce.moxiecode.com/tryit/custom_toolbar_button.php上的教程,但需要添加多个自定义按钮。
这是我添加一个按钮的块,但我需要添加多个按钮而不知道如何
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}');
}
});
}
感谢您的帮助
答案 0 :(得分:6)
多次调用fn.addButton:
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}');
}
});
}
如果您要定义toolbar
布局,例如
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | firstname",
请记住添加新的id
(例如lastname
)