From a003af7977bd59ed650897ba95a34a62f45d4023 Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Mon, 8 Aug 2011 08:44:51 -0700 Subject: [PATCH] Starting to rename text cell to html cell. --- .../html/notebook/static/js/textcell.js | 152 ------------------ 1 file changed, 152 deletions(-) delete mode 100644 IPython/frontend/html/notebook/static/js/textcell.js diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js deleted file mode 100644 index 7141dede8..000000000 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ /dev/null @@ -1,152 +0,0 @@ - -//============================================================================ -// TextCell -//============================================================================ - -var IPython = (function (IPython) { - - var TextCell = function (notebook) { - IPython.Cell.apply(this, arguments); - this.placeholder = "Type HTML and LaTeX: $\\alpha^2$" - this.rendered = false; - }; - - - TextCell.prototype = new IPython.Cell(); - - - TextCell.prototype.create_element = function () { - var cell = $("
").addClass('cell text_cell border-box-sizing'). - append( - $(""). - addClass('text_cell_input'). - attr('rows',1). - attr('cols',80). - autogrow() - ).append( - // The tabindex=-1 makes this div focusable. - $('
').addClass('text_cell_render').attr('tabindex','-1') - ) - this.element = cell; - }; - - - TextCell.prototype.bind_events = function () { - IPython.Cell.prototype.bind_events.apply(this); - var that = this; - this.element.keydown(function (event) { - if (event.which === 13) { - if (that.rendered) { - that.edit(); - event.preventDefault(); - }; - }; - }); - }; - - - TextCell.prototype.select = function () { - IPython.Cell.prototype.select.apply(this); - var output = this.element.find("div.text_cell_render"); - output.trigger('focus'); - }; - - - TextCell.prototype.edit = function () { - if (this.rendered === true) { - var text_cell = this.element; - var input = text_cell.find("textarea.text_cell_input"); - var output = text_cell.find("div.text_cell_render"); - output.hide(); - input.show().trigger('focus'); - this.rendered = false; - }; - }; - - - TextCell.prototype.render = function () { - if (this.rendered === false) { - var text_cell = this.element; - var input = text_cell.find("textarea.text_cell_input"); - var output = text_cell.find("div.text_cell_render"); - var text = input.val(); - if (text === "") { - text = this.placeholder; - input.val(text); - }; - output.html(text) - input.html(text); - MathJax.Hub.Queue(["Typeset",MathJax.Hub]); - input.hide(); - output.show(); - this.rendered = true; - }; - }; - - - TextCell.prototype.config_mathjax = function () { - var text_cell = this.element; - var that = this; - text_cell.click(function () { - that.edit(); - }).focusout(function () { - that.render(); - }); - - text_cell.trigger("focusout"); - }; - - - TextCell.prototype.get_text = function() { - return this.element.find("textarea.text_cell_input").val(); - }; - - - TextCell.prototype.set_text = function(text) { - this.element.find("textarea.text_cell_input").val(text); - this.element.find("textarea.text_cell_input").html(text); - this.element.find("div.text_cell_render").html(text); - }; - - - TextCell.prototype.at_top = function () { - if (this.rendered) { - return true; - } else { - return false; - } - }; - - - TextCell.prototype.at_bottom = function () { - if (this.rendered) { - return true; - } else { - return false; - } - }; - - - TextCell.prototype.fromJSON = function (data) { - if (data.cell_type === 'text') { - if (data.text !== undefined) { - this.set_text(data.text); - this.grow(this.element.find("textarea.text_cell_input")); - }; - }; - } - - - TextCell.prototype.toJSON = function () { - var data = {} - data.cell_type = 'text'; - data.text = this.get_text(); - return data; - }; - - IPython.TextCell = TextCell; - - return IPython; - -}(IPython)); -