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

64 lines
1.4 KiB
Vue
Raw Normal View History

<template>
2023-04-08 02:01:42 +02: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 00:27:12 +01:00
</MkModal>
2023-02-19 00:53:19 +01:00
</template>
2023-02-19 00:53:19 +01:00
<script lang="ts" setup>
import { shallowRef } from "vue";
2023-09-24 06:27:16 +02:00
import type * as firefish from "firefish-js";
2023-04-08 02:01:42 +02:00
import MkModal from "@/components/MkModal.vue";
import MkPostForm from "@/components/MkPostForm.vue";
2023-02-19 00:53:19 +01:00
const props = defineProps<{
2023-09-24 06:27:16 +02:00
reply?: firefish.entities.Note;
renote?: firefish.entities.Note;
2023-02-19 00:53:19 +01:00
channel?: any; // TODO
2023-09-24 06:27:16 +02:00
mention?: firefish.entities.User;
specified?: firefish.entities.User;
2023-02-19 00:53:19 +01:00
initialText?: string;
2023-09-24 06:27:16 +02:00
initialVisibility?: typeof firefish.noteVisibilities;
initialLanguage?: typeof firefish.languages;
2023-09-24 06:27:16 +02:00
initialFiles?: firefish.entities.DriveFile[];
2023-02-19 00:53:19 +01:00
initialLocalOnly?: boolean;
2023-09-24 06:27:16 +02:00
initialVisibleUsers?: firefish.entities.User[];
initialNote?: firefish.entities.Note;
2023-02-19 00:53:19 +01:00
instant?: boolean;
fixed?: boolean;
autofocus?: boolean;
2023-09-24 06:27:16 +02:00
editId?: firefish.entities.Note["id"];
2023-02-19 00:53:19 +01:00
}>();
2023-02-19 00:27:12 +01:00
2023-02-19 00:53:19 +01:00
const emit = defineEmits<{
2023-04-08 02:01:42 +02:00
(ev: "closed"): void;
2023-02-19 00:53:19 +01:00
}>();
2023-02-19 00:27:12 +01:00
2023-09-02 01:27:33 +02:00
const modal = shallowRef<InstanceType<typeof MkModal>>();
const form = shallowRef<InstanceType<typeof MkPostForm>>();
2023-02-19 00:27:12 +01:00
2023-02-19 00:53:19 +01:00
function onPosted() {
modal.value.close({
2023-02-19 00:53:19 +01:00
useSendAnimation: true,
});
}
2023-02-19 00:27:12 +01:00
2023-02-19 00:53:19 +01:00
function onModalClosed() {
2023-04-08 02:01:42 +02:00
emit("closed");
2023-02-19 00:53:19 +01:00
}
</script>