Ticket #4107: 4107.patch

File 4107.patch, 2.6 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/styles/plugin.js

     
    197197                                        {
    198198                                                if ( attName == '_length' )
    199199                                                        continue;
    200                                                 if ( attribs[attName] == element.getAttribute( attName ) )
     200                                                if ( attribs[attName] == normalizeCssText( element.getAttribute( attName ), false ) )
    201201                                                {
    202202                                                        if ( !fullMatch )
    203203                                                                return true;
     
    11771177                return overrides;
    11781178        }
    11791179
    1180         function normalizeCssText( unparsedCssText )
     1180        function normalizeCssText( unparsedCssText, nativeNormalize )
    11811181        {
    1182                 // Injects the style in a temporary span object, so the browser parses it,
    1183                 // retrieving its final format.
    1184                 var temp = new CKEDITOR.dom.element( 'span' );
    1185                 temp.setAttribute( 'style', unparsedCssText );
    1186                 var styleText = temp.getAttribute( 'style' );
     1182                var styleText;
     1183                if ( nativeNormalize != false )
     1184                {
     1185                        // Injects the style in a temporary span object, so the browser parses it,
     1186                        // retrieving its final format.
     1187                        var temp = new CKEDITOR.dom.element( 'span' );
     1188                        temp.setAttribute( 'style', unparsedCssText );
     1189                        styleText = temp.getAttribute( 'style' );
     1190                }
     1191                else
     1192                        styleText = unparsedCssText;
     1193
     1194                // Normalize font-family style text across browsers.(#4107).
     1195                styleText = styleText.replace(/^font-family: ([\w -]+)((:?,\s+[\w -]+)*);/, function( match, g1, g2 )
     1196                {
     1197                        return 'font-family: ' + g1 +
     1198                                   ( g2 ? g2.replace( /,\s+([\w -]+)/g, function( match, g1 )
     1199                                   {
     1200                                                return ',' + g1;
     1201                                   } ) : '' ) +
     1202                                   ';';
     1203                } ).toLowerCase();
     1204
    11871205                // IE will leave a single semicolon when failed to parse the style text.(#3891)
    11881206                return styleText == ';' ? '' : styleText;
    11891207        }
  • CHANGES.html

     
    185185                <li><a href="http://dev.fckeditor.net/ticket/4075">#4075</a> : [IE6/7]Fixed apply custom inline style with "class" attribute failed.</li>
    186186                <li><a href="http://dev.fckeditor.net/ticket/4087">#4087</a> : [Firefox]Fixed extra blocks created on create list when full document selected.</li>
    187187                <li><a href="http://dev.fckeditor.net/ticket/4097">#4097</a> : No undo/redo support for fontColor and backgroundColor buttons.</li>
     188                <li><a href="http://dev.fckeditor.net/ticket/4107">#4107</a> : Fixed font style inconsistency across browsers.</li>
    188189        </ul>
    189190        <h3>
    190191                CKEditor 3.0 RC</h3>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy