fix: mathjax resize on sindow resize (#32606)
* fix: mathjax resize on sindow resize * fix: add resize for mathjax in wiki and cms
This commit is contained in:
@@ -81,6 +81,12 @@
|
||||
<!-- Configure and load MathJax -->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
styles: {
|
||||
'.MathJax_SVG>svg': { 'max-width': '100%' },
|
||||
},
|
||||
CommonHTML: { linebreaks: { automatic: true } },
|
||||
SVG: { linebreaks: { automatic: true } },
|
||||
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||
tex2jax: {
|
||||
inlineMath: [
|
||||
["\\(","\\)"],
|
||||
@@ -92,6 +98,18 @@
|
||||
]
|
||||
}
|
||||
});
|
||||
window.addEventListener('resize', MJrenderer);
|
||||
let 1 = -1;
|
||||
let delay = 1000;
|
||||
function MJrenderer() {
|
||||
if (t >= 0) {
|
||||
window.clearTimeout(t);
|
||||
}
|
||||
t = window.setTimeout(function() {
|
||||
MathJax.Hub.Queue(["Rerenderer", MathJax.Hub]);
|
||||
t = -1;
|
||||
}, delay);
|
||||
};
|
||||
</script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.signal.Interest(function(message) {
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
%if mathjax_mode is not Undefined and mathjax_mode == 'wiki':
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
styles: {
|
||||
'.MathJax_SVG>svg': { 'max-width': '100%', },
|
||||
},
|
||||
CommonHTML: { linebreaks: { automatic: true } },
|
||||
SVG: { linebreaks: { automatic: true } },
|
||||
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
|
||||
});
|
||||
@@ -36,7 +42,13 @@
|
||||
%else:
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
styles: {
|
||||
'.MathJax_SVG>svg': { 'max-width': '100%', },
|
||||
},
|
||||
messageStyle: "none",
|
||||
CommonHTML: { linebreaks: { automatic: true } },
|
||||
SVG: { linebreaks: { automatic: true } },
|
||||
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||
tex2jax: {
|
||||
inlineMath: [
|
||||
["\\(","\\)"],
|
||||
@@ -85,6 +97,21 @@
|
||||
explorer: true
|
||||
}
|
||||
};
|
||||
window.addEventListener('resize', MJrerender);
|
||||
|
||||
let t = -1;
|
||||
let delay = 1000;
|
||||
function MJrerender() {
|
||||
if (t >= 0) {
|
||||
// If we are still waiting, then the user is still resizing =>
|
||||
// postpone the action further!
|
||||
window.clearTimeout(t);
|
||||
}
|
||||
t = window.setTimeout(function() {
|
||||
MathJax.Hub.Queue(["Rerender",MathJax.Hub]);
|
||||
t = -1; // Reset the handle
|
||||
}, delay);
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
|
||||
|
||||
Reference in New Issue
Block a user