checkPromptsConfigForPlaceholders binded to the onInput event for the text area
This commit is contained in:
parent
eedfeb8a18
commit
8b37263738
1 changed files with 10 additions and 3 deletions
|
|
@ -118,7 +118,16 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
// console.log('>>>>>>>>>>> suggestions: ' + JSON.stringify(suggestions));
|
// 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) => {
|
// document.addEventListener('click', (e) => {
|
||||||
// // Check if the click was outside the textarea or suggestion list
|
// // 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 text = textarea.value.substring(0, cursorPosition);
|
||||||
const match = text.match(/{%[^\s]*$/);
|
const match = text.match(/{%[^\s]*$/);
|
||||||
|
|
||||||
checkPromptsConfigForPlaceholders(textarea);
|
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const lastWord = match[0];
|
const lastWord = match[0];
|
||||||
const tr = textarea.parentNode.parentNode.parentNode;
|
const tr = textarea.parentNode.parentNode.parentNode;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue