Skip to content

Commit

Permalink
Fix calling .remove() when in an output widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Apr 13, 2017
1 parent 117a155 commit 00b16dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions widgetsnbextension/src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function register_events(Jupyter, events, outputarea) {
events.on('delete.Cell', removeView);
events.on('execute.CodeCell', removeView);
events.on('clear_output.CodeCell', removeView);
events.on('clear_output.OutputArea', removeView);

/**
* Render data to the output area.
Expand Down
7 changes: 4 additions & 3 deletions widgetsnbextension/src/widget_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var OutputView = widgets.DOMWidgetView.extend({

render: function(){
var that = this;
var renderOutput = function(outputArea) {
var renderOutput = function(outputArea, events) {
that.output_area = new outputArea.OutputArea({
selector: that.el,
// use default values for the output area config
Expand All @@ -79,15 +79,16 @@ var OutputView = widgets.DOMWidgetView.extend({
}, that);
that.listenTo(that.model, 'clear_output', function(msg) {
that.output_area.handle_clear_output(msg);
})
events.trigger('clear_output.OutputArea', {cell: {output_area: that.output_area}})
});

// Render initial contents from that.model._outputs
that.model._outputs.forEach(function(msg) {
that.output_area.handle_output(msg);
}, that)
}

requirejs(["notebook/js/outputarea"], renderOutput)
requirejs(["notebook/js/outputarea", "base/js/events"], renderOutput)
},
});

Expand Down

0 comments on commit 00b16dc

Please sign in to comment.