summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/components/renote-form-window.vue
blob: b9760fcbe922b8455492ae9379e20ac4ff35020a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
<mk-window ref="window" is-modal @closed="onWindowClosed" :animation="animation">
	<span slot="header" :class="$style.header">%fa:retweet%%i18n:@title%</span>
	<mk-renote-form ref="form" :note="note" @posted="onPosted" @canceled="onCanceled" v-hotkey.global="keymap"/>
</mk-window>
</template>

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
	props: {
		note: {
			type: Object,
			required: true
		},

		animation: {
			type: Boolean,
			required: false,
			default: true
		}
	},

	computed: {
		keymap(): any {
			return {
				'esc': this.close,
				'enter': this.post,
				'q': this.quote,
			};
		}
	},

	methods: {
		post() {
			(this.$refs.form as any).ok();
		},
		quote() {
			(this.$refs.form as any).onQuote();
		},
		close() {
			(this.$refs.window as any).close();
		},
		onPosted() {
			(this.$refs.window as any).close();
		},
		onCanceled() {
			(this.$refs.window as any).close();
		},
		onWindowClosed() {
			this.$emit('closed');
			this.destroyDom();
		}
	}
});
</script>

<style lang="stylus" module>
.header
	> [data-fa]
		margin-right 4px

</style>