From 68f84a3426684914f834342854bf4963ba2d8d57 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 29 Feb 2024 16:53:35 +0100 Subject: [PATCH] fix replacement for 2+ variables --- client/src/components/hints.tsx | 2 +- tsconfig.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/hints.tsx b/client/src/components/hints.tsx index e57db5f..2df97d6 100644 --- a/client/src/components/hints.tsx +++ b/client/src/components/hints.tsx @@ -13,7 +13,7 @@ function getHintText(hint: GameHint): string { if (hint.rawText) { // Replace the variable names used in the hint with the ones used by the player // variable names are marked like `«{g}»` inside the text. - return hint.rawText.replace(/«\{(.*?)\}»/, ((_, v) => + return hint.rawText.replaceAll(/«\{(.*?)\}»/g, ((_, v) => // `hint.varNames` contains tuples `[oldName, newName]` (hint.varNames.find(x => x[0] == v))[1])) } else { diff --git a/tsconfig.json b/tsconfig.json index 545c5c3..961d146 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,9 @@ "downlevelIteration": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, + "lib": [ + "ES2021.String" + ] }, "exclude": ["server", "relay"] }