File tree 6 files changed +26
-2
lines changed
translations/locales/en-US
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) {
38
38
/ ^ \d + $ / . test ( e . code . at ( - 1 ) ) ? e . code . at ( - 1 ) : e . key . toLowerCase ( )
39
39
} `
40
40
] ?. ( e ) ;
41
+ } else if ( isCtrl && e . altKey && e . code === 'KeyN' ) {
42
+ // specifically for creating a new file
43
+ handlers . current [ `ctrl-alt-n` ] ?. ( e ) ;
41
44
} else if ( isCtrl ) {
42
45
handlers . current [ `ctrl-${ e . key . toLowerCase ( ) } ` ] ?. ( e ) ;
43
46
}
Original file line number Diff line number Diff line change @@ -133,6 +133,8 @@ const ProjectMenu = () => {
133
133
134
134
const replaceCommand =
135
135
metaKey === 'Ctrl' ? `${ metaKeyName } +H` : `${ metaKeyName } +⌥+F` ;
136
+ const newFileCommand =
137
+ metaKey === 'Ctrl' ? `${ metaKeyName } +Alt+N` : `${ metaKeyName } +⌥+N` ;
136
138
137
139
return (
138
140
< ul className = "nav__items-left" role = "menubar" >
@@ -220,6 +222,7 @@ const ProjectMenu = () => {
220
222
< NavDropdownMenu id = "sketch" title = { t ( 'Nav.Sketch.Title' ) } >
221
223
< NavMenuItem onClick = { ( ) => dispatch ( newFile ( rootFile . id ) ) } >
222
224
{ t ( 'Nav.Sketch.AddFile' ) }
225
+ < span className = "nav__keyboard-shortcut" > { newFileCommand } </ span >
223
226
</ NavMenuItem >
224
227
< NavMenuItem onClick = { ( ) => dispatch ( newFolder ( rootFile . id ) ) } >
225
228
{ 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`] = `
637
637
role = " menuitem"
638
638
>
639
639
Add File
640
+ <span
641
+ class = " nav__keyboard-shortcut"
642
+ >
643
+ Ctrl+Alt+N
644
+ </span >
640
645
</button >
641
646
</li >
642
647
<li
Original file line number Diff line number Diff line change 8
8
expandSidebar ,
9
9
showErrorModal ,
10
10
startSketch ,
11
- stopSketch
11
+ stopSketch ,
12
+ newFile
12
13
} from '../actions/ide' ;
13
14
import { setAllAccessibleOutput } from '../actions/preferences' ;
14
15
import { cloneProject , saveProject } from '../actions/project' ;
@@ -72,6 +73,11 @@ export const useIDEKeyHandlers = ({ getContent }) => {
72
73
sidebarIsExpanded ? collapseSidebar ( ) : expandSidebar ( )
73
74
) ;
74
75
} ,
76
+ 'ctrl-alt-n' : ( e ) => {
77
+ e . preventDefault ( ) ;
78
+ e . stopPropagation ( ) ;
79
+ dispatch ( newFile ( ) ) ;
80
+ } ,
75
81
'ctrl-`' : ( e ) => {
76
82
e . preventDefault ( ) ;
77
83
dispatch ( consoleIsExpanded ? collapseConsole ( ) : expandConsole ( ) ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ function KeyboardShortcutModal() {
6
6
const { t } = useTranslation ( ) ;
7
7
const replaceCommand =
8
8
metaKey === 'Ctrl' ? `${ metaKeyName } + H` : `${ metaKeyName } + ⌥ + F` ;
9
+ const newFileCommand =
10
+ metaKey === 'Ctrl' ? `${ metaKeyName } + Alt + N` : `${ metaKeyName } + ⌥ + N` ;
9
11
return (
10
12
< div className = "keyboard-shortcuts" >
11
13
< h3 className = "keyboard-shortcuts__title" >
@@ -69,6 +71,10 @@ function KeyboardShortcutModal() {
69
71
< span className = "keyboard-shortcut__command" > { metaKeyName } + K</ span >
70
72
< span > { t ( 'KeyboardShortcuts.CodeEditing.ColorPicker' ) } </ span >
71
73
</ li >
74
+ < li className = "keyboard-shortcut-item" >
75
+ < span className = "keyboard-shortcut__command" > { newFileCommand } </ span >
76
+ < span > { t ( 'KeyboardShortcuts.CodeEditing.CreateNewFile' ) } </ span >
77
+ </ li >
72
78
</ ul >
73
79
< h3 className = "keyboard-shortcuts__title" > General</ h3 >
74
80
< ul className = "keyboard-shortcuts__list" >
Original file line number Diff line number Diff line change 207
207
"FindNextTextMatch" : " Find Next Text Match" ,
208
208
"FindPreviousTextMatch" : " Find Previous Text Match" ,
209
209
"CodeEditing" : " Code Editing" ,
210
- "ColorPicker" : " Show Inline Color Picker"
210
+ "ColorPicker" : " Show Inline Color Picker" ,
211
+ "CreateNewFile" : " Create New File"
211
212
},
212
213
"General" : {
213
214
"StartSketch" : " Start Sketch" ,
You can’t perform that action at this time.
0 commit comments