JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
85da621fe732cc72c57105db75b0db215c21094f
[ckeditor.git] / _source / core / ckeditor.js
1 /*\r
2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * @fileOverview Contains the third and last part of the {@link CKEDITOR} object\r
8  *              definition.\r
9  */\r
10 \r
11 // Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.\r
12 delete CKEDITOR.loadFullCore;\r
13 \r
14 /**\r
15  * Holds references to all editor instances created. The name of the properties\r
16  * in this object correspond to instance names, and their values contains the\r
17  * {@link CKEDITOR.editor} object representing them.\r
18  * @type {Object}\r
19  * @example\r
20  * alert( <b>CKEDITOR.instances</b>.editor1.name );  // "editor1"\r
21  */\r
22 CKEDITOR.instances = {};\r
23 \r
24 /**\r
25  * The document of the window holding the CKEDITOR object.\r
26  * @type {CKEDITOR.dom.document}\r
27  * @example\r
28  * alert( <b>CKEDITOR.document</b>.getBody().getName() );  // "body"\r
29  */\r
30 CKEDITOR.document = new CKEDITOR.dom.document( document );\r
31 \r
32 /**\r
33  * Adds an editor instance to the global {@link CKEDITOR} object. This function\r
34  * is available for internal use mainly.\r
35  * @param {CKEDITOR.editor} editor The editor instance to be added.\r
36  * @example\r
37  */\r
38 CKEDITOR.add = function( editor )\r
39 {\r
40         CKEDITOR.instances[ editor.name ] = editor;\r
41 \r
42         editor.on( 'focus', function()\r
43                 {\r
44                         if ( CKEDITOR.currentInstance != editor )\r
45                         {\r
46                                 CKEDITOR.currentInstance = editor;\r
47                                 CKEDITOR.fire( 'currentInstance' );\r
48                         }\r
49                 });\r
50 \r
51         editor.on( 'blur', function()\r
52                 {\r
53                         if ( CKEDITOR.currentInstance == editor )\r
54                         {\r
55                                 CKEDITOR.currentInstance = null;\r
56                                 CKEDITOR.fire( 'currentInstance' );\r
57                         }\r
58                 });\r
59 };\r
60 \r
61 /**\r
62  * Removes and editor instance from the global {@link CKEDITOR} object. his function\r
63  * is available for internal use mainly.\r
64  * @param {CKEDITOR.editor} editor The editor instance to be added.\r
65  * @example\r
66  */\r
67 CKEDITOR.remove = function( editor )\r
68 {\r
69         delete CKEDITOR.instances[ editor.name ];\r
70 };\r
71 \r
72 // Load the bootstrap script.\r
73 CKEDITOR.loader.load( 'core/_bootstrap' );              // @Packager.RemoveLine\r
74 \r
75 // Tri-state constants.\r
76 \r
77 /**\r
78  * Used to indicate the ON or ACTIVE state.\r
79  * @constant\r
80  * @example\r
81  */\r
82 CKEDITOR.TRISTATE_ON = 1;\r
83 \r
84 /**\r
85  * Used to indicate the OFF or NON ACTIVE state.\r
86  * @constant\r
87  * @example\r
88  */\r
89 CKEDITOR.TRISTATE_OFF = 2;\r
90 \r
91 /**\r
92  * Used to indicate DISABLED state.\r
93  * @constant\r
94  * @example\r
95  */\r
96 CKEDITOR.TRISTATE_DISABLED = 0;\r