form buttons styling

This commit is contained in:
Jan Prochazka
2020-04-26 08:11:36 +02:00
parent 4e0770d1ab
commit d2887f9869
7 changed files with 96 additions and 17 deletions

View File

@@ -25,6 +25,7 @@ export default function SqlEditor({
tabVisible = false,
onKeyDown = undefined,
editorRef = undefined,
focusOnCreate = false,
}) {
const [containerRef, { height, width }] = useDimensions();
const ownEditorRef = React.useRef(null);
@@ -32,8 +33,9 @@ export default function SqlEditor({
const currentEditorRef = editorRef || ownEditorRef;
React.useEffect(() => {
if (tabVisible && currentEditorRef.current && currentEditorRef.current.editor) currentEditorRef.current.editor.focus();
}, [tabVisible]);
if ((tabVisible || focusOnCreate) && currentEditorRef.current && currentEditorRef.current.editor)
currentEditorRef.current.editor.focus();
}, [tabVisible, focusOnCreate]);
React.useEffect(() => {
if (onKeyDown && currentEditorRef.current) {