From 6aaa4d7a962a3248cdabaf41e0572dbc9c77b00b Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 29 Mar 2017 16:05:21 +0200 Subject: [PATCH] an early attempt to fix #2273 I was not able to test this though preserves initial strategy that uses original cell as cell B so as to preserve selection --- notebook/static/notebook/js/notebook.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index e3cfeacfc..4fb82417a 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1697,11 +1697,16 @@ define([ if (cell.is_splittable()) { var texta = cell.get_pre_cursor(); var textb = cell.get_post_cursor(); + // current cell becomes the second one + // so we don't need to worry about selection cell.set_text(textb); + // create new cell with same type var new_cell = this.insert_cell_above(cell.cell_type); // Unrender the new cell so we can call set_text. new_cell.unrender(); new_cell.set_text(texta); + // duplicate metadata + new_cell.metadata = JSON.parse(JSON.stringify(cell.metadata)); } };