@jupyter-notebook/application-extension 7.0.2 → 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 +25 -9
  2. package/package.json +17 -17
package/lib/index.js CHANGED
@@ -10,7 +10,7 @@ import { IMainMenu } from '@jupyterlab/mainmenu';
10
10
  import { ILatexTypesetter, IMarkdownParser, IRenderMimeRegistry, RenderMimeRegistry, standardRendererFactories, } from '@jupyterlab/rendermime';
11
11
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
12
12
  import { ITranslator, nullTranslator } from '@jupyterlab/translation';
13
- import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette, } from '@jupyter-notebook/application';
13
+ import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette, INotebookPathOpener, defaultNotebookPathOpener, } from '@jupyter-notebook/application';
14
14
  import { jupyterIcon } from '@jupyter-notebook/ui-components';
15
15
  import { PromiseDelegate } from '@lumino/coreutils';
16
16
  import { DisposableDelegate, DisposableSet, } from '@lumino/disposable';
@@ -136,7 +136,7 @@ const opener = {
136
136
  const file = decodeURIComponent(path);
137
137
  const urlParams = new URLSearchParams(parsed.search);
138
138
  let defaultFactory = docRegistry.defaultWidgetFactory(path).name;
139
- // Explicitely get the default viewers from the settings because
139
+ // Explicitly get the default viewers from the settings because
140
140
  // JupyterLab might not have had the time to load the settings yet (race condition)
141
141
  // Relevant code: https://github.com/jupyterlab/jupyterlab/blob/d56ff811f39b3c10c6d8b6eb27a94624b753eb53/packages/docmanager-extension/src/index.tsx#L265-L293
142
142
  if (settingRegistry) {
@@ -219,7 +219,7 @@ const pages = {
219
219
  app.commands.addCommand(CommandIDs.openLab, {
220
220
  label: trans.__('Open JupyterLab'),
221
221
  execute: () => {
222
- window.open(`${baseUrl}lab`);
222
+ window.open(URLExt.join(baseUrl, 'lab'));
223
223
  },
224
224
  });
225
225
  const page = PageConfig.getOption('notebookPage');
@@ -230,7 +230,7 @@ const pages = {
230
230
  app.commands.execute('filebrowser:activate');
231
231
  }
232
232
  else {
233
- window.open(`${baseUrl}tree`);
233
+ window.open(URLExt.join(baseUrl, 'tree'));
234
234
  }
235
235
  },
236
236
  });
@@ -240,6 +240,17 @@ const pages = {
240
240
  }
241
241
  },
242
242
  };
243
+ /**
244
+ * A plugin to open paths in new browser tabs.
245
+ */
246
+ const pathOpener = {
247
+ id: '@jupyter-notebook/application-extension:path-opener',
248
+ autoStart: true,
249
+ provides: INotebookPathOpener,
250
+ activate: (app) => {
251
+ return defaultNotebookPathOpener;
252
+ },
253
+ };
243
254
  /**
244
255
  * The default paths for a Jupyter Notebook app.
245
256
  */
@@ -268,9 +279,11 @@ const rendermime = {
268
279
  ISanitizer,
269
280
  IMarkdownParser,
270
281
  ITranslator,
282
+ INotebookPathOpener,
271
283
  ],
272
- activate: (app, docManager, latexTypesetter, sanitizer, markdownParser, translator) => {
284
+ activate: (app, docManager, latexTypesetter, sanitizer, markdownParser, translator, notebookPathOpener) => {
273
285
  const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
286
+ const opener = notebookPathOpener !== null && notebookPathOpener !== void 0 ? notebookPathOpener : defaultNotebookPathOpener;
274
287
  if (docManager) {
275
288
  app.commands.addCommand(CommandIDs.handleLink, {
276
289
  label: trans.__('Handle Local Link'),
@@ -282,10 +295,12 @@ const rendermime = {
282
295
  return docManager.services.contents
283
296
  .get(path, { content: false })
284
297
  .then((model) => {
285
- // Open in a new browser tab
286
- const url = PageConfig.getBaseUrl();
287
- const treeUrl = URLExt.join(url, 'tree', model.path);
288
- window.open(treeUrl, '_blank');
298
+ const baseUrl = PageConfig.getBaseUrl();
299
+ opener.open({
300
+ prefix: URLExt.join(baseUrl, 'tree'),
301
+ path: model.path,
302
+ target: '_blank',
303
+ });
289
304
  });
290
305
  },
291
306
  });
@@ -872,6 +887,7 @@ const plugins = [
872
887
  menuSpacer,
873
888
  opener,
874
889
  pages,
890
+ pathOpener,
875
891
  paths,
876
892
  rendermime,
877
893
  shell,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/application-extension",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "Jupyter Notebook - Application Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -38,22 +38,22 @@
38
38
  "watch": "tsc -b --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@jupyter-notebook/application": "^7.0.2",
42
- "@jupyter-notebook/ui-components": "^7.0.2",
43
- "@jupyterlab/application": "^4.0.4",
44
- "@jupyterlab/apputils": "^4.1.4",
45
- "@jupyterlab/codeeditor": "^4.0.4",
46
- "@jupyterlab/console": "^4.0.4",
47
- "@jupyterlab/coreutils": "^6.0.4",
48
- "@jupyterlab/docmanager": "^4.0.4",
49
- "@jupyterlab/docregistry": "^4.0.4",
50
- "@jupyterlab/mainmenu": "^4.0.4",
51
- "@jupyterlab/rendermime": "^4.0.4",
52
- "@jupyterlab/settingregistry": "^4.0.4",
53
- "@jupyterlab/translation": "^4.0.4",
54
- "@lumino/coreutils": "^2.1.1",
55
- "@lumino/disposable": "^2.1.1",
56
- "@lumino/widgets": "^2.1.1"
41
+ "@jupyter-notebook/application": "^7.0.4",
42
+ "@jupyter-notebook/ui-components": "^7.0.4",
43
+ "@jupyterlab/application": "^4.0.6",
44
+ "@jupyterlab/apputils": "^4.1.6",
45
+ "@jupyterlab/codeeditor": "^4.0.6",
46
+ "@jupyterlab/console": "^4.0.6",
47
+ "@jupyterlab/coreutils": "^6.0.6",
48
+ "@jupyterlab/docmanager": "^4.0.6",
49
+ "@jupyterlab/docregistry": "^4.0.6",
50
+ "@jupyterlab/mainmenu": "^4.0.6",
51
+ "@jupyterlab/rendermime": "^4.0.6",
52
+ "@jupyterlab/settingregistry": "^4.0.6",
53
+ "@jupyterlab/translation": "^4.0.6",
54
+ "@lumino/coreutils": "^2.1.2",
55
+ "@lumino/disposable": "^2.1.2",
56
+ "@lumino/widgets": "^2.3.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "rimraf": "^3.0.2",