@jupyter-notebook/terminal-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 +10 -3
  2. package/package.json +6 -5
package/lib/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { IRouter, } from '@jupyterlab/application';
4
- import { PageConfig } from '@jupyterlab/coreutils';
4
+ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
5
5
  import { ITerminalTracker } from '@jupyterlab/terminal';
6
+ import { INotebookPathOpener, defaultNotebookPathOpener, } from '@jupyter-notebook/application';
6
7
  import { find } from '@lumino/algorithm';
7
8
  /**
8
9
  * A plugin to open terminals in a new tab
@@ -41,9 +42,11 @@ const opener = {
41
42
  const redirect = {
42
43
  id: '@jupyter-notebook/terminal-extension:redirect',
43
44
  requires: [ITerminalTracker],
45
+ optional: [INotebookPathOpener],
44
46
  autoStart: true,
45
- activate: (app, tracker) => {
47
+ activate: (app, tracker, notebookPathOpener) => {
46
48
  const baseUrl = PageConfig.getBaseUrl();
49
+ const opener = notebookPathOpener !== null && notebookPathOpener !== void 0 ? notebookPathOpener : defaultNotebookPathOpener;
47
50
  tracker.widgetAdded.connect((send, terminal) => {
48
51
  const widget = find(app.shell.widgets('main'), (w) => w.id === terminal.id);
49
52
  if (widget) {
@@ -51,7 +54,11 @@ const redirect = {
51
54
  return;
52
55
  }
53
56
  const name = terminal.content.session.name;
54
- window.open(`${baseUrl}terminals/${name}`, '_blank');
57
+ opener.open({
58
+ prefix: URLExt.join(baseUrl, 'terminals'),
59
+ path: name,
60
+ target: '_blank',
61
+ });
55
62
  // dispose the widget since it is not used on this page
56
63
  terminal.dispose();
57
64
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/terminal-extension",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "Jupyter Notebook - Terminal Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -38,10 +38,11 @@
38
38
  "watch": "tsc -b --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@jupyterlab/application": "^4.0.4",
42
- "@jupyterlab/coreutils": "^6.0.4",
43
- "@jupyterlab/terminal": "^4.0.4",
44
- "@lumino/algorithm": "^2.0.0"
41
+ "@jupyter-notebook/application": "^7.0.4",
42
+ "@jupyterlab/application": "^4.0.6",
43
+ "@jupyterlab/coreutils": "^6.0.6",
44
+ "@jupyterlab/terminal": "^4.0.6",
45
+ "@lumino/algorithm": "^2.0.1"
45
46
  },
46
47
  "devDependencies": {
47
48
  "rimraf": "^3.0.2",