From df6c0fc69fddbdeb0c2758e9104ad406ddea731a Mon Sep 17 00:00:00 2001 From: leangseu-edx <83240113+leangseu-edx@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:43:17 -0400 Subject: [PATCH] fix: work around existing css that fail to draw mathjax (#32764) --- cms/djangoapps/pipeline_js/js/xmodule.js | 9 ++++++++- cms/templates/content_libraries/xblock_iframe.html | 7 +++++++ common/templates/mathjax_include.html | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/pipeline_js/js/xmodule.js b/cms/djangoapps/pipeline_js/js/xmodule.js index 96f8f1afa948..9688d97a4b88 100644 --- a/cms/djangoapps/pipeline_js/js/xmodule.js +++ b/cms/djangoapps/pipeline_js/js/xmodule.js @@ -63,7 +63,14 @@ define( t = -1; }, delay); } - }; + + // this is added to compensate for custom css that accidentally hide mathjax + $('.MathJax_SVG>svg').toArray().forEach(el => { + if ($(el).width() === 0) { + $(el).css('max-width', 'inherit'); + } + }); + }; } ); window.CodeMirror = CodeMirror; diff --git a/cms/templates/content_libraries/xblock_iframe.html b/cms/templates/content_libraries/xblock_iframe.html index 79d0de1409e8..6a60530cc9a5 100644 --- a/cms/templates/content_libraries/xblock_iframe.html +++ b/cms/templates/content_libraries/xblock_iframe.html @@ -115,6 +115,13 @@ t = -1; }, delay); } + + // this is added to compensate for custom css that accidentally hide mathjax + $('.MathJax_SVG>svg').toArray().forEach(el => { + if ($(el).width() === 0) { + $(el).css('max-width', 'inherit'); + } + }); };