MCPcopy
hub / github.com/wellsjo/JSON-Splora / createTemplate

Method createTemplate

app/js/system/MainMenu.js:37–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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: () => {

Callers 1

constructorMethod · 0.95

Calls 5

createThemeSubMenuMethod · 0.95
newTabMethod · 0.80
removeTabMethod · 0.80
formatMethod · 0.80
minifyMethod · 0.80

Tested by

no test coverage detected