소스 검색

Escape $ in template strings

Henning Dieterichs 2 년 전
부모
커밋
7d75202fb5
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      website/src/website/pages/playground/PlaygroundModel.ts

+ 4 - 1
website/src/website/pages/playground/PlaygroundModel.ts

@@ -251,7 +251,10 @@ export class PlaygroundModel {
 		);
 		debugger;
 		const js = this.js;
-		const str = value.replaceAll("\\", "\\\\").replaceAll("`", "\\`");
+		const str = value
+			.replaceAll("\\", "\\\\")
+			.replaceAll("$", "\\$")
+			.replaceAll("`", "\\`");
 		const newJs = js.replace(regexp, "$1" + str + "`");
 		const autoReload = this.settings.autoReload;
 		this.settings.autoReload = false;