From e02c071caa172538d80d50fb03e813176d9a722f Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 3 Sep 2022 11:20:36 +0800 Subject: [PATCH] :lipstick: fix https://github.com/siyuan-note/siyuan/issues/5799 --- app/src/protyle/gutter/index.ts | 9 ++++++++- app/src/protyle/toolbar/index.ts | 6 +++++- app/src/protyle/wysiwyg/keydown.ts | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 39dba6413..bb9da3336 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -26,8 +26,11 @@ import {isMobile} from "../../util/functions"; import {confirmDialog} from "../../dialog/confirmDialog"; import {enableProtyle} from "../util/onGet"; import {countBlockWord} from "../../layout/status"; -import {Constants} from "../../constants"; +/// #if !MOBILE import {openFileById} from "../../editor/util"; +/// #endif +import {Constants} from "../../constants"; +import {openMobileFileById} from "../../mobile/editor"; export class Gutter { public element: HTMLElement; @@ -1184,10 +1187,14 @@ export class Gutter { if (!protyle.block.showAll) { const ids = protyle.path.split("/"); if (ids.length > 2) { + /// #if MOBILE + openMobileFileById(ids[ids.length - 2],[Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]); + /// #else openFileById({ id: ids[ids.length - 2], action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL] }); + /// #endif } } else { zoomOut(protyle, protyle.block.parent2ID, id); diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index fa1495c3a..ff3feed9d 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -661,7 +661,7 @@ export class Toolbar { pinData.styleH = textElement.style.height; pinData.styleW = textElement.style.width; } else { - this.subElement.style.width = ""; + this.subElement.style.width = isMobile() ? "100vw" : ""; this.subElement.style.padding = "0"; } this.subElement.innerHTML = `
@@ -686,6 +686,10 @@ export class Toolbar {
`; const autoHeight = () => { textElement.style.height = textElement.scrollHeight + "px"; + if (isMobile()) { + setPosition(this.subElement, 0, 0); + return; + } if (this.subElement.firstElementChild.getAttribute("data-drag") === "true") { if (textElement.getBoundingClientRect().bottom > window.innerHeight) { this.subElement.style.top = window.innerHeight - this.subElement.clientHeight + "px"; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 79710c320..1a41e2453 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -64,6 +64,7 @@ import * as dayjs from "dayjs"; import {highlightRender} from "../markdown/highlightRender"; import {countBlockWord} from "../../layout/status"; import {insertHTML} from "../util/insertHTML"; +import {openMobileFileById} from "../../mobile/editor"; export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { editorElement.addEventListener("keydown", async (event: KeyboardEvent & { target: HTMLElement }) => { @@ -411,10 +412,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (!protyle.block.showAll) { const ids = protyle.path.split("/"); if (ids.length > 2) { + /// #if MOBILE + openMobileFileById(ids[ids.length - 2],[Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]); + /// #else openFileById({ id: ids[ids.length - 2], action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL] }); + /// #endif } } else { zoomOut(protyle, protyle.block.parent2ID, nodeElement.getAttribute("data-node-id"));