Ticket #4809: 4809_2.patch

File 4809_2.patch, 1.2 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/htmldataprocessor/plugin.js

     
    8080
    8181        var dtd = CKEDITOR.dtd;
    8282
     83        // Define orders of table elements.
     84        var tableOrder = [ 'caption', 'colgroup', 'col', 'thead', 'tbody', 'tfoot' ];
     85
     86
    8387        // Find out the list of block-like tags that can contain <br>.
    8488        var blockLikeTags = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent );
    8589        for ( var i in blockLikeTags )
     
    160164                                        return element;
    161165                                },
    162166
     167                                // The contents of table should be in correct order (#4809).
     168                                table : function( element )
     169                                {
     170                                        var children = element.children;
     171                                        children.sort( function ( node1, node2 )
     172                                                                   {
     173                                                                           return node1.type == CKEDITOR.NODE_ELEMENT && node2.type == node1.type ?
     174                                                                                        tableOrder.indexOf( node1.name ) > tableOrder.indexOf( node2.name ) ? 1 : -1 : 0;
     175                                                                   } );
     176                                },
     177
    163178                                embed : function( element )
    164179                                {
    165180                                        var parent = element.parent;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy