Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 998da88

Browse files
committed
Add: wait for initial typeset before any custom
1 parent 23b0df5 commit 998da88

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

runestone/common/js/runestonebase.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,16 @@ export default class RunestoneBase {
465465
// should wait until defaultPageReady is defined
466466
// If defaultPageReady is not defined then just enqueue the components.
467467
// Once defaultPageReady is defined
468+
// the window.runestoneMathReady promise will be fulfilled when the
469+
// initial typesetting is complete.
468470
if (MathJax.typesetPromise) {
469-
return this.mjresolver(this.aQueue.enqueue(component))
471+
if (typeof(window.runestoneMathReady) !== "undefined") {
472+
return window.runestoneMathReady.then(
473+
() => this.mjresolver(this.aQueue.enqueue(component))
474+
)
475+
} else {
476+
return this.mjresolver(this.aQueue.enqueue(component))
477+
}
470478
} else {
471479
console.log(`Waiting on MathJax!! ${MathJax.typesetPromise}`);
472480
setTimeout(() => this.queueMathJax(component), 200);

0 commit comments

Comments
 (0)