Skip to content

Commit

Permalink
Merge pull request #1220 from vivliostyle/fix/issue1219
Browse files Browse the repository at this point in the history
fix(viewer): Navigation with page slider should not affect browser history stack
  • Loading branch information
MurakamiShinyu authored Aug 31, 2023
2 parents a7b1ed7 + 7b3f117 commit f1147ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/viewer/src/viewmodels/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class Navigation {
if (this.viewerOptions.renderAllPages()) {
const pageNumber = Number(pageNumberText);
const epageNav = this.viewer.epageFromPageNumber(pageNumber);
this.viewer.navigateToEPage(epageNav);
this.viewer.navigateToEPage(epageNav, false);
} else {
const pageNumberElem = document.getElementById(
"vivliostyle-page-number",
Expand Down Expand Up @@ -553,7 +553,7 @@ class Navigation {
) as HTMLInputElement;
const pageNumber = Number(pageNumberElem.value);
const epageNav = this.viewer.epageFromPageNumber(pageNumber);
this.viewer.navigateToEPage(epageNav);
this.viewer.navigateToEPage(epageNav, false);

return true;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/viewer/src/viewmodels/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ class Viewer {
this.coreViewer.navigateToPage(Navigation.LAST);
}

navigateToEPage(epage: number): void {
if (Math.abs(epage - this.epage()) > 1) {
navigateToEPage(epage: number, pushHistory?: boolean): void {
if (pushHistory === undefined || pushHistory) {
window.history.pushState(null, null);
}
this.coreViewer.navigateToPage(Navigation.EPAGE, epage);
Expand Down

1 comment on commit f1147ea

@vercel
Copy link

@vercel vercel bot commented on f1147ea Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vivliostyle – ./

vivliostyle-git-master-vivliostyle.vercel.app
vivliostyle-vivliostyle.vercel.app
vivliostyle.vercel.app

Please sign in to comment.