瀏覽代碼

Update examples"

Steven Silvester 7 年之前
父節點
當前提交
12d661087e
共有 2 個文件被更改,包括 9 次插入10 次删除
  1. 3 5
      examples/filebrowser/src/index.ts
  2. 6 5
      examples/notebook/src/index.ts

+ 3 - 5
examples/filebrowser/src/index.ts

@@ -32,7 +32,7 @@ import {
 } from '@jupyterlab/docmanager';
 
 import {
-  DocumentRegistry, TextModelFactory
+  DocumentRegistry
 } from '@jupyterlab/docregistry';
 
 import {
@@ -76,9 +76,7 @@ function createApp(manager: ServiceManager.IManager): void {
     }
   };
 
-  let docRegistry = new DocumentRegistry({
-    textModelFactory: new TextModelFactory()
-  });
+  let docRegistry = new DocumentRegistry();
   let docManager = new DocumentManager({
     registry: docRegistry,
     manager,
@@ -93,7 +91,7 @@ function createApp(manager: ServiceManager.IManager): void {
     factoryOptions: {
       name: 'Editor',
       modelName: 'text',
-      fileExtensions: ['*'],
+      fileTypes: ['*'],
       defaultFor: ['*'],
       preferKernel: false,
       canStartKernel: true

+ 6 - 5
examples/notebook/src/index.ts

@@ -33,7 +33,7 @@ import {
 } from '@jupyterlab/docmanager';
 
 import {
-  DocumentRegistry, TextModelFactory
+  DocumentRegistry
 } from '@jupyterlab/docregistry';
 
 import {
@@ -104,8 +104,9 @@ function createApp(manager: ServiceManager.IManager): void {
     }
   };
 
-  let docRegistry = new DocumentRegistry({
-    textModelFactory: new TextModelFactory()
+  let docRegistry = new DocumentRegistry();
+  DocumentRegistry.defaultFileTypes.forEach(ft => {
+    docRegistry.addFileType(ft);
   });
   let docManager = new DocumentManager({
     registry: docRegistry,
@@ -120,8 +121,8 @@ function createApp(manager: ServiceManager.IManager): void {
   let wFactory = new NotebookWidgetFactory({
     name: 'Notebook',
     modelName: 'notebook',
-    fileExtensions: ['.ipynb'],
-    defaultFor: ['.ipynb'],
+    fileTypes: ['notebook'],
+    defaultFor: ['notebook'],
     preferKernel: true,
     canStartKernel: true,
     rendermime, contentFactory,