Ticket #4790: 4790.patch

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

     
    1212        var listNodeNames = { ol : 1, ul : 1 },
    1313                emptyTextRegex = /^[\n\r\t ]*$/;
    1414
     15        var whitespaces = CKEDITOR.dom.walker.whitespaces(),
     16                bookmarks = CKEDITOR.dom.walker.bookmark(),
     17                nonEmpty = function( node ){ return !( whitespaces( node ) || bookmarks( node ) ); };
     18
    1519        CKEDITOR.plugins.list = {
    1620                /*
    1721                 * Convert a DOM list tree into a data structure that is easier to
     
    125129                                        if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT
    126130                                                 && currentIndex != listArray.length - 1 )
    127131                                        {
    128                                                 if ( currentListItem.getLast()
    129                                                                 && currentListItem.getLast().type == CKEDITOR.NODE_ELEMENT
    130                                                                 && currentListItem.getLast().getAttribute( 'type' ) == '_moz' )
    131                                                         currentListItem.getLast().remove();
    132                                                 currentListItem.appendBogus();
    133                                         }
     132                                                var last = currentListItem.getLast();
     133                                                if ( last && last.type == CKEDITOR.NODE_ELEMENT
     134                                                                && last.getAttribute( 'type' ) == '_moz' )
     135                                                {
     136                                                        last.remove();
     137                                                }
    134138
     139                                                if ( !( last = currentListItem.getLast( nonEmpty )
     140                                                        && last.type == CKEDITOR.NODE_ELEMENT
     141                                                        && last.getName() in CKEDITOR.dtd.$block ) )
     142                                                {
     143                                                        currentListItem.append( doc.createElement( 'br' ) );
     144                                                }
     145                                        }
     146
    135147                                        if ( currentListItem.type == CKEDITOR.NODE_ELEMENT &&
    136148                                                        currentListItem.getName() == paragraphName &&
    137149                                                        currentListItem.$.firstChild )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy