1 /*
  2  * CKEditor - The text editor for Internet - http://ckeditor.com
  3  * Copyright (C) 2003-2008 Frederico Caldeira Knabben
  4  *
  5  * == BEGIN LICENSE ==
  6  *
  7  * Licensed under the terms of any of the following licenses at your
  8  * choice:
  9  *
 10  *  - GNU General Public License Version 2 or later (the "GPL")
 11  *    http://www.gnu.org/licenses/gpl.html
 12  *
 13  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 14  *    http://www.gnu.org/licenses/lgpl.html
 15  *
 16  *  - Mozilla Public License Version 1.1 or later (the "MPL")
 17  *    http://www.mozilla.org/MPL/MPL-1.1.html
 18  *
 19  * == END LICENSE ==
 20  */
 21
 22 /**
 23  * @fileOverview Contains the third and last part of the {@link CKEDITOR} object
 24  *		definition.
 25  */
 26
 27 // Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
 28 delete CKEDITOR.loadFullCore;
 29
 30 /**
 31  * Holds references to all editor instances created. The name of the properties
 32  * in this object correspond to instance names, and their values contains the
 33  * {@link CKEDITOR.editor} object representing them.
 34  * @type {Object}
 35  * @example
 36  * alert( <b>CKEDITOR.instances</b>.editor1.name );  // "editor1"
 37  */
 38 CKEDITOR.instances = {};
 39
 40 // Overwrite the basic _replaceElement implementation with the definitive one.
 41 CKEDITOR.replace._replaceElement = function( textarea, config )
 42 {
 43 	// Encapsulates the original DOM textarea in a CKEDITOR.dom.element
 44 	// instance.
 45 	textarea = new CKEDITOR.dom.element( textarea );
 46
 47 	// Create the editor instance.
 48 	CKEDITOR.add( new CKEDITOR.editor( textarea, config ) );
 49 };
 50
 51 /**
 52  * Adds an editor instance to the global {@link CKEDITOR} object. It also fires
 53  * the effective creation of the editor interface.
 54  * @param {CKEDITOR.editor} editor The editor instance to be added.
 55  * @type undefined
 56  * @example
 57  * var myTextarea = CKEDITOR.dom.element.getById( 'myTextarea' );
 58  * var myEditor = new CKEDITOR.editor( myTextarea );
 59  * <b>CKEDITOR.add( myEditor )</b>;
 60  */
 61 CKEDITOR.add = function( editor )
 62 {
 63 	var name = editor.name;
 64
 65 	// Abort it there is already an instance with that name.
 66 	if ( CKEDITOR.instances[ name ] )
 67 		return;
 68
 69 	CKEDITOR.instances[ name ] = editor;
 70
 71 	CKEDITOR.fire( 'instancecreated', name, editor );
 72 	editor.fireOnce( 'instancecreated' );
 73 };
 74
 75 // Set the status to "loading", which means that the main CKEDITOR object has
 76 // been created, and the rest is getting loaded.
 77 CKEDITOR.status = 'loading';
 78
 79 // Load the bootstrap script.
 80 CKEDITOR.loader.load( 'core/_bootstrap' );
 81