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

Commit

Permalink
Merge ab6636f into c31bea6
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Feb 7, 2019
2 parents c31bea6 + ab6636f commit 74904a9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/model/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,13 +1317,11 @@ export default class Writer {
let isAffected = false;

if ( type == 'move' ) {
const intersecting =
isAffected =
positionOrRange.containsPosition( markerRange.start ) ||
positionOrRange.start.isEqual( markerRange.start ) ||
positionOrRange.containsPosition( markerRange.end ) ||
positionOrRange.end.isEqual( markerRange.end );

isAffected = intersecting && !positionOrRange.containsRange( markerRange );
} else {
// if type == 'merge'.
const elementBefore = positionOrRange.nodeBefore;
Expand Down
47 changes: 47 additions & 0 deletions tests/model/operation/transform/undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,51 @@ describe( 'transform', () => {
'<paragraph>B<m1:end></m1:end>ar</paragraph>'
);
} );

// https://github.com/ckeditor/ckeditor5-engine/issues/1668
it( 'marker and moves with undo-redo-undo', () => {
john.setData( '<paragraph>X[]Y</paragraph>' );

const inputBufferBatch = john.editor.commands.get( 'input' ).buffer.batch;

john.editor.model.enqueueChange( inputBufferBatch, () => {
john.type( 'a' );
john.type( 'b' );
john.type( 'c' );

john.setSelection( [ 0, 1 ], [ 0, 4 ] );
john.setMarker( 'm1' );
} );

expectClients( '<paragraph>X<m1:start></m1:start>abc<m1:end></m1:end>Y</paragraph>' );

john.setSelection( [ 0, 0 ], [ 0, 5 ] );
john._processExecute( 'delete' );

expectClients( '<paragraph></paragraph>' );

john.undo();

expectClients( '<paragraph>X<m1:start></m1:start>abc<m1:end></m1:end>Y</paragraph>' );

john.undo();

expectClients( '<paragraph>XY</paragraph>' );

john.redo();

expectClients( '<paragraph>X<m1:start></m1:start>abc<m1:end></m1:end>Y</paragraph>' );

john.redo();

expectClients( '<paragraph></paragraph>' );

john.undo();

expectClients( '<paragraph>X<m1:start></m1:start>abc<m1:end></m1:end>Y</paragraph>' );

john.undo();

expectClients( '<paragraph>XY</paragraph>' );
} );
} );

0 comments on commit 74904a9

Please sign in to comment.