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