Ticket #6849: 6849.patch

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

     
    6060                        var isStartOfBlock      = splitInfo.wasStartOfBlock,
    6161                                isEndOfBlock    = splitInfo.wasEndOfBlock;
    6262
    63                         var node;
     63                        var node,
     64                                newBlock,
     65                                newBlockDir;
    6466
    6567                        // If this is a block under a list item, split it as well. (#1647)
    66                         if ( nextBlock )
     68                        if ( nextBlock && ( node = nextBlock.getParent() ) && node.is( 'li' ) )
    6769                        {
    68                                 node = nextBlock.getParent();
    69                                 if ( node.is( 'li' ) )
    70                                 {
    71                                         nextBlock.breakParent( node );
    72                                         nextBlock.move( nextBlock.getNext(), 1 );
    73                                 }
    74                         }
     70                                nextBlock.breakParent( node );
     71                                newBlock = nextBlock.clone();
     72                                !CKEDITOR.env.ie && newBlock.appendBogus();
     73                                newBlock.move( nextBlock.getPrevious() );
     74                                nextBlock.move( nextBlock.getNext(), 1 );
     75                                range.moveToElementEditStart( nextBlock );
     76                        }
    7577                        else if ( previousBlock && ( node = previousBlock.getParent() ) && node.is( 'li' ) )
    7678                        {
    7779                                previousBlock.breakParent( node );
    78                                 range.moveToElementEditStart( previousBlock.getNext() );
     80                                newBlock = previousBlock.getNext();
    7981                                previousBlock.move( previousBlock.getPrevious() );
     82                                range.moveToElementEditStart( newBlock );
    8083                        }
    81 
    8284                        // If we have both the previous and next blocks, it means that the
    8385                        // boundaries were on separated blocks, or none of them where on the
    8486                        // block limits (start/end).
    85                         if ( !isStartOfBlock && !isEndOfBlock )
     87                        else if ( !isStartOfBlock && !isEndOfBlock )
    8688                        {
    8789                                // If the next block is an <li> with another list tree as the first
    8890                                // child, we'll need to append a filler (<br>/NBSP) or the list item
     
    98100                        }
    99101                        else
    100102                        {
    101                                 var newBlock,
    102                                         newBlockDir;
    103 
    104103                                if ( previousBlock )
    105104                                {
    106105                                        // Do not enter this block if it's a header tag, or we are in
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy