Browse Source

Merge pull request #3550 from ian-r-rose/fix-indentation-in-cells

Check for `null` or `undefined` in cached settings.
Brian E. Granger 7 years ago
parent
commit
648c0c3e8f
1 changed files with 9 additions and 3 deletions
  1. 9 3
      packages/notebook-extension/src/index.ts

+ 9 - 3
packages/notebook-extension/src/index.ts

@@ -450,19 +450,25 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
       settings.get('codeCellConfig').composite as Partial<CodeEditor.IConfig>;
     let code = { ...StaticNotebook.defaultEditorConfig.code };
     Object.keys(code).forEach((key: keyof CodeEditor.IConfig) => {
-      code[key] = cached[key] === null ? code[key] : cached[key];
+      code[key] = (cached[key] === null || cached[key] === undefined)
+                  ? code[key]
+                  : cached[key];
     });
     cached =
       settings.get('markdownCellConfig').composite as Partial<CodeEditor.IConfig>;
     let markdown = { ...StaticNotebook.defaultEditorConfig.markdown };
     Object.keys(markdown).forEach((key: keyof CodeEditor.IConfig) => {
-      markdown[key] = cached[key] === null ? markdown[key] : cached[key];
+      markdown[key] = (cached[key] === null || cached[key] === undefined)
+                      ? markdown[key]
+                      : cached[key];
     });
     cached =
       settings.get('rawCellConfig').composite as Partial<CodeEditor.IConfig>;
     let raw = { ...StaticNotebook.defaultEditorConfig.raw };
     Object.keys(raw).forEach((key: keyof CodeEditor.IConfig) => {
-      raw[key] = cached[key] === null ? raw[key] : cached[key];
+      raw[key] = (cached[key] === null || cached[key] === undefined)
+                 ? raw[key]
+                 : cached[key];
     });
     factory.editorConfig = editorConfig = { code, markdown, raw };
   }