Added LatexView

This commit is contained in:
Jonathan Frederic 2013-12-06 23:48:11 +00:00
parent b656f34c48
commit a6e5ec942c
2 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,29 @@ define(["notebook/js/widget"], function(widget_manager){
widget_manager.register_widget_view('HTMLView', HTMLView); widget_manager.register_widget_view('HTMLView', HTMLView);
var LatexView = IPython.WidgetView.extend({
// Called when view is rendered.
render : function(){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
var that=this;
this.$el.html(this.model.get('value'));
var math_el = that.$el.get(0);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,math_el]);
return IPython.WidgetView.prototype.update.call(this);
},
});
widget_manager.register_widget_view('LatexView', LatexView);
var TextAreaView = IPython.WidgetView.extend({ var TextAreaView = IPython.WidgetView.extend({
// Called when view is rendered. // Called when view is rendered.

View File

@ -314,6 +314,7 @@
"| | *DropdownView* |\n", "| | *DropdownView* |\n",
"| | ListBoxView |\n", "| | ListBoxView |\n",
"| StringWidget | HTMLView |\n", "| StringWidget | HTMLView |\n",
"| | LatexView |\n",
"| | TextAreaView |\n", "| | TextAreaView |\n",
"| | *TextBoxView* |\n" "| | *TextBoxView* |\n"
] ]