An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/6086
Vanessae793431202d0
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex e376675fc9..9f8c5ed267 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -16,7 +16,7 @@ import {hasTopClosestByTag} from "../../protyle/util/hasClosest";import {MobileBacklinks} from "./MobileBacklinks";import {MobileBookmarks} from "./MobileBookmarks";import {MobileTags} from "./MobileTags";-import {initKeyboardToolbar} from "./showKeyboardToolbar";+import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";export const initFramework = () => {setInlineStyle();@@ -70,7 +70,7 @@ export const initFramework = () => {});});new MobileFiles();- document.getElementById("toolbarFile").addEventListener(getEventName(), () => {+ document.getElementById("toolbarFile").addEventListener("click", () => {sidebarElement.style.left = "0";document.querySelector(".scrim").classList.remove("fn__none");const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type");@@ -84,7 +84,8 @@ export const initFramework = () => {tag.update();}});- document.getElementById("toolbarMore").addEventListener(getEventName(), () => {+ // 用 touchstart 会导致键盘不收起+ document.getElementById("toolbarMore").addEventListener("click", () => {popMenu();});const editElement = document.getElementById("toolbarEdit");@@ -138,6 +139,9 @@ export const initFramework = () => {const initEditorName = () => {const inputElement = document.getElementById("toolbarName") as HTMLInputElement;inputElement.setAttribute("placeholder", window.siyuan.languages._kernel[16]);+ inputElement.addEventListener("focus", () => {+ hideKeyboardToolbar();+ });inputElement.addEventListener("blur", () => {if (window.siyuan.config.readonly || document.querySelector("#toolbarEdit use").getAttribute("xlink:href") === "#iconEdit") {return;diff --git a/app/src/mobile/util/showKeyboardToolbar.ts b/app/src/mobile/util/showKeyboardToolbar.tsindex 4dfec5d300..282f9af26f 100644--- a/app/src/mobile/util/showKeyboardToolbar.ts+++ b/app/src/mobile/util/showKeyboardToolbar.ts@@ -7,18 +7,21 @@ import {focusByRange} from "../../protyle/util/selection";import {scrollCenter} from "../../util/highlightById";export const showKeyboardToolbar = (bottom = 0) => {- const toolbarElement = document.getElementById("keyboardToolbar");- toolbarElement.classList.remove("fn__none");- toolbarElement.style.bottom = bottom + "px";- let range: Range;if (getSelection().rangeCount > 0) {- range = getSelection().getRangeAt(0);+ const range = getSelection().getRangeAt(0);+ if (!window.siyuan.mobileEditor ||+ !window.siyuan.mobileEditor.protyle.wysiwyg.element.contains(range.startContainer)) {+ return;+ }+ } else {+ return;}- if (!range || !window.siyuan.mobileEditor ||- !window.siyuan.mobileEditor.protyle.wysiwyg.element.contains(range.startContainer)) {+ const toolbarElement = document.getElementById("keyboardToolbar");+ if (!toolbarElement.classList.contains("fn__none")) {return;}-+ toolbarElement.classList.remove("fn__none");+ toolbarElement.style.bottom = bottom + "px";if ("android" === window.siyuan.config.system.container && window.JSAndroid) {// Android 端事件需要滞后一些,所以这里延迟一下setTimeout(() => {diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 1d903d3fe5..304b64e04b 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -26,6 +26,7 @@ import {getDisplayName} from "../util/pathName";import {onGet} from "./util/onGet";import {reloadProtyle} from "./util/reload";import {renderBacklink} from "./wysiwyg/renderBacklink";+import {showKeyboardToolbar} from "../mobile/util/showKeyboardToolbar";export class Protyle {@@ -179,8 +180,8 @@ export class Protyle {// 需等待 getDoc 完成后再执行,否则在无页签的时候 updatePanelByEditor 会执行2次// 只能用 focusin,否则点击表格无法执行- /// #if !MOBILEthis.protyle.wysiwyg.element.addEventListener("focusin", () => {+ /// #if !MOBILEif (this.protyle && this.protyle.model) {let needUpdate = true;if (this.protyle.model.element.parentElement.parentElement.classList.contains("layout__wnd--active") && this.protyle.model.headElement.classList.contains("item--focus")) {@@ -200,8 +201,10 @@ export class Protyle {item.classList.remove("layout__wnd--active");});}+ /// #else+ showKeyboardToolbar();+ /// #endif});- /// #endif// 需等渲染完后再回调,用于定位搜索字段 https://github.com/siyuan-note/siyuan/issues/3171if (mergedOptions.after) {mergedOptions.after(this);