Show More
@@ -371,18 +371,16 var IPython = (function (IPython) { | |||||
371 | } |
|
371 | } | |
372 |
|
372 | |||
373 |
|
373 | |||
374 |
OutputArea.prototype._append_javascript_error = function (err, |
|
374 | OutputArea.prototype._append_javascript_error = function (err, element) { | |
375 | // display a message when a javascript error occurs in display output |
|
375 | // display a message when a javascript error occurs in display output | |
376 | var msg = "Javascript error adding output!" |
|
376 | var msg = "Javascript error adding output!" | |
377 | console.log(msg, err); |
|
377 | if ( element === undefined ) return; | |
378 | if ( container === undefined ) return; |
|
378 | element.append( | |
379 | container.append( |
|
|||
380 | $('<div/>').html(msg + "<br/>" + |
|
379 | $('<div/>').html(msg + "<br/>" + | |
381 | err.toString() + |
|
380 | err.toString() + | |
382 | '<br/>See your browser Javascript console for more details.' |
|
381 | '<br/>See your browser Javascript console for more details.' | |
383 | ).addClass('js-error') |
|
382 | ).addClass('js-error') | |
384 | ); |
|
383 | ); | |
385 | container.show(); |
|
|||
386 | }; |
|
384 | }; | |
387 |
|
385 | |||
388 | OutputArea.prototype._safe_append = function (toinsert) { |
|
386 | OutputArea.prototype._safe_append = function (toinsert) { | |
@@ -394,7 +392,13 var IPython = (function (IPython) { | |||||
394 | this.element.append(toinsert); |
|
392 | this.element.append(toinsert); | |
395 | } catch(err) { |
|
393 | } catch(err) { | |
396 | console.log(err); |
|
394 | console.log(err); | |
397 | this._append_javascript_error(err, this.element); |
|
395 | // Create an actual output_area and output_subarea, which creates | |
|
396 | // the prompt area and the proper indentation. | |||
|
397 | var toinsert = this.create_output_area(); | |||
|
398 | var subarea = $('<div/>').addClass('output_subarea'); | |||
|
399 | toinsert.append(subarea); | |||
|
400 | this._append_javascript_error(err, subarea); | |||
|
401 | this.element.append(toinsert); | |||
398 | } |
|
402 | } | |
399 | }; |
|
403 | }; | |
400 |
|
404 | |||
@@ -512,16 +516,13 var IPython = (function (IPython) { | |||||
512 |
|
516 | |||
513 | OutputArea.prototype.append_javascript = function (js, md, container) { |
|
517 | OutputArea.prototype.append_javascript = function (js, md, container) { | |
514 | // We just eval the JS code, element appears in the local scope. |
|
518 | // We just eval the JS code, element appears in the local scope. | |
515 | var element = this.create_output_subarea(md, ""); |
|
519 | var element = this.create_output_subarea(md, "output_javascript"); | |
516 | container.append(element); |
|
520 | container.append(element); | |
517 | // Div for js shouldn't be drawn, as it will add empty height to the area. |
|
|||
518 | container.hide(); |
|
|||
519 | // If the Javascript appends content to `element` that should be drawn, then |
|
|||
520 | // it must also call `container.show()`. |
|
|||
521 | try { |
|
521 | try { | |
522 | eval(js); |
|
522 | eval(js); | |
523 | } catch(err) { |
|
523 | } catch(err) { | |
524 | this._append_javascript_error(err, container); |
|
524 | console.log(err); | |
|
525 | this._append_javascript_error(err, element); | |||
525 | } |
|
526 | } | |
526 | }; |
|
527 | }; | |
527 |
|
528 |
@@ -29,3 +29,11 div.inner_cell { | |||||
29 | .vbox(); |
|
29 | .vbox(); | |
30 | .box-flex1(); |
|
30 | .box-flex1(); | |
31 | } |
|
31 | } | |
|
32 | ||||
|
33 | /* This is needed so that empty prompt areas can collapse to zero height when there | |||
|
34 | is no content in the output_subarea and the prompt. The main purpose of this is | |||
|
35 | to make sure that empty JavaScript output_subareas have no height. */ | |||
|
36 | div.prompt:empty { | |||
|
37 | padding-top: 0; | |||
|
38 | padding-bottom: 0; | |||
|
39 | } |
@@ -127,6 +127,11 div.output_png { | |||||
127 | div.output_jpeg { |
|
127 | div.output_jpeg { | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
|
130 | /* Empty output_javascript divs should have no height */ | |||
|
131 | div.output_javascript:empty { | |||
|
132 | padding: 0; | |||
|
133 | } | |||
|
134 | ||||
130 | .js-error { |
|
135 | .js-error { | |
131 | color: darkred; |
|
136 | color: darkred; | |
132 | } |
|
137 | } |
@@ -57,6 +57,7 input.engine_num_input{height:20px;margin-bottom:2px;padding-top:0;padding-botto | |||||
57 | div.cell{border:1px solid transparent;display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;padding:5px 5px 5px 0px;margin:0px;outline:none;}div.cell.selected{border-radius:4px;border:thin #ababab solid;} |
|
57 | div.cell{border:1px solid transparent;display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;padding:5px 5px 5px 0px;margin:0px;outline:none;}div.cell.selected{border-radius:4px;border:thin #ababab solid;} | |
58 | div.prompt{min-width:11ex;padding:0.4em;margin:0px;font-family:monospace;text-align:right;line-height:1.231em;} |
|
58 | div.prompt{min-width:11ex;padding:0.4em;margin:0px;font-family:monospace;text-align:right;line-height:1.231em;} | |
59 | div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} |
|
59 | div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} | |
|
60 | div.prompt:empty{padding-top:0;padding-bottom:0;} | |||
60 | div.input{page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} |
|
61 | div.input{page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} | |
61 | div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;} |
|
62 | div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;} | |
62 | div.input_prompt{color:navy;border-top:1px solid transparent;} |
|
63 | div.input_prompt{color:navy;border-top:1px solid transparent;} | |
@@ -102,6 +103,7 div.output_subarea{padding:0.4em 0.4em 0em 0.4em;-webkit-box-flex:1;-moz-box-fle | |||||
102 | div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} |
|
103 | div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} | |
103 | div.output_stderr{background:#fdd;} |
|
104 | div.output_stderr{background:#fdd;} | |
104 | div.output_latex{text-align:left;} |
|
105 | div.output_latex{text-align:left;} | |
|
106 | div.output_javascript:empty{padding:0;} | |||
105 | .js-error{color:darkred;} |
|
107 | .js-error{color:darkred;} | |
106 | div.raw_input{padding-top:0px;padding-bottom:0px;height:1em;line-height:1em;font-family:monospace;} |
|
108 | div.raw_input{padding-top:0px;padding-bottom:0px;height:1em;line-height:1em;font-family:monospace;} | |
107 | span.input_prompt{font-family:inherit;} |
|
109 | span.input_prompt{font-family:inherit;} |
@@ -1438,6 +1438,7 input.engine_num_input{height:20px;margin-bottom:2px;padding-top:0;padding-botto | |||||
1438 | div.cell{border:1px solid transparent;display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;padding:5px 5px 5px 0px;margin:0px;outline:none;}div.cell.selected{border-radius:4px;border:thin #ababab solid;} |
|
1438 | div.cell{border:1px solid transparent;display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;padding:5px 5px 5px 0px;margin:0px;outline:none;}div.cell.selected{border-radius:4px;border:thin #ababab solid;} | |
1439 | div.prompt{min-width:11ex;padding:0.4em;margin:0px;font-family:monospace;text-align:right;line-height:1.231em;} |
|
1439 | div.prompt{min-width:11ex;padding:0.4em;margin:0px;font-family:monospace;text-align:right;line-height:1.231em;} | |
1440 | div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} |
|
1440 | div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;width:100%;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} | |
|
1441 | div.prompt:empty{padding-top:0;padding-bottom:0;} | |||
1441 | div.input{page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} |
|
1442 | div.input{page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} | |
1442 | div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;} |
|
1443 | div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;} | |
1443 | div.input_prompt{color:navy;border-top:1px solid transparent;} |
|
1444 | div.input_prompt{color:navy;border-top:1px solid transparent;} | |
@@ -1483,6 +1484,7 div.output_subarea{padding:0.4em 0.4em 0em 0.4em;-webkit-box-flex:1;-moz-box-fle | |||||
1483 | div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} |
|
1484 | div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} | |
1484 | div.output_stderr{background:#fdd;} |
|
1485 | div.output_stderr{background:#fdd;} | |
1485 | div.output_latex{text-align:left;} |
|
1486 | div.output_latex{text-align:left;} | |
|
1487 | div.output_javascript:empty{padding:0;} | |||
1486 | .js-error{color:darkred;} |
|
1488 | .js-error{color:darkred;} | |
1487 | div.raw_input{padding-top:0px;padding-bottom:0px;height:1em;line-height:1em;font-family:monospace;} |
|
1489 | div.raw_input{padding-top:0px;padding-bottom:0px;height:1em;line-height:1em;font-family:monospace;} | |
1488 | span.input_prompt{font-family:inherit;} |
|
1490 | span.input_prompt{font-family:inherit;} |
General Comments 0
You need to be logged in to leave comments.
Login now