Skip to content

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

:art: Restore mobile keyboard after inserting content https://github.com/siyuan-note/siyuan/issues/19792

Danieldc368d9e779e
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 3781f70658..aab4007b43 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -1587,7 +1587,15 @@ export const initKeyboardToolbar = () => {
}
} else if (slashBtnElement.getAttribute("data-focus") === "true" ||
liteSlashBtnElement && slashBtnElement.getAttribute("data-focus") !== "false") {
- focusByRange(protyle.toolbar.range);
+ const selection = getSelection();
+ const editorRange = getEditorFocusRange(protyle.wysiwyg.element,
+ selection?.rangeCount ? selection.getRangeAt(0) : undefined, protyle.toolbar.range);
+ if (editorRange && (document.activeElement === document.body ||
+ protyle.wysiwyg.element.contains(document.activeElement))) {
+ hideKeyboardToolbarUtil(true);
+ restoreKeyboardToolbarRange(protyle, editorRange);
+ showKeyboardToolbar();
+ }
}
return;
}