Ticket #5271: 5271.patch

File 5271.patch, 1.2 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/list/plugin.js

     
    228228                newList.listNode.replace( groupObj.root );
    229229        }
    230230
     231        var headerTagRegex = /^h[1-6]$/;
     232
    231233        function createList( editor, groupObj, listsCreated )
    232234        {
    233235                var contents = groupObj.contents,
     
    279281                {
    280282                        var contentBlock = listContents.shift(),
    281283                                listItem = doc.createElement( 'li' );
    282                         contentBlock.moveChildren( listItem );
    283                         contentBlock.remove();
     284
     285                        // Preserve heading structure when converting to list item. (#5271)
     286                        if ( headerTagRegex.test( contentBlock.getName() ) )
     287                        {
     288                                var tmp = new CKEDITOR.dom.documentFragment( contentBlock.getDocument() );
     289                                tmp.append( contentBlock );
     290                                contentBlock = tmp;
     291                        }
     292                       
     293                        if ( contentBlock.type == CKEDITOR.NODE_ELEMENT )
     294                        {
     295                                contentBlock.copyAttributes( listItem );
     296                                contentBlock.remove();
     297                        }
     298
     299                        contentBlock.moveChildren( listItem );
    284300                        listItem.appendTo( listNode );
    285301
    286302                        // Append a bogus BR to force the LI to render at full height
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy