2018-02-11 09:17:51 -06:00
|
|
|
<template>
|
2018-02-11 09:58:02 -06:00
|
|
|
<mk-window ref="window" is-modal @closed="$destroy">
|
2018-02-11 09:17:51 -06:00
|
|
|
<span slot="header">
|
2018-02-14 04:21:15 -06:00
|
|
|
<span v-if="!reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
|
|
|
|
<span v-if="reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
|
2018-02-11 09:23:05 -06:00
|
|
|
<span :class="$style.count" v-if="media.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', media.length) }}</span>
|
|
|
|
<span :class="$style.count" v-if="uploadings.length != 0">{{ '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', uploadings.length) }}<mk-ellipsis/></span>
|
2018-02-11 09:17:51 -06:00
|
|
|
</span>
|
|
|
|
<div slot="content">
|
2018-02-14 04:21:15 -06:00
|
|
|
<mk-post-preview v-if="reply" :class="$style.postPreview" :post="reply"/>
|
2018-02-11 09:23:05 -06:00
|
|
|
<mk-post-form ref="form"
|
|
|
|
:reply="reply"
|
2018-02-14 04:30:35 -06:00
|
|
|
@posted="onPosted"
|
2018-02-11 09:23:05 -06:00
|
|
|
@change-uploadings="onChangeUploadings"
|
|
|
|
@change-attached-media="onChangeMedia"/>
|
2018-02-11 09:17:51 -06:00
|
|
|
</div>
|
|
|
|
</mk-window>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['reply'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
uploadings: [],
|
|
|
|
media: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-02-14 04:03:48 -06:00
|
|
|
Vue.nextTick(() => {
|
|
|
|
(this.$refs.form as any).focus();
|
|
|
|
});
|
2018-02-11 09:17:51 -06:00
|
|
|
},
|
|
|
|
methods: {
|
2018-02-16 00:38:12 -06:00
|
|
|
onChangeUploadings(files) {
|
|
|
|
this.uploadings = files;
|
2018-02-11 09:17:51 -06:00
|
|
|
},
|
|
|
|
onChangeMedia(media) {
|
|
|
|
this.media = media;
|
2018-02-14 04:30:35 -06:00
|
|
|
},
|
|
|
|
onPosted() {
|
|
|
|
(this.$refs.window as any).close();
|
2018-02-11 09:17:51 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
2018-02-11 09:23:05 -06:00
|
|
|
.count
|
2018-02-11 09:17:51 -06:00
|
|
|
margin-left 8px
|
|
|
|
opacity 0.8
|
|
|
|
|
|
|
|
&:before
|
|
|
|
content '('
|
|
|
|
|
|
|
|
&:after
|
|
|
|
content ')'
|
|
|
|
|
|
|
|
.postPreview
|
|
|
|
margin 16px 22px
|
|
|
|
|
|
|
|
</style>
|