Commit 4f326a8c by Waqas Khalid

Merge pull request #6832 from edx/waqas/tnl1149-discussion-mathjax-solution

Discussion forum should be independent of mathjax 
parents 20c9a8af 11159ba7
......@@ -10,6 +10,7 @@ if Backbone?
@$el.html(Mustache.render(@template, params))
@$("span.timeago").timeago()
element = @$(".post-body")
if MathJax?
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]]
@
......
......@@ -32,6 +32,7 @@ if Backbone?
convertMath: ->
element = @$(".post-body")
element.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight element.text()
if MathJax?
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]]
edit: (event) ->
......
......@@ -33,6 +33,7 @@ if Backbone?
convertMath: ->
body = @$el.find(".response-body")
body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.text()
if MathJax?
MathJax.Hub.Queue ["Typeset", MathJax.Hub, body[0]]
_delete: (event) =>
......
......@@ -27,6 +27,7 @@ if Backbone?
convertMath: ->
element = @$(".response-body")
element.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight element.text()
if MathJax?
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]]
edit: (event) ->
......
......@@ -12,6 +12,7 @@
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
});
HUB = MathJax.Hub
</script>
%else:
<script type="text/x-mathjax-config">
......@@ -27,6 +28,7 @@
]
}
});
HUB = MathJax.Hub
</script>
%endif
......
......@@ -2,11 +2,6 @@
$ ->
if not MathJax?
return
HUB = MathJax.Hub
class MathJaxProcessor
MATHSPLIT = /// (
......@@ -116,6 +111,7 @@ $ ->
Markdown.getMathCompatibleConverter = (postProcessor) ->
postProcessor ||= ((text) -> text)
converter = Markdown.getSanitizingConverter()
if MathJax?
processor = new MathJaxProcessor()
converter.hooks.chain "preConversion", MathJaxProcessor.removeMathWrapper(processor)
converter.hooks.chain "postConversion", (text) ->
......
......@@ -57,7 +57,7 @@ class @MathJaxDelayRenderer
@$buffer.html(text)
curTime = getTime()
@elapsedTime = curTime - prevTime
if MathJax
if MathJax?
prevTime = getTime()
@mathjaxRunning = true
MathJax.Hub.Queue ["Typeset", MathJax.Hub, @$buffer.attr("id")], =>
......
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