fix(econ): render latex labels on mathjax ready
This commit is contained in:
parent
8707530a50
commit
01d7681b6b
1 changed files with 29 additions and 13 deletions
|
|
@ -664,17 +664,33 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
MathJax.typeset()
|
// wait for mathjax
|
||||||
document.querySelectorAll(".sliders").forEach((slidersDiv) => {
|
if (typeof MathJax !== "undefined") {
|
||||||
slidersDiv.addEventListener("input", function (event) {
|
MathJax.typeset();
|
||||||
const graphDiv = slidersDiv.previousElementSibling;
|
initSliderEvents();
|
||||||
if (graphDiv && graphDiv.querySelector("svg")) {
|
} else {
|
||||||
const svg = graphDiv.querySelector("svg");
|
window.MathJax = {
|
||||||
svg.querySelectorAll("foreignObject body").forEach((body) => {
|
startup: {
|
||||||
MathJax.typesetPromise([body]);
|
pageReady: function () {
|
||||||
});
|
return MathJax.startup.defaultPageReady().then(function () {
|
||||||
}
|
initSliderEvents();
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
});
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function initSliderEvents() {
|
||||||
|
document.querySelectorAll(".sliders").forEach((slidersDiv) => {
|
||||||
|
slidersDiv.addEventListener("input", function (event) {
|
||||||
|
const graphDiv = slidersDiv.previousElementSibling;
|
||||||
|
if (graphDiv && graphDiv.querySelector("svg")) {
|
||||||
|
const svg = graphDiv.querySelector("svg");
|
||||||
|
svg.querySelectorAll("foreignObject body").forEach((body) => {
|
||||||
|
MathJax.typesetPromise([body]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue