2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2020-07-12 02:14:59 -07:00
|
|
|
<div class="ulveipgl">
|
2020-02-21 00:16:51 -08:00
|
|
|
<transition :name="$store.state.device.animation ? 'form-fade' : ''" appear @after-leave="$emit('closed');">
|
2020-07-12 02:14:59 -07:00
|
|
|
<div class="bg _modalBg" ref="bg" v-if="show" @click="close()"></div>
|
2020-01-29 11:37:25 -08:00
|
|
|
</transition>
|
|
|
|
<div class="main" ref="main" @click.self="close()" @keydown="onKeydown">
|
2020-02-06 02:11:14 -08:00
|
|
|
<transition :name="$store.state.device.animation ? 'form' : ''" appear
|
2020-01-29 11:37:25 -08:00
|
|
|
@after-leave="destroyDom"
|
|
|
|
>
|
|
|
|
<x-post-form ref="form"
|
|
|
|
v-if="show"
|
|
|
|
:reply="reply"
|
|
|
|
:renote="renote"
|
|
|
|
:mention="mention"
|
|
|
|
:specified="specified"
|
|
|
|
:initial-text="initialText"
|
|
|
|
:initial-note="initialNote"
|
|
|
|
:instant="instant"
|
|
|
|
@posted="onPosted"
|
2020-03-20 02:11:39 -07:00
|
|
|
@cancel="onCanceled"
|
|
|
|
style="border-radius: var(--radius);"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import XPostForm from './post-form.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
XPostForm
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
reply: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
renote: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
mention: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
specified: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
initialText: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
initialNote: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
instant: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show: true
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
focus() {
|
|
|
|
this.$refs.form.focus();
|
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
|
|
|
this.show = false;
|
|
|
|
(this.$refs.bg as any).style.pointerEvents = 'none';
|
|
|
|
(this.$refs.main as any).style.pointerEvents = 'none';
|
|
|
|
},
|
|
|
|
|
|
|
|
onPosted() {
|
|
|
|
this.$emit('posted');
|
|
|
|
this.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
onCanceled() {
|
|
|
|
this.$emit('cancel');
|
|
|
|
this.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
onKeydown(e) {
|
|
|
|
if (e.which === 27) { // Esc
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.form-enter-active, .form-leave-active {
|
|
|
|
transition: opacity 0.3s, transform 0.3s !important;
|
|
|
|
}
|
|
|
|
.form-enter, .form-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
transform: scale(0.9);
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-fade-enter-active, .form-fade-leave-active {
|
|
|
|
transition: opacity 0.3s !important;
|
|
|
|
}
|
|
|
|
.form-fade-enter, .form-fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-07-12 02:14:59 -07:00
|
|
|
.ulveipgl {
|
2020-01-29 11:37:25 -08:00
|
|
|
> .bg {
|
|
|
|
z-index: 10000;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
display: block;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 10000;
|
|
|
|
top: 32px;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
height: calc(100% - 64px);
|
|
|
|
width: 500px;
|
|
|
|
max-width: calc(100% - 16px);
|
|
|
|
overflow: auto;
|
|
|
|
margin: 0 auto 0 auto;
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
top: 16px;
|
|
|
|
height: calc(100% - 32px);
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 520px) {
|
|
|
|
top: 8px;
|
|
|
|
height: calc(100% - 16px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|