File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1729,9 +1729,14 @@ class TRMLYamlForm extends HTMLElement {
17291729 if ( typeof value !== 'string' ) return '""' ;
17301730
17311731 // Check if value needs quoting
1732- if ( / [: # \[ \] \{ \} , & \* \| > ! ' " % @ ` \n \t ] / . test ( value ) || / ^ \d + $ / . test ( value ) || value . startsWith ( ' ' ) || value . endsWith ( ' ' ) ) {
1733- return `"${ value . replace ( / " / g, '\\"' ) } "` ;
1734- }
1732+ if (
1733+ / [: # \[ \] \{ \} , & \* \| > ! ' " % @ ` \n \t ] / . test ( value ) || // Existing special chars
1734+ / ^ \d + $ / . test ( value ) || // Existing numeric string check
1735+ value . startsWith ( ' ' ) || value . endsWith ( ' ' ) || // Existing whitespace check
1736+ / ^ ( t r u e | f a l s e | y e s | n o | o n | o f f ) $ / i. test ( value ) // NEW check for YAML literals (case-insensitive)
1737+ ) {
1738+ return `"${ value . replace ( / " / g, '\\"' ) } "` ;
1739+ } ;
17351740
17361741 return value ;
17371742 }
@@ -2146,3 +2151,4 @@ class TRMLYamlForm extends HTMLElement {
21462151
21472152// Register the custom element
21482153customElements . define ( 'trmnl-form-builder' , TRMLYamlForm ) ;
2154+
You can’t perform that action at this time.
0 commit comments