201c19570c2286bbdf6b4167217660020d135028
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
7 * @fileOverview Contains the third and last part of the {@link CKEDITOR} object
11 // Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
12 delete CKEDITOR
.loadFullCore
;
15 * Holds references to all editor instances created. The name of the properties
16 * in this object correspond to instance names, and their values contains the
17 * {@link CKEDITOR.editor} object representing them.
20 * alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
22 CKEDITOR
.instances
= {};
25 * The document of the window holding the CKEDITOR object.
26 * @type {CKEDITOR.dom.document}
28 * alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
30 CKEDITOR
.document
= new CKEDITOR
.dom
.document( document
);
33 * Adds an editor instance to the global {@link CKEDITOR} object. This function
34 * is available for internal use mainly.
35 * @param {CKEDITOR.editor} editor The editor instance to be added.
38 CKEDITOR
.add = function( editor
)
40 CKEDITOR
.instances
[ editor
.name
] = editor
;
42 editor
.on( 'focus', function()
44 if ( CKEDITOR
.currentInstance
!= editor
)
46 CKEDITOR
.currentInstance
= editor
;
47 CKEDITOR
.fire( 'currentInstance' );
51 editor
.on( 'blur', function()
53 if ( CKEDITOR
.currentInstance
== editor
)
55 CKEDITOR
.currentInstance
= null;
56 CKEDITOR
.fire( 'currentInstance' );
62 * Removes an editor instance from the global {@link CKEDITOR} object. This function
63 * is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
64 * to avoid memory leaks.
65 * @param {CKEDITOR.editor} editor The editor instance to be removed.
68 CKEDITOR
.remove = function( editor
)
70 delete CKEDITOR
.instances
[ editor
.name
];
74 * Perform global clean up to free as much memory as possible
75 * when there are no instances left
77 CKEDITOR
.on( 'instanceDestroyed', function ()
79 if ( CKEDITOR
.tools
.isEmpty( this.instances
) )
80 CKEDITOR
.fire( 'reset' );
83 // Load the bootstrap script.
84 CKEDITOR
.loader
.load( 'core/_bootstrap' ); // @Packager.RemoveLine
86 // Tri-state constants.
89 * Used to indicate the ON or ACTIVE state.
93 CKEDITOR
.TRISTATE_ON
= 1;
96 * Used to indicate the OFF or NON ACTIVE state.
100 CKEDITOR
.TRISTATE_OFF
= 2;
103 * Used to indicate DISABLED state.
107 CKEDITOR
.TRISTATE_DISABLED
= 0;
110 * The editor which is currently active (have user focus).
111 * @name CKEDITOR.currentInstance
112 * @type CKEDITOR.editor
113 * @see CKEDITOR#currentInstance
115 * function showCurrentEditorName()
117 * if ( CKEDITOR.currentInstance )
118 * alert( CKEDITOR.currentInstance.name );
120 * alert( 'Please focus an editor first.' );
125 * Fired when the CKEDITOR.currentInstance object reference changes. This may
126 * happen when setting the focus on different editor instances in the page.
127 * @name CKEDITOR#currentInstance
129 * var editor; // Variable to hold a reference to the current editor.
130 * CKEDITOR.on( 'currentInstance' , function( e )
132 * editor = CKEDITOR.currentInstance;
137 * Fired when the last instance has been destroyed. This event is used to perform
138 * global memory clean up.
139 * @name CKEDITOR#reset