This commit is contained in:
Vanessa 2023-01-16 21:33:50 +08:00
parent c5f35969eb
commit 1310f5e8f9
2 changed files with 33 additions and 14 deletions

View file

@ -26,6 +26,8 @@ import {openSearch} from "../search/spread";
import {saveScroll} from "../protyle/scroll/saveScroll"; import {saveScroll} from "../protyle/scroll/saveScroll";
import {pdfResize} from "../asset/renderAssets"; import {pdfResize} from "../asset/renderAssets";
import {Backlink} from "./dock/Backlink"; import {Backlink} from "./dock/Backlink";
import {openFileById} from "../editor/util";
import {getSearch} from "../util/functions";
export const setPanelFocus = (element: Element) => { export const setPanelFocus = (element: Element) => {
if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) { 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) => { export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {

View file

@ -18,6 +18,8 @@ import {MobileBacklinks} from "./MobileBacklinks";
import {MobileBookmarks} from "./MobileBookmarks"; import {MobileBookmarks} from "./MobileBookmarks";
import {MobileTags} from "./MobileTags"; import {MobileTags} from "./MobileTags";
import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar"; import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";
import {getSearch} from "../../util/functions";
import {openFileById} from "../../editor/util";
export const initFramework = () => { export const initFramework = () => {
setInlineStyle(); setInlineStyle();
@ -127,20 +129,26 @@ export const initFramework = () => {
}); });
initEditorName(); initEditorName();
if (getOpenNotebookCount() > 0) { if (getOpenNotebookCount() > 0) {
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO]; const openId = getSearch("id", window.location.href);
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => { if (openId) {
if (existResponse.data) { openMobileFileById(getSearch("id", window.location.href),
openMobileFileById(localDoc.id, localDoc.action); getSearch("focus", window.location.href) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
} else { } else {
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => { const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
if (response.data.length !== 0) { fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
openMobileFileById(response.data[0].id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); if (existResponse.data) {
} else { openMobileFileById(localDoc.id, localDoc.action);
setEmpty(); } 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 { } else {
setEmpty(); setEmpty();
} }