This commit is contained in:
Vanessa 2023-08-12 00:04:10 +08:00
parent 0684145b44
commit ec4e0c0d14
2 changed files with 10 additions and 2 deletions

View file

@ -215,6 +215,10 @@ export const openFile = (options: IOpenFileOptions) => {
wnd.parent.children.find((item, index) => { wnd.parent.children.find((item, index) => {
if (item.id === wnd.id) { if (item.id === wnd.id) {
let nextWnd = wnd.parent.children[index + 1]; let nextWnd = wnd.parent.children[index + 1];
if (!nextWnd) {
// wnd 为右侧时,应设置其为目标
nextWnd = wnd;
}
while (nextWnd instanceof Layout) { while (nextWnd instanceof Layout) {
nextWnd = nextWnd.children[0]; nextWnd = nextWnd.children[0];
} }

View file

@ -104,7 +104,7 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean) => {
removed: localData.removed, removed: localData.removed,
page: 1 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") { } else if (target.id === "searchOpen") {
config.k = searchInputElement.value; config.k = searchInputElement.value;
config.r = replaceInputElement.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) { if (closeCB) {
closeCB(); closeCB();
} }