سؤال

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);

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.

How can I call blur() to remove the caret as well?

هل كانت مفيدة؟

المحلول 2

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

نصائح أخرى

Isn't this enough?

editor.editable().$.blur();

It works for me.

Another more shorter way that works for me:

editor.window.$.frameElement.blur();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top