File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
src/features/payload-cms/payload-cms/plugins/form Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " conveniat27" ,
3- "version" : " 0.42.0 " ,
3+ "version" : " 0.42.1 " ,
44 "description" : " The official website of conveniat27" ,
55 "license" : " MIT" ,
66 "author" : " Cyrill Püntener v/o JPG (cyrill.puentener@cevi.ch)" ,
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ export const beforeEmailChangeHook: BeforeEmail = async (
9393 return '' ;
9494 } ;
9595
96+ let wildcardHtmlText = '' ;
97+ let wildcardHtmlTable =
98+ '<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse; width: 100%;">' ;
99+
96100 for ( const item of submissionDataArray ) {
97101 if (
98102 item !== null &&
@@ -101,9 +105,16 @@ export const beforeEmailChangeHook: BeforeEmail = async (
101105 typeof item . field === 'string' &&
102106 'value' in item
103107 ) {
104- submissionDict [ item . field ] = extractStringValue ( item . value ) ;
108+ const stringValue = extractStringValue ( item . value ) ;
109+ submissionDict [ item . field ] = stringValue ;
110+
111+ const fieldName = escapeHTML ( item . field ) ;
112+ const fieldValue = escapeHTML ( stringValue ) . replaceAll ( '\n' , '<br />' ) ;
113+ wildcardHtmlText += `<strong>${ fieldName } </strong>: ${ fieldValue } <br />\n` ;
114+ wildcardHtmlTable += `<tr><td><strong>${ fieldName } </strong></td><td>${ fieldValue } </td></tr>\n` ;
105115 }
106116 }
117+ wildcardHtmlTable += '</table>' ;
107118
108119 interface MinimalLexicalNode {
109120 type : string ;
@@ -181,6 +192,10 @@ export const beforeEmailChangeHook: BeforeEmail = async (
181192 }
182193 }
183194
195+ // Replace payloads wildcard variables
196+ updatedHtml = updatedHtml . replaceAll ( '{{*}}' , ( ) => wildcardHtmlText ) ;
197+ updatedHtml = updatedHtml . replaceAll ( '{{*:table}}' , ( ) => wildcardHtmlTable ) ;
198+
184199 return {
185200 ...email ,
186201 html : updatedHtml ,
Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ const selectedJobNotFoundMessage: StaticTranslationString = {
2121} ;
2222
2323const noJobSelectedMessage : StaticTranslationString = {
24- en : 'no job selected ' ,
25- de : 'kein Job ausgewählt ' ,
26- fr : 'aucun job sélectionné ' ,
24+ en : '- ' ,
25+ de : '- ' ,
26+ fr : '- ' ,
2727} ;
2828
2929/**
You can’t perform that action at this time.
0 commit comments