mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Properly avoid concurrent invocations of loadMathJax()
.
This commit is contained in:
parent
bdb0dd064b
commit
2d3b9e0c66
1 changed files with 2 additions and 16 deletions
|
@ -123,7 +123,6 @@ const mathJax = {} as {
|
||||||
amFixes: any;
|
amFixes: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
let stopLoadingMathJax = false;
|
|
||||||
let mathJaxLoaded = false;
|
let mathJaxLoaded = false;
|
||||||
let mathJaxLoading = false;
|
let mathJaxLoading = false;
|
||||||
let mathJaxLoadedCallback: SubtypeLoadedCb | undefined;
|
let mathJaxLoadedCallback: SubtypeLoadedCb | undefined;
|
||||||
|
@ -135,19 +134,7 @@ let errorSvg: string;
|
||||||
let errorAria: string;
|
let errorAria: string;
|
||||||
|
|
||||||
const loadMathJax = async () => {
|
const loadMathJax = async () => {
|
||||||
const shouldLoad =
|
const continueLoading = !mathJaxLoading;
|
||||||
!mathJaxLoaded &&
|
|
||||||
!mathJaxLoading &&
|
|
||||||
(mathJax.adaptor === undefined ||
|
|
||||||
mathJax.amHtml === undefined ||
|
|
||||||
mathJax.texHtml === undefined ||
|
|
||||||
mathJax.visitor === undefined ||
|
|
||||||
mathJax.mmlSvg === undefined ||
|
|
||||||
mathJax.amFixes === undefined ||
|
|
||||||
(useSRE && mathJax.mmlSre === undefined));
|
|
||||||
if (!shouldLoad && !mathJaxLoaded) {
|
|
||||||
stopLoadingMathJax = true;
|
|
||||||
}
|
|
||||||
if (!mathJaxLoaded) {
|
if (!mathJaxLoaded) {
|
||||||
mathJaxLoading = true;
|
mathJaxLoading = true;
|
||||||
|
|
||||||
|
@ -208,8 +195,7 @@ const loadMathJax = async () => {
|
||||||
type E = typeof LiteElement;
|
type E = typeof LiteElement;
|
||||||
type T = typeof LiteText;
|
type T = typeof LiteText;
|
||||||
type D = typeof LiteDocument;
|
type D = typeof LiteDocument;
|
||||||
if (stopLoadingMathJax) {
|
if (mathJaxLoading && !continueLoading) {
|
||||||
stopLoadingMathJax = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue