2018-02-11 17:58:02 +02:00
|
|
|
<template>
|
|
|
|
<mk-window ref="window" is-modal @closed="$destroy">
|
2018-04-07 20:30:37 +03:00
|
|
|
<span slot="header" :class="$style.header">%fa:retweet%%i18n:desktop.tags.mk-renote-form-window.title%</span>
|
|
|
|
<mk-renote-form ref="form" :note="note" @posted="onPosted" @canceled="onCanceled"/>
|
2018-02-11 17:58:02 +02:00
|
|
|
</mk-window>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-04-07 20:30:37 +03:00
|
|
|
props: ['note'],
|
2018-02-11 17:58:02 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
2018-02-16 20:18:48 +02:00
|
|
|
},
|
|
|
|
onPosted() {
|
|
|
|
(this.$refs.window as any).close();
|
|
|
|
},
|
|
|
|
onCanceled() {
|
|
|
|
(this.$refs.window as any).close();
|
2018-02-11 17:58:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
|
|
|
.header
|
|
|
|
> [data-fa]
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
</style>
|