Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Fix: Corrected transformations for pasting and undo scenarios.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Oct 23, 2018
1 parent 260a22f commit 6a37874
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/operation/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,9 +1692,10 @@ setTransformation( MoveOperation, MergeOperation, ( a, b, context ) => {
// removed nodes might be unexpected. This means that in this scenario we will reverse merging and remove the element.
//
if ( !context.aWasUndone ) {
const gyMove = new MoveOperation( b.graveyardPosition, 1, a.targetPosition.getShiftedBy( -1 ), 0 );
const gyMoveTarget = Position.createFromPosition( b.graveyardPosition );
const gyMove = new MoveOperation( b.graveyardPosition, 1, gyMoveTarget, 0 );

const targetPositionPath = gyMove.getMovedRangeStart().path.slice();
const targetPositionPath = b.graveyardPosition.path.slice();
targetPositionPath.push( 0 );

return [
Expand Down
3 changes: 3 additions & 0 deletions tests/model/operation/transform/undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,5 +384,8 @@ describe( 'transform', () => {

john.redo();
expectClients( '<paragraph>Fo1</paragraph><paragraph>2ar</paragraph>' );

john.undo();
expectClients( '<paragraph>Foo</paragraph><paragraph>Bar</paragraph>' );
} );
} );

0 comments on commit 6a37874

Please sign in to comment.