JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / core / editor_basic.js
index 3c4c5e3..da7ef1f 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -27,36 +27,38 @@ if ( !CKEDITOR.editor )
        CKEDITOR.ELEMENT_MODE_APPENDTO = 2;\r
 \r
        /**\r
-        * Represents an editor instance. This constructor should be rarely used,\r
-        * being the {@link CKEDITOR} methods preferible.\r
-        * @constructor\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.\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 )\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
+                       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><b>CKEDITOR.ELEMENT_MODE_NONE</b>: No element is linked to the\r
+                * <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the\r
                 *              editor instance.</li>\r
-                * <li><b>CKEDITOR.ELEMENT_MODE_REPLACE</b>: The element is to be\r
+                * <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be\r
                 *              replaced by the editor instance.</li>\r
-                * <li><b>CKEDITOR.ELEMENT_MODE_APPENDTO</b>: The editor is to be\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
@@ -96,6 +98,10 @@ if ( !CKEDITOR.editor )
                        // 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
@@ -126,10 +132,11 @@ if ( !CKEDITOR.editor )
         * @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 )\r
+       CKEDITOR.editor.appendTo = function( elementOrId, config, data )\r
        {\r
                var element = elementOrId;\r
                if ( typeof element != 'object' )\r
@@ -141,7 +148,7 @@ if ( !CKEDITOR.editor )
                }\r
 \r
                // Create the editor instance.\r
-               return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO );\r
+               return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );\r
        };\r
 \r
        CKEDITOR.editor.prototype =\r