Commit 72d8cc50 authored by Randall Leeds's avatar Randall Leeds

On-going hl switch / editing / draft interactions

- Wait until we have a token to finish on-going edits
- Make sure to reset the on-going highlight switch
- No need to cancel on route change now that draft discarding does that
parent b071c2ad
......@@ -58,17 +58,15 @@ class App
token: newValue
else
plugins.Auth.setToken(newValue)
plugins.Auth.withToken plugins.Permissions._setAuthFromToken
plugins.Auth.withToken (token) =>
plugins.Permissions._setAuthFromToken token
if annotator.ongoing_edit
$timeout =>
annotator.clickAdder()
, 500
if annotator.ongoing_edit
annotator.clickAdder()
if $scope.ongoingHighlightSwitch
$timeout =>
if $scope.ongoingHighlightSwitch
$scope.ongoingHighlightSwitch = false
annotator.setTool 'highlight'
, 500
else
plugins.Permissions.setUser(null)
delete plugins.Auth
......@@ -587,9 +585,6 @@ class Annotation
$scope.model.$modelValue.text = ''
$scope.model.$modelValue.tags = ''
$scope.$on '$routeChangeStart', -> $scope.cancel() if $scope.editing
$scope.$on '$routeUpdate', -> $scope.cancel() if $scope.editing
$scope.$watch 'editing', -> $scope.$emit 'toggleEditing'
$scope.$watch 'model.$modelValue.id', (id) ->
......
......@@ -187,9 +187,6 @@ class Hypothesis extends Annotator
this.subscribe 'annotationDeleted', (a) =>
$rootScope.annotations = $rootScope.annotations.filter (b) -> b isnt a
# Reload the route after annotations are loaded
this.subscribe 'annotationsLoaded', -> $route.reload()
_setupXDM: (options) ->
$rootScope = @element.injector().get '$rootScope'
......
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