X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fdomiterator%2Fplugin.js;h=5c092bba559b7efa8509ac066373cc56f1cb7ae6;hp=22815c45e2d80622a2fc20fde5ac4433d63729d8;hb=4e90e78dc97789709ee7404359a5517540c27553;hpb=8f6c203fdaa543c3bca40baea6ae4ddcdf1a77f5 diff --git a/_source/plugins/domiterator/plugin.js b/_source/plugins/domiterator/plugin.js index 22815c4..5c092bb 100644 --- a/_source/plugins/domiterator/plugin.js +++ b/_source/plugins/domiterator/plugin.js @@ -31,7 +31,9 @@ CKEDITOR.plugins.add( 'domiterator' ); var beginWhitespaceRegex = /^[\r\n\t ]+$/, // Ignore bookmark nodes.(#3783) - bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true ); + bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true ), + whitespacesGuard = CKEDITOR.dom.walker.whitespaces( true ), + skipGuard = function( node ) { return bookmarkGuard( node ) && whitespacesGuard( node ); }; // Get a reference for the next element, bookmark nodes are skipped. function getNextSourceNode( node, startFromSibling, lastNode ) @@ -207,7 +209,7 @@ CKEDITOR.plugins.add( 'domiterator' ); // to close the range, otherwise we include the parent within it. if ( range && !closeRange ) { - while ( !currentNode.getNext( bookmarkGuard ) && !isLast ) + while ( !currentNode.getNext( skipGuard ) && !isLast ) { var parentNode = currentNode.getParent(); @@ -215,7 +217,10 @@ CKEDITOR.plugins.add( 'domiterator' ); && !parentPre && { br : 1 } ) ) { closeRange = 1; + includeNode = 0; isLast = isLast || ( parentNode.equals( lastNode) ); + // Make sure range includes bookmarks at the end of the block. (#7359) + range.setEndAt( parentNode, CKEDITOR.POSITION_BEFORE_END ); break; }