From 614e43ad247e8d8cb37c2205ce6a5881075b5469 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 21 Apr 2023 17:07:00 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/8074 --- app/src/mobile/menu/search.ts | 6 ++++++ app/src/mobile/util/touch.ts | 27 +++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts index 1ef6a8674..17ced8652 100644 --- a/app/src/mobile/menu/search.ts +++ b/app/src/mobile/menu/search.ts @@ -13,6 +13,7 @@ import {unicode2Emoji} from "../../emoji"; import {newFileByName} from "../../util/newFile"; import {showMessage} from "../../dialog/message"; import {reloadProtyle} from "../../protyle/util/reload"; +import {activeBlur, hideKeyboardToolbar} from "../util/keyboardToolbar"; const replace = (element: Element, config: ISearchOption, isAll: boolean) => { if (config.method === 1 || config.method === 2) { @@ -215,6 +216,9 @@ const updateSearchResult = (config: ISearchOption, element: Element) => { nextElement.setAttribute("disabled", "true"); }); } else { + if (!config.page) { + config.page = 1 + } if (config.page > 1) { previousElement.removeAttribute("disabled"); } else { @@ -514,6 +518,8 @@ const initSearchEvent = (element: Element, config: ISearchOption) => { }; export const popSearch = (config = window.siyuan.storage[Constants.LOCAL_SEARCHDATA] as ISearchOption) => { + activeBlur(); + hideKeyboardToolbar(); let includeChild = true; let enableIncludeChild = false; config.idPath.forEach(item => { diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index aaf86982d..62a34f1bd 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -3,6 +3,7 @@ import {closePanel} from "./closePanel"; import {popMenu} from "../menu"; import {activeBlur, hideKeyboardToolbar} from "./keyboardToolbar"; import {getCurrentEditor} from "../editor"; +import {linkMenu, refMenu, tagMenu} from "../../menus/protyle"; let clientX: number; let clientY: number; @@ -23,14 +24,36 @@ const popSide = (render = true) => { }; export const handleTouchEnd = (event: TouchEvent) => { - if (getCurrentEditor()) { + const editor = getCurrentEditor() + if (editor) { document.querySelectorAll(".protyle-breadcrumb__bar--hide").forEach(item => { item.classList.remove("protyle-breadcrumb__bar--hide"); }); window.siyuan.hideBreadcrumb = false; } - const target = event.target as HTMLElement; + if (editor && typeof yDiff === "undefined" && new Date().getTime() - time > 900 && + target.tagName === "SPAN" && window.webkit?.messageHandlers && + !hasClosestByAttribute(target, "data-type", "NodeBlockQueryEmbed")) { + // ios 长按行内元素弹出菜单 + const types = target.getAttribute("data-type").split(" ") + if (types.includes("inline-memo")) { + editor.protyle.toolbar.showRender(editor.protyle, target); + } + if (editor.protyle.disabled) { + return; + } + if (types.includes("block-ref")) { + refMenu(editor.protyle, target); + } else if (types.includes("file-annotation-ref")) { + editor.protyle.toolbar.showFileAnnotationRef(editor.protyle, target); + } else if (types.includes("tag")) { + tagMenu(editor.protyle, target); + } else if (types.includes("a")) { + linkMenu(editor.protyle, target); + } + return; + } if (!clientX || !clientY || typeof yDiff === "undefined" || target.tagName === "AUDIO" || hasClosestByClassName(target, "b3-dialog", true) ||