##// END OF EJS Templates
Address @carreau 's comments
Jonathan Frederic -
Show More
@@ -86,6 +86,17 define([
86 // deactivated, it's popped from the stack. When the stack is empty,
86 // deactivated, it's popped from the stack. When the stack is empty,
87 // the cell's output area is used.
87 // the cell's output area is used.
88 this.active_output_areas = [];
88 this.active_output_areas = [];
89 var that = this;
90 Object.defineProperty(this, 'active_output_area', {
91 get: function() {
92 if (that.active_output_areas && that.active_output_areas.length > 0) {
93 return that.active_output_areas[that.active_output_areas.length-1];
94 } else {
95 return that.output_area;
96 }
97 },
98 });
99
89 this.last_msg_id = null;
100 this.last_msg_id = null;
90 this.completer = null;
101 this.completer = null;
91
102
@@ -98,8 +109,6 define([
98
109
99 // Attributes we want to override in this subclass.
110 // Attributes we want to override in this subclass.
100 this.cell_type = "code";
111 this.cell_type = "code";
101
102 var that = this;
103 this.element.focusout(
112 this.element.focusout(
104 function() { that.auto_highlight(); }
113 function() { that.auto_highlight(); }
105 );
114 );
@@ -125,17 +134,6 define([
125 CodeCell.prototype = Object.create(Cell.prototype);
134 CodeCell.prototype = Object.create(Cell.prototype);
126
135
127 /**
136 /**
128 * @method get_output_area
129 */
130 CodeCell.prototype.get_output_area = function () {
131 if (this.active_output_areas && this.active_output_areas.length > 0) {
132 return this.active_output_areas[this.active_output_areas.length-1];
133 } else {
134 return this.output_area;
135 }
136 };
137
138 /**
139 * @method push_output_area
137 * @method push_output_area
140 */
138 */
141 CodeCell.prototype.push_output_area = function (output_area) {
139 CodeCell.prototype.push_output_area = function (output_area) {
@@ -318,7 +316,7 define([
318 return;
316 return;
319 }
317 }
320
318
321 this.get_output_area().clear_output();
319 this.active_output_area.clear_output();
322
320
323 // Clear widget area
321 // Clear widget area
324 this.widget_subarea.html('');
322 this.widget_subarea.html('');
@@ -358,12 +356,10 define([
358 },
356 },
359 iopub : {
357 iopub : {
360 output : function() {
358 output : function() {
361 var output_area = that.get_output_area();
359 that.active_output_area.handle_output.apply(output_area, arguments);
362 output_area.handle_output.apply(output_area, arguments);
363 },
360 },
364 clear_output : function() {
361 clear_output : function() {
365 var output_area = that.get_output_area();
362 that.active_output_area.handle_clear_output.apply(output_area, arguments);
366 output_area.handle_clear_output.apply(output_area, arguments);
367 },
363 },
368 },
364 },
369 input : $.proxy(this._handle_input_request, this)
365 input : $.proxy(this._handle_input_request, this)
@@ -398,7 +394,7 define([
398 * @private
394 * @private
399 */
395 */
400 CodeCell.prototype._handle_input_request = function (msg) {
396 CodeCell.prototype._handle_input_request = function (msg) {
401 this.get_output_area().append_raw_input(msg);
397 this.active_output_area.append_raw_input(msg);
402 };
398 };
403
399
404
400
@@ -501,7 +497,7 define([
501
497
502
498
503 CodeCell.prototype.clear_output = function (wait) {
499 CodeCell.prototype.clear_output = function (wait) {
504 this.get_output_area().clear_output(wait);
500 this.active_output_area.clear_output(wait);
505 this.set_input_prompt();
501 this.set_input_prompt();
506 };
502 };
507
503
@@ -5,7 +5,8 define([
5 "widgets/js/widget",
5 "widgets/js/widget",
6 "jquery",
6 "jquery",
7 'notebook/js/outputarea',
7 'notebook/js/outputarea',
8 ], function(widget, $, outputarea){
8 ], function(widget, $, outputarea) {
9 'use strict';
9
10
10 var OutputView = widget.DOMWidgetView.extend({
11 var OutputView = widget.DOMWidgetView.extend({
11 initialize: function (parameters) {
12 initialize: function (parameters) {
General Comments 0
You need to be logged in to leave comments. Login now