Vanessa 2024-12-08 23:11:06 +08:00
parent 70d0246668
commit 4d32146dca

View file

@ -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();