浏览代码

Update console to create new prompts.

A. Darian 9 年之前
父节点
当前提交
61be0c5e2f
共有 3 个文件被更改,包括 15 次插入4 次删除
  1. 5 2
      src/notebook/console/model.ts
  2. 3 2
      src/notebook/console/widget.ts
  3. 7 0
      src/notebook/theme.css

+ 5 - 2
src/notebook/console/model.ts

@@ -382,12 +382,15 @@ class ConsoleModel implements IConsoleModel {
    */
   run(): void {
     let prompt = this._cells.get(this._cells.length - 1) as ICodeCellModel;
-    prompt.trusted = true;
     let session = this.session;
     if (!session || !session.kernel) {
       return;
     }
-    executeCodeCell(prompt, session.kernel);
+    prompt.trusted = true;
+    prompt.input.textEditor.readOnly = true;
+    executeCodeCell(prompt, session.kernel).then(() => {
+      this._cells.add(this.createCodeCell());
+    });
   }
 
   /**

+ 3 - 2
src/notebook/console/widget.ts

@@ -191,9 +191,10 @@ class ConsoleWidget extends Widget {
     switch (args.type) {
     case ListChangeType.Add:
       widget = factory(args.newValue as ICellModel, this._rendermime);
-      // widget.addClass(NB_CELL_CLASS);
-      // widget.input.editor.addClass(NB_EDITOR_CLASS);
       layout.insertChild(args.newIndex, widget);
+      let prompt = this.prompt;
+      Private.scrollIfNeeded(this.parent.node, prompt.node);
+      prompt.input.editor.focus();
       break;
     }
     this.update();

+ 7 - 0
src/notebook/theme.css

@@ -325,6 +325,12 @@
 }
 
 
+.jp-Console .jp-Cell {
+  padding-top: 0;
+  padding-bottom: 0;
+}
+
+
 .jp-Console .jp-InputArea-editor.jp-CodeMirror {
   background: transparent;
   border-color: transparent;
@@ -342,6 +348,7 @@
   text-align: left;
 }
 
+
 .jp-Console .jp-OutputArea pre {
   border: none;
   line-height: 25px;