Vanessa 2026-02-04 16:27:48 +08:00
parent ba0cf1cf28
commit 24e3c88c59
4 changed files with 4 additions and 9 deletions

View file

@ -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)) {

View file

@ -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;

View file

@ -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;

View file

@ -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) {