Merge pull request #21531 from Snuffleupagus/PDFThumbnailViewer-#updateStatus-isCopy

Reduce duplication when updating undoButton/undoCloseButton in `PDFThumbnailViewer.prototype.#updateStatus`
This commit is contained in:
calixteman 2026-07-03 08:14:23 +02:00 committed by GitHub
commit ab90210aa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1215,19 +1215,14 @@ class PDFThumbnailViewer {
} }
this.#toggleBar("undo", l10nId, { count }); this.#toggleBar("undo", l10nId, { count });
if (type === "copy") { const isCopy = type === "copy";
this.#undoButton.firstElementChild.setAttribute( this.#undoButton.firstElementChild.setAttribute(
"data-l10n-id", "data-l10n-id",
"pdfjs-views-manager-status-done-button-label" isCopy
); ? "pdfjs-views-manager-status-done-button-label"
this.#undoCloseButton.classList.toggle("hidden", true); : "pdfjs-views-manager-status-undo-button-label"
} else { );
this.#undoButton.firstElementChild.setAttribute( this.#undoCloseButton.classList.toggle("hidden", isCopy);
"data-l10n-id",
"pdfjs-views-manager-status-undo-button-label"
);
this.#undoCloseButton.classList.toggle("hidden", false);
}
} }
#moveDraggedContainer(dx, dy) { #moveDraggedContainer(dx, dy) {