Escape $ signs for the insert functions

Fixes #248, as discussed in #247
This commit is contained in:
DominikDoom
2023-10-14 16:19:34 +02:00
parent 5ebe22ddfc
commit a7233a594f

View File

@@ -489,6 +489,10 @@ async function insertTextAtCursor(textArea, result, tagword, tabCompletedWithout
optionalSeparator = TAC_CFG.extraNetworksSeparator || " ";
}
// Escape $ signs since they are special chars for the replace function
// We need four since we're also escaping them in replaceAll in the first place
sanitizedText = sanitizedText.replaceAll("$", "$$$$");
// Replace partial tag word with new text, add comma if needed
let insert = surrounding.replace(match, sanitizedText + optionalSeparator);