Commit d12659da authored by Robert Knight's avatar Robert Knight

Add "requestConfigFromFrame" string setting

This setting will cause the sidebar app to fetch its configuration via
a postMessage request to frames with the given origin on startup.

The setting is not actually used yet. This is coming in future commits.
parent 782de4f6
...@@ -24,6 +24,7 @@ function configFrom(window_) { ...@@ -24,6 +24,7 @@ function configFrom(window_) {
onLayoutChange: settings.hostPageSetting('onLayoutChange'), onLayoutChange: settings.hostPageSetting('onLayoutChange'),
openSidebar: settings.hostPageSetting('openSidebar', {allowInBrowserExt: true}), openSidebar: settings.hostPageSetting('openSidebar', {allowInBrowserExt: true}),
query: settings.query, query: settings.query,
requestConfigFromFrame: settings.hostPageSetting('requestConfigFromFrame'),
services: settings.hostPageSetting('services'), services: settings.hostPageSetting('services'),
showHighlights: settings.showHighlights, showHighlights: settings.showHighlights,
sidebarAppUrl: settings.sidebarAppUrl, sidebarAppUrl: settings.sidebarAppUrl,
......
...@@ -87,15 +87,17 @@ describe('annotator.config.index', function() { ...@@ -87,15 +87,17 @@ describe('annotator.config.index', function() {
[ [
'assetRoot', 'assetRoot',
'openSidebar',
'branding', 'branding',
'openSidebar',
'requestConfigFromFrame',
'services', 'services',
].forEach(function(settingName) { ].forEach(function(settingName) {
it('returns the ' + settingName + ' value from the host page', function() { it('returns the ' + settingName + ' value from the host page', function() {
var settings = { var settings = {
'assetRoot': 'chrome-extension://1234/client/', 'assetRoot': 'chrome-extension://1234/client/',
'openSidebar': 'OPEN_SIDEBAR_SETTING',
'branding': 'BRANDING_SETTING', 'branding': 'BRANDING_SETTING',
'openSidebar': 'OPEN_SIDEBAR_SETTING',
'requestConfigFromFrame': 'https://embedder.com',
'services': 'SERVICES_SETTING', 'services': 'SERVICES_SETTING',
}; };
fakeSettingsFrom().hostPageSetting = function(settingName) { fakeSettingsFrom().hostPageSetting = function(settingName) {
......
...@@ -35,6 +35,9 @@ function hostPageConfig(window) { ...@@ -35,6 +35,9 @@ function hostPageConfig(window) {
// This should be removed once new note button is enabled for everybody. // This should be removed once new note button is enabled for everybody.
'enableExperimentalNewNoteButton', 'enableExperimentalNewNoteButton',
// Fetch config from a parent frame.
'requestConfigFromFrame',
// Theme which can either be specified as 'clean'. // Theme which can either be specified as 'clean'.
// If nothing is the specified the classic look is applied. // If nothing is the specified the classic look is applied.
'theme', 'theme',
......
...@@ -16,6 +16,7 @@ describe('hostPageConfig', function () { ...@@ -16,6 +16,7 @@ describe('hostPageConfig', function () {
annotations: '1234', annotations: '1234',
appType: 'bookmarklet', appType: 'bookmarklet',
openSidebar: true, openSidebar: true,
requestConfigFromFrame: 'https://embedder.com',
showHighlights: true, showHighlights: true,
services: [{ services: [{
authority: 'hypothes.is', authority: 'hypothes.is',
...@@ -26,6 +27,7 @@ describe('hostPageConfig', function () { ...@@ -26,6 +27,7 @@ describe('hostPageConfig', function () {
annotations: '1234', annotations: '1234',
appType: 'bookmarklet', appType: 'bookmarklet',
openSidebar: true, openSidebar: true,
requestConfigFromFrame: 'https://embedder.com',
showHighlights: true, showHighlights: true,
services: [{ services: [{
authority: 'hypothes.is', authority: 'hypothes.is',
......
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