Javascript 我如何在焦点事件中抓住Frola编辑?

Javascript 我如何在焦点事件中抓住Frola编辑?,javascript,wysiwyg,addeventlistener,onfocus,froala,Javascript,Wysiwyg,Addeventlistener,Onfocus,Froala,我必须在焦点事件上为froala编辑器创建一个eventListener函数。但我在上找不到任何事件回调,也找不到此编辑器结构的任何输入元素 这是重点结构快照 怎么做我通过尝试和错误的方法发布了我的问题后,找到了一个解决方案。 jQuery的focusin函数捕获任何元素的焦点事件 这是测试代码: $("#editor").focusin(function(){ console.log("edito

我必须在焦点事件上为froala编辑器创建一个eventListener函数。但我在上找不到任何事件回调,也找不到此编辑器结构的任何输入元素

这是重点结构快照


怎么做

我通过尝试和错误的方法发布了我的问题后,找到了一个解决方案。 jQuery的focusin函数捕获任何元素的焦点事件

这是测试代码:

      $("#editor").focusin(function(){ 
                                         console.log("editor is focused");                       
                }).focusout(function(){
                                         console.log("editor is blured"); 
                 });

我找到了一个解决方案后,张贴我的问题,通过尝试和错误的方法。 jQuery的focusin函数捕获任何元素的焦点事件

这是测试代码:

      $("#editor").focusin(function(){ 
                                         console.log("editor is focused");                       
                }).focusout(function(){
                                         console.log("editor is blured"); 
                 });
根据,你写下:

$(".selector").on('editable.focus', function (e, editor) {
  // editor focused
});
和模糊:

$(".selector").on('editable.blur', function (e, editor) {
  // editor blurred
});
要分离焦点事件,请执行以下操作:

$(".selector").off('editable.focus');

$(".selector").off('editable.blur');
根据,你写下:

$(".selector").on('editable.focus', function (e, editor) {
  // editor focused
});
和模糊:

$(".selector").on('editable.blur', function (e, editor) {
  // editor blurred
});
要分离焦点事件,请执行以下操作:

$(".selector").off('editable.focus');

$(".selector").off('editable.blur');

“.selector”应该是Froala编辑器元素或目标元素的选择器?仅供其他人参考,对于react variant,如果您在“events”键下的编辑器配置对象中传递它,那么如何从编辑器对象获取新的/更改的HTML?更新:找到了,新的HTML位于editor.el.innerHTML'.selector'应该是Froala编辑器元素或目标元素的选择器?仅供参考,对于其他人,如果您将其传递到编辑器配置对象中的'events'键下,使用此回调,如何从编辑器对象获取新的/更改的HTML?更新:弄明白了,新的HTML位于editor.el.innerHTML