Skip to content

Commit 877c011

Browse files
committed
Dispose context
1 parent d567524 commit 877c011

File tree

6 files changed

+739
-163
lines changed

6 files changed

+739
-163
lines changed

src/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default extension;
7676
function activate(
7777
app: JupyterFrontEnd,
7878
browserFactory: IFileBrowserFactory,
79-
restorer: ILayoutRestorer,
79+
restorer: ILayoutRestorer | null,
8080
menu: IMainMenu,
8181
palette: ICommandPalette,
8282
launcher: ILauncher | null
@@ -87,12 +87,14 @@ function activate(
8787
const tracker = new WidgetTracker<DrawIODocumentWidget>({ namespace });
8888

8989
// Handle state restoration.
90-
restorer.restore(tracker, {
91-
command: 'docmanager:open',
92-
args: widget => ({ path: widget.context.path, factory: FACTORY }),
93-
name: widget => widget.context.path
94-
});
95-
90+
if (restorer) {
91+
restorer.restore(tracker, {
92+
command: 'docmanager:open',
93+
args: widget => ({ path: widget.context.path, factory: FACTORY }),
94+
name: widget => widget.context.path
95+
});
96+
}
97+
9698
const widgetFactory = new DrawIOWidgetFactory({
9799
name: FACTORY,
98100
modelName: 'dio',
@@ -119,7 +121,7 @@ function activate(
119121
app.docRegistry.addFileType({
120122
name: 'drawio',
121123
displayName: 'Diagram',
122-
mimeTypes: ['application/dio', 'application/drawio'],
124+
mimeTypes: ['text/xml', 'application/drawio', 'application/dio'],
123125
extensions: ['.dio', '.drawio'],
124126
iconClass: 'jp-MaterialIcon jp-ImageIcon',
125127
fileFormat: 'text',

0 commit comments

Comments
 (0)