X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Frange.js;h=a8b102d933599d5a5f332b7df784b4633457b9e1;hb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;hp=5b1681f850c41a5118ac98bb844b7e584a1c97fb;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git
diff --git a/_source/core/dom/range.js b/_source/core/dom/range.js
index 5b1681f..a8b102d 100644
--- a/_source/core/dom/range.js
+++ b/_source/core/dom/range.js
@@ -278,7 +278,7 @@ CKEDITOR.dom.range = function( document )
if ( CKEDITOR.tools.trim( node.getText() ).length )
return false;
}
- else
+ else if( node.type == CKEDITOR.NODE_ELEMENT )
{
// If there are non-empty inline elements (e.g. ), then we're not
// at the start.
@@ -308,6 +308,15 @@ CKEDITOR.dom.range = function( document )
|| node.getParent().hasAttribute( '_fck_bookmark' );
}
+ var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
+ bookmarkEval = new CKEDITOR.dom.walker.bookmark();
+
+ function nonWhitespaceOrBookmarkEval( node )
+ {
+ // Whitespaces and bookmark nodes are to be ignored.
+ return !whitespaceEval( node ) && !bookmarkEval( node );
+ }
+
CKEDITOR.dom.range.prototype =
{
clone : function()
@@ -1183,7 +1192,8 @@ CKEDITOR.dom.range = function( document )
this.setStartAt(
blockBoundary,
!blockBoundary.is( 'br' ) &&
- ( !enlargeable || blockBoundary.contains( enlargeable ) ) ?
+ ( !enlargeable && this.checkStartOfBlock()
+ || enlargeable && blockBoundary.contains( enlargeable ) ) ?
CKEDITOR.POSITION_AFTER_START :
CKEDITOR.POSITION_AFTER_END );
@@ -1208,8 +1218,8 @@ CKEDITOR.dom.range = function( document )
// the document position of it with 'enlargeable' node.
this.setEndAt(
blockBoundary,
- !blockBoundary.is( 'br' ) &&
- ( !enlargeable || blockBoundary.contains( enlargeable ) ) ?
+ ( !enlargeable && this.checkEndOfBlock()
+ || enlargeable && blockBoundary.contains( enlargeable ) ) ?
CKEDITOR.POSITION_BEFORE_END :
CKEDITOR.POSITION_BEFORE_START );
// We must include the
at the end of range if there's
@@ -1457,19 +1467,7 @@ CKEDITOR.dom.range = function( document )
}
else
{
- // Extract the contents of the block from the selection point to the end
- // of its contents.
- this.setEndAt( startBlock, CKEDITOR.POSITION_BEFORE_END );
- var documentFragment = this.extractContents();
-
- // Duplicate the block element after it.
- endBlock = startBlock.clone( false );
-
- // Place the extracted contents into the duplicated block.
- documentFragment.appendTo( endBlock );
- endBlock.insertAfter( startBlock );
- this.moveToPosition( startBlock, CKEDITOR.POSITION_AFTER_END );
-
+ endBlock = this.splitElement( startBlock );
// In Gecko, the last child node must be a bogus
.
// Note: bogus
added under