瀏覽代碼

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

Vanessa 9 月之前
父節點
當前提交
6d35cbebae
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      app/src/protyle/render/av/cell.ts

+ 9 - 2
app/src/protyle/render/av/cell.ts

@@ -308,8 +308,15 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
     }
     }
     /// #if MOBILE
     /// #if MOBILE
     const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
     const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
-    if (contentElement) {
-        contentElement.scrollTop = contentElement.scrollTop + cellRect.top - 110;
+    if (contentElement && cellElement.getAttribute("data-dtype") !== "checkbox") {
+        const keyboardToolbarElement = document.getElementById("keyboardToolbar")
+        const keyboardH = parseInt(keyboardToolbarElement.getAttribute("data-keyboardheight")) || (window.outerHeight / 2 - 42)
+        console.log(keyboardH, window.innerHeight, cellRect.bottom)
+        if (cellRect.bottom > window.innerHeight - keyboardH - 42) {
+            contentElement.scrollTop += cellRect.bottom - window.innerHeight + 42 + keyboardH;
+        } else if (cellRect.top < 110) {
+            contentElement.scrollTop -= 110 - cellRect.top;
+        }
     }
     }
     /// #else
     /// #else
     if (!blockElement.querySelector(".av__header")) {
     if (!blockElement.querySelector(".av__header")) {