diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index e3b301901c..7831f93124 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -96,6 +96,19 @@ export const FileExplorer = (props: FileExplorerProps) => { } }, [treeRef.current]) + useEffect(() => { + const deleteKeyPressHandler = (eve: KeyboardEvent) => { + if (eve.key === 'Delete' || eve.key === 'Backspace' ) { + console.log('delete key was pressed') + } + } + + treeRef.current?.addEventListener('keydown', deleteKeyPressHandler) + return () => { + treeRef.current?.removeEventListener('keydown', deleteKeyPressHandler) + } + }, []) + const hasReservedKeyword = (content: string): boolean => { if (state.reservedKeywords.findIndex((value) => content.startsWith(value)) !== -1) return true else return false diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index aff1b70bd8..89c50f79fa 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -201,6 +201,9 @@ export interface FileExplorerContextMenuProps { export interface WorkSpaceState { ctrlKey: boolean + deleteKey?: boolean + backspaceKey?: boolean + F2Key?: boolean newFileName: string actions: { id: string