Merge pull request #4195 from dpalou/MOBILE-4672

MOBILE-4672 mathjax: Fix some equations not displayed in quiz
main
Pau Ferrer Ocaña 2024-10-08 12:43:17 +02:00 committed by GitHub
commit 6d2b1ed902
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import { CoreEvents } from '@singletons/events';
import { CoreSite } from '@classes/sites/site'; import { CoreSite } from '@classes/sites/site';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { CoreWait } from '@singletons/wait'; import { CoreWait } from '@singletons/wait';
import { CoreDom } from '@singletons/dom';
/** /**
* Handler to support the MathJax filter. * Handler to support the MathJax filter.
@ -177,6 +178,10 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
): Promise<void> { ): Promise<void> {
await this.waitForReady(); await this.waitForReady();
// Make sure the element is in DOM, otherwise some equations don't work.
// Automatically timeout the promise after a certain time, we don't want to wait forever.
await CoreUtils.ignoreErrors(CoreUtils.timeoutPromise(CoreDom.waitToBeInDOM(container), 15000));
await this.window.M!.filter_mathjaxloader!.typeset(container); await this.window.M!.filter_mathjaxloader!.typeset(container);
} }