File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -529,7 +529,22 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
529529 < TextField
530530 type = "number"
531531 value = { customLimit }
532- onChange = { ( e ) => updateCustomLimit ( e . target . value ) }
532+ onChange = { ( e : React . ChangeEvent < HTMLInputElement > ) => {
533+ const value = parseInt ( e . target . value ) ;
534+ // Only update if the value is greater than or equal to 1 or if the field is empty
535+ if ( e . target . value === '' || value >= 1 ) {
536+ updateCustomLimit ( e . target . value ) ;
537+ }
538+ } }
539+ inputProps = { {
540+ min : 1 ,
541+ onKeyPress : ( e : React . KeyboardEvent < HTMLInputElement > ) => {
542+ const value = ( e . target as HTMLInputElement ) . value + e . key ;
543+ if ( parseInt ( value ) < 1 ) {
544+ e . preventDefault ( ) ;
545+ }
546+ }
547+ } }
533548 placeholder = { t ( 'right_panel.limit.enter_number' ) }
534549 sx = { {
535550 marginLeft : '10px' ,
You can’t perform that action at this time.
0 commit comments