forked from Simon-Initiative/oli-torus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Simon-Initiative:master' into master
- Loading branch information
Showing
52 changed files
with
1,495 additions
and
1,564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// this hook is used to evaluate MathJax expressions in the page | ||
// just after the page is mounted and the websocket connection is established. | ||
|
||
export const EvaluateMathJaxExpressions = { | ||
mounted() { | ||
const elements = document.querySelectorAll('.formula, .formula-inline'); | ||
|
||
const getGlobalLastPromise = () => { | ||
/* istanbul ignore next */ | ||
let lastPromise = window?.MathJax?.startup?.promise; | ||
/* istanbul ignore next */ | ||
if (!lastPromise) { | ||
console.info('NO LAST PROMISE'); | ||
typeof jest === 'undefined' && | ||
console.warn( | ||
'Load the MathJax script before this one or unpredictable rendering might occur.', | ||
); | ||
lastPromise = Promise.resolve(); | ||
} | ||
return lastPromise; | ||
}; | ||
|
||
const setGlobalLastPromise = (promise: Promise<any>) => { | ||
window.MathJax.startup.promise = promise; | ||
}; | ||
|
||
let lastPromise = getGlobalLastPromise(); | ||
lastPromise = lastPromise.then(() => | ||
window.MathJax.typesetPromise(Array.from(elements) as HTMLElement[]), | ||
); | ||
setGlobalLastPromise(lastPromise); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.