X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Feditor_basic.js;h=da7ef1ff07da58c31a02408c720c1ae1ff1f23ab;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=3c4c5e32e5b78da2c925b987b7f9925ca0dfac46;hpb=c6e377a02b54abc07129d72b632763c727476a15;p=ckeditor.git diff --git a/_source/core/editor_basic.js b/_source/core/editor_basic.js index 3c4c5e3..da7ef1f 100644 --- a/_source/core/editor_basic.js +++ b/_source/core/editor_basic.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -27,36 +27,38 @@ if ( !CKEDITOR.editor ) CKEDITOR.ELEMENT_MODE_APPENDTO = 2; /** - * Represents an editor instance. This constructor should be rarely used, - * being the {@link CKEDITOR} methods preferible. - * @constructor + * Creates an editor class instance. This constructor should be rarely + * used, in favor of the {@link CKEDITOR} editor creation functions. + * @ class Represents an editor instance. * @param {Object} instanceConfig Configuration values for this specific * instance. * @param {CKEDITOR.dom.element} [element] The element linked to this * instance. * @param {Number} [mode] The mode in which the element is linked to this - * instance. + * instance. See {@link #elementMode}. + * @param {String} [data] Since 3.3. Initial value for the instance. * @augments CKEDITOR.event * @example */ - CKEDITOR.editor = function( instanceConfig, element, mode ) + CKEDITOR.editor = function( instanceConfig, element, mode, data ) { this._ = { // Save the config to be processed later by the full core code. instanceConfig : instanceConfig, - element : element + element : element, + data : data }; /** * The mode in which the {@link #element} is linked to this editor * instance. It can be any of the following values: * * @name CKEDITOR.editor.prototype.elementMode @@ -96,6 +98,10 @@ if ( !CKEDITOR.editor ) // Look for the element by id. We accept any kind of element here. element = document.getElementById( elementOrIdOrName ); + // Elements that should go into head are unacceptable (#6791). + if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} ) + element = null; + // If not found, look for elements by name. In this case we accept only // textareas. if ( !element ) @@ -126,10 +132,11 @@ if ( !CKEDITOR.editor ) * @param {Object} [config] The specific configurations to apply to this * editor instance. Configurations set here will override global CKEditor * settings. + * @param {String} [data] Since 3.3. Initial value for the instance. * @returns {CKEDITOR.editor} The editor instance created. * @example */ - CKEDITOR.editor.appendTo = function( elementOrId, config ) + CKEDITOR.editor.appendTo = function( elementOrId, config, data ) { var element = elementOrId; if ( typeof element != 'object' ) @@ -141,7 +148,7 @@ if ( !CKEDITOR.editor ) } // Create the editor instance. - return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO ); + return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data ); }; CKEDITOR.editor.prototype =