##// END OF EJS Templates
Fixing auto-indent issues in CodeMirror config....
Brian Granger -
Show More
@@ -13,6 +13,7 var IPython = (function (IPython) {
13 13
14 14 var utils = IPython.utils;
15 15
16
16 17 var Cell = function (notebook) {
17 18 this.placeholder = this.placeholder || '';
18 19 this.notebook = notebook;
@@ -24,16 +25,17 var IPython = (function (IPython) {
24 25 this.element = null;
25 26 this.create_element();
26 27 if (this.element !== null) {
27 this.set_autoindent(true);
28 28 this.element.data("cell", this);
29 29 this.bind_events();
30 30 }
31 31 this.cell_id = utils.uuid();
32 32 };
33 33
34
34 35 // Subclasses must implement create_element.
35 36 Cell.prototype.create_element = function () {};
36 37
38
37 39 Cell.prototype.bind_events = function () {
38 40 var that = this;
39 41 var nb = that.notebook;
@@ -49,6 +51,7 var IPython = (function (IPython) {
49 51 });
50 52 };
51 53
54
52 55 // typeset with MathJax if MathJax is available
53 56 Cell.prototype.typeset = function () {
54 57 if (window.MathJax){
@@ -121,6 +124,7 var IPython = (function (IPython) {
121 124 return text;
122 125 };
123 126
127
124 128 Cell.prototype.grow = function(element) {
125 129 // Grow the cell by hand. This is used upon reloading from JSON, when the
126 130 // autogrow handler is not called.
@@ -138,16 +142,6 var IPython = (function (IPython) {
138 142 };
139 143
140 144
141 Cell.prototype.set_autoindent = function (state) {
142 if (state) {
143 this.code_mirror.setOption('tabMode', 'indent');
144 this.code_mirror.setOption('enterMode', 'indent');
145 } else {
146 this.code_mirror.setOption('tabMode', 'shift');
147 this.code_mirror.setOption('enterMode', 'flat');
148 }
149 };
150
151 145 IPython.Cell = Cell;
152 146
153 147 return IPython;
@@ -32,7 +32,6 var IPython = (function (IPython) {
32 32 this.set_tooltipontab(true);
33 33 this.set_smartcompleter(true);
34 34 this.set_timebeforetooltip(1200);
35 this.set_autoindent(true);
36 35 };
37 36
38 37
@@ -723,6 +722,7 var IPython = (function (IPython) {
723 722 };
724 723 };
725 724
725
726 726 // Cell collapsing and output clearing
727 727
728 728 Notebook.prototype.collapse = function (index) {
@@ -750,22 +750,16 var IPython = (function (IPython) {
750 750 this.time_before_tooltip = time;
751 751 };
752 752
753
753 754 Notebook.prototype.set_tooltipontab = function (state) {
754 755 this.tooltip_on_tab = state;
755 756 };
756 757
758
757 759 Notebook.prototype.set_smartcompleter = function (state) {
758 760 this.smart_completer = state;
759 761 };
760 762
761 Notebook.prototype.set_autoindent = function (state) {
762 var cells = this.get_cells();
763 len = cells.length;
764 for (var i=0; i<len; i++) {
765 cells[i].set_autoindent(state);
766 };
767 };
768
769 763
770 764 Notebook.prototype.clear_all_output = function () {
771 765 var ncells = this.ncells();
@@ -778,6 +772,7 var IPython = (function (IPython) {
778 772 this.dirty = true;
779 773 };
780 774
775
781 776 // Other cell functions: line numbers, ...
782 777
783 778 Notebook.prototype.cell_toggle_line_numbers = function() {
General Comments 0
You need to be logged in to leave comments. Login now