Javascript TinyMCE-如何添加带有名称的按钮
我知道我可以使用Javascript TinyMCE-如何添加带有名称的按钮,javascript,tinymce,Javascript,Tinymce,我知道我可以使用addButton在TinyMCE 4中添加按钮。但当我使用addButton并为其输入标题时,编辑器中只显示一个空按钮,并显示包含标题内容的工具提示。如何添加菜单栏中实际显示的标题,如保存按钮?多亏了Eslam,我找到了解决方案 // Create and render a button to the body element tinymce.ui.Factory.create({ type: 'button', text: 'My button' }).renderTo(do
addButton
在TinyMCE 4中添加按钮。但当我使用addButton并为其输入标题时,编辑器中只显示一个空按钮,并显示包含标题内容的工具提示。如何添加菜单栏中实际显示的标题,如保存按钮?多亏了Eslam,我找到了解决方案
// Create and render a button to the body element
tinymce.ui.Factory.create({
type: 'button',
text: 'My button'
}).renderTo(document.body);
实际上,您只需设置addButton的“文本”值:
$('#site_content').tinymce({
setup : function(ed) {
ed.addButton('name', {
text : 'TEXT',
onclick : function() {
}
});
}
});
TinyMCE的文档在某些部分非常糟糕,如果你问我谢谢,但这只会将其呈现给正文,我希望按钮显示在菜单栏中,就像addButton一样