From 59aae7c87b02ef3fe8edfff42b739b9edd0488d9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 10 Jun 2022 14:47:57 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5150 --- app/src/mobile/editor.ts | 4 ++++ app/src/protyle/util/setEditMode.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index 8fd17e407..df1b1ed03 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -10,10 +10,14 @@ import {focusBlock} from "../protyle/util/selection"; import {scrollCenter} from "../util/highlightById"; import {lockFile} from "../dialog/processSystem"; import {hasClosestByAttribute} from "../protyle/util/hasClosest"; +import {setEditMode} from "../protyle/util/setEditMode"; export const openMobileFileById = (id: string, hasContext?: boolean, action = [Constants.CB_GET_HL], pushStack = true) => { window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, hasContext, action})); if (window.siyuan.mobileEditor) { + if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) { + setEditMode(window.siyuan.mobileEditor.protyle, "wysiwyg"); + } let blockElement; Array.from(window.siyuan.mobileEditor.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${id}"]`)).find(item => { if (!hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed")) { diff --git a/app/src/protyle/util/setEditMode.ts b/app/src/protyle/util/setEditMode.ts index db79bb317..a2a985a13 100644 --- a/app/src/protyle/util/setEditMode.ts +++ b/app/src/protyle/util/setEditMode.ts @@ -21,7 +21,9 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => { protyle.preview.element.classList.add("fn__none"); protyle.contentElement.classList.remove("fn__none"); - protyle.scroll?.element.classList.remove("fn__none"); + if (protyle.options.render.scroll) { + protyle.scroll?.element.classList.remove("fn__none"); + } protyle.breadcrumb.element.classList.remove("fn__none"); protyle.breadcrumb.element.nextElementSibling.classList.remove("fn__flex-1");