diff --git a/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js b/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js index 6931544b393fc9141ff8978640fe495c847820ac..d5e1e3c4672f6d527bd73b31eb7181e3e858eae4 100644 --- a/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js +++ b/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js @@ -175,10 +175,10 @@ class TrackChangesProvider { if (notOnTrack) return this.selectCharacterAndMarkDeleted(options) if (isOnAdd) { - console.log('delete collapsed on add') const annotation = this.getAnnotationByStatus('add') const isOnLeftEdge = this.isOnLeftEdge(annotation) const isOnRightEdge = this.isOnRightEdge(annotation) + const isFromSameUser = this.isAnnotationFromTheSameUser(annotation) const key = direction.key // when on own additions, simply delete the character @@ -187,18 +187,24 @@ class TrackChangesProvider { // TODO -- watch it for different users if ( (isOnLeftEdge && key === 'BACKSPACE') || - (isOnRightEdge && key === 'DELETE') + (isOnRightEdge && key === 'DELETE') || + (!isFromSameUser && !isOnDelete) ) { return this.selectCharacterAndMarkDeleted(options) } - return this.deleteCharacter(direction.move) + if (!isFromSameUser && isOnDelete) { + // pass -- jump to 'is on delete' handler underneath + } else { + return this.deleteCharacter(direction.move) + } } if (isOnDelete) { const annotation = this.getAnnotationByStatus('delete') const isOnLeftEdge = this.isOnLeftEdge(annotation) const isOnRightEdge = this.isOnRightEdge(annotation) + const isFromSameUser = this.isAnnotationFromTheSameUser(annotation) const key = direction.key let moveOnly, point @@ -215,7 +221,12 @@ class TrackChangesProvider { } if (moveOnly) return this.moveCursorTo(point) - return this.expandAnnotationToDirection(annotation, direction) + + if (isFromSameUser) { + return this.expandAnnotationToDirection(annotation, direction) + } else { + return this.selectCharacterAndMarkDeleted(options) + } } }