mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
display_id comes from transient dict, not top-level
This commit is contained in:
parent
30d3406f54
commit
0f05b2bf26
@ -225,6 +225,7 @@ define([
|
||||
} else if (msg_type === "display_data") {
|
||||
json.data = content.data;
|
||||
json.metadata = content.metadata;
|
||||
json.transient = content.transient;
|
||||
} else if (msg_type === "execute_result") {
|
||||
json.data = content.data;
|
||||
json.metadata = content.metadata;
|
||||
@ -237,7 +238,7 @@ define([
|
||||
console.log("unhandled output message", msg);
|
||||
return;
|
||||
}
|
||||
this.append_output(json, msg);
|
||||
this.append_output(json);
|
||||
};
|
||||
|
||||
// Declare mime type as constants
|
||||
@ -334,8 +335,7 @@ define([
|
||||
that.element.trigger('resize');
|
||||
};
|
||||
if (json.output_type === 'display_data') {
|
||||
var display_id = msg && msg.content.display_id;
|
||||
record_output = this.append_display_data(json, handle_appended, display_id);
|
||||
record_output = this.append_display_data(json, handle_appended);
|
||||
} else {
|
||||
handle_appended();
|
||||
}
|
||||
@ -570,10 +570,11 @@ define([
|
||||
};
|
||||
|
||||
|
||||
OutputArea.prototype.append_display_data = function (json, handle_inserted, display_id) {
|
||||
OutputArea.prototype.append_display_data = function (json, handle_inserted) {
|
||||
var toinsert = this.create_output_area();
|
||||
var record = true;
|
||||
var target;
|
||||
var display_id = (json.transient || {}).display_id;
|
||||
if (display_id) {
|
||||
// it has a display_id;
|
||||
target = this._display_id_targets[display_id];
|
||||
@ -966,9 +967,20 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return for-saving version of outputs.
|
||||
* Excludes transient values.
|
||||
*/
|
||||
OutputArea.prototype.toJSON = function () {
|
||||
return this.outputs;
|
||||
return this.outputs.map(function (out) {
|
||||
var out2 = {};
|
||||
Object.keys(out).map(function (key) {
|
||||
if (key != 'transient') {
|
||||
out2[key] = out[key];
|
||||
}
|
||||
});
|
||||
return out2;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1067,7 +1067,7 @@ define([
|
||||
var callbacks = this.get_callbacks_for_msg(msg_id);
|
||||
if (msg.header.msg_type === 'display_data') {
|
||||
// display_data messages may re-route based on their display_id
|
||||
var display_id = msg.content.display_id;
|
||||
var display_id = (msg.content.transient || {}).display_id;
|
||||
if (display_id) {
|
||||
// it has a display_id
|
||||
var target_msg_id = this._display_id_targets[display_id];
|
||||
|
Loading…
Reference in New Issue
Block a user