diff --git a/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js b/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js index 63a90635f47cb290c7834b0c13587d114e973fd5..fd58968195f4abfe4984c2785cbe6dfedd21c48f 100644 --- a/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js +++ b/app/components/SimpleEditor/elements/track_change/TrackChangesProvider.js @@ -182,8 +182,12 @@ class TrackChangesProvider { const isOnLeftEdge = this.isOnLeftEdge(annotation) const isOnRightEdge = this.isOnRightEdge(annotation) const isFromSameUser = this.isAnnotationFromTheSameUser(annotation) + const mode = this.getMode() const key = direction.key + // use this variable to throw the flow to the isOnDelete handler underneath + let pass = false + // when on own additions, simply delete the character // unless it is on the edge: then make a deletion annotation @@ -193,14 +197,12 @@ class TrackChangesProvider { (isOnRightEdge && key === 'DELETE') || (!isFromSameUser && !isOnDelete) ) { - return this.selectCharacterAndMarkDeleted(options) + if (mode) return this.selectCharacterAndMarkDeleted(options) + pass = true } - if (!isFromSameUser && isOnDelete) { - // pass -- jump to 'is on delete' handler underneath - } else { - return this.deleteCharacter(direction.move) - } + if (!isFromSameUser && isOnDelete) pass = true + if (!pass) return this.deleteCharacter(direction.move) } if (isOnDelete) { @@ -297,6 +299,7 @@ class TrackChangesProvider { }) each(ownAdditions, (annotation) => { + console.log(annotation) const selection = annotation.getSelection() // make sure only the part of the annotation that is selected is deleted