File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,39 +85,34 @@ function isInputFocused(): boolean {
8585 activeElement instanceof HTMLTextAreaElement ||
8686 activeElement ?. getAttribute ( 'contenteditable' ) === 'true' ;
8787}
88+
8889function matchesModifiers ( event : KeyboardEvent , parsed : ParsedKey ) : boolean {
8990 const isMac = navigator . platform . toUpperCase ( ) . indexOf ( 'MAC' ) >= 0 ;
9091 const modKey = isMac ? event . metaKey : event . ctrlKey ;
9192
9293 if ( parsed . mod ) {
93- if ( ! modKey ) {
94- return false ;
95- }
96- if ( isMac && event . ctrlKey ) {
97- return false ;
98- }
99- if ( ! isMac && event . metaKey ) {
94+ if (
95+ ! modKey ||
96+ ( isMac && event . ctrlKey ) ||
97+ ( ! isMac && event . metaKey )
98+ ) {
10099 return false ;
101100 }
102101 } else {
103- if ( ! parsed . meta && event . metaKey ) {
104- return false ;
105- }
106- if ( ! parsed . ctrl && event . ctrlKey ) {
102+ if (
103+ ( ! parsed . meta && event . metaKey ) ||
104+ ( ! parsed . ctrl && event . ctrlKey )
105+ ) {
107106 return false ;
108107 }
109108 }
110109
111- if ( parsed . shift !== event . shiftKey ) {
112- return false ;
113- }
114- if ( parsed . alt !== event . altKey ) {
115- return false ;
116- }
117- if ( parsed . meta && ! event . metaKey ) {
118- return false ;
119- }
120- if ( parsed . ctrl && ! event . ctrlKey ) {
110+ if (
111+ ( parsed . shift !== event . shiftKey ) ||
112+ ( parsed . alt !== event . altKey ) ||
113+ ( parsed . meta && ! event . metaKey ) ||
114+ ( parsed . ctrl && ! event . ctrlKey )
115+ ) {
121116 return false ;
122117 }
123118
You can’t perform that action at this time.
0 commit comments