Commit bc8ddf96 authored by Robert Knight's avatar Robert Knight

Ensure PDF integration is loaded in PDF documents

The recent refactor to change the relationship between the `Guest` and `Sidebar`
classes broke PDF.js integration because the `PdfSidebar` class is no
longer able to modify the config that is passed to the `Guest` class.
Previously it would pass `PDF: {}` in the config to the `super()` call
which would then result in the `Guest` class loading the PDF
integration.

This now has to be done in the `index.js` module. We already had to do
this previously for ebooks. Now it has to be done for all scenarios.
parent c4e74296
...@@ -52,10 +52,6 @@ function init() { ...@@ -52,10 +52,6 @@ function init() {
let SidebarClass = isPDF ? PdfSidebar : Sidebar; let SidebarClass = isPDF ? PdfSidebar : Sidebar;
if (config.subFrameIdentifier) { if (config.subFrameIdentifier) {
// Make sure the PDF plugin is loaded if the subframe contains the PDF.js viewer.
if (isPDF) {
config.PDF = {};
}
SidebarClass = null; SidebarClass = null;
// Other modules use this to detect if this // Other modules use this to detect if this
...@@ -66,6 +62,11 @@ function init() { ...@@ -66,6 +62,11 @@ function init() {
config.pluginClasses = pluginClasses; config.pluginClasses = pluginClasses;
// Load the PDF anchoring/metadata integration.
if (isPDF) {
config.PDF = {};
}
const guest = new Guest(document.body, config); const guest = new Guest(document.body, config);
const sidebar = SidebarClass const sidebar = SidebarClass
? new SidebarClass(document.body, guest, config) ? new SidebarClass(document.body, guest, config)
......
...@@ -7,7 +7,6 @@ import Sidebar from './sidebar'; ...@@ -7,7 +7,6 @@ import Sidebar from './sidebar';
*/ */
const defaultConfig = { const defaultConfig = {
PDF: {},
BucketBar: { BucketBar: {
scrollables: ['#viewerContainer'], scrollables: ['#viewerContainer'],
}, },
......
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