8000 fix: remove template literal dollar signs · coder/modules@d5cfadb · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit d5cfadb

Browse files
committed
fix: remove template literal dollar signs
1 parent fba0f84 commit d5cfadb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

windows-rdp/devolutions-patch.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
* that you can take advantage of the @ts-check directive and get some type-
99
* checking still.
1010
*
11-
* A lot of the HTML selectors in this file will look nonstandard. This is
12-
* because they are actually custom Angular components.
11+
* Other notes about the weird ways this file is set up:
12+
* - A lot of the HTML selectors in this file will look nonstandard. This is
13+
* because they are actually custom Angular components.
14+
* - It is strongly advised that you avoid template literals that use the
15+
* placeholder syntax via the dollar sign. The Terraform script looks for
16+
* these characters so that it can inject Coder-specific values, so any
17+
* template literal that uses the character actually needs to double up each
18+
* of them
1319
*
1420
* @typedef {Readonly<{ querySelector: string; value: string; }>} FormFieldEntry
1521
* @typedef {Readonly<Record<string, FormFieldEntry>>} FormFieldEntries
@@ -135,7 +141,7 @@ function setInputValue(inputField, inputText) {
135141
if (i === -1) {
136142
inputField.value = "";
137143
} else {
138-
inputField.value = `$${inputField.value}$${currentChar}`;
144+
inputField.value = inputField.value + currentChar;
139145
}
140146

141147
inputField.dispatchEvent(inputEvent);
@@ -171,7 +177,7 @@ function setInputValue(inputField, inputText) {
171177
async function autoSubmitForm(myForm) {
172178
const setProtocolValue = () => {
173179
/** @type {HTMLDivElement | null} */
174-
const protocolDropdownTrigger = myForm.querySelector(`div[role="button"]`);
180+
const protocolDropdownTrigger = myForm.querySelector('div[role="button"]');
175181
if (protocolDropdownTrigger === null) {
176182
throw new Error("No clickable trigger for setting protocol value");
177183
}
@@ -184,7 +190,7 @@ async function autoSubmitForm(myForm) {
184190
// they're part of the form. Avoids CSS stacking context issues, maybe?
185191
/** @type {HTMLLIElement | null} */
186192
const protocolOption = document.querySelector(
187-
`p-dropdownitem[ng-reflect-label="$${PROTOCOL}"] li`,
193+
'p-dropdownitem[ng-reflect-label="' + PROTOCOL + '" li',
188194
);
189195

190196
if (protocolOption === null) {
@@ -223,7 +229,7 @@ async function autoSubmitForm(myForm) {
223229

224230
if (input === null) {
225231
throw new Error(
226-
`Unable to element that matches query "$${querySelector}"`,
232+
'Unable to element that matches query "' + querySelector + '"',
227233
);
228234
}
229235

@@ -332,7 +338,7 @@ function setupFormDetection() {
332338
function setupObscuringStyles() {
333339
const styleId = "coder-patch--styles";
334340

335-
const existingContainer = document.querySelector(`#$${styleId}`);
341+
const existingContainer = document.querySelector("#" + styleId);
336342
if (existingContainer) {
337343
return;
338344
}

0 commit comments

Comments
 (0)
0