Skip to content

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

:bug: Anchor document tree context menus to list items https://github.com/siyuan-note/siyuan/issues/19269

Danielbc64d1677b5e
diff --git a/app/src/menus/index.ts b/app/src/menus/index.ts
index 1c4d72e294..dafd37fa9d 100644
--- a/app/src/menus/index.ts
+++ b/app/src/menus/index.ts
@@ -89,25 +89,23 @@ export class Menus {
}
this.unselect();
// navigation 根上:新建文档/文件夹/取消挂在/打开文件位置
- const menuButton = (event.target as Element).closest("[data-type='more-root'], .b3-list-item__action[data-type='new']");
- const rect = menuButton?.getBoundingClientRect();
+ const rect = target.getBoundingClientRect();
initNavigationMenu(app, target).popup({
- x: rect ? rect.left : event.clientX,
- y: rect ? rect.bottom : event.clientY,
- h: rect ? rect.height : 0,
+ x: rect.left,
+ y: rect.bottom,
+ h: rect.height,
});
setPanelFocus(hasClosestByClassName(target, "sy__file") as HTMLElement);
event.stopPropagation();
break;
} else if (dataType === "navigation-file") {
this.unselect();
- const menuButton = (event.target as Element).closest("[data-type='more-file'], .b3-list-item__action[data-type='new']");
- const rect = menuButton?.getBoundingClientRect();
+ const rect = target.getBoundingClientRect();
// navigation 文件上:删除/重命名/打开文件位置/导出
initFileMenu(app, this.getDir(target), target.getAttribute("data-path"), target).popup({
- x: rect ? rect.left : event.clientX,
- y: rect ? rect.bottom : event.clientY,
- h: rect ? rect.height : 0,
+ x: rect.left,
+ y: rect.bottom,
+ h: rect.height,
});
setPanelFocus(hasClosestByClassName(target, "sy__file") as HTMLElement);
event.stopPropagation();