From b070efc32ccce04c98549a80bc0209572a4f1bfb Mon Sep 17 00:00:00 2001 From: mishaschwartz Date: Wed, 6 Jan 2021 10:03:26 -0500 Subject: [PATCH 1/2] cell data: make sure that the cell id (from nbformat 4.5) is kept when saving notebooks --- notebook/static/notebook/js/cell.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notebook/static/notebook/js/cell.js b/notebook/static/notebook/js/cell.js index 023b3d375..dbe031359 100644 --- a/notebook/static/notebook/js/cell.js +++ b/notebook/static/notebook/js/cell.js @@ -490,6 +490,9 @@ define([ var data = {}; // deepcopy the metadata so copied cells don't share the same object data.metadata = JSON.parse(JSON.stringify(this.metadata)); + if (this.id !== undefined) { + data.id = this.id; + } if (data.metadata.deletable) { delete data.metadata.deletable; } @@ -511,6 +514,9 @@ define([ if (data.metadata !== undefined) { this.metadata = data.metadata; } + if (data.id !== undefined) { + this.id = data.id; + } }; From a5d7528994cb0d4ac9c12cbed82116d8ef63c941 Mon Sep 17 00:00:00 2001 From: mishaschwartz Date: Wed, 6 Jan 2021 10:32:01 -0500 Subject: [PATCH 2/2] cell copy: make sure that cell id is not copied when copying cell --- notebook/static/notebook/js/notebook.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 6a4310b0a..00ad703de 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1648,6 +1648,9 @@ define([ if (cell_json.metadata.deletable !== undefined) { delete cell_json.metadata.deletable; } + if (cell_json.id !== undefined) { + delete cell_json.id; + } this.clipboard.push(cell_json); } this.enable_paste();