Disabled editing notes in download tab when saving notes is disabled.

This commit is contained in:
Christian Bastian
2024-08-17 04:47:14 -04:00
parent 75879a5403
commit 4eed80f699

View File

@@ -3496,11 +3496,11 @@ class DownloadView {
}, },
}); });
const infoNotes = $el("textarea.comfy-multiline-input", { const infoNotes = $el("textarea.comfy-multiline-input.model-info-notes", {
name: "model info notes", name: "model info notes",
value: info["description"]??"", value: info["description"]??"",
rows: 6, rows: 6,
disabled: false, disabled: true,
style: { display: info["description"] === undefined || info["description"] === "" ? "none" : "" }, style: { display: info["description"] === undefined || info["description"] === "" ? "none" : "" },
}); });
@@ -3624,7 +3624,7 @@ class DownloadView {
$checkbox({ $checkbox({
$: (el) => { this.elements.downloadNotes = el; }, $: (el) => { this.elements.downloadNotes = el; },
textContent: "Save Notes.", textContent: "Save Notes.",
checked: settings["download-save-description-as-text-file"].checked, checked: false,
}), }),
]) ])
]); ]);
@@ -3635,6 +3635,17 @@ class DownloadView {
infosHtml.innerHTML = ""; infosHtml.innerHTML = "";
infosHtml.append.apply(infosHtml, modelInfosHtml); infosHtml.append.apply(infosHtml, modelInfosHtml);
const downloadNotes = this.elements.downloadNotes;
downloadNotes.addEventListener("change", (e) => {
const modelInfoNotes = infosHtml.querySelectorAll(`textarea.model-info-notes`);
const disabled = !e.currentTarget.checked;
for (let i = 0; i < modelInfoNotes.length; i++) {
modelInfoNotes[i].disabled = disabled;
}
});
downloadNotes.checked = settings["download-save-description-as-text-file"].checked;
downloadNotes.dispatchEvent(new Event('change'));
const hideSearchButtons = settings["text-input-always-hide-search-button"].checked; const hideSearchButtons = settings["text-input-always-hide-search-button"].checked;
this.elements.searchButton.style.display = hideSearchButtons ? "none" : ""; this.elements.searchButton.style.display = hideSearchButtons ? "none" : "";