Escape $ signs for the insert functions

Fixes #248, as discussed in #247
pull/253/head
DominikDoom 2023-10-14 16:19:34 +02:00
parent 5ebe22ddfc
commit a7233a594f
1 changed files with 4 additions and 0 deletions

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