繁体   English   中英

单击编辑器上的工具栏按钮时,不将焦点放在 Froala editor.$el (textarea) 的编程方法是什么

[英]What is the programmatic approach to not give focus to the Froala editor.$el (textarea) when clicking a toolbar button on the editor

目前我正在努力理解,单击工具栏按钮时最好不要将焦点放在Froala编辑器上?

我试图通过事件访问编辑器,但我无法让它工作,我不确定这是正确的选择

    new FroalaEditor(".froala_editor", {    
      events: {
        'toolbar.focusEditor': function () {
          alert("hello")
          console.log(this);
        }
      }
    }); 

我们有editor.button.bindCommands()但我也不明白这一点。

我可以去上班的是

    var editor = new FroalaEditor(".froala_editor", {}, function () {
      $("button#moreText-1").click(function() {
          editor.$el.blur()
      });
    });

现在,当我单击moreText按钮时,似乎现在没有对编辑器的关注并且插入符号没有显示。

但是有没有更多api类型的方法来做到这一点。 例如,必须触发一个事件以将textarea聚焦在单击上,那么确保textarea没有获得焦点然后变得模糊的最佳方法是什么。

在 Froala 富文本编辑器获得焦点后触发。

new FroalaEditor('.selector', {
  events: {
    'focus': function () {
      // Do something here.
      // this is the editor instance.
      console.log(this);
    })
  }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM