Ticket #7492: 7492_3.patch

File 7492_3.patch, 3.1 KB (added by Alfonso Martínez de Lizarrondo, 12 years ago)

Revised patch

  • _samples/output_xhtml.html

     
    9898                                                font_style :
    9999                                                {
    100100                                                                element         : 'span',
    101                                                                 attributes              : { 'class' : '#(family)' }
     101                                                                attributes              : { 'class' : '#(family)' },
     102                                                                overrides       : [ { element : 'span', attributes : { 'class' : /^Font(?:Comic|Courier|Times)$/ } } ]
    102103                                                },
    103104
    104105                                                /*
     
    108109                                                fontSize_style :
    109110                                                        {
    110111                                                                element         : 'span',
    111                                                                 attributes      : { 'class' : '#(size)' }
     112                                                                attributes      : { 'class' : '#(size)' },
     113                                                                overrides       : [ { element : 'span', attributes : { 'class' : /^Font(?:Smaller|Larger|Small|Big|Double)$/ } } ]
    112114                                                        } ,
    113115
    114116                                                /*
     
    120122                                                colorButton_foreStyle :
    121123                                                        {
    122124                                                                element : 'span',
    123                                                                 attributes : { 'class' : '#(color)' }
     125                                                                attributes : { 'class' : '#(color)' },
     126                                                                overrides       : [ { element : 'span', attributes : { 'class' : /^FontColor(?:1|2|3)$/ } } ]
    124127                                                        },
    125128
    126129                                                colorButton_backStyle :
    127130                                                        {
    128131                                                                element : 'span',
    129                                                                 attributes : { 'class' : '#(color)BG' }
     132                                                                attributes : { 'class' : '#(color)BG' },
     133                                                                overrides       : [ { element : 'span', attributes : { 'class' : /^FontColor(?:1|2|3)BG$/ } } ]
    130134                                                        },
    131135
    132136                                                /*
  • _source/plugins/styles/plugin.js

     
    11321132        function removeFromElement( style, element )
    11331133        {
    11341134                var def = style._.definition,
    1135                         attributes = CKEDITOR.tools.extend( {}, def.attributes, getOverrides( style )[ element.getName() ] ),
     1135                        attributes = def.attributes,
    11361136                        styles = def.styles,
     1137                        overrides = getOverrides( style )[ element.getName() ],
    11371138                        // If the style is only about the element itself, we have to remove the element.
    11381139                        removeEmpty = CKEDITOR.tools.isEmpty( attributes ) && CKEDITOR.tools.isEmpty( styles );
    11391140
     
    11591160                        element.removeStyle( styleName );
    11601161                }
    11611162
     1163                // Remove overrides, but don't remove the element if it's a block element
     1164                removeOverrides( element, overrides, blockElements[ element.getName() ] ) ;
     1165
    11621166                if ( removeEmpty )
    11631167                {
    11641168                        !CKEDITOR.dtd.$block[ element.getName() ] || style._.enterMode == CKEDITOR.ENTER_BR && !element.hasAttributes() ?
     
    12001204         *  Note: Remove the element if no attributes remain.
    12011205         * @param {Object} element
    12021206         * @param {Object} overrides
     1207         * @param {Boolean} Don't remove the element
    12031208         */
    1204         function removeOverrides( element, overrides )
     1209        function removeOverrides( element, overrides, dontRemove )
    12051210        {
    12061211                var attributes = overrides && overrides.attributes ;
    12071212
     
    12291234                        }
    12301235                }
    12311236
    1232                 removeNoAttribsElement( element );
     1237                if ( !dontRemove )
     1238                        removeNoAttribsElement( element );
    12331239        }
    12341240
    12351241        // If the element has no more attributes, remove it.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy