Skip to content

Commit

Permalink
fix: blank page selector misapplied when target-counter is used
Browse files Browse the repository at this point in the history
- fix #1131
  • Loading branch information
MurakamiShinyu committed Feb 17, 2024
1 parent 8ecff45 commit 40a760b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/vivliostyle/epub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 40a760b

Please sign in to comment.