diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 785780a5c..78807c8a0 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -375,7 +375,7 @@ export class Gutter { }; } - private renderMultipleMenu(protyle: IProtyle, selectsElement: Element[]) { + public renderMultipleMenu(protyle: IProtyle, selectsElement: Element[]) { let isList = false; let isContinue = false; let hasEmbedBlock = false; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index edb142023..4250f79c2 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -514,6 +514,17 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (matchHotKey("⌘/", event)) { event.stopPropagation(); event.preventDefault(); + const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); + if (selectElements.length > 0) { + if (selectElements.length === 1) { + protyle.gutter.renderMenu(protyle, selectElements[0]); + } else { + protyle.gutter.renderMultipleMenu(protyle, Array.from(selectElements)); + } + const rect = nodeElement.getBoundingClientRect(); + window.siyuan.menus.menu.popup({x: rect.left, y: rect.top}, true); + return; + } const inlineElement = hasClosestByAttribute(range.startContainer, "data-type", null); if (inlineElement) { const types = inlineElement.getAttribute("data-type").split(" "); @@ -544,14 +555,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { return; } } - const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); - let actionElement = nodeElement; - if (selectElements.length > 0) { - actionElement = selectElements[0] as HTMLElement; - } - protyle.gutter.renderMenu(protyle, actionElement); - const rect = nodeElement.getBoundingClientRect(); - window.siyuan.menus.menu.popup({x: rect.left, y: rect.top}, true); return; }