X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fdomiterator%2Fplugin.js;h=ded0a32cd432b20ca4ca709d2ebff543a18688ba;hp=a7a8e4d4ad3f170e4425ba0add66b522b67e1495;hb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;hpb=8761695d9b70afe75905deaac88f78c1f8aeb32d diff --git a/_source/plugins/domiterator/plugin.js b/_source/plugins/domiterator/plugin.js index a7a8e4d..ded0a32 100644 --- a/_source/plugins/domiterator/plugin.js +++ b/_source/plugins/domiterator/plugin.js @@ -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;