X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fdomiterator%2Fplugin.js;h=9fc5fd5400ea537d853c3a93ce1243066a1edbb7;hp=f0b18357659138979c2f5c292ff6d93d26e7a66e;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7
diff --git a/_source/plugins/domiterator/plugin.js b/_source/plugins/domiterator/plugin.js
index f0b1835..9fc5fd5 100644
--- a/_source/plugins/domiterator/plugin.js
+++ b/_source/plugins/domiterator/plugin.js
@@ -20,11 +20,11 @@ CKEDITOR.plugins.add( 'domiterator' );
return;
this.range = range;
- this.forceBrBreak = false;
+ this.forceBrBreak = 0;
// Whether include
s into the enlarged range.(#3730).
- this.enlargeBr = true;
- this.enforceRealBlocks = false;
+ this.enlargeBr = 1;
+ this.enforceRealBlocks = 0;
this._ || ( this._ = {} );
}
@@ -80,7 +80,7 @@ CKEDITOR.plugins.add( 'domiterator' );
// next block.(#3887)
if ( this._.lastNode &&
this._.lastNode.type == CKEDITOR.NODE_TEXT &&
- !CKEDITOR.tools.trim( this._.lastNode.getText( ) ) &&
+ !CKEDITOR.tools.trim( this._.lastNode.getText() ) &&
this._.lastNode.getParent().isBlockBoundary() )
{
var testRange = new CKEDITOR.dom.range( range.document );
@@ -112,13 +112,13 @@ CKEDITOR.plugins.add( 'domiterator' );
{
// closeRange indicates that a paragraph boundary has been found,
// so the range can be closed.
- var closeRange = false,
- parentPre = currentNode.hasAscendant( 'pre' );
+ var closeRange = 0,
+ parentPre = currentNode.hasAscendant( 'pre' );
// includeNode indicates that the current node is good to be part
// of the range. By default, any non-element node is ok for it.
var includeNode = ( currentNode.type != CKEDITOR.NODE_ELEMENT ),
- continueFromSibling = false;
+ continueFromSibling = 0;
// If it is an element node, let's check if it can be part of the
// range.
@@ -132,7 +132,7 @@ CKEDITOR.plugins.add( 'domiterator' );
//
boundaries must be part of the range. It will
// happen only if ForceBrBreak.
if ( nodeName == 'br' )
- includeNode = true;
+ includeNode = 1;
else if ( !range && !currentNode.getChildCount() && nodeName != 'hr' )
{
// If we have found an empty block, and haven't started
@@ -154,7 +154,7 @@ CKEDITOR.plugins.add( 'domiterator' );
this._.nextNode = currentNode;
}
- closeRange = true;
+ closeRange = 1;
}
else
{
@@ -171,7 +171,7 @@ CKEDITOR.plugins.add( 'domiterator' );
currentNode = currentNode.getFirst();
continue;
}
- includeNode = true;
+ includeNode = 1;
}
}
else if ( currentNode.type == CKEDITOR.NODE_TEXT )
@@ -179,7 +179,7 @@ CKEDITOR.plugins.add( 'domiterator' );
// Ignore normal whitespaces (i.e. not including or
// other unicode whitespaces) before/after a block node.
if ( beginWhitespaceRegex.test( currentNode.getText() ) )
- includeNode = false;
+ includeNode = 0;
}
// The current node is good to be part of the range and we are
@@ -204,15 +204,15 @@ CKEDITOR.plugins.add( 'domiterator' );
if ( parentNode.isBlockBoundary( this.forceBrBreak
&& !parentPre && { br : 1 } ) )
{
- closeRange = true;
+ closeRange = 1;
isLast = isLast || ( parentNode.equals( lastNode) );
break;
}
currentNode = parentNode;
- includeNode = true;
+ includeNode = 1;
isLast = ( currentNode.equals( lastNode ) );
- continueFromSibling = true;
+ continueFromSibling = 1;
}
}
@@ -302,6 +302,9 @@ CKEDITOR.plugins.add( 'domiterator' );
}
}
+ // Ignore bookmark nodes.(#3783)
+ var bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true );
+
if ( removePreviousBr )
{
var previousSibling = block.getPrevious();
@@ -316,9 +319,6 @@ CKEDITOR.plugins.add( 'domiterator' );
if ( removeLastBr )
{
- // Ignore bookmark nodes.(#3783)
- var bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true );
-
var lastChild = block.getLast();
if ( lastChild && lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.getName() == 'br' )
{
@@ -339,6 +339,12 @@ CKEDITOR.plugins.add( 'domiterator' );
block.getNextSourceNode( true, null, lastNode );
}
+ if ( !bookmarkGuard( this._.nextNode ) )
+ {
+ this._.nextNode = this._.nextNode.getNextSourceNode( true, null, function( node )
+ { return !node.equals( lastNode ) && bookmarkGuard( node ); } );
+ }
+
return block;
}
};