Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: https://github.com/siyuan-note/siyuan/issues/7518

Vanessa3727db323cad
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 1bff212205..69d99425f5 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -183,9 +183,6 @@ 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 || window.siyuan.config.editor.readOnly || window.siyuan.mobile.editor.protyle.disabled) {
return;
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 1f44a75822..dda3e34788 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -87,7 +87,30 @@ export const hideKeyboard = () => {
(document.activeElement as HTMLElement).blur();
};
+const disabledKeyboardToolbar = () => {
+ document.querySelectorAll("#keyboardToolbar button").forEach(item => {
+ if (item.getAttribute("data-type") !== "all") {
+ item.setAttribute("disabled", "disabled");
+ }
+ });
+}
+
+const enKeyboardToolbar = () => {
+ document.querySelectorAll("#keyboardToolbar button").forEach(item => {
+ item.removeAttribute("disabled");
+ });
+}
+
export const initKeyboardToolbar = () => {
+ window.addEventListener('focus', (event) => {
+ const target = event.target as HTMLElement
+ if (["INPUT", "TEXTAREA"].includes(target.tagName)) {
+ disabledKeyboardToolbar()
+ } else if (target.classList.contains("protyle-wysiwyg")) {
+ enKeyboardToolbar()
+ }
+ }, true);
+
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.addEventListener("click", (event) => {
const target = event.target as HTMLElement;