Skip to content

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

:bug: Prevent database primary keys from focusing root documents https://github.com/siyuan-note/siyuan/issues/18352

Daniel4471765a24f0
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index d5955a3d76..5898240a25 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -66,6 +66,7 @@ export const openFileById = async (options: {
showMessage(response.msg);
return;
}
+ const zoomIn = options.zoomIn === true && options.id !== response.data.rootID;
return openFile({
app: options.app,
@@ -77,7 +78,7 @@ export const openFileById = async (options: {
position: options.position,
mode: options.mode,
action: options.action,
- zoomIn: options.zoomIn,
+ zoomIn,
keepCursor: options.keepCursor,
removeCurrentTab: options.removeCurrentTab,
afterOpen: options.afterOpen,
diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts
index 348ae6cb09..30b8ace052 100644
--- a/app/src/mobile/editor.ts
+++ b/app/src/mobile/editor.ts
@@ -68,13 +68,17 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
showMessage(data.msg);
return;
}
+ const isRootFocus = id === data.data.rootID &&
+ action.includes(Constants.CB_GET_ALL) &&
+ action.includes(Constants.CB_GET_FOCUS);
+ const actionList = isRootFocus ? action.filter((item) => item !== Constants.CB_GET_ALL) : action;
const protyleOptions: IProtyleOptions = {
databaseAttr: true,
blockId: id,
rootId: data.data.rootID,
notebookId: data.data.box,
scrollPosition,
- action,
+ action: actionList,
render: {
scroll: true,
title: true,
@@ -99,7 +103,7 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
} else {
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: data.data.rootID});
}
- if (action.includes(Constants.CB_GET_SCROLL) && window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID]) {
+ if (actionList.includes(Constants.CB_GET_SCROLL) && window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID]) {
getDocByScroll({
protyle: window.siyuan.mobile.editor.protyle,
scrollAttr: window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID],
@@ -114,8 +118,8 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
} else {
const getDocParam: IObject = {
id,
- size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
- mode: action.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,
+ size: actionList.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
+ mode: actionList.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,
};
if (isEncryptedBox(window.siyuan.mobile.editor.protyle.notebookId)) {
getDocParam.notebook = window.siyuan.mobile.editor.protyle.notebookId;
@@ -124,7 +128,7 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
onGet({
data: getResponse,
protyle: window.siyuan.mobile.editor.protyle,
- action,
+ action: actionList,
scrollPosition,
afterCB() {
app.plugins.forEach(item => {