简体   繁体   English

散焦鹅毛笔的文本编辑器

[英]Unfocus quill's text editor

Is there a way to unfocus? 有什么方法可以使注意力不集中吗?

I want to update the whole text format using my code and i don't want to give my user the option to write text after it. 我想使用我的代码更新整个文本格式,但我不想让用户选择在其后编写文本。 I update the format of the whole text (range: start=0, end=text length) using formatText method and then the text area on focus and the user can write:/ 我使用formatText方法更新了整个文本的格式(范围:开始= 0,结束=文本长度),然后将焦点对准文本区域,用户可以编写:/

There is not an explicit unfocus() API since there's not much that Quill needs beyond the existing DOM blur function: 没有显式的unfocus() API,因为除现有的DOM模糊功能外,Quill并不需要太多的东西:

quill.root.blur()

The user can of course click back into the editor so if you want to prevent that you can disable the whole editor with: 用户当然可以单击返回编辑器,因此,如果您要防止出现这种情况,可以使用以下方法禁用整个编辑器:

quill.editor.disable()

You may still make API calls but the user will be unable to interact with the editor while disabled. 您仍然可以进行API调用,但是在禁用后用户将无法与编辑器进行交互。

I had an issue with the cursor remaining on the screen after blur. 我有一个问题,就是光标模糊后仍留在屏幕上。 I realized that quill already has a hidden focusable element that seems to fix the problem. 我意识到,羽毛笔已经具有隐藏的可聚焦元素,似乎可以解决该问题。

quill.querySelector('.ql-clipboard').focus(); quill.querySelector('。ql-clipboard')。focus();

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

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