Skip to content

Commit

Permalink
Fix epubs not loading in web-library
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Sep 11, 2023
1 parent d6a91a0 commit abf4f62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ window.createReader = (options) => {
throw new Error('Reader is already initialized');
}
options.platform = 'web';
if (window.frameElement) {
// This fix is needed for epubs to work in web-library. Otherwise instanceof
// inside epubjs code check fails (window.Uint8Array != window.top.Uint8Array)
// and epubs are not loaded.
window.ArrayBuffer = window.top.ArrayBuffer;
}
let reader = new Reader({
onOpenContextMenu: (params) => {
reader.openContextMenu(params);
Expand Down

0 comments on commit abf4f62

Please sign in to comment.