Переглянути джерело

More ContentFactory.IOptions usage

Brian E. Granger 8 роки тому
батько
коміт
9d49c9c8b7
2 змінених файлів з 31 додано та 19 видалено
  1. 15 9
      packages/cells/src/widget.ts
  2. 16 10
      packages/notebook/src/model.ts

+ 15 - 9
packages/cells/src/widget.ts

@@ -370,7 +370,7 @@ namespace Cell {
     /**
      * Create a content factory for a cell.
      */
-    constructor(options: IContentFactoryOptions = {}) {
+    constructor(options: ContentFactory.IOptions = {}) {
       this._editorFactory = (options.editorFactory || InputArea.defaultEditorFactory);
     }
 
@@ -424,18 +424,24 @@ namespace Cell {
   }
 
   /**
-   * Options for the content factory.
+   * A namespace for content factory.
    */
   export
-  interface IContentFactoryOptions {
+  namespace ContentFactory {
     /**
-     * The editor factory used by the content factory.
-     * 
-     * If this is not passed, a default CodeMirror editor factory
-     * will be used.
-    */
-    editorFactory?: CodeEditor.Factory;
+     * Options for the content factory.
+     */
+    export
+    interface IOptions {
+      /**
+       * The editor factory used by the content factory.
+       * 
+       * If this is not passed, a default CodeMirror editor factory
+       * will be used.
+      */
+      editorFactory?: CodeEditor.Factory;
 
+    }
   }
 
   /**

+ 16 - 10
packages/notebook/src/model.ts

@@ -385,7 +385,7 @@ namespace NotebookModel {
     /**
      * Create a new cell model factory.
      */
-    constructor(options: IContentFactoryOptions) {
+    constructor(options: ContentFactory.IOptions) {
       this.codeCellContentFactory = (options.codeCellContentFactory ||
         CodeCellModel.defaultContentFactory
       );
@@ -468,19 +468,25 @@ namespace NotebookModel {
   }
 
   /**
-   * The options used to initialize a `ContentFactory`.
+   * A namespace for the content factory.
    */
   export
-  interface IContentFactoryOptions {
+  namespace ContentFactory {
     /**
-     * The factory for code cell model content.
+     * The options used to initialize a `ContentFactory`.
      */
-    codeCellContentFactory?: CodeCellModel.IContentFactory;
-
-    /**
-     * The modelDB in which to place new content.
-     */
-    modelDB?: IModelDB;
+    export
+    interface IOptions {
+      /**
+       * The factory for code cell model content.
+       */
+      codeCellContentFactory?: CodeCellModel.IContentFactory;
+
+      /**
+       * The modelDB in which to place new content.
+       */
+      modelDB?: IModelDB;
+    }
   }
 
   /**