@@ -58,6 +58,20 @@ const sentryTemplate = {
5858 pattern : "/^https:\\/\\/[a-f0-9]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}(?::[0-9]{1,5})?\\/[0-9]+$/i" ,
5959 message : 'Invalid Sentry DSN.' ,
6060 } ,
61+ // Event handlers for real-time value processing
62+ events : {
63+ // Trim whitespace when user clicks outside the input (blur event)
64+ blur : function ( value , field , formData , component ) {
65+ if ( value && typeof value === 'string' ) {
66+ var trimmed = value . trim ( ) ;
67+ if ( trimmed !== value ) {
68+ // Update the form data with trimmed value
69+ formData [ field . name ] = trimmed ;
70+ console . log ( '[Sentry DSN] Auto-trimmed whitespace on blur' ) ;
71+ }
72+ }
73+ }
74+ } ,
6175 } ,
6276 {
6377 name : 'excludedUrls' ,
@@ -81,9 +95,14 @@ const sentryTemplate = {
8195 button_text : 'Add URL Pattern' ,
8296 input_size : 'large' , // Size for the input within array field
8397 button_size : 'small' , // Size for the button within array field
84- // Disable button until input has a value
85- button_disabled : function ( inputValue ) {
86- return ! inputValue || inputValue . trim ( ) === '' ;
98+ // Disable button until input has a value (minimum 1 character after trim)
99+ button_disabled : function ( inputValue ) {
100+ // Explicitly check for undefined, null, non-string, or empty/whitespace-only
101+ if ( typeof inputValue !== 'string' ) {
102+ return true ; // Disabled
103+ }
104+ var trimmed = inputValue . trim ( ) ;
105+ return trimmed . length === 0 ; // Disabled if empty, enabled if has characters
87106 } ,
88107 validation : {
89108 // Pattern allows: URLs, wildcards (*), paths, extensions
0 commit comments