Commit 8419426e authored by Sean Roberts's avatar Sean Roberts

Cleaning up: moving constructor to be first function in Guest class and...

Cleaning up: moving constructor to be first function in Guest class and removing unused wrapper html field
parent 4efa180a
...@@ -54,20 +54,6 @@ module.exports = class Guest extends Delegator ...@@ -54,20 +54,6 @@ module.exports = class Guest extends Delegator
html: html:
adder: '<hypothesis-adder></hypothesis-adder>' adder: '<hypothesis-adder></hypothesis-adder>'
wrapper: '<div class="annotator-wrapper"></div>'
addPlugin: (name, options) ->
if @plugins[name]
console.error("You cannot have more than one instance of any plugin.")
else
klass = @options.pluginClasses[name]
if typeof klass is 'function'
@plugins[name] = new klass(@element[0], options)
@plugins[name].annotator = this
@plugins[name].pluginInit?()
else
console.error("Could not load " + name + " plugin. Have you included the appropriate <script> tag?")
this # allow chaining
constructor: (element, options) -> constructor: (element, options) ->
super super
...@@ -112,6 +98,19 @@ module.exports = class Guest extends Delegator ...@@ -112,6 +98,19 @@ module.exports = class Guest extends Delegator
if not @plugins[name] and @options.pluginClasses[name] if not @plugins[name] and @options.pluginClasses[name]
this.addPlugin(name, opts) this.addPlugin(name, opts)
addPlugin: (name, options) ->
if @plugins[name]
console.error("You cannot have more than one instance of any plugin.")
else
klass = @options.pluginClasses[name]
if typeof klass is 'function'
@plugins[name] = new klass(@element[0], options)
@plugins[name].annotator = this
@plugins[name].pluginInit?()
else
console.error("Could not load " + name + " plugin. Have you included the appropriate <script> tag?")
this # allow chaining
# Get the document info # Get the document info
getDocumentInfo: -> getDocumentInfo: ->
if @plugins.PDF? if @plugins.PDF?
......
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