mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Also update the browser history when the user *manually* change pages using the pageNumber-input (PR 12493 follow-up)
This patch addresses a review comment, which pointed out that we should *also* handle the pageNumber-input, from PR 12493. Given that a user *manually* changing pages using the pageNumber-input, on the toolbar, could be regarded as a pretty strong indication of user-intent w.r.t. navigation in the document, hence I suppose that updating the browser history in this case as well probably won't hurt.
This commit is contained in:
parent
4eaa058c16
commit
911948c5c0
4 changed files with 27 additions and 10 deletions
|
@ -787,6 +787,22 @@ class BaseViewer {
|
|||
this._scrollIntoView({ pageDiv: pageView.div });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} label - The page label.
|
||||
* @returns {number|null} The page number corresponding to the page label,
|
||||
* or `null` when no page labels exist and/or the input is invalid.
|
||||
*/
|
||||
pageLabelToPageNumber(label) {
|
||||
if (!this._pageLabels) {
|
||||
return null;
|
||||
}
|
||||
const i = this._pageLabels.indexOf(label);
|
||||
if (i < 0) {
|
||||
return null;
|
||||
}
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef ScrollPageIntoViewParameters
|
||||
* @property {number} pageNumber - The page number.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue