Ticket #4463: 4463_3.patch

File 4463_3.patch, 14.7 KB (added by Garry Yao, 14 years ago)
  • _source/core/tools.js

     
    9898                },
    9999
    100100                /**
     101                 * Turn the first letter of string to upper-case.
     102                 * @param {String} str
     103                 */
     104                capitalize: function( str )
     105                {
     106                        return str.charAt( 0 ).toUpperCase() + str.substring( 1 ).toLowerCase();
     107                },
     108
     109                /**
    101110                 * Copy the properties from one object to another. By default, properties
    102111                 * already present in the target object <strong>are not</strong> overwritten.
    103112                 * @param {Object} target The object to be extended.
     
    220229                } )(),
    221230
    222231                /**
     232                 * Build the HTML snippet of a set of <style>/<link>.
     233                 * @param css {String|Array} Each of which are url (absolute) of a CSS file or
     234                 * a trunk of style text.
     235                 */
     236                buildStyleHtml : function ( css )
     237                {
     238                        css = [].concat( css );
     239                        var item, retval = [];
     240                        for ( var i = 0; i < css.length; i++ )
     241                        {
     242                                item = css[ i ];
     243                                // Is CSS style text ?
     244                                if ( /@import|[{}]/.test(item) )
     245                                        retval.push('<style>' + item + '</style>');
     246                                else
     247                                        retval.push('<link type="text/css" rel=stylesheet href="' + item + '">');
     248                        }
     249                        return retval.join( '' );
     250                },
     251
     252                /**
    223253                 * Replace special HTML characters in a string with their relative HTML
    224254                 * entity values.
    225255                 * @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/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 : editor.skin.editor.css,
    136136                                                        level : this._.level - 1,
    137137                                                        className : editor.skinClass + ' cke_contextmenu'
    138138                                                },
  • _source/core/skins.js

     
    2020        var preloaded = {};
    2121        var paths = {};
    2222
    23         var loadedPart = function( skinName, part, callback )
     23        var loadPart = function( skinName, part, callback )
    2424        {
    2525                // Get the skin definition.
    2626                var skinDefinition = loaded[ skinName ];
     
    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                {
     
    4355                                CKEDITOR.imageCacher.load( preload, function()
    4456                                        {
    4557                                                preloaded[ skinName ] = 1;
    46                                                 loadedPart( skinName, part, callback );
     58                                                loadPart( skinName, part, callback );
    4759                                        } );
    4860                                return;
    4961                        }
     
    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
     
    119144                        checkIsLoaded();
    120145                }
    121146        };
    122 
     147
    123148        return /** @lends CKEDITOR.skins */ {
    124149
    125150                /**
     
    156181                                skinPath = editor.skinPath;
    157182
    158183                        if ( loaded[ skinName ] )
    159                         {
    160                                 loadedPart( skinName, skinPart, callback );
    161 
    162                                 // Get the skin definition.
    163                                 var skinDefinition = loaded[ skinName ];
    164 
    165                                 // Trigger init function if any.
    166                                 if ( skinDefinition.init )
    167                                         skinDefinition.init( editor );
    168                         }
     184                                loadPart( skinName, skinPart, callback );
    169185                        else
    170186                        {
    171187                                paths[ skinName ] = skinPath;
    172188                                CKEDITOR.scriptLoader.load( skinPath + 'skin.js', function()
    173189                                                {
    174                                                         loadedPart( skinName, skinPart, callback );
    175 
    176190                                                        // Get the skin definition.
    177                                                         var skinDefinition = loaded[ skinName ];
    178 
     191                                                        var skinDefinition = editor.skin = loaded[ skinName ];
    179192                                                        // Trigger init function if any.
    180193                                                        if ( skinDefinition.init )
    181194                                                                skinDefinition.init( editor );
     195
     196                                                        loadPart( skinName, skinPart, callback );
    182197                                                });
    183198                        }
    184199                }
  • _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                                                loadTheme( editor );
    250250                                        });
    251251                        });
    252252        };
     
    255255        {
    256256                CKEDITOR.skins.load( editor, 'editor', function()
    257257                        {
    258                                 loadTheme( editor );
     258                                loadLang( editor );
    259259                        });
    260260        };
    261261
  • _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/stylescombo/plugin.js

     
    2626
    2727                                        panel :
    2828                                        {
    29                                                 css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
     29                                                css : editor.skin.editor.css.concat( config.contentsCss ),
    3030                                                voiceLabel : lang.panelVoiceLabel
    3131                                        },
    3232
  • _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/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

     
    77 * @fileOverview The floating dialog plugin.
    88 */
    99
    10 CKEDITOR.plugins.add( 'dialog',
    11         {
    12                 requires : [ 'dialogui' ]
    13         });
    14 
    1510/**
    1611 * No resize for this dialog.
    1712 * @constant
     
    7368                return null;
    7469        }
    7570
    76         // Stores dialog related data from skin definitions. e.g. margin sizes.
    77         var skinData = {};
    78 
    7971        /**
    8072         * This is the base class for runtime dialog objects. An instance of this
    8173         * class represents a single named dialog for a single editor instance.
     
    14371429                        element = dialog.getElement().getFirst(),
    14381430                        editor = dialog.getParentEditor(),
    14391431                        magnetDistance = editor.config.dialog_magnetDistance,
    1440                         margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ];
     1432                        margins = editor.skin.margins || [ 0, 0, 0, 0 ];
    14411433
    14421434                if ( typeof magnetDistance == 'undefined' )
    14431435                        magnetDistance = 20;
     
    15151507                        minWidth = definition.minWidth || 0,
    15161508                        minHeight = definition.minHeight || 0,
    15171509                        resizable = definition.resizable,
    1518                         margins = skinData[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ];
     1510                        margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ];
    15191511
    15201512                function topSizer( coords, dy )
    15211513                {
     
    26722664                        }
    26732665                };
    26742666        })();
    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 })();
     2667})();
    26872668
    26882669// Extend the CKEDITOR.editor class with dialog specific functions.
    26892670CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
     
    27362717                }
    27372718        });
    27382719
     2720CKEDITOR.plugins.add( 'dialog',
     2721        {
     2722                requires : [ 'dialogui' ]
     2723        });
     2724
    27392725// Dialog related configurations.
    27402726
    27412727/**
  • _source/plugins/font/plugin.js

     
    3636
    3737                                panel :
    3838                                {
    39                                         css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
     39                                        css : editor.skin.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 : editor.skin.editor.css
    3535                                        },
    3636
    3737                                        onBlock : function( panel, blockName )
  • _source/core/resourcemanager.js

     
    8686                if ( this.registered[ name ] )
    8787                        throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
    8888
    89                 this.registered[ name ] = definition || {};
     89                CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
     90                                this.registered[ name ] = definition || {} );
    9091        },
    9192
    9293        /**
  • _source/plugins/format/plugin.js

     
    3333
    3434                                panel :
    3535                                {
    36                                         css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
     36                                        css : editor.skin.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( 'dialogPluginReady', function()
    207207{
    208208        CKEDITOR.dialog.on( 'resize', function( evt )
    209209                {
     
    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/v2/skin.js

     
    2323        };
    2424})() );
    2525
    26 if ( CKEDITOR.dialog )
     26CKEDITOR.on( 'dialogPluginReady', function()
    2727{
    2828        CKEDITOR.dialog.on( 'resize', function( evt )
    2929                {
     
    6969                                        el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
    7070                                },
    7171                                100 );
    72                 });
    73 }
     72                } );
     73} );
  • _source/skins/office2003/skin.js

     
    2323        };
    2424})() );
    2525
    26 if ( CKEDITOR.dialog )
     26CKEDITOR.on( 'dialogPluginReady', function()
    2727{
    2828        CKEDITOR.dialog.on( 'resize', function( evt )
    2929                {
     
    7373                        // Ensure size is correct for RTL mode. (#4003)
    7474                        if ( evt.editor.lang.dir == 'rtl' )
    7575                                setTimeout( fixSize, 1000 );
    76                 });
    77 }
     76                } );
     77} );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy