Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: blank page selector misapplied when target-counter is used #1281

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading