From dbf4bef2edd92b88082b379bca5e933d73c0ebd5 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 28 Aug 2024 16:13:52 -0400 Subject: [PATCH] EPUB: Extract _displaySections() and add note --- src/dom/epub/epub-view.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dom/epub/epub-view.ts b/src/dom/epub/epub-view.ts index e4a64867..5aff68ed 100644 --- a/src/dom/epub/epub-view.ts +++ b/src/dom/epub/epub-view.ts @@ -161,7 +161,7 @@ class EPUBView extends DOMView { this._iframeDocument.body.append(this._sectionsContainer); let styleScoper = new StyleScoper(this._iframeDocument); - await Promise.all(this.book.spine.spineItems.map(section => this._displaySection(section, styleScoper))); + await this._displaySections(styleScoper); if (this._sectionRenderers.some(view => view.error) && await this._isEncrypted()) { this._options.onEPUBEncrypted(); @@ -244,6 +244,14 @@ class EPUBView extends DOMView { this._sectionRenderers[section.index] = renderer; } + private _displaySections(styleScoper: StyleScoper) { + return Promise.all(this.book.spine.spineItems + // We should do this: + // .filter(section => section.linear) + // But we need to be sure it won't break anything + .map(section => this._displaySection(section, styleScoper))); + } + private _initPageMapping(json?: string): PageMapping { let mapping: PageMapping | null = null;