iceshrimp/packages/client/src/components/MkPostFormDialog.vue

62 lines
1.3 KiB
Vue
Raw Normal View History

<template>
2023-04-08 09:01:42 +09:00
<MkModal
ref="modal"
:prefer-type="'dialog'"
@click="modal.close()"
@closed="onModalClosed()"
>
<MkPostForm
ref="form"
style="margin: 0 auto auto auto"
v-bind="props"
autofocus
freeze-after-posted
@posted="onPosted"
@cancel="modal.close()"
@esc="modal.close()"
/>
2023-02-19 08:27:12 +09:00
</MkModal>
2023-02-19 08:53:19 +09:00
</template>
2023-02-19 08:53:19 +09:00
<script lang="ts" setup>
2023-04-08 09:01:42 +09:00
import {} from "vue";
import * as misskey from "calckey-js";
import MkModal from "@/components/MkModal.vue";
import MkPostForm from "@/components/MkPostForm.vue";
2023-02-19 08:53:19 +09:00
const props = defineProps<{
reply?: misskey.entities.Note;
renote?: misskey.entities.Note;
channel?: any; // TODO
mention?: misskey.entities.User;
specified?: misskey.entities.User;
initialText?: string;
initialVisibility?: typeof misskey.noteVisibilities;
initialFiles?: misskey.entities.DriveFile[];
initialLocalOnly?: boolean;
initialVisibleUsers?: misskey.entities.User[];
initialNote?: misskey.entities.Note;
instant?: boolean;
fixed?: boolean;
autofocus?: boolean;
2023-05-07 19:27:25 +09:00
editId?: misskey.entities.Note["id"];
2023-02-19 08:53:19 +09:00
}>();
2023-02-19 08:27:12 +09:00
2023-02-19 08:53:19 +09:00
const emit = defineEmits<{
2023-04-08 09:01:42 +09:00
(ev: "closed"): void;
2023-02-19 08:53:19 +09:00
}>();
2023-02-19 08:27:12 +09:00
2023-02-19 08:53:19 +09:00
let modal = $shallowRef<InstanceType<typeof MkModal>>();
let form = $shallowRef<InstanceType<typeof MkPostForm>>();
2023-02-19 08:27:12 +09:00
2023-02-19 08:53:19 +09:00
function onPosted() {
modal.close({
useSendAnimation: true,
});
}
2023-02-19 08:27:12 +09:00
2023-02-19 08:53:19 +09:00
function onModalClosed() {
2023-04-08 09:01:42 +09:00
emit("closed");
2023-02-19 08:53:19 +09:00
}
</script>