我正在使用tinymce,内联模式,在某些情况下,我需要能够使用javascript显示/隐藏事件编辑器的工具栏。 它应该是这样的:
tinymce.activeEditor.getToolbar() // getToolbar doesn't exist
只是给定了一个编辑器实例,我找不到任何方法来获取对其工具栏的引用。
另请注意,页面上可能有多个工具栏,但在任何给定时间仅显示一个。
工具栏初始化如下:
tinymce.init({
selector: "#" + id,
menubar: false,
inline: true,
theme: "modern",
oninit: "setPlainText"
...
谢谢。
最佳答案
有一个discussion about this on the TinyMCE forum 。它建议:
...
setup: function (theEditor) {
theEditor.on('focus', function () {
$(this.contentAreaContainer.parentElement).find("div.mce-toolbar-grp").show();
});
theEditor.on('blur', function () {
$(this.contentAreaContainer.parentElement).find("div.mce-toolbar-grp").hide();
});
theEditor.on("init", function() {
$(this.contentAreaContainer.parentElement).find("div.mce-toolbar-grp").hide();
});
}
...
关于javascript - 使用tinyMCE时,有没有办法从编辑器实例获取对工具栏的引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30826797/