forked from akai/readest
bump: sync with upstream foliate-js (#1381)
This commit is contained in:
@@ -203,6 +203,12 @@ const FoliateViewer: React.FC<{
|
||||
|
||||
const { book } = view;
|
||||
|
||||
book.transformTarget?.addEventListener('load', (event: Event) => {
|
||||
const { detail } = event as CustomEvent;
|
||||
if (detail.isScript) {
|
||||
detail.allowScript = viewSettings.allowScript ?? false;
|
||||
}
|
||||
});
|
||||
book.transformTarget?.addEventListener('data', getDocTransformHandler({ width, height }));
|
||||
view.renderer.setStyles?.(getStyles(viewSettings));
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ export class DocumentLoader {
|
||||
);
|
||||
}
|
||||
|
||||
public async open({ allowScript = false } = {}): Promise<{ book: BookDoc; format: BookFormat }> {
|
||||
public async open(): Promise<{ book: BookDoc; format: BookFormat }> {
|
||||
let book = null;
|
||||
let format: BookFormat = 'EPUB';
|
||||
if (!this.file.size) {
|
||||
@@ -200,7 +200,7 @@ export class DocumentLoader {
|
||||
format = 'FBZ';
|
||||
} else {
|
||||
const { EPUB } = await import('foliate-js/epub.js');
|
||||
book = await new EPUB(loader).init({ allowScript });
|
||||
book = await new EPUB(loader).init();
|
||||
format = 'EPUB';
|
||||
}
|
||||
} else if (await this.isPDF()) {
|
||||
|
||||
@@ -130,9 +130,7 @@ export const useReaderStore = create<ReaderStore>((set, get) => ({
|
||||
const content = (await appService.loadBookContent(book, settings)) as BookContent;
|
||||
const { file, config } = content;
|
||||
console.log('Loading book', key);
|
||||
const { book: bookDoc } = await new DocumentLoader(file).open({
|
||||
allowScript: config.viewSettings?.allowScript,
|
||||
});
|
||||
const { book: bookDoc } = await new DocumentLoader(file).open();
|
||||
updateToc(bookDoc, config.viewSettings?.sortedTOC ?? false);
|
||||
// Set the book's language for formerly imported books, newly imported books have this field set
|
||||
book.primaryLanguage =
|
||||
|
||||
+1
-1
Submodule packages/foliate-js updated: 8d86688f69...30404a1865
Reference in New Issue
Block a user