mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +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) {
|
if (window.siyuan.mobile?.editor) {
|
||||||
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
|
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
|
||||||
id: options.id,
|
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]);
|
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
|
||||||
if (options.isPushBack) {
|
if (options.isPushBack) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const getCurrentEditor = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openMobileFileById = (app: App, id: string, action = [Constants.CB_GET_HL]) => {
|
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]);
|
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
|
||||||
if (window.siyuan.mobile.editor) {
|
if (window.siyuan.mobile.editor) {
|
||||||
hideElements(["toolbar", "hint", "util"], window.siyuan.mobile.editor.protyle);
|
hideElements(["toolbar", "hint", "util"], window.siyuan.mobile.editor.protyle);
|
||||||
|
|
@ -48,9 +48,6 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (window.siyuan.mobile.editor) {
|
if (window.siyuan.mobile.editor) {
|
||||||
if (document.getElementById("empty").classList.contains("fn__none")) {
|
|
||||||
saveScroll(window.siyuan.mobile.editor.protyle);
|
|
||||||
}
|
|
||||||
pushBack();
|
pushBack();
|
||||||
addLoading(window.siyuan.mobile.editor.protyle);
|
addLoading(window.siyuan.mobile.editor.protyle);
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {initRightMenu} from "./menu";
|
||||||
import {openChangelog} from "../boot/openChangelog";
|
import {openChangelog} from "../boot/openChangelog";
|
||||||
import {registerServiceWorker} from "../util/serviceWorker";
|
import {registerServiceWorker} from "../util/serviceWorker";
|
||||||
import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
|
import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
|
||||||
|
import {saveScroll} from "../protyle/scroll/saveScroll";
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
public plugins: import("../plugin").Plugin[] = [];
|
public plugins: import("../plugin").Plugin[] = [];
|
||||||
|
|
@ -59,6 +60,12 @@ class App {
|
||||||
window.siyuan.menus.menu.remove();
|
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) => {
|
fetchPost("/api/system/getConf", {}, async (confResponse) => {
|
||||||
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
|
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
|
||||||
window.siyuan.config = confResponse.data.conf;
|
window.siyuan.config = confResponse.data.conf;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ const focusStack = (backStack: IBackStack) => {
|
||||||
const protyle = getCurrentEditor().protyle;
|
const protyle = getCurrentEditor().protyle;
|
||||||
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
|
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
|
||||||
id: backStack.id,
|
id: backStack.id,
|
||||||
action: backStack.callback,
|
|
||||||
};
|
};
|
||||||
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
|
setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]);
|
||||||
hideElements(["toolbar", "hint", "util"], protyle);
|
hideElements(["toolbar", "hint", "util"], protyle);
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ export const initFramework = (app: App) => {
|
||||||
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
|
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
|
||||||
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
|
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
|
||||||
if (existResponse.data) {
|
if (existResponse.data) {
|
||||||
openMobileFileById(app, localDoc.id, localDoc.action);
|
openMobileFileById(app, localDoc.id, [Constants.CB_GET_SCROLL]);
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
|
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
|
||||||
if (response.data.length !== 0) {
|
if (response.data.length !== 0) {
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ export const getLocalStorage = (cb: () => void) => {
|
||||||
};
|
};
|
||||||
defaultStorage[Constants.LOCAL_DOCINFO] = {
|
defaultStorage[Constants.LOCAL_DOCINFO] = {
|
||||||
id: "",
|
id: "",
|
||||||
action: []
|
|
||||||
};
|
};
|
||||||
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
|
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
|
||||||
defaultStorage[Constants.LOCAL_SEARCHDATA] = {
|
defaultStorage[Constants.LOCAL_SEARCHDATA] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue