From a38f4001535023aa1d4197502d25101df53bcb42 Mon Sep 17 00:00:00 2001 From: kundan kumar Date: Tue, 18 Jun 2024 21:19:18 +0530 Subject: [PATCH 1/2] added Enter key for new file --- next_app/src/components/new-file-dialog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/next_app/src/components/new-file-dialog.tsx b/next_app/src/components/new-file-dialog.tsx index fbaee1a..a42798a 100644 --- a/next_app/src/components/new-file-dialog.tsx +++ b/next_app/src/components/new-file-dialog.tsx @@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { toast } from "sonner"; +import { HtmlContext } from "next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints"; export function NewFileDialog({ manager, project, collapsed, setCollapsed }: { manager: ProjectManager; project: string; collapsed:boolean; setCollapsed: Dispatch> }) { const globalState = useGlobalState(); @@ -27,6 +28,12 @@ export function NewFileDialog({ manager, project, collapsed, setCollapsed }: { m setPopupOpen(false); setCollapsed(true); } + const handleEnter =( event :React.KeyboardEvent ) =>{ + if(event.key === "Enter"){ + newFile(); + } + + } return ( { setPopupOpen(e); setCollapsed(!e)}}> @@ -40,7 +47,7 @@ export function NewFileDialog({ manager, project, collapsed, setCollapsed }: { m Create a new file Enter the name of the file you want to create
(supported extensions: lua, luanb, md)
- setNewFileName(e.target.value)} /> + setNewFileName(e.target.value)} onKeyDown={handleEnter}/>
From 21ff09ffc916ac6fd5989a2270eafe9341ef6532 Mon Sep 17 00:00:00 2001 From: kundan kumar Date: Tue, 18 Jun 2024 21:26:43 +0530 Subject: [PATCH 2/2] _ --- next_app/src/components/new-file-dialog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/next_app/src/components/new-file-dialog.tsx b/next_app/src/components/new-file-dialog.tsx index a42798a..ec31524 100644 --- a/next_app/src/components/new-file-dialog.tsx +++ b/next_app/src/components/new-file-dialog.tsx @@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { toast } from "sonner"; -import { HtmlContext } from "next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints"; export function NewFileDialog({ manager, project, collapsed, setCollapsed }: { manager: ProjectManager; project: string; collapsed:boolean; setCollapsed: Dispatch> }) { const globalState = useGlobalState();