diff --git a/src/model/differ.js b/src/model/differ.js index aa881a877..2fa41fa7b 100644 --- a/src/model/differ.js +++ b/src/model/differ.js @@ -149,6 +149,12 @@ export default class Differ { case 'remove': case 'move': case 'reinsert': { + // When range is moved to the same position then not mark it as a change. + // See: https://github.com/ckeditor/ckeditor5-engine/issues/1664. + if ( operation.sourcePosition.isEqual( operation.targetPosition ) ) { + return; + } + const sourceParentInserted = this._isInInsertedElement( operation.sourcePosition.parent ); const targetParentInserted = this._isInInsertedElement( operation.targetPosition.parent ); diff --git a/tests/model/differ.js b/tests/model/differ.js index 505251afa..8bb149f20 100644 --- a/tests/model/differ.js +++ b/tests/model/differ.js @@ -629,6 +629,17 @@ describe( 'Differ', () => { ] ); } ); } ); + + // https://github.com/ckeditor/ckeditor5-engine/issues/1664 + it( 'move to the same position', () => { + const position = new Position( root, [ 0 ] ); + + model.change( () => { + move( position, 1, position ); + + expectChanges( [] ); + } ); + } ); } ); describe( 'rename', () => {