Skip to content

Commit f5f2ead

Browse files
authored
Merge pull request #2349 from parmentelat/split-cell
include metadata when copying a cell
2 parents 6ef2e42 + 6aaa4d7 commit f5f2ead

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,11 +1697,16 @@ define([
16971697
if (cell.is_splittable()) {
16981698
var texta = cell.get_pre_cursor();
16991699
var textb = cell.get_post_cursor();
1700+
// current cell becomes the second one
1701+
// so we don't need to worry about selection
17001702
cell.set_text(textb);
1703+
// create new cell with same type
17011704
var new_cell = this.insert_cell_above(cell.cell_type);
17021705
// Unrender the new cell so we can call set_text.
17031706
new_cell.unrender();
17041707
new_cell.set_text(texta);
1708+
// duplicate metadata
1709+
new_cell.metadata = JSON.parse(JSON.stringify(cell.metadata));
17051710
}
17061711
};
17071712

0 commit comments

Comments
 (0)