Ticket #3912: 3912_2.patch

File 3912_2.patch, 2.3 KB (added by Garry Yao, 14 years ago)
  • _source/skins/kama/skin.js

     
    55
    66CKEDITOR.skins.add( 'kama', (function()
    77{
    8         var preload = [];
     8        var preload = [],
     9                uiColorStylesheetId = 'cke_ui_color';
    910
    1011        if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
    1112        {
     
    8990                                        uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' );
    9091                        }
    9192
    92                         function addStylesheet( document )
     93                        function getStylesheet( document )
    9394                        {
    94                                 var node = document.getHead().append( 'style' );
    95                                 node.setAttribute( "id", "cke_ui_color" );
    96                                 node.setAttribute( "type", "text/css" );
    97 
     95                                var node = document.getById( uiColorStylesheetId );
     96                                if( !node )
     97                                {
     98                                        node = document.getHead().append( 'style' );
     99                                        node.setAttribute( "id", uiColorStylesheetId );
     100                                        node.setAttribute( "type", "text/css" );
     101                                }
    98102                                return node;
    99103                        }
    100104
     
    105109                                {
    106110                                        if ( CKEDITOR.env.webkit )
    107111                                        {
    108                                                 // Truncate manually.
    109                                                 for ( i = 0 ; i < styleNodes[ id ].$.sheet.rules.length ; i++ )
    110                                                         styleNodes[ id ].$.sheet.removeRule( i );
    111 
    112112                                                for ( i = 0 ; i < styleContent.length ; i++ )
    113113                                                {
    114114                                                        content = styleContent[ i ][ 1 ];
     
    125125                                                        content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] );
    126126
    127127                                                if ( CKEDITOR.env.ie )
    128                                                         styleNodes[ id ].$.styleSheet.cssText = content;
     128                                                        styleNodes[ id ].$.styleSheet.cssText += content;
    129129                                                else
    130                                                         styleNodes[ id ].setHtml( content );
     130                                                        styleNodes[ id ].$.innerHTML += content;
    131131                                        }
    132132                                }
    133133                        }
     
    146146                                setUiColor : function( color )
    147147                                {
    148148                                        var cssContent,
    149                                                 uiStyle = addStylesheet( CKEDITOR.document ),
     149                                                uiStyle = getStylesheet( CKEDITOR.document ),
    150150                                                cssId = '#cke_' + CKEDITOR.tools.escapeCssSelector( editor.name );
    151151
    152152                                        var cssSelectors =
     
    186186                                // Add stylesheet if missing.
    187187                                if ( !iframe.getById( 'cke_ui_color' ) )
    188188                                {
    189                                         var node = addStylesheet( iframe );
     189                                        var node = getStylesheet( iframe );
    190190                                        uiColorMenus.push( node );
    191191
    192192                                        var color = editor.getUiColor();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy