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 /** 41 * The document of the window holding the CKEDITOR object. 42 * @type {CKEDITOR.dom.document} 43 * @example 44 * alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body" 45 */ 46 CKEDITOR.document = new CKEDITOR.dom.document( document ); 47 48 // Overwrite the basic _replaceElement implementation with the definitive one. 49 CKEDITOR.replace._replaceElement = function( textarea, config ) 50 { 51 // Encapsulates the original DOM textarea in a CKEDITOR.dom.element 52 // instance. 53 textarea = new CKEDITOR.dom.element( textarea ); 54 55 // Create the editor instance. 56 CKEDITOR.add( new CKEDITOR.editor( textarea, config ) ); 57 }; 58 59 /** 60 * Adds an editor instance to the global {@link CKEDITOR} object. It also fires 61 * the effective creation of the editor interface. 62 * @param {CKEDITOR.editor} editor The editor instance to be added. 63 * @type undefined 64 * @example 65 * var myTextarea = CKEDITOR.document.getById( 'myTextarea' ); 66 * var myEditor = new CKEDITOR.editor( myTextarea ); 67 * <b>CKEDITOR.add( myEditor )</b>; 68 */ 69 CKEDITOR.add = function( editor ) 70 { 71 var name = editor.name; 72 73 // Abort it there is already an instance with that name. 74 if ( CKEDITOR.instances[ name ] ) 75 return; 76 77 CKEDITOR.instances[ name ] = editor; 78 79 CKEDITOR.fire( 'instancecreated', name, editor ); 80 editor.fireOnce( 'instancecreated' ); 81 }; 82 83 CKEDITOR.status = 'loaded'; 84 85 // Load the bootstrap script. 86 CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine 87