From 13bcdc909569d4056ffd64e50e708d6e64edba61 Mon Sep 17 00:00:00 2001 From: Julien Rebetez Date: Tue, 20 Oct 2015 17:05:44 +0200 Subject: [PATCH] Keep the attachments even if the cell type changes --- notebook/static/notebook/js/notebook.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 3ba7b70ce..a37e83e11 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1298,6 +1298,9 @@ define(function (require) { } //metadata target_cell.metadata = source_cell.metadata; + // attachments (we transfer them so they aren't lost if the + // cell is turned back into markdown) + target_cell.attachments = source_cell.attachments; target_cell.set_text(text); // make this value the starting point, so that we can only undo @@ -1346,6 +1349,8 @@ define(function (require) { } // metadata target_cell.metadata = source_cell.metadata; + target_cell.attachments = source_cell.attachments; + // We must show the editor before setting its contents target_cell.unrender(); target_cell.set_text(text); @@ -1398,6 +1403,10 @@ define(function (require) { } //metadata target_cell.metadata = source_cell.metadata; + // attachments (we transfer them so they aren't lost if the + // cell is turned back into markdown) + target_cell.attachments = source_cell.attachments; + // We must show the editor before setting its contents target_cell.unrender(); target_cell.set_text(text);