##// END OF EJS Templates
cleanup stdin event submission...
MinRK -
Show More
@@ -74,7 +74,6 b' var IPython = (function (IPython) {'
74
74
75 OutputArea.prototype.bind_events = function () {
75 OutputArea.prototype.bind_events = function () {
76 var that = this;
76 var that = this;
77 this._submit_raw_input_proxy = $.proxy(this._submit_raw_input, this);
78 this.prompt_overlay.dblclick(function () { that.toggle_output(); });
77 this.prompt_overlay.dblclick(function () { that.toggle_output(); });
79 this.prompt_overlay.click(function () { that.toggle_scroll(); });
78 this.prompt_overlay.click(function () { that.toggle_scroll(); });
80
79
@@ -451,29 +450,34 b' var IPython = (function (IPython) {'
451 };
450 };
452
451
453 OutputArea.prototype.append_raw_input = function (content) {
452 OutputArea.prototype.append_raw_input = function (content) {
453 var that = this;
454 this.expand();
454 this.expand();
455 this.flush_clear_timeout();
455 this.flush_clear_timeout();
456 var area = this.create_output_area();
456 var area = this.create_output_area();
457
457 area.append(
458 area.append(
458 $("<div/>")
459 $("<div/>")
459 .addClass("box-flex1 output_subarea raw_input")
460 .addClass("box-flex1 output_subarea raw_input")
460 .append(
461 .append(
461 $("<form/>")
462 $("<span/>")
462 .attr("action", "javascript:$([IPython.events]).trigger('submit_raw_input.OutputArea');")
463 .addClass("input_prompt")
463 .append(
464 .text(content.prompt)
464 $("<span/>")
465 )
465 .addClass("input_prompt")
466 .append(
466 .text(content.prompt)
467 $("<input/>")
467 ).append(
468 .addClass("raw_input")
468 $("<input/>")
469 .attr('type', 'text')
469 .attr("size", 80)
470 .attr("size", 80)
470 .addClass("raw_input")
471 .keydown(function (event, ui) {
471 )
472 // make sure we submit on enter,
473 // and don't re-execute the *cell* on shift-enter
474 if (event.which === utils.keycodes.ENTER) {
475 that._submit_raw_input();
476 return false;
477 }
478 })
472 )
479 )
473 )
480 );
474 // clear events first
475 $([IPython.events]).off('submit_raw_input.OutputArea');
476 $([IPython.events]).on('submit_raw_input.OutputArea', this._submit_raw_input_proxy);
477 this.element.append(area);
481 this.element.append(area);
478 area.find("input.raw_input").focus();
482 area.find("input.raw_input").focus();
479 }
483 }
@@ -491,7 +495,6 b' var IPython = (function (IPython) {'
491 container.parent().remove();
495 container.parent().remove();
492 // replace with plaintext version in stdout
496 // replace with plaintext version in stdout
493 this.append_output(content, false);
497 this.append_output(content, false);
494 $([IPython.events]).off('submit_raw_input.OutputArea', this._submit_raw_input_proxy);
495 $([IPython.events]).trigger('send_input_reply.Kernel', value);
498 $([IPython.events]).trigger('send_input_reply.Kernel', value);
496 }
499 }
497
500
General Comments 0
You need to be logged in to leave comments. Login now