Commit ea8294e9 authored by Juan Corona's avatar Juan Corona

Read the showHighlights config at the Guest level and apply the state there

parent 4dff8d67
...@@ -92,7 +92,7 @@ module.exports = class Guest extends Delegator ...@@ -92,7 +92,7 @@ module.exports = class Guest extends Delegator
this.addPlugin('CrossFrame', cfOptions) this.addPlugin('CrossFrame', cfOptions)
@crossframe = this.plugins.CrossFrame @crossframe = this.plugins.CrossFrame
@crossframe.onConnect(=> this.publish('panelReady')) @crossframe.onConnect(=> this._setupInitialState(config))
this._connectAnnotationSync(@crossframe) this._connectAnnotationSync(@crossframe)
this._connectAnnotationUISync(@crossframe) this._connectAnnotationUISync(@crossframe)
...@@ -135,6 +135,10 @@ module.exports = class Guest extends Delegator ...@@ -135,6 +135,10 @@ module.exports = class Guest extends Delegator
return Promise.all([metadataPromise, uriPromise]).then ([metadata, href]) -> return Promise.all([metadataPromise, uriPromise]).then ([metadata, href]) ->
return {uri: normalizeURI(href, baseURI), metadata} return {uri: normalizeURI(href, baseURI), metadata}
_setupInitialState: (config) ->
this.publish('panelReady')
this.setVisibleHighlights(config.showHighlights == 'always')
_connectAnnotationSync: (crossframe) -> _connectAnnotationSync: (crossframe) ->
this.subscribe 'annotationDeleted', (annotation) => this.subscribe 'annotationDeleted', (annotation) =>
this.detach(annotation) this.detach(annotation)
......
...@@ -51,9 +51,6 @@ module.exports = class Host extends Guest ...@@ -51,9 +51,6 @@ module.exports = class Host extends Guest
app.appendTo(@frame) app.appendTo(@frame)
this.on 'panelReady', => this.on 'panelReady', =>
# Initialize tool state.
this.setVisibleHighlights(config.showHighlights == 'always')
# Show the UI # Show the UI
@frame.css('display', '') @frame.css('display', '')
......
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