Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lipstick: fix https://github.com/siyuan-note/siyuan/issues/5799

Vanessae02c071caa17
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 39dba64136..bb9da33361 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 fa1495c3ae..ff3feed9d2 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 = `<div ${(isPin && this.subElement.firstElementChild.getAttribute("data-drag") === "true") ? 'data-drag="true"' : ""} class="block__popover--move"><div class="block__icons block__icons--border fn__flex">
@@ -686,6 +686,10 @@ export class Toolbar {
<textarea spellcheck="false" class="b3-text-field b3-text-field--text fn__block" placeholder="${placeholder}" style="width:${isMobile() ? "80vw" : Math.max(480, renderElement.clientWidth * 0.7) + "px"};max-height:50vh"></textarea></div>`;
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 79710c3208..1a41e24538 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"));