Ticket #3312: 3312_2.patch

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

     
    7878
    7979                var node;
    8080
    81                 // If this is a block under a list item, split it as well. (#1647)
     81                // 1. If this is a block under a list item, split it as well. (#1647)
     82                // 2. Exit the whole list if it's the last empty first-level list item. (#3312)
    8283                if ( nextBlock )
    8384                {
    8485                        node = nextBlock.getParent();
     
    9495                        range.moveToElementEditStart( previousBlock.getNext() );
    9596                        previousBlock.move( previousBlock.getPrevious() );
    9697                }
     98                else if ( ( node = previousBlock ) && node.is( 'li' )
     99                                        && node.getParent().is( 'ul', 'ol' )
     100                                        && !node.getNext()
     101                                        && !CKEDITOR.tools.trim( node.getText() ).length )
     102                {
     103                        var editableElement;
     104                        // Locate the next content edit-able element of this node.
     105                        function getNextEditableElement( node )
     106                        {
     107                                var walker = new CKEDITOR.dom.walker( node );
     108                                walker.evaluator = function( toNode ){
     109                                        return ( !!toNode.isEditable && toNode.isEditable() );
     110                                };
     111                                return walker.next();
     112                        }
     113                       
     114                        if ( editableElement = getNextEditableElement(
     115                                                ( node.getLast && node.getLast() )|| node ) )
     116                        {
     117                                editableElement.scrollIntoView();
     118                                range.moveToPosition( editableElement, CKEDITOR.POSITION_AFTER_START );
     119                                range.select();
     120                        }
    97121
     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/core/dom/element.js

     
    547547                 */
    548548                getText : function()
    549549                {
    550                         return this.$.textContent || this.$.innerText;
     550                        return this.$.textContent || this.$.innerText || '';
    551551                },
    552552
    553553                /**
  • _source/core/dom/text.js

     
    6464
    6565                getText : function()
    6666                {
    67                         return this.$.nodeValue;
     67                        return this.$.nodeValue || '';
     68                },
     69
     70                isEditable : function()
     71                {       
     72                        return true;
     73                },
     74
     75                scrollIntoView : function()
     76                {
     77                        return this.getParent().scrollIntoView();
    6878                },
    6979
    7080                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy