jupyter-specta 0.1.6 → 0.1.7
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/app.js +2 -0
- package/lib/document/plugin.js +6 -2
- package/lib/shell.js +1 -0
- package/lib/tool.js +2 -15
- package/package.json +3 -1
- package/style/base.css +1 -0
- package/style/style.css +5 -0
package/lib/app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JupyterFrontEnd, createRendermimePlugins } from '@jupyterlab/application';
|
|
2
2
|
import { SpectaShell } from './shell';
|
|
3
3
|
import { PageConfig } from '@jupyterlab/coreutils';
|
|
4
|
+
import { Base64ModelFactory } from '@jupyterlab/docregistry';
|
|
4
5
|
export class SpectaApp extends JupyterFrontEnd {
|
|
5
6
|
constructor(options) {
|
|
6
7
|
var _a;
|
|
@@ -17,6 +18,7 @@ export class SpectaApp extends JupyterFrontEnd {
|
|
|
17
18
|
* The version of the application.
|
|
18
19
|
*/
|
|
19
20
|
this.version = '1.0.0';
|
|
21
|
+
this.docRegistry.addModelFactory(new Base64ModelFactory());
|
|
20
22
|
if (options.mimeExtensions) {
|
|
21
23
|
for (const plugin of createRendermimePlugins(options.mimeExtensions)) {
|
|
22
24
|
this.registerPlugin(plugin);
|
package/lib/document/plugin.js
CHANGED
|
@@ -6,6 +6,7 @@ import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
|
|
|
6
6
|
import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook';
|
|
7
7
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
8
8
|
import { IKernelSpecManager } from '@jupyterlab/services';
|
|
9
|
+
import { Widget } from '@lumino/widgets';
|
|
9
10
|
import { ISpectaDocTracker, ISpectaLayoutRegistry } from '../token';
|
|
10
11
|
import { createFileBrowser, hideAppLoadingIndicator, isSpectaApp, registerDocumentFactory } from '../tool';
|
|
11
12
|
const activate = (app, rendermime, tracker, editorServices, contentFactory, spectaLayoutRegistry, themeManager) => {
|
|
@@ -70,7 +71,7 @@ export const spectaOpener = {
|
|
|
70
71
|
else {
|
|
71
72
|
let count = 0;
|
|
72
73
|
const tryOpen = () => {
|
|
73
|
-
const widget = docManager.openOrReveal(path);
|
|
74
|
+
const widget = docManager.openOrReveal(path, 'default');
|
|
74
75
|
if (widget) {
|
|
75
76
|
app.shell.add(widget, 'main');
|
|
76
77
|
hideAppLoadingIndicator();
|
|
@@ -79,7 +80,10 @@ export const spectaOpener = {
|
|
|
79
80
|
count++;
|
|
80
81
|
if (count > 10) {
|
|
81
82
|
console.error('Failed to open file', path);
|
|
82
|
-
|
|
83
|
+
const widget = new Widget();
|
|
84
|
+
widget.node.innerHTML = `<h2 style="text-align: center; margin-top: 200px;">Failed to open file ${path}</h2>`;
|
|
85
|
+
app.shell.add(widget, 'main');
|
|
86
|
+
hideAppLoadingIndicator();
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
setTimeout(tryOpen, 100);
|
package/lib/shell.js
CHANGED
|
@@ -33,6 +33,7 @@ export class SpectaShell extends Widget {
|
|
|
33
33
|
rootLayout.addWidget(topHandler.panel);
|
|
34
34
|
const hboxPanel = (this._mainPanel = new BoxPanel());
|
|
35
35
|
hboxPanel.id = 'jp-main-content-panel';
|
|
36
|
+
hboxPanel.addClass('specta-main-content-panel');
|
|
36
37
|
hboxPanel.direction = 'top-to-bottom';
|
|
37
38
|
BoxLayout.setStretch(hboxPanel, 1);
|
|
38
39
|
rootLayout.addWidget(hboxPanel);
|
package/lib/tool.js
CHANGED
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
|
|
13
|
-
import { NotebookModelFactory } from '@jupyterlab/notebook';
|
|
14
13
|
import { NotebookGridWidgetFactory } from './document/factory';
|
|
15
14
|
import { SpectaWidgetFactory } from './specta_widget_factory';
|
|
16
15
|
export function registerDocumentFactory(options) {
|
|
@@ -27,26 +26,14 @@ export function registerDocumentFactory(options) {
|
|
|
27
26
|
const widgetFactory = new NotebookGridWidgetFactory({
|
|
28
27
|
name: factoryName,
|
|
29
28
|
modelName: 'notebook',
|
|
30
|
-
fileTypes: ['
|
|
31
|
-
spectaWidgetFactory,
|
|
29
|
+
fileTypes: ['notebook'],
|
|
32
30
|
shell: app.shell,
|
|
31
|
+
spectaWidgetFactory,
|
|
33
32
|
themeManager,
|
|
34
33
|
spectaLayoutRegistry
|
|
35
34
|
});
|
|
36
35
|
// Registering the widget factory
|
|
37
36
|
app.docRegistry.addWidgetFactory(widgetFactory);
|
|
38
|
-
// Creating and registering the model factory for our custom DocumentModelAdd commentMore actions
|
|
39
|
-
const modelFactory = new NotebookModelFactory({});
|
|
40
|
-
app.docRegistry.addModelFactory(modelFactory);
|
|
41
|
-
// register the filetype
|
|
42
|
-
app.docRegistry.addFileType({
|
|
43
|
-
name: 'ipynb',
|
|
44
|
-
displayName: 'IPYNB',
|
|
45
|
-
mimeTypes: ['text/json'],
|
|
46
|
-
extensions: ['.ipynb', '.IPYNB'],
|
|
47
|
-
fileFormat: 'json',
|
|
48
|
-
contentType: 'notebook'
|
|
49
|
-
});
|
|
50
37
|
widgetFactory.widgetCreated.connect((sender, widget) => {
|
|
51
38
|
widget.context.pathChanged.connect(() => {
|
|
52
39
|
spectaTracker.save(widget);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyter-specta",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/trungleduc/specta",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
"@jupyterlab/docregistry": "^4.4.2",
|
|
61
61
|
"@jupyterlab/filebrowser": "^4.4.2",
|
|
62
62
|
"@jupyterlab/filebrowser-extension": "^4.4.2",
|
|
63
|
+
"@jupyterlab/imageviewer": "^4.4.2",
|
|
64
|
+
"@jupyterlab/imageviewer-extension": "^4.4.2",
|
|
63
65
|
"@jupyterlab/json-extension": "^4.4.2",
|
|
64
66
|
"@jupyterlab/logconsole": "^4.4.2",
|
|
65
67
|
"@jupyterlab/mainmenu": "^4.4.2",
|
package/style/base.css
CHANGED