gpt4 book ai didi

javascript - 单击编辑器上的工具栏按钮时不将焦点集中到 Froala 编辑器的编程方法是什么。$el(文本区域)

转载 作者:行者123 更新时间:2023-12-02 22:12:27 26 4
gpt4 key购买 nike

目前我正在努力理解,单击工具栏按钮时哪种方式最好不将焦点集中在 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);
})
}
});

关于javascript - 单击编辑器上的工具栏按钮时不将焦点集中到 Froala 编辑器的编程方法是什么。$el(文本区域),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59517463/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com