diff --git a/notebook/static/notebook/js/cell.js b/notebook/static/notebook/js/cell.js index 122cee957..97e50e803 100644 --- a/notebook/static/notebook/js/cell.js +++ b/notebook/static/notebook/js/cell.js @@ -70,7 +70,6 @@ define([ } }); - this.attachments = {}; // backward compat. Object.defineProperty(this, 'cm_config', { @@ -477,8 +476,6 @@ define([ var data = {}; // deepcopy the metadata so copied cells don't share the same object data.metadata = JSON.parse(JSON.stringify(this.metadata)); - // same for attachments - data.attachments = JSON.parse(JSON.stringify(this.attachments)); data.cell_type = this.cell_type; return data; }; @@ -491,9 +488,6 @@ define([ if (data.metadata !== undefined) { this.metadata = data.metadata; } - if (data.attachments !== undefined) { - this.attachments = data.attachments; - } }; diff --git a/notebook/static/notebook/js/textcell.js b/notebook/static/notebook/js/textcell.js index 277f80a86..104a54e98 100644 --- a/notebook/static/notebook/js/textcell.js +++ b/notebook/static/notebook/js/textcell.js @@ -184,7 +184,12 @@ define([ */ TextCell.prototype.fromJSON = function (data) { Cell.prototype.fromJSON.apply(this, arguments); + console.log('data cell_type : ' + data.cell_type + ' this.cell_type : ' + this.cell_type); if (data.cell_type === this.cell_type) { + if (data.attachments !== undefined) { + this.attachments = data.attachments; + } + if (data.source !== undefined) { this.set_text(data.source); // make this value the starting point, so that we can only undo @@ -208,6 +213,11 @@ define([ if (data.source == this.placeholder) { data.source = ""; } + // Deepcopy the attachments so copied cells don't share the same + // objects + if (this.attachments !== undefined) { + data.attachments = JSON.parse(JSON.stringify(this.attachments)); + } return data; };