From f41d84a36c7370772058233b10e3889b9afa7ee6 Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Sun, 29 Jan 2023 15:11:16 +0800 Subject: [PATCH] fix: Incorrect cursor position when resizing (#257) --- packages/bytemd/src/editor.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/bytemd/src/editor.svelte b/packages/bytemd/src/editor.svelte index 3e2b464..dc3db02 100644 --- a/packages/bytemd/src/editor.svelte +++ b/packages/bytemd/src/editor.svelte @@ -369,6 +369,14 @@ editor && editor.focus() }) } + + if (v === 'write') { + tick().then(() => { + // https://github.com/bytedance/bytemd/issues/232 + // https://github.com/codemirror/codemirror5/issues/3270 + editor && editor.setSize(null, null) + }) + } }} on:click={(e) => { switch (e.detail) {