diff --git a/package-lock.json b/package-lock.json
index cd99ac9b..330f2f97 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8710,7 +8710,7 @@
"dependencies": {
"resolve": {
"version": "1.1.7",
- "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
"dev": true
}
@@ -29263,6 +29263,11 @@
"popper.js": "^1.15.0"
}
},
+ "vue-resize": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.5.0.tgz",
+ "integrity": "sha512-k5gOOwTIGSoWZb133Gx3IfSeiiAmve5GyWI7+pU8CvbNntpSAlrCYwZ26GB63NpxcLPK94+m0BDl5TxuZUI+Hw=="
+ },
"vue-router": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.3.3.tgz",
diff --git a/package.json b/package.json
index c86d9c62..43af7e51 100644
--- a/package.json
+++ b/package.json
@@ -201,6 +201,7 @@
"vue-click-outside": "^1.1.0",
"vue-electron": "^1.0.6",
"vue-popperjs": "^2.3.0",
+ "vue-resize": "^0.5.0",
"vue-router": "^3.3.3",
"vue-shortkey": "^3.1.7",
"vuex": "^3.4.0",
diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot.vue b/src/renderer/components/TimelineSpace/Modals/NewToot.vue
index cc51d766..76572bde 100644
--- a/src/renderer/components/TimelineSpace/Modals/NewToot.vue
+++ b/src/renderer/components/TimelineSpace/Modals/NewToot.vue
@@ -12,7 +12,14 @@
-
+
-
+
@@ -125,6 +133,7 @@
+
@@ -152,7 +161,8 @@ export default {
pollExpire: {
label: this.$t('modals.new_toot.poll.expires.1_day'),
value: 3600 * 24
- }
+ },
+ statusHeight: 240
}
},
computed: {
@@ -311,15 +321,23 @@ export default {
},
updateImage(file) {
this.$store.dispatch('TimelineSpace/Modals/NewToot/incrementMediaCount')
- this.$store.dispatch('TimelineSpace/Modals/NewToot/uploadImage', file).catch(() => {
- this.$message({
- message: this.$t('message.attach_error'),
- type: 'error'
+ this.$store
+ .dispatch('TimelineSpace/Modals/NewToot/uploadImage', file)
+ .then(() => {
+ this.statusHeight = this.statusHeight - this.$refs.preview.offsetHeight
+ })
+ .catch(() => {
+ this.$message({
+ message: this.$t('message.attach_error'),
+ type: 'error'
+ })
})
- })
},
removeAttachment(media) {
- this.$store.dispatch('TimelineSpace/Modals/NewToot/removeMedia', media)
+ const previousHeight = this.$refs.preview.offsetHeight
+ this.$store.dispatch('TimelineSpace/Modals/NewToot/removeMedia', media).then(() => {
+ this.statusHeight = this.statusHeight + previousHeight
+ })
},
changeVisibility(level) {
this.$store.commit('TimelineSpace/Modals/NewToot/changeVisibilityValue', level)
@@ -357,12 +375,22 @@ export default {
updateDescription(id, value) {
this.$store.commit('TimelineSpace/Modals/NewToot/updateMediaDescription', { id: id, description: value })
},
- togglePollForm() {
- this.openPoll = !this.openPoll
+ async togglePollForm() {
+ const previousHeight = this.$refs.poll ? this.$refs.poll.$el.offsetHeight : 0
+ const toggle = () => {
+ this.openPoll = !this.openPoll
+ if (this.openPoll) {
+ this.polls = ['', '']
+ } else {
+ this.polls = []
+ }
+ }
+ await toggle()
+ console.log(this.$refs.poll)
if (this.openPoll) {
- this.polls = ['', '']
+ this.statusHeight = this.statusHeight - this.$refs.poll.$el.offsetHeight
} else {
- this.polls = []
+ this.statusHeight = this.statusHeight + previousHeight
}
},
addPoll() {
@@ -373,6 +401,10 @@ export default {
},
changeExpire(obj) {
this.pollExpire = obj
+ },
+ handleResize(event) {
+ const pollHeight = this.$refs.poll ? this.$refs.poll.$el.offsetHeight : 0
+ this.statusHeight = event.height - 63 - 54 - this.$refs.preview.offsetHeight - pollHeight
}
}
}
@@ -380,6 +412,12 @@ export default {