mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
enhance(frontend/MkPostForm): ノートの投稿後すぐに投稿モーダルを閉じるように (MisskeyIO#605)
This commit is contained in:
parent
5e476a76ca
commit
8b214f8247
@ -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() {
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user