mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
f2f292c5fa
commit
56fe8371d1
13 changed files with 57 additions and 33 deletions
|
|
@ -326,7 +326,7 @@ const boot = () => {
|
||||||
currentWindow.show();
|
currentWindow.show();
|
||||||
setTimeout(() => { // 等待界面js执行完毕
|
setTimeout(() => { // 等待界面js执行完毕
|
||||||
writeLog(siyuanOpenURL);
|
writeLog(siyuanOpenURL);
|
||||||
currentWindow.webContents.send("siyuan-openurl", siyuanOpenURL);
|
currentWindow.webContents.send("siyuan-open-url", siyuanOpenURL);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -656,6 +656,9 @@ app.whenReady().then(() => {
|
||||||
resetTrayMenu(tray, lang, mainWindow);
|
resetTrayMenu(tray, lang, mainWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipcMain.on("siyuan-open-folder", (event, filePath) => {
|
||||||
|
shell.showItemInFolder(filePath);
|
||||||
|
});
|
||||||
ipcMain.on("siyuan-first-quit", () => {
|
ipcMain.on("siyuan-first-quit", () => {
|
||||||
app.exit();
|
app.exit();
|
||||||
});
|
});
|
||||||
|
|
@ -692,7 +695,7 @@ app.whenReady().then(() => {
|
||||||
ipcMain.on("siyuan-quit", (event, port) => {
|
ipcMain.on("siyuan-quit", (event, port) => {
|
||||||
exitApp(port);
|
exitApp(port);
|
||||||
});
|
});
|
||||||
ipcMain.on("siyuan-openwindow", (event, data) => {
|
ipcMain.on("siyuan-open-window", (event, data) => {
|
||||||
const mainWindow = BrowserWindow.fromId(data.id);
|
const mainWindow = BrowserWindow.fromId(data.id);
|
||||||
const mainBounds = mainWindow.getBounds();
|
const mainBounds = mainWindow.getBounds();
|
||||||
const mainScreen = screen.getDisplayNearestPoint({x: mainBounds.x, y: mainBounds.y});
|
const mainScreen = screen.getDisplayNearestPoint({x: mainBounds.x, y: mainBounds.y});
|
||||||
|
|
@ -832,9 +835,9 @@ app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipcMain.on("siyuan-send_windows", (event, data) => {
|
ipcMain.on("siyuan-send-windows", (event, data) => {
|
||||||
BrowserWindow.getAllWindows().forEach(item => {
|
BrowserWindow.getAllWindows().forEach(item => {
|
||||||
item.webContents.send("siyuan-send_windows", data);
|
item.webContents.send("siyuan-send-windows", data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipcMain.on("siyuan-auto-launch", (event, data) => {
|
ipcMain.on("siyuan-auto-launch", (event, data) => {
|
||||||
|
|
@ -907,7 +910,7 @@ app.on("open-url", (event, url) => { // for macOS
|
||||||
if (url.startsWith("siyuan://")) {
|
if (url.startsWith("siyuan://")) {
|
||||||
workspaces.forEach(item => {
|
workspaces.forEach(item => {
|
||||||
if (item.browserWindow && !item.browserWindow.isDestroyed()) {
|
if (item.browserWindow && !item.browserWindow.isDestroyed()) {
|
||||||
item.browserWindow.webContents.send("siyuan-openurl", url);
|
item.browserWindow.webContents.send("siyuan-open-url", url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -950,7 +953,7 @@ app.on("second-instance", (event, argv) => {
|
||||||
const siyuanURL = argv.find((arg) => arg.startsWith("siyuan://"));
|
const siyuanURL = argv.find((arg) => arg.startsWith("siyuan://"));
|
||||||
workspaces.forEach(item => {
|
workspaces.forEach(item => {
|
||||||
if (item.browserWindow && !item.browserWindow.isDestroyed() && siyuanURL) {
|
if (item.browserWindow && !item.browserWindow.isDestroyed() && siyuanURL) {
|
||||||
item.browserWindow.webContents.send("siyuan-openurl", siyuanURL);
|
item.browserWindow.webContents.send("siyuan-open-url", siyuanURL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1037,6 +1040,6 @@ powerMonitor.on("shutdown", () => {
|
||||||
powerMonitor.on("lock-screen", () => {
|
powerMonitor.on("lock-screen", () => {
|
||||||
writeLog("system lock-screen");
|
writeLog("system lock-screen");
|
||||||
BrowserWindow.getAllWindows().forEach(item => {
|
BrowserWindow.getAllWindows().forEach(item => {
|
||||||
item.webContents.send("siyuan-send_windows", {cmd: "lockscreenByMode"});
|
item.webContents.send("siyuan-send-windows", {cmd: "lockscreenByMode"});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ export const initWindow = (app: App) => {
|
||||||
currentWindow.on("focus", winOnFocus);
|
currentWindow.on("focus", winOnFocus);
|
||||||
currentWindow.on("blur", winOnBlur);
|
currentWindow.on("blur", winOnBlur);
|
||||||
if (!isWindow()) {
|
if (!isWindow()) {
|
||||||
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
|
ipcRenderer.on(Constants.SIYUAN_OPEN_URL, (event, url) => {
|
||||||
if (url.startsWith("siyuan://plugins/")) {
|
if (url.startsWith("siyuan://plugins/")) {
|
||||||
const pluginId = url.replace("siyuan://plugins/", "").split("?")[0];
|
const pluginId = url.replace("siyuan://plugins/", "").split("?")[0];
|
||||||
if (!pluginId) {
|
if (!pluginId) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import * as path from "path";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {isBrowser} from "../util/functions";
|
import {isBrowser} from "../util/functions";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
|
import {showFileInFolder} from "../util/pathName";
|
||||||
|
|
||||||
export const exportConfig = {
|
export const exportConfig = {
|
||||||
element: undefined as Element,
|
element: undefined as Element,
|
||||||
|
|
@ -204,7 +205,7 @@ export const exportConfig = {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
pandocBinPathElement.addEventListener("click", () => {
|
pandocBinPathElement.addEventListener("click", () => {
|
||||||
if (window.siyuan.config.export.pandocBin) {
|
if (window.siyuan.config.export.pandocBin) {
|
||||||
shell.showItemInFolder(window.siyuan.config.export.pandocBin);
|
showFileInFolder(window.siyuan.config.export.pandocBin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const pandocBinElement = exportConfig.element.querySelector("#pandocBin") as HTMLInputElement;
|
const pandocBinElement = exportConfig.element.querySelector("#pandocBin") as HTMLInputElement;
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,21 @@ export abstract class Constants {
|
||||||
// 渲染进程调主进程
|
// 渲染进程调主进程
|
||||||
public static readonly SIYUAN_SHOW: string = "siyuan-show";
|
public static readonly SIYUAN_SHOW: string = "siyuan-show";
|
||||||
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
|
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
|
||||||
public static readonly SIYUAN_OPEN_WORKSPACE: string = "siyuan-open-workspace";
|
|
||||||
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
||||||
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
|
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
|
||||||
public static readonly SIYUAN_INIT: string = "siyuan-init";
|
public static readonly SIYUAN_INIT: string = "siyuan-init";
|
||||||
public static readonly SIYUAN_OPENURL: string = "siyuan-openurl";
|
public static readonly SIYUAN_SEND_WINDOWS: string = "siyuan-send-windows"; // 主窗口和各新窗口之间的通信,{cmd: "closetab"|"lockscreen"|"lockscreenByMode", data: {}})
|
||||||
public static readonly SIYUAN_OPENWINDOW: string = "siyuan-openwindow";
|
|
||||||
public static readonly SIYUAN_SEND_WINDOWS: string = "siyuan-send_windows"; // 主窗口和各新窗口之间的通信,{cmd: "closetab"|"lockscreen"|"lockscreenByMode", data: {}})
|
|
||||||
public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
|
public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
|
||||||
|
public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
|
||||||
|
|
||||||
|
public static readonly SIYUAN_OPEN_WORKSPACE: string = "siyuan-open-workspace";
|
||||||
|
public static readonly SIYUAN_OPEN_URL: string = "siyuan-open-url";
|
||||||
|
public static readonly SIYUAN_OPEN_WINDOW: string = "siyuan-open-window";
|
||||||
|
public static readonly SIYUAN_OPEN_FOLDER: string = "siyuan-open-folder";
|
||||||
|
|
||||||
public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
|
public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
|
||||||
public static readonly SIYUAN_EXPORT_CLOSE: string = "siyuan-export-close";
|
public static readonly SIYUAN_EXPORT_CLOSE: string = "siyuan-export-close";
|
||||||
public static readonly SIYUAN_EXPORT_PREVENT: string = "siyuan-export-prevent";
|
public static readonly SIYUAN_EXPORT_PREVENT: string = "siyuan-export-prevent";
|
||||||
public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
|
|
||||||
|
|
||||||
// custom
|
// custom
|
||||||
public static readonly CUSTOM_SY_READONLY: string = "custom-sy-readonly";
|
public static readonly CUSTOM_SY_READONLY: string = "custom-sy-readonly";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {Wnd} from "../layout/Wnd";
|
||||||
import {getDockByType, getInstanceById, getWndByLayout, pdfIsLoading, setPanelFocus} from "../layout/util";
|
import {getDockByType, getInstanceById, getWndByLayout, pdfIsLoading, setPanelFocus} from "../layout/util";
|
||||||
import {getAllModels, getAllTabs} from "../layout/getAll";
|
import {getAllModels, getAllTabs} from "../layout/getAll";
|
||||||
import {highlightById, scrollCenter} from "../util/highlightById";
|
import {highlightById, scrollCenter} from "../util/highlightById";
|
||||||
import {getDisplayName, pathPosix} from "../util/pathName";
|
import {getDisplayName, pathPosix, showFileInFolder} from "../util/pathName";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {setEditMode} from "../protyle/util/setEditMode";
|
import {setEditMode} from "../protyle/util/setEditMode";
|
||||||
import {Files} from "../layout/dock/Files";
|
import {Files} from "../layout/dock/Files";
|
||||||
|
|
@ -668,7 +668,7 @@ export const openBy = (url: string, type: "folder" | "app") => {
|
||||||
if (type === "app") {
|
if (type === "app") {
|
||||||
shell.openPath(response.data);
|
shell.openPath(response.data);
|
||||||
} else if (type === "folder") {
|
} else if (type === "folder") {
|
||||||
shell.showItemInFolder(response.data);
|
showFileInFolder(response.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -691,7 +691,7 @@ export const openBy = (url: string, type: "folder" | "app") => {
|
||||||
address = address.replace(/\\\\/g, "\\");
|
address = address.replace(/\\\\/g, "\\");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shell.showItemInFolder(address);
|
showFileInFolder(address);
|
||||||
}
|
}
|
||||||
/// #endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {dialog} from "@electron/remote";
|
import {dialog} from "@electron/remote";
|
||||||
import {SaveDialogReturnValue} from "electron";
|
import {SaveDialogReturnValue} from "electron";
|
||||||
import {shell} from "electron";
|
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {getAssetName, pathPosix} from "../util/pathName";
|
import {getAssetName, pathPosix, showFileInFolder} from "../util/pathName";
|
||||||
import {openFileById} from "../editor/util";
|
import {openFileById} from "../editor/util";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {openNewWindowById} from "../window/openNewWindow";
|
import {openNewWindowById} from "../window/openNewWindow";
|
||||||
|
|
@ -86,10 +85,10 @@ export const openEditorTab = (app: App, id: string, notebookId?: string, pathStr
|
||||||
label: window.siyuan.languages.showInFolder,
|
label: window.siyuan.languages.showInFolder,
|
||||||
click: () => {
|
click: () => {
|
||||||
if (notebookId) {
|
if (notebookId) {
|
||||||
shell.showItemInFolder(path.join(window.siyuan.config.system.dataDir, notebookId, pathString));
|
showFileInFolder(path.join(window.siyuan.config.system.dataDir, notebookId, pathString));
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/block/getBlockInfo", {id}, (response) => {
|
fetchPost("/api/block/getBlockInfo", {id}, (response) => {
|
||||||
shell.showItemInFolder(path.join(window.siyuan.config.system.dataDir, response.data.box, response.data.path));
|
showFileInFolder(path.join(window.siyuan.config.system.dataDir, response.data.box, response.data.path));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import {MenuItem} from "./Menu";
|
import {MenuItem} from "./Menu";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {dialog, getCurrentWindow} from "@electron/remote";
|
import {dialog, getCurrentWindow} from "@electron/remote";
|
||||||
import {ipcRenderer, shell} from "electron";
|
import {ipcRenderer} from "electron";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {openHistory} from "../history/history";
|
import {openHistory} from "../history/history";
|
||||||
import {getOpenNotebookCount, originalPath, pathPosix} from "../util/pathName";
|
import {getOpenNotebookCount, originalPath, pathPosix, showFileInFolder} from "../util/pathName";
|
||||||
import {mountHelp, newDailyNote} from "../util/mount";
|
import {mountHelp, newDailyNote} from "../util/mount";
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
|
|
@ -449,7 +449,7 @@ const workspaceItem = (item: IWorkspace) => {
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: window.siyuan.languages.showInFolder,
|
label: window.siyuan.languages.showInFolder,
|
||||||
click() {
|
click() {
|
||||||
shell.showItemInFolder(item.path);
|
showFileInFolder(item.path);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import {Constants} from "../../constants";
|
||||||
import {highlightRender} from "../render/highlightRender";
|
import {highlightRender} from "../render/highlightRender";
|
||||||
import {processRender} from "../util/processCode";
|
import {processRender} from "../util/processCode";
|
||||||
import {openByMobile, setStorageVal} from "../util/compatibility";
|
import {openByMobile, setStorageVal} from "../util/compatibility";
|
||||||
|
import {showFileInFolder} from "../../util/pathName";
|
||||||
|
|
||||||
export const afterExport = (exportPath: string, msgId: string) => {
|
export const afterExport = (exportPath: string, msgId: string) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
|
|
@ -19,7 +20,7 @@ export const afterExport = (exportPath: string, msgId: string) => {
|
||||||
<div class="fn__space"></div>
|
<div class="fn__space"></div>
|
||||||
<button class="b3-button b3-button--white">${window.siyuan.languages.showInFolder}</button>`, 6000, "info", msgId);
|
<button class="b3-button b3-button--white">${window.siyuan.languages.showInFolder}</button>`, 6000, "info", msgId);
|
||||||
document.querySelector(`#message [data-id="${msgId}"] button`).addEventListener("click", () => {
|
document.querySelector(`#message [data-id="${msgId}"] button`).addEventListener("click", () => {
|
||||||
shell.showItemInFolder(path.join(exportPath));
|
showFileInFolder(path.join(exportPath));
|
||||||
hideMessage(msgId);
|
hideMessage(msgId);
|
||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import * as path from "path";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {openCardByData} from "../../card/openCard";
|
import {openCardByData} from "../../card/openCard";
|
||||||
import {viewCards} from "../../card/viewCards";
|
import {viewCards} from "../../card/viewCards";
|
||||||
import {getDisplayName, getNotebookName, pathPosix} from "../../util/pathName";
|
import {getDisplayName, getNotebookName, pathPosix, showFileInFolder} from "../../util/pathName";
|
||||||
import {makeCard, quickMakeCard} from "../../card/makeCard";
|
import {makeCard, quickMakeCard} from "../../card/makeCard";
|
||||||
import {emitOpenMenu} from "../../plugin/EventBus";
|
import {emitOpenMenu} from "../../plugin/EventBus";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
|
|
@ -247,7 +247,7 @@ export const openTitleMenu = (protyle: IProtyle, position: {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.showInFolder,
|
label: window.siyuan.languages.showInFolder,
|
||||||
click: () => {
|
click: () => {
|
||||||
shell.showItemInFolder(path.join(window.siyuan.config.system.dataDir, protyle.notebookId, protyle.path));
|
showFileInFolder(path.join(window.siyuan.config.system.dataDir, protyle.notebookId, protyle.path));
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import {getQueryTip} from "./util";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {MenuItem} from "../menus/Menu";
|
import {MenuItem} from "../menus/Menu";
|
||||||
import {Dialog} from "../dialog";
|
import {Dialog} from "../dialog";
|
||||||
|
import {showFileInFolder} from "../util/pathName";
|
||||||
|
|
||||||
export const openSearchAsset = (element: Element, isStick: boolean) => {
|
export const openSearchAsset = (element: Element, isStick: boolean) => {
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
|
|
@ -135,7 +136,7 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
|
||||||
if (!isHistory) {
|
if (!isHistory) {
|
||||||
if (currentList) {
|
if (currentList) {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
shell.showItemInFolder(path.join(window.siyuan.config.system.dataDir, currentList.lastElementChild.getAttribute("aria-label")));
|
showFileInFolder(path.join(window.siyuan.config.system.dataDir, currentList.lastElementChild.getAttribute("aria-label")));
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,14 @@ import {openFile, openFileById} from "../editor/util";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
import {reloadProtyle} from "../protyle/util/reload";
|
import {reloadProtyle} from "../protyle/util/reload";
|
||||||
import {MenuItem} from "../menus/Menu";
|
import {MenuItem} from "../menus/Menu";
|
||||||
import {getDisplayName, getNotebookIcon, getNotebookName, movePathTo, pathPosix} from "../util/pathName";
|
import {
|
||||||
|
getDisplayName,
|
||||||
|
getNotebookIcon,
|
||||||
|
getNotebookName,
|
||||||
|
movePathTo,
|
||||||
|
pathPosix,
|
||||||
|
showFileInFolder
|
||||||
|
} from "../util/pathName";
|
||||||
import {Protyle} from "../protyle";
|
import {Protyle} from "../protyle";
|
||||||
import {onGet} from "../protyle/util/onGet";
|
import {onGet} from "../protyle/util/onGet";
|
||||||
import {addLoading} from "../protyle/ui/initUI";
|
import {addLoading} from "../protyle/ui/initUI";
|
||||||
|
|
@ -796,7 +803,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
||||||
clearTimeout(clickTimeout);
|
clearTimeout(clickTimeout);
|
||||||
if (isAsset) {
|
if (isAsset) {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
shell.showItemInFolder(path.join(window.siyuan.config.system.dataDir, target.lastElementChild.getAttribute("aria-label")));
|
showFileInFolder(path.join(window.siyuan.config.system.dataDir, target.lastElementChild.getAttribute("aria-label")));
|
||||||
/// #endif
|
/// #endif
|
||||||
} else {
|
} else {
|
||||||
const id = target.getAttribute("data-node-id");
|
const id = target.getAttribute("data-node-id");
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,17 @@ import {getSearch, isMobile} from "./functions";
|
||||||
import {focusByRange} from "../protyle/util/selection";
|
import {focusByRange} from "../protyle/util/selection";
|
||||||
import {unicode2Emoji} from "../emoji";
|
import {unicode2Emoji} from "../emoji";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
|
/// #if !BROWSER
|
||||||
|
import {ipcRenderer} from "electron";
|
||||||
|
/// #endif
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
|
|
||||||
|
export const showFileInFolder = (filePath: string) => {
|
||||||
|
/// #if !BROWSER
|
||||||
|
ipcRenderer.send(Constants.SIYUAN_OPEN_FOLDER, filePath);
|
||||||
|
/// #endif
|
||||||
|
};
|
||||||
|
|
||||||
export const getIdZoomInByPath = () => {
|
export const getIdZoomInByPath = () => {
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const PWAURL = searchParams.get("url");
|
const PWAURL = searchParams.get("url");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export const openNewWindow = (tab: Tab, options: windowOptions = {}) => {
|
||||||
const json = {};
|
const json = {};
|
||||||
layoutToJSON(tab, json);
|
layoutToJSON(tab, json);
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
ipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {
|
ipcRenderer.send(Constants.SIYUAN_OPEN_WINDOW, {
|
||||||
position: options.position,
|
position: options.position,
|
||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
|
|
@ -61,7 +61,7 @@ export const openNewWindowById = (id: string, options: windowOptions = {}) => {
|
||||||
json.children.scrollAttr.rootId = response.data.rootID;
|
json.children.scrollAttr.rootId = response.data.rootID;
|
||||||
}
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
ipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {
|
ipcRenderer.send(Constants.SIYUAN_OPEN_WINDOW, {
|
||||||
position: options.position,
|
position: options.position,
|
||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
|
|
@ -76,7 +76,7 @@ export const openNewWindowById = (id: string, options: windowOptions = {}) => {
|
||||||
zoomInId: id,
|
zoomInId: id,
|
||||||
};
|
};
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
ipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {
|
ipcRenderer.send(Constants.SIYUAN_OPEN_WINDOW, {
|
||||||
position: options.position,
|
position: options.position,
|
||||||
width: options.width,
|
width: options.width,
|
||||||
height: options.height,
|
height: options.height,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue