mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
d29bfb6c49
commit
2ff96ae614
1 changed files with 22 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import {focusBlock, focusByRange} from "../protyle/util/selection";
|
|||
import {onGet} from "../protyle/util/onGet";
|
||||
/// #if !BROWSER
|
||||
import {shell} from "electron";
|
||||
import {BrowserWindow} from "@electron/remote";
|
||||
/// #endif
|
||||
import {pushBack} from "../util/backForward";
|
||||
import {Asset} from "../asset";
|
||||
|
|
@ -23,6 +24,7 @@ import {setTitle} from "../dialog/processSystem";
|
|||
import {zoomOut} from "../menus/protyle";
|
||||
import {countBlockWord, countSelectWord} from "../layout/status";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {getSearch} from "../util/functions";
|
||||
|
||||
export const openFileById = (options: {
|
||||
id: string,
|
||||
|
|
@ -112,6 +114,26 @@ const openFile = (options: IOpenFileOptions) => {
|
|||
}
|
||||
}
|
||||
|
||||
let hasOpen = false;
|
||||
/// #if !BROWSER
|
||||
// https://github.com/siyuan-note/siyuan/issues/7491
|
||||
BrowserWindow.getAllWindows().find((item) => {
|
||||
const json = getSearch("json", new URL(item.webContents.getURL()).search)
|
||||
if (json) {
|
||||
const jsonObj = JSON.parse(json);
|
||||
if ((jsonObj.children.rootId && jsonObj.children.rootId === options.rootID) ||
|
||||
(jsonObj.children.path && jsonObj.children.path === options.assetPath)) {
|
||||
item.focus();
|
||||
hasOpen = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
/// #endif
|
||||
if (hasOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
let wnd: Wnd = undefined;
|
||||
// 获取光标所在 tab
|
||||
const element = document.querySelector(".layout__wnd--active");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue