diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index 59c3010d3..2774fe80b 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -261,7 +261,7 @@ define(function(require){ help : 'to raw', help_index : 'cc', handler : function (env) { - env.notebook.to_raw(); + env.notebook.cells_to_raw(); } }, 'change-cell-to-heading-1' : { diff --git a/notebook/static/notebook/js/maintoolbar.js b/notebook/static/notebook/js/maintoolbar.js index 8c496ca22..10af1d07d 100644 --- a/notebook/static/notebook/js/maintoolbar.js +++ b/notebook/static/notebook/js/maintoolbar.js @@ -114,7 +114,7 @@ define([ that.notebook.to_markdown(); break; case 'raw': - that.notebook.to_raw(); + that.notebook.cells_to_raw(); break; case 'heading': that.notebook._warn_heading(); diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index eb3651db0..3d91a5274 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1259,6 +1259,21 @@ define(function (require) { } }; + /** + * Turn one or more cells into a raw text cell. + * + * @param {Array} indices - cell indices to convert + */ + Notebook.prototype.cells_to_raw = function (indices) { + if (indices === undefined) { + indices = this.get_selected_cells_indices(); + } + + for(var i=0; i < indices.length; i++) { + this.to_raw(indices[i]); + } + }; + /** * Turn a cell into a raw text cell. *