double click to edit subtree

This commit is contained in:
codetypes committed 2024-03-13 00:28:37 +08:00
1 parent 6b5abae6a3
commit fed08a0f45
9 files changed
+176 -108

No files matched your search

+12 -2
View File
@@ -18,12 +18,18 @@ export class MainProcess {
nativeTheme.themeSource = "dark";
app.on("ready", () => {
this.createWindow();
electronLocalshortcut.register(this.mainWindow, "CommandOrControl+C", () => {
this.registerShortcut("CmdOrCtrl+C", () => {
this.mainWindow.webContents.send(MainEventType.COPY_NODE);
});
electronLocalshortcut.register(this.mainWindow, "CommandOrControl+V", () => {
this.registerShortcut("CmdOrCtrl+V", () => {
this.mainWindow.webContents.send(MainEventType.PASTE_NODE);
});
this.registerShortcut("CmdOrCtrl+Z", () => {
this.mainWindow.webContents.send(MainEventType.UNDO);
});
this.registerShortcut(process.platform === "darwin" ? "Cmd+Shift+Z" : "ctrl+y", () => {
this.mainWindow.webContents.send(MainEventType.REDO);
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
@@ -37,6 +43,10 @@ export class MainProcess {
});
}
registerShortcut(accelerator: string | string[], callback: () => void) {
electronLocalshortcut.register(this.mainWindow, accelerator, callback);
}
createWindow() {
this.settings = new Settings();
global.settings = this.settings;