Ticket #3312: 3312_3.patch

File 3312_3.patch, 3.1 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/enterkey/plugin.js

     
    5757        {
    5858                // Get the range for the current selection.
    5959                range = range || getRange( editor );
     60               
     61                // splitBlock may change  the range later. 
     62                var orginalRange = range.clone();
    6063
    6164                var doc = range.document;
    6265
     
    7881
    7982                var node;
    8083
    81                 // If this is a block under a list item, split it as well. (#1647)
     84                // 1. If this is a block under a list item, split it as well. (#1647)
     85                // 2. Exit the whole list if it's the last empty first-level list item. (#3312)
    8286                if ( nextBlock )
    8387                {
    8488                        node = nextBlock.getParent();
     
    9498                        range.moveToElementEditStart( previousBlock.getNext() );
    9599                        previousBlock.move( previousBlock.getPrevious() );
    96100                }
    97 
     101                else if ( ( node = previousBlock ) && node.is( 'li' )
     102                                        && node.getParent().is( 'ul', 'ol' )
     103                                        && !node.getNext()
     104                                        && !CKEDITOR.tools.trim( node.getText() ).length )
     105                {
     106                        // Create marker node for recording the editable position before list outdentation.
     107                        if( !CKEDITOR.env.ie )
     108                        {
     109                                var markerNode =
     110                                        CKEDITOR.dom.element.createFromHtml( '<span id="_cke_marker_editable" >&nbsp;</span>' );
     111                                node.append( markerNode );
     112                        }
     113                        var listNode = node.getParent();
     114                        listNode = editor.plugins.indent.outdentList( editor, orginalRange, listNode );
     115                        if ( !CKEDITOR.env.ie )
     116                        {
     117                                range.moveToElementEditStart(
     118                                        ( markerNode = editor.document.getById( '_cke_marker_editable' ) ).getParent() );
     119                                markerNode.remove();
     120                                range.select();
     121                        }
     122                        return;
     123                }
    98124                // If we have both the previous and next blocks, it means that the
    99125                // boundaries were on separated blocks, or none of them where on the
    100126                // block limits (start/end).
  • _source/plugins/indent/plugin.js

     
    275275                        // Register the state changing handlers.
    276276                        editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, indent ) );
    277277                        editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, outdent ) );
     278                       
     279                        // Register 'outdent list' as public editor instance function. 
     280                        editor.plugins.indent.outdentList= CKEDITOR.tools.bind( indentList, outdent );
     281                       
    278282                },
    279283
    280284                requires : [ 'domiterator', 'list' ]
     
    279283
    280284                requires : [ 'domiterator', 'list' ]
    281285        } );
     286       
    282287})();
    283288
    284289CKEDITOR.tools.extend( CKEDITOR.config,
  • _source/core/dom/element.js

     
    551551                 */
    552552                getText : function()
    553553                {
    554                         return this.$.textContent || this.$.innerText;
     554                        return this.$.textContent || this.$.innerText || '';
    555555                },
    556556
    557557                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy