Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14767

Vanessa6599b2d89b9a
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index a23599bc4e..6a1428954b 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)) {