Ticket #6662: 6662.patch

File 6662.patch, 3.2 KB (added by Tobiasz Cudnik, 13 years ago)
  • _source/plugins/pastefromword/filter/default.js

     
    184184                        isListBulletIndicator : function( element )
    185185                        {
    186186                                var styleText = element.attributes && element.attributes.style;
    187                                 if ( /mso-list\s*:\s*Ignore/i.test( styleText ) )
     187                                if ( !CKEDITOR.env.gecko && /mso-list\s*:\s*Ignore/i.test( styleText ) )
    188188                                        return true;
     189                                // Search for following structure in Gecko `P.class > SPAN > SPAN > SPAN`.
     190                                else if ( CKEDITOR.env.gecko && element.parent.attributes &&
     191                                        /\b(ListParagraph(CxSp\w+)?|MsoNormal\b)/i.test( element.parent.attributes[ 'class' ] ) &&
     192                                        element.children && element.children.length == 1 && element.children[ 0 ].name == 'span' &&
     193                                        element.children[ 0 ].children && element.children[ 0 ].children.length == 1 &&
     194                                        element.children[ 0 ].children[ 0 ].type == 3
     195                                )
     196                                        return true;
    189197                        },
    190198
    191199                        isContainingOnlySpaces : function( element )
     
    214222                                                                        // Text-indent is not representing list item level any more.
    215223                                                                        [ 'text-indent' ],
    216224                                                                        [ 'line-height' ],
     225
     226                                                                        [ 'list-style-type' ],
    217227                                                                        // Resolve indent level from 'margin-left' value.
    218228                                                                        [ ( /^margin(:?-left)?$/ ), null, function( margin )
    219229                                                                        {
     
    399409                                                                        ] )( listItemAttrs.style )
    400410                                                                        || '' );
    401411
    402                                                         if ( !list )
     412                                                        if ( !list || ( list && list.name != listType ) )
    403413                                                        {
    404414                                                                list = new CKEDITOR.htmlParser.element( listType );
    405415                                                                list.add( listItem );
     
    867877
    868878                                                // For IE/Safari: List item bullet type is supposed to be indicated by
    869879                                                // the text of a span with style 'mso-list : Ignore' or an image.
    870                                                 if ( !CKEDITOR.env.gecko && isListBulletIndicator( element ) )
     880                                                // For Gecko, list bullet is a child of `p.ListParagraphCxSp*` element.
     881                                                if ( ( !CKEDITOR.env.gecko && isListBulletIndicator( element ) ) ||
     882                                                        ( CKEDITOR.env.gecko && isListBulletIndicator( element ) ) )
    871883                                                {
    872                                                         var listSymbolNode = element.firstChild( function( node )
    873                                                         {
    874                                                                 return node.value || node.name == 'img';
    875                                                         });
    876 
    877                                                         var listSymbol =  listSymbolNode && ( listSymbolNode.value || 'l.' ),
    878                                                                 listType = listSymbol.match( /^([^\s]+?)([.)]?)$/ );
     884                                                        var listSymbol, listType;
     885                                                        if ( CKEDITOR.env.gecko )
     886                                                        {
     887                                                                listType = element.children[ 0 ].children[ 0 ].value;
     888                                                                listType = /^(?: [ \n]?)*([\w\u00B7]*)(\.?)/.exec( listType );
     889                                                        }
     890                                                        else
     891                                                        {
     892                                                                var listSymbolNode = element.firstChild( function( node )
     893                                                                {
     894                                                                        return node.value || node.name == 'img';
     895                                                                });
     896                                                               
     897                                                                listSymbol =  listSymbolNode && ( listSymbolNode.value || 'l.' ),
     898                                                                        listType = listSymbol.match( /^([^\s]+?)([.)]?)$/ );
     899                                                        }
    879900                                                        return createListBulletMarker( listType, listSymbol );
    880901                                                }
    881902
     
    971992                                                // Preserve clear float style.
    972993                                                [ ( /^clear$/ ) ],
    973994
     995                                                [ ( /^list-style-type/ ) ],
     996
    974997                                                [ ( /^border.*|margin.*|vertical-align|float$/ ), null,
    975998                                                        function( value, element )
    976999                                                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy