Add temporary flickering fix

This commit is contained in:
Sauli Anto 2019-09-28 18:30:56 +03:00
parent fff7e87630
commit 8e00885b29

View File

@ -28,15 +28,15 @@ export function renderEquation( equation, element, engine = 'katex', display = f
MathJax.startup.document.updateDocument(); MathJax.startup.document.updateDocument();
} ); } );
} else { } else {
if ( display ) { // Fixme: MathJax typesetting cause occasionally math processing error without timeout
element.innerHTML = '\\[' + equation + '\\]';
} else {
element.innerHTML = '\\(' + equation + '\\)';
}
// Fixme: MathJax render occasionally math processing error without timeout
setTimeout( () => { setTimeout( () => {
if ( display ) {
element.innerHTML = '\\[' + equation + '\\]';
} else {
element.innerHTML = '\\(' + equation + '\\)';
}
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, element ] ); MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, element ] );
}, 100); }, 50);
} }
} else if ( engine === 'katex' && typeof katex !== 'undefined' ) { } else if ( engine === 'katex' && typeof katex !== 'undefined' ) {
katex.render( equation, element, { katex.render( equation, element, {