Merge pull request #16347 from Snuffleupagus/getAllTextInProgress-no-copy

Prevent incomplete copy-all behaviour while text-extraction is running (PR 16286 follow-up)
This commit is contained in:
Jonas Jenwald 2023-04-26 08:24:17 +02:00 committed by GitHub
commit 598408b7af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -691,19 +691,19 @@ class PDFViewer {
// including this element so having it in the selection means that all
// has been selected.
if (textLayerMode === TextLayerMode.ENABLE_PERMISSIONS) {
if (
this.#getAllTextInProgress ||
textLayerMode === TextLayerMode.ENABLE_PERMISSIONS
) {
event.preventDefault();
event.stopPropagation();
return;
}
this.#getAllTextInProgress = true;
// TODO: if all the pages are rendered we don't need to wait for
// getAllText and we could just get text from the Selection object.
if (this.#getAllTextInProgress) {
return;
}
this.#getAllTextInProgress = true;
// Select all the document.
const savedCursor = this.container.style.cursor;
this.container.style.cursor = "wait";