From 2c3dee41201d0a6c778c002b19c349cdd62470fb Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 3 Nov 2022 19:12:50 +0100 Subject: qol improvements --- src/components/PatchHelper.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/PatchHelper.tsx b/src/components/PatchHelper.tsx index 853febc..391be9d 100644 --- a/src/components/PatchHelper.tsx +++ b/src/components/PatchHelper.tsx @@ -80,7 +80,7 @@ function ReplacementComponent({ module, match, replacement, setReplacementError const fullMatch = matchResult[0] ? makeCodeblock(matchResult[0], "js") : ""; const groups = matchResult.length > 1 - ? makeCodeblock(matchResult.slice(1).map((g, i) => `Group ${i}: ${g}`).join("\n"), "yml") + ? makeCodeblock(matchResult.slice(1).map((g, i) => `Group ${i + 1}: ${g}`).join("\n"), "yml") : ""; return ( @@ -172,6 +172,22 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) { onChange={onChange} error={error ?? replacementError} /> + {!isFunc && ( + <> + Cheat Sheet + {Object.entries({ + "$$": "Insert a $", + "$&": "Insert the entire match", + "$\\`": "Insert the substring before the match", + "$'": "Insert the substring after the match", + "$n": "Insert the nth capturing group ($1, $2...)" + }).map(([placeholder, desc]) => ( + + {Parser.parse("`" + placeholder + "`")}: {desc} + + ))} + + )}