1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 06:18:40 +09:00

enhance(frontend/MkPostForm): ノートの投稿後すぐに投稿モーダルを閉じるように (MisskeyIO#605)

This commit is contained in:
水咲(みさき) 2024-04-11 18:27:27 +09:00 committed by GitHub
parent 5e476a76ca
commit 8b214f8247
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -162,7 +162,9 @@ const props = withDefaults(defineProps<{
provide('mock', props.mock);
const emit = defineEmits<{
(ev: 'posting'): void;
(ev: 'posted'): void;
(ev: 'postError'): void;
(ev: 'cancel'): void;
(ev: 'esc'): void;
@ -861,7 +863,9 @@ async function post(ev?: MouseEvent) {
type: 'error',
text: err.message + '\n' + (err as any).id,
});
emit("postError");
});
emit("posting");
}
function cancel() {

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<MkModal ref="modal" :preferType="'dialog'" @click="modal?.close()" @closed="onModalClosed()">
<MkPostForm ref="form" :class="$style.form" v-bind="props" autofocus freezeAfterPosted @posted="onPosted" @cancel="modal?.close()" @esc="modal?.close()"/>
<MkPostForm ref="form" :class="$style.form" v-bind="props" autofocus freezeAfterPosted @posting="onPosting" @postError="onPostError" @cancel="modal?.close()" @esc="modal?.close()"/>
</MkModal>
</template>
@ -14,6 +14,7 @@ import { shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import MkModal from '@/components/MkModal.vue';
import MkPostForm from '@/components/MkPostForm.vue';
import * as os from '@/os.js';
const props = defineProps<{
reply?: Misskey.entities.Note;
@ -40,12 +41,16 @@ const emit = defineEmits<{
const modal = shallowRef<InstanceType<typeof MkModal>>();
const form = shallowRef<InstanceType<typeof MkPostForm>>();
function onPosted() {
function onPosting() {
modal.value?.close({
useSendAnimation: true,
});
}
function onPostError() {
os.post();
}
function onModalClosed() {
emit('closed');
}