@jupyter-notebook/application-extension 7.0.3 → 7.0.5
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 +25 -9
- package/package.json +14 -14
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
|
-
//
|
|
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(
|
|
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(
|
|
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
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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.
|
|
3
|
+
"version": "7.0.5",
|
|
4
4
|
"description": "Jupyter Notebook - Application Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"watch": "tsc -b --watch"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jupyter-notebook/application": "^7.0.
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.
|
|
43
|
-
"@jupyterlab/application": "^4.0.
|
|
44
|
-
"@jupyterlab/apputils": "^4.1.
|
|
45
|
-
"@jupyterlab/codeeditor": "^4.0.
|
|
46
|
-
"@jupyterlab/console": "^4.0.
|
|
47
|
-
"@jupyterlab/coreutils": "^6.0.
|
|
48
|
-
"@jupyterlab/docmanager": "^4.0.
|
|
49
|
-
"@jupyterlab/docregistry": "^4.0.
|
|
50
|
-
"@jupyterlab/mainmenu": "^4.0.
|
|
51
|
-
"@jupyterlab/rendermime": "^4.0.
|
|
52
|
-
"@jupyterlab/settingregistry": "^4.0.
|
|
53
|
-
"@jupyterlab/translation": "^4.0.
|
|
41
|
+
"@jupyter-notebook/application": "^7.0.5",
|
|
42
|
+
"@jupyter-notebook/ui-components": "^7.0.5",
|
|
43
|
+
"@jupyterlab/application": "^4.0.7",
|
|
44
|
+
"@jupyterlab/apputils": "^4.1.7",
|
|
45
|
+
"@jupyterlab/codeeditor": "^4.0.7",
|
|
46
|
+
"@jupyterlab/console": "^4.0.7",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.0.7",
|
|
48
|
+
"@jupyterlab/docmanager": "^4.0.7",
|
|
49
|
+
"@jupyterlab/docregistry": "^4.0.7",
|
|
50
|
+
"@jupyterlab/mainmenu": "^4.0.7",
|
|
51
|
+
"@jupyterlab/rendermime": "^4.0.7",
|
|
52
|
+
"@jupyterlab/settingregistry": "^4.0.7",
|
|
53
|
+
"@jupyterlab/translation": "^4.0.7",
|
|
54
54
|
"@lumino/coreutils": "^2.1.2",
|
|
55
55
|
"@lumino/disposable": "^2.1.2",
|
|
56
56
|
"@lumino/widgets": "^2.3.0"
|