瀏覽代碼

Add default cell type to notebook options.

Ian Rose 6 年之前
父節點
當前提交
3427d2f913
共有 2 個文件被更改,包括 14 次插入1 次删除
  1. 7 0
      packages/notebook-extension/schema/tracker.json
  2. 7 1
      packages/notebook/src/widget.ts

+ 7 - 0
packages/notebook-extension/schema/tracker.json

@@ -284,6 +284,13 @@
         "codeFolding": false
       }
     },
+    "defaultCell": {
+      "title": "Default cell type",
+      "description": "The default type (markdown, code, or raw) for new cells",
+      "type": "string",
+      "enum": ["code", "markdown", "raw"],
+      "default": "code"
+    },
     "kernelShutdown": {
       "title": "Shut down kernel",
       "description": "Whether to shut down or not the kernel when closing a notebook.",

+ 7 - 1
packages/notebook/src/widget.ts

@@ -730,12 +730,18 @@ export namespace StaticNotebook {
      * Enable scrolling past the last cell
      */
     scrollPastEnd: boolean;
+
+    /**
+     * The default type for new notebook cells.
+     */
+    defaultCell: nbformat.CellType;
   }
   /**
    * Default configuration options for notebooks.
    */
   export const defaultNotebookConfig: INotebookConfig = {
-    scrollPastEnd: true
+    scrollPastEnd: true,
+    defaultCell: 'code'
   };
 
   /**