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