浏览代码

Add support for %load in the console

Steven Silvester 8 年之前
父节点
当前提交
2c2a11d6d2
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/console/widget.ts

+ 10 - 0
src/console/widget.ts

@@ -221,6 +221,16 @@ class ConsoleWidget extends Widget {
         if (value.content.status === 'ok') {
         if (value.content.status === 'ok') {
           let content = value.content as KernelMessage.IExecuteOkReply;
           let content = value.content as KernelMessage.IExecuteOkReply;
           this._inspectionHandler.handleExecuteReply(content);
           this._inspectionHandler.handleExecuteReply(content);
+          // Use deprecated payloads for backwards compatibility.
+          if (content.payload) {
+            let setNextInput = content.payload.filter(i => {
+              return (i as any).source === 'set_next_input';
+            })[0];
+            if (setNextInput) {
+              let text = (setNextInput as any).text;
+              this.prompt.model.source = text;
+            }
+          }
         }
         }
         Private.scrollToBottom(this.node);
         Private.scrollToBottom(this.node);
       },
       },