File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -363,9 +363,18 @@ function focusKeydown(event: KeyboardEvent) {
363363
364364const shortcutListeners = new WeakMap ( )
365365
366+ function findHotkey ( toolbar : Element , key : string ) : HTMLElement | null {
367+ for ( const el of toolbar . querySelectorAll < HTMLElement > ( '[hotkey]' ) ) {
368+ if ( el . getAttribute ( 'hotkey' ) === key ) {
369+ return el
370+ }
371+ }
372+ return null
373+ }
374+
366375function shortcut ( toolbar : Element , event : KeyboardEvent ) {
367376 if ( ( event . metaKey && modifierKey === 'Meta' ) || ( event . ctrlKey && modifierKey === 'Control' ) ) {
368- const button = toolbar . querySelector < HTMLElement > ( `[hotkey=" ${ event . key } "]` )
377+ const button = findHotkey ( toolbar , event . key )
369378 if ( button ) {
370379 button . click ( )
371380 event . preventDefault ( )
You can’t perform that action at this time.
0 commit comments