Merge pull request #17015 from calixteman/alt_text_save_button
[Editor] Let the Save button always enabled in the alt-text dialog
This commit is contained in:
commit
c027aaeefa
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -522,7 +522,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<button id="altTextCancel" tabindex="0"><span data-l10n-id="editor_alt_text_cancel_button">Cancel</span></button>
|
||||
<button id="altTextSave" tabindex="0" disabled><span data-l10n-id="editor_alt_text_save_button">Save</span></button>
|
||||
<button id="altTextSave" tabindex="0"><span data-l10n-id="editor_alt_text_save_button">Save</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
Loading…
x
Reference in New Issue
Block a user