Skip to content

Commit 6d2b1ed

Browse files
authored
Merge pull request #4195 from dpalou/MOBILE-4672
MOBILE-4672 mathjax: Fix some equations not displayed in quiz
2 parents 325aca7 + 341d1bc commit 6d2b1ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { CoreEvents } from '@singletons/events';
2424
import { CoreSite } from '@classes/sites/site';
2525
import { makeSingleton } from '@singletons';
2626
import { CoreWait } from '@singletons/wait';
27+
import { CoreDom } from '@singletons/dom';
2728

2829
/**
2930
* Handler to support the MathJax filter.
@@ -177,6 +178,10 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
177178
): Promise<void> {
178179
await this.waitForReady();
179180

181+
// Make sure the element is in DOM, otherwise some equations don't work.
182+
// Automatically timeout the promise after a certain time, we don't want to wait forever.
183+
await CoreUtils.ignoreErrors(CoreUtils.timeoutPromise(CoreDom.waitToBeInDOM(container), 15000));
184+
180185
await this.window.M!.filter_mathjaxloader!.typeset(container);
181186
}
182187

0 commit comments

Comments
 (0)