Skip to content

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

:art: ⌘/

Vanessa05de4271cc09
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 785780a5c7..78807c8a02 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 edb142023d..4250f79c2e 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;
}