From 40a760bb1ce90a71afc7d47481ac8cc7c4f6ff43 Mon Sep 17 00:00:00 2001 From: MurakamiShinyu Date: Sat, 17 Feb 2024 18:30:45 +0900 Subject: [PATCH] fix: blank page selector misapplied when target-counter is used - fix #1131 --- packages/core/src/vivliostyle/epub.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/src/vivliostyle/epub.ts b/packages/core/src/vivliostyle/epub.ts index f9209661f..40f6e2668 100644 --- a/packages/core/src/vivliostyle/epub.ts +++ b/packages/core/src/vivliostyle/epub.ts @@ -1605,14 +1605,22 @@ export class OPFView implements Vgen.CustomRendererFactory { // (fix for issue #1272) const { currentPageType, previousPageType } = viewItem.instance.styler.cascade; + + // Save the scopes and restore them after re-rendering page. + // This is necessary for :blank page selector to work. + // (fix for issue #1131) + const scopes = Object.entries(viewItem.instance.scopes); + this.counterStore.pushPageCounters(refs.pageCounters); this.counterStore.pushReferencesToSolve(refs.refs); const pos = viewItem.layoutPositions[refs.pageIndex]; + this.renderSinglePage(viewItem, pos).then((result) => { viewItem.instance.styler.cascade.currentPageType = currentPageType; viewItem.instance.styler.cascade.previousPageType = previousPageType; + viewItem.instance.scopes = Object.fromEntries(scopes); this.counterStore.popPageCounters(); this.counterStore.popReferencesToSolve(); const resultPosition = result.pageAndPosition.position;