diff --git a/src/components/PostEditor.vue b/src/components/PostEditor.vue index d8ca512..bdb2cb1 100644 --- a/src/components/PostEditor.vue +++ b/src/components/PostEditor.vue @@ -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) } diff --git a/src/utils/autoresize.ts b/src/utils/autoresize.ts index 6707f14..bc51127 100644 --- a/src/utils/autoresize.ts +++ b/src/utils/autoresize.ts @@ -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")) +}