Commit fa3bfd77 by kimth

Set up mathjax_preprocessor

parent 36b44253
...@@ -6,6 +6,7 @@ class @Problem ...@@ -6,6 +6,7 @@ class @Problem
@element_id = @el.attr('id') @element_id = @el.attr('id')
@url = @el.data('url') @url = @el.data('url')
@render() @render()
@mathjax_preprocessor = false
$: (selector) -> $: (selector) ->
$(selector, @el) $(selector, @el)
...@@ -300,12 +301,12 @@ class @Problem ...@@ -300,12 +301,12 @@ class @Problem
if jax = MathJax.Hub.getAllJax(target)[0] if jax = MathJax.Hub.getAllJax(target)[0]
eqn = $(element).val() eqn = $(element).val()
if window.mathjax_preprocessor if @mathjax_preprocessor
eqn = window.mathjax_preprocessor(eqn) eqn = @mathjax_preprocessor(eqn)
MathJax.Hub.Queue ['Text', jax, eqn], MathJax.Hub.Queue ['Text', jax, eqn],
[@updateMathML, jax, element] [@updateMathML, jax, element]
updateMathML: (jax, element) => updateMathML: (jax, element) =>
try try
$("##{element.id}_dynamath").val(jax.root.toMathML '') $("##{element.id}_dynamath").val(jax.root.toMathML '')
...@@ -323,7 +324,7 @@ class @Problem ...@@ -323,7 +324,7 @@ class @Problem
inputtypeSetupMethods: inputtypeSetupMethods:
textinputdynamath: (element) => textinputdynamath: (element) =>
@mathjax_preprocessor = window.mathjax_preprocessor @mathjax_preprocessor = window.mathjax_preprocessor
javascriptinput: (element) => javascriptinput: (element) =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment