Ticket #6390: 6390_2.patch

File 6390_2.patch, 2.8 KB (added by Garry Yao, 13 years ago)
  • _source/core/scriptloader.js

     
    1616CKEDITOR.scriptLoader = (function()
    1717{
    1818        var uniqueScripts = {},
    19                 waitingList = {};
     19                waitingList = {},
     20                isBusy = 0;
    2021
    2122        return /** @lends CKEDITOR.scriptLoader */ {
    2223                /**
     
    9091
    9192                                if ( --scriptCount <= 0 )
    9293                                {
    93                                         showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
     94                                        isBusy = 0, showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
    9495                                        doCallback( success );
    9596                                }
    9697                        };
     
    172173                                CKEDITOR.fire( 'download', url );               // @Packager.RemoveLine
    173174                        };
    174175
    175                         showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
     176                        isBusy = 1, showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
    176177                        for ( var i = 0 ; i < scriptCount ; i++ )
    177178                        {
    178179                                loadScript( scriptUrl[ i ] );
     
    195196
    196197                        // Append it to <head>.
    197198                        script.appendTo( CKEDITOR.document.getHead() );
     199                },
     200
     201                /**
     202                 * Whether loading queue is not empty.
     203                 * @return {Boolean}
     204                 */
     205                checkBusy : function()
     206                {
     207                        return isBusy;
    198208                }
    199209        };
    200210})();
  • _source/plugins/dialog/plugin.js

     
    29132913                 */
    29142914                openDialog : function( dialogName, callback )
    29152915                {
     2916                        if ( CKEDITOR.scriptLoader.checkBusy() )
     2917                                return null;
     2918
    29162919                        var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
    29172920                                        dialogSkin = this.skin.dialog;
    29182921
     
    29332936                        else if ( dialogDefinitions == 'failed' )
    29342937                                throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );
    29352938
    2936                         // Not loaded? Load the .js file first.
    2937                         var body = CKEDITOR.document.getBody(),
    2938                                 cursor = body.$.style.cursor,
    2939                                 me = this;
     2939                        var me = this;
    29402940
    2941                         body.setStyle( 'cursor', 'wait' );
    2942 
    29432941                        function onDialogFileLoaded( success )
    29442942                        {
    29452943                                var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
     
    29542952                                        CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';
    29552953
    29562954                                me.openDialog( dialogName, callback );
    2957                                 body.setStyle( 'cursor', cursor );
    29582955                        }
    29592956
    29602957                        if ( typeof dialogDefinitions == 'string' )
    29612958                        {
    29622959                                var loadDefinition = 1;
    2963                                 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded );
     2960                                CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 );
    29642961                        }
    29652962
    29662963                        CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy