Resize post form after submitting

This commit is contained in:
silverpill 2022-05-15 22:21:25 +00:00
parent 2630d11b14
commit caf7b28b22
2 changed files with 8 additions and 1 deletions

View file

@ -103,7 +103,7 @@ import Avatar from "@/components/Avatar.vue"
import VisibilityIcon from "@/components/VisibilityIcon.vue"
import { useInstanceInfo } from "@/store/instance"
import { useCurrentUser } from "@/store/user"
import { setupAutoResize } from "@/utils/autoresize"
import { setupAutoResize, triggerResize } from "@/utils/autoresize"
import { renderMarkdownLite } from "@/utils/markdown"
import { fileToDataUrl, dataUrlToBase64 } from "@/utils/upload"
@ -218,6 +218,9 @@ export default class PostEditor extends Vue {
this.errorMessage = null
this.attachment = null
this.content = ""
this.$nextTick(() => {
triggerResize(this.$refs.postFormContent)
})
this.$emit("post-created", post)
}

View file

@ -6,3 +6,7 @@ export function setupAutoResize(textarea: HTMLTextAreaElement) {
textarea.style.height = `${textarea.scrollHeight}px`
}, false)
}
export function triggerResize(textarea: HTMLTextAreaElement) {
textarea.dispatchEvent(new Event("input"))
}