Show More
@@ -1,415 +1,418 b'' | |||
|
1 | 1 | /** |
|
2 | 2 | * Primary styles |
|
3 | 3 | * |
|
4 | 4 | * Author: IPython Development Team |
|
5 | 5 | */ |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | body { |
|
9 | 9 | overflow: hidden; |
|
10 | 10 | } |
|
11 | 11 | |
|
12 | 12 | blockquote { |
|
13 | 13 | border-left: 4px solid #DDD; |
|
14 | 14 | padding: 0 15px; |
|
15 | 15 | color: #777; |
|
16 | 16 | } |
|
17 | 17 | |
|
18 | 18 | span#save_widget { |
|
19 | 19 | padding: 5px; |
|
20 | 20 | margin: 0px 0px 0px 300px; |
|
21 | 21 | display:inline-block; |
|
22 | 22 | } |
|
23 | 23 | |
|
24 | 24 | span#notebook_name { |
|
25 | 25 | height: 1em; |
|
26 | 26 | line-height: 1em; |
|
27 | 27 | padding: 3px; |
|
28 | 28 | border: none; |
|
29 | 29 | font-size: 146.5%; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | .ui-menubar-item .ui-button .ui-button-text { |
|
34 | 34 | padding: 0.4em 1.0em; |
|
35 | 35 | font-size: 100%; |
|
36 | 36 | } |
|
37 | 37 | |
|
38 | 38 | .ui-menu { |
|
39 | 39 | -moz-box-shadow: 0px 6px 10px -1px #adadad; |
|
40 | 40 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; |
|
41 | 41 | box-shadow: 0px 6px 10px -1px #adadad; |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | .ui-menu .ui-menu-item a { |
|
45 | 45 | border: 1px solid transparent; |
|
46 | 46 | padding: 2px 1.6em; |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | .ui-menu .ui-menu-item a.ui-state-focus { |
|
50 | 50 | margin: 0; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | .ui-menu hr { |
|
54 | 54 | margin: 0.3em 0; |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | #menubar_container { |
|
58 | 58 | position: relative; |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | #notification_area { |
|
62 | 62 | position: absolute; |
|
63 | 63 | right: 0px; |
|
64 | 64 | top: 0px; |
|
65 | 65 | height: 25px; |
|
66 | 66 | padding: 3px 0px; |
|
67 | 67 | padding-right: 3px; |
|
68 | 68 | z-index: 10; |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | .notification_widget{ |
|
72 | 72 | float : right; |
|
73 | 73 | right: 0px; |
|
74 | 74 | top: 1px; |
|
75 | 75 | height: 25px; |
|
76 | 76 | padding: 3px 6px; |
|
77 | 77 | z-index: 10; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | .toolbar { |
|
81 | 81 | padding: 3px 15px; |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | #maintoolbar > select, #maintoolbar label { |
|
85 | 85 | font-size: 85%; |
|
86 | margin-left:0.3em; | |
|
87 | margin-right:0.3em; | |
|
88 | ||
|
86 | 89 | } |
|
87 | 90 | |
|
88 | 91 | |
|
89 | 92 | div#main_app { |
|
90 | 93 | width: 100%; |
|
91 | 94 | position: relative; |
|
92 | 95 | } |
|
93 | 96 | |
|
94 | 97 | span#quick_help_area { |
|
95 | 98 | position: static; |
|
96 | 99 | padding: 5px 0px; |
|
97 | 100 | margin: 0px 0px 0px 0px; |
|
98 | 101 | } |
|
99 | 102 | |
|
100 | 103 | .help_string { |
|
101 | 104 | float: right; |
|
102 | 105 | width: 170px; |
|
103 | 106 | padding: 0px 5px; |
|
104 | 107 | text-align: left; |
|
105 | 108 | font-size: 85%; |
|
106 | 109 | } |
|
107 | 110 | |
|
108 | 111 | .help_string_label { |
|
109 | 112 | float: right; |
|
110 | 113 | font-size: 85%; |
|
111 | 114 | } |
|
112 | 115 | |
|
113 | 116 | div#notebook_panel { |
|
114 | 117 | margin: 0px 0px 0px 0px; |
|
115 | 118 | padding: 0px; |
|
116 | 119 | } |
|
117 | 120 | |
|
118 | 121 | div#notebook { |
|
119 | 122 | overflow-y: scroll; |
|
120 | 123 | overflow-x: auto; |
|
121 | 124 | width: 100%; |
|
122 | 125 | /* This spaces the cell away from the edge of the notebook area */ |
|
123 | 126 | padding: 5px 5px 15px 5px; |
|
124 | 127 | margin: 0px; |
|
125 | 128 | background-color: white; |
|
126 | 129 | } |
|
127 | 130 | |
|
128 | 131 | div#pager_splitter { |
|
129 | 132 | height: 8px; |
|
130 | 133 | } |
|
131 | 134 | |
|
132 | 135 | #pager_container { |
|
133 | 136 | position : relative; |
|
134 | 137 | } |
|
135 | 138 | |
|
136 | 139 | div#pager { |
|
137 | 140 | padding: 15px; |
|
138 | 141 | overflow: auto; |
|
139 | 142 | display: none; |
|
140 | 143 | } |
|
141 | 144 | |
|
142 | 145 | div.ui-widget-content { |
|
143 | 146 | border: 1px solid #aaa; |
|
144 | 147 | outline: none; |
|
145 | 148 | } |
|
146 | 149 | |
|
147 | 150 | .cell { |
|
148 | 151 | border: 1px solid transparent; |
|
149 | 152 | } |
|
150 | 153 | |
|
151 | 154 | div.cell { |
|
152 | 155 | width: 100%; |
|
153 | 156 | padding: 5px 5px 5px 0px; |
|
154 | 157 | /* This acts as a spacer between cells, that is outside the border */ |
|
155 | 158 | margin: 2px 0px 2px 0px; |
|
156 | 159 | } |
|
157 | 160 | |
|
158 | 161 | div.code_cell { |
|
159 | 162 | background-color: white; |
|
160 | 163 | } |
|
161 | 164 | |
|
162 | 165 | /* any special styling for code cells that are currently running goes here */ |
|
163 | 166 | div.code_cell.running { |
|
164 | 167 | } |
|
165 | 168 | |
|
166 | 169 | div.prompt { |
|
167 | 170 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ |
|
168 | 171 | width: 11ex; |
|
169 | 172 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ |
|
170 | 173 | padding: 0.4em; |
|
171 | 174 | margin: 0px; |
|
172 | 175 | font-family: monospace; |
|
173 | 176 | text-align:right; |
|
174 | 177 | } |
|
175 | 178 | |
|
176 | 179 | div.input { |
|
177 | 180 | page-break-inside: avoid; |
|
178 | 181 | } |
|
179 | 182 | |
|
180 | 183 | /* input_area and input_prompt must match in top border and margin for alignment */ |
|
181 | 184 | div.input_area { |
|
182 | 185 | color: black; |
|
183 | 186 | border: 1px solid #ddd; |
|
184 | 187 | border-radius: 3px; |
|
185 | 188 | background: #f7f7f7; |
|
186 | 189 | } |
|
187 | 190 | |
|
188 | 191 | div.input_prompt { |
|
189 | 192 | color: navy; |
|
190 | 193 | border-top: 1px solid transparent; |
|
191 | 194 | } |
|
192 | 195 | |
|
193 | 196 | div.output_wrapper { |
|
194 | 197 | /* This is a spacer between the input and output of each cell */ |
|
195 | 198 | margin-top: 5px; |
|
196 | 199 | margin-left: 5px; |
|
197 | 200 | /* FF needs explicit width to stretch */ |
|
198 | 201 | width: 100%; |
|
199 | 202 | /* this position must be relative to enable descendents to be absolute within it */ |
|
200 | 203 | position: relative; |
|
201 | 204 | } |
|
202 | 205 | |
|
203 | 206 | /* class for the output area when it should be height-limited */ |
|
204 | 207 | div.output_scroll { |
|
205 | 208 | /* ideally, this would be max-height, but FF barfs all over that */ |
|
206 | 209 | height: 24em; |
|
207 | 210 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ |
|
208 | 211 | width: 100%; |
|
209 | 212 | |
|
210 | 213 | overflow: auto; |
|
211 | 214 | border-radius: 3px; |
|
212 | 215 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); |
|
213 | 216 | } |
|
214 | 217 | |
|
215 | 218 | /* output div while it is collapsed */ |
|
216 | 219 | div.output_collapsed { |
|
217 | 220 | margin-right: 5px; |
|
218 | 221 | } |
|
219 | 222 | |
|
220 | 223 | div.out_prompt_overlay { |
|
221 | 224 | height: 100%; |
|
222 | 225 | padding: 0px; |
|
223 | 226 | position: absolute; |
|
224 | 227 | border-radius: 3px; |
|
225 | 228 | } |
|
226 | 229 | |
|
227 | 230 | div.out_prompt_overlay:hover { |
|
228 | 231 | /* use inner shadow to get border that is computed the same on WebKit/FF */ |
|
229 | 232 | box-shadow: inset 0 0 1px #000; |
|
230 | 233 | background: rgba(240, 240, 240, 0.5); |
|
231 | 234 | } |
|
232 | 235 | |
|
233 | 236 | div.output_prompt { |
|
234 | 237 | color: darkred; |
|
235 | 238 | /* 5px right shift to account for margin in parent container */ |
|
236 | 239 | margin: 0 5px 0 -5px; |
|
237 | 240 | } |
|
238 | 241 | |
|
239 | 242 | /* This class is the outer container of all output sections. */ |
|
240 | 243 | div.output_area { |
|
241 | 244 | padding: 0px; |
|
242 | 245 | page-break-inside: avoid; |
|
243 | 246 | } |
|
244 | 247 | |
|
245 | 248 | /* This class is for the output subarea inside the output_area and after |
|
246 | 249 | the prompt div. */ |
|
247 | 250 | div.output_subarea { |
|
248 | 251 | padding: 0.44em 0.4em 0.4em 1px; |
|
249 | 252 | } |
|
250 | 253 | |
|
251 | 254 | /* The rest of the output_* classes are for special styling of the different |
|
252 | 255 | output types */ |
|
253 | 256 | |
|
254 | 257 | /* all text output has this class: */ |
|
255 | 258 | div.output_text { |
|
256 | 259 | text-align: left; |
|
257 | 260 | color: black; |
|
258 | 261 | font-family: monospace; |
|
259 | 262 | } |
|
260 | 263 | |
|
261 | 264 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ |
|
262 | 265 | div.output_stream { |
|
263 | 266 | padding-top: 0.0em; |
|
264 | 267 | padding-bottom: 0.0em; |
|
265 | 268 | } |
|
266 | 269 | div.output_stdout { |
|
267 | 270 | } |
|
268 | 271 | div.output_stderr { |
|
269 | 272 | background: #fdd; /* very light red background for stderr */ |
|
270 | 273 | } |
|
271 | 274 | |
|
272 | 275 | div.output_latex { |
|
273 | 276 | text-align: left; |
|
274 | 277 | color: black; |
|
275 | 278 | } |
|
276 | 279 | |
|
277 | 280 | div.output_html { |
|
278 | 281 | } |
|
279 | 282 | |
|
280 | 283 | div.output_png { |
|
281 | 284 | } |
|
282 | 285 | |
|
283 | 286 | div.output_jpeg { |
|
284 | 287 | } |
|
285 | 288 | |
|
286 | 289 | div.text_cell { |
|
287 | 290 | background-color: white; |
|
288 | 291 | padding: 5px 5px 5px 5px; |
|
289 | 292 | } |
|
290 | 293 | |
|
291 | 294 | div.text_cell_input { |
|
292 | 295 | color: black; |
|
293 | 296 | border: 1px solid #ddd; |
|
294 | 297 | border-radius: 3px; |
|
295 | 298 | background: #f7f7f7; |
|
296 | 299 | } |
|
297 | 300 | |
|
298 | 301 | div.text_cell_render { |
|
299 | 302 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
300 | 303 | outline: none; |
|
301 | 304 | resize: none; |
|
302 | 305 | width: inherit; |
|
303 | 306 | border-style: none; |
|
304 | 307 | padding: 5px; |
|
305 | 308 | color: black; |
|
306 | 309 | } |
|
307 | 310 | |
|
308 | 311 | /* The following gets added to the <head> if it is detected that the user has a |
|
309 | 312 | * monospace font with inconsistent normal/bold/italic height. See |
|
310 | 313 | * notebookmain.js. Such fonts will have keywords vertically offset with |
|
311 | 314 | * respect to the rest of the text. The user should select a better font. |
|
312 | 315 | * See: https://github.com/ipython/ipython/issues/1503 |
|
313 | 316 | * |
|
314 | 317 | * .CodeMirror span { |
|
315 | 318 | * vertical-align: bottom; |
|
316 | 319 | * } |
|
317 | 320 | */ |
|
318 | 321 | |
|
319 | 322 | .CodeMirror { |
|
320 | 323 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
321 | 324 | } |
|
322 | 325 | |
|
323 | 326 | .CodeMirror-scroll { |
|
324 | 327 | height: auto; /* Changed to auto to autogrow */ |
|
325 | 328 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ |
|
326 | 329 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ |
|
327 | 330 | overflow-y: hidden; |
|
328 | 331 | overflow-x: auto; /* Changed from auto to remove scrollbar */ |
|
329 | 332 | } |
|
330 | 333 | |
|
331 | 334 | /* CSS font colors for translated ANSI colors. */ |
|
332 | 335 | |
|
333 | 336 | |
|
334 | 337 | .ansiblack {color: black;} |
|
335 | 338 | .ansired {color: darkred;} |
|
336 | 339 | .ansigreen {color: darkgreen;} |
|
337 | 340 | .ansiyellow {color: brown;} |
|
338 | 341 | .ansiblue {color: darkblue;} |
|
339 | 342 | .ansipurple {color: darkviolet;} |
|
340 | 343 | .ansicyan {color: steelblue;} |
|
341 | 344 | .ansigrey {color: grey;} |
|
342 | 345 | .ansibold {font-weight: bold;} |
|
343 | 346 | |
|
344 | 347 | .completions { |
|
345 | 348 | position: absolute; |
|
346 | 349 | z-index: 10; |
|
347 | 350 | overflow: hidden; |
|
348 | 351 | border: 1px solid grey; |
|
349 | 352 | } |
|
350 | 353 | |
|
351 | 354 | .completions select { |
|
352 | 355 | background: white; |
|
353 | 356 | outline: none; |
|
354 | 357 | border: none; |
|
355 | 358 | padding: 0px; |
|
356 | 359 | margin: 0px; |
|
357 | 360 | overflow: auto; |
|
358 | 361 | font-family: monospace; |
|
359 | 362 | } |
|
360 | 363 | |
|
361 | 364 | option.context { |
|
362 | 365 | background-color: #DEF7FF; |
|
363 | 366 | } |
|
364 | 367 | option.introspection { |
|
365 | 368 | background-color: #EBF4EB; |
|
366 | 369 | } |
|
367 | 370 | |
|
368 | 371 | /*fixed part of the completion*/ |
|
369 | 372 | .completions p b { |
|
370 | 373 | font-weight:bold; |
|
371 | 374 | } |
|
372 | 375 | |
|
373 | 376 | .completions p { |
|
374 | 377 | background: #DDF; |
|
375 | 378 | /*outline: none; |
|
376 | 379 | padding: 0px;*/ |
|
377 | 380 | border-bottom: black solid 1px; |
|
378 | 381 | padding: 1px; |
|
379 | 382 | font-family: monospace; |
|
380 | 383 | } |
|
381 | 384 | |
|
382 | 385 | pre.dialog { |
|
383 | 386 | background-color: #f7f7f7; |
|
384 | 387 | border: 1px solid #ddd; |
|
385 | 388 | border-radius: 3px; |
|
386 | 389 | padding: 0.4em; |
|
387 | 390 | padding-left: 2em; |
|
388 | 391 | } |
|
389 | 392 | |
|
390 | 393 | p.dialog { |
|
391 | 394 | padding : 0.2em; |
|
392 | 395 | } |
|
393 | 396 | |
|
394 | 397 | .shortcut_key { |
|
395 | 398 | display: inline-block; |
|
396 | 399 | width: 15ex; |
|
397 | 400 | text-align: right; |
|
398 | 401 | font-family: monospace; |
|
399 | 402 | } |
|
400 | 403 | |
|
401 | 404 | .shortcut_descr { |
|
402 | 405 | } |
|
403 | 406 | |
|
404 | 407 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems |
|
405 | 408 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. |
|
406 | 409 | */ |
|
407 | 410 | pre, code, kbd, samp { white-space: pre-wrap; } |
|
408 | 411 | |
|
409 | 412 | #fonttest { |
|
410 | 413 | font-family: monospace; |
|
411 | 414 | } |
|
412 | 415 | |
|
413 | 416 | .js-error { |
|
414 | 417 | color: darkred; |
|
415 | 418 | } |
@@ -1,178 +1,178 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // ToolBar |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var MainToolBar = function (selector) { |
|
15 | 15 | this.selector = selector; |
|
16 | 16 | IPython.ToolBar.apply(this, arguments); |
|
17 | 17 | this.construct(); |
|
18 | 18 | this.add_drop_down_list(); |
|
19 | 19 | this.bind_events(); |
|
20 | 20 | $(this.selector) |
|
21 | .append($('<label/>').text('CellToolbar')) | |
|
21 | .append($('<label/>').text('Cell Toolbar:')) | |
|
22 | 22 | .append(IPython.CellToolbar.dropdown_preset_element) |
|
23 | 23 | }; |
|
24 | 24 | |
|
25 | 25 | MainToolBar.prototype = new IPython.ToolBar(); |
|
26 | 26 | |
|
27 | 27 | MainToolBar.prototype.construct = function () { |
|
28 | 28 | this.add_buttons_group([ |
|
29 | 29 | { |
|
30 | 30 | id : 'save_b', |
|
31 | 31 | label : 'Save', |
|
32 | 32 | icon : 'ui-icon-disk', |
|
33 | 33 | callback : function () { |
|
34 | 34 | IPython.notebook.save_notebook(); |
|
35 | 35 | } |
|
36 | 36 | } |
|
37 | 37 | ]); |
|
38 | 38 | this.add_buttons_group([ |
|
39 | 39 | { |
|
40 | 40 | id : 'cut_b', |
|
41 | 41 | label : 'Cut Cell', |
|
42 | 42 | icon : 'ui-icon-scissors', |
|
43 | 43 | callback : function () { |
|
44 | 44 | IPython.notebook.cut_cell(); |
|
45 | 45 | } |
|
46 | 46 | }, |
|
47 | 47 | { |
|
48 | 48 | id : 'copy_b', |
|
49 | 49 | label : 'Copy Cell', |
|
50 | 50 | icon : 'ui-icon-copy', |
|
51 | 51 | callback : function () { |
|
52 | 52 | IPython.notebook.copy_cell(); |
|
53 | 53 | } |
|
54 | 54 | }, |
|
55 | 55 | { |
|
56 | 56 | id : 'paste_b', |
|
57 | 57 | label : 'Paste Cell Below', |
|
58 | 58 | icon : 'ui-icon-clipboard', |
|
59 | 59 | callback : function () { |
|
60 | 60 | IPython.notebook.paste_cell_below(); |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | ],'cut_copy_paste'); |
|
64 | 64 | |
|
65 | 65 | this.add_buttons_group([ |
|
66 | 66 | { |
|
67 | 67 | id : 'move_up_b', |
|
68 | 68 | label : 'Move Cell Up', |
|
69 | 69 | icon : 'ui-icon-arrowthick-1-n', |
|
70 | 70 | callback : function () { |
|
71 | 71 | IPython.notebook.move_cell_up(); |
|
72 | 72 | } |
|
73 | 73 | }, |
|
74 | 74 | { |
|
75 | 75 | id : 'move_down_b', |
|
76 | 76 | label : 'Move Cell Down', |
|
77 | 77 | icon : 'ui-icon-arrowthick-1-s', |
|
78 | 78 | callback : function () { |
|
79 | 79 | IPython.notebook.move_cell_down(); |
|
80 | 80 | } |
|
81 | 81 | } |
|
82 | 82 | ],'move_up_down'); |
|
83 | 83 | |
|
84 | 84 | this.add_buttons_group([ |
|
85 | 85 | { |
|
86 | 86 | id : 'insert_above_b', |
|
87 | 87 | label : 'Insert Cell Above', |
|
88 | 88 | icon : 'ui-icon-arrowthickstop-1-n', |
|
89 | 89 | callback : function () { |
|
90 | 90 | IPython.notebook.insert_cell_above('code'); |
|
91 | 91 | } |
|
92 | 92 | }, |
|
93 | 93 | { |
|
94 | 94 | id : 'insert_below_b', |
|
95 | 95 | label : 'Insert Cell Below', |
|
96 | 96 | icon : 'ui-icon-arrowthickstop-1-s', |
|
97 | 97 | callback : function () { |
|
98 | 98 | IPython.notebook.insert_cell_below('code'); |
|
99 | 99 | } |
|
100 | 100 | } |
|
101 | 101 | ],'insert_above_below'); |
|
102 | 102 | |
|
103 | 103 | this.add_buttons_group([ |
|
104 | 104 | { |
|
105 | 105 | id : 'run_b', |
|
106 | 106 | label : 'Run Cell', |
|
107 | 107 | icon : 'ui-icon-play', |
|
108 | 108 | callback : function () { |
|
109 | 109 | IPython.notebook.execute_selected_cell(); |
|
110 | 110 | } |
|
111 | 111 | }, |
|
112 | 112 | { |
|
113 | 113 | id : 'interrupt_b', |
|
114 | 114 | label : 'Interrupt', |
|
115 | 115 | icon : 'ui-icon-stop', |
|
116 | 116 | callback : function () { |
|
117 | 117 | IPython.notebook.kernel.interrupt(); |
|
118 | 118 | } |
|
119 | 119 | } |
|
120 | 120 | ],'run_int'); |
|
121 | 121 | }; |
|
122 | 122 | |
|
123 | 123 | MainToolBar.prototype.add_drop_down_list = function () { |
|
124 | 124 | var select = $(this.selector) |
|
125 | 125 | .append($('<select/>') |
|
126 | 126 | .attr('id','cell_type') |
|
127 | 127 | .addClass('ui-widget ui-widget-content') |
|
128 | 128 | .append($('<option/>').attr('value','code').text('Code')) |
|
129 | 129 | .append($('<option/>').attr('value','markdown').text('Markdown')) |
|
130 | 130 | .append($('<option/>').attr('value','raw').text('Raw Text')) |
|
131 | 131 | .append($('<option/>').attr('value','heading1').text('Heading 1')) |
|
132 | 132 | .append($('<option/>').attr('value','heading2').text('Heading 2')) |
|
133 | 133 | .append($('<option/>').attr('value','heading3').text('Heading 3')) |
|
134 | 134 | .append($('<option/>').attr('value','heading4').text('Heading 4')) |
|
135 | 135 | .append($('<option/>').attr('value','heading5').text('Heading 5')) |
|
136 | 136 | .append($('<option/>').attr('value','heading6').text('Heading 6')) |
|
137 | 137 | ); |
|
138 | 138 | }; |
|
139 | 139 | |
|
140 | 140 | MainToolBar.prototype.bind_events = function () { |
|
141 | 141 | var that = this; |
|
142 | 142 | |
|
143 | 143 | this.element.find('#cell_type').change(function () { |
|
144 | 144 | var cell_type = $(this).val(); |
|
145 | 145 | if (cell_type === 'code') { |
|
146 | 146 | IPython.notebook.to_code(); |
|
147 | 147 | } else if (cell_type === 'markdown') { |
|
148 | 148 | IPython.notebook.to_markdown(); |
|
149 | 149 | } else if (cell_type === 'raw') { |
|
150 | 150 | IPython.notebook.to_raw(); |
|
151 | 151 | } else if (cell_type === 'heading1') { |
|
152 | 152 | IPython.notebook.to_heading(undefined, 1); |
|
153 | 153 | } else if (cell_type === 'heading2') { |
|
154 | 154 | IPython.notebook.to_heading(undefined, 2); |
|
155 | 155 | } else if (cell_type === 'heading3') { |
|
156 | 156 | IPython.notebook.to_heading(undefined, 3); |
|
157 | 157 | } else if (cell_type === 'heading4') { |
|
158 | 158 | IPython.notebook.to_heading(undefined, 4); |
|
159 | 159 | } else if (cell_type === 'heading5') { |
|
160 | 160 | IPython.notebook.to_heading(undefined, 5); |
|
161 | 161 | } else if (cell_type === 'heading6') { |
|
162 | 162 | IPython.notebook.to_heading(undefined, 6); |
|
163 | 163 | } |
|
164 | 164 | }); |
|
165 | 165 | $([IPython.events]).on('selected_cell_type_changed.Notebook', function (event, data) { |
|
166 | 166 | if (data.cell_type === 'heading') { |
|
167 | 167 | that.element.find('#cell_type').val(data.cell_type+data.level); |
|
168 | 168 | } else { |
|
169 | 169 | that.element.find('#cell_type').val(data.cell_type); |
|
170 | 170 | } |
|
171 | 171 | }); |
|
172 | 172 | }; |
|
173 | 173 | |
|
174 | 174 | IPython.MainToolBar = MainToolBar; |
|
175 | 175 | |
|
176 | 176 | return IPython; |
|
177 | 177 | |
|
178 | 178 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now