Skip to content

Commit

Permalink
Clear editor file menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
XuluWarrior committed Sep 22, 2024
1 parent 46ca802 commit a65c1a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ export async function importFile() {
}
}
}

export async function clearEditor() {
BrowserWindow.getFocusedWindow()!.webContents.send('update-spec', '')
}
6 changes: 5 additions & 1 deletion src/main/menus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Menu, shell } from 'electron'

import { importFile } from "./commands";
import { clearEditor, importFile } from "./commands";

const isMac = process.platform === 'darwin'

Expand All @@ -13,6 +13,10 @@ const template = [
label: 'Import file',
click: importFile
},
{
label: 'Clear editor',
click: clearEditor
},
{ type: 'separator' },
isMac ? { role: 'close' } : { role: 'quit' }
]
Expand Down

0 comments on commit a65c1a6

Please sign in to comment.