diff --git a/qt/aqt/data/web/js/mathjax.js b/qt/aqt/data/web/js/mathjax.js index 6cae47bdb..2074174f3 100644 --- a/qt/aqt/data/web/js/mathjax.js +++ b/qt/aqt/data/web/js/mathjax.js @@ -1,34 +1,28 @@ window.MathJax = { - tex: { - displayMath: [["\\[", "\\]"]], - processRefs: false, - processEnvironments: false, - packages: { - '[+]': [ - 'noerrors', - 'mhchem', - ], - } - }, - startup: { - typeset: false, - pageReady: () => { - console.log('page is ready'); - return MathJax.startup.defaultPageReady(); + tex: { + displayMath: [["\\[", "\\]"]], + processRefs: false, + processEnvironments: false, + packages: { + "[+]": ["noerrors", "mhchem"], + }, }, - }, - options: { - renderActions: { - addMenu: [], - checkLoading: [] + startup: { + typeset: false, + pageReady: () => { + console.log("page is ready"); + return MathJax.startup.defaultPageReady(); + }, + }, + options: { + renderActions: { + addMenu: [], + checkLoading: [], + }, + ignoreHtmlClass: "tex2jax_ignore", + processHtmlClass: "tex2jax_process", + }, + loader: { + load: ["[tex]/noerrors", "[tex]/mhchem"], }, - ignoreHtmlClass: 'tex2jax_ignore', - processHtmlClass: 'tex2jax_process', - }, - loader: { - load: [ - '[tex]/noerrors', - '[tex]/mhchem', - ] - } }; diff --git a/qt/aqt/data/web/js/reviewer.ts b/qt/aqt/data/web/js/reviewer.ts index 1db7d4dfa..2dec1632c 100644 --- a/qt/aqt/data/web/js/reviewer.ts +++ b/qt/aqt/data/web/js/reviewer.ts @@ -39,13 +39,13 @@ function _updateQA(html, fadeTime, onupdate, onshown) { var qa = $("#qa"); // fade out current text - qa.fadeOut(fadeTime).promise() + qa.fadeOut(fadeTime) + .promise() // update text .then(() => { try { - qa.html(html) - } - catch (err) { + qa.html(html); + } catch (err) { qa.html( ( `Invalid HTML on card: ${String(err).substring(0, 2000)}\n` + @@ -55,19 +55,20 @@ function _updateQA(html, fadeTime, onupdate, onshown) { } }) .then(() => _runHook(onUpdateHook)) - // @ts-ignore wait for mathjax to ready - .then(() => MathJax.startup.promise - .then(() => { + .then(() => + // @ts-ignore wait for mathjax to ready + MathJax.startup.promise.then(() => { // @ts-ignore clear MathJax buffer MathJax.typesetClear(); // @ts-ignore typeset return MathJax.typesetPromise(qa.slice(0, 1)); - })) + }) + ) // and reveal when processing is done .then(() => qa.fadeIn(fadeTime).promise()) .then(() => _runHook(onShownHook)) - .then(() => _updatingQA = false); + .then(() => (_updatingQA = false)); } function _showQuestion(q, bodyclass) {