如何在CKEditor中模糊插入符号? [英] How to blur caret in CKEditor?
问题描述
我在串联模式下使用CKEditor.我正在使用以下方法聚焦并立即模糊(用于测试):
I am using CKEditor in inline mode. I am focusing and immediately blurring (for testing) using the following:
var editor = CKEDITOR.dom.element.get( e.currentTarget.getDOMNode());
editor.getEditor().focus();
editor.getEditor().focusManager.blur(true);
我想模糊编辑器,并且focusManger.blur(true)
导致工具栏被隐藏.但是,插入符号仍处于聚焦状态.由于某种原因,我找不到散焦和移除插入符号的方法.我尝试在另一个DOM元素上调用focus()
,但是插入符号仍然存在.
I want to blur the editor and focusManger.blur(true)
results in the toolbar being hidden. However, the caret is still focused. For some reason, I cannot find a way to defocus and remove the caret. I have tried calling focus()
on another DOM element, but the caret still persists.
如何致电blur()
删除插入符号?
How can I call blur()
to remove the caret as well?
推荐答案
我能够解决此问题的唯一方法是模糊contenteditable
div:
The only way I was able to solve this is to blur the contenteditable
div:
CKEDITOR.currentInstance.element.$; //Grab the DOM node which is the contenteditable
CKEDITOR.currentInstance.element.$.blur(); //Blur it
CKEDITOR.currentInstance.focusManager.blur(true); //CKEditor's blur hides the toolbar
这篇关于如何在CKEditor中模糊插入符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!