Ticket #5242: 5242.patch

File 5242.patch, 2.3 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/styles/plugin.js

     
    199199                                                        continue;
    200200
    201201                                                var elementAttr = element.getAttribute( attName ) || '';
    202                                                 if ( attribs[ attName ] ==
    203                                                          ( attName == 'style' ?
    204                                                            normalizeCssText( elementAttr, false ) : elementAttr  ) )
     202                                                if ( attName == 'style' ?
     203                                                        compareCssText( attribs[ attName ], normalizeCssText( elementAttr, false ) )
     204                                                        : attribs[ attName ] == elementAttr )
    205205                                                {
    206206                                                        if ( !fullMatch )
    207207                                                                return true;
     
    12081208                                                         .replace( /,\s+/g, ',' ) // Trimming spaces after comma (e.g. font-family name)(#4107).
    12091209                                                         .toLowerCase();
    12101210        }
    1211 
     1211       
     1212        // Turn inline style text properties into one hash.
     1213        function parseStyleText( styleText )
     1214        {
     1215                var retval = {};
     1216                styleText
     1217                   .replace( /"/g, '"' )
     1218                   .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )
     1219                {
     1220                        retval[ name ] = value;
     1221                } );
     1222                return retval;
     1223        }
     1224
     1225        function compareCssText( source, target )
     1226        {
     1227                typeof source == 'string' && ( source = parseStyleText( source ) );
     1228                typeof target == 'string' && ( target = parseStyleText( target ) );
     1229                for( var name in source )
     1230                {
     1231                        // Value 'inheirt'  is treated as a wildcard,
     1232                        // which will matches any value.   
     1233                        if ( !( name in target &&
     1234                                        ( target[ name ] == source[ name ]
     1235                                                || source[ name ] == 'inherit'
     1236                                                || target[ name ] == 'inherit' ) ) )
     1237                        {
     1238                                return false;
     1239                        }
     1240                }
     1241                return true;
     1242        }
     1243
    12121244        function applyStyle( document, remove )
    12131245        {
    12141246                // Get all ranges from the selection.
  • _source/plugins/colorbutton/plugin.js

     
    8686
    8787                                        panel.hide();
    8888
    89                                         var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], color && { color : color } );
     89                                        var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : color || 'inherit' } );
    9090
    9191                                        editor.fire( 'saveSnapshot' );
    9292                                        if ( color )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy