mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🎨 改进 保持移动端界面打开位置
This commit is contained in:
parent
073e738389
commit
23ebc726ac
6 changed files with 9 additions and 8 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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", {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ export const getLocalStorage = (cb: () => void) => {
|
|||
};
|
||||
defaultStorage[Constants.LOCAL_DOCINFO] = {
|
||||
id: "",
|
||||
action: []
|
||||
};
|
||||
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
|
||||
defaultStorage[Constants.LOCAL_SEARCHDATA] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue