mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-09 03:50:45 +08:00
Make attachments textcell-specific
This commit is contained in:
parent
c012835e67
commit
84f38c2cf9
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user