Ticket #4892: 4892.patch

File 4892.patch, 1.5 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/pastefromword/filter/default.js

     
    756756                                                        elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element );
    757757                                        },
    758758
     759                                        'div' : function( element )
     760                                        {
     761                                                // Aligned table with no text surrounded is represented by a wrapper div, from which
     762                                                // table cells inherit as text-align styles, which is wrong.
     763                                                // Instead we use a clear-float div after the table to properly achieve the same layout.
     764                                                var singleChild = element.onlyChild();
     765                                                if( singleChild && singleChild.name == 'table' )
     766                                                {
     767                                                        var attrs = element.attributes;
     768                                                        singleChild.attributes = CKEDITOR.tools.extend( singleChild.attributes, attrs );
     769                                                        attrs.style && singleChild.addStyle( attrs.style );
     770
     771                                                        var clearFloatDiv = new CKEDITOR.htmlParser.element( 'div' );
     772                                                        clearFloatDiv.addStyle( 'clear' ,'both' );
     773                                                        element.add( clearFloatDiv );
     774                                                        delete element.name;
     775                                                }
     776                                        },
     777
    759778                                        'td' : function ( element )
    760779                                        {
    761780                                                // 'td' in 'thead' is actually <th>.
     
    936955                                                                }
    937956                                                        } ],
    938957
     958                                                // Preserve clear float style.
     959                                                [ /^clear$/ ],
     960
    939961                                                [ ( /^border.*|margin.*|vertical-align|float$/ ), null,
    940962                                                        function( value, element )
    941963                                                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy