Skip to content

Commit 1270aab

Browse files
committed
working for 0.33.X
1 parent f5b1be3 commit 1270aab

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"watch": "tsc -w"
3131
},
3232
"dependencies": {
33-
"@jupyterlab/application": "^0.17.0",
34-
"@jupyterlab/apputils": "^0.17.0",
35-
"@jupyterlab/coreutils": "^2.0.0",
36-
"@jupyterlab/docregistry": "^0.17.0",
37-
"@jupyterlab/filebrowser": "^0.17.0",
38-
"@jupyterlab/launcher": "^0.17.0",
39-
"@jupyterlab/mainmenu": "^0.6.0"
33+
"@jupyterlab/application": "^0.17.2",
34+
"@jupyterlab/apputils": "^0.17.2",
35+
"@jupyterlab/coreutils": "^2.0.2",
36+
"@jupyterlab/docregistry": "^0.17.2",
37+
"@jupyterlab/filebrowser": "^0.17.3",
38+
"@jupyterlab/launcher": "^0.17.2",
39+
"@jupyterlab/mainmenu": "^0.6.2"
4040
},
4141
"devDependencies": {
4242
"rimraf": "^2.6.1",

src/editor.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ const DIRTY_CLASS = 'jp-mod-dirty';
6767
export
6868
class DrawioWidget extends DocumentWidget<Widget> {
6969

70-
constructor(context: DocumentRegistry.Context) {
71-
super();
72-
this.context = context;
70+
constructor(options: DocumentWidget.IOptions<Widget>) {
71+
super({ ...options });
72+
this.context = options['context'];
7373

7474
this._onTitleChanged();
75-
context.pathChanged.connect(this._onTitleChanged, this);
75+
this.context.pathChanged.connect(this._onTitleChanged, this);
7676

7777
this.context.ready.then(() => { this._onContextReady(); });
78-
this.context.ready.then(() => { this._handleDirtyState(); });
78+
this.context.ready.then(() => { this._handleDirtyStateNew(); });
7979
}
8080

8181
protected onAfterShow(msg: Message): void {
@@ -94,7 +94,7 @@ class DrawioWidget extends DocumentWidget<Widget> {
9494
this._onContentChanged();
9595

9696
contextModel.contentChanged.connect(this._onContentChanged, this);
97-
contextModel.stateChanged.connect(this._onModelStateChanged, this);
97+
contextModel.stateChanged.connect(this._onModelStateChangedNew, this);
9898

9999
this._editor.sidebarContainer.style.width = '208px';
100100
var footer = document.getElementsByClassName('geFooterContainer');
@@ -170,13 +170,13 @@ class DrawioWidget extends DocumentWidget<Widget> {
170170
this.context.model.fromString(xml);
171171
}
172172

173-
private _onModelStateChanged(sender: DocumentRegistry.IModel, args: IChangedArgs<any>): void {
173+
private _onModelStateChangedNew(sender: DocumentRegistry.IModel, args: IChangedArgs<any>): void {
174174
if (args.name === 'dirty') {
175-
this._handleDirtyState();
175+
this._handleDirtyStateNew();
176176
}
177177
}
178178

179-
private _handleDirtyState() : void {
179+
private _handleDirtyStateNew() : void {
180180
if (this.context.model.dirty) {
181181
this.title.className += ` ${DIRTY_CLASS}`;
182182
} else {
@@ -204,10 +204,14 @@ class DrawioWidget extends DocumentWidget<Widget> {
204204
*/
205205
export
206206
class DrawioFactory extends ABCWidgetFactory<DrawioWidget, DocumentRegistry.IModel> {
207-
/**
208-
* Create a new widget given a context.
209-
*/
210-
protected createNewWidget(context: DocumentRegistry.Context): DrawioWidget {
211-
return new DrawioWidget(context);
212-
}
207+
/**
208+
* Create a new widget given a context.
209+
*/
210+
constructor(options: DocumentRegistry.IWidgetFactoryOptions){
211+
super(options);
212+
}
213+
214+
protected createNewWidget(context: DocumentRegistry.Context): DrawioWidget {
215+
return new DrawioWidget({context, content: new Widget()});
216+
}
213217
}

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"allowJs": true,
88
"module": "commonjs",
99
"moduleResolution": "node",
10-
"target": "ES5",
10+
"target": "ES2015",
1111
"outDir": "./lib",
12-
"lib": ["ES5", "ES2015.Promise", "DOM", "ES2015.Collection"],
12+
"lib": ["ES2015", "ES2015.Promise", "DOM", "ES2015.Collection"],
1313
"types": []
1414
},
1515
"include": ["src/*"]

0 commit comments

Comments
 (0)