Skip to content

Commit 57db709

Browse files
authored
Merge pull request #5928 from mishaschwartz/persist-cell-id
Ensure that cell ids persist after save
2 parents 8d0af52 + a5d7528 commit 57db709

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

notebook/static/notebook/js/cell.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ define([
490490
var data = {};
491491
// deepcopy the metadata so copied cells don't share the same object
492492
data.metadata = JSON.parse(JSON.stringify(this.metadata));
493+
if (this.id !== undefined) {
494+
data.id = this.id;
495+
}
493496
if (data.metadata.deletable) {
494497
delete data.metadata.deletable;
495498
}
@@ -511,6 +514,9 @@ define([
511514
if (data.metadata !== undefined) {
512515
this.metadata = data.metadata;
513516
}
517+
if (data.id !== undefined) {
518+
this.id = data.id;
519+
}
514520
};
515521

516522

notebook/static/notebook/js/notebook.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,9 @@ define([
16481648
if (cell_json.metadata.deletable !== undefined) {
16491649
delete cell_json.metadata.deletable;
16501650
}
1651+
if (cell_json.id !== undefined) {
1652+
delete cell_json.id;
1653+
}
16511654
this.clipboard.push(cell_json);
16521655
}
16531656
this.enable_paste();

0 commit comments

Comments
 (0)