From 1acc794e63ab8dbce481d8f6e23afac585ec2dbd Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 20 Oct 2025 06:09:38 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3:=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=80=E4=B8=AA=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...%95%E4%B8%80%E4%B8%AA%E4%BB%A3%E7%A0%81.md | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%AA%E4%BB%A3%E7%A0%81.md b/%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%AA%E4%BB%A3%E7%A0%81.md index 2f9b619..b90cd93 100644 --- a/%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%AA%E4%BB%A3%E7%A0%81.md +++ b/%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%AA%E4%BB%A3%E7%A0%81.md @@ -1,33 +1,10 @@ # 这是一段typescript代码333 ```ts -import +importddddd ``` -```ts +```ts hljs language-typescript - const handleKeyDown = (e: KeyboardEvent) => { - // 在代码块内编辑时启用保护 - const selection = window.getSelection(); - if (selection && selection.rangeCount > 0) { - const range = selection.getRangeAt(0); - const preElement = range.commonAncestorContainer.closest('pre'); - if (preElement) { - isInternalChangeRef.current = true; - } - } - }; - - const handleKeyUp = () => { - setTimeout(() => { - if (!vditorElement.matches(':focus')) { - isInternalChangeRef.current = false; - } - }, 100); - }; - - vditorElement.addEventListener('focusin', handleFocusIn); - vditorElement.addEventListener('focusout', handleFocusOut); - vditorElement.addEventListener('keydown', handleKeyDown); - vditorElement.addEventListener('keyup', handleKeyUp); + ```