##// END OF EJS Templates
Add extra_class arg to the rest of the append methods,...
Jonathan Frederic -
Show More
@@ -403,7 +403,7 b' var IPython = (function (IPython) {'
403 if (this.prompt_area) {
403 if (this.prompt_area) {
404 toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');
404 toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');
405 }
405 }
406 this.append_mime_type(json, toinsert);
406 this.append_mime_type(json, toinsert, 'output_pyout');
407 this._safe_append(toinsert);
407 this._safe_append(toinsert);
408 // If we just output latex, typeset it.
408 // If we just output latex, typeset it.
409 if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) {
409 if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) {
@@ -498,11 +498,11 b' var IPython = (function (IPython) {'
498 } else {
498 } else {
499 // don't display if we don't know how to sanitize it
499 // don't display if we don't know how to sanitize it
500 console.log("Ignoring untrusted " + type + " output.");
500 console.log("Ignoring untrusted " + type + " output.");
501 continue;
501 continue;
502 }
502 }
503 }
503 }
504 var md = json.metadata || {};
504 var md = json.metadata || {};
505 var toinsert = append.apply(this, [value, md, element]);
505 var toinsert = append.apply(this, [value, md, element, extra_class]);
506 $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]);
506 $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]);
507 return true;
507 return true;
508 }
508 }
@@ -511,9 +511,12 b' var IPython = (function (IPython) {'
511 };
511 };
512
512
513
513
514 OutputArea.prototype.append_html = function (html, md, element) {
514 OutputArea.prototype.append_html = function (html, md, element, extra_class) {
515 var type = 'text/html';
515 var type = 'text/html';
516 var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
516 var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
517 if (extra_class){
518 toinsert.addClass(extra_class);
519 }
517 IPython.keyboard_manager.register_events(toinsert);
520 IPython.keyboard_manager.register_events(toinsert);
518 toinsert.append(html);
521 toinsert.append(html);
519 element.append(toinsert);
522 element.append(toinsert);
@@ -521,10 +524,13 b' var IPython = (function (IPython) {'
521 };
524 };
522
525
523
526
524 OutputArea.prototype.append_javascript = function (js, md, element) {
527 OutputArea.prototype.append_javascript = function (js, md, element, extra_class) {
525 // We just eval the JS code, element appears in the local scope.
528 // We just eval the JS code, element appears in the local scope.
526 var type = 'application/javascript';
529 var type = 'application/javascript';
527 var toinsert = this.create_output_subarea(md, "output_javascript", type);
530 var toinsert = this.create_output_subarea(md, "output_javascript", type);
531 if (extra_class){
532 toinsert.addClass(extra_class);
533 }
528 IPython.keyboard_manager.register_events(toinsert);
534 IPython.keyboard_manager.register_events(toinsert);
529 element.append(toinsert);
535 element.append(toinsert);
530 // FIXME TODO : remove `container element for 3.0`
536 // FIXME TODO : remove `container element for 3.0`
@@ -560,9 +566,12 b' var IPython = (function (IPython) {'
560 };
566 };
561
567
562
568
563 OutputArea.prototype.append_svg = function (svg, md, element) {
569 OutputArea.prototype.append_svg = function (svg, md, element, extra_class) {
564 var type = 'image/svg+xml';
570 var type = 'image/svg+xml';
565 var toinsert = this.create_output_subarea(md, "output_svg", type);
571 var toinsert = this.create_output_subarea(md, "output_svg", type);
572 if (extra_class){
573 toinsert.addClass(extra_class);
574 }
566 toinsert.append(svg);
575 toinsert.append(svg);
567 element.append(toinsert);
576 element.append(toinsert);
568 return toinsert;
577 return toinsert;
@@ -613,9 +622,12 b' var IPython = (function (IPython) {'
613 };
622 };
614
623
615
624
616 OutputArea.prototype.append_jpeg = function (jpeg, md, element) {
625 OutputArea.prototype.append_jpeg = function (jpeg, md, element, extra_class) {
617 var type = 'image/jpeg';
626 var type = 'image/jpeg';
618 var toinsert = this.create_output_subarea(md, "output_jpeg", type);
627 var toinsert = this.create_output_subarea(md, "output_jpeg", type);
628 if (extra_class){
629 toinsert.addClass(extra_class);
630 }
619 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
631 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
620 set_width_height(img, md, 'image/jpeg');
632 set_width_height(img, md, 'image/jpeg');
621 this._dblclick_to_reset_size(img);
633 this._dblclick_to_reset_size(img);
@@ -625,9 +637,12 b' var IPython = (function (IPython) {'
625 };
637 };
626
638
627
639
628 OutputArea.prototype.append_pdf = function (pdf, md, element) {
640 OutputArea.prototype.append_pdf = function (pdf, md, element, extra_class) {
629 var type = 'application/pdf';
641 var type = 'application/pdf';
630 var toinsert = this.create_output_subarea(md, "output_pdf", type);
642 var toinsert = this.create_output_subarea(md, "output_pdf", type);
643 if (extra_class){
644 toinsert.addClass(extra_class);
645 }
631 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
646 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
632 a.attr('target', '_blank');
647 a.attr('target', '_blank');
633 a.text('View PDF')
648 a.text('View PDF')
@@ -636,11 +651,14 b' var IPython = (function (IPython) {'
636 return toinsert;
651 return toinsert;
637 }
652 }
638
653
639 OutputArea.prototype.append_latex = function (latex, md, element) {
654 OutputArea.prototype.append_latex = function (latex, md, element, extra_class) {
640 // This method cannot do the typesetting because the latex first has to
655 // This method cannot do the typesetting because the latex first has to
641 // be on the page.
656 // be on the page.
642 var type = 'text/latex';
657 var type = 'text/latex';
643 var toinsert = this.create_output_subarea(md, "output_latex", type);
658 var toinsert = this.create_output_subarea(md, "output_latex", type);
659 if (extra_class){
660 toinsert.addClass(extra_class);
661 }
644 toinsert.append(latex);
662 toinsert.append(latex);
645 element.append(toinsert);
663 element.append(toinsert);
646 return toinsert;
664 return toinsert;
General Comments 0
You need to be logged in to leave comments. Login now