prepare to handle shortcut keys

pull/4976/head
Joseph Izang 5 months ago
parent 56d388c5ff
commit 70edff38cd
  1. 13
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  2. 3
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -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

@ -201,6 +201,9 @@ export interface FileExplorerContextMenuProps {
export interface WorkSpaceState {
ctrlKey: boolean
deleteKey?: boolean
backspaceKey?: boolean
F2Key?: boolean
newFileName: string
actions: {
id: string

Loading…
Cancel
Save