Skip to content

Commit

Permalink
EPUB: Extract _displaySections() and add note
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Aug 28, 2024
1 parent 1085fdb commit dbf4bef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dom/epub/epub-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {
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();
Expand Down Expand Up @@ -244,6 +244,14 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {
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;

Expand Down

0 comments on commit dbf4bef

Please sign in to comment.