From 068fc2730339f6d405e2e32977c5dd5477c57625 2012-01-30 19:50:04 From: Brian Granger Date: 2012-01-30 19:50:04 Subject: [PATCH] Updating JS part of plaintext cell handling. --- diff --git a/IPython/frontend/html/notebook/static/js/menubar.js b/IPython/frontend/html/notebook/static/js/menubar.js index ae5893d..b513ecd 100644 --- a/IPython/frontend/html/notebook/static/js/menubar.js +++ b/IPython/frontend/html/notebook/static/js/menubar.js @@ -129,8 +129,8 @@ var IPython = (function (IPython) { this.element.find('#to_markdown').click(function () { IPython.notebook.to_markdown(); }); - this.element.find('#to_rst').click(function () { - IPython.notebook.to_rst(); + this.element.find('#to_plaintext').click(function () { + IPython.notebook.to_plaintext(); }); this.element.find('#to_heading1').click(function () { IPython.notebook.to_heading(undefined, 1); diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 60277a5..ec4a74e 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -135,9 +135,9 @@ var IPython = (function (IPython) { that.to_markdown(); that.control_key_active = false; return false; - } else if (event.which === 82 && that.control_key_active) { - // To RST = r - that.to_rst(); + } else if (event.which === 84 && that.control_key_active) { + // To Plaintext = r + that.to_plaintext(); that.control_key_active = false; return false; } else if (event.which === 49 && that.control_key_active) { @@ -170,8 +170,8 @@ var IPython = (function (IPython) { that.to_heading(undefined, 6); that.control_key_active = false; return false; - } else if (event.which === 84 && that.control_key_active) { - // Toggle output = t + } else if (event.which === 79 && that.control_key_active) { + // Toggle output = o that.toggle_output(); that.control_key_active = false; return false; @@ -511,8 +511,8 @@ var IPython = (function (IPython) { cell = new IPython.MarkdownCell(this); } else if (type === 'html') { cell = new IPython.HTMLCell(this); - } else if (type === 'rst') { - cell = new IPython.RSTCell(this); + } else if (type === 'plaintext') { + cell = new IPython.PlaintextCell(this); } else if (type === 'heading') { cell = new IPython.HeadingCell(this); }; @@ -545,8 +545,8 @@ var IPython = (function (IPython) { cell = new IPython.MarkdownCell(this); } else if (type === 'html') { cell = new IPython.HTMLCell(this); - } else if (type === 'rst') { - cell = new IPython.RSTCell(this); + } else if (type === 'plaintext') { + cell = new IPython.PlaintextCell(this); } else if (type === 'heading') { cell = new IPython.HeadingCell(this); }; @@ -628,14 +628,14 @@ var IPython = (function (IPython) { }; - Notebook.prototype.to_rst = function (index) { + Notebook.prototype.to_plaintext = function (index) { 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.RSTCell)) { - target_cell = this.insert_cell_below('rst',i); + if (!(source_cell instanceof IPython.PlaintextCell)) { + target_cell = this.insert_cell_below('plaintext',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { text = ''; diff --git a/IPython/frontend/html/notebook/static/js/quickhelp.js b/IPython/frontend/html/notebook/static/js/quickhelp.js index 8e29541..585e621 100644 --- a/IPython/frontend/html/notebook/static/js/quickhelp.js +++ b/IPython/frontend/html/notebook/static/js/quickhelp.js @@ -34,13 +34,14 @@ var IPython = (function (IPython) { {key: 'Ctrl-m d', help: 'delete cell'}, {key: 'Ctrl-m a', help: 'insert cell above'}, {key: 'Ctrl-m b', help: 'insert cell below'}, - {key: 'Ctrl-m t', help: 'toggle output'}, + {key: 'Ctrl-m o', help: 'toggle output'}, {key: 'Ctrl-m l', help: 'toggle line numbers'}, {key: 'Ctrl-m s', help: 'save notebook'}, {key: 'Ctrl-m j', help: 'move cell down'}, {key: 'Ctrl-m k', help: 'move cell up'}, {key: 'Ctrl-m y', help: 'code cell'}, {key: 'Ctrl-m m', help: 'markdown cell'}, + {key: 'Ctrl-m t', help: 'plaintext cell'}, {key: 'Ctrl-m p', help: 'select previous'}, {key: 'Ctrl-m n', help: 'select next'}, {key: 'Ctrl-m i', help: 'interrupt kernel'}, diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js index 984328f..6e58523 100644 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ b/IPython/frontend/html/notebook/static/js/textcell.js @@ -237,26 +237,26 @@ var IPython = (function (IPython) { }; - // RSTCell + // PlaintextCell - var RSTCell = function (notebook) { - this.placeholder = "Type *ReStructured Text* and LaTeX: $\\alpha^2$"; + var PlaintextCell = function (notebook) { + this.placeholder = "Type plain text and LaTeX: $\\alpha^2$"; this.code_mirror_mode = 'rst'; IPython.TextCell.apply(this, arguments); - this.cell_type = 'rst'; + this.cell_type = 'plaintext'; }; - RSTCell.prototype = new TextCell(); + PlaintextCell.prototype = new TextCell(); - RSTCell.prototype.render = function () { + PlaintextCell.prototype.render = function () { this.rendered = true; this.edit(); }; - RSTCell.prototype.select = function () { + PlaintextCell.prototype.select = function () { IPython.Cell.prototype.select.apply(this); // In some cases (inserting a new cell) we need a refresh before and // after the focus. Not sure why this is the case. @@ -266,7 +266,7 @@ var IPython = (function (IPython) { }; - RSTCell.prototype.at_top = function () { + PlaintextCell.prototype.at_top = function () { var cursor = this.code_mirror.getCursor(); if (cursor.line === 0) { return true; @@ -276,7 +276,7 @@ var IPython = (function (IPython) { }; - RSTCell.prototype.at_bottom = function () { + PlaintextCell.prototype.at_bottom = function () { var cursor = this.code_mirror.getCursor(); if (cursor.line === (this.code_mirror.lineCount()-1)) { return true; @@ -341,7 +341,7 @@ var IPython = (function (IPython) { IPython.TextCell = TextCell; IPython.HTMLCell = HTMLCell; IPython.MarkdownCell = MarkdownCell; - IPython.RSTCell = RSTCell; + IPython.PlaintextCell = PlaintextCell; IPython.HeadingCell = HeadingCell; diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index b9e25ee..15e0a53 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -119,7 +119,7 @@
  • Code
  • Markdown
  • -
  • RST
  • +
  • Plaintext
  • Heading 1
  • Heading 2
  • Heading 3