Jquery TinyMCE焦点上显示菜单
我对我的项目很感兴趣 我有两个文本区域。我只需要显示活动控件。 我有两个选择:Jquery TinyMCE焦点上显示菜单,jquery,jquery-ui,tinymce,tinymce-4,tinymce-3,Jquery,Jquery Ui,Tinymce,Tinymce 4,Tinymce 3,我对我的项目很感兴趣 我有两个文本区域。我只需要显示活动控件。 我有两个选择: 两者都有一个共同的控制 隐藏非活动编辑器的控件 我想不出第一个选择。 我采用了第二种方法 现在我可以在编辑器聚焦时触发事件。 我需要帮助删除菜单和工具从编辑器时,它失去了重点 以下是我如何处理第二个选项的代码: setup : function(ed) { ed.on("focusout", function() { tinyMCE.activeEditor.e
setup : function(ed) {
ed.on("focusout", function() {
tinyMCE.activeEditor.execCommand('mceSetAttribute','toolbar','false');
console.log(tinyMCE.activeEditor.execCommand('mceSetAttribute','toolbar','false'));
});
ed.on("focus", function() {
});
}
这适用于tinyMCE 4(假设您使用的是jQuery):
次要说明:如果使用AngularJS,您也可以使用
angular.element(…)
代替$(…)
。我确信在“聚焦输出”代码部分中所做的任何事情都是错误的。如果有人能告诉我应该是什么代码,我将不胜感激。这里没有focuout
事件,但有blur
事件
setup: function(editor) {
editor.on("init", function() {
editor.contentParent = $(this.contentAreaContainer.parentElement);
editor.contentParent.find("div.mce-toolbar-grp").hide();
});
editor.on('focus', function () {
editor.contentParent.find("div.mce-toolbar-grp").show();
});
editor.on('blur', function () {
editor.contentParent.find("div.mce-toolbar-grp").hide();
});
}