diff --git a/pages/customprompts/mzta-custom-prompts.js b/pages/customprompts/mzta-custom-prompts.js index 155c93a2..a6b6a4e5 100644 --- a/pages/customprompts/mzta-custom-prompts.js +++ b/pages/customprompts/mzta-custom-prompts.js @@ -118,7 +118,16 @@ document.addEventListener('DOMContentLoaded', async () => { // console.log('>>>>>>>>>>> suggestions: ' + JSON.stringify(suggestions)); - textareas.forEach(textarea => textareaAutocomplete(textarea, autocompleteSuggestions)); + textareas.forEach(textarea => { + textareaAutocomplete(textarea, autocompleteSuggestions); +textareas.forEach(textarea => { + textarea.addEventListener('input', (e) => { + checkPromptsConfigForPlaceholders(e.target); + }); + textareaAutocomplete(textarea, autocompleteSuggestions); +}); + + }); // document.addEventListener('click', (e) => { // // Check if the click was outside the textarea or suggestion list @@ -690,8 +699,6 @@ function textareaAutocomplete(textarea, suggestions) { const text = textarea.value.substring(0, cursorPosition); const match = text.match(/{%[^\s]*$/); - checkPromptsConfigForPlaceholders(textarea); - if (match) { const lastWord = match[0]; const tr = textarea.parentNode.parentNode.parentNode;