Ticket #4139: 4139_2.patch

File 4139_2.patch, 2.4 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/list/plugin.js

     
    342342
    343343                var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode );
    344344
    345                 // Compensate a <br> before the first node if the previous node of list is a non-blocks.(#3836)
    346                 var docFragment = newList.listNode, firstNode, previousNode;
    347                 if ( ( firstNode = docFragment.getFirst() )
    348                          && !( firstNode.is && firstNode.isBlockBoundary() )
    349                          && ( previousNode = groupObj.root.getPrevious( true ) )
    350                          && !( previousNode.is && previousNode.isBlockBoundary( { br : 1 } ) ) )
    351                         editor.document.createElement( 'br' ).insertBefore( firstNode );
     345                // Compensate <br> before/after the list node if the surrounds are non-blocks.(#3836)
     346                var docFragment = newList.listNode, boundaryNode, siblingNode;
     347                function compensateBrs( isStart )
     348                {
     349                        if ( ( boundaryNode = docFragment[ isStart ? 'getFirst' : 'getLast' ]() )
     350                                 && !( boundaryNode.is && boundaryNode.isBlockBoundary() )
     351                                 && ( siblingNode = groupObj.root[ isStart ? 'getPrevious' : 'getNext' ]
     352                                      ( CKEDITOR.dom.walker.whitespaces( true ) ) )
     353                                 && !( siblingNode.is && siblingNode.isBlockBoundary( { br : 1 } ) ) )
     354                                editor.document.createElement( 'br' )[ isStart ? 'insertBefore' : 'insertAfter' ]( boundaryNode );
     355                }
     356                compensateBrs( true );
     357                compensateBrs();
    352358
    353359                var rootParent = groupObj.root.getParent();
    354360                docFragment.replace( groupObj.root );
    355                 // The list content might be empty.(#3782)
    356                 if( !CKEDITOR.env.ie && rootParent )
    357                         rootParent.appendBogus();
    358361        }
    359362
    360363        function listCommand( name, type )
  • CHANGES.html

     
    210210                <li><a href="http://dev.fckeditor.net/ticket/4123">#4123</a> : Some dialog buttons were broken in IE7 quirks.</li>
    211211                <li><a href="http://dev.fckeditor.net/ticket/4122">#4122</a> : [IE] The image dialog
    212212                        was being rendered improperly when loading an image with long URL.</li>
     213                <li><a href="http://dev.fckeditor.net/ticket/4139">#4139</a> : Fixed list plugin logics which broken TC of plugin/list/test_ticket_3836.</li>
    213214        </ul>
    214215        <h3>
    215216                CKEditor 3.0 RC</h3>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy