From 6599b2d89b9af83c8f062d924fecbce791f1671c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 8 May 2025 11:47:47 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14767 --- app/src/protyle/wysiwyg/keydown.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index a23599bc4..6a1428954 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1791,6 +1791,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const snippetClassName = (range.commonAncestorContainer as HTMLElement).className; if (snippetClassName.startsWith("language-")) { language = snippetClassName.replace("language-", ""); + // https://github.com/siyuan-note/siyuan/issues/14767 + if (!wbrElement.parentElement.isSameNode(range.commonAncestorContainer)) { + wbrElement.parentElement.after(wbrElement); + wbrElement.previousElementSibling.remove(); + } } } if (!window.hljs.getLanguage(language)) {