diff --git a/src/main/commands.ts b/src/main/commands.ts index f999792..6170ec2 100644 --- a/src/main/commands.ts +++ b/src/main/commands.ts @@ -29,3 +29,7 @@ export async function importFile() { } } } + +export async function clearEditor() { + BrowserWindow.getFocusedWindow()!.webContents.send('update-spec', '') +} diff --git a/src/main/menus.ts b/src/main/menus.ts index 941a317..7b25def 100644 --- a/src/main/menus.ts +++ b/src/main/menus.ts @@ -1,6 +1,6 @@ import { Menu, shell } from 'electron' -import { importFile } from "./commands"; +import { clearEditor, importFile } from "./commands"; const isMac = process.platform === 'darwin' @@ -13,6 +13,10 @@ const template = [ label: 'Import file', click: importFile }, + { + label: 'Clear editor', + click: clearEditor + }, { type: 'separator' }, isMac ? { role: 'close' } : { role: 'quit' } ]