@jupyter-notebook/notebook-extension 7.0.0-rc.0 → 7.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +31 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
import { DOMUtils, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
|
|
4
4
|
import { Text, Time } from '@jupyterlab/coreutils';
|
|
5
5
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
6
|
+
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
6
7
|
import { NotebookPanel, INotebookTracker, INotebookTools, } from '@jupyterlab/notebook';
|
|
7
8
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
8
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
9
|
+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
9
10
|
import { INotebookShell } from '@jupyter-notebook/application';
|
|
10
11
|
import { Poll } from '@lumino/polling';
|
|
11
12
|
import { Widget } from '@lumino/widgets';
|
|
@@ -79,6 +80,34 @@ const checkpoints = {
|
|
|
79
80
|
});
|
|
80
81
|
},
|
|
81
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Add a command to close the browser tab when clicking on "Close and Shut Down"
|
|
85
|
+
*/
|
|
86
|
+
const closeTab = {
|
|
87
|
+
id: '@jupyter-notebook/notebook-extension:close-tab',
|
|
88
|
+
autoStart: true,
|
|
89
|
+
requires: [IMainMenu],
|
|
90
|
+
optional: [ITranslator],
|
|
91
|
+
activate: (app, menu, translator) => {
|
|
92
|
+
const { commands } = app;
|
|
93
|
+
translator = translator !== null && translator !== void 0 ? translator : nullTranslator;
|
|
94
|
+
const trans = translator.load('notebook');
|
|
95
|
+
const id = 'notebook:close-and-halt';
|
|
96
|
+
commands.addCommand(id, {
|
|
97
|
+
label: trans.__('Close and Shut Down Notebook'),
|
|
98
|
+
execute: async () => {
|
|
99
|
+
await commands.execute('notebook:close-and-shutdown');
|
|
100
|
+
window.close();
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
menu.fileMenu.closeAndCleaners.add({
|
|
104
|
+
id,
|
|
105
|
+
// use a small rank to it takes precedence over the default
|
|
106
|
+
// shut down action for the notebook
|
|
107
|
+
rank: 0,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
};
|
|
82
111
|
/**
|
|
83
112
|
* The kernel logo plugin.
|
|
84
113
|
*/
|
|
@@ -308,6 +337,7 @@ const trusted = {
|
|
|
308
337
|
*/
|
|
309
338
|
const plugins = [
|
|
310
339
|
checkpoints,
|
|
340
|
+
closeTab,
|
|
311
341
|
kernelLogo,
|
|
312
342
|
kernelStatus,
|
|
313
343
|
scrollOutput,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/notebook-extension",
|
|
3
|
-
"version": "7.0.0-rc.
|
|
3
|
+
"version": "7.0.0-rc.2",
|
|
4
4
|
"description": "Jupyter Notebook - Notebook Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"watch": "tsc -b --watch"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jupyter-notebook/application": "^7.0.0-rc.
|
|
41
|
+
"@jupyter-notebook/application": "^7.0.0-rc.2",
|
|
42
42
|
"@jupyterlab/application": "^4.0.2",
|
|
43
43
|
"@jupyterlab/apputils": "^4.1.2",
|
|
44
44
|
"@jupyterlab/cells": "^4.0.2",
|