Skip to content

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

:art: open row

Vanessaaa22b4892af1
diff --git a/app/src/menus/util.ts b/app/src/menus/util.ts
index 28c85c0508..7338a6633a 100644
--- a/app/src/menus/util.ts
+++ b/app/src/menus/util.ts
@@ -39,14 +39,38 @@ export const openEditorTab = (app: App, id: string, notebookId?: string, pathStr
label: window.siyuan.languages.insertRight,
accelerator: `${updateHotkeyTip(window.siyuan.config.keymap.editor.general.insertRight.custom)}/${updateHotkeyTip("⌥Click")}`,
click: () => {
- openFileById({app, id, position: "right", action: [Constants.CB_GET_FOCUS]});
+ if (notebookId) {
+ openFileById({app, id, position: "right", action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]});
+ } else {
+ fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
+ openFileById({
+ app,
+ id,
+ position: "right",
+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
+ zoomIn: foldResponse.data
+ });
+ });
+ }
}
}, {
icon: "iconLayoutBottom",
label: window.siyuan.languages.insertBottom,
accelerator: "⇧Click",
click: () => {
- openFileById({app, id, position: "bottom", action: [Constants.CB_GET_FOCUS]});
+ if (notebookId) {
+ openFileById({app, id, position: "bottom", action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]});
+ } else {
+ fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
+ openFileById({
+ app,
+ id,
+ position: "bottom",
+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
+ zoomIn: foldResponse.data
+ });
+ });
+ }
}
}];
if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
@@ -54,11 +78,19 @@ export const openEditorTab = (app: App, id: string, notebookId?: string, pathStr
label: window.siyuan.languages.openInNewTab,
accelerator: "⌥⌘Click",
click: () => {
- openFileById({
- app,
- id, action: [Constants.CB_GET_FOCUS],
- removeCurrentTab: false
- });
+ if (notebookId) {
+ openFileById({app, id, action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL], removeCurrentTab: false});
+ } else {
+ fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
+ openFileById({
+ app,
+ id,
+ action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
+ zoomIn: foldResponse.data,
+ removeCurrentTab: false
+ });
+ });
+ }
}
});
}