From 46c67bde4769fd6c9c0527c7e5b22eff4d15b0ac 2013-04-26 02:25:19 From: Min RK Date: 2013-04-26 02:25:19 Subject: [PATCH] Merge pull request #3221 from dwyde/remove-html-cell Remove references to HTMLCell (dead code) Closes #2980. --- diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 52c50cd..1f49204 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -705,7 +705,7 @@ var IPython = (function (IPython) { * Index will be brought back into the accissible range [0,n] * * @method insert_cell_at_index - * @param type {string} in ['code','html','markdown','heading'] + * @param type {string} in ['code','markdown','heading'] * @param [index] {int} a valid index where to inser cell * * @return cell {cell|null} created cell or null @@ -723,8 +723,6 @@ var IPython = (function (IPython) { cell.set_input_prompt(); } else if (type === 'markdown') { cell = new IPython.MarkdownCell(); - } else if (type === 'html') { - cell = new IPython.HTMLCell(); } else if (type === 'raw') { cell = new IPython.RawCell(); } else if (type === 'heading') { @@ -884,37 +882,6 @@ var IPython = (function (IPython) { }; /** - * Turn a cell into an HTML cell. - * - * @method to_html - * @param {Number} [index] A cell's index - */ - Notebook.prototype.to_html = function (index) { - // TODO: remove? This is never called - var i = this.index_or_selected(index); - if (this.is_valid_cell_index(i)) { - var source_element = this.get_cell_element(i); - var source_cell = source_element.data("cell"); - var target_cell = null; - if (!(source_cell instanceof IPython.HTMLCell)) { - target_cell = this.insert_cell_below('html',i); - var text = source_cell.get_text(); - if (text === source_cell.placeholder) { - text = ''; - }; - // The edit must come before the set_text. - target_cell.edit(); - target_cell.set_text(text); - // make this value the starting point, so that we can only undo - // to this state, instead of a blank cell - target_cell.code_mirror.clearHistory(); - source_element.remove(); - this.dirty = true; - }; - }; - }; - - /** * Turn a cell into a raw text cell. * * @method to_raw @@ -1138,14 +1105,7 @@ var IPython = (function (IPython) { new_cell.edit(); // editor must be visible to call set_text new_cell.set_text(textb); new_cell.render(); - } else if (cell instanceof IPython.HTMLCell) { - cell.set_text(texta); - cell.render(); - var new_cell = this.insert_cell_below('html'); - new_cell.edit(); // editor must be visible to call set_text - new_cell.set_text(textb); - new_cell.render(); - }; + } }; }; @@ -1163,7 +1123,7 @@ var IPython = (function (IPython) { var text = cell.get_text(); if (cell instanceof IPython.CodeCell) { cell.set_text(upper_text+'\n'+text); - } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { + } else if (cell instanceof IPython.MarkdownCell) { cell.edit(); cell.set_text(upper_text+'\n'+text); cell.render(); @@ -1187,7 +1147,7 @@ var IPython = (function (IPython) { var text = cell.get_text(); if (cell instanceof IPython.CodeCell) { cell.set_text(text+'\n'+lower_text); - } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) { + } else if (cell instanceof IPython.MarkdownCell) { cell.edit(); cell.set_text(text+'\n'+lower_text); cell.render(); @@ -1396,8 +1356,6 @@ var IPython = (function (IPython) { var cell_index = that.find_cell_index(cell); if (cell instanceof IPython.CodeCell) { cell.execute(); - } else if (cell instanceof IPython.HTMLCell) { - cell.render(); } if (default_options.terminal) { cell.select_all(); diff --git a/IPython/frontend/html/notebook/static/js/outputarea.js b/IPython/frontend/html/notebook/static/js/outputarea.js index 5a11dd2..dec3135 100644 --- a/IPython/frontend/html/notebook/static/js/outputarea.js +++ b/IPython/frontend/html/notebook/static/js/outputarea.js @@ -325,7 +325,7 @@ var IPython = (function (IPython) { } }; - OutputArea.display_order = ['javascript','html','latex','svg','png','jpeg','text']; + OutputArea.display_order = ['javascript','latex','svg','png','jpeg','text']; OutputArea.prototype.append_mime_type = function (json, element, dynamic) { for(var type_i in OutputArea.display_order){ diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js index 0219da5..1473e31 100644 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ b/IPython/frontend/html/notebook/static/js/textcell.js @@ -283,45 +283,6 @@ var IPython = (function (IPython) { /** - * @constructor HtmlCell - * @class HtmlCell - * @extends Ipython.TextCell - */ - var HTMLCell = function (options) { - - options = this.mergeopt(HTMLCell,options); - TextCell.apply(this, [options]); - - this.cell_type = 'html'; - }; - - HTMLCell.options_default = { - cm_config : { - mode: 'htmlmixed', - }, - placeholder: "Type HTML and LaTeX: $\\alpha^2$" - }; - - - HTMLCell.prototype = new TextCell(); - - /** - * @method render - */ - HTMLCell.prototype.render = function () { - if (this.rendered === false) { - var text = this.get_text(); - if (text === "") { text = this.placeholder; } - this.set_rendered(text); - this.typeset(); - this.element.find('div.text_cell_input').hide(); - this.element.find("div.text_cell_render").show(); - this.rendered = true; - } - }; - - - /** * @class MarkdownCell * @constructor MarkdownCell * @extends Ipython.HtmlCell @@ -586,7 +547,6 @@ var IPython = (function (IPython) { }; IPython.TextCell = TextCell; - IPython.HTMLCell = HTMLCell; IPython.MarkdownCell = MarkdownCell; IPython.RawCell = RawCell; IPython.HeadingCell = HeadingCell;