X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Ffocusmanager.js;h=3f276c5e8104afc0a2623346177d8dacee98e3d5;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=cf4e50f2eec4d8791749e8e7db5121721749df68;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/core/focusmanager.js b/_source/core/focusmanager.js index cf4e50f..3f276c5 100644 --- a/_source/core/focusmanager.js +++ b/_source/core/focusmanager.js @@ -9,11 +9,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ /** - * Manages the focus activity in an editor instance. This class is to be used - * mainly by UI elements coders when adding interface elements to CKEditor. - * @constructor + * Creates a focusManager class instance. + * @class Manages the focus activity in an editor instance. This class is to be + * used mainly by UI elements coders when adding interface elements that need + * to set the focus state of the editor. * @param {CKEDITOR.editor} editor The editor instance. * @example + * var focusManager = new CKEDITOR.focusManager( editor ); + * focusManager.focus(); */ CKEDITOR.focusManager = function( editor ) { @@ -43,9 +46,10 @@ CKEDITOR.focusManager = function( editor ) CKEDITOR.focusManager.prototype = { /** - * Indicates that the editor instance has the focus. - * - * This function is not used to set the focus in the editor. Use + * Used to indicate that the editor instance has the focus.
+ *
+ * Note that this function will not explicitelly set the focus in the + * editor (for example, making the caret blinking on it). Use * {@link CKEDITOR.editor#focus} for it instead. * @example * var editor = CKEDITOR.instances.editor1; @@ -68,7 +72,7 @@ CKEDITOR.focusManager.prototype = var editor = this._.editor; - editor.container.getFirst().addClass( 'cke_focus' ); + editor.container.getChild( 1 ).addClass( 'cke_focus' ); this.hasFocus = true; editor.fire( 'focus' ); @@ -76,10 +80,11 @@ CKEDITOR.focusManager.prototype = }, /** - * Indicates that the editor instance has lost the focus. Note that this - * functions acts asynchronously with a delay of 100ms to avoid subsequent - * blur/focus effects. If you want the "blur" to happen immediately, use - * the {@link #forceBlur} function instead. + * Used to indicate that the editor instance has lost the focus.
+ *
+ * Note that this functions acts asynchronously with a delay of 100ms to + * avoid subsequent blur/focus effects. If you want the "blur" to happen + * immediately, use the {@link #forceBlur} function instead. * @example * var editor = CKEDITOR.instances.editor1; * editor.focusManager.blur(); @@ -101,7 +106,7 @@ CKEDITOR.focusManager.prototype = }, /** - * Indicates that the editor instance has lost the focus. Unlike + * Used to indicate that the editor instance has lost the focus. Unlike * {@link #blur}, this function is synchronous, marking the instance as * "blured" immediately. * @example @@ -114,10 +119,34 @@ CKEDITOR.focusManager.prototype = { var editor = this._.editor; - editor.container.getFirst().removeClass( 'cke_focus' ); + editor.container.getChild( 1 ).removeClass( 'cke_focus' ); this.hasFocus = false; editor.fire( 'blur' ); } } }; + +/** + * Fired when the editor instance receives the input focus. + * @name CKEDITOR.editor#focus + * @event + * @param {CKEDITOR.editor} editor The editor instance. + * @example + * editor.on( 'focus', function( e ) + * { + * alert( 'The editor named ' + e.editor.name + ' is now focused' ); + * }); + */ + +/** + * Fired when the editor instance loses the input focus. + * @name CKEDITOR.editor#blur + * @event + * @param {CKEDITOR.editor} editor The editor instance. + * @example + * editor.on( 'blur', function( e ) + * { + * alert( 'The editor named ' + e.editor.name + ' lost the focus' ); + * }); + */