@jupyter-notebook/notebook-extension 7.0.0-beta.4 → 7.0.0-rc.1

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.
Files changed (2) hide show
  1. package/lib/index.js +35 -3
  2. package/package.json +9 -9
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
  */
@@ -274,7 +303,7 @@ const notebookToolsWidget = {
274
303
  }
275
304
  // Add the notebook tools in right area.
276
305
  if (notebookTools) {
277
- shell.add(notebookTools, 'right');
306
+ shell.add(notebookTools, 'right', { type: 'Property Inspector' });
278
307
  }
279
308
  };
280
309
  shell.currentChanged.connect(onChange);
@@ -296,7 +325,9 @@ const trusted = {
296
325
  const notebook = current.content;
297
326
  await current.context.ready;
298
327
  const widget = TrustedComponent.create({ notebook, translator });
299
- notebookShell.add(widget, 'menu', { rank: 11000 });
328
+ notebookShell.add(widget, 'menu', {
329
+ rank: 11000,
330
+ });
300
331
  };
301
332
  notebookShell.currentChanged.connect(onChange);
302
333
  },
@@ -306,6 +337,7 @@ const trusted = {
306
337
  */
307
338
  const plugins = [
308
339
  checkpoints,
340
+ closeTab,
309
341
  kernelLogo,
310
342
  kernelStatus,
311
343
  scrollOutput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/notebook-extension",
3
- "version": "7.0.0-beta.4",
3
+ "version": "7.0.0-rc.1",
4
4
  "description": "Jupyter Notebook - Notebook Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -38,14 +38,14 @@
38
38
  "watch": "tsc -b --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@jupyter-notebook/application": "^7.0.0-beta.4",
42
- "@jupyterlab/application": "^4.0.1",
43
- "@jupyterlab/apputils": "^4.1.1",
44
- "@jupyterlab/cells": "^4.0.1",
45
- "@jupyterlab/docmanager": "^4.0.1",
46
- "@jupyterlab/notebook": "^4.0.1",
47
- "@jupyterlab/settingregistry": "^4.0.1",
48
- "@jupyterlab/translation": "^4.0.1",
41
+ "@jupyter-notebook/application": "^7.0.0-rc.1",
42
+ "@jupyterlab/application": "^4.0.2",
43
+ "@jupyterlab/apputils": "^4.1.2",
44
+ "@jupyterlab/cells": "^4.0.2",
45
+ "@jupyterlab/docmanager": "^4.0.2",
46
+ "@jupyterlab/notebook": "^4.0.2",
47
+ "@jupyterlab/settingregistry": "^4.0.2",
48
+ "@jupyterlab/translation": "^4.0.2",
49
49
  "@lumino/polling": "^2.1.1",
50
50
  "@lumino/widgets": "^2.1.1"
51
51
  },