Commit 869f97d4 authored by Ujvari Gergely's avatar Ujvari Gergely

Fix for #364

parent 93bc8be3
......@@ -171,6 +171,11 @@ class App
delete annotator.plugins.Store
annotator.addStore Store.options
if newValue? and annotator.ongoing_edit
$timeout =>
annotator.clickAdder()
, 500
$scope.$watch 'frame.visible', (newValue) ->
if newValue
annotator.show()
......
......@@ -160,6 +160,10 @@ class Annotator.Host extends Annotator
@drag.last = null
)
.bind('adderClick', =>
@onAdderClick @event
)
.bind('getDocumentInfo', =>
return {
uri: @plugins.Document.uri()
......@@ -273,3 +277,8 @@ class Annotator.Host extends Annotator
@api.notify
method: 'addToken'
params: token
#Save the event for restarting edit
onAdderClick: (event) =>
@event = event
super
\ No newline at end of file
......@@ -43,6 +43,7 @@ class Hypothesis extends Annotator
# Internal state
dragging: false # * To enable dragging only when we really want to
ongoing_edit: false # * Is there an interrupted edit by login
# Here as a noop just to make the Permissions plugin happy
# XXX: Change me when Annotator stops assuming things about viewers
......@@ -239,6 +240,10 @@ class Hypothesis extends Annotator
]
this
clickAdder: =>
@provider.notify
method: 'adderClick'
showEditor: (annotation) =>
this.show()
@element.injector().invoke [
......@@ -247,6 +252,8 @@ class Hypothesis extends Annotator
unless this.plugins.Auth? and this.plugins.Auth.haveValidToken()
$route.current.locals.$scope.$apply ->
$route.current.locals.$scope.$emit 'showAuth', true
@provider.notify method: 'onEditorHide'
@ongoing_edit = true
return
# Set the path
......@@ -254,10 +261,12 @@ class Hypothesis extends Annotator
id: annotation.id
action: 'create'
$location.path('/editor').search(search)
# Digest the change
$rootScope.$digest()
@ongoing_edit = false
# Push the annotation into the editor scope
if $route.current.controller is 'EditorController'
$route.current.locals.$scope.$apply (s) -> s.annotation = annotation
......
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