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/8928

Vanessaec4e0c0d1437
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index 8657132591..4e467661a7 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -215,6 +215,10 @@ export const openFile = (options: IOpenFileOptions) => {
wnd.parent.children.find((item, index) => {
if (item.id === wnd.id) {
let nextWnd = wnd.parent.children[index + 1];
+ if (!nextWnd) {
+ // wnd 为右侧时,应设置其为目标
+ nextWnd = wnd;
+ }
while (nextWnd instanceof Layout) {
nextWnd = nextWnd.children[0];
}
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 781859ebd1..1ab533b685 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -104,7 +104,7 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean) => {
removed: localData.removed,
page: 1
},
- position: "right"
+ position: (window.siyuan.layout.centerLayout.children.length > 1 || window.innerWidth > 1024) ? "right" : undefined
});
};
@@ -492,7 +492,11 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
} else if (target.id === "searchOpen") {
config.k = searchInputElement.value;
config.r = replaceInputElement.value;
- openFile({app, searchData: config, position: "right"});
+ openFile({
+ app,
+ searchData: config,
+ position: (window.siyuan.layout.centerLayout.children.length > 1 || window.innerWidth > 1024) ? "right" : undefined
+ });
if (closeCB) {
closeCB();
}