+++ /dev/null
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-if ( !CKEDITOR.editor )\r
-{\r
- /**\r
- * No element is linked to the editor instance.\r
- * @constant\r
- * @example\r
- */\r
- CKEDITOR.ELEMENT_MODE_NONE = 0;\r
-\r
- /**\r
- * The element is to be replaced by the editor instance.\r
- * @constant\r
- * @example\r
- */\r
- CKEDITOR.ELEMENT_MODE_REPLACE = 1;\r
-\r
- /**\r
- * The editor is to be created inside the element.\r
- * @constant\r
- * @example\r
- */\r
- CKEDITOR.ELEMENT_MODE_APPENDTO = 2;\r
-\r
- /**\r
- * Creates an editor class instance. This constructor should be rarely\r
- * used, in favor of the {@link CKEDITOR} editor creation functions.\r
- * @ class Represents an editor instance.\r
- * @param {Object} instanceConfig Configuration values for this specific\r
- * instance.\r
- * @param {CKEDITOR.dom.element} [element] The element linked to this\r
- * instance.\r
- * @param {Number} [mode] The mode in which the element is linked to this\r
- * instance. See {@link #elementMode}.\r
- * @param {String} [data] Since 3.3. Initial value for the instance.\r
- * @augments CKEDITOR.event\r
- * @example\r
- */\r
- CKEDITOR.editor = function( instanceConfig, element, mode, data )\r
- {\r
- this._ =\r
- {\r
- // Save the config to be processed later by the full core code.\r
- instanceConfig : instanceConfig,\r
- element : element,\r
- data : data\r
- };\r
-\r
- /**\r
- * The mode in which the {@link #element} is linked to this editor\r
- * instance. It can be any of the following values:\r
- * <ul>\r
- * <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the\r
- * editor instance.</li>\r
- * <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be\r
- * replaced by the editor instance.</li>\r
- * <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be\r
- * created inside the element.</li>\r
- * </ul>\r
- * @name CKEDITOR.editor.prototype.elementMode\r
- * @type Number\r
- * @example\r
- * var editor = CKEDITOR.replace( 'editor1' );\r
- * alert( <b>editor.elementMode</b> ); "1"\r
- */\r
- this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;\r
-\r
- // Call the CKEDITOR.event constructor to initialize this instance.\r
- CKEDITOR.event.call( this );\r
-\r
- this._init();\r
- };\r
-\r
- /**\r
- * Replaces a <textarea> or a DOM element (DIV) with a CKEditor\r
- * instance. For textareas, the initial value in the editor will be the\r
- * textarea value. For DOM elements, their innerHTML will be used\r
- * instead. We recommend using TEXTAREA and DIV elements only. Do not use\r
- * this function directly. Use {@link CKEDITOR.replace} instead.\r
- * @param {Object|String} elementOrIdOrName The DOM element (textarea), its\r
- * ID or name.\r
- * @param {Object} [config] The specific configurations to apply to this\r
- * editor instance. Configurations set here will override global CKEditor\r
- * settings.\r
- * @returns {CKEDITOR.editor} The editor instance created.\r
- * @example\r
- */\r
- CKEDITOR.editor.replace = function( elementOrIdOrName, config )\r
- {\r
- var element = elementOrIdOrName;\r
-\r
- if ( typeof element != 'object' )\r
- {\r
- // Look for the element by id. We accept any kind of element here.\r
- element = document.getElementById( elementOrIdOrName );\r
-\r
- // Elements that should go into head are unacceptable (#6791).\r
- if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )\r
- element = null;\r
-\r
- // If not found, look for elements by name. In this case we accept only\r
- // textareas.\r
- if ( !element )\r
- {\r
- var i = 0,\r
- textareasByName = document.getElementsByName( elementOrIdOrName );\r
-\r
- while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )\r
- { /*jsl:pass*/ }\r
- }\r
-\r
- if ( !element )\r
- throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';\r
- }\r
-\r
- // Do not replace the textarea right now, just hide it. The effective\r
- // replacement will be done by the _init function.\r
- element.style.visibility = 'hidden';\r
-\r
- // Create the editor instance.\r
- return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );\r
- };\r
-\r
- /**\r
- * Creates a new editor instance inside a specific DOM element. Do not use\r
- * this function directly. Use {@link CKEDITOR.appendTo} instead.\r
- * @param {Object|String} elementOrId The DOM element or its ID.\r
- * @param {Object} [config] The specific configurations to apply to this\r
- * editor instance. Configurations set here will override global CKEditor\r
- * settings.\r
- * @param {String} [data] Since 3.3. Initial value for the instance.\r
- * @returns {CKEDITOR.editor} The editor instance created.\r
- * @example\r
- */\r
- CKEDITOR.editor.appendTo = function( elementOrId, config, data )\r
- {\r
- var element = elementOrId;\r
- if ( typeof element != 'object' )\r
- {\r
- element = document.getElementById( elementOrId );\r
-\r
- if ( !element )\r
- throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';\r
- }\r
-\r
- // Create the editor instance.\r
- return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );\r
- };\r
-\r
- CKEDITOR.editor.prototype =\r
- {\r
- /**\r
- * Initializes the editor instance. This function will be overriden by the\r
- * full CKEDITOR.editor implementation (editor.js).\r
- * @private\r
- */\r
- _init : function()\r
- {\r
- var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );\r
- pending.push( this );\r
- },\r
-\r
- // Both fire and fireOnce will always pass this editor instance as the\r
- // "editor" param in CKEDITOR.event.fire. So, we override it to do that\r
- // automaticaly.\r
-\r
- /** @ignore */\r
- fire : function( eventName, data )\r
- {\r
- return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );\r
- },\r
-\r
- /** @ignore */\r
- fireOnce : function( eventName, data )\r
- {\r
- return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );\r
- }\r
- };\r
-\r
- // "Inherit" (copy actually) from CKEDITOR.event.\r
- CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );\r
-}\r