Permalink
Browse files

Add clickToClose option

  • Loading branch information...
JakeHartnell committed Aug 27, 2015
1 parent 8357ee3 commit cbe6a41232decb40c1f936d07521ff3cbb7431ac
Showing with 9 additions and 8 deletions.
  1. +7 −7 h/static/scripts/annotator/guest.coffee
  2. +2 −1 h/static/scripts/annotator/main.js
@@ -71,6 +71,13 @@ module.exports = class Guest extends Annotator
this._connectAnnotationSync(@crossframe)
this._connectAnnotationUISync(@crossframe)
if @options.clickToClose
@wrapper = @element
.on 'click', (event) =>
if !@selectedTargets?.length
this.hideFrame()
this
# Load plugins
for own name, opts of @options
if not @plugins[name] and Annotator.Plugin[name]
@@ -128,13 +135,6 @@ module.exports = class Guest extends Annotator
crossframe.on 'setVisibleHighlights', (state) =>
this.publish 'setVisibleHighlights', state
_setupWrapper: ->
@wrapper = @element
.on 'click', (event) =>
if !@selectedTargets?.length
this.hideFrame()
this
# These methods aren't used in the iframe-hosted configuration of Annotator.
_setupDynamicStyle: -> this
_setupViewer: -> this
@@ -29,7 +29,8 @@ var docs = 'https://h.readthedocs.org/en/latest/hacking/customized-embedding.htm
var options = {
app: jQuery('link[type="application/annotator+html"]').attr('href'),
BucketBar: {container: '.annotator-frame', scrollables: ['body']},
Toolbar: {container: '.annotator-frame'}
Toolbar: {container: '.annotator-frame'},
clickToClose: true
};
// Document metadata plugins

0 comments on commit cbe6a41

Please sign in to comment.