mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
0ee6f5299e
commit
844c5ce688
3 changed files with 6 additions and 4 deletions
|
|
@ -664,8 +664,10 @@ app.whenReady().then(() => {
|
|||
ipcMain.on("siyuan-first-quit", () => {
|
||||
app.exit();
|
||||
});
|
||||
ipcMain.handle("siyuan-dialog", (event, data) => {
|
||||
return dialog.showOpenDialog(data);
|
||||
});
|
||||
ipcMain.on("siyuan-cmd", (event, cmd) => {
|
||||
console.log(cmd)
|
||||
switch (cmd) {
|
||||
case "openDevTools":
|
||||
event.sender.openDevTools({mode: "bottom"});
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export abstract class Constants {
|
|||
|
||||
// 渲染进程调主进程
|
||||
public static readonly SIYUAN_CMD: string = "siyuan-cmd";
|
||||
public static readonly SIYUAN_DIALOG: string = "siyuan-dialog";
|
||||
|
||||
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
|
||||
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import {copySubMenu, exportMd, movePathToMenu, openFileAttr, renameMenu,} from "./commonMenuItem";
|
||||
/// #if !BROWSER
|
||||
import {FileFilter, shell} from "electron";
|
||||
import {dialog as remoteDialog} from "@electron/remote";
|
||||
import {FileFilter, ipcRenderer, shell} from "electron";
|
||||
import * as path from "path";
|
||||
/// #endif
|
||||
import {MenuItem} from "./Menu";
|
||||
|
|
@ -643,7 +642,7 @@ export const genImportMenu = (notebookId: string, pathString: string) => {
|
|||
if (isDoc) {
|
||||
filters = [{name: "Markdown", extensions: ["md", "markdown"]}];
|
||||
}
|
||||
const localPath = await remoteDialog.showOpenDialog({
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG, {
|
||||
defaultPath: window.siyuan.config.system.homeDir,
|
||||
filters,
|
||||
properties: [isDoc ? "openFile" : "openDirectory"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue