Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16548

Vanessa24e3c88c594f
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index d3c0d40b2f..566f02f131 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -174,10 +174,7 @@ window.reconnectWebSocket = () => {
window.goBack = goBack;
window.showMessage = showMessage;
window.processIOSPurchaseResponse = processIOSPurchaseResponse;
-window.showKeyboardToolbar = (height) => {
- document.getElementById("keyboardToolbar").setAttribute("data-keyboardheight", (height ? height : window.outerHeight / 2 - 42).toString());
- showKeyboardToolbar();
-};
+window.showKeyboardToolbar = showKeyboardToolbar;
window.hideKeyboardToolbar = hideKeyboardToolbar;
window.openFileByURL = (openURL) => {
if (openURL && isSYProtocol(openURL)) {
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 97a4c4486f..f63bba0008 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -288,8 +288,7 @@ export const showKeyboardToolbarUtil = (oldScrollTop: number) => {
showUtil = true;
const toolbarElement = document.getElementById("keyboardToolbar");
- let keyboardHeight = toolbarElement.getAttribute("data-keyboardheight");
- keyboardHeight = (keyboardHeight ? (parseInt(keyboardHeight) + 42) : window.outerHeight / 2) + "px";
+ const keyboardHeight = document.documentElement.clientHeight - window.visualViewport.height + "px";
const editor = getCurrentEditor();
if (editor) {
editor.protyle.element.parentElement.style.paddingBottom = keyboardHeight;
diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts
index 3fea1d1228..7721284471 100644
--- a/app/src/mobile/util/touch.ts
+++ b/app/src/mobile/util/touch.ts
@@ -29,7 +29,7 @@ const popSide = (render = true) => {
export const handleTouchEnd = (event: TouchEvent, app: App) => {
const target = event.target as HTMLElement;
const wysisygElement = hasClosestByClassName(target, "protyle-wysiwyg", true);
- if (!yDiff || Math.abs(yDiff) < 10) {
+ if (!yDiff || Math.abs(yDiff) < 24) {
let editElement: HTMLElement;
if (["INPUT", "TEXTAREA"].includes(target.tagName) && target.getAttribute("readonly") !== "readonly") {
editElement = target;
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 866a8759e5..2b1d3a6060 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -417,8 +417,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
/// #if MOBILE
const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
if (contentElement && cellElement.getAttribute("data-dtype") !== "checkbox") {
- const keyboardToolbarElement = document.getElementById("keyboardToolbar");
- const keyboardH = parseInt(keyboardToolbarElement.getAttribute("data-keyboardheight")) || (window.outerHeight / 2 - 42);
+ const keyboardH = document.documentElement.clientHeight - window.visualViewport.height;
if (cellRect.bottom > window.innerHeight - keyboardH - 42) {
contentElement.scrollTop += cellRect.bottom - window.innerHeight + 42 + keyboardH;
} else if (cellRect.top < 110) {