Ticket #3664: 3664_3.patch

File 3664_3.patch, 1.2 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    8181
    8282                                // If we're inserting a block at dtd-violated position, split
    8383                                // the parent blocks until we reach blockLimit.
    84                                 var parent, dtd;
    85                                 if ( this.config.enterMode != CKEDITOR.ENTER_BR && isBlock )
     84                                var current, dtd;
     85                                if ( isBlock )
    8686                                {
    87                                         while( ( parent = range.getCommonAncestor( false, true ) )
    88                                                         && ( dtd = CKEDITOR.dtd[ parent.getName() ] )
     87                                        while( ( current = range.getCommonAncestor( false, true ) )
     88                                                        && ( dtd = CKEDITOR.dtd[ current.getName() ] )
    8989                                                        && !( dtd && dtd [ elementName ] ) )
    9090                                        {
    91                                                 range.splitBlock();
     91                                                // If we're in an empty block which indicate a new paragraph,
     92                                                // simply replace it with the inserting block.(#3664)
     93                                                if ( range.checkStartOfBlock()
     94                                                         && range.checkEndOfBlock() )
     95                                                {
     96                                                        range.setStartBefore( current );
     97                                                        range.collapse( true );
     98                                                        current.remove();
     99                                                }
     100                                                else
     101                                                        range.splitBlock();
    92102                                        }
    93103                                }
    94104
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy