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 1815e14 commit 65c289c
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', '')

Check failure on line 34 in src/main/commands.ts

View workflow job for this annotation

GitHub Actions / Build

Object is possibly 'null'.
}
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 65c289c

Please sign in to comment.