Skip to content

Commit

Permalink
Merge pull request #1281 from vivliostyle/fix/issue1131
Browse files Browse the repository at this point in the history
fix: blank page selector misapplied when target-counter is used
  • Loading branch information
MurakamiShinyu authored Feb 18, 2024
2 parents 8ecff45 + 40a760b commit 8667886
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 8667886

Please sign in to comment.