UNPKG

1.31 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';
5import { SemanticCommand } from '@jupyterlab/apputils';
6/**
7 * An extensible FileMenu for the application.
8 */
9export class FileMenu extends RankedMenu {
10 constructor(options) {
11 super(options);
12 this.quitEntry = false;
13 this.closeAndCleaners = new SemanticCommand();
14 this.consoleCreators = new SemanticCommand();
15 }
16 /**
17 * The New submenu.
18 */
19 get newMenu() {
20 var _a, _b;
21 if (!this._newMenu) {
22 this._newMenu =
23 (_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({
24 commands: this.commands
25 });
26 }
27 return this._newMenu;
28 }
29 /**
30 * Dispose of the resources held by the file menu.
31 */
32 dispose() {
33 var _a;
34 (_a = this._newMenu) === null || _a === void 0 ? void 0 : _a.dispose();
35 super.dispose();
36 }
37}
38//# sourceMappingURL=file.js.map
\No newline at end of file