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