Reduce duplication when updating undoButton/undoCloseButton in PDFThumbnailViewer.prototype.#updateStatus

This commit is contained in:
Jonas Jenwald 2026-07-03 00:03:17 +02:00
parent a0061817e6
commit f373fbfa5b

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) {