Commit 1a15838c authored by Robert Knight's avatar Robert Knight

Implement side-by-side mode for VitalSource EPUB books

In the VitalSource integration, enable the side-by-side mode in the
underlying HTML document integration.
parent d81b73af
......@@ -67,7 +67,9 @@ describe('annotator/integrations/vitalsource', () => {
contentContainer: sinon.stub(),
describe: sinon.stub(),
destroy: sinon.stub(),
fitSideBySide: sinon.stub().returns(false),
scrollToAnchor: sinon.stub(),
sideBySideEnabled: false,
};
FakeHTMLIntegration = sinon.stub().returns(fakeHTMLIntegration);
......@@ -189,9 +191,16 @@ describe('annotator/integrations/vitalsource', () => {
assert.equal(integration.canAnnotate(), true);
});
it('does not support side-by-side mode', () => {
it('delegates to HTMLIntegration for side-by-side mode', () => {
const integration = createIntegration();
assert.equal(integration.fitSideBySide(), false);
fakeHTMLIntegration.fitSideBySide.returns(true);
assert.isTrue(fakeHTMLIntegration.sideBySideEnabled);
const layout = { expanded: true, width: 150 };
const isActive = integration.fitSideBySide(layout);
assert.isTrue(isActive);
assert.calledWith(fakeHTMLIntegration.fitSideBySide, layout);
});
it('stops mouse events from propagating to parent frame', () => {
......
......@@ -8,6 +8,7 @@ import { injectClient } from '../hypothesis-injector';
* @typedef {import('../../types/annotator').Annotator} Annotator
* @typedef {import('../../types/annotator').Integration} Integration
* @typedef {import('../../types/annotator').Selector} Selector
* @typedef {import('../../types/annotator').SidebarLayout} SidebarLayout
*/
/**
......@@ -146,6 +147,7 @@ export class VitalSourceContentIntegration {
*/
constructor(container = document.body) {
this._htmlIntegration = new HTMLIntegration(container);
this._htmlIntegration.sideBySideEnabled = true;
this._listeners = new ListenerCollection();
......@@ -223,9 +225,11 @@ export class VitalSourceContentIntegration {
return this._htmlIntegration.contentContainer();
}
fitSideBySide() {
// Not yet implemented
return false;
/**
* @param {SidebarLayout} layout
*/
fitSideBySide(layout) {
return this._htmlIntegration.fitSideBySide(layout);
}
async getMetadata() {
......
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