Skip to content

Commit

Permalink
Fix #4369 Browser viewer should not wait for vscode panel 'restore_st…
Browse files Browse the repository at this point in the history
…ate'
  • Loading branch information
James-Yu committed Sep 6, 2024
1 parent 8702997 commit 0b740c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion viewer/components/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export async function restoreState() {

async function restoreDefault() {
const params = await (await fetch('config.json')).json() as PdfViewerParams
await viewerStatePromise

if (params.trim !== undefined) {
setTrimValue(params.trim)
Expand All @@ -130,6 +129,11 @@ async function restoreDefault() {
PDFViewerApplication.pdfViewer.spreadMode = params.spreadMode
}

if (!utils.isEmbedded()) {
return
}

await viewerStatePromise
const viewerContainer = document.getElementById('viewerContainer')!
if (typeof viewerState.scrollTop === 'number' && viewerContainer.scrollTop !== viewerState.scrollTop) {
viewerContainer.scrollTop = viewerState.scrollTop
Expand Down

0 comments on commit 0b740c0

Please sign in to comment.