Skip to content

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

:art: 改进 保持移动端界面打开位置

Vanessa23ebc726acc6
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index e5df3ccd48..ca4850405a 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -590,7 +590,6 @@ export const zoomOut = (options: {
if (window.siyuan.mobile?.editor) {
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
id: options.id,
- action: options.id === options.protyle.block.rootID ? [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT] : [Constants.CB_GET_ALL]
};
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
if (options.isPushBack) {
diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts
index 572c882a44..6b65ba2746 100644
--- a/app/src/mobile/editor.ts
+++ b/app/src/mobile/editor.ts
@@ -20,7 +20,7 @@ export const getCurrentEditor = () => {
};
export const openMobileFileById = (app: App, id: string, action = [Constants.CB_GET_HL]) => {
- window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id, action};
+ window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id};
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
if (window.siyuan.mobile.editor) {
hideElements(["toolbar", "hint", "util"], window.siyuan.mobile.editor.protyle);
@@ -48,9 +48,6 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_
return;
}
if (window.siyuan.mobile.editor) {
- if (document.getElementById("empty").classList.contains("fn__none")) {
- saveScroll(window.siyuan.mobile.editor.protyle);
- }
pushBack();
addLoading(window.siyuan.mobile.editor.protyle);
fetchPost("/api/filetree/getDoc", {
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 41ef960637..c7293a2d47 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -22,6 +22,7 @@ import {initRightMenu} from "./menu";
import {openChangelog} from "../boot/openChangelog";
import {registerServiceWorker} from "../util/serviceWorker";
import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
+import {saveScroll} from "../protyle/scroll/saveScroll";
class App {
public plugins: import("../plugin").Plugin[] = [];
@@ -59,6 +60,12 @@ class App {
window.siyuan.menus.menu.remove();
}
});
+ window.addEventListener("beforeunload", () => {
+ saveScroll(window.siyuan.mobile.editor.protyle);
+ }, false);
+ window.addEventListener("pagehide", () => {
+ saveScroll(window.siyuan.mobile.editor.protyle);
+ }, false);
fetchPost("/api/system/getConf", {}, async (confResponse) => {
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
window.siyuan.config = confResponse.data.conf;
diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts
index 441f184471..24dbd8062b 100644
--- a/app/src/mobile/util/MobileBackFoward.ts
+++ b/app/src/mobile/util/MobileBackFoward.ts
@@ -19,7 +19,6 @@ const focusStack = (backStack: IBackStack) => {
const protyle = getCurrentEditor().protyle;
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
id: backStack.id,
- action: backStack.callback,
};
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
hideElements(["toolbar", "hint", "util"], protyle);
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 053aaad5cd..219a3f4590 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -151,7 +151,7 @@ export const initFramework = (app: App) => {
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
if (existResponse.data) {
- openMobileFileById(app, localDoc.id, localDoc.action);
+ openMobileFileById(app, localDoc.id, [Constants.CB_GET_SCROLL]);
} else {
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
if (response.data.length !== 0) {
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 49be79a4d1..4976a014c5 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -183,7 +183,6 @@ export const getLocalStorage = (cb: () => void) => {
};
defaultStorage[Constants.LOCAL_DOCINFO] = {
id: "",
- action: []
};
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
defaultStorage[Constants.LOCAL_SEARCHDATA] = {