Skip to content
Snippets Groups Projects
Commit 36a15a3e authored by Yannis Barlas's avatar Yannis Barlas
Browse files

handle collapsed deletions on another users annotation

parent ab028731
No related branches found
No related tags found
No related merge requests found
......@@ -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)
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment