X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Ffocusmanager.js;h=3f276c5e8104afc0a2623346177d8dacee98e3d5;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=749de6d6aecbd3d451d52355f058ac7d6b64d1d3;hpb=c6e377a02b54abc07129d72b632763c727476a15;p=ckeditor.git diff --git a/_source/core/focusmanager.js b/_source/core/focusmanager.js index 749de6d..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,7 +119,7 @@ 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' ); @@ -127,6 +132,11 @@ CKEDITOR.focusManager.prototype = * @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' ); + * }); */ /** @@ -134,4 +144,9 @@ CKEDITOR.focusManager.prototype = * @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' ); + * }); */