From 8ce1072b0cabd9069e697900822e554dfbf00a29 Mon Sep 17 00:00:00 2001 From: MikiVL Date: Tue, 5 May 2026 03:42:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=9C=E6=9D=A0=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=20Esc=20=E5=8F=96=E6=B6=88=E5=90=8E=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E8=BE=93=E5=85=A5=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/editor/Editor.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/editor/Editor.tsx b/src/components/editor/Editor.tsx index ea7bab1..9afe849 100644 --- a/src/components/editor/Editor.tsx +++ b/src/components/editor/Editor.tsx @@ -184,7 +184,14 @@ export function Editor() { return true } if (event.key === 'Escape') { + if (slashStartPos.current !== null && editor) { + const { state, dispatch } = editor.view + const { from } = state.selection + const tr = state.tr.delete(slashStartPos.current, from) + dispatch(tr) + } setSlashOpen(false) + slashStartPos.current = null return true } }