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

Fix for #364

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