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 ...@@ -58,17 +58,15 @@ class App
token: newValue token: newValue
else else
plugins.Auth.setToken(newValue) plugins.Auth.setToken(newValue)
plugins.Auth.withToken plugins.Permissions._setAuthFromToken plugins.Auth.withToken (token) =>
plugins.Permissions._setAuthFromToken token
if annotator.ongoing_edit if annotator.ongoing_edit
$timeout => annotator.clickAdder()
annotator.clickAdder()
, 500
if $scope.ongoingHighlightSwitch if $scope.ongoingHighlightSwitch
$timeout => $scope.ongoingHighlightSwitch = false
annotator.setTool 'highlight' annotator.setTool 'highlight'
, 500
else else
plugins.Permissions.setUser(null) plugins.Permissions.setUser(null)
delete plugins.Auth delete plugins.Auth
...@@ -587,9 +585,6 @@ class Annotation ...@@ -587,9 +585,6 @@ class Annotation
$scope.model.$modelValue.text = '' $scope.model.$modelValue.text = ''
$scope.model.$modelValue.tags = '' $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 'editing', -> $scope.$emit 'toggleEditing'
$scope.$watch 'model.$modelValue.id', (id) -> $scope.$watch 'model.$modelValue.id', (id) ->
......
...@@ -187,9 +187,6 @@ class Hypothesis extends Annotator ...@@ -187,9 +187,6 @@ class Hypothesis extends Annotator
this.subscribe 'annotationDeleted', (a) => this.subscribe 'annotationDeleted', (a) =>
$rootScope.annotations = $rootScope.annotations.filter (b) -> b isnt a $rootScope.annotations = $rootScope.annotations.filter (b) -> b isnt a
# Reload the route after annotations are loaded
this.subscribe 'annotationsLoaded', -> $route.reload()
_setupXDM: (options) -> _setupXDM: (options) ->
$rootScope = @element.injector().get '$rootScope' $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