@jupyter-notebook/lab-extension 7.0.3 → 7.0.4

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 +14 -8
  2. package/package.json +10 -10
package/lib/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { ILabShell, } from '@jupyterlab/application';
4
4
  import { ICommandPalette, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
5
- import { PageConfig } from '@jupyterlab/coreutils';
5
+ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
6
6
  import { INotebookTracker } from '@jupyterlab/notebook';
7
7
  import { ITranslator } from '@jupyterlab/translation';
8
8
  import { Menu, MenuBar } from '@lumino/widgets';
9
- import { INotebookShell } from '@jupyter-notebook/application';
9
+ import { defaultNotebookPathOpener, INotebookPathOpener, INotebookShell, } from '@jupyter-notebook/application';
10
10
  import { caretDownIcon, CommandToolbarButton, launchIcon, } from '@jupyterlab/ui-components';
11
11
  /**
12
12
  * The command IDs used by the application plugin.
@@ -39,24 +39,26 @@ const interfaceSwitcher = {
39
39
  requires: [ITranslator, INotebookTracker],
40
40
  optional: [
41
41
  ICommandPalette,
42
+ INotebookPathOpener,
42
43
  INotebookShell,
43
44
  ILabShell,
44
45
  IToolbarWidgetRegistry,
45
46
  ],
46
- activate: (app, translator, notebookTracker, palette, notebookShell, labShell, toolbarRegistry) => {
47
+ activate: (app, translator, notebookTracker, palette, notebookPathOpener, notebookShell, labShell, toolbarRegistry) => {
47
48
  const { commands, shell } = app;
48
49
  const baseUrl = PageConfig.getBaseUrl();
49
50
  const trans = translator.load('notebook');
50
51
  const nbClassicEnabled = PageConfig.getOption('nbclassic_enabled') === 'true';
51
52
  const switcher = new Menu({ commands });
52
53
  const switcherOptions = [];
54
+ const opener = notebookPathOpener !== null && notebookPathOpener !== void 0 ? notebookPathOpener : defaultNotebookPathOpener;
53
55
  if (!notebookShell) {
54
56
  switcherOptions.push({
55
57
  command: CommandIDs.openNotebook,
56
58
  commandLabel: trans.__('Notebook'),
57
59
  commandDescription: trans.__('Open in %1', 'Jupyter Notebook'),
58
60
  buttonLabel: 'openNotebook',
59
- urlPrefix: `${baseUrl}tree/`,
61
+ urlPrefix: `${baseUrl}tree`,
60
62
  });
61
63
  }
62
64
  if (!labShell) {
@@ -65,7 +67,7 @@ const interfaceSwitcher = {
65
67
  commandLabel: trans.__('JupyterLab'),
66
68
  commandDescription: trans.__('Open in %1', 'JupyterLab'),
67
69
  buttonLabel: 'openLab',
68
- urlPrefix: `${baseUrl}doc/tree/`,
70
+ urlPrefix: `${baseUrl}doc/tree`,
69
71
  });
70
72
  }
71
73
  if (nbClassicEnabled) {
@@ -74,7 +76,7 @@ const interfaceSwitcher = {
74
76
  commandLabel: trans.__('NbClassic'),
75
77
  commandDescription: trans.__('Open in %1', 'NbClassic'),
76
78
  buttonLabel: 'openNbClassic',
77
- urlPrefix: `${baseUrl}nbclassic/notebooks/`,
79
+ urlPrefix: `${baseUrl}nbclassic/notebooks`,
78
80
  });
79
81
  }
80
82
  const isEnabled = () => {
@@ -88,7 +90,10 @@ const interfaceSwitcher = {
88
90
  if (!current) {
89
91
  return;
90
92
  }
91
- window.open(`${urlPrefix}${current.context.path}`);
93
+ opener.open({
94
+ prefix: urlPrefix,
95
+ path: current.context.path,
96
+ });
92
97
  };
93
98
  commands.addCommand(command, {
94
99
  label: (args) => {
@@ -163,7 +168,8 @@ const launchNotebookTree = {
163
168
  commands.addCommand(CommandIDs.launchNotebookTree, {
164
169
  label: trans.__('Launch Jupyter Notebook File Browser'),
165
170
  execute: () => {
166
- window.open(PageConfig.getBaseUrl() + 'tree');
171
+ const url = URLExt.join(PageConfig.getBaseUrl(), 'tree');
172
+ window.open(url);
167
173
  },
168
174
  });
169
175
  if (palette) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/lab-extension",
3
- "version": "7.0.3",
3
+ "version": "7.0.4",
4
4
  "description": "Jupyter Notebook - Lab Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -43,19 +43,19 @@
43
43
  "watch:src": "tsc -w"
44
44
  },
45
45
  "dependencies": {
46
- "@jupyter-notebook/application": "^7.0.3",
47
- "@jupyterlab/application": "^4.0.5",
48
- "@jupyterlab/apputils": "^4.1.5",
49
- "@jupyterlab/coreutils": "^6.0.5",
50
- "@jupyterlab/docregistry": "^4.0.5",
51
- "@jupyterlab/notebook": "^4.0.5",
52
- "@jupyterlab/translation": "^4.0.5",
53
- "@jupyterlab/ui-components": "^4.0.5",
46
+ "@jupyter-notebook/application": "^7.0.4",
47
+ "@jupyterlab/application": "^4.0.6",
48
+ "@jupyterlab/apputils": "^4.1.6",
49
+ "@jupyterlab/coreutils": "^6.0.6",
50
+ "@jupyterlab/docregistry": "^4.0.6",
51
+ "@jupyterlab/notebook": "^4.0.6",
52
+ "@jupyterlab/translation": "^4.0.6",
53
+ "@jupyterlab/ui-components": "^4.0.6",
54
54
  "@lumino/commands": "^2.1.3",
55
55
  "@lumino/disposable": "^2.1.2"
56
56
  },
57
57
  "devDependencies": {
58
- "@jupyterlab/builder": "^4.0.5",
58
+ "@jupyterlab/builder": "^4.0.6",
59
59
  "rimraf": "^3.0.2",
60
60
  "typescript": "~5.0.2"
61
61
  },