refs #1316 Consider spoiler input field for resize new toot window
This commit is contained in:
parent
62f24a8259
commit
39d9f68792
|
@ -3,12 +3,12 @@
|
||||||
:title="$t('modals.new_toot.title')"
|
:title="$t('modals.new_toot.title')"
|
||||||
:visible.sync="newTootModal"
|
:visible.sync="newTootModal"
|
||||||
:before-close="closeConfirm"
|
:before-close="closeConfirm"
|
||||||
width="400px"
|
width="600px"
|
||||||
class="new-toot-modal"
|
class="new-toot-modal"
|
||||||
ref="dialog"
|
ref="dialog"
|
||||||
>
|
>
|
||||||
<el-form v-on:submit.prevent="toot" role="form">
|
<el-form v-on:submit.prevent="toot" role="form">
|
||||||
<div class="spoiler" v-show="showContentWarning">
|
<div class="spoiler" v-if="showContentWarning" ref="spoiler">
|
||||||
<div class="el-input">
|
<div class="el-input">
|
||||||
<input type="text" class="el-input__inner" :placeholder="$t('modals.new_toot.cw')" v-model="spoiler" v-shortkey.avoid />
|
<input type="text" class="el-input__inner" :placeholder="$t('modals.new_toot.cw')" v-model="spoiler" v-shortkey.avoid />
|
||||||
</div>
|
</div>
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
type="text"
|
type="text"
|
||||||
@click="showContentWarning = !showContentWarning"
|
@click="toggleContentWarning()"
|
||||||
:title="$t('modals.new_toot.footer.add_cw')"
|
:title="$t('modals.new_toot.footer.add_cw')"
|
||||||
:class="showContentWarning ? '' : 'clickable'"
|
:class="showContentWarning ? '' : 'clickable'"
|
||||||
:aria-pressed="showContentWarning"
|
:aria-pressed="showContentWarning"
|
||||||
|
@ -388,7 +388,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await toggle()
|
await toggle()
|
||||||
console.log(this.$refs.poll)
|
|
||||||
if (this.openPoll) {
|
if (this.openPoll) {
|
||||||
this.statusHeight = this.statusHeight - this.$refs.poll.$el.offsetHeight
|
this.statusHeight = this.statusHeight - this.$refs.poll.$el.offsetHeight
|
||||||
} else {
|
} else {
|
||||||
|
@ -404,11 +403,21 @@ export default {
|
||||||
changeExpire(obj) {
|
changeExpire(obj) {
|
||||||
this.pollExpire = obj
|
this.pollExpire = obj
|
||||||
},
|
},
|
||||||
|
async toggleContentWarning() {
|
||||||
|
const previousHeight = this.$refs.spoiler ? this.$refs.spoiler.offsetHeight : 0
|
||||||
|
await (this.showContentWarning = !this.showContentWarning)
|
||||||
|
if (this.showContentWarning) {
|
||||||
|
this.statusHeight = this.statusHeight - this.$refs.spoiler.offsetHeight
|
||||||
|
} else {
|
||||||
|
this.statusHeight = this.statusHeight + previousHeight
|
||||||
|
}
|
||||||
|
},
|
||||||
handleResize(event) {
|
handleResize(event) {
|
||||||
const style = this.$refs.dialog.$el.firstChild.style
|
const style = this.$refs.dialog.$el.firstChild.style
|
||||||
if (style.overflow === '' || style.overflow === 'hidden') {
|
if (style.overflow === '' || style.overflow === 'hidden') {
|
||||||
const pollHeight = this.$refs.poll ? this.$refs.poll.$el.offsetHeight : 0
|
const pollHeight = this.$refs.poll ? this.$refs.poll.$el.offsetHeight : 0
|
||||||
this.statusHeight = event.height - 63 - 54 - this.$refs.preview.offsetHeight - pollHeight
|
const spoilerHeight = this.$refs.spoiler ? this.$refs.spoiler.offsetHeight : 0
|
||||||
|
this.statusHeight = event.height - 63 - 54 - this.$refs.preview.offsetHeight - pollHeight - spoilerHeight
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pickerOpened(open) {
|
pickerOpened(open) {
|
||||||
|
|
Loading…
Reference in New Issue