checkPromptsConfigForPlaceholders binded to the onInput event for the text area

This commit is contained in:
mic 2024-12-15 20:27:40 +01:00
parent eedfeb8a18
commit 8b37263738

View file

@ -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;