##// END OF EJS Templates
Improving the scrolling model.
Brian E. Granger -
Show More
@@ -61,7 +61,7 b' input, select { vertical-align: middle; }'
61 body {
61 body {
62 background-color: white;
62 background-color: white;
63 /* This won't propagate to all children so we also set it below */
63 /* This won't propagate to all children so we also set it below */
64 font-size: 12pt;
64 font-size: 10pt;
65 /* This makes sure that the body covers the entire window and needs to
65 /* This makes sure that the body covers the entire window and needs to
66 be in a different element than the display: box in wrapper below */
66 be in a different element than the display: box in wrapper below */
67 position: absolute;
67 position: absolute;
@@ -82,10 +82,6 b' span#ipython_notebook h1 {'
82
82
83 }
83 }
84
84
85 div#tools {
86 font-size: 11pt;
87 }
88
89 span#kernel_status {
85 span#kernel_status {
90 position: absolute;
86 position: absolute;
91 top: 12%;
87 top: 12%;
@@ -138,10 +134,10 b' div#notebook {'
138 overflow-y: scroll;
134 overflow-y: scroll;
139 overflow-x: auto;
135 overflow-x: auto;
140 width: 100%;
136 width: 100%;
141 padding: 0px 15px 15px 15px;
137 padding: 0px 15px 0px 15px;
142 margin: 0px
138 margin: 0px
143 background-color: white;
139 background-color: white;
144 font-size: 12pt;
140 font-size: 10pt;
145 }
141 }
146
142
147 div#pager_splitter {
143 div#pager_splitter {
@@ -149,12 +145,13 b' div#pager_splitter {'
149 }
145 }
150
146
151 div#pager {
147 div#pager {
148 padding: 15px;
152 overflow: auto;
149 overflow: auto;
153 }
150 }
154
151
155 .monospace-font {
152 .monospace-font {
156 font-family: monospace;
153 font-family: monospace;
157 font-size: 12pt;
154 font-size: 10pt;
158 }
155 }
159
156
160 div.cell {
157 div.cell {
@@ -194,7 +191,7 b' div.output_area {'
194
191
195 div.output_latex {
192 div.output_latex {
196 /* Slightly bigger than the rest of the notebook */
193 /* Slightly bigger than the rest of the notebook */
197 font-size: 13pt;
194 font-size: 11pt;
198 }
195 }
199
196
200 div.output_png {
197 div.output_png {
@@ -206,7 +203,7 b' div.text_cell {'
206
203
207 textarea.text_cell_input {
204 textarea.text_cell_input {
208 /* Slightly bigger than the rest of the notebook */
205 /* Slightly bigger than the rest of the notebook */
209 font-size: 13pt;
206 font-size: 11pt;
210 outline: none;
207 outline: none;
211 resize: none;
208 resize: none;
212 width: inherit;
209 width: inherit;
@@ -219,7 +216,7 b' textarea.text_cell_input {'
219 div.text_cell_render {
216 div.text_cell_render {
220 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
217 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
221 /* Slightly bigger than the rest of the notebook */
218 /* Slightly bigger than the rest of the notebook */
222 font-size: 13pt;
219 font-size: 11pt;
223 outline: none;
220 outline: none;
224 resize: none;
221 resize: none;
225 width: inherit;
222 width: inherit;
@@ -19,6 +19,7 b' var IPython = (function (IPython) {'
19 this.notebook_save_re = /%notebook save/
19 this.notebook_save_re = /%notebook save/
20 this.notebook_filename_re = /(\w)+.ipynb/
20 this.notebook_filename_re = /(\w)+.ipynb/
21 this.style();
21 this.style();
22 this.create_elements();
22 this.bind_events();
23 this.bind_events();
23 this.start_kernel();
24 this.start_kernel();
24 };
25 };
@@ -29,6 +30,16 b' var IPython = (function (IPython) {'
29 };
30 };
30
31
31
32
33 Notebook.prototype.create_elements = function () {
34 // We add this end_space div to the end of the notebook div to:
35 // i) provide a margin between the last cell and the end of the notebook
36 // ii) to prevent the div from scrolling up when the last cell is being
37 // edited, but is too low on the page, which browsers will do automatically.
38 this.element.append($('<div class="end_space"></div>').height(50));
39 $('div#notebook').addClass('border-box-sizing');
40 };
41
42
32 Notebook.prototype.bind_events = function () {
43 Notebook.prototype.bind_events = function () {
33 var that = this;
44 var that = this;
34 $(document).keydown(function (event) {
45 $(document).keydown(function (event) {
@@ -77,6 +88,8 b' var IPython = (function (IPython) {'
77 }
88 }
78 if (cell_index === (that.ncells()-1)) {
89 if (cell_index === (that.ncells()-1)) {
79 that.insert_code_cell_after();
90 that.insert_code_cell_after();
91 // If we are adding a new cell at the end, scroll down to show it.
92 that.scroll_to_bottom();
80 } else {
93 } else {
81 that.select(cell_index+1);
94 that.select(cell_index+1);
82 };
95 };
@@ -114,6 +127,10 b' var IPython = (function (IPython) {'
114 };
127 };
115
128
116
129
130 Notebook.prototype.scroll_to_bottom = function () {
131 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 'slow');
132 };
133
117 // Cell indexing, retrieval, etc.
134 // Cell indexing, retrieval, etc.
118
135
119
136
@@ -158,6 +175,9 b' var IPython = (function (IPython) {'
158 this.selected_cell().unselect();
175 this.selected_cell().unselect();
159 };
176 };
160 this.cells()[index].select();
177 this.cells()[index].select();
178 if (index === (this.ncells()-1)) {
179 this.scroll_to_bottom();
180 };
161 };
181 };
162 return this;
182 return this;
163 };
183 };
@@ -228,7 +248,7 b' var IPython = (function (IPython) {'
228
248
229
249
230 Notebook.prototype.append_cell = function (cell) {
250 Notebook.prototype.append_cell = function (cell) {
231 this.element.append(cell.element);
251 this.element.find('div.end_space').before(cell.element);
232 return this;
252 return this;
233 };
253 };
234
254
General Comments 0
You need to be logged in to leave comments. Login now