Fix mathjax with blockquote might have race condition

This commit is contained in:
Wu Cheng-Han 2016-11-18 12:19:05 +08:00
parent f387bb312f
commit 80ee507951
1 changed files with 13 additions and 11 deletions

View File

@ -286,17 +286,6 @@ function finishView(view) {
if ($(value).children().length == 0)
$(value).gist(viewAjaxCallback);
});
//mathjax
var mathjaxdivs = view.find('span.mathjax.raw').removeClass("raw").toArray();
try {
if (mathjaxdivs.length > 1) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs]);
MathJax.Hub.Queue(viewAjaxCallback);
} else if (mathjaxdivs.length > 0) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs[0]]);
MathJax.Hub.Queue(viewAjaxCallback);
}
} catch (err) {}
//sequence diagram
var sequences = view.find("div.sequence-diagram.raw").removeClass("raw");
sequences.each(function (key, value) {
@ -508,6 +497,19 @@ function finishView(view) {
else langDiv.html(result.value);
}
});
//mathjax
var mathjaxdivs = view.find('span.mathjax.raw').removeClass("raw").toArray();
try {
if (mathjaxdivs.length > 1) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs]);
MathJax.Hub.Queue(viewAjaxCallback);
} else if (mathjaxdivs.length > 0) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs[0]]);
MathJax.Hub.Queue(viewAjaxCallback);
}
} catch (err) {
console.warn(err);
}
//render title
document.title = renderTitle(view);
}