Skip to content

Commit

Permalink
Fixed an issue to allow the Enter key to save data in the result grid…
Browse files Browse the repository at this point in the history
… text editor. #5307
  • Loading branch information
pravesh-sharma authored Sep 27, 2024
1 parent 0e63914 commit f0ecc95
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Portal container={document.body}>
<ResizableDiv columnIndex={column.idx}
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">
<DefaultButton startIcon={<CloseIcon />} onClick={()=>onClose(false)} size="small">
{gettext('Cancel')}
Expand Down

0 comments on commit f0ecc95

Please sign in to comment.