diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js index 31141ca..e24be0e 100644 --- a/IPython/frontend/html/notebook/static/js/cell.js +++ b/IPython/frontend/html/notebook/static/js/cell.js @@ -13,6 +13,7 @@ var IPython = (function (IPython) { var utils = IPython.utils; + var Cell = function (notebook) { this.placeholder = this.placeholder || ''; this.notebook = notebook; @@ -24,16 +25,17 @@ var IPython = (function (IPython) { this.element = null; this.create_element(); if (this.element !== null) { - this.set_autoindent(true); this.element.data("cell", this); this.bind_events(); } this.cell_id = utils.uuid(); }; + // Subclasses must implement create_element. Cell.prototype.create_element = function () {}; + Cell.prototype.bind_events = function () { var that = this; var nb = that.notebook; @@ -49,6 +51,7 @@ var IPython = (function (IPython) { }); }; + // typeset with MathJax if MathJax is available Cell.prototype.typeset = function () { if (window.MathJax){ @@ -121,6 +124,7 @@ var IPython = (function (IPython) { return text; }; + Cell.prototype.grow = function(element) { // Grow the cell by hand. This is used upon reloading from JSON, when the // autogrow handler is not called. @@ -138,16 +142,6 @@ var IPython = (function (IPython) { }; - Cell.prototype.set_autoindent = function (state) { - if (state) { - this.code_mirror.setOption('tabMode', 'indent'); - this.code_mirror.setOption('enterMode', 'indent'); - } else { - this.code_mirror.setOption('tabMode', 'shift'); - this.code_mirror.setOption('enterMode', 'flat'); - } - }; - IPython.Cell = Cell; return IPython; diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 3db6305..031d46a 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -32,7 +32,6 @@ var IPython = (function (IPython) { this.set_tooltipontab(true); this.set_smartcompleter(true); this.set_timebeforetooltip(1200); - this.set_autoindent(true); }; @@ -723,6 +722,7 @@ var IPython = (function (IPython) { }; }; + // Cell collapsing and output clearing Notebook.prototype.collapse = function (index) { @@ -750,22 +750,16 @@ var IPython = (function (IPython) { this.time_before_tooltip = time; }; + Notebook.prototype.set_tooltipontab = function (state) { this.tooltip_on_tab = state; }; + Notebook.prototype.set_smartcompleter = function (state) { this.smart_completer = state; }; - Notebook.prototype.set_autoindent = function (state) { - var cells = this.get_cells(); - len = cells.length; - for (var i=0; i