@doenet/doenetml-iframe 0.7.20-dev.338 → 0.7.20-dev.339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -38029,7 +38029,7 @@ function isMathJaxEngine(candidate) {
|
|
|
38029
38029
|
return false;
|
|
38030
38030
|
}
|
|
38031
38031
|
const startup = candidate.startup;
|
|
38032
|
-
return !!startup && typeof startup === "object" && typeof startup.promise?.then === "function";
|
|
38032
|
+
return !!startup && (typeof startup === "object" || typeof startup === "function") && typeof startup.promise?.then === "function";
|
|
38033
38033
|
}
|
|
38034
38034
|
function findMathJaxScript() {
|
|
38035
38035
|
const scripts = document.querySelectorAll("script[src]");
|
|
@@ -38053,9 +38053,11 @@ function waitForExistingMathJax(timeoutMs) {
|
|
|
38053
38053
|
return;
|
|
38054
38054
|
}
|
|
38055
38055
|
if (Date.now() > deadline) {
|
|
38056
|
-
|
|
38057
|
-
|
|
38058
|
-
|
|
38056
|
+
reject2(
|
|
38057
|
+
new Error(
|
|
38058
|
+
"DoenetViewer: timed out waiting for a host-provided MathJax"
|
|
38059
|
+
)
|
|
38060
|
+
);
|
|
38059
38061
|
return;
|
|
38060
38062
|
}
|
|
38061
38063
|
window.setTimeout(poll, 50);
|
|
@@ -38063,9 +38065,9 @@ function waitForExistingMathJax(timeoutMs) {
|
|
|
38063
38065
|
poll();
|
|
38064
38066
|
});
|
|
38065
38067
|
}
|
|
38066
|
-
function injectMathJax(src, config2) {
|
|
38068
|
+
function injectMathJax(src, config2, { force = false } = {}) {
|
|
38067
38069
|
return new Promise((resolve, reject2) => {
|
|
38068
|
-
if (config2 && window.MathJax == null) {
|
|
38070
|
+
if (config2 && (force || window.MathJax == null)) {
|
|
38069
38071
|
window.MathJax = config2;
|
|
38070
38072
|
}
|
|
38071
38073
|
const script = document.createElement("script");
|
|
@@ -38095,7 +38097,13 @@ function createMathJaxPromise(options) {
|
|
|
38095
38097
|
return Promise.resolve(window.MathJax);
|
|
38096
38098
|
}
|
|
38097
38099
|
if (useExistingMathJax || findMathJaxScript()) {
|
|
38098
|
-
return waitForExistingMathJax(timeoutMs)
|
|
38100
|
+
return waitForExistingMathJax(timeoutMs).catch((reason) => {
|
|
38101
|
+
console.warn(
|
|
38102
|
+
"DoenetViewer: a host-provided MathJax did not become usable in time; falling back to loading Doenet's own copy.",
|
|
38103
|
+
reason
|
|
38104
|
+
);
|
|
38105
|
+
return injectMathJax(src, config2, { force: true });
|
|
38106
|
+
});
|
|
38099
38107
|
}
|
|
38100
38108
|
return injectMathJax(src, config2);
|
|
38101
38109
|
}
|
|
@@ -38111,6 +38119,12 @@ function loadMathJax(options = {}) {
|
|
|
38111
38119
|
}
|
|
38112
38120
|
const promise = createMathJaxPromise(options);
|
|
38113
38121
|
window[GLOBAL_PROMISE_KEY] = promise;
|
|
38122
|
+
promise.catch(() => {
|
|
38123
|
+
const store = window;
|
|
38124
|
+
if (store[GLOBAL_PROMISE_KEY] === promise) {
|
|
38125
|
+
delete store[GLOBAL_PROMISE_KEY];
|
|
38126
|
+
}
|
|
38127
|
+
});
|
|
38114
38128
|
return promise;
|
|
38115
38129
|
}
|
|
38116
38130
|
function MathJaxContext({
|
|
@@ -63397,7 +63411,7 @@ function ExternalVirtualKeyboard({
|
|
|
63397
63411
|
}
|
|
63398
63412
|
);
|
|
63399
63413
|
}
|
|
63400
|
-
const version = "0.7.20-dev.
|
|
63414
|
+
const version = "0.7.20-dev.339";
|
|
63401
63415
|
const latestDoenetmlVersion = version;
|
|
63402
63416
|
function subscribeToPinnedTheme() {
|
|
63403
63417
|
return () => {
|