@pie-element/math-templated 2.22.7-next.0 → 2.22.7-next.2
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/configure/package.json +1 -1
- package/controller/package.json +1 -1
- package/module/configure.js +162 -189
- package/module/element.js +162 -189
- package/module/manifest.json +2 -2
- package/module/print.js +162 -189
- package/package.json +3 -3
package/module/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.0/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.0.0/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -21844,90 +21844,6 @@ withMask$1.withMask = withMask;
|
|
|
21844
21844
|
var dragInTheBlank = {};
|
|
21845
21845
|
var mathRenderingAccessible = {};
|
|
21846
21846
|
var renderMath$2 = {};
|
|
21847
|
-
var mathjaxScript = {};
|
|
21848
|
-
Object.defineProperty(mathjaxScript, "__esModule", {
|
|
21849
|
-
value: true
|
|
21850
|
-
});
|
|
21851
|
-
mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
|
|
21852
|
-
var _renderMath = renderMath$2;
|
|
21853
|
-
var MathJaxVersion = '3.2.2';
|
|
21854
|
-
mathjaxScript.MathJaxVersion = MathJaxVersion;
|
|
21855
|
-
var initializeMathJax = function initializeMathJax(renderOpts) {
|
|
21856
|
-
if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
|
|
21857
|
-
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
21858
|
-
}
|
|
21859
|
-
var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
|
|
21860
|
-
macros: {
|
|
21861
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
21862
|
-
overarc: '\\overparen',
|
|
21863
|
-
napprox: '\\not\\approx',
|
|
21864
|
-
longdiv: '\\enclose{longdiv}'
|
|
21865
|
-
},
|
|
21866
|
-
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
21867
|
-
processEscapes: true,
|
|
21868
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
21869
|
-
} : {
|
|
21870
|
-
macros: {
|
|
21871
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
21872
|
-
overarc: '\\overparen',
|
|
21873
|
-
napprox: '\\not\\approx',
|
|
21874
|
-
longdiv: '\\enclose{longdiv}'
|
|
21875
|
-
},
|
|
21876
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
21877
|
-
};
|
|
21878
|
-
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
21879
|
-
window.MathJax = {
|
|
21880
|
-
startup: {
|
|
21881
|
-
typeset: false,
|
|
21882
|
-
ready: function ready() {
|
|
21883
|
-
var mathjax = MathJax._.mathjax.mathjax;
|
|
21884
|
-
var STATE = MathJax._.core.MathItem.STATE;
|
|
21885
|
-
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
21886
|
-
var rerender = Menu.prototype.rerender;
|
|
21887
|
-
Menu.prototype.rerender = function () {
|
|
21888
|
-
var _this = this;
|
|
21889
|
-
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
21890
|
-
mathjax.handleRetriesFor(function () {
|
|
21891
|
-
return rerender.call(_this, start);
|
|
21892
|
-
});
|
|
21893
|
-
};
|
|
21894
|
-
MathJax.startup.defaultReady();
|
|
21895
|
-
var globalObj = (0, _renderMath.getGlobal)();
|
|
21896
|
-
globalObj.instance = MathJax;
|
|
21897
|
-
resolve();
|
|
21898
|
-
}
|
|
21899
|
-
},
|
|
21900
|
-
loader: {
|
|
21901
|
-
load: ['input/mml']
|
|
21902
|
-
},
|
|
21903
|
-
tex: texConfig,
|
|
21904
|
-
chtml: {
|
|
21905
|
-
fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
|
|
21906
|
-
displayAlign: 'center'
|
|
21907
|
-
},
|
|
21908
|
-
customKey: '@pie-lib/math-rendering-accessible@1',
|
|
21909
|
-
options: {
|
|
21910
|
-
enableEnrichment: true,
|
|
21911
|
-
sre: {
|
|
21912
|
-
speech: 'deep'
|
|
21913
|
-
},
|
|
21914
|
-
menuOptions: {
|
|
21915
|
-
settings: {
|
|
21916
|
-
assistiveMml: true,
|
|
21917
|
-
collapsible: false,
|
|
21918
|
-
explorer: false
|
|
21919
|
-
}
|
|
21920
|
-
}
|
|
21921
|
-
}
|
|
21922
|
-
};
|
|
21923
|
-
var script = document.createElement('script');
|
|
21924
|
-
script.type = 'text/javascript';
|
|
21925
|
-
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
21926
|
-
script.async = true;
|
|
21927
|
-
document.body.appendChild(script);
|
|
21928
|
-
});
|
|
21929
|
-
};
|
|
21930
|
-
mathjaxScript.initializeMathJax = initializeMathJax;
|
|
21931
21847
|
var normalization$1 = {};
|
|
21932
21848
|
var slicedToArray = {
|
|
21933
21849
|
exports: {}
|
|
@@ -81603,9 +81519,8 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81603
81519
|
Object.defineProperty(exports, "__esModule", {
|
|
81604
81520
|
value: true
|
|
81605
81521
|
});
|
|
81606
|
-
exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
|
|
81522
|
+
exports.initializeMathJax = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = exports.MathJaxVersion = void 0;
|
|
81607
81523
|
var _typeof2 = _interopRequireDefault(_typeof$b.exports);
|
|
81608
|
-
var _mathjaxScript = mathjaxScript;
|
|
81609
81524
|
var _normalization = normalization$1;
|
|
81610
81525
|
var mr = _interopRequireWildcard(mathRendering);
|
|
81611
81526
|
var _SerializedMmlVisitor = SerializedMmlVisitor;
|
|
@@ -81653,11 +81568,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81653
81568
|
return visitor.visitTree(node);
|
|
81654
81569
|
};
|
|
81655
81570
|
var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
81656
|
-
var NEWLINE_LATEX =
|
|
81657
|
-
var mathRenderingKEY =
|
|
81658
|
-
var mathRenderingAccessibleKEY =
|
|
81571
|
+
var NEWLINE_LATEX = "\\newline ";
|
|
81572
|
+
var mathRenderingKEY = "@pie-lib/math-rendering@2";
|
|
81573
|
+
var mathRenderingAccessibleKEY = "@pie-lib/math-rendering-accessible@1";
|
|
81574
|
+
var MathJaxVersion = "3.2.2";
|
|
81575
|
+
exports.MathJaxVersion = MathJaxVersion;
|
|
81659
81576
|
var getGlobal = function getGlobal() {
|
|
81660
|
-
if (typeof window !==
|
|
81577
|
+
if (typeof window !== "undefined") {
|
|
81661
81578
|
if (!window[mathRenderingAccessibleKEY]) {
|
|
81662
81579
|
window[mathRenderingAccessibleKEY] = {};
|
|
81663
81580
|
}
|
|
@@ -81667,16 +81584,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81667
81584
|
}
|
|
81668
81585
|
};
|
|
81669
81586
|
exports.getGlobal = getGlobal;
|
|
81670
|
-
var defaultOpts = function defaultOpts() {
|
|
81671
|
-
return getGlobal().opts || ({});
|
|
81672
|
-
};
|
|
81673
81587
|
var fixMathElement = function fixMathElement(element) {
|
|
81674
81588
|
if (element.dataset.mathHandled) {
|
|
81675
81589
|
return;
|
|
81676
81590
|
}
|
|
81677
|
-
var property =
|
|
81591
|
+
var property = "innerText";
|
|
81678
81592
|
if (element.textContent) {
|
|
81679
|
-
property =
|
|
81593
|
+
property = "textContent";
|
|
81680
81594
|
}
|
|
81681
81595
|
if (element[property]) {
|
|
81682
81596
|
element[property] = (0, _normalization.wrapMath)((0, _normalization.unWrapMath)(element[property]).unwrapped);
|
|
@@ -81687,7 +81601,7 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81687
81601
|
exports.fixMathElement = fixMathElement;
|
|
81688
81602
|
var fixMathElements = function fixMathElements() {
|
|
81689
81603
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
81690
|
-
var mathElements = el.querySelectorAll(
|
|
81604
|
+
var mathElements = el.querySelectorAll("[data-latex]");
|
|
81691
81605
|
mathElements.forEach(function (item) {
|
|
81692
81606
|
return fixMathElement(item);
|
|
81693
81607
|
});
|
|
@@ -81695,25 +81609,25 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81695
81609
|
exports.fixMathElements = fixMathElements;
|
|
81696
81610
|
var adjustMathMLStyle = function adjustMathMLStyle() {
|
|
81697
81611
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
81698
|
-
var nodes = el.querySelectorAll(
|
|
81612
|
+
var nodes = el.querySelectorAll("math");
|
|
81699
81613
|
nodes.forEach(function (node) {
|
|
81700
|
-
return node.setAttribute(
|
|
81614
|
+
return node.setAttribute("displaystyle", "true");
|
|
81701
81615
|
});
|
|
81702
81616
|
};
|
|
81703
81617
|
var createPlaceholder = function createPlaceholder(element) {
|
|
81704
81618
|
var _element$previousSibl;
|
|
81705
|
-
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains(
|
|
81619
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
81706
81620
|
var _element$parentNode;
|
|
81707
|
-
element.dataset.originalDisplay = element.style.display ||
|
|
81708
|
-
element.style.display =
|
|
81709
|
-
var placeholder = document.createElement(
|
|
81710
|
-
placeholder.style.cssText =
|
|
81711
|
-
placeholder.classList.add(
|
|
81621
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
81622
|
+
element.style.display = "none";
|
|
81623
|
+
var placeholder = document.createElement("span");
|
|
81624
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
81625
|
+
placeholder.classList.add("math-placeholder");
|
|
81712
81626
|
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
81713
81627
|
}
|
|
81714
81628
|
};
|
|
81715
81629
|
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
81716
|
-
document.querySelectorAll(
|
|
81630
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
81717
81631
|
var _targetElement$datase;
|
|
81718
81632
|
var targetElement = placeholder.nextElementSibling;
|
|
81719
81633
|
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
@@ -81724,9 +81638,9 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81724
81638
|
});
|
|
81725
81639
|
};
|
|
81726
81640
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
81727
|
-
var elements = content.querySelectorAll(
|
|
81641
|
+
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
81728
81642
|
elements.forEach(function (element) {
|
|
81729
|
-
var mjxContainers = element.querySelectorAll(
|
|
81643
|
+
var mjxContainers = element.querySelectorAll("mjx-container");
|
|
81730
81644
|
if (mjxContainers.length > 1) {
|
|
81731
81645
|
for (var i = 1; i < mjxContainers.length; i++) {
|
|
81732
81646
|
mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
|
|
@@ -81734,28 +81648,124 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81734
81648
|
}
|
|
81735
81649
|
});
|
|
81736
81650
|
};
|
|
81737
|
-
var
|
|
81738
|
-
|
|
81739
|
-
|
|
81651
|
+
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
81652
|
+
executeOn = executeOn || document.body;
|
|
81653
|
+
fixMathElements(executeOn);
|
|
81654
|
+
adjustMathMLStyle(executeOn);
|
|
81655
|
+
var mathJaxInstance = getGlobal().instance;
|
|
81656
|
+
if (mathJaxInstance) {
|
|
81657
|
+
mathJaxInstance.texReset();
|
|
81658
|
+
mathJaxInstance.typesetClear();
|
|
81659
|
+
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
81660
|
+
try {
|
|
81661
|
+
removeExcessMjxContainers(executeOn);
|
|
81662
|
+
var updatedDocument = mathJaxInstance.startup.document;
|
|
81663
|
+
var list = updatedDocument.math.list;
|
|
81664
|
+
for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
|
|
81665
|
+
var mathMl = toMMl(item.data.root);
|
|
81666
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
81667
|
+
item.data.typesetRoot.setAttribute("data-mathml", parsedMathMl);
|
|
81668
|
+
}
|
|
81669
|
+
} catch (e) {
|
|
81670
|
+
console.error("Error post-processing MathJax typesetting:", e.toString());
|
|
81671
|
+
}
|
|
81672
|
+
mathJaxInstance.startup.document.clear();
|
|
81673
|
+
})["catch"](function (error) {
|
|
81674
|
+
console.error("Error in typesetting with MathJax:", error);
|
|
81675
|
+
});
|
|
81676
|
+
}
|
|
81740
81677
|
};
|
|
81678
|
+
var initializeMathJax = function initializeMathJax(callback) {
|
|
81679
|
+
var texConfig = {
|
|
81680
|
+
macros: {
|
|
81681
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
81682
|
+
overarc: "\\overparen",
|
|
81683
|
+
napprox: "\\not\\approx",
|
|
81684
|
+
longdiv: "\\enclose{longdiv}"
|
|
81685
|
+
},
|
|
81686
|
+
displayMath: [["$$", "$$"], ["\\[", "\\]"]]
|
|
81687
|
+
};
|
|
81688
|
+
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
81689
|
+
window.MathJax = {
|
|
81690
|
+
startup: {
|
|
81691
|
+
typeset: false,
|
|
81692
|
+
ready: function ready() {
|
|
81693
|
+
var mathjax = MathJax._.mathjax.mathjax;
|
|
81694
|
+
var STATE = MathJax._.core.MathItem.STATE;
|
|
81695
|
+
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
81696
|
+
var rerender = Menu.prototype.rerender;
|
|
81697
|
+
Menu.prototype.rerender = function () {
|
|
81698
|
+
var _this = this;
|
|
81699
|
+
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
81700
|
+
mathjax.handleRetriesFor(function () {
|
|
81701
|
+
return rerender.call(_this, start);
|
|
81702
|
+
});
|
|
81703
|
+
};
|
|
81704
|
+
MathJax.startup.defaultReady();
|
|
81705
|
+
var globalObj = getGlobal();
|
|
81706
|
+
globalObj.instance = MathJax;
|
|
81707
|
+
window.mathjaxLoadedComplete = true;
|
|
81708
|
+
console.log("MathJax has initialised!", new Date().toString());
|
|
81709
|
+
if (callback) {
|
|
81710
|
+
callback();
|
|
81711
|
+
}
|
|
81712
|
+
resolve();
|
|
81713
|
+
}
|
|
81714
|
+
},
|
|
81715
|
+
loader: {
|
|
81716
|
+
load: ["input/mml"],
|
|
81717
|
+
preLoad: function preLoad() {}
|
|
81718
|
+
},
|
|
81719
|
+
tex: texConfig,
|
|
81720
|
+
chtml: {
|
|
81721
|
+
fontURL: "https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2",
|
|
81722
|
+
displayAlign: "center"
|
|
81723
|
+
},
|
|
81724
|
+
customKey: "@pie-lib/math-rendering-accessible@1",
|
|
81725
|
+
options: {
|
|
81726
|
+
enableEnrichment: true,
|
|
81727
|
+
sre: {
|
|
81728
|
+
speech: "deep"
|
|
81729
|
+
},
|
|
81730
|
+
menuOptions: {
|
|
81731
|
+
settings: {
|
|
81732
|
+
assistiveMml: true,
|
|
81733
|
+
collapsible: false,
|
|
81734
|
+
explorer: false
|
|
81735
|
+
}
|
|
81736
|
+
}
|
|
81737
|
+
}
|
|
81738
|
+
};
|
|
81739
|
+
var script = document.createElement("script");
|
|
81740
|
+
script.type = "text/javascript";
|
|
81741
|
+
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
81742
|
+
script.async = true;
|
|
81743
|
+
document.body.appendChild(script);
|
|
81744
|
+
});
|
|
81745
|
+
};
|
|
81746
|
+
exports.initializeMathJax = initializeMathJax;
|
|
81741
81747
|
var renderMath = function renderMath(el, renderOpts) {
|
|
81742
|
-
var
|
|
81748
|
+
var usedForMmlOutput = typeof el === "string";
|
|
81743
81749
|
var executeOn = document.body;
|
|
81744
|
-
if (
|
|
81745
|
-
|
|
81746
|
-
div.innerHTML = el;
|
|
81747
|
-
executeOn = div;
|
|
81750
|
+
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
81751
|
+
return mr.renderMath(el, renderOpts);
|
|
81748
81752
|
}
|
|
81749
|
-
|
|
81750
|
-
|
|
81751
|
-
|
|
81752
|
-
|
|
81753
|
-
|
|
81754
|
-
|
|
81755
|
-
|
|
81756
|
-
(
|
|
81753
|
+
if (!usedForMmlOutput) {
|
|
81754
|
+
if (window.mathjaxLoadedComplete) {
|
|
81755
|
+
renderContentWithMathJax(el);
|
|
81756
|
+
} else if (window.mathjaxLoadedP) {
|
|
81757
|
+
window.mathjaxLoadedP.then(function () {
|
|
81758
|
+
window.mathjaxLoadedComplete = true;
|
|
81759
|
+
renderContentWithMathJax(el);
|
|
81760
|
+
})["catch"](function (error) {
|
|
81761
|
+
return console.error("Error in initializing MathJax:", error);
|
|
81762
|
+
});
|
|
81757
81763
|
}
|
|
81758
|
-
|
|
81764
|
+
} else {
|
|
81765
|
+
if (window.MathJax && window.mathjaxLoadedP) {
|
|
81766
|
+
var div = document.createElement("div");
|
|
81767
|
+
div.innerHTML = el;
|
|
81768
|
+
executeOn = div;
|
|
81759
81769
|
try {
|
|
81760
81770
|
MathJax.texReset();
|
|
81761
81771
|
MathJax.typesetClear();
|
|
@@ -81764,75 +81774,38 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81764
81774
|
var list = updatedDocument.math.list;
|
|
81765
81775
|
var item = list.next;
|
|
81766
81776
|
var mathMl = toMMl(item.data.root);
|
|
81767
|
-
var parsedMathMl = mathMl.replaceAll(
|
|
81777
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
81768
81778
|
return parsedMathMl;
|
|
81769
81779
|
} catch (error) {
|
|
81770
|
-
console.error(
|
|
81780
|
+
console.error("Error rendering math:", error.message);
|
|
81771
81781
|
}
|
|
81782
|
+
return el;
|
|
81772
81783
|
}
|
|
81773
|
-
|
|
81774
|
-
window.mathjaxLoadedP.then(function () {
|
|
81775
|
-
var mathJaxInstance = getGlobal().instance;
|
|
81776
|
-
if (mathJaxInstance) {
|
|
81777
|
-
mathJaxInstance.texReset();
|
|
81778
|
-
mathJaxInstance.typesetClear();
|
|
81779
|
-
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
81780
|
-
try {
|
|
81781
|
-
removeExcessMjxContainers(executeOn);
|
|
81782
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81783
|
-
var _updatedDocument = mathJaxInstance.startup.document;
|
|
81784
|
-
var _list = _updatedDocument.math.list;
|
|
81785
|
-
for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
|
|
81786
|
-
var _mathMl = toMMl(_item.data.root);
|
|
81787
|
-
var _parsedMathMl = _mathMl.replaceAll('\n', '');
|
|
81788
|
-
_item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
|
|
81789
|
-
}
|
|
81790
|
-
} catch (e) {
|
|
81791
|
-
console.error('Error post-processing MathJax typesetting:', e.toString());
|
|
81792
|
-
}
|
|
81793
|
-
mathJaxInstance.startup.document.clear();
|
|
81794
|
-
})["catch"](function (error) {
|
|
81795
|
-
console.error('Error in typesetting with MathJax:', error);
|
|
81796
|
-
});
|
|
81797
|
-
}
|
|
81798
|
-
})["catch"](function (error) {
|
|
81799
|
-
console.error('Error in initializing MathJax:', error);
|
|
81800
|
-
});
|
|
81801
|
-
}
|
|
81802
|
-
};
|
|
81803
|
-
if (skipWaitForMathRenderingLib) {
|
|
81804
|
-
return renderMathAccessible();
|
|
81805
|
-
} else {
|
|
81806
|
-
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
81807
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81808
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
81809
|
-
}
|
|
81810
|
-
if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
|
|
81811
|
-
return renderMathAccessible();
|
|
81812
|
-
}
|
|
81813
|
-
var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
|
|
81814
|
-
var mathElements = executeOn.querySelectorAll('[data-latex]');
|
|
81815
|
-
mathElements.forEach(createPlaceholder);
|
|
81816
|
-
var checkIntervalId;
|
|
81817
|
-
var maxWaitTime = 500;
|
|
81818
|
-
var startTime = Date.now();
|
|
81819
|
-
var checkForLib = function checkForLib() {
|
|
81820
|
-
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
81821
|
-
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
81822
|
-
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
81823
|
-
clearInterval(checkIntervalId);
|
|
81824
|
-
if (mathRenderingHasLoaded) {
|
|
81825
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81826
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
81827
|
-
}
|
|
81828
|
-
renderMathAccessibleCallback();
|
|
81829
|
-
}
|
|
81830
|
-
};
|
|
81831
|
-
checkIntervalId = setInterval(checkForLib, 100);
|
|
81832
|
-
};
|
|
81833
|
-
waitForMathRenderingLib(renderMathAccessible);
|
|
81784
|
+
return el;
|
|
81834
81785
|
}
|
|
81835
81786
|
};
|
|
81787
|
+
(function () {
|
|
81788
|
+
if (window.checkIntervalId) {
|
|
81789
|
+
return;
|
|
81790
|
+
}
|
|
81791
|
+
window.checkIntervalId = undefined;
|
|
81792
|
+
var maxWaitTime = 5000;
|
|
81793
|
+
var startTime = Date.now();
|
|
81794
|
+
var checkForLib = function checkForLib() {
|
|
81795
|
+
var mathElements = document.body.querySelectorAll("[data-latex]");
|
|
81796
|
+
mathElements.forEach(createPlaceholder);
|
|
81797
|
+
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
81798
|
+
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
81799
|
+
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
81800
|
+
clearInterval(window.checkIntervalId);
|
|
81801
|
+
removePlaceholdersAndRestoreDisplay();
|
|
81802
|
+
}
|
|
81803
|
+
if (hasExceededMaxWait) {
|
|
81804
|
+
initializeMathJax(renderContentWithMathJax);
|
|
81805
|
+
}
|
|
81806
|
+
};
|
|
81807
|
+
window.checkIntervalId = setInterval(checkForLib, 50);
|
|
81808
|
+
})();
|
|
81836
81809
|
var _default = renderMath;
|
|
81837
81810
|
exports["default"] = _default;
|
|
81838
81811
|
})(renderMath$2);
|
package/module/manifest.json
CHANGED