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

Always pass edits via ongoing_edit

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