File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -64,20 +64,21 @@ export default class EditorScrollCommandsPlugin extends Plugin {
64
64
65
65
isScrollHotkeyEvent ( event : KeyboardEvent , hotkeys : Hotkey [ ] ) {
66
66
return hotkeys ?. some ( ( hotkey : Hotkey ) => {
67
- let keyMatched =
68
- ( hotkey . key == event . code ) ||
69
- ( 'Key' + hotkey . key == event . code ) ;
70
-
71
- if ( ! keyMatched ) { return false ; }
67
+ if ( ( hotkey . key != event . code ) &&
68
+ ( 'Key' + hotkey . key != event . code ) ) { return false ; }
72
69
73
70
let mods = hotkey . modifiers ;
74
- let modKeyState = Platform . isMacOS ? event . metaKey : event . ctrlKey ;
75
71
76
72
if ( event . altKey != mods . contains ( 'Alt' ) ) { return false ; }
77
- if ( event . ctrlKey != mods . contains ( 'Ctrl' ) ) { return false ; }
78
73
if ( event . shiftKey != mods . contains ( 'Shift' ) ) { return false ; }
79
- if ( event . metaKey != mods . contains ( 'Meta' ) ) { return false ; }
80
- if ( modKeyState != mods . contains ( 'Mod' ) ) { return false ; }
74
+
75
+ if ( Platform . isMacOS ) {
76
+ if ( event . metaKey != ( mods . contains ( 'Mod' ) || mods . contains ( 'Meta' ) ) )
77
+ { return false ; }
78
+ } else {
79
+ if ( event . ctrlKey != ( mods . contains ( 'Mod' ) || mods . contains ( 'Ctrl' ) ) )
80
+ { return false ; }
81
+ }
81
82
82
83
return true ;
83
84
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"id" : " editor-scroll-commands" ,
3
3
"name" : " Editor Scroll Commands" ,
4
- "version" : " 1.1.2 " ,
4
+ "version" : " 1.1.3 " ,
5
5
"minAppVersion" : " 0.15.0" ,
6
6
"description" : " Add scroll commands for editor, so you can assign hotkeys." ,
7
7
"author" : " Andrey Sorokin <pho.nzp@gmail.com>" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " editor-scroll-commands" ,
3
- "version" : " 1.1.2 " ,
3
+ "version" : " 1.1.3 " ,
4
4
"description" : " Add scroll commands for editor, so you can assign hotkeys." ,
5
5
"main" : " main.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change 3
3
"1.0.3" : " 0.15.0" ,
4
4
"1.1.0" : " 0.15.0" ,
5
5
"1.1.1" : " 0.15.0" ,
6
- "1.1.2" : " 0.15.0"
6
+ "1.1.2" : " 0.15.0" ,
7
+ "1.1.3" : " 0.15.0"
7
8
}
You can’t perform that action at this time.
0 commit comments