diff --git a/client/common/useKeyDownHandlers.js b/client/common/useKeyDownHandlers.js index dbe2ee06bb..75c81e1ff9 100644 --- a/client/common/useKeyDownHandlers.js +++ b/client/common/useKeyDownHandlers.js @@ -32,15 +32,19 @@ export default function useKeyDownHandlers(keyHandlers) { if (!e.key) return; const isMac = navigator.userAgent.toLowerCase().indexOf('mac') !== -1; const isCtrl = isMac ? e.metaKey : e.ctrlKey; - if (e.shiftKey && isCtrl) { + + if (isCtrl && e.shiftKey && e.altKey && e.code === 'KeyN') { + // specifically for creating a new folder + handlers.current[`ctrl-alt-shift-n`]?.(e); + } else if (isCtrl && e.altKey && e.code === 'KeyN') { + // specifically for creating a new file + handlers.current[`ctrl-alt-n`]?.(e); + } else if (e.shiftKey && isCtrl) { handlers.current[ `ctrl-shift-${ /^\d+$/.test(e.code.at(-1)) ? e.code.at(-1) : e.key.toLowerCase() }` ]?.(e); - } else if (isCtrl && e.altKey && e.code === 'KeyN') { - // specifically for creating a new file - handlers.current[`ctrl-alt-n`]?.(e); } else if (isCtrl) { handlers.current[`ctrl-${e.key.toLowerCase()}`]?.(e); } diff --git a/client/modules/IDE/components/Header/Nav.jsx b/client/modules/IDE/components/Header/Nav.jsx index f40e9137bf..de59a4271c 100644 --- a/client/modules/IDE/components/Header/Nav.jsx +++ b/client/modules/IDE/components/Header/Nav.jsx @@ -139,6 +139,8 @@ const ProjectMenu = () => { metaKey === 'Ctrl' ? `${metaKeyName}+H` : `${metaKeyName}+⌥+F`; const newFileCommand = metaKey === 'Ctrl' ? `${metaKeyName}+Alt+N` : `${metaKeyName}+⌥+N`; + const newFolderCommand = + metaKey === 'Ctrl' ? `${metaKeyName}+Alt+Shift+N` : `${metaKeyName}+⌥+⇧+N`; return (

{t('KeyboardShortcuts.General')} diff --git a/translations/locales/en-US/translations.json b/translations/locales/en-US/translations.json index 376c18471c..84922fc914 100644 --- a/translations/locales/en-US/translations.json +++ b/translations/locales/en-US/translations.json @@ -249,7 +249,8 @@ "FindPreviousTextMatch": "Find Previous Text Match", "CodeEditing": "Code Editing", "ColorPicker": "Show Inline Color Picker", - "CreateNewFile": "Create New File" + "CreateNewFile": "Create New File", + "CreateNewFolder": "Create New Folder" }, "General": "General", "GeneralSelection": {