Commit b9027a0b authored by Robert Knight's avatar Robert Knight Committed by Nick Stenning

Do not clear the selection when creating new replies

The purpose of clearing the selection was to ensure
that the new annotation was immediately visible.

Clearing the selection when creating a reply to
a selected annotation is not necessary because the reply
is part of an already-visible thread.
parent b495e557
......@@ -162,3 +162,10 @@ describe 'WidgetController', ->
$scope.clearSelection = sinon.stub()
$rootScope.$emit('beforeAnnotationCreated', {$highlight: true})
assert.notCalled($scope.clearSelection)
it 'does not clear the selection if the new annotation is a reply', ->
$scope.clearSelection = sinon.stub()
$rootScope.$emit('beforeAnnotationCreated', {
references: ['parent-id']
})
assert.notCalled($scope.clearSelection)
......@@ -74,7 +74,7 @@ module.exports = class WidgetController
!!($scope.focusedAnnotations ? {})[annotation?.$$tag]
$rootScope.$on('beforeAnnotationCreated', (event, data) ->
if data.$highlight
if data.$highlight || (data.references && data.references.length > 0)
return
$scope.clearSelection()
)
Markdown is supported
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