mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
64b6001947
commit
7e8e6167ff
4 changed files with 6 additions and 48 deletions
|
|
@ -180,12 +180,10 @@ export const openFile = (options: IOpenFileOptions) => {
|
|||
}
|
||||
const ids = decodeURIComponent(new URL(item.webContents.getURL()).hash.substring(1)).split(Constants.ZWSP);
|
||||
if (ids.includes(options.rootID) || ids.includes(options.assetPath)) {
|
||||
let execJS = `window.newWindow.switchTabById("${options.rootID || options.assetPath}");`;
|
||||
if (options.assetPath) {
|
||||
execJS += `window.newWindow.positionPDF("${options.assetPath}", ${typeof options.page === "number" ? options.page : `"${options.page}"`})`;
|
||||
}
|
||||
item.focus();
|
||||
item.webContents.executeJavaScript(execJS);
|
||||
const optionsClone = Object.assign({}, options);
|
||||
delete optionsClone.app
|
||||
item.webContents.executeJavaScript(`window.newWindow.openFile(${JSON.stringify(optionsClone)});`);
|
||||
if (options.afterOpen) {
|
||||
options.afterOpen();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue