UNPKG

1.29 kBJavaScriptView Raw
1// Copyright (c) Jupyter Development Team.
2// Distributed under the terms of the Modified BSD License.
3import { RankedMenu } from '@jupyterlab/ui-components';
4import { find } from '@lumino/algorithm';
5/**
6 * An extensible FileMenu for the application.
7 */
8export class FileMenu extends RankedMenu {
9 constructor(options) {
10 super(options);
11 this.quitEntry = false;
12 // Create the "New" submenu.
13 this.closeAndCleaners = new Set();
14 this.consoleCreators = new Set();
15 }
16 /**
17 * The New submenu.
18 */
19 get newMenu() {
20 var _a, _b;
21 if (!this._newMenu) {
22 this._newMenu = (_b = (_a = find(this.items, menu => { var _a; return ((_a = menu.submenu) === null || _a === void 0 ? void 0 : _a.id) === 'jp-mainmenu-file-new'; })) === null || _a === void 0 ? void 0 : _a.submenu) !== null && _b !== void 0 ? _b : new RankedMenu({
23 commands: this.commands
24 });
25 }
26 return this._newMenu;
27 }
28 /**
29 * Dispose of the resources held by the file menu.
30 */
31 dispose() {
32 var _a;
33 (_a = this._newMenu) === null || _a === void 0 ? void 0 : _a.dispose();
34 this.consoleCreators.clear();
35 super.dispose();
36 }
37}
38//# sourceMappingURL=file.js.map
\No newline at end of file