From 6f929697f3b87169c6770fa59350738b27e11aa2 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Thu, 17 Nov 2016 22:37:59 -0800 Subject: [PATCH] Add `Notebook.render_cell_output` method --- notebook/static/notebook/js/notebook.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index a04b99727..df365e903 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1640,6 +1640,17 @@ import {ShortcutEditor} from 'notebook/js/shortcuteditor'; first_inserted.focus_cell(); } }; + + /** + * Re-render the output of a CodeCell. + */ + Notebook.prototype.render_cell_output = function (code_cell) { + var cell_data = code_cell.toJSON(); + var cell_index = this.find_cell_index(code_cell); + this.delete_cell(cell_index); + var new_cell = this.insert_cell_at_index(cell_data.cell_type, cell_index); + new_cell.fromJSON(cell_data); + }; // Split/merge