File tree Expand file tree Collapse file tree 6 files changed +26
-2
lines changed
translations/locales/en-US Expand file tree Collapse file tree 6 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ export default function useKeyDownHandlers(keyHandlers) {
3838 / ^ \d + $ / . test ( e . code . at ( - 1 ) ) ? e . code . at ( - 1 ) : e . key . toLowerCase ( )
3939 } `
4040 ] ?. ( e ) ;
41+ } else if ( isCtrl && e . altKey && e . code === 'KeyN' ) {
42+ // specifically for creating a new file
43+ handlers . current [ `ctrl-alt-n` ] ?. ( e ) ;
4144 } else if ( isCtrl ) {
4245 handlers . current [ `ctrl-${ e . key . toLowerCase ( ) } ` ] ?. ( e ) ;
4346 }
Original file line number Diff line number Diff line change @@ -133,6 +133,8 @@ const ProjectMenu = () => {
133133
134134 const replaceCommand =
135135 metaKey === 'Ctrl' ? `${ metaKeyName } +H` : `${ metaKeyName } +⌥+F` ;
136+ const newFileCommand =
137+ metaKey === 'Ctrl' ? `${ metaKeyName } +Alt+N` : `${ metaKeyName } +⌥+N` ;
136138
137139 return (
138140 < ul className = "nav__items-left" role = "menubar" >
@@ -220,6 +222,7 @@ const ProjectMenu = () => {
220222 < NavDropdownMenu id = "sketch" title = { t ( 'Nav.Sketch.Title' ) } >
221223 < NavMenuItem onClick = { ( ) => dispatch ( newFile ( rootFile . id ) ) } >
222224 { t ( 'Nav.Sketch.AddFile' ) }
225+ < span className = "nav__keyboard-shortcut" > { newFileCommand } </ span >
223226 </ NavMenuItem >
224227 < NavMenuItem onClick = { ( ) => dispatch ( newFolder ( rootFile . id ) ) } >
225228 { t ( 'Nav.Sketch.AddFolder' ) }
Original file line number Diff line number Diff line change @@ -637,6 +637,11 @@ exports[`Nav renders editor version for desktop 1`] = `
637637 role = " menuitem"
638638 >
639639 Add File
640+ <span
641+ class = " nav__keyboard-shortcut"
642+ >
643+ Ctrl+Alt+N
644+ </span >
640645 </button >
641646 </li >
642647 <li
Original file line number Diff line number Diff line change 88 expandSidebar ,
99 showErrorModal ,
1010 startSketch ,
11- stopSketch
11+ stopSketch ,
12+ newFile
1213} from '../actions/ide' ;
1314import { setAllAccessibleOutput } from '../actions/preferences' ;
1415import { cloneProject , saveProject } from '../actions/project' ;
@@ -72,6 +73,11 @@ export const useIDEKeyHandlers = ({ getContent }) => {
7273 sidebarIsExpanded ? collapseSidebar ( ) : expandSidebar ( )
7374 ) ;
7475 } ,
76+ 'ctrl-alt-n' : ( e ) => {
77+ e . preventDefault ( ) ;
78+ e . stopPropagation ( ) ;
79+ dispatch ( newFile ( ) ) ;
80+ } ,
7581 'ctrl-`' : ( e ) => {
7682 e . preventDefault ( ) ;
7783 dispatch ( consoleIsExpanded ? collapseConsole ( ) : expandConsole ( ) ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ function KeyboardShortcutModal() {
66 const { t } = useTranslation ( ) ;
77 const replaceCommand =
88 metaKey === 'Ctrl' ? `${ metaKeyName } + H` : `${ metaKeyName } + ⌥ + F` ;
9+ const newFileCommand =
10+ metaKey === 'Ctrl' ? `${ metaKeyName } + Alt + N` : `${ metaKeyName } + ⌥ + N` ;
911 return (
1012 < div className = "keyboard-shortcuts" >
1113 < h3 className = "keyboard-shortcuts__title" >
@@ -69,6 +71,10 @@ function KeyboardShortcutModal() {
6971 < span className = "keyboard-shortcut__command" > { metaKeyName } + K</ span >
7072 < span > { t ( 'KeyboardShortcuts.CodeEditing.ColorPicker' ) } </ span >
7173 </ li >
74+ < li className = "keyboard-shortcut-item" >
75+ < span className = "keyboard-shortcut__command" > { newFileCommand } </ span >
76+ < span > { t ( 'KeyboardShortcuts.CodeEditing.CreateNewFile' ) } </ span >
77+ </ li >
7278 </ ul >
7379 < h3 className = "keyboard-shortcuts__title" > General</ h3 >
7480 < ul className = "keyboard-shortcuts__list" >
Original file line number Diff line number Diff line change 207207 "FindNextTextMatch" : " Find Next Text Match" ,
208208 "FindPreviousTextMatch" : " Find Previous Text Match" ,
209209 "CodeEditing" : " Code Editing" ,
210- "ColorPicker" : " Show Inline Color Picker"
210+ "ColorPicker" : " Show Inline Color Picker" ,
211+ "CreateNewFile" : " Create New File"
211212 },
212213 "General" : {
213214 "StartSketch" : " Start Sketch" ,
You can’t perform that action at this time.
0 commit comments