Ticket #9152: 9152.patch

File 9152.patch, 3.3 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/list/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    784784                           CKEDITOR.dtd[ node.getName() ][ '#' ];
    785785        }
    786786
    787         // Merge the visual line content at the cursor range into the block.
     787        // Join visually two block lines.
    788788        function joinNextLineToCursor( editor, cursor, nextCursor )
    789789        {
    790790                editor.fire( 'saveSnapshot' );
     
    798798
    799799                // Kill original bogus;
    800800                var currentPath = new CKEDITOR.dom.elementPath( cursor.startContainer );
    801                 var currentLi = currentPath.lastElement.getAscendant( 'li', 1 );
     801                var currentBlock = currentPath.lastElement.getAscendant( 'li', 1 ) || currentPath.block;
    802802
    803803                var bogus = currentPath.block.getBogus();
    804804                bogus && bogus.remove();
     
    815815                else
    816816                        cursor.startContainer.append( frag );
    817817
    818                 var nextPath = new CKEDITOR.dom.elementPath( nextCursor.startContainer );
    819                 var nextLi = nextCursor.startContainer.getAscendant( 'li', 1 );
     818                var nextPath = new CKEDITOR.dom.elementPath( nextCursor.startContainer ),
     819                        nextLi = nextCursor.startContainer.getAscendant( 'li', 1 );
    820820
    821821                // Move the sub list nested in the next list item.
    822822                if ( nextLi )
     
    825825                        if ( sublist )
    826826                        {
    827827                                // If next line is in the sub list of the current list item.
    828                                 if ( currentLi.contains( nextLi ) )
     828                                if ( currentBlock.contains( nextLi ) )
    829829                                {
    830830                                        mergeChildren( sublist, nextLi.getParent(), nextLi );
    831831                                        sublist.remove();
    832832                                }
    833833                                // Migrate the sub list to current list item.
    834834                                else
    835                                         currentLi.append( sublist );
     835                                        currentBlock.append( sublist );
    836836                        }
    837837                }
    838838
     
    922922                                                var body = editor.document.getBody();
    923923                                                var walker = new CKEDITOR.dom.walker( range.clone() );
    924924                                                walker.evaluator = function( node ) { return nonEmpty( node ) && !blockBogus( node ); };
     925                                                walker.guard = function( node, isOut ) { return !( isOut && node.type == CKEDITOR.NODE_ELEMENT && node.is( 'table' ) ) };
    925926
    926927                                                var cursor = range.clone();
    927928
     
    976977                                                }
    977978                                                else
    978979                                                {
    979                                                         var li = range.startContainer.getAscendant( 'li', 1 );
     980                                                        var next,
     981                                                                nextLine,
     982                                                                li = range.startContainer.getAscendant( 'li', 1 );
     983
    980984                                                        if ( li )
    981985                                                        {
    982986                                                                walker.range.setEndAt( body, CKEDITOR.POSITION_BEFORE_END );
     
    10071011                                                                if ( isAtEnd && next )
    10081012                                                                {
    10091013                                                                        // Put cursor range there.
    1010                                                                         var nextLine = range.clone();
     1014                                                                        nextLine = range.clone();
    10111015                                                                        nextLine.moveToElementEditStart( next );
    10121016
     1017                                                                        joinNextLineToCursor( editor, cursor, nextLine );
     1018                                                                        evt.cancel();
     1019                                                                }
     1020                                                        }
     1021                                                        else
     1022                                                        {
     1023                                                                // Handle Del key pressed before list.
     1024                                                                walker.range.setEndAt( body, CKEDITOR.POSITION_BEFORE_END );
     1025                                                                next = walker.next();
     1026                                                                if ( next && next.type == CKEDITOR.NODE_ELEMENT &&
     1027                                                                     next.getName() in listNodeNames )
     1028                                                                {
     1029                                                                        // Put cursor range there.
     1030                                                                        nextLine = range.clone();
     1031                                                                        nextLine.moveToElementEditStart( next );
    10131032                                                                        joinNextLineToCursor( editor, cursor, nextLine );
    10141033                                                                        evt.cancel();
    10151034                                                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy