我在串联模式下使用CKEditor。我正在使用以下方法聚焦并立即模糊(用于测试):
var editor = CKEDITOR.dom.element.get( e.currentTarget.getDOMNode());
editor.getEditor().focus();
editor.getEditor().focusManager.blur(true);
我想模糊编辑器,focusManger.blur(true)
导致工具栏被隐藏。但是,插入符号仍处于聚焦状态。由于某种原因,我找不到散焦和移除插入符号的方法。我尝试在另一个DOM元素上调用focus()
,但是插入符号仍然存在。
如何呼叫blur()
来删除插入符号?
这还不够吗?
editor.editable().$.blur();
它对我有用。
我能够解决此问题的唯一方法是模糊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
另一种更适合我的较短方法:
editor.window.$.frameElement.blur();