File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 27
27
28
28
const storeMethods = createStoreMethods ();
29
29
const actionMap = createActionMap (commands );
30
- let formattedEscKey = ' '
30
+ let formattedEscKey = ' ' ;
31
31
const { togglePalette, closePalette : closeCommandPalette } = storeMethods ;
32
32
33
33
const updateStore = () => {
107
107
}
108
108
};
109
109
110
+ const toggleCommandPalette = (event : KeyboardEvent ) => {
111
+ event .preventDefault ();
112
+ togglePalette ();
113
+ };
114
+
110
115
onMount (async () => {
111
- const tinyKeys = await import (' tinykeys' )
112
- const {default : tiny, parseKeybinding} = tinyKeys
116
+ const tinyKeys = await import (' tinykeys' );
117
+ const { default : tiny, parseKeybinding } = tinyKeys ;
113
118
formattedEscKey = parseKeybinding (' Esc' ).flat ().join (' ' );
114
119
const shortcuts = createShortcuts ({
115
120
actions: commands
116
121
});
117
122
unsubscribeKbdListener = tiny (window , {
118
123
... shortcuts ,
119
- ' $mod+k' : togglePalette ,
124
+ ' $mod+k' : toggleCommandPalette ,
120
125
Escape: closePalette ,
121
126
ArrowUp: handleArrowUp ,
122
127
ArrowDown: handleArrowDown ,
161
166
focusLastElement ();
162
167
wrapperElement ?.removeEventListener ?.(' click' , handleOutsideClick );
163
168
});
164
-
165
-
166
169
</script >
167
170
168
171
<Portal target =" body" >
You can’t perform that action at this time.
0 commit comments