Ticket #6728: 6728_7.patch

File 6728_7.patch, 4.9 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/bidi/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
    55
    66(function()
    77{
    8         var guardElements = { table:1, tbody: 1, ul:1, ol:1, blockquote:1, div:1, tr: 1 },
     8        var guardElements = { table:1, ul:1, ol:1, blockquote:1, div:1 },
    99                directSelectionGuardElements = {},
    1010                // All guard elements which can have a direction applied on them.
    1111                allGuardElements = {};
     
    153153                        while ( ancestor && ancestor.type == CKEDITOR.NODE_ELEMENT
    154154                                        && ( parent = ancestor.getParent() )
    155155                                        && parent.getChildCount() == 1
    156                                         && ( !( ancestor.getName() in elements ) || ( parent.getName() in elements ) )
    157                                         )
     156                                        && !( ancestor.getName() in elements ) )
    158157                                ancestor = parent;
    159158
    160159                        return ancestor.type == CKEDITOR.NODE_ELEMENT
     
    209208                                        {
    210209                                                return !! ( node.type == CKEDITOR.NODE_ELEMENT
    211210                                                                && node.getName() in guardElements
    212                                                                 && !( node.getName() == ( enterMode == CKEDITOR.ENTER_P ) ? 'p' : 'div'
     211                                                                && !( node.getName() == ( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' )
    213212                                                                        && node.getParent().type == CKEDITOR.NODE_ELEMENT
    214213                                                                        && node.getParent().getName() == 'blockquote' )
    215214                                                                // Element must be fully included in the range as well. (#6485).
     
    225224
    226225                                        while ( ( block = iterator.getNextParagraph() ) )
    227226                                                !block.isReadOnly() && switchDir( block, dir, editor, database );
    228                                 }
     227                                        }
    229228
    230229                                CKEDITOR.dom.element.clearAllMarkers( database );
    231230
  • _source/plugins/domiterator/plugin.js

     
    3030        }
    3131
    3232        var beginWhitespaceRegex = /^[\r\n\t ]+$/,
    33                 isBookmark = CKEDITOR.dom.walker.bookmark();
     33                // Ignore bookmark nodes.(#3783)
     34                bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true );
    3435
     36        // Get a reference for the next element, bookmark nodes are skipped.
     37        function getNextSourceNode( node, startFromSibling, lastNode )
     38        {
     39                var next = node.getNextSourceNode( startFromSibling, null, lastNode );
     40                while ( !bookmarkGuard( next ) )
     41                        next = next.getNextSourceNode( startFromSibling, null, lastNode );
     42                return next;
     43        }
     44
    3545        iterator.prototype = {
    3646                getNextParagraph : function( blockTag )
    3747                {
     
    220230                                if ( includeNode )
    221231                                        range.setEndAt( currentNode, CKEDITOR.POSITION_AFTER_END );
    222232
    223                                 currentNode = currentNode.getNextSourceNode( continueFromSibling, null, lastNode );
     233                                currentNode = getNextSourceNode ( currentNode, continueFromSibling, lastNode );
    224234                                isLast = !currentNode;
    225235
    226236                                // We have found a block boundary. Let's close the range and move out of the
     
    256266                                        // Create the fixed block.
    257267                                        block = this.range.document.createElement( blockTag || 'p' );
    258268
    259                                         // Move the contents of the temporary range to the fixed block.
    260                                         range.extractContents().appendTo( block );
    261                                         block.trim();
     269                                                // Move the contents of the temporary range to the fixed block.
     270                                                range.extractContents().appendTo( block );
     271                                                block.trim();
    262272
    263                                         // Insert the fixed block into the DOM.
    264                                         range.insertNode( block );
     273                                                // Insert the fixed block into the DOM.
     274                                                range.insertNode( block );
    265275
    266                                         removePreviousBr = removeLastBr = true;
    267                                 }
     276                                                removePreviousBr = removeLastBr = true;
     277                                        }
    268278                                else if ( block.getName() != 'li' )
    269279                                {
    270280                                        // If the range doesn't includes the entire contents of the
     
    297307                                        // the current range, which could be an <li> child (nested
    298308                                        // lists) or the next sibling <li>.
    299309
    300                                         this._.nextNode = ( block.equals( lastNode ) ? null :
    301                                                 range.getBoundaryNodes().endNode.getNextSourceNode( true, null, lastNode ) );
     310                                        this._.nextNode = ( block.equals( lastNode ) ? null : getNextSourceNode( range.getBoundaryNodes().endNode, 1, lastNode ) );
    302311                                }
    303312                        }
    304313
    305                         // Ignore bookmark nodes.(#3783)
    306                         var bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true );
    307 
    308314                        if ( removePreviousBr )
    309315                        {
    310316                                var previousSibling = block.getPrevious();
     
    336342                        if ( !this._.nextNode )
    337343                        {
    338344                                this._.nextNode = ( isLast || block.equals( lastNode ) ) ? null :
    339                                         block.getNextSourceNode( true, null, lastNode );
     345                                        getNextSourceNode( block, 1, lastNode );
    340346                        }
    341347
    342                         if ( !bookmarkGuard( this._.nextNode ) )
    343                         {
    344                                 this._.nextNode = this._.nextNode.getNextSourceNode( true, null, function( node )
    345                                         { return !node.equals( lastNode ) && bookmarkGuard( node ); } );
    346                         }
    347 
    348348                        return block;
    349349                }
    350350        };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy