Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 3a593b7

Browse files
committed
fix(packages/core): menu.ts assumes the client defines a list of notebooks
Fixes #6962
1 parent 626c419 commit 3a593b7

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/core/src/main/menu.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-18 IBM Corporation
2+
* Copyright 2017-21 IBM Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -133,7 +133,7 @@ export const install = (createWindow: (executeThisArgvPlease?: string[]) => void
133133
}
134134
]
135135

136-
const menuTemplate: MenuItemConstructorOptions[] = [
136+
const fileMenu: MenuItemConstructorOptions[] = [
137137
{
138138
label: 'File',
139139
submenu: fileMenuItems
@@ -151,8 +151,10 @@ export const install = (createWindow: (executeThisArgvPlease?: string[]) => void
151151
{ role: 'delete' },
152152
{ role: 'selectAll' }
153153
]
154-
},
154+
}
155+
]
155156

157+
const viewMenu: MenuItemConstructorOptions[] = [
156158
{
157159
label: 'View',
158160
submenu: [
@@ -171,8 +173,10 @@ export const install = (createWindow: (executeThisArgvPlease?: string[]) => void
171173
{ type: 'separator' },
172174
{ role: 'togglefullscreen' }
173175
]
174-
},
175-
notebookMenuItem,
176+
}
177+
]
178+
179+
const windowMenu: MenuItemConstructorOptions[] = [
176180
{
177181
role: 'window',
178182
submenu: [{ role: 'minimize' }, { role: 'close', accelerator: closeAccelerator }]
@@ -184,6 +188,11 @@ export const install = (createWindow: (executeThisArgvPlease?: string[]) => void
184188
}
185189
]
186190

191+
const menuTemplate: MenuItemConstructorOptions[] = fileMenu
192+
.concat(viewMenu)
193+
.concat(notebookMenuItem ? [notebookMenuItem] : [])
194+
.concat(windowMenu)
195+
187196
const about: MenuItemConstructorOptions = {
188197
label: `About ${productName}`,
189198
click: () => {

0 commit comments

Comments
 (0)