Skip to content

Commit 6cebd3e

Browse files
authored
Merge pull request #2411 from jasongrout/outputclearevents
Pass the output area object in events specific to the output area.
2 parents d00b7e3 + 8e822e9 commit 6cebd3e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

notebook/static/notebook/js/codecell.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ define([
313313
stop_on_error = true;
314314
}
315315

316-
this.output_area.clear_output(false, true);
316+
this.clear_output(false, true);
317317
var old_msg_id = this.last_msg_id;
318318
if (old_msg_id) {
319319
this.kernel.clear_callbacks_for_msg(old_msg_id);
@@ -509,10 +509,10 @@ define([
509509
};
510510

511511

512-
CodeCell.prototype.clear_output = function (wait) {
513-
this.output_area.clear_output(wait);
514-
this.set_input_prompt();
512+
CodeCell.prototype.clear_output = function (wait, ignore_queue) {
515513
this.events.trigger('clear_output.CodeCell', {cell: this});
514+
this.output_area.clear_output(wait, ignore_queue);
515+
this.set_input_prompt();
516516
};
517517

518518

notebook/static/notebook/js/outputarea.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ define([
348348
this._needs_height_reset = false;
349349
}
350350

351-
this.element.trigger('resizeOutput');
351+
this.element.trigger('resizeOutput', {output_area: this});
352352
};
353353

354354
OutputArea.prototype.create_output_area = function () {
@@ -451,7 +451,7 @@ define([
451451
}
452452

453453
// Notify others of changes.
454-
this.element.trigger('changed');
454+
this.element.trigger('changed', {output_area: this});
455455
};
456456

457457

@@ -942,7 +942,7 @@ define([
942942
};
943943

944944

945-
OutputArea.prototype.clear_output = function(wait, ignore_que) {
945+
OutputArea.prototype.clear_output = function(wait, ignore_clear_queue) {
946946
if (wait) {
947947

948948
// If a clear is queued, clear before adding another to the queue.
@@ -955,7 +955,7 @@ define([
955955

956956
// Fix the output div's height if the clear_output is waiting for
957957
// new output (it is being used in an animation).
958-
if (!ignore_que && this.clear_queued) {
958+
if (!ignore_clear_queue && this.clear_queued) {
959959
var height = this.element.height();
960960
this.element.height(height);
961961
this.clear_queued = false;
@@ -965,11 +965,12 @@ define([
965965
// Remove load event handlers from img tags because we don't want
966966
// them to fire if the image is never added to the page.
967967
this.element.find('img').off('load');
968+
this.element.trigger('clearing', {output_area: this});
968969
this.element.html("");
969970

970971
// Notify others of changes.
971-
this.element.trigger('changed');
972-
this.element.trigger('cleared');
972+
this.element.trigger('changed', {output_area: this});
973+
this.element.trigger('cleared', {output_area: this});
973974

974975
this.outputs = [];
975976
this._display_id_targets = {};

0 commit comments

Comments
 (0)