Merge branch 'MDL-79039-master' of https://github.com/andrewnicols/moodle

This commit is contained in:
Huong Nguyen 2023-08-25 14:25:19 +07:00
commit 394dbffc24
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,6 @@ define("filter_mathjaxloader/loader",["exports","core_filters/events"],(function
* @copyright 2014 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
let lang="",configured=!1;_exports.configure=params=>{let script=document.createElement("script");script.type="text/x-mathjax-config",script[window.opera?"innerHTML":"text"]=params.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(script),lang=params.lang,document.addEventListener(_events.eventTypes.filterContentUpdated,contentUpdated)};const setLocale=()=>{configured||void 0!==window.MathJax&&(window.MathJax.Hub.Queue((function(){window.MathJax.Localization.setLocale(lang)})),window.MathJax.Hub.Configured(),configured=!0)};_exports.typeset=()=>{if(!configured){setLocale();const elements=document.getElementsByClassName("filter_mathjaxloader_equation");elements&&elements.forEach((element=>{void 0!==window.MathJax&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,element])}))}};const contentUpdated=event=>{if(void 0===window.MathJax)return;const processDelay=window.MathJax.Hub.processSectionDelay;window.MathJax.Hub.processSectionDelay=0,window.MathJax.Hub.Config({positionToHash:!1}),setLocale(),event.detail.nodes.forEach((node=>{node.getElementsByClassName("filter_mathjaxloader_equation").forEach((node=>{window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,node])}))})),window.MathJax.Hub.processSectionDelay=processDelay};_exports.contentUpdated=contentUpdated}));
let lang="",configured=!1;_exports.configure=params=>{let script=document.createElement("script");script.type="text/x-mathjax-config",script[window.opera?"innerHTML":"text"]=params.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(script),lang=params.lang,document.addEventListener(_events.eventTypes.filterContentUpdated,contentUpdated)};const setLocale=()=>{configured||void 0!==window.MathJax&&(window.MathJax.Hub.Queue((function(){window.MathJax.Localization.setLocale(lang)})),window.MathJax.Hub.Configured(),configured=!0)};_exports.typeset=()=>{if(!configured){setLocale();const elements=document.getElementsByClassName("filter_mathjaxloader_equation");elements&&elements.forEach((element=>{void 0!==window.MathJax&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,element])}))}};const contentUpdated=event=>{if(void 0===window.MathJax)return;const processDelay=window.MathJax.Hub.processSectionDelay;window.MathJax.Hub.processSectionDelay=0,window.MathJax.Hub.Config({positionToHash:!1}),setLocale(),event.detail.nodes.forEach((node=>{if(!(node instanceof HTMLElement))return;node.getElementsByClassName("filter_mathjaxloader_equation").forEach((node=>{window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,node])}))})),window.MathJax.Hub.processSectionDelay=processDelay};_exports.contentUpdated=contentUpdated}));
//# sourceMappingURL=loader.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -116,6 +116,10 @@ export const contentUpdated = (event) => {
setLocale();
// The list of HTMLElements in an Array.
event.detail.nodes.forEach((node) => {
if (!(node instanceof HTMLElement)) {
// We may have been passed a #text node.
return;
}
const mathjaxElements = node.getElementsByClassName('filter_mathjaxloader_equation');
mathjaxElements.forEach((node) => {
window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node]);