diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx index 6839cf65b..35a82d5ac 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx @@ -7,7 +7,7 @@ // ////////////////////////////////////////////////////////////// import { makeStyles, Box, Portal } from '@material-ui/core'; -import React, {useContext} from 'react'; +import React, {useContext, useLayoutEffect, useRef} from 'react'; import { DefaultButton, PrimaryButton } from '../../../../../../static/js/components/Buttons'; import CheckRoundedIcon from '@material-ui/icons/CheckRounded'; import CloseIcon from '@material-ui/icons/Close'; @@ -123,6 +123,10 @@ function setEditorPosition(cellEle, editorEle) { if(!editorEle || !cellEle) { return; } + /* Once the position is set, then don't change it */ + if(editorEle.style.left || editorEle.style.top) { + return; + } let gridEle = cellEle.closest('.rdg'); let cellRect = cellEle.getBoundingClientRect(); let position = { @@ -158,6 +162,12 @@ function textColumnFinalVal(columnVal, column) { } return columnVal; } + +function suppressEnterKey(e) { + if(e.keyCode == 13) { + e.stopPropagation(); + } +} export function TextEditor({row, column, onRowChange, onClose}) { const classes = useStyles(); const value = row[column.key] ?? ''; @@ -186,7 +196,7 @@ export function TextEditor({row, column, onRowChange, onClose}) { { setEditorPosition(getCellElement(column.idx), ele); - }} className={classes.textEditor} data-label="pg-editor"> + }} className={classes.textEditor} data-label="pg-editor" onKeyDown={suppressEnterKey} >