Ticket #4048: 4048.patch

File 4048.patch, 5.3 KB (added by tobiasz.cudnik, 3 years ago)
  • _source/skins/kama/skin.js

     
    2222                margins         : [ 0, 0, 0, 0 ], 
    2323                init : function( editor ) 
    2424                { 
    25                         var menuHead; 
    26                         function menuSetUiColor( color ) 
    27                         { 
    28                                 if ( !menuHead ) 
    29                                         return null; 
    30  
    31                                 var uiStyle = menuHead.append('style'); 
    32  
    33                                 var cssSrc = "/* UI Color Support */\ 
     25                        var uiColorMenus = {}; 
     26                        var uiColorRegex = /\$color/g; 
     27                        var uiColorMenuCss = "/* UI Color Support */\ 
    3428.cke_skin_kama .cke_menuitem .cke_icon_wrapper\ 
    3529{\ 
    3630        background-color: $color !important;\ 
     
    8579        background-color: $color !important;\ 
    8680}"; 
    8781 
    88                                 uiStyle.setAttribute( "type", "text/css" ); 
    89                                 var regex = /\$color/g; 
     82                        function uiColorAddMenu( id, head ) 
     83                        { 
     84                                uiColorMenus[ id ] = head.append( 'style' ); 
     85                                uiColorMenus[ id ].setAttribute( "type", "text/css" ); 
    9086 
    9187                                // We have to split CSS declarations for webkit. 
    9288                                if ( CKEDITOR.env.webkit ) 
    9389                                { 
    94                                         cssSrc = cssSrc.split( '}' ).slice( 0, -1 ); 
    95                                         for ( var i in cssSrc ) 
    96                                                         cssSrc[ i ] = cssSrc[ i ].split( '{' ); 
     90                                        uiColorMenuCss = uiColorMenuCss.split( '}' ).slice( 0, -1 ); 
     91                                        for ( var i in uiColorMenuCss ) 
     92                                                        uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' ); 
    9793                                } 
     94                        } 
    9895 
    99                                 return ( menuSetUiColor = 
    100                                         function( color ) 
    101                                         { 
    102                                                 if ( CKEDITOR.env.webkit ) 
    103                                                 { 
    104                                                         for ( var i in cssSrc ) 
    105                                                                 uiStyle.$.sheet.addRule( 
    106                                                                         cssSrc[ i ][ 0 ], cssSrc[ i ][ 1 ].replace( regex, color ) 
    107                                                                 ); 
    108                                                 } 
    109                                                 else 
    110                                                 { 
    111                                                         var css = cssSrc.replace( regex, color ); 
     96                        function uiColorUpdateMenus( color ) 
     97                        { 
     98                                for ( var id in uiColorMenus ) 
     99                                { 
     100                                        if ( CKEDITOR.env.webkit ) 
     101                                        { 
     102                                                for ( var i in uiColorMenuCss ) 
     103                                                        uiColorMenus[ id ].$.sheet.addRule( 
     104                                                                uiColorMenuCss[ i ][ 0 ], uiColorMenuCss[ i ][ 1 ].replace( uiColorRegex, color ) 
     105                                                        ); 
     106                                        } 
     107                                        else 
     108                                        { 
     109                                                var css = uiColorMenuCss.replace( uiColorRegex, color ); 
    112110 
    113                                                         if ( CKEDITOR.env.ie ) 
    114                                                                 uiStyle.$.styleSheet.cssText = css; 
    115                                                         else 
    116                                                                 uiStyle.setHtml( css ); 
    117                                                 } 
    118                                         })( color ); 
    119                         } 
     111                                                if ( CKEDITOR.env.ie ) 
     112                                                        uiColorMenus[ id ].$.styleSheet.cssText = css; 
     113                                                else 
     114                                                        uiColorMenus[ id ].setHtml( css ); 
     115                                        } 
     116                                } 
     117                        } 
    120118 
    121119                        CKEDITOR.tools.extend( editor, 
    122120                        { 
     
    156154                                                        else 
    157155                                                                uiStyle.setHtml( cssSelectors + '{' + css + '}' ); 
    158156 
    159                                                         menuSetUiColor( color ); 
     157                                                        uiColorUpdateMenus( color ); 
    160158                                                })( color ); 
    161159                                } 
    162160                        }); 
     
    170168                                { 
    171169                                        old.apply( this, arguments ); 
    172170 
    173                                         if ( !menuHead && editor == this.editor ) 
     171                                        if ( !uiColorMenus[ this.id ] && editor == this.editor ) 
    174172                                        { 
    175                                                 // Save reference. 
    176                                                 menuHead = this._.element.getDocument().getHead(); 
    177                                                 menuSetUiColor( editor.getUiColor() ); 
     173                                                uiColorAddMenu( this.id, this._.element.getDocument().getHead() ); 
     174                                                uiColorUpdateMenus( editor.getUiColor() ); 
    178175                                        } 
    179176                                }; 
    180177                        } 
     
    182179                        // Apply UI color if specified in config. 
    183180                        if ( editor.config.uiColor ) 
    184181                                editor.setUiColor( editor.config.uiColor ); 
    185  
    186                         // Fix editor's width. HPadding and 100% width iframe issue. 
    187 //                      if ( CKEDITOR.env.ie && CKEDITOR.env.quirks ) 
    188 //                      { 
    189 //                              editor.on( 'mode', function( event ) 
    190 //                              { 
    191 //                                      var container = editor.getResizable(); 
    192 //                                      editor.resize( container.$.offsetWidth-10, container.$.offsetHeight ); 
    193 //                                      event.removeListener(); 
    194 //                              }); 
    195 //                      } 
    196  
    197 //                      if ( CKEDITOR.env.ie && ( CKEDITOR.env.quirks || CKEDITOR.env.version < 7 ) ) 
    198 //                      { 
    199 //                              editor.on( 'themeLoaded', function( event ) 
    200 //                              { 
    201 //                                      var toolbars = editor.container.getChild( [0, 0, 0, 0, 0, 0, 0] ).getChildren(); 
    202 //                                      for ( var i = 0 ; i < toolbars.count() ; i++ ) 
    203 //                                      { 
    204 //                                              var toolbar = toolbars.getItem( i ); 
    205  
    206 //                                              var last = toolbar.getLast(); 
    207 //                                              if ( !last || !last.getPrevious().hasClass( 'cke_rcombo' ) ) 
    208 //                                                      continue; 
    209 // 
    210 //                                              last.addClass( 'cke_toolbar_end_last' ); 
    211 //                                      } 
    212 //                              }); 
    213 //                      } 
    214182                } 
    215183        }; 
    216184})() ); 
  • CHANGES.html

     
    162162                        ckeditor2.html test case.</li> 
    163163                <li><a href="http://dev.fckeditor.net/ticket/3989">#3989</a> : Host page horizontal scrolling a lot when on having righ-to-left direction.</li> 
    164164                <li><a href="http://dev.fckeditor.net/ticket/4001">#4001</a> : Create link around existing image result incorrect.</li> 
     165                <li><a href="http://dev.fckeditor.net/ticket/4048">#4048</a> : Context submenu lacks uiColor.</li> 
    165166        </ul> 
    166167        <h3> 
    167168                CKEditor 3.0 RC</h3> 
  • _source/plugins/menu/plugin.js

     
    122122 
    123123                        show : function( offsetParent, corner, offsetX, offsetY ) 
    124124                        { 
     125                                console.log( 'menu#show' ) 
    125126                                var items = this.items, 
    126127                                        editor = this.editor, 
    127128                                        panel = this._.panel, 
© 2003 – 2011 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy