TinyMCE 添加多个自定义工具栏按钮 [英] TinyMCE adding multiple custom toolbar button
本文介绍了TinyMCE 添加多个自定义工具栏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在关注 http://tinymce.moxiecode.com/tryit/custom_toolbar_button 上的教程.php 但需要添加多个自定义按钮.
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}');
}
});
}
感谢您的帮助
推荐答案
只需多次调用 fn.addButton:
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}');
}
});
}
如果您正在定义 toolbar
布局,例如
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",
记得添加新的id
(例如lastname
)
这篇关于TinyMCE 添加多个自定义工具栏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文