Now that you have got the Open File functionality and registered the global keyboard shortcut for it, let's see what it takes to load a file from the local filesystem back into the editor component:
- Let's start by updating the menu.js file and registering a second global shortcut for Cmd + O or Ctrl + O, depending on the user's desktop platform:
globalShortcut.register('CommandOrControl+O', () => { // show open dialog });
We have already imported the dialog object from the Electron framework. You can use it to invoke the system's Open dialog as well.
- Update the menu.js file according to the following code:
globalShortcut.register('CommandOrControl+O', () => { const window = BrowserWindow.getFocusedWindow(); ...