From ccb95c7132f1815237fcc1c3806eef4bdd151cfe Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 22 Nov 2023 16:18:32 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/9717 --- app/src/dialog/processSystem.ts | 4 +++- app/src/mobile/util/initFramework.ts | 2 +- app/src/protyle/ui/hideElements.ts | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index fc1f115ad..58ed0f1f1 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -170,7 +170,9 @@ export const kernelError = () => { export const exitSiYuan = () => { hideAllElements(["util"]); /// #if MOBILE - saveScroll(window.siyuan.mobile.editor.protyle); + if (window.siyuan.mobile.editor) { + saveScroll(window.siyuan.mobile.editor.protyle); + } /// #endif fetchPost("/api/system/exit", {force: false}, (response) => { if (response.code === 1) { // 同步执行失败 diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts index 7fc5ad539..05320a4f6 100644 --- a/app/src/mobile/util/initFramework.ts +++ b/app/src/mobile/util/initFramework.ts @@ -20,7 +20,7 @@ import {syncGuide} from "../../sync/syncGuide"; import {Inbox} from "../../layout/dock/Inbox"; import {App} from "../../index"; -export const initFramework = (app: App, isStart:boolean) => { +export const initFramework = (app: App, isStart: boolean) => { setInlineStyle(); renderSnippet(); initKeyboardToolbar(); diff --git a/app/src/protyle/ui/hideElements.ts b/app/src/protyle/ui/hideElements.ts index e666a002d..89edcec6e 100644 --- a/app/src/protyle/ui/hideElements.ts +++ b/app/src/protyle/ui/hideElements.ts @@ -61,10 +61,12 @@ export const hideAllElements = (types: string[]) => { if (types.includes("util")) { /// #if MOBILE const editor = getCurrentEditor(); - editor.protyle.toolbar.subElement.classList.add("fn__none"); - if (editor.protyle.toolbar.subElementCloseCB) { - editor.protyle.toolbar.subElementCloseCB(); - editor.protyle.toolbar.subElementCloseCB = undefined; + if (editor) { + editor.protyle.toolbar.subElement.classList.add("fn__none"); + if (editor.protyle.toolbar.subElementCloseCB) { + editor.protyle.toolbar.subElementCloseCB(); + editor.protyle.toolbar.subElementCloseCB = undefined; + } } /// #else getAllEditor().forEach(item => {