monkeeShark/src/client/app/desktop/views/components/post-form-window.vue

109 lines
2.1 KiB
Vue
Raw Normal View History

2018-02-11 15:17:51 +00:00
<template>
2018-09-18 05:50:13 +00:00
<mk-window class="mk-post-form-window" ref="window" is-modal @closed="onWindowClosed" :animation="animation">
2019-02-18 02:13:56 +00:00
<template #header>
2019-02-18 00:48:00 +00:00
<span class="mk-post-form-window--header">
<span class="icon" v-if="geo"><fa icon="map-marker-alt"/></span>
<span v-if="!reply">{{ $t('note') }}</span>
<span v-if="reply">{{ $t('reply') }}</span>
<span class="count" v-if="files.length != 0">{{ this.$t('attaches').replace('{}', files.length) }}</span>
<span class="count" v-if="uploadings.length != 0">{{ this.$t('uploading-media').replace('{}', uploadings.length) }}<mk-ellipsis/></span>
</span>
</template>
2018-02-16 08:01:36 +00:00
2018-05-31 07:38:05 +00:00
<div class="mk-post-form-window--body">
<mk-note-preview v-if="reply" class="notePreview" :note="reply"/>
<mk-post-form ref="form"
:reply="reply"
2018-12-27 14:14:30 +00:00
:mention="mention"
2018-05-31 07:38:05 +00:00
@posted="onPosted"
@change-uploadings="onChangeUploadings"
2018-09-05 10:32:46 +00:00
@change-attached-files="onChangeFiles"
2018-05-31 07:38:05 +00:00
@geo-attached="onGeoAttached"
@geo-dettached="onGeoDettached"/>
</div>
2018-02-11 15:17:51 +00:00
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
2018-02-11 15:17:51 +00:00
export default Vue.extend({
i18n: i18n('desktop/views/components/post-form-window.vue'),
2018-09-18 05:50:13 +00:00
props: {
reply: {
type: Object,
2018-09-18 17:26:06 +00:00
required: false
2018-09-18 05:50:13 +00:00
},
2018-12-27 14:14:30 +00:00
mention: {
type: Object,
required: false
},
2018-09-18 05:50:13 +00:00
animation: {
type: Boolean,
required: false,
default: true
}
},
2018-02-11 15:17:51 +00:00
data() {
return {
uploadings: [],
2018-09-05 10:32:46 +00:00
files: [],
2018-03-04 23:44:37 +00:00
geo: null
2018-02-11 15:17:51 +00:00
};
},
2018-09-18 05:50:13 +00:00
2018-02-11 15:17:51 +00:00
mounted() {
2018-02-18 09:40:24 +00:00
this.$nextTick(() => {
2018-02-14 10:03:48 +00:00
(this.$refs.form as any).focus();
});
2018-02-11 15:17:51 +00:00
},
2018-09-18 05:50:13 +00:00
2018-02-11 15:17:51 +00:00
methods: {
2018-02-16 06:38:12 +00:00
onChangeUploadings(files) {
this.uploadings = files;
2018-02-11 15:17:51 +00:00
},
2018-09-05 10:32:46 +00:00
onChangeFiles(files) {
this.files = files;
2018-02-14 10:30:35 +00:00
},
2018-03-04 23:44:37 +00:00
onGeoAttached(geo) {
this.geo = geo;
},
2018-03-05 05:09:12 +00:00
onGeoDettached() {
this.geo = null;
},
2018-02-14 10:30:35 +00:00
onPosted() {
(this.$refs.window as any).close();
},
onWindowClosed() {
this.$emit('closed');
this.destroyDom();
2018-02-11 15:17:51 +00:00
}
}
});
</script>
2018-05-31 07:38:05 +00:00
<style lang="stylus" scoped>
2018-09-28 10:59:19 +00:00
.mk-post-form-window
2018-05-31 07:38:05 +00:00
.mk-post-form-window--header
.icon
margin-right 8px
2018-03-04 23:44:37 +00:00
2018-05-31 07:38:05 +00:00
.count
margin-left 8px
opacity 0.8
2018-02-11 15:17:51 +00:00
2018-05-31 07:38:05 +00:00
&:before
content '('
2018-02-11 15:17:51 +00:00
2018-05-31 07:38:05 +00:00
&:after
content ')'
2018-02-11 15:17:51 +00:00
2018-05-31 07:38:05 +00:00
.mk-post-form-window--body
.notePreview
margin 16px 22px
2018-02-11 15:17:51 +00:00
</style>