Ticket #3599: 3599_3.patch

File 3599_3.patch, 2.0 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/colorbutton/plugin.js

     
    8686
    8787                                        panel.hide();
    8888
    89                                         var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : color || 'inherit' } );
    9089
    9190                                        editor.fire( 'saveSnapshot' );
     91
     92                                        // Clean up any conflicting style within the range.
     93                                        new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document );
     94
    9295                                        if ( color )
    93                                                 style.apply( editor.document );
    94                                         else
    95                                                 style.remove( editor.document );
     96                                        {
     97                                                var colorStyle = config['colorButton_' + type + 'Style'];
     98
     99                                                colorStyle.childRule = type == 'back' ?
     100                                                        // It's better to apply background color as the innermost style. (#3599)
     101                                                        function(){ return false; } :
     102                                                        // Fore color style must be applied inside links instead of around it.
     103                                                        function(){ return element.getName() != 'a'; };
     104                                               
     105                                                new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document );
     106                                        }
     107
    96108                                        editor.fire( 'saveSnapshot' );
    97109                                });
    98110
     
    214226        {
    215227                element         : 'span',
    216228                styles          : { 'color' : '#(color)' },
    217                 overrides       : [ { element : 'font', attributes : { 'color' : null } } ],
    218 
    219                 // Fore color style must be applied inside links instead of around it.
    220                 childRule : function( element )
    221                 {
    222                         return element.getName() != 'a';
    223                 }
     229                overrides       : [ { element : 'font', attributes : { 'color' : null } } ]
    224230        };
    225231
    226232/**
     
    237243CKEDITOR.config.colorButton_backStyle =
    238244        {
    239245                element         : 'span',
    240                 styles          : { 'background-color' : '#(color)' },
    241 
    242                 // It's better to apply background color as the innermost style. (#3599)
    243                 childRule : function( element )
    244                 {
    245                         return false;
    246                 }
     246                styles          : { 'background-color' : '#(color)' }
    247247        };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy