refactor(command): use dialog (#352)

This commit is contained in:
QiroNT 2022-12-10 05:18:21 +08:00 committed by GitHub
parent f249087a95
commit 462e85dad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 131 deletions

View file

@ -1,11 +1,23 @@
<script setup lang="ts">
import {
isCommandPanelOpen,
isEditHistoryDialogOpen,
isMediaPreviewOpen,
isPreviewHelpOpen,
isPublishDialogOpen,
isSigninDialogOpen,
} from '~/composables/dialog'
const isMac = useIsMac()
// TODO: temporary, await for keybind system
// listen to ctrl+/ on windows/linux or cmd+/ on mac
useEventListener('keydown', (e: KeyboardEvent) => {
if (e.key === '/' && (isMac.value ? e.metaKey : e.ctrlKey)) {
e.preventDefault()
openCommandPanel(true)
}
})
</script>
<template>
@ -30,4 +42,7 @@ import {
<ModalDialog v-model="isEditHistoryDialogOpen">
<StatusEditPreview :edit="statusEdit" />
</ModalDialog>
<ModalDialog v-model="isCommandPanelOpen" max-w-fit flex>
<CommandPanel @close="closeCommandPanel()" />
</ModalDialog>
</template>