Resize post form after submitting
This commit is contained in:
parent
2630d11b14
commit
caf7b28b22
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue