Commit 0fd2fcff authored by Randall Leeds's avatar Randall Leeds

Always pass edits via ongoing_edit

parent 51c56980
...@@ -652,6 +652,7 @@ class Editor ...@@ -652,6 +652,7 @@ class Editor
this.$inject = ['$location', '$routeParams', '$scope', 'annotator'] this.$inject = ['$location', '$routeParams', '$scope', 'annotator']
constructor: ($location, $routeParams, $scope, annotator) -> constructor: ($location, $routeParams, $scope, annotator) ->
{providers} = annotator {providers} = annotator
save = -> save = ->
$location.path('/viewer').search('id', $scope.annotation.id).replace() $location.path('/viewer').search('id', $scope.annotation.id).replace()
for p in providers for p in providers
...@@ -679,6 +680,10 @@ class Editor ...@@ -679,6 +680,10 @@ class Editor
annotator.unsubscribe 'annotationCreated', save annotator.unsubscribe 'annotationCreated', save
annotator.unsubscribe 'annotationDeleted', cancel annotator.unsubscribe 'annotationDeleted', cancel
$scope.annotation = annotator.ongoing_edit
annotator.ongoing_edit = null
class Viewer class Viewer
this.$inject = [ this.$inject = [
......
...@@ -320,12 +320,13 @@ class Hypothesis extends Annotator ...@@ -320,12 +320,13 @@ class Hypothesis extends Annotator
@element.injector().invoke [ @element.injector().invoke [
'$location', '$rootScope', '$route', 'drafts' '$location', '$rootScope', '$route', 'drafts'
($location, $rootScope, $route, drafts) => ($location, $rootScope, $route, drafts) =>
@ongoing_edit = annotation
unless this.plugins.Auth? and this.plugins.Auth.haveValidToken() unless this.plugins.Auth? and this.plugins.Auth.haveValidToken()
$route.current.locals.$scope.$apply -> $route.current.locals.$scope.$apply ->
$route.current.locals.$scope.$emit 'showAuth', true $route.current.locals.$scope.$emit 'showAuth', true
for p in @providers for p in @providers
p.channel.notify method: 'onEditorHide' p.channel.notify method: 'onEditorHide'
@ongoing_edit = annotation
return return
# Set the path # Set the path
...@@ -338,7 +339,6 @@ class Hypothesis extends Annotator ...@@ -338,7 +339,6 @@ class Hypothesis extends Annotator
drafts.add annotation drafts.add annotation
# Digest the change # Digest the change
$rootScope.annotation = annotation
$rootScope.$digest() $rootScope.$digest()
] ]
this this
......
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