@@ -22,6 +22,7 @@ import {
22
22
createEmailBodyWithoutN8nAttribution ,
23
23
} from './email-templates' ;
24
24
import type { IEmail } from './interfaces' ;
25
+ import { cssVariables } from '../../nodes/Form/cssVariables' ;
25
26
import { formFieldsProperties } from '../../nodes/Form/Form.node' ;
26
27
import { prepareFormData , prepareFormReturnItem , resolveRawData } from '../../nodes/Form/utils' ;
27
28
import { escapeHtml } from '../utilities' ;
@@ -39,6 +40,7 @@ type FormResponseTypeOptions = {
39
40
responseFormTitle ?: string ;
40
41
responseFormDescription ?: string ;
41
42
responseFormButtonLabel ?: string ;
43
+ responseFormCustomCss ?: string ;
42
44
} ;
43
45
44
46
const INPUT_FIELD_IDENTIFIER = 'field-0' ;
@@ -283,6 +285,17 @@ export function getSendAndWaitProperties(
283
285
type : 'string' ,
284
286
default : 'Submit' ,
285
287
} ,
288
+ {
289
+ displayName : 'Response Form Custom Styling' ,
290
+ name : 'responseFormCustomCss' ,
291
+ type : 'string' ,
292
+ typeOptions : {
293
+ rows : 10 ,
294
+ editor : 'cssEditor' ,
295
+ } ,
296
+ default : cssVariables . trim ( ) ,
297
+ description : 'Override default styling of the response form with CSS' ,
298
+ } ,
286
299
limitWaitTimeOption ,
287
300
appendAttributionOption ,
288
301
] ,
@@ -331,6 +344,7 @@ const getFormResponseCustomizations = (context: IWebhookFunctions) => {
331
344
formTitle,
332
345
formDescription,
333
346
buttonLabel,
347
+ customCss : options . responseFormCustomCss ,
334
348
} ;
335
349
} ;
336
350
@@ -351,7 +365,8 @@ export async function sendAndWaitWebhook(this: IWebhookFunctions) {
351
365
352
366
if ( responseType === 'freeText' ) {
353
367
if ( method === 'GET' ) {
354
- const { formTitle, formDescription, buttonLabel } = getFormResponseCustomizations ( this ) ;
368
+ const { formTitle, formDescription, buttonLabel, customCss } =
369
+ getFormResponseCustomizations ( this ) ;
355
370
356
371
const data = prepareFormData ( {
357
372
formTitle,
@@ -369,6 +384,7 @@ export async function sendAndWaitWebhook(this: IWebhookFunctions) {
369
384
] ,
370
385
testRun : false ,
371
386
query : { } ,
387
+ customCss,
372
388
} ) ;
373
389
374
390
res . render ( 'form-trigger' , data ) ;
@@ -408,7 +424,8 @@ export async function sendAndWaitWebhook(this: IWebhookFunctions) {
408
424
}
409
425
410
426
if ( method === 'GET' ) {
411
- const { formTitle, formDescription, buttonLabel } = getFormResponseCustomizations ( this ) ;
427
+ const { formTitle, formDescription, buttonLabel, customCss } =
428
+ getFormResponseCustomizations ( this ) ;
412
429
413
430
const data = prepareFormData ( {
414
431
formTitle,
@@ -420,6 +437,7 @@ export async function sendAndWaitWebhook(this: IWebhookFunctions) {
420
437
formFields : fields ,
421
438
testRun : false ,
422
439
query : { } ,
440
+ customCss,
423
441
} ) ;
424
442
425
443
res . render ( 'form-trigger' , data ) ;
0 commit comments