Skip to content

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

:bug: Anchor document tree add button context menus https://github.com/siyuan-note/siyuan/issues/19269

Daniel2191d152a60d
diff --git a/app/src/block/util.ts b/app/src/block/util.ts
index 26d1c4e1ff..ef1137adee 100644
--- a/app/src/block/util.ts
+++ b/app/src/block/util.ts
@@ -320,7 +320,7 @@ export const jumpToParent = (protyle: IProtyle, nodeElement: Element, type: "par
action
});
/// #else
- openMobileFileById(protyle.app, targetId, action);
+ openMobileFileById(protyle.app, targetId, action, "start");
/// #endif
});
});
diff --git a/app/src/config/assets.ts b/app/src/config/assets.ts
index 94a0773adb..2ce41e2a15 100644
--- a/app/src/config/assets.ts
+++ b/app/src/config/assets.ts
@@ -233,7 +233,7 @@ const assets = {
const blockIDs = JSON.parse(target.getAttribute("data-id")) as string[];
if (blockIDs.length > 0) {
/// #if MOBILE
- openMobileFileById(app, blockIDs[0], [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(app, blockIDs[0], [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
/// #else
window.siyuan.blockPanels.push(new BlockPanel({
app,
diff --git a/app/src/layout/dock/BacklinkContent.ts b/app/src/layout/dock/BacklinkContent.ts
index 1d597d9323..aa893c1c90 100644
--- a/app/src/layout/dock/BacklinkContent.ts
+++ b/app/src/layout/dock/BacklinkContent.ts
@@ -737,7 +737,7 @@ export class BacklinkContent extends Model {
private openDocument(options: {app: App, id: string, action: TProtyleAction[], position?: "right" | "bottom"}) {
/// #if MOBILE
- openMobileFileById(options.app, options.id, options.action);
+ openMobileFileById(options.app, options.id, options.action, "start");
/// #else
openFileById(options);
/// #endif
diff --git a/app/src/menus/index.ts b/app/src/menus/index.ts
index 3ad7478b31..1c4d72e294 100644
--- a/app/src/menus/index.ts
+++ b/app/src/menus/index.ts
@@ -89,7 +89,7 @@ export class Menus {
}
this.unselect();
// navigation 根上:新建文档/文件夹/取消挂在/打开文件位置
- const menuButton = (event.target as Element).closest("[data-type='more-root']");
+ const menuButton = (event.target as Element).closest("[data-type='more-root'], .b3-list-item__action[data-type='new']");
const rect = menuButton?.getBoundingClientRect();
initNavigationMenu(app, target).popup({
x: rect ? rect.left : event.clientX,
@@ -101,7 +101,7 @@ export class Menus {
break;
} else if (dataType === "navigation-file") {
this.unselect();
- const menuButton = (event.target as Element).closest("[data-type='more-file']");
+ const menuButton = (event.target as Element).closest("[data-type='more-file'], .b3-list-item__action[data-type='new']");
const rect = menuButton?.getBoundingClientRect();
// navigation 文件上:删除/重命名/打开文件位置/导出
initFileMenu(app, this.getDir(target), target.getAttribute("data-path"), target).popup({
diff --git a/app/src/mobile/dock/MobileBookmarks.ts b/app/src/mobile/dock/MobileBookmarks.ts
index 2030a6acd1..2ea96560e8 100644
--- a/app/src/mobile/dock/MobileBookmarks.ts
+++ b/app/src/mobile/dock/MobileBookmarks.ts
@@ -54,7 +54,7 @@ export class MobileBookmarks {
}
}
checkFold(id, (zoomIn) => {
- openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
});
},
blockExtHTML: '<span class="b3-list-item__action"><svg><use xlink:href="#iconMore"></use></svg></span>',
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index f0ad20cb02..3454d0d2a2 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -324,7 +324,7 @@ window.openFileByURL = (openURL) => {
}
openMobileFileById(siyuanApp, blockInfo.id, blockInfo.avItemID ? [Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] :
(blockInfo.focus ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]),
- undefined, undefined, blockInfo.avItemID ? (protyle) => activateQueuedAVLocate(protyle, blockInfo.id) : undefined);
+ blockInfo.avItemID ? undefined : "start", undefined, blockInfo.avItemID ? (protyle) => activateQueuedAVLocate(protyle, blockInfo.id) : undefined);
return true;
}
return false;
diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts
index f7150289c9..958bf94ac2 100644
--- a/app/src/mobile/menu/search.ts
+++ b/app/src/mobile/menu/search.ts
@@ -728,7 +728,7 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab
preventScroll(window.siyuan.mobile.editor.protyle);
}
checkFold(id, (zoomIn) => {
- openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(app, id, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
});
closePanel();
} else {
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 6d94ee932d..3f2e9ef5f2 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -373,7 +373,7 @@ export const initFramework = async (app: App, isStart: boolean) => {
}
openMobileFileById(app, info.id, info.avItemID ? [Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL] :
(info.focus ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]),
- undefined, undefined, info.avItemID ? (protyle) => activateQueuedAVLocate(protyle, info.id) : undefined);
+ info.avItemID ? undefined : "start", undefined, info.avItemID ? (protyle) => activateQueuedAVLocate(protyle, info.id) : undefined);
return;
}
if (openMobileOnboarding(app)) {
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index f098b75743..2d438b11a0 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -4725,7 +4725,7 @@ export class WYSIWYG {
checkFold(response.data.refDefs[0].refID, (zoomIn) => {
mobileBlur = true;
activeBlur();
- openMobileFileById(protyle.app, response.data.refDefs[0].refID, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(protyle.app, response.data.refDefs[0].refID, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
});
});
return;
@@ -4834,7 +4834,7 @@ export class WYSIWYG {
/// #if MOBILE
mobileBlur = true;
activeBlur();
- openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
/// #else
if (event.shiftKey) {
openFileById({
@@ -4891,7 +4891,7 @@ export class WYSIWYG {
if (openFloatElement) {
const id = openFloatElement.getAttribute("data-id");
/// #if MOBILE
- openMobileFileById(protyle.app, id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ openMobileFileById(protyle.app, id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL], "start");
/// #else
window.siyuan.blockPanels.push(new BlockPanel({
app: protyle.app,