()
| 35 | } |
| 36 | |
| 37 | createTemplate() { |
| 38 | const template = [{ |
| 39 | label: 'File', |
| 40 | submenu: [{ |
| 41 | label: 'Open', |
| 42 | accelerator: 'CommandOrControl+O', |
| 43 | click: () => { |
| 44 | dialog.showOpenDialog( |
| 45 | BrowserWindow.getFocusedWindow() || BrowserWindow.getAllWindows()[0], |
| 46 | { filters: [{ name: 'JSON Files', extensions: ['json'] }, { name: 'All Files', extensions: ['*'] }] }, |
| 47 | (filePaths) => { |
| 48 | window.app = this.app |
| 49 | this.app.tabs.newTab(fs.readFileSync(filePaths[0], 'utf8'), 0) |
| 50 | } |
| 51 | ) |
| 52 | } |
| 53 | }, { |
| 54 | label: 'New Tab', |
| 55 | accelerator: 'CommandOrControl+t', |
| 56 | click: () => { |
| 57 | window.app = this.app |
| 58 | this.app.tabs.newTab() |
| 59 | } |
| 60 | }, { |
| 61 | label: 'Close Tab', |
| 62 | accelerator: 'CommandOrControl+w', |
| 63 | click: () => { |
| 64 | window.app = this.app |
| 65 | this.app.tabs.removeTab() |
| 66 | } |
| 67 | }] }, { |
| 68 | label: 'Edit', |
| 69 | submenu: [{ |
| 70 | role: 'undo' |
| 71 | }, { |
| 72 | role: 'redo' |
| 73 | }, { |
| 74 | type: 'separator' |
| 75 | }, { |
| 76 | role: 'cut' |
| 77 | }, { |
| 78 | role: 'copy' |
| 79 | }, { |
| 80 | role: 'paste' |
| 81 | }, { |
| 82 | role: 'selectall' |
| 83 | }, { |
| 84 | type: 'separator' |
| 85 | }, { |
| 86 | label: 'Format', |
| 87 | accelerator: 'CommandOrControl+Shift+F', |
| 88 | click: () => { |
| 89 | this.app.getCurrentPage().editor.format() |
| 90 | } |
| 91 | }, { |
| 92 | label: 'Minify', |
| 93 | accelerator: 'CommandOrControl+Shift+M', |
| 94 | click: () => { |
no test coverage detected