From 7681722e5afdc2df0c9eed201b05add3beda92a7 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Thu, 28 Jul 2022 23:55:59 +0500 Subject: [PATCH] fix: autofocus input field and submit on enter --- web/src/components/filePathInputModal.tsx | 31 ++++++++++------- web/src/components/nameInputModal.tsx | 41 ++++++++++++++++------- web/src/components/tree.tsx | 6 +++- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/web/src/components/filePathInputModal.tsx b/web/src/components/filePathInputModal.tsx index d1eeaa5..f5bcca6 100644 --- a/web/src/components/filePathInputModal.tsx +++ b/web/src/components/filePathInputModal.tsx @@ -39,21 +39,30 @@ const FilePathInputModal = ({ setFilePath(value) } + const handleSubmit = (event: React.FormEvent) => { + event.preventDefault() + if (hasError || !filePath) return + saveFile(filePath) + } + return ( setOpen(false)} open={open}> Save File - +
+ +