An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Allow disabling mind map hand mode from the More menu https://github.com/siyuan-note/siyuan/issues/20783
Danield4406fcb29fd
diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex c97f875100..663396d686 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -1210,6 +1210,32 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,panMenu.toggle();};+ // 应用菜单位于导图外,按下菜单项会先停用交互,随后才执行菜单的点击动作。+ for (const pointerType of ["mouse", "touch"]) {+ const menuHost = document.createElement("div");+ hostParent.append(menuHost);+ const menuView = new api.ListMindmapView({...options, host: menuHost,+ onSettingsMenu: (_anchor: HTMLElement, _expand: unknown, pan: typeof panMenu) => panMenu = pan});+ const menuItem = document.createElement("button");+ document.body.append(menuItem);+ for (const active of [false, true, false, true]) {+ menuHost.querySelector<HTMLButtonElement>('[aria-label="more"]').click();+ check.equal(panMenu.active, active);+ const toggle = panMenu.toggle;+ menuItem.dispatchEvent(new PointerEvent("pointerdown", {bubbles: true, pointerType}));+ check.equal(menuHost.classList.contains("mindmap-view--pan"), false);+ toggle();+ check.equal(menuHost.classList.contains("mindmap-view--pan"), !active,+ `${pointerType} menu clicks apply the inverse of the displayed checked state`);+ const hand = menuHost.querySelector<HTMLButtonElement>('[aria-label="cursorHand"]');+ check.equal(hand.getAttribute("aria-pressed"), String(!active));+ check.equal(hand.hidden, active);+ }+ menuItem.remove();+ menuView.destroy();+ menuHost.remove();+ }+// 方向键选中视口外的节点时自动平移,待完成的布局和只读视图使用同一定位逻辑。const navigationHost = document.createElement("div");navigationHost.style.width = "400px";diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 6cd893d5d1..e7ca4b9382 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -666,10 +666,11 @@ export class ListMindmapView {if (this.options.onSettingsMenu) {add("settings", "more", "iconMore", () => {const selectedId = this.selectedId;+ const panning = this.panning;this.options.onSettingsMenu(this.buttons.get("settings"),this.buttons.get("expandLevel").hidden ? level => this.finishThen(() => {void this.expandToLevel(level, selectedId).catch(error => console.error(error));- }) : undefined, {active: this.panning, toggle: () => this.togglePanning()});+ }) : undefined, {active: panning, toggle: () => this.togglePanning(!panning)});});this.buttons.get("settings").setAttribute("aria-haspopup", "menu");}@@ -686,7 +687,7 @@ export class ListMindmapView {}}- private togglePanning() {+ private togglePanning(value = !this.panning) {this.finishThen(() => {if (this.locked || this.destroyed) {return;@@ -694,7 +695,7 @@ export class ListMindmapView {this.setInteractionActive(true);this.finishRelationEdit?.(true);this.cancelPointer();- this.setPanning(!this.panning);+ this.setPanning(value);this.relationFrom = undefined;this.relationPreview = undefined;this.inspector.hidden = true;