diff --git a/src/display/editor/editor.js b/src/display/editor/editor.js index 2898b293a..ecea8664a 100644 --- a/src/display/editor/editor.js +++ b/src/display/editor/editor.js @@ -932,6 +932,9 @@ class AnnotationEditor { } set altTextData({ altText, decorative }) { + if (this.#altText === altText && this.#altTextDecorative === decorative) { + return; + } this.#altText = altText; this.#altTextDecorative = decorative; this.#setAltTextButtonState(); diff --git a/web/alt_text_manager.js b/web/alt_text_manager.js index 0975ca0df..dad87d3c1 100644 --- a/web/alt_text_manager.js +++ b/web/alt_text_manager.js @@ -52,8 +52,6 @@ class AltTextManager { #container; - #previousDecorative = null; - constructor( { dialog, @@ -82,7 +80,6 @@ class AltTextManager { saveButton.addEventListener("click", this.#save.bind(this)); optionDescription.addEventListener("change", this.#boundUpdateUIState); optionDecorative.addEventListener("change", this.#boundUpdateUIState); - textarea.addEventListener("input", this.#boundUpdateUIState); this.#overlayManager.register(dialog); } @@ -151,7 +148,6 @@ class AltTextManager { this.#optionDescription.checked = true; } this.#previousAltText = this.#textarea.value = altText?.trim() || ""; - this.#previousDecorative = decorative; this.#updateUIState(); this.#currentEditor = editor; @@ -268,14 +264,7 @@ class AltTextManager { } #updateUIState() { - const altText = this.#textarea.value.trim(); - const decorative = this.#optionDecorative.checked; - - this.#textarea.disabled = decorative; - this.#saveButton.disabled = !( - this.#previousDecorative !== decorative || - this.#previousAltText !== altText - ); + this.#textarea.disabled = this.#optionDecorative.checked; } #save() { diff --git a/web/viewer.html b/web/viewer.html index e2d886733..327efd365 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -522,7 +522,7 @@ See https://github.com/adobe-type-tools/cmap-resources
- +