Ticket #4445: 4445.patch

File 4445.patch, 3.5 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    214214                                        var mainElement,
    215215                                                fieldset,
    216216                                                iframe,
    217                                                 isLoadingData,
    218217                                                isPendingFocus,
    219218                                                frameLoaded,
    220219                                                fireMode;
     
    448447                                                                        fireMode = false;
    449448                                                                }
    450449
    451                                                                 isLoadingData = false;
     450                                                                delete editor._.isLoadingData;
    452451
    453452                                                                if ( isPendingFocus )
    454453                                                                {
     
    503502
    504503                                                        loadData : function( data )
    505504                                                        {
    506                                                                 isLoadingData = true;
     505                                                                editor._.isLoadingData = true;
    507506
    508507                                                                // Get the HTML version of the data.
    509508                                                                if ( editor.dataProcessor )
     
    573572
    574573                                                        focus : function()
    575574                                                        {
    576                                                                 if ( isLoadingData )
     575                                                                if ( editor._.isLoadingData )
    577576                                                                        isPendingFocus = true;
    578577                                                                else if ( editor.window )
    579578                                                                {
  • _source/plugins/newpage/plugin.js

     
    1919                                exec : function( editor )
    2020                                {
    2121                                        var command = this;
    22                                         function afterCommand()
     22                                        editor.setData( editor.config.newpage_html, function()
    2323                                        {
    24                                                 // Defer to happen after 'selectionChange'.
    25                                                 setTimeout( function()
    26                                                 {
    27                                                         editor.fire( 'afterCommandExec',
    28                                                         {
    29                                                                 name: command.name,
    30                                                                 command: command
    31                                                         } );
    32                                                 }, 500 );
    33                                         }
    34                                         if ( editor.mode == 'wysiwyg')
    35                                                 editor.on( 'contentDom', function( evt ){
    36 
    37                                                         evt.removeListener();
    38                                 afterCommand();
    39                                                 } );
    40 
    41                                         editor.setData( editor.config.newpage_html );
     24                                                editor.fire( 'afterCommandExec',
     25                                                {
     26                                                        name: command.name,
     27                                                        command: command
     28                                                } );
     29                                        } );
    4230                                        editor.focus();
    43 
    44                                         if( editor.mode == 'source' )
    45                                                 afterCommand();
    46 
    4731                                },
    4832                                async : true
    4933                        });
  • _source/core/editor.js

     
    567567                /**
    568568                 * Sets the editor data. The data must be provided in raw format.
    569569                 * @param {String} data HTML code to replace the curent content in the editor.
     570                 * @param {Function} callback Function to be called after the setData is completed.
    570571                 * @example
    571572                 * CKEDITOR.instances.editor1.<b>setData( '&lt;p&gt;This is the editor data.&lt;/p&gt;' )</b>;
     573                 * CKEDITOR.instances.editor1.setData( '&lt;p&gt;Some other editor data.&lt;/p&gt;', function()
     574                 * {
     575                 *              CKEDITOR.instances.editor1.checkDirty();        // true
     576                 * } );
    572577                 */
    573                 setData : function( data )
     578                setData : function( data , callback )
    574579                {
    575580                        // Fire "setData" so data manipulation may happen.
    576581                        var eventData = { dataValue : data };
     
    579584                        this._.data = eventData.dataValue;
    580585
    581586                        this.fire( 'afterSetData', eventData );
     587
     588                        if( callback )
     589                        {
     590                                if( this._.isLoadingData )
     591                                        this.on( 'contentDom', function( evt )
     592                                        {
     593                                                // A short delay to make sure cursor
     594                                                // has started blinking.
     595                                                setTimeout( callback, 300 );
     596                                        } );
     597                                else
     598                                        callback();
     599                        }
    582600                },
    583601
    584602                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy