feat: make shortcuts easier to add across the app
This commit is contained in:
@@ -4,7 +4,12 @@ import Settings from './Settings.vue';
|
||||
|
||||
import { DialogType } from '~/composables/useDialog';
|
||||
|
||||
const { open, page, data, close, confirm } = useDialog();
|
||||
const { open, page, data, close, confirm, openDialog } = useDialog();
|
||||
const { addShortcut } = useKeyboardShortcuts();
|
||||
|
||||
const unbindShortcut = addShortcut(['ctrl', ','], () => {
|
||||
openDialog(DialogType.Settings);
|
||||
});
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
@@ -24,6 +29,7 @@ onUnmounted(() => {
|
||||
if (open.value) {
|
||||
document.body.removeEventListener('keydown', handleKeyDown);
|
||||
}
|
||||
unbindShortcut();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user