From 4eed80f69937a07d913c8426038a643fc28aa449 Mon Sep 17 00:00:00 2001 From: Christian Bastian <80225746+cdb-boop@users.noreply.github.com> Date: Sat, 17 Aug 2024 04:47:14 -0400 Subject: [PATCH] Disabled editing notes in download tab when saving notes is disabled. --- web/model-manager.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web/model-manager.js b/web/model-manager.js index b84aafb..463357f 100644 --- a/web/model-manager.js +++ b/web/model-manager.js @@ -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", value: info["description"]??"", rows: 6, - disabled: false, + disabled: true, style: { display: info["description"] === undefined || info["description"] === "" ? "none" : "" }, }); @@ -3624,7 +3624,7 @@ class DownloadView { $checkbox({ $: (el) => { this.elements.downloadNotes = el; }, textContent: "Save Notes.", - checked: settings["download-save-description-as-text-file"].checked, + checked: false, }), ]) ]); @@ -3635,6 +3635,17 @@ class DownloadView { infosHtml.innerHTML = ""; 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; this.elements.searchButton.style.display = hideSearchButtons ? "none" : "";