@jupyter-notebook/application-extension 7.0.0-beta.2 → 7.0.0-beta.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.
- package/lib/index.js +96 -2
- package/package.json +14 -14
- package/schema/menus.json +4 -0
package/lib/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
import { ILabStatus, IRouter, ITreePathUpdater, JupyterFrontEnd, } from '@jupyterlab/application';
|
|
4
|
-
import { DOMUtils, ICommandPalette, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
|
|
4
|
+
import { DOMUtils, ICommandPalette, ISanitizer, ISplashScreen, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
|
|
5
5
|
import { ConsolePanel } from '@jupyterlab/console';
|
|
6
6
|
import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';
|
|
7
7
|
import { IDocumentManager, renameDialog } from '@jupyterlab/docmanager';
|
|
8
8
|
import { DocumentWidget } from '@jupyterlab/docregistry';
|
|
9
9
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
10
|
+
import { ILatexTypesetter, IMarkdownParser, IRenderMimeRegistry, RenderMimeRegistry, standardRendererFactories, } from '@jupyterlab/rendermime';
|
|
10
11
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
11
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
12
|
+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
12
13
|
import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette, } from '@jupyter-notebook/application';
|
|
13
14
|
import { jupyterIcon } from '@jupyter-notebook/ui-components';
|
|
14
15
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
@@ -27,6 +28,10 @@ const STRIP_IPYNB = /\.ipynb$/;
|
|
|
27
28
|
*/
|
|
28
29
|
var CommandIDs;
|
|
29
30
|
(function (CommandIDs) {
|
|
31
|
+
/**
|
|
32
|
+
* Handle local links
|
|
33
|
+
*/
|
|
34
|
+
CommandIDs.handleLink = 'application:handle-local-link';
|
|
30
35
|
/**
|
|
31
36
|
* Toggle Top Bar visibility
|
|
32
37
|
*/
|
|
@@ -223,6 +228,66 @@ const paths = {
|
|
|
223
228
|
return app.paths;
|
|
224
229
|
},
|
|
225
230
|
};
|
|
231
|
+
/**
|
|
232
|
+
* A plugin providing a rendermime registry.
|
|
233
|
+
*/
|
|
234
|
+
const rendermime = {
|
|
235
|
+
id: '@jupyter-notebook/application-extension:rendermime',
|
|
236
|
+
autoStart: true,
|
|
237
|
+
provides: IRenderMimeRegistry,
|
|
238
|
+
description: 'Provides the render mime registry.',
|
|
239
|
+
optional: [
|
|
240
|
+
IDocumentManager,
|
|
241
|
+
ILatexTypesetter,
|
|
242
|
+
ISanitizer,
|
|
243
|
+
IMarkdownParser,
|
|
244
|
+
ITranslator,
|
|
245
|
+
],
|
|
246
|
+
activate: (app, docManager, latexTypesetter, sanitizer, markdownParser, translator) => {
|
|
247
|
+
const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
|
|
248
|
+
if (docManager) {
|
|
249
|
+
app.commands.addCommand(CommandIDs.handleLink, {
|
|
250
|
+
label: trans.__('Handle Local Link'),
|
|
251
|
+
execute: (args) => {
|
|
252
|
+
const path = args['path'];
|
|
253
|
+
if (path === undefined || path === null) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
return docManager.services.contents
|
|
257
|
+
.get(path, { content: false })
|
|
258
|
+
.then((model) => {
|
|
259
|
+
// Open in a new browser tab
|
|
260
|
+
const url = PageConfig.getBaseUrl();
|
|
261
|
+
const treeUrl = URLExt.join(url, 'tree', model.path);
|
|
262
|
+
window.open(treeUrl, '_blank');
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return new RenderMimeRegistry({
|
|
268
|
+
initialFactories: standardRendererFactories,
|
|
269
|
+
linkHandler: !docManager
|
|
270
|
+
? undefined
|
|
271
|
+
: {
|
|
272
|
+
handleLink: (node, path, id) => {
|
|
273
|
+
// If node has the download attribute explicitly set, use the
|
|
274
|
+
// default browser downloading behavior.
|
|
275
|
+
if (node.tagName === 'A' && node.hasAttribute('download')) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
app.commandLinker.connectNode(node, CommandIDs.handleLink, {
|
|
279
|
+
path,
|
|
280
|
+
id,
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
latexTypesetter: latexTypesetter !== null && latexTypesetter !== void 0 ? latexTypesetter : undefined,
|
|
285
|
+
markdownParser: markdownParser !== null && markdownParser !== void 0 ? markdownParser : undefined,
|
|
286
|
+
translator: translator !== null && translator !== void 0 ? translator : undefined,
|
|
287
|
+
sanitizer: sanitizer !== null && sanitizer !== void 0 ? sanitizer : undefined,
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
};
|
|
226
291
|
/**
|
|
227
292
|
* The default Jupyter Notebook application shell.
|
|
228
293
|
*/
|
|
@@ -237,6 +302,33 @@ const shell = {
|
|
|
237
302
|
autoStart: true,
|
|
238
303
|
provides: INotebookShell,
|
|
239
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* The default splash screen provider.
|
|
307
|
+
*/
|
|
308
|
+
const splash = {
|
|
309
|
+
id: '@jupyter-notebook/application-extension:splash',
|
|
310
|
+
description: 'Provides an empty splash screen.',
|
|
311
|
+
autoStart: true,
|
|
312
|
+
provides: ISplashScreen,
|
|
313
|
+
activate: (app) => {
|
|
314
|
+
const { restored } = app;
|
|
315
|
+
const splash = document.createElement('div');
|
|
316
|
+
splash.style.position = 'absolute';
|
|
317
|
+
splash.style.width = '100%';
|
|
318
|
+
splash.style.height = '100%';
|
|
319
|
+
splash.style.zIndex = '10';
|
|
320
|
+
return {
|
|
321
|
+
show: (light = true) => {
|
|
322
|
+
splash.style.backgroundColor = light ? 'white' : '#111111';
|
|
323
|
+
document.body.appendChild(splash);
|
|
324
|
+
return new DisposableDelegate(async () => {
|
|
325
|
+
await restored;
|
|
326
|
+
document.body.removeChild(splash);
|
|
327
|
+
});
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
},
|
|
331
|
+
};
|
|
240
332
|
/**
|
|
241
333
|
* The default JupyterLab application status provider.
|
|
242
334
|
*/
|
|
@@ -739,8 +831,10 @@ const plugins = [
|
|
|
739
831
|
opener,
|
|
740
832
|
pages,
|
|
741
833
|
paths,
|
|
834
|
+
rendermime,
|
|
742
835
|
shell,
|
|
743
836
|
sidePanelVisibility,
|
|
837
|
+
splash,
|
|
744
838
|
status,
|
|
745
839
|
tabTitle,
|
|
746
840
|
title,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/application-extension",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.4",
|
|
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.0-beta.
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.0-beta.
|
|
43
|
-
"@jupyterlab/application": "^4.0.
|
|
44
|
-
"@jupyterlab/apputils": "^4.
|
|
45
|
-
"@jupyterlab/
|
|
46
|
-
"@jupyterlab/
|
|
47
|
-
"@jupyterlab/
|
|
48
|
-
"@jupyterlab/
|
|
49
|
-
"@jupyterlab/
|
|
50
|
-
"@jupyterlab/
|
|
51
|
-
"@jupyterlab/
|
|
52
|
-
"@jupyterlab/settingregistry": "^4.0.
|
|
53
|
-
"@jupyterlab/translation": "^4.0.
|
|
41
|
+
"@jupyter-notebook/application": "^7.0.0-beta.4",
|
|
42
|
+
"@jupyter-notebook/ui-components": "^7.0.0-beta.4",
|
|
43
|
+
"@jupyterlab/application": "^4.0.1",
|
|
44
|
+
"@jupyterlab/apputils": "^4.1.1",
|
|
45
|
+
"@jupyterlab/codeeditor": "^4.0.1",
|
|
46
|
+
"@jupyterlab/console": "^4.0.1",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.0.1",
|
|
48
|
+
"@jupyterlab/docmanager": "^4.0.1",
|
|
49
|
+
"@jupyterlab/docregistry": "^4.0.1",
|
|
50
|
+
"@jupyterlab/mainmenu": "^4.0.1",
|
|
51
|
+
"@jupyterlab/rendermime": "^4.0.1",
|
|
52
|
+
"@jupyterlab/settingregistry": "^4.0.1",
|
|
53
|
+
"@jupyterlab/translation": "^4.0.1",
|
|
54
54
|
"@lumino/coreutils": "^2.1.1",
|
|
55
55
|
"@lumino/disposable": "^2.1.1",
|
|
56
56
|
"@lumino/widgets": "^2.1.1"
|