瀏覽代碼

Fixed: MergeDelta x MoveDelta transformation case should not be applied in undo mode.

Szymon Cofalik 8 年之前
父節點
當前提交
b1ae45e617
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      packages/ckeditor5-engine/src/model/delta/basic-transformations.js

+ 8 - 4
packages/ckeditor5-engine/src/model/delta/basic-transformations.js

@@ -141,8 +141,10 @@ addTransformationCase( MarkerDelta, RenameDelta, transformMarkerDelta );
 
 // Add special case for MoveDelta x MergeDelta transformation.
 addTransformationCase( MoveDelta, MergeDelta, ( a, b, context ) => {
-	// Do not apply special transformation case if `MergeDelta` has `NoOperation` as the second operation.
-	if ( !b.position ) {
+	const undoMode = context.aWasUndone || context.bWasUndone;
+
+	// Do not apply special transformation case in undo mode or if `MergeDelta` has `NoOperation` as the second operation.
+	if ( undoMode || !b.position ) {
 		return defaultTransform( a, b, context );
 	}
 
@@ -185,8 +187,10 @@ addTransformationCase( MergeDelta, InsertDelta, ( a, b, context ) => {
 
 // Add special case for MergeDelta x MoveDelta transformation.
 addTransformationCase( MergeDelta, MoveDelta, ( a, b, context ) => {
-	// Do not apply special transformation case if `MergeDelta` has `NoOperation` as the second operation.
-	if ( !a.position ) {
+	const undoMode = context.aWasUndone || context.bWasUndone;
+
+	// Do not apply special transformation case in undo mode or if `MergeDelta` has `NoOperation` as the second operation.
+	if ( undoMode || !a.position ) {
 		return defaultTransform( a, b, context );
 	}