feat: go to new status after redraftting

This commit is contained in:
三咲智子 2023-01-01 23:57:49 +08:00
parent d62292d219
commit 22fcc1d68b
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
5 changed files with 42 additions and 13 deletions

View file

@ -1,4 +1,5 @@
<script setup lang="ts">
import type { Status } from 'masto'
import {
isCommandPanelOpen,
isEditHistoryDialogOpen,
@ -26,6 +27,15 @@ useEventListener('keydown', (e: KeyboardEvent) => {
openCommandPanel(true)
}
})
const handlePublished = (status: Status) => {
lastPublishDialogStatus.value = status
isPublishDialogOpen.value = false
}
const handlePublishClose = () => {
lastPublishDialogStatus.value = null
}
</script>
<template>
@ -36,9 +46,16 @@ useEventListener('keydown', (e: KeyboardEvent) => {
<ModalDialog v-model="isPreviewHelpOpen" max-w-125>
<HelpPreview @close="closePreviewHelp()" />
</ModalDialog>
<ModalDialog v-model="isPublishDialogOpen" max-w-180 flex>
<ModalDialog
v-model="isPublishDialogOpen"
max-w-180 flex
@close="handlePublishClose"
>
<!-- This `w-0` style is used to avoid overflow problems in flex layoutsso don't remove it unless you know what you're doing -->
<PublishWidget :draft-key="dialogDraftKey" expanded flex-1 w-0 />
<PublishWidget
:draft-key="dialogDraftKey" expanded flex-1 w-0
@published="handlePublished"
/>
</ModalDialog>
<ModalDialog
v-model="isMediaPreviewOpen"

View file

@ -46,12 +46,13 @@ const props = withDefaults(defineProps<Props>(), {
keepAlive: false,
})
const emits = defineEmits<{
const emit = defineEmits<{
/** v-model dialog visibility */
(event: 'update:modelValue', value: boolean): void
(event: 'close',): void
}>()
const visible = useVModel(props, 'modelValue', emits, { passive: true })
const visible = useVModel(props, 'modelValue', emit, { passive: true })
const deactivated = useDeactivated()
const route = useRoute()
@ -75,6 +76,7 @@ defineExpose({
/** close the dialog */
function close() {
visible.value = false
emit('close')
}
function clickMask() {