Sharkey/src/client/app/desktop/views/components/renote-form-window.vue

65 lines
1.1 KiB
Vue
Raw Normal View History

2018-04-07 20:30:37 +03:00
<template>
2018-09-18 08:50:13 +03:00
<mk-window ref="window" is-modal @closed="onWindowClosed" :animation="animation">
2018-04-14 19:04:40 +03:00
<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"/>
2018-04-07 20:30:37 +03:00
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
2018-09-18 08:50:13 +03:00
props: {
note: {
type: Object,
required: true
},
animation: {
type: Boolean,
required: false,
default: true
}
},
computed: {
keymap(): any {
return {
'esc': this.close,
2018-09-18 08:39:18 +03:00
'enter': this.post,
'q': this.quote,
};
}
2018-04-07 20:30:37 +03:00
},
2018-04-07 20:30:37 +03:00
methods: {
post() {
(this.$refs.form as any).ok();
},
2018-09-18 08:39:18 +03:00
quote() {
(this.$refs.form as any).onQuote();
},
close() {
(this.$refs.window as any).close();
2018-04-07 20:30:37 +03:00
},
onPosted() {
(this.$refs.window as any).close();
},
onCanceled() {
(this.$refs.window as any).close();
},
onWindowClosed() {
this.$emit('closed');
this.destroyDom();
2018-04-07 20:30:37 +03:00
}
}
});
</script>
<style lang="stylus" module>
.header
> [data-fa]
margin-right 4px
</style>