Merge pull request #30 from timkpaine/master

Update for JLab 0.33.X
pull/6/head
Sylvain Corlay 2018-08-16 11:02:37 +02:00 zatwierdzone przez GitHub
commit d5bdda058d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 252 dodań i 700 usunięć

883
package-lock.json wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -30,13 +30,13 @@
"watch": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^0.16.2",
"@jupyterlab/apputils": "^0.16.2",
"@jupyterlab/coreutils": "^1.1.2",
"@jupyterlab/docregistry": "^0.16.2",
"@jupyterlab/filebrowser": "^0.16.2",
"@jupyterlab/launcher": "^0.16.2",
"@jupyterlab/mainmenu": "^0.5.2"
"@jupyterlab/application": "^0.17.2",
"@jupyterlab/apputils": "^0.17.2",
"@jupyterlab/coreutils": "^2.0.2",
"@jupyterlab/docregistry": "^0.17.2",
"@jupyterlab/filebrowser": "^0.17.3",
"@jupyterlab/launcher": "^0.17.2",
"@jupyterlab/mainmenu": "^0.6.2"
},
"devDependencies": {
"rimraf": "^2.6.1",

Wyświetl plik

@ -31,9 +31,13 @@ w.mxLoadResources = false;
import * as mx from './mxgraph/javascript/examples/grapheditor/www/modulated.js';
import {
ABCWidgetFactory, DocumentRegistry
ABCWidgetFactory, DocumentRegistry, DocumentWidget,
} from '@jupyterlab/docregistry';
import {
Toolbar
} from '@jupyterlab/apputils';
import {
IChangedArgs, PathExt
} from '@jupyterlab/coreutils';
@ -61,17 +65,17 @@ import {
const DIRTY_CLASS = 'jp-mod-dirty';
export
class DrawioWidget extends Widget implements DocumentRegistry.IReadyWidget {
class DrawioWidget extends DocumentWidget<Widget> {
constructor(context: DocumentRegistry.Context) {
super();
this.context = context;
constructor(options: DocumentWidget.IOptions<Widget>) {
super({ ...options });
this.context = options['context'];
this._onTitleChanged();
context.pathChanged.connect(this._onTitleChanged, this);
this.context.pathChanged.connect(this._onTitleChanged, this);
this.context.ready.then(() => { this._onContextReady(); });
this.context.ready.then(() => { this._handleDirtyState(); });
this.context.ready.then(() => { this._handleDirtyStateNew(); });
}
protected onAfterShow(msg: Message): void {
@ -90,7 +94,7 @@ class DrawioWidget extends Widget implements DocumentRegistry.IReadyWidget {
this._onContentChanged();
contextModel.contentChanged.connect(this._onContentChanged, this);
contextModel.stateChanged.connect(this._onModelStateChanged, this);
contextModel.stateChanged.connect(this._onModelStateChangedNew, this);
this._editor.sidebarContainer.style.width = '208px';
var footer = document.getElementsByClassName('geFooterContainer');
@ -166,13 +170,13 @@ class DrawioWidget extends Widget implements DocumentRegistry.IReadyWidget {
this.context.model.fromString(xml);
}
private _onModelStateChanged(sender: DocumentRegistry.IModel, args: IChangedArgs<any>): void {
private _onModelStateChangedNew(sender: DocumentRegistry.IModel, args: IChangedArgs<any>): void {
if (args.name === 'dirty') {
this._handleDirtyState();
this._handleDirtyStateNew();
}
}
private _handleDirtyState() : void {
private _handleDirtyStateNew() : void {
if (this.context.model.dirty) {
this.title.className += ` ${DIRTY_CLASS}`;
} else {
@ -187,6 +191,9 @@ class DrawioWidget extends Widget implements DocumentRegistry.IReadyWidget {
return this._ready.promise;
}
public content: Widget;
public toolbar: Toolbar;
public revealed: Promise<void>;
readonly context: DocumentRegistry.Context;
private _editor : any;
private _ready = new PromiseDelegate<void>();
@ -197,10 +204,14 @@ class DrawioWidget extends Widget implements DocumentRegistry.IReadyWidget {
*/
export
class DrawioFactory extends ABCWidgetFactory<DrawioWidget, DocumentRegistry.IModel> {
/**
* Create a new widget given a context.
*/
protected createNewWidget(context: DocumentRegistry.Context): DrawioWidget {
return new DrawioWidget(context);
}
/**
* Create a new widget given a context.
*/
constructor(options: DocumentRegistry.IWidgetFactoryOptions){
super(options);
}
protected createNewWidget(context: DocumentRegistry.Context): DrawioWidget {
return new DrawioWidget({context, content: new Widget()});
}
}

Wyświetl plik

@ -136,6 +136,7 @@ function activate(app: JupyterLab,
// Add a command for creating a new diagram file.
commands.addCommand('drawio:create-new', {
label: 'Diagram',
iconClass: 'jp-MaterialIcon jp-ImageIcon',
caption: 'Create a new diagram file',
execute: () => {
let cwd = browserFactory.defaultBrowser.model.path;
@ -156,10 +157,7 @@ function activate(app: JupyterLab,
// Add a launcher item if the launcher is available.
if (launcher) {
launcher.add({
displayName: 'Diagram',
name: 'diagram',
iconClass: 'jp-MaterialIcon jp-ImageIcon',
callback: createNewDIO,
command: 'drawio:create-new',
rank: 1,
category: 'Other'
});

Wyświetl plik

@ -7,9 +7,9 @@
"allowJs": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "ES5",
"target": "ES2015",
"outDir": "./lib",
"lib": ["ES5", "ES2015.Promise", "DOM", "ES2015.Collection"],
"lib": ["ES2015", "ES2015.Promise", "DOM", "ES2015.Collection"],
"types": []
},
"include": ["src/*"]