mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +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", () => {
|
ipcMain.on("siyuan-first-quit", () => {
|
||||||
app.exit();
|
app.exit();
|
||||||
});
|
});
|
||||||
|
ipcMain.handle("siyuan-dialog", (event, data) => {
|
||||||
|
return dialog.showOpenDialog(data);
|
||||||
|
});
|
||||||
ipcMain.on("siyuan-cmd", (event, cmd) => {
|
ipcMain.on("siyuan-cmd", (event, cmd) => {
|
||||||
console.log(cmd)
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "openDevTools":
|
case "openDevTools":
|
||||||
event.sender.openDevTools({mode: "bottom"});
|
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_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_CONFIG_TRAY: string = "siyuan-config-tray";
|
||||||
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import {copySubMenu, exportMd, movePathToMenu, openFileAttr, renameMenu,} from "./commonMenuItem";
|
import {copySubMenu, exportMd, movePathToMenu, openFileAttr, renameMenu,} from "./commonMenuItem";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {FileFilter, shell} from "electron";
|
import {FileFilter, ipcRenderer, shell} from "electron";
|
||||||
import {dialog as remoteDialog} from "@electron/remote";
|
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {MenuItem} from "./Menu";
|
import {MenuItem} from "./Menu";
|
||||||
|
|
@ -643,7 +642,7 @@ export const genImportMenu = (notebookId: string, pathString: string) => {
|
||||||
if (isDoc) {
|
if (isDoc) {
|
||||||
filters = [{name: "Markdown", extensions: ["md", "markdown"]}];
|
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,
|
defaultPath: window.siyuan.config.system.homeDir,
|
||||||
filters,
|
filters,
|
||||||
properties: [isDoc ? "openFile" : "openDirectory"],
|
properties: [isDoc ? "openFile" : "openDirectory"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue