diff options
author | AutumnVN <htuan03@gmail.com> | 2023-05-11 17:59:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 02:59:51 +0200 |
commit | 3c7496ac6d72534c9b285ac789d95a4040a7385c (patch) | |
tree | 2d57743f6687fc4ebdfa69c1fb57be502cbe7af7 | |
parent | 63387a48ee1862ac192966a99db8036368b9a08f (diff) | |
download | Vencord-3c7496ac6d72534c9b285ac789d95a4040a7385c.tar.gz Vencord-3c7496ac6d72534c9b285ac789d95a4040a7385c.tar.bz2 Vencord-3c7496ac6d72534c9b285ac789d95a4040a7385c.zip |
TextReplace: Visible Linebreak in settings (#1063)
Co-authored-by: V <vendicated@riseup.net>
-rw-r--r-- | src/plugins/textReplace.tsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/textReplace.tsx b/src/plugins/textReplace.tsx index f41afc5..e161168 100644 --- a/src/plugins/textReplace.tsx +++ b/src/plugins/textReplace.tsx @@ -159,7 +159,7 @@ function TextReplace({ title, rulesArray, rulesKey, update }: TextReplaceProps) <Input placeholder="Replace" initialValue={rule.replace} - onChange={e => onChange(e.replaceAll("\\n", "\n"), index, "replace")} + onChange={e => onChange(e, index, "replace")} /> <Input placeholder="Only if includes" @@ -220,7 +220,7 @@ function applyRules(content: string): string { if (!rule.find || !rule.replace) continue; if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue; - content = content.replaceAll(rule.find, rule.replace); + content = content.replaceAll(rule.find, rule.replace.replaceAll("\\n", "\n")); } } @@ -231,7 +231,7 @@ function applyRules(content: string): string { try { const regex = stringToRegex(rule.find); - content = content.replace(regex, rule.replace); + content = content.replace(regex, rule.replace.replaceAll("\\n", "\n")); } catch (e) { new Logger("TextReplace").error(`Invalid regex: ${rule.find}`); } |