From 2a9422eae28764d37957757426c410038c86959d 2012-01-30 20:08:36 From: Brian Granger Date: 2012-01-30 20:08:36 Subject: [PATCH] Heading/plaintext cells now wired up to toolbar UI. --- diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index ec4a74e..5f68ffa 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -136,7 +136,7 @@ var IPython = (function (IPython) { that.control_key_active = false; return false; } else if (event.which === 84 && that.control_key_active) { - // To Plaintext = r + // To Plaintext = t that.to_plaintext(); that.control_key_active = false; return false; @@ -401,7 +401,11 @@ var IPython = (function (IPython) { }; var cell = this.get_cell(index) cell.select(); - IPython.toolbar.set_cell_type(cell.cell_type); + if (cell.cell_type === 'heading') { + IPython.toolbar.set_cell_type(cell.cell_type+cell.level); + } else { + IPython.toolbar.set_cell_type(cell.cell_type) + } }; return this; }; @@ -672,6 +676,7 @@ var IPython = (function (IPython) { source_element.remove(); this.dirty = true; }; + IPython.toolbar.set_cell_type("heading"+level); }; }; diff --git a/IPython/frontend/html/notebook/static/js/toolbar.js b/IPython/frontend/html/notebook/static/js/toolbar.js index 501f00a..df0de25 100644 --- a/IPython/frontend/html/notebook/static/js/toolbar.js +++ b/IPython/frontend/html/notebook/static/js/toolbar.js @@ -108,6 +108,20 @@ var IPython = (function (IPython) { IPython.notebook.to_code(); } else if (cell_type === 'markdown') { IPython.notebook.to_markdown(); + } else if (cell_type === 'plaintext') { + IPython.notebook.to_plaintext(); + } else if (cell_type === 'heading1') { + IPython.notebook.to_heading(undefined, 1); + } else if (cell_type === 'heading2') { + IPython.notebook.to_heading(undefined, 2); + } else if (cell_type === 'heading3') { + IPython.notebook.to_heading(undefined, 3); + } else if (cell_type === 'heading4') { + IPython.notebook.to_heading(undefined, 4); + } else if (cell_type === 'heading5') { + IPython.notebook.to_heading(undefined, 5); + } else if (cell_type === 'heading6') { + IPython.notebook.to_heading(undefined, 6); }; }); diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index 15e0a53..242a5d0 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -180,6 +180,13 @@