X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdomiterator%2Fplugin.js;h=f463645527e76a5f0a2a384d2d9cf204300abb11;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hp=a7a8e4d4ad3f170e4425ba0add66b522b67e1495;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/domiterator/plugin.js b/_source/plugins/domiterator/plugin.js index a7a8e4d..f463645 100644 --- a/_source/plugins/domiterator/plugin.js +++ b/_source/plugins/domiterator/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -12,7 +12,7 @@ CKEDITOR.plugins.add( 'domiterator' ); (function() { - var iterator = function( range ) + function iterator( range ) { if ( arguments.length < 1 ) return; @@ -25,9 +25,10 @@ CKEDITOR.plugins.add( 'domiterator' ); this.enforceRealBlocks = false; this._ || ( this._ = {} ); - }, - beginWhitespaceRegex = /^[\r\n\t ]+$/; + } + var beginWhitespaceRegex = /^[\r\n\t ]+$/, + isBookmark = CKEDITOR.dom.walker.bookmark(); iterator.prototype = { getNextParagraph : function( blockTag ) @@ -212,14 +213,12 @@ CKEDITOR.plugins.add( 'domiterator' ); if ( ( closeRange || isLast ) && range ) { var boundaryNodes = range.getBoundaryNodes(), - startPath = new CKEDITOR.dom.elementPath( range.startContainer ), - endPath = new CKEDITOR.dom.elementPath( range.endContainer ); - - // Drop the range if it only contains bookmark nodes.(#4087) - if ( boundaryNodes.startNode.equals( boundaryNodes.endNode ) - && boundaryNodes.startNode.getParent().equals( startPath.blockLimit ) - && boundaryNodes.startNode.type == CKEDITOR.NODE_ELEMENT - && boundaryNodes.startNode.getAttribute( '_fck_bookmark' ) ) + startPath = new CKEDITOR.dom.elementPath( range.startContainer ); + + // Drop the range if it only contains bookmark nodes, and is + // not because of the original collapsed range. (#4087,#4450) + if ( boundaryNodes.startNode.getParent().equals( startPath.blockLimit ) + && isBookmark( boundaryNodes.startNode ) && isBookmark( boundaryNodes.endNode ) ) { range = null; this._.nextNode = null;