Ticket #3664: 3664.patch

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

     
    7979                                // If we're inserting a block at dtd-violated positoin, split
    8080                                // the parent blocks until we reach blockLimit.
    8181                                var parent, dtd;
    82                                 if ( this.config.enterMode != CKEDITOR.ENTER_BR && isBlock )
     82                                if ( isBlock )
    8383                                        while( ( parent = range.getCommonAncestor( false, true ) )
    8484                                                        && ( dtd = CKEDITOR.dtd[ parent.getName() ] )
    8585                                                        && !( dtd && dtd [ elementName ] ) )
    86                                                 range.splitBlock();
     86                                        {
     87                                                // If we're in an 'blank' block, just replace it later
     88                                                // by the new block.(#3664)
     89                                                var children, count, firstChild;
     90                                                if ( this.config.enterMode != CKEDITOR.ENTER_BR
     91                                                          && parent.getName() in CKEDITOR.dtd.$block
     92                                                          && ( children = parent.getChildren() )
     93                                                          && ( ( count = children.count() ) || true )
     94                                                          && ( !count ||
     95                                                               count == 1
     96                                                                   && ( firstChild = children.getItem( 0 ) )
     97                                                                   && firstChild.is && firstChild.is( 'br' ) ) )
     98                                                {
     99                                                        range.setStartBefore( parent );
     100                                                        range.collapse( true );
     101                                                        parent.remove();
     102                                                }
     103                                                else
     104                                                        range.splitBlock();
     105                                        }
    87106
    88107                                // Insert the new node.
    89108                                range.insertNode( clone );
  • _source/plugins/domiterator/plugin.js

     
    6262                                {
    6363                                                this._.lastNode = range.document.createText( '' );
    6464                                                this._.lastNode.insertAfter( lastNode );
     65                                                this._.lastNode.isDirty = true;
    6566                                }
    6667                                // Let's reuse this variable.
    6768                                range = null;
     
    208209                                if ( !range )
    209210                                {
    210211                                        this._.nextNode = null;
     212
     213                                        // We've finished the iteration, remove the last node on dirty.
     214                                        if ( this._.lastNode.isDirty )
     215                                                this._.lastNode.remove();
     216
    211217                                        return null;
    212218                                }
    213219
     
    304310                                this._.nextNode = ( isLast || block.equals( lastNode ) ) ? null :
    305311                                        block.getNextSourceNode( true, null, lastNode );
    306312                        }
    307 
     313                       
    308314                        return block;
    309315                }
    310316        };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy