Ticket #3664: 3664_2.patch

File 3664_2.patch, 1.3 KB (added by Garry Yao, 15 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 )
    86                                 {
    87                                         while( ( parent = range.getCommonAncestor( false, true ) )
    88                                                         && ( dtd = CKEDITOR.dtd[ parent.getName() ] )
     84                                var current, dtd;
     85                                if ( isBlock )
     86                                        while( ( current = range.getCommonAncestor( false, true ) )
     87                                                        && ( dtd = CKEDITOR.dtd[ current.getName() ] )
    8988                                                        && !( dtd && dtd [ elementName ] ) )
    9089                                        {
    91                                                 range.splitBlock();
     90                                                // If we're in an 'blank' block, just replace it later
     91                                                // by the new block.(#3664)
     92                                                var children, count, firstChild;
     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                                        }
    93                                 }
    94103
    95104                                // Insert the new node.
    96105                                range.insertNode( clone );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy