From 53aacb8a77b7065cf0d51d1241f3c8bbf2b382b2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 17 Apr 2025 00:08:52 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14589 --- app/src/mobile/menu/index.ts | 1 - app/src/mobile/menu/search.ts | 1 - app/src/mobile/util/closePanel.ts | 3 +-- app/src/mobile/util/initFramework.ts | 1 - app/src/mobile/util/keyboardToolbar.ts | 14 +++++++------- app/src/mobile/util/touch.ts | 2 -- app/src/protyle/wysiwyg/index.ts | 4 ---- app/src/types/index.d.ts | 1 + 8 files changed, 9 insertions(+), 18 deletions(-) diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts index 495258826..516689af7 100644 --- a/app/src/mobile/menu/index.ts +++ b/app/src/mobile/menu/index.ts @@ -33,7 +33,6 @@ import {initFileTree} from "../settings/fileTree"; export const popMenu = () => { activeBlur(); - hideKeyboardToolbar(); document.getElementById("menu").style.transform = "translateX(0px)"; }; diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts index 5f5c238c9..4cfcb27f5 100644 --- a/app/src/mobile/menu/search.ts +++ b/app/src/mobile/menu/search.ts @@ -672,7 +672,6 @@ export const popSearch = (app: App, searchConfig?: any) => { } activeBlur(); - hideKeyboardToolbar(); let includeChild = true; let enableIncludeChild = false; config.idPath.forEach(item => { diff --git a/app/src/mobile/util/closePanel.ts b/app/src/mobile/util/closePanel.ts index 60be93d65..709ca1585 100644 --- a/app/src/mobile/util/closePanel.ts +++ b/app/src/mobile/util/closePanel.ts @@ -11,7 +11,6 @@ export const closePanel = () => { }; export const closeModel = () => { - document.getElementById("model").style.transform = ""; activeBlur(); - hideKeyboardToolbar(); + document.getElementById("model").style.transform = ""; }; diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts index 35eb6e3c9..a383457dd 100644 --- a/app/src/mobile/util/initFramework.ts +++ b/app/src/mobile/util/initFramework.ts @@ -138,7 +138,6 @@ export const initFramework = (app: App, isStart: boolean) => { }); window.siyuan.mobile.docks.file = new MobileFiles(app); document.getElementById("toolbarFile").addEventListener("click", () => { - hideKeyboardToolbar(); activeBlur(); sidebarElement.style.transform = "translateX(0px)"; const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type"); diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts index 67ccde574..896de2148 100644 --- a/app/src/mobile/util/keyboardToolbar.ts +++ b/app/src/mobile/util/keyboardToolbar.ts @@ -36,18 +36,18 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => { "var(--b3-font-color9)", "var(--b3-font-color10)", "var(--b3-font-color11)", "var(--b3-font-color12)", "var(--b3-font-color13)"].forEach((item, index) => { colorHTML += ``; }); let bgHTML = ""; - ["","var(--b3-font-background1)", "var(--b3-font-background2)", "var(--b3-font-background3)", "var(--b3-font-background4)", + ["", "var(--b3-font-background1)", "var(--b3-font-background2)", "var(--b3-font-background3)", "var(--b3-font-background4)", "var(--b3-font-background5)", "var(--b3-font-background6)", "var(--b3-font-background7)", "var(--b3-font-background8)", "var(--b3-font-background9)", "var(--b3-font-background10)", "var(--b3-font-background11)", "var(--b3-font-background12)", "var(--b3-font-background13)"].forEach((item, index) => { bgHTML += ``; }); @@ -462,6 +462,8 @@ export const hideKeyboardToolbar = () => { }; export const activeBlur = () => { + window.JSAndroid?.hideKeyboard(); + hideKeyboardToolbar(); (document.activeElement as HTMLElement).blur(); }; @@ -566,7 +568,6 @@ export const initKeyboardToolbar = () => { focusByRange(range); } else { activeBlur(); - hideKeyboardToolbar(); } return; } @@ -658,7 +659,6 @@ export const initKeyboardToolbar = () => { protyle.gutter.renderMenu(protyle, nodeElement); window.siyuan.menus.menu.fullscreen(); activeBlur(); - hideKeyboardToolbar(); return; } else if (type === "outdent") { listOutdent(protyle, [nodeElement.parentElement], range); diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 03ed0f189..68f19f9ac 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -21,7 +21,6 @@ const popSide = (render = true) => { if (render) { document.getElementById("toolbarFile").dispatchEvent(new CustomEvent("click")); } else { - hideKeyboardToolbar(); activeBlur(); document.getElementById("sidebar").style.transform = "translateX(0px)"; } @@ -309,7 +308,6 @@ export const handleTouchMove = (event: TouchEvent) => { transformMask((windowWidth - xDiff) / windowWidth); } activeBlur(); - hideKeyboardToolbar(); if (window.siyuan.mobile.editor) { window.siyuan.mobile.editor.protyle.contentElement.style.overflow = "hidden"; } diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 8ccff2fbc..df24fbfaa 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2168,7 +2168,6 @@ export class WYSIWYG { // https://github.com/siyuan-note/siyuan/issues/14569 if (event.target.tagName === "VIDEO") { activeBlur(); - hideKeyboardToolbar(); return; } /// #endif @@ -2265,7 +2264,6 @@ export class WYSIWYG { } /// #if MOBILE activeBlur(); - hideKeyboardToolbar(); openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); /// #else if (event.shiftKey) { @@ -2332,7 +2330,6 @@ export class WYSIWYG { }, (response) => { checkFold(response.data.refDefs[0].refID, (zoomIn) => { activeBlur(); - hideKeyboardToolbar(); openMobileFileById(protyle.app, response.data.refDefs[0].refID, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); }); }); @@ -2406,7 +2403,6 @@ export class WYSIWYG { checkFold(embedId, (zoomIn, action) => { /// #if MOBILE activeBlur(); - hideKeyboardToolbar(); openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]); /// #else if (event.shiftKey) { diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index d46efd65b..146039d74 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -208,6 +208,7 @@ interface Window { readClipboard(): string readHTMLClipboard(): string getBlockURL(): string + hideKeyboard(): void } JSHarmony: { openExternal(url: string): void