Vanessa 2025-05-08 11:47:47 +08:00
parent a0b5d5bb1f
commit 6599b2d89b

View file

@ -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)) {