1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-22 18:48:19 +09:00
MisskeyIO/src/client/app/desktop/views/components/renote-form-window.vue

43 lines
926 B
Vue
Raw Normal View History

2018-04-08 02:30:37 +09:00
<template>
<mk-window ref="window" is-modal @closed="$destroy">
2018-04-15 01:04:40 +09:00
<span slot="header" :class="$style.header">%fa:retweet%%i18n:@title%</span>
2018-04-08 02:30:37 +09:00
<mk-renote-form ref="form" :note="note" @posted="onPosted" @canceled="onCanceled"/>
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: ['note'],
mounted() {
document.addEventListener('keydown', this.onDocumentKeydown);
},
beforeDestroy() {
document.removeEventListener('keydown', this.onDocumentKeydown);
},
methods: {
onDocumentKeydown(e) {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
if (e.which == 27) { // Esc
(this.$refs.window as any).close();
}
}
},
onPosted() {
(this.$refs.window as any).close();
},
onCanceled() {
(this.$refs.window as any).close();
}
}
});
</script>
<style lang="stylus" module>
.header
> [data-fa]
margin-right 4px
</style>