Selaa lähdekoodia

Fixed: MergeDelta and SplitDelta did not create correct sticky MoveOperations.

Szymon Cofalik 9 vuotta sitten
vanhempi
sitoutus
751ab03771

+ 10 - 0
packages/ckeditor5-engine/src/model/delta/mergedelta.js

@@ -32,6 +32,16 @@ export default class MergeDelta extends Delta {
 		return this._removeOperation ? this._removeOperation.sourcePosition : null;
 		return this._removeOperation ? this._removeOperation.sourcePosition : null;
 	}
 	}
 
 
+	getReversed() {
+		let delta = super.getReversed();
+
+		if ( delta.operations.length > 0 ) {
+			delta.operations[ 1 ].isSticky = false;
+		}
+
+		return delta;
+	}
+
 	/**
 	/**
 	 * Operation in this delta that removes the node after merge position (which will be empty at that point) or
 	 * Operation in this delta that removes the node after merge position (which will be empty at that point) or
 	 * `null` if the delta has no operations. Note, that after {@link engine.model.delta.transform transformation}
 	 * `null` if the delta has no operations. Note, that after {@link engine.model.delta.transform transformation}

+ 10 - 0
packages/ckeditor5-engine/src/model/delta/splitdelta.js

@@ -32,6 +32,16 @@ export default class SplitDelta extends Delta {
 		return this._moveOperation ? this._moveOperation.sourcePosition : null;
 		return this._moveOperation ? this._moveOperation.sourcePosition : null;
 	}
 	}
 
 
+	getReversed() {
+		let delta = super.getReversed();
+
+		if ( delta.operations.length > 0 ) {
+			delta.operations[ 0 ].isSticky = true;
+		}
+
+		return delta;
+	}
+
 	/**
 	/**
 	 * Operation in the delta that adds a node to the tree model where split elements will be moved to or `null` if
 	 * Operation in the delta that adds a node to the tree model where split elements will be moved to or `null` if
 	 * there are no operations in the delta.
 	 * there are no operations in the delta.