8
8
* that you can take advantage of the @ts-check directive and get some type-
9
9
* checking still.
10
10
*
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
13
19
*
14
20
* @typedef {Readonly<{ querySelector: string; value: string; }> } FormFieldEntry
15
21
* @typedef {Readonly<Record<string, FormFieldEntry>> } FormFieldEntries
@@ -135,7 +141,7 @@ function setInputValue(inputField, inputText) {
135
141
if ( i === - 1 ) {
136
142
inputField . value = "" ;
137
143
} else {
138
- inputField . value = `$ ${ inputField . value } $ ${ currentChar } ` ;
144
+ inputField . value = inputField . value + currentChar ;
139
145
}
140
146
141
147
inputField . dispatchEvent ( inputEvent ) ;
@@ -171,7 +177,7 @@ function setInputValue(inputField, inputText) {
171
177
async function autoSubmitForm ( myForm ) {
172
178
const setProtocolValue = ( ) => {
173
179
/** @type {HTMLDivElement | null } */
174
- const protocolDropdownTrigger = myForm . querySelector ( ` div[role="button"]` ) ;
180
+ const protocolDropdownTrigger = myForm . querySelector ( ' div[role="button"]' ) ;
175
181
if ( protocolDropdownTrigger === null ) {
176
182
throw new Error ( "No clickable trigger for setting protocol value" ) ;
177
183
}
@@ -184,7 +190,7 @@ async function autoSubmitForm(myForm) {
184
190
// they're part of the form. Avoids CSS stacking context issues, maybe?
185
191
/** @type {HTMLLIElement | null } */
186
192
const protocolOption = document . querySelector (
187
- ` p-dropdownitem[ng-reflect-label="$ ${ PROTOCOL } "] li` ,
193
+ ' p-dropdownitem[ng-reflect-label="' + PROTOCOL + '" li' ,
188
194
) ;
189
195
190
196
if ( protocolOption === null ) {
@@ -223,7 +229,7 @@ async function autoSubmitForm(myForm) {
223
229
224
230
if ( input === null ) {
225
231
throw new Error (
226
- ` Unable to element that matches query "$ ${ querySelector } "` ,
232
+ ' Unable to element that matches query "' + querySelector + '"' ,
227
233
) ;
228
234
}
229
235
@@ -332,7 +338,7 @@ function setupFormDetection() {
332
338
function setupObscuringStyles ( ) {
333
339
const styleId = "coder-patch--styles" ;
334
340
335
- const existingContainer = document . querySelector ( `#$ ${ styleId } ` ) ;
341
+ const existingContainer = document . querySelector ( "#" + styleId ) ;
336
342
if ( existingContainer ) {
337
343
return ;
338
344
}
0 commit comments