mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-09 17:51:27 +08:00
This commit is contained in:
parent
0b6b729ab5
commit
233b64e85d
@ -667,8 +667,19 @@ app.whenReady().then(() => {
|
||||
ipcMain.on("siyuan-show", (event) => {
|
||||
showWindow(getWindowByContentId(event.sender.id));
|
||||
});
|
||||
ipcMain.on("siyuan-hide", (event) => {
|
||||
getWindowByContentId(event.sender.id).hide();
|
||||
ipcMain.on("siyuan-cmd", (event, cmd) => {
|
||||
console.log(cmd)
|
||||
switch (cmd) {
|
||||
case "hide":
|
||||
getWindowByContentId(event.sender.id).hide();
|
||||
break;
|
||||
case "redo":
|
||||
event.sender.redo();
|
||||
break;
|
||||
case "undo":
|
||||
event.sender.undo();
|
||||
break;
|
||||
}
|
||||
});
|
||||
ipcMain.on("siyuan-config-tray", (event, data) => {
|
||||
workspaces.find(item => {
|
||||
|
@ -25,7 +25,7 @@ export abstract class Constants {
|
||||
|
||||
// 渲染进程调主进程
|
||||
public static readonly SIYUAN_SHOW: string = "siyuan-show";
|
||||
public static readonly SIYUAN_HIDE: string = "siyuan-hide";
|
||||
public static readonly SIYUAN_CMD: string = "siyuan-cmd";
|
||||
|
||||
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
|
||||
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
||||
|
@ -199,7 +199,7 @@ export const exitSiYuan = () => {
|
||||
// 桌面端退出拉起更新安装时有时需要重启两次 https://github.com/siyuan-note/siyuan/issues/6544
|
||||
// 这里先将主界面隐藏
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send(Constants.SIYUAN_HIDE);
|
||||
ipcRenderer.send(Constants.SIYUAN_CMD, "hide");
|
||||
}, 2000);
|
||||
// 然后等待一段时间后再退出,避免界面主进程退出以后内核子进程被杀死
|
||||
setTimeout(() => {
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
openFileAttr,
|
||||
} from "../../menus/commonMenuItem";
|
||||
/// #if !BROWSER
|
||||
import {getCurrentWindow} from "@electron/remote";
|
||||
import { ipcRenderer } from "electron";
|
||||
/// #endif
|
||||
import {Constants} from "../../constants";
|
||||
import {matchHotKey} from "../util/hotKey";
|
||||
@ -99,13 +99,13 @@ export class Title {
|
||||
}
|
||||
/// #if !BROWSER
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) {
|
||||
getCurrentWindow().webContents.undo();
|
||||
ipcRenderer.send(Constants.SIYUAN_CMD, "undo");
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {
|
||||
getCurrentWindow().webContents.redo();
|
||||
ipcRenderer.send(Constants.SIYUAN_CMD, "redo");
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user