mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-24 16:04:06 +01:00
This commit is contained in:
parent
7688733364
commit
4ee566cbd9
30 changed files with 153 additions and 163 deletions
|
|
@ -14,7 +14,7 @@ import {hideElements} from "../protyle/ui/hideElements";
|
|||
import {pushBack} from "./util/MobileBackFoward";
|
||||
|
||||
export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) => {
|
||||
localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, action}));
|
||||
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id, action};
|
||||
if (window.siyuan.mobileEditor) {
|
||||
hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);
|
||||
if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) {
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ class App {
|
|||
window.siyuan.menus.menu.remove();
|
||||
}
|
||||
});
|
||||
setLocalStorage();
|
||||
fetchPost("/api/system/getConf", {}, confResponse => {
|
||||
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
|
||||
window.siyuan.config = confResponse.data.conf;
|
||||
setLocalStorage();
|
||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
||||
window.siyuan.languages = lauguages;
|
||||
document.title = window.siyuan.languages.siyuanNote;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ const forwardStack: IBackStack[] = [];
|
|||
|
||||
const focusStack = (backStack: IBackStack) => {
|
||||
const protyle = window.siyuan.mobileEditor.protyle;
|
||||
localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({
|
||||
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {
|
||||
id: backStack.id,
|
||||
action: backStack.callback,
|
||||
}));
|
||||
};
|
||||
hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);
|
||||
if (protyle.contentElement.classList.contains("fn__none")) {
|
||||
setEditMode(protyle, "wysiwyg");
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ export const initFramework = () => {
|
|||
});
|
||||
initEditorName();
|
||||
if (getOpenNotebookCount() > 0) {
|
||||
const localDoc = JSON.parse(localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');
|
||||
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];
|
||||
fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {
|
||||
if (existResponse.data) {
|
||||
openMobileFileById(localDoc.id, localDoc.action);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {getEventName, openByMobile, writeText} from "../../protyle/util/compatibility";
|
||||
import {exportLocalStorage, getEventName, openByMobile, writeText} from "../../protyle/util/compatibility";
|
||||
import {popSearch} from "./search";
|
||||
import {initAppearance} from "../settings/appearance";
|
||||
import {closePanel} from "./closePanel";
|
||||
|
|
@ -172,7 +172,9 @@ ${accountHTML}
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuSafeQuit") {
|
||||
exitSiYuan();
|
||||
exportLocalStorage(() => {
|
||||
exitSiYuan();
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
@ -439,8 +441,10 @@ ${accountHTML}
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuLock") {
|
||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||
window.location.href = "/";
|
||||
exportLocalStorage(() => {
|
||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||
window.location.href = "/";
|
||||
});
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -457,6 +461,7 @@ ${accountHTML}
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuSyncNow") {
|
||||
exportLocalStorage();
|
||||
syncGuide();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -37,17 +37,14 @@ export const toolbarSearchEvent = () => {
|
|||
onRecentBlocks(response.data.blocks, response.data.matchedRootCount,response.data.matchedBlockCount);
|
||||
});
|
||||
}
|
||||
const localData = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEDATA) || "{}");
|
||||
localData.k = inputElement.value;
|
||||
localStorage.setItem(Constants.LOCAL_SEARCHEDATA, JSON.stringify(localData));
|
||||
window.siyuan.storage[Constants.LOCAL_SEARCHEDATA].k = inputElement.value;
|
||||
}, Constants.TIMEOUT_SEARCH);
|
||||
};
|
||||
|
||||
const initToolbarSearch = () => {
|
||||
const inputElement = document.getElementById("toolbarSearch") as HTMLInputElement;
|
||||
inputElement.focus();
|
||||
const localData = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEDATA) || "{}");
|
||||
inputElement.value = localData.k || "";
|
||||
inputElement.value = window.siyuan.storage[Constants.LOCAL_SEARCHEDATA].k;
|
||||
inputElement.addEventListener("compositionend", (event: InputEvent) => {
|
||||
if (event && event.isComposing) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue