Ticket #4463: 4463_2.patch

File 4463_2.patch, 12.1 KB (added by Garry Yao, 13 years ago)
  • _source/core/tools.js

     
    220220                } )(),
    221221
    222222                /**
     223                 * Build the HTML snippet of a set of <style>/<link>.
     224                 * @param css {String|Array} Each of which are url (absolute) of a CSS file or
     225                 * a trunk of style text.
     226                 */
     227                buildStyleHtml : function ( css )
     228                {
     229                        css = [].concat( css );
     230                        var item, retval = [];
     231                        for ( var i = 0; i < css.length; i++ )
     232                        {
     233                                item = css[ i ];
     234                                // Is CSS style text ?
     235                                if ( /@import|[{}]/.test(item) )
     236                                        retval.push('<style>' + item + '</style>');
     237                                else
     238                                        retval.push('<link type="text/css" rel=stylesheet href="' + item + '">');
     239                        }
     240                        return retval.join( '' );
     241                },
     242
     243                /**
    223244                 * Replace special HTML characters in a string with their relative HTML
    224245                 * entity values.
    225246                 * @param {String} text The string to be encoded.
  • _source/plugins/wysiwygarea/plugin.js

     
    560560                                                                        editor.config.docType +
    561561                                                                        '<html dir="' + editor.config.contentsLangDirection + '">' +
    562562                                                                        '<head>' +
    563                                                                                 '<link type="text/css" rel="stylesheet" href="' +
    564                                                                                 [].concat( editor.config.contentsCss ).join( '"><link type="text/css" rel="stylesheet" href="' ) +
    565                                                                                 '">' +
     563                                                                                CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
    566564                                                                                '<style type="text/css" _fcktemp="true">' +
    567565                                                                                        editor._.styles.join( '\n' ) +
    568566                                                                                '</style>'+
  • _source/core/skins.js

     
    2323        var loadedPart = function( skinName, part, callback )
    2424        {
    2525                // Get the skin definition.
    26                 var skinDefinition = loaded[ skinName ];
     26                var skinDefinition = CKEDITOR.skins[ skinName ] = loaded[ skinName ];
    2727
    2828                var appendSkinPath = function( fileNames )
    2929                {
     
    3333                        }
    3434                };
    3535
     36                function fixCSSTextRelativePath( cssStyleText, baseUrl )
     37                {
     38                        return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
     39                                        function( match, opener, path, closer )
     40                                        {
     41                                                if ( /^\/|^\w?:/.test( path ) )
     42                                                        return match;
     43                                                else
     44                                                        return 'url(' + baseUrl + opener +  path + closer + ')';
     45                                        } );
     46                }
     47
    3648                // Check if we need to preload images from it.
    3749                if ( !preloaded[ skinName ] )
    3850                {
     
    96108                        // Load the "css" pieces.
    97109                        if ( !cssIsLoaded )
    98110                        {
    99                                 appendSkinPath( part.css );
     111                                var cssPart = part.css;
    100112
    101                                 for ( var c = 0 ; c < part.css.length ; c++ )
    102                                         CKEDITOR.document.appendStyleSheet( part.css[ c ] );
    103 
     113                                if ( CKEDITOR.tools.isArray( cssPart ) )
     114                                {
     115                                        appendSkinPath( cssPart );
     116                                        for ( var c = 0 ; c < cssPart.length ; c++ )
     117                                                CKEDITOR.document.appendStyleSheet( cssPart[ c ] );
     118                                }
     119                                else
     120                                {
     121                                        cssPart = fixCSSTextRelativePath(
     122                                                                cssPart, CKEDITOR.getUrl( paths[ skinName ] ) );
     123                                        // Processing Inline CSS part.
     124                                        CKEDITOR.document.appendStyleText( cssPart );
     125                                }
     126                               
     127                                part.css = cssPart;
     128
    104129                                cssIsLoaded = 1;
    105130                        }
    106131
  • _source/plugins/menu/plugin.js

     
    132132                                {
    133133                                        panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),
    134134                                                {
    135                                                         css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],
     135                                                        css : CKEDITOR.skins[ editor.skinName ].editor.css,
    136136                                                        level : this._.level - 1,
    137137                                                        className : editor.skinClass + ' cke_contextmenu'
    138138                                                },
  • _source/plugins/panel/plugin.js

     
    160160                                                // It looks strange, but for FF2, the styles must go
    161161                                                // after <body>, so it (body) becames immediatelly
    162162                                                // available. (#3031)
    163                                                 '<link type="text/css" rel=stylesheet href="' + this.css.join( '"><link type="text/css" rel="stylesheet" href="' ) + '">' +
     163                                                CKEDITOR.tools.buildStyleHtml( this.css ) +
    164164                                        '<\/html>' );
    165165                                doc.$.close();
    166166
  • _source/core/editor.js

     
    124124                editor.fireOnce( 'configLoaded' );
    125125
    126126                // Load language file.
    127                 loadLang( editor );
     127                loadSkin( editor );
    128128        };
    129129
    130130        var loadLang = function( editor )
     
    246246
    247247                                                // Load the editor skin.
    248248                                                editor.fire( 'pluginsLoaded' );
    249                                                 loadSkin( editor );
     249                                                CKEDITOR.fireOnce( 'pluginsLoaded' );
     250                                                loadTheme( editor );
    250251                                        });
    251252                        });
    252253        };
     
    255256        {
    256257                CKEDITOR.skins.load( editor, 'editor', function()
    257258                        {
    258                                 loadTheme( editor );
     259                                loadLang( editor );
    259260                        });
    260261        };
    261262
  • _source/core/dom/document.js

     
    5252                        }
    5353                },
    5454
     55                appendStyleText : function( cssStyleText )
     56                {
     57                        if ( this.$.createStyleSheet )
     58                        {
     59                                var styleSheet = this.$.createStyleSheet( "" );
     60                                styleSheet.cssText = cssStyleText ;
     61                        }
     62                        else
     63                        {
     64                                var style = new CKEDITOR.dom.element( 'style', this );
     65                                style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
     66                                this.getHead().append( style );
     67                        }
     68                },
     69
    5570                createElement : function( name, attribsAndStyles )
    5671                {
    5772                        var element = new CKEDITOR.dom.element( name, this );
  • _source/plugins/preview/plugin.js

     
    3737                                        '<head>' +
    3838                                        baseTag +
    3939                                        '<title>' + editor.lang.preview + '</title>' +
    40                                         '<link type="text/css" rel="stylesheet" href="' +
    41                                         [].concat( editor.config.contentsCss ).join( '"><link type="text/css" rel="stylesheet" href="' ) +
    42                                         '">' +
     40                                        CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
    4341                                        '</head>' + bodyHtml +
    4442                                        editor.getData() +
    4543                                        '</body></html>';
  • _source/plugins/dialog/plugin.js

     
    7373                return null;
    7474        }
    7575
    76         // Stores dialog related data from skin definitions. e.g. margin sizes.
    77         var skinData = {};
    78 
    7976        /**
    8077         * This is the base class for runtime dialog objects. An instance of this
    8178         * class represents a single named dialog for a single editor instance.
     
    14371434                        element = dialog.getElement().getFirst(),
    14381435                        editor = dialog.getParentEditor(),
    14391436                        magnetDistance = editor.config.dialog_magnetDistance,
    1440                         margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ];
     1437                        margins = CKEDITOR.skins[ editor.skinName ].margins || [ 0, 0, 0, 0 ];
    14411438
    14421439                if ( typeof magnetDistance == 'undefined' )
    14431440                        magnetDistance = 20;
     
    15151512                        minWidth = definition.minWidth || 0,
    15161513                        minHeight = definition.minHeight || 0,
    15171514                        resizable = definition.resizable,
    1518                         margins = skinData[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ];
     1515                        margins = CKEDITOR.skins[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ];
    15191516
    15201517                function topSizer( coords, dy )
    15211518                {
     
    26722669                        }
    26732670                };
    26742671        })();
    2675 
    2676         // Grab the margin data from skin definition and store it away.
    2677         CKEDITOR.skins.add = ( function()
    2678         {
    2679                 var original = CKEDITOR.skins.add;
    2680                 return function( skinName, skinDefinition )
    2681                 {
    2682                         skinData[ skinName ] = { margins : skinDefinition.margins };
    2683                         return original.apply( this, arguments );
    2684                 };
    2685         } )();
    2686 })();
     2672})();
    26872673
    26882674// Extend the CKEDITOR.editor class with dialog specific functions.
    26892675CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
  • _source/plugins/font/plugin.js

     
    3636
    3737                                panel :
    3838                                {
    39                                         css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
     39                                        css : CKEDITOR.skins[ editor.skinName ].editor.css.concat( config.contentsCss ),
    4040                                        voiceLabel : lang.panelVoiceLabel
    4141                                },
    4242
  • _source/plugins/colorbutton/plugin.js

     
    3131
    3232                                        panel :
    3333                                        {
    34                                                 css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ]
     34                                                css : CKEDITOR.skins[ editor.skinName ].editor.css.concat( config.contentsCss )
    3535                                        },
    3636
    3737                                        onBlock : function( panel, blockName )
  • _source/plugins/format/plugin.js

     
    3333
    3434                                panel :
    3535                                {
    36                                         css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
     36                                        css : CKEDITOR.skins[ editor.skinName ].editor.css.concat( config.contentsCss ),
    3737                                        voiceLabel : lang.panelVoiceLabel
    3838                                },
    3939
  • _source/skins/kama/skin.js

     
    203203        };
    204204})() );
    205205
    206 if ( CKEDITOR.dialog )
     206CKEDITOR.on( 'pluginsLoaded', function()
    207207{
    208         CKEDITOR.dialog.on( 'resize', function( evt )
     208        CKEDITOR.dialog && CKEDITOR.dialog.on( 'resize', function( evt )
    209209                {
    210210                        var data = evt.data,
    211211                                width = data.width,
     
    258258                                        el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
    259259                                },
    260260                                100 );
    261                 });
    262 }
     261                } );
     262} );
    263263
    264264/**
    265265 * The base user interface color to be used by the editor. Not all skins are
  • _source/skins/office2003/skin.js

     
    2323        };
    2424})() );
    2525
    26 if ( CKEDITOR.dialog )
     26CKEDITOR.on( 'pluginsLoaded', function()
    2727{
    28         CKEDITOR.dialog.on( 'resize', function( evt )
     28        CKEDITOR.dialog && CKEDITOR.dialog.on( 'resize', function( evt )
    2929                {
    3030                        var data = evt.data,
    3131                                width = data.width,
     
    7373                        // Ensure size is correct for RTL mode. (#4003)
    7474                        if ( evt.editor.lang.dir == 'rtl' )
    7575                                setTimeout( fixSize, 1000 );
    76                 });
    77 }
     76                } );
     77} );
  • _source/skins/v2/skin.js

     
    2323        };
    2424})() );
    2525
    26 if ( CKEDITOR.dialog )
     26CKEDITOR.on( 'pluginsLoaded', function()
    2727{
    28         CKEDITOR.dialog.on( 'resize', function( evt )
     28        CKEDITOR.dialog && CKEDITOR.dialog.on( 'resize', function( evt )
    2929                {
    3030                        var data = evt.data,
    3131                                width = data.width,
     
    6969                                        el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
    7070                                },
    7171                                100 );
    72                 });
    73 }
     72                } );
     73} );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy