From 4d32146dca7b94038919b681a2520016c89b2ad2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 8 Dec 2024 23:11:06 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/13404 --- app/src/protyle/wysiwyg/keydown.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 6feef09f5..b1dd6e9ea 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1311,12 +1311,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // toolbar action if (matchHotKey(window.siyuan.config.keymap.editor.insert.lastUsed.custom, event)) { protyle.toolbar.range = range; - let selectElements: Element[] = []; - if (selectText === "" && protyle.toolbar.getCurrentType(range).length === 0) { - selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); - if (selectElements.length === 0) { - selectElements = [nodeElement]; - } + const selectElements: Element[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); + if (selectText === "" && selectElements.length === 0) { + selectElements.push(nodeElement); } fontEvent(protyle, selectElements); event.stopPropagation();