浏览代码

Fixed: Range#_getTransformedByUnwrapOperation if the operation is a special case of unwrapping a node that is already in the graveyard.

Szymon Cofalik 7 年之前
父节点
当前提交
9305ae44ec
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      packages/ckeditor5-engine/src/model/position.js

+ 6 - 4
packages/ckeditor5-engine/src/model/position.js

@@ -599,15 +599,17 @@ export default class Position {
 			unwrappedRange.start.isEqual( this ) ||
 			unwrappedRange.end.isEqual( this );
 
+		let pos;
+
 		if ( isContained ) {
-			return this._getCombined( operation.position, operation.targetPosition );
+			pos = this._getCombined( operation.position, operation.targetPosition );
 		} else if ( this.isEqual( operation.targetPosition ) ) {
 			return Position.createFromPosition( this );
 		} else {
-			const pos = this._getTransformedByInsertion( operation.targetPosition, operation.howMany - 1 );
-
-			return pos._getTransformedByInsertion( operation.graveyardPosition, 1 );
+			pos = this._getTransformedByInsertion( operation.targetPosition, operation.howMany );
 		}
+
+		return pos._getTransformedByMove( operation.targetPosition.getShiftedBy( operation.howMany ), operation.graveyardPosition, 1 );
 	}
 
 	/**