From 0608706e7dcb76798cbdca29851c5c512fc8470d Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Thu, 10 Jul 2025 19:03:09 +0200 Subject: [PATCH] Fix more broken/missed references --- javascript/_utils.js | 2 +- javascript/ext_wildcards.js | 4 ++-- javascript/tagAutocomplete.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/javascript/_utils.js b/javascript/_utils.js index dc6abed..656c6a6 100644 --- a/javascript/_utils.js +++ b/javascript/_utils.js @@ -242,7 +242,7 @@ class TacUtils { memo, Object.prototype.toString.call(obj[prop]) === "[object Object]" ? // keep working if value is an object - flatten(obj[prop], roots.concat([prop]), sep) + this.flatten(obj[prop], roots.concat([prop]), sep) : // include current prop and value and prefix prop with the roots { [roots.concat([prop]).join(sep)]: obj[prop] } ), diff --git a/javascript/ext_wildcards.js b/javascript/ext_wildcards.js index 2f1ea07..40e1256 100644 --- a/javascript/ext_wildcards.js +++ b/javascript/ext_wildcards.js @@ -2,13 +2,13 @@ const WC_REGEX = new RegExp(/__([^,]+)__([^, ]*)/g); // Trigger conditions -const WC_TRIGGER = () => TAC.CFG.useWildcards && [...TAC.Globals.tagword.matchAll(new RegExp(WC_REGEX.source.replaceAll("__", escapeRegExp(TAC.CFG.wcWrap)), "g"))].length > 0; +const WC_TRIGGER = () => TAC.CFG.useWildcards && [...TAC.Globals.tagword.matchAll(new RegExp(WC_REGEX.source.replaceAll("__", TacUtils.escapeRegExp(TAC.CFG.wcWrap)), "g"))].length > 0; const WC_FILE_TRIGGER = () => TAC.CFG.useWildcards && (TAC.Globals.tagword.startsWith(TAC.CFG.wcWrap) && !TAC.Globals.tagword.endsWith(TAC.CFG.wcWrap) || TAC.Globals.tagword === TAC.CFG.wcWrap); class WildcardParser extends BaseTagParser { async parse() { // Show wildcards from a file with that name - let wcMatch = [...TAC.Globals.tagword.matchAll(new RegExp(WC_REGEX.source.replaceAll("__", escapeRegExp(TAC.CFG.wcWrap)), "g"))]; + let wcMatch = [...TAC.Globals.tagword.matchAll(new RegExp(WC_REGEX.source.replaceAll("__", TacUtils.escapeRegExp(TAC.CFG.wcWrap)), "g"))]; let wcFile = wcMatch[0][1]; let wcWord = wcMatch[0][2]; diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index 381be26..5769cb9 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -424,7 +424,7 @@ const COMPLETED_WILDCARD_REGEX = /__[^\s,_][^\t\n\r,_]*[^\s,_]__[^\s,_]*/g; const STYLE_VAR_REGEX = /\$\(?[^$|\[\],\s]*\)?/g; const NORMAL_TAG_REGEX = /[^\s,|<>\[\]:]+_\([^\s,|<>\[\]:]*\)?|[^\s,|<>():\[\]]+|?/g; -const TAG_REGEX = () => { return new RegExp(`${POINTY_REGEX.source}|${COMPLETED_WILDCARD_REGEX.source.replaceAll("__", escapeRegExp(TAC.CFG.wcWrap))}|${STYLE_VAR_REGEX.source}|${NORMAL_TAG_REGEX.source}`, "g"); } +const TAG_REGEX = () => { return new RegExp(`${POINTY_REGEX.source}|${COMPLETED_WILDCARD_REGEX.source.replaceAll("__", TacUtils.escapeRegExp(TAC.CFG.wcWrap))}|${STYLE_VAR_REGEX.source}|${NORMAL_TAG_REGEX.source}`, "g"); } // On click, insert the tag into the prompt textbox with respect to the cursor position async function insertTextAtCursor(textArea, result, tagword, tabCompletedWithoutChoice = false) {