From 65c289cc79020c5dba69a99b411dc486187589f9 Mon Sep 17 00:00:00 2001 From: XuluWarrior Date: Mon, 23 Sep 2024 01:35:33 +0200 Subject: [PATCH] Clear editor file menu item --- src/main/commands.ts | 4 ++++ src/main/menus.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/commands.ts b/src/main/commands.ts index 872c0f2..16480b7 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' } ]