浏览代码

Improve docs for isSameTree.

Piotr Jasiun 8 年之前
父节点
当前提交
a778fff826
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      packages/ckeditor5-engine/src/model/batch.js

+ 7 - 1
packages/ckeditor5-engine/src/model/batch.js

@@ -949,9 +949,15 @@ function addMarkerOperation( batch, name, oldRange, newRange ) {
 // collaboration may track changes on the document but ignore changes on detached fragments and should not get
 // unexpected `move` operation.
 function isSameTree( rootA, rootB ) {
+	// If it is the same root this is the same tree.
 	if ( rootA === rootB ) {
 		return true;
 	}
 
-	return rootA instanceof RootElement && rootB instanceof RootElement;
+	// If both roots are documents root it is operation within the document what we still treat as the same tree.
+	if ( rootA instanceof RootElement && rootB instanceof RootElement ) {
+		return true;
+	}
+
+	return false;
 }