Fixed an issue to allow the Enter key to save data in the result grid text editor. #5307

This commit is contained in:
Pravesh Sharma 2024-09-27 12:18:07 +05:30 committed by GitHub
parent 0e63914ab3
commit f0ecc95ca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,11 +246,18 @@ export function TextEditor({row, column, onRowChange, onClose}) {
} }
}; };
const onkeydown = (e)=>{
// If only the Enter key is pressed, then save the changes.
if(e.keyCode == 13 && !e.shiftKey) {
onOK();
}
};
return ( return (
<Portal container={document.body}> <Portal container={document.body}>
<ResizableDiv columnIndex={column.idx} <ResizableDiv columnIndex={column.idx}
className='Editors-textEditor' data-label="pg-editor" onKeyDown={suppressEnterKey} > className='Editors-textEditor' data-label="pg-editor" onKeyDown={suppressEnterKey} >
<textarea ref={autoFocusAndSelect} className='Editors-textarea' value={localVal} onChange={onChange} /> <textarea ref={autoFocusAndSelect} className='Editors-textarea' value={localVal} onChange={onChange} onKeyDown={onkeydown} />
<Box display="flex" justifyContent="flex-end"> <Box display="flex" justifyContent="flex-end">
<DefaultButton startIcon={<CloseIcon />} onClick={()=>onClose(false)} size="small"> <DefaultButton startIcon={<CloseIcon />} onClick={()=>onClose(false)} size="small">
{gettext('Cancel')} {gettext('Cancel')}