From 20037e9919ec5c1322ec35ff01918b7e2293fce5 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 14 Dec 2022 18:13:09 +0100 Subject: [PATCH] Don't remove the loading icon from the DOM when a page is resetted --- web/pdf_page_view.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index ab68c7ea2a303..416ff69fc92b7 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -429,6 +429,7 @@ class PDFPageView { case annotationEditorLayerNode: case xfaLayerNode: case textLayerNode: + case this.loadingIconDiv: continue; } node.remove(); @@ -472,8 +473,18 @@ class PDFPageView { delete this.svg; } - this.loadingIconDiv = document.createElement("div"); - this.loadingIconDiv.className = "loadingIcon notVisible"; + if (!this.loadingIconDiv) { + this.loadingIconDiv = document.createElement("div"); + this.loadingIconDiv.className = "loadingIcon notVisible"; + this.loadingIconDiv.setAttribute("role", "img"); + this.l10n.get("loading").then(msg => { + this.loadingIconDiv?.setAttribute("aria-label", msg); + }); + div.append(this.loadingIconDiv); + } else { + this.toggleLoadingIconSpinner(); + } + if ( (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || GENERIC")) && @@ -481,11 +492,6 @@ class PDFPageView { ) { this.toggleLoadingIconSpinner(/* viewVisible = */ true); } - this.loadingIconDiv.setAttribute("role", "img"); - this.l10n.get("loading").then(msg => { - this.loadingIconDiv?.setAttribute("aria-label", msg); - }); - div.append(this.loadingIconDiv); } update({ scale = 0, rotation = null, optionalContentConfigPromise = null }) {