fix: create and store label when colon is pressed (#2886)

* fix: create and store label when colon is pressed

* fix: use native JS replace

* chore: extra value variable is removed

---------

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Daman Arora 2023-06-12 05:06:21 -04:00 committed by GitHub
parent bb7ea8e8fb
commit 754ba93df9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,8 +84,8 @@ function LabelSelect({
handleBlur(); handleBlur();
}, [handleBlur]); }, [handleBlur]);
const handleChange = (e: ChangeEvent<HTMLInputElement>): void => { const handleLabelChange = (event: ChangeEvent<HTMLInputElement>): void => {
setCurrentVal(e.target?.value); setCurrentVal(event.target?.value.replace(':', ''));
}; };
const handleClose = (key: string): void => { const handleClose = (key: string): void => {
@ -133,9 +133,9 @@ function LabelSelect({
<div style={{ display: 'flex', width: '100%' }}> <div style={{ display: 'flex', width: '100%' }}>
<Input <Input
placeholder={renderPlaceholder()} placeholder={renderPlaceholder()}
onChange={handleChange} onChange={handleLabelChange}
onKeyUp={(e): void => { onKeyUp={(e): void => {
if (e.key === 'Enter' || e.code === 'Enter') { if (e.key === 'Enter' || e.code === 'Enter' || e.key === ':') {
send('NEXT'); send('NEXT');
} }
}} }}