JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.2
[ckeditor.git] / _source / core / focusmanager.js
index 0a3f514..3f276c5 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -9,11 +9,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  */\r
 \r
 /**\r
- * Manages the focus activity in an editor instance. This class is to be used\r
- * mainly by UI elements coders when adding interface elements to CKEditor.\r
- * @constructor\r
+ * Creates a focusManager class instance.\r
+ * @class Manages the focus activity in an editor instance. This class is to be\r
+ * used mainly by UI elements coders when adding interface elements that need\r
+ * to set the focus state of the editor.\r
  * @param {CKEDITOR.editor} editor The editor instance.\r
  * @example\r
+ * var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;\r
+ * focusManager.focus();\r
  */\r
 CKEDITOR.focusManager = function( editor )\r
 {\r
@@ -43,9 +46,10 @@ CKEDITOR.focusManager = function( editor )
 CKEDITOR.focusManager.prototype =\r
 {\r
        /**\r
-        * Indicates that the editor instance has the focus.\r
-        *\r
-        * This function is not used to set the focus in the editor. Use\r
+        * Used to indicate that the editor instance has the focus.<br />\r
+        * <br />\r
+        * Note that this function will not explicitelly set the focus in the\r
+        * editor (for example, making the caret blinking on it). Use\r
         * {@link CKEDITOR.editor#focus} for it instead.\r
         * @example\r
         * var editor = CKEDITOR.instances.editor1;\r
@@ -68,7 +72,7 @@ CKEDITOR.focusManager.prototype =
 \r
                        var editor = this._.editor;\r
 \r
-                       editor.container.getFirst().addClass( 'cke_focus' );\r
+                       editor.container.getChild( 1 ).addClass( 'cke_focus' );\r
 \r
                        this.hasFocus = true;\r
                        editor.fire( 'focus' );\r
@@ -76,10 +80,11 @@ CKEDITOR.focusManager.prototype =
        },\r
 \r
        /**\r
-        * Indicates that the editor instance has lost the focus. Note that this\r
-        * functions acts asynchronously with a delay of 100ms to avoid subsequent\r
-        * blur/focus effects. If you want the "blur" to happen immediately, use\r
-        * the {@link #forceBlur} function instead.\r
+        * Used to indicate that the editor instance has lost the focus.<br />\r
+        * <br />\r
+        * Note that this functions acts asynchronously with a delay of 100ms to\r
+        * avoid subsequent blur/focus effects. If you want the "blur" to happen\r
+        * immediately, use the {@link #forceBlur} function instead.\r
         * @example\r
         * var editor = CKEDITOR.instances.editor1;\r
         * <b>editor.focusManager.blur()</b>;\r
@@ -101,7 +106,7 @@ CKEDITOR.focusManager.prototype =
        },\r
 \r
        /**\r
-        * Indicates that the editor instance has lost the focus. Unlike\r
+        * Used to indicate that the editor instance has lost the focus. Unlike\r
         * {@link #blur}, this function is synchronous, marking the instance as\r
         * "blured" immediately.\r
         * @example\r
@@ -114,10 +119,34 @@ CKEDITOR.focusManager.prototype =
                {\r
                        var editor = this._.editor;\r
 \r
-                       editor.container.getFirst().removeClass( 'cke_focus' );\r
+                       editor.container.getChild( 1 ).removeClass( 'cke_focus' );\r
 \r
                        this.hasFocus = false;\r
                        editor.fire( 'blur' );\r
                }\r
        }\r
 };\r
+\r
+/**\r
+ * Fired when the editor instance receives the input focus.\r
+ * @name CKEDITOR.editor#focus\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor The editor instance.\r
+ * @example\r
+ * editor.on( 'focus', function( e )\r
+ *     {\r
+ *         alert( 'The editor named ' + e.editor.name + ' is now focused' );\r
+ *     });\r
+ */\r
+\r
+/**\r
+ * Fired when the editor instance loses the input focus.\r
+ * @name CKEDITOR.editor#blur\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor The editor instance.\r
+ * @example\r
+ * editor.on( 'blur', function( e )\r
+ *     {\r
+ *         alert( 'The editor named ' + e.editor.name + ' lost the focus' );\r
+ *     });\r
+ */\r