mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #17005 from calixteman/alt_text_tweak_save_flow
[Editor] Tweak the save flow in the alt-text dialog
This commit is contained in:
commit
f66613c8e4
2 changed files with 30 additions and 11 deletions
|
@ -52,6 +52,8 @@ class AltTextManager {
|
|||
|
||||
#container;
|
||||
|
||||
#previousDecorative = null;
|
||||
|
||||
constructor(
|
||||
{
|
||||
dialog,
|
||||
|
@ -149,6 +151,7 @@ class AltTextManager {
|
|||
this.#optionDescription.checked = true;
|
||||
}
|
||||
this.#previousAltText = this.#textarea.value = altText?.trim() || "";
|
||||
this.#previousDecorative = decorative;
|
||||
this.#updateUIState();
|
||||
|
||||
this.#currentEditor = editor;
|
||||
|
@ -265,11 +268,14 @@ class AltTextManager {
|
|||
}
|
||||
|
||||
#updateUIState() {
|
||||
const hasAltText = !!this.#textarea.value.trim();
|
||||
const altText = this.#textarea.value.trim();
|
||||
const decorative = this.#optionDecorative.checked;
|
||||
|
||||
this.#textarea.disabled = decorative;
|
||||
this.#saveButton.disabled = !decorative && !hasAltText;
|
||||
this.#saveButton.disabled = !(
|
||||
this.#previousDecorative !== decorative ||
|
||||
this.#previousAltText !== altText
|
||||
);
|
||||
}
|
||||
|
||||
#save() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue