Ticket #5216: 5216.patch

File 5216.patch, 4.0 KB (added by Alfonso Martínez de Lizarrondo, 15 years ago)

Proposed patch

  • _samples/ajax.html

     
    2626
    2727        var html = document.getElementById( 'editorcontents' ).innerHTML;
    2828
    29         // Create a new editor inside the <div id="editor">
    30         editor = CKEDITOR.appendTo( 'editor' );
    31         editor.setData( html );
    32 
    33         // This sample may break here if the ckeditor_basic.js is used. In such case, the following code should be used instead:
    34         /*
    35         if ( editor.setData )
    36                 editor.setData( html );
    37         else
    38         {
    39                 CKEDITOR.on( 'loaded', function()
    40                         {
    41                                 editor.setData( html );
    42                         });
    43         }
    44         */
     29        // Create a new editor inside the <div id="editor">, setting its value to html
     30        editor = CKEDITOR.appendTo( 'editor', null, html );
    4531}
    4632
    4733function removeEditor()
  • _source/core/ckeditor_basic.js

     
    8080                 */
    8181                CKEDITOR.replaceByClassEnabled = true;
    8282
    83                 var createInstance = function( elementOrIdOrName, config, creationFunction )
     83                var createInstance = function( elementOrIdOrName, config, creationFunction, data )
    8484                {
    8585                        if ( CKEDITOR.env.isCompatible )
    8686                        {
     
    8888                                if ( CKEDITOR.loadFullCore )
    8989                                        CKEDITOR.loadFullCore();
    9090
    91                                 var editor = creationFunction( elementOrIdOrName, config );
     91                                var editor = creationFunction( elementOrIdOrName, config, data );
    9292                                CKEDITOR.add( editor );
    9393                                return editor;
    9494                        }
     
    126126                 * @param {Object} [config] The specific configurations to apply to this
    127127                 *              editor instance. Configurations set here will override global CKEditor
    128128                 *              settings.
     129                 * @param {String} [data] Since 3.3. Initial value for the instance.
    129130                 * @returns {CKEDITOR.editor} The editor instance created.
    130131                 * @example
    131132                 * &lt;div id="editorSpace"&gt;&lt:/div&gt;
    132133                 * ...
    133134                 * <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
    134135                 */
    135                 CKEDITOR.appendTo = function( elementOrId, config )
     136                CKEDITOR.appendTo = function( elementOrId, config, data )
    136137                {
    137                         return createInstance( elementOrId, config, CKEDITOR.editor.appendTo );
     138                        return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
    138139                };
    139140
    140141                /**
  • _source/core/editor_basic.js

     
    3636         *              instance.
    3737         * @param {Number} [mode] The mode in which the element is linked to this
    3838         *              instance.
     39         * @param {String} [data] Since 3.3. Initial value for the instance.
    3940         * @augments CKEDITOR.event
    4041         * @example
    4142         */
    42         CKEDITOR.editor = function( instanceConfig, element, mode )
     43        CKEDITOR.editor = function( instanceConfig, element, mode, data )
    4344        {
    4445                this._ =
    4546                {
    4647                        // Save the config to be processed later by the full core code.
    4748                        instanceConfig : instanceConfig,
    48                         element : element
     49                        element : element,
     50                        data : data
    4951                };
    5052
    5153                /**
     
    126128         * @param {Object} [config] The specific configurations to apply to this
    127129         *              editor instance. Configurations set here will override global CKEditor
    128130         *              settings.
     131         * @param {String} [data] Since 3.3. Initial value for the instance.
    129132         * @returns {CKEDITOR.editor} The editor instance created.
    130133         * @example
    131134         */
    132         CKEDITOR.editor.appendTo = function( elementOrId, config )
     135        CKEDITOR.editor.appendTo = function( elementOrId, config, data )
    133136        {
    134137                var element = elementOrId;
    135138                if ( typeof element != 'object' )
     
    141144                }
    142145
    143146                // Create the editor instance.
    144                 return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO );
     147                return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
    145148        };
    146149
    147150        CKEDITOR.editor.prototype =
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy