Commit b4b36648 authored by Randall Leeds's avatar Randall Leeds

cancel editing better when not logged in

Fixes a bug where annotating while not logged in would cause
persistent highlights and break the `back` functionality.
parent e52a87f7
......@@ -217,8 +217,12 @@ class Annotator.Host extends Annotator
hash: annotation.hash
if not stub.hash
@consumer.createAnnotation (hash) =>
annotation.hash = stub.hash = hash
@consumer.showEditor stub
if not hash?
this.deleteAnnotation annotation
@ignoreMouseup = false
else
annotation.hash = stub.hash = hash
@consumer.showEditor stub
else
@consumer.showEditor stub
......
......@@ -41,20 +41,20 @@ class Hypothesis extends Annotator
this.publish event, [annotation]
addPlugin: => this.addPlugin arguments...
createAnnotation: =>
@cache[h = ++@hash] = this.createAnnotation()
h
if @plugins.Permissions.user?
@cache[h = ++@hash] = this.createAnnotation()
h
else
this.showAuth true
this.show()
null
showEditor: (stub) =>
h = stub.hash
annotation = $.extend @cache[h], stub,
hash:
toJSON: => undefined
valueOf: => h
if @plugins.Permissions.user?
this.showEditor annotation
else
@editor.hide()
this.showAuth true
this.show()
this.showEditor annotation
# This guy does stuff when you "back out" of the interface.
# (Currently triggered by a click on the source page.)
back: =>
......
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