Integrating with the application menu

In this section, we are going to provide support for the application menu. For the sake of simplicity, let's integrate the Open and Save features for now and extend the menu as we introduce new features to the application:

You can find out more about how to work with menus in Chapter 2, Building a Markdown Editor. Examples are also provided.
  1. In the project root folder, create a menu.js file with the following content:
const { Menu, BrowserWindow, dialog } = require('electron');const fs = require('fs');module.exports = Menu.buildFromTemplate([  {    label: 'File',    submenu: [      {        label: 'Open',        accelerator: 'CommandOrControl+O',        click() {          loadFile();        }      },      {        label: 'Save', accelerator: 'CommandOrControl+S', ...

Get Electron Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.