Ticket #3782: 3782.patch

File 3782.patch, 1.4 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/list/plugin.js

     
    1111{
    1212        var listNodeNames = { ol : 1, ul : 1 },
    1313                emptyTextRegex = /^[\n\r\t ]*$/;
     14        var dtd = CKEDITOR.dtd;
     15        var blockLikeTags = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent );
    1416
    1517        CKEDITOR.plugins.list = {
    1618                /*
     
    335337                }
    336338
    337339                var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode );
     340
    338341                // If groupObj.root is the last element in its parent, or its nextSibling is a <br>, then we should
    339342                // not add a <br> after the final item. So, check for the cases and trim the <br>.
    340343                if ( !groupObj.root.getNext() || groupObj.root.getNext().$.nodeName.toLowerCase() == 'br' )
     
    342345                        if ( newList.listNode.getLast().$.nodeName.toLowerCase() == 'br' )
    343346                                newList.listNode.getLast().remove();
    344347                }
     348
     349                var parentNode = groupObj.root.getParent();
    345350                newList.listNode.replace( groupObj.root );
     351
     352                // If groupObj.root's parent is a block, we might have removed the filler BR node at the line above.
     353                // So put it back if needed. (#3782)
     354                if ( parentNode && blockLikeTags[ parentNode.getName() ] )
     355                        parentNode.appendBogus();
    346356        }
    347357
    348358        function listCommand( name, type )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy