Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/pull/7086

Vanessa1310f5e8f923
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index f75521b06e..aafed449dd 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -26,6 +26,8 @@ import {openSearch} from "../search/spread";
import {saveScroll} from "../protyle/scroll/saveScroll";
import {pdfResize} from "../asset/renderAssets";
import {Backlink} from "./dock/Backlink";
+import {openFileById} from "../editor/util";
+import {getSearch} from "../util/functions";
export const setPanelFocus = (element: Element) => {
if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) {
@@ -296,6 +298,15 @@ export const JSONToLayout = (isStart: boolean) => {
}
});
}
+ // https://github.com/siyuan-note/siyuan/pull/7086
+ const openId = getSearch("id", window.location.href)
+ if (openId) {
+ openFileById({
+ id: getSearch("id", window.location.href),
+ action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
+ zoomIn: getSearch("focus", window.location.href) === "1"
+ });
+ }
};
export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index f66d9114b3..930a049bb9 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -18,6 +18,8 @@ import {MobileBacklinks} from "./MobileBacklinks";
import {MobileBookmarks} from "./MobileBookmarks";
import {MobileTags} from "./MobileTags";
import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";
+import {getSearch} from "../../util/functions";
+import {openFileById} from "../../editor/util";
export const initFramework = () => {
setInlineStyle();
@@ -127,20 +129,26 @@ export const initFramework = () => {
});
initEditorName();
if (getOpenNotebookCount() > 0) {
- const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
- fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
- if (existResponse.data) {
- openMobileFileById(localDoc.id, localDoc.action);
- } else {
- fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
- if (response.data.length !== 0) {
- openMobileFileById(response.data[0].id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
- } else {
- setEmpty();
- }
- });
- }
- });
+ const openId = getSearch("id", window.location.href);
+ if (openId) {
+ openMobileFileById(getSearch("id", window.location.href),
+ getSearch("focus", window.location.href) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
+ } else {
+ const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
+ fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
+ if (existResponse.data) {
+ openMobileFileById(localDoc.id, localDoc.action);
+ } else {
+ fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
+ if (response.data.length !== 0) {
+ openMobileFileById(response.data[0].id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
+ } else {
+ setEmpty();
+ }
+ });
+ }
+ });
+ }
} else {
setEmpty();
}