Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/9794

Vanessa3dcbaf4c378f
diff --git a/app/src/boot/globalEvent/searchKeydown.ts b/app/src/boot/globalEvent/searchKeydown.ts
index c8bb6ed2bd..3995433b61 100644
--- a/app/src/boot/globalEvent/searchKeydown.ts
+++ b/app/src/boot/globalEvent/searchKeydown.ts
@@ -53,10 +53,6 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
const assetsElement = element.querySelector("#searchAssets");
const isAsset = !assetsElement.classList.contains("fn__none");
const listElement = isAsset ? assetsElement.querySelector("#searchAssetList") : element.querySelector("#searchList");
- let currentList: HTMLElement = listElement.querySelector(".b3-list-item--focus");
- if (!currentList) {
- return false;
- }
const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;
if (!isAsset && matchHotKey(window.siyuan.config.keymap.general.newFile.custom, event)) {
newFileByName(app, searchInputElement.value);
@@ -80,6 +76,10 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {
// 不能返回 true,否则历史菜单无法使用快捷键
return false;
}
+ let currentList: HTMLElement = listElement.querySelector(".b3-list-item--focus");
+ if (!currentList) {
+ return false;
+ }
if (currentList.getAttribute("data-type") === "search-new") {
if (event.key === "Enter") {
newFileByName(app, searchInputElement.value);