From ae02c749e9a630c5d52b49bd63d4c8a1e81f6180 Mon Sep 17 00:00:00 2001 From: Dominik Reh Date: Thu, 13 Oct 2022 10:35:08 +0200 Subject: [PATCH] Negative prompts now exclusive to their category They now only autocomplete if their parent category is active in the config as well --- tagAutocomplete.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tagAutocomplete.js b/tagAutocomplete.js index 1aa3700..8640037 100644 --- a/tagAutocomplete.js +++ b/tagAutocomplete.js @@ -374,12 +374,15 @@ onUiUpdate(function(){ // Skip directly if not found on the page if (area === null || area === undefined) return; - // Check config for which textareas to add autocomplete to - let shouldAdd = area === txt2imgTextArea && acConfig.activeIn.txt2img - || area === img2imgTextArea && acConfig.activeIn.img2img - || negativeTextAreas.includes(area) && acConfig.activeIn.negativePrompts; - - if (!shouldAdd) return; + // Return if autocomplete is disabled for the current area type in config + let textAreaId = getTextAreaIdentifier(area); + if (textAreaId.includes("p") || (textAreaId.includes("n") && acConfig.activeIn.negativePrompts)) { + if (textAreaId.includes("img2img")) { + if (!acConfig.activeIn.img2img) return; + } else { + if (!acConfig.activeIn.txt2img) return; + } + } // Only add listeners once if (!area.classList.contains('autocomplete')) {