X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Ffocusmanager.js;h=812bc9b5fde1861bb87533f28c992429544ce071;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=0a3f5146b7a91aecf0ea4118aa2657e114392392;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/core/focusmanager.js b/_source/core/focusmanager.js index 0a3f514..812bc9b 100644 --- a/_source/core/focusmanager.js +++ b/_source/core/focusmanager.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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' ); + * }); + */