@pie-element/math-templated 2.22.7-next.1 → 2.22.7-next.10
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 +161 -189
- package/module/element.js +161 -189
- package/module/manifest.json +2 -2
- package/module/print.js +161 -189
- package/package.json +3 -3
package/configure/package.json
CHANGED
package/controller/package.json
CHANGED
package/module/configure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.1/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@5.0.1/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;
|
|
@@ -43049,90 +43049,6 @@ Collapse$1.default = _default$l;
|
|
|
43049
43049
|
getDefaultExportFromCjs(Collapse$2);
|
|
43050
43050
|
var mathRenderingAccessible = {};
|
|
43051
43051
|
var renderMath$1 = {};
|
|
43052
|
-
var mathjaxScript = {};
|
|
43053
|
-
Object.defineProperty(mathjaxScript, "__esModule", {
|
|
43054
|
-
value: true
|
|
43055
|
-
});
|
|
43056
|
-
mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
|
|
43057
|
-
var _renderMath = renderMath$1;
|
|
43058
|
-
var MathJaxVersion = '3.2.2';
|
|
43059
|
-
mathjaxScript.MathJaxVersion = MathJaxVersion;
|
|
43060
|
-
var initializeMathJax = function initializeMathJax(renderOpts) {
|
|
43061
|
-
if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
|
|
43062
|
-
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
43063
|
-
}
|
|
43064
|
-
var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
|
|
43065
|
-
macros: {
|
|
43066
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
43067
|
-
overarc: '\\overparen',
|
|
43068
|
-
napprox: '\\not\\approx',
|
|
43069
|
-
longdiv: '\\enclose{longdiv}'
|
|
43070
|
-
},
|
|
43071
|
-
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
43072
|
-
processEscapes: true,
|
|
43073
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
43074
|
-
} : {
|
|
43075
|
-
macros: {
|
|
43076
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
43077
|
-
overarc: '\\overparen',
|
|
43078
|
-
napprox: '\\not\\approx',
|
|
43079
|
-
longdiv: '\\enclose{longdiv}'
|
|
43080
|
-
},
|
|
43081
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
43082
|
-
};
|
|
43083
|
-
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
43084
|
-
window.MathJax = {
|
|
43085
|
-
startup: {
|
|
43086
|
-
typeset: false,
|
|
43087
|
-
ready: function ready() {
|
|
43088
|
-
var mathjax = MathJax._.mathjax.mathjax;
|
|
43089
|
-
var STATE = MathJax._.core.MathItem.STATE;
|
|
43090
|
-
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
43091
|
-
var rerender = Menu.prototype.rerender;
|
|
43092
|
-
Menu.prototype.rerender = function () {
|
|
43093
|
-
var _this = this;
|
|
43094
|
-
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
43095
|
-
mathjax.handleRetriesFor(function () {
|
|
43096
|
-
return rerender.call(_this, start);
|
|
43097
|
-
});
|
|
43098
|
-
};
|
|
43099
|
-
MathJax.startup.defaultReady();
|
|
43100
|
-
var globalObj = (0, _renderMath.getGlobal)();
|
|
43101
|
-
globalObj.instance = MathJax;
|
|
43102
|
-
resolve();
|
|
43103
|
-
}
|
|
43104
|
-
},
|
|
43105
|
-
loader: {
|
|
43106
|
-
load: ['input/mml']
|
|
43107
|
-
},
|
|
43108
|
-
tex: texConfig,
|
|
43109
|
-
chtml: {
|
|
43110
|
-
fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
|
|
43111
|
-
displayAlign: 'center'
|
|
43112
|
-
},
|
|
43113
|
-
customKey: '@pie-lib/math-rendering-accessible@1',
|
|
43114
|
-
options: {
|
|
43115
|
-
enableEnrichment: true,
|
|
43116
|
-
sre: {
|
|
43117
|
-
speech: 'deep'
|
|
43118
|
-
},
|
|
43119
|
-
menuOptions: {
|
|
43120
|
-
settings: {
|
|
43121
|
-
assistiveMml: true,
|
|
43122
|
-
collapsible: false,
|
|
43123
|
-
explorer: false
|
|
43124
|
-
}
|
|
43125
|
-
}
|
|
43126
|
-
}
|
|
43127
|
-
};
|
|
43128
|
-
var script = document.createElement('script');
|
|
43129
|
-
script.type = 'text/javascript';
|
|
43130
|
-
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
43131
|
-
script.async = true;
|
|
43132
|
-
document.body.appendChild(script);
|
|
43133
|
-
});
|
|
43134
|
-
};
|
|
43135
|
-
mathjaxScript.initializeMathJax = initializeMathJax;
|
|
43136
43052
|
var normalization$1 = {};
|
|
43137
43053
|
var _interopRequireDefault$o = interopRequireDefault.exports;
|
|
43138
43054
|
Object.defineProperty(normalization$1, "__esModule", {
|
|
@@ -102668,9 +102584,8 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102668
102584
|
Object.defineProperty(exports, "__esModule", {
|
|
102669
102585
|
value: true
|
|
102670
102586
|
});
|
|
102671
|
-
exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
|
|
102587
|
+
exports.initializeMathJax = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = exports.MathJaxVersion = void 0;
|
|
102672
102588
|
var _typeof2 = _interopRequireDefault(_typeof$3.exports);
|
|
102673
|
-
var _mathjaxScript = mathjaxScript;
|
|
102674
102589
|
var _normalization = normalization$1;
|
|
102675
102590
|
var mr = _interopRequireWildcard(mathRendering);
|
|
102676
102591
|
var _SerializedMmlVisitor = SerializedMmlVisitor;
|
|
@@ -102718,11 +102633,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102718
102633
|
return visitor.visitTree(node);
|
|
102719
102634
|
};
|
|
102720
102635
|
var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
102721
|
-
var NEWLINE_LATEX =
|
|
102722
|
-
var mathRenderingKEY =
|
|
102723
|
-
var mathRenderingAccessibleKEY =
|
|
102636
|
+
var NEWLINE_LATEX = "\\newline ";
|
|
102637
|
+
var mathRenderingKEY = "@pie-lib/math-rendering@2";
|
|
102638
|
+
var mathRenderingAccessibleKEY = "@pie-lib/math-rendering-accessible@1";
|
|
102639
|
+
var MathJaxVersion = "3.2.2";
|
|
102640
|
+
exports.MathJaxVersion = MathJaxVersion;
|
|
102724
102641
|
var getGlobal = function getGlobal() {
|
|
102725
|
-
if (typeof window !==
|
|
102642
|
+
if (typeof window !== "undefined") {
|
|
102726
102643
|
if (!window[mathRenderingAccessibleKEY]) {
|
|
102727
102644
|
window[mathRenderingAccessibleKEY] = {};
|
|
102728
102645
|
}
|
|
@@ -102732,16 +102649,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102732
102649
|
}
|
|
102733
102650
|
};
|
|
102734
102651
|
exports.getGlobal = getGlobal;
|
|
102735
|
-
var defaultOpts = function defaultOpts() {
|
|
102736
|
-
return getGlobal().opts || ({});
|
|
102737
|
-
};
|
|
102738
102652
|
var fixMathElement = function fixMathElement(element) {
|
|
102739
102653
|
if (element.dataset.mathHandled) {
|
|
102740
102654
|
return;
|
|
102741
102655
|
}
|
|
102742
|
-
var property =
|
|
102656
|
+
var property = "innerText";
|
|
102743
102657
|
if (element.textContent) {
|
|
102744
|
-
property =
|
|
102658
|
+
property = "textContent";
|
|
102745
102659
|
}
|
|
102746
102660
|
if (element[property]) {
|
|
102747
102661
|
element[property] = (0, _normalization.wrapMath)((0, _normalization.unWrapMath)(element[property]).unwrapped);
|
|
@@ -102752,7 +102666,7 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102752
102666
|
exports.fixMathElement = fixMathElement;
|
|
102753
102667
|
var fixMathElements = function fixMathElements() {
|
|
102754
102668
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
102755
|
-
var mathElements = el.querySelectorAll(
|
|
102669
|
+
var mathElements = el.querySelectorAll("[data-latex]");
|
|
102756
102670
|
mathElements.forEach(function (item) {
|
|
102757
102671
|
return fixMathElement(item);
|
|
102758
102672
|
});
|
|
@@ -102760,25 +102674,25 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102760
102674
|
exports.fixMathElements = fixMathElements;
|
|
102761
102675
|
var adjustMathMLStyle = function adjustMathMLStyle() {
|
|
102762
102676
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
102763
|
-
var nodes = el.querySelectorAll(
|
|
102677
|
+
var nodes = el.querySelectorAll("math");
|
|
102764
102678
|
nodes.forEach(function (node) {
|
|
102765
|
-
return node.setAttribute(
|
|
102679
|
+
return node.setAttribute("displaystyle", "true");
|
|
102766
102680
|
});
|
|
102767
102681
|
};
|
|
102768
102682
|
var createPlaceholder = function createPlaceholder(element) {
|
|
102769
102683
|
var _element$previousSibl;
|
|
102770
|
-
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains(
|
|
102684
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
102771
102685
|
var _element$parentNode;
|
|
102772
|
-
element.dataset.originalDisplay = element.style.display ||
|
|
102773
|
-
element.style.display =
|
|
102774
|
-
var placeholder = document.createElement(
|
|
102775
|
-
placeholder.style.cssText =
|
|
102776
|
-
placeholder.classList.add(
|
|
102686
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
102687
|
+
element.style.display = "none";
|
|
102688
|
+
var placeholder = document.createElement("span");
|
|
102689
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
102690
|
+
placeholder.classList.add("math-placeholder");
|
|
102777
102691
|
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
102778
102692
|
}
|
|
102779
102693
|
};
|
|
102780
102694
|
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
102781
|
-
document.querySelectorAll(
|
|
102695
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
102782
102696
|
var _targetElement$datase;
|
|
102783
102697
|
var targetElement = placeholder.nextElementSibling;
|
|
102784
102698
|
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
@@ -102789,9 +102703,9 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102789
102703
|
});
|
|
102790
102704
|
};
|
|
102791
102705
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
102792
|
-
var elements = content.querySelectorAll(
|
|
102706
|
+
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
102793
102707
|
elements.forEach(function (element) {
|
|
102794
|
-
var mjxContainers = element.querySelectorAll(
|
|
102708
|
+
var mjxContainers = element.querySelectorAll("mjx-container");
|
|
102795
102709
|
if (mjxContainers.length > 1) {
|
|
102796
102710
|
for (var i = 1; i < mjxContainers.length; i++) {
|
|
102797
102711
|
mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
|
|
@@ -102799,28 +102713,124 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102799
102713
|
}
|
|
102800
102714
|
});
|
|
102801
102715
|
};
|
|
102802
|
-
var
|
|
102803
|
-
|
|
102804
|
-
|
|
102716
|
+
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
102717
|
+
executeOn = executeOn || document.body;
|
|
102718
|
+
fixMathElements(executeOn);
|
|
102719
|
+
adjustMathMLStyle(executeOn);
|
|
102720
|
+
var mathJaxInstance = getGlobal().instance;
|
|
102721
|
+
if (mathJaxInstance) {
|
|
102722
|
+
mathJaxInstance.texReset();
|
|
102723
|
+
mathJaxInstance.typesetClear();
|
|
102724
|
+
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
102725
|
+
try {
|
|
102726
|
+
removeExcessMjxContainers(executeOn);
|
|
102727
|
+
var updatedDocument = mathJaxInstance.startup.document;
|
|
102728
|
+
var list = updatedDocument.math.list;
|
|
102729
|
+
for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
|
|
102730
|
+
var mathMl = toMMl(item.data.root);
|
|
102731
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
102732
|
+
item.data.typesetRoot.setAttribute("data-mathml", parsedMathMl);
|
|
102733
|
+
}
|
|
102734
|
+
} catch (e) {
|
|
102735
|
+
console.error("Error post-processing MathJax typesetting:", e.toString());
|
|
102736
|
+
}
|
|
102737
|
+
mathJaxInstance.startup.document.clear();
|
|
102738
|
+
})["catch"](function (error) {
|
|
102739
|
+
console.error("Error in typesetting with MathJax:", error);
|
|
102740
|
+
});
|
|
102741
|
+
}
|
|
102805
102742
|
};
|
|
102743
|
+
var initializeMathJax = function initializeMathJax(callback) {
|
|
102744
|
+
var texConfig = {
|
|
102745
|
+
macros: {
|
|
102746
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
102747
|
+
overarc: "\\overparen",
|
|
102748
|
+
napprox: "\\not\\approx",
|
|
102749
|
+
longdiv: "\\enclose{longdiv}"
|
|
102750
|
+
},
|
|
102751
|
+
displayMath: [["$$", "$$"], ["\\[", "\\]"]]
|
|
102752
|
+
};
|
|
102753
|
+
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
102754
|
+
window.MathJax = {
|
|
102755
|
+
startup: {
|
|
102756
|
+
typeset: false,
|
|
102757
|
+
ready: function ready() {
|
|
102758
|
+
var mathjax = MathJax._.mathjax.mathjax;
|
|
102759
|
+
var STATE = MathJax._.core.MathItem.STATE;
|
|
102760
|
+
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
102761
|
+
var rerender = Menu.prototype.rerender;
|
|
102762
|
+
Menu.prototype.rerender = function () {
|
|
102763
|
+
var _this = this;
|
|
102764
|
+
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
102765
|
+
mathjax.handleRetriesFor(function () {
|
|
102766
|
+
return rerender.call(_this, start);
|
|
102767
|
+
});
|
|
102768
|
+
};
|
|
102769
|
+
MathJax.startup.defaultReady();
|
|
102770
|
+
var globalObj = getGlobal();
|
|
102771
|
+
globalObj.instance = MathJax;
|
|
102772
|
+
window.mathjaxLoadedComplete = true;
|
|
102773
|
+
console.log("MathJax has initialised!", new Date().toString());
|
|
102774
|
+
if (callback) {
|
|
102775
|
+
callback();
|
|
102776
|
+
}
|
|
102777
|
+
resolve();
|
|
102778
|
+
}
|
|
102779
|
+
},
|
|
102780
|
+
loader: {
|
|
102781
|
+
load: ["input/mml"],
|
|
102782
|
+
preLoad: function preLoad() {}
|
|
102783
|
+
},
|
|
102784
|
+
tex: texConfig,
|
|
102785
|
+
chtml: {
|
|
102786
|
+
fontURL: "https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2",
|
|
102787
|
+
displayAlign: "center"
|
|
102788
|
+
},
|
|
102789
|
+
customKey: "@pie-lib/math-rendering-accessible@1",
|
|
102790
|
+
options: {
|
|
102791
|
+
enableEnrichment: true,
|
|
102792
|
+
sre: {
|
|
102793
|
+
speech: "deep"
|
|
102794
|
+
},
|
|
102795
|
+
menuOptions: {
|
|
102796
|
+
settings: {
|
|
102797
|
+
assistiveMml: true,
|
|
102798
|
+
collapsible: false,
|
|
102799
|
+
explorer: false
|
|
102800
|
+
}
|
|
102801
|
+
}
|
|
102802
|
+
}
|
|
102803
|
+
};
|
|
102804
|
+
var script = document.createElement("script");
|
|
102805
|
+
script.type = "text/javascript";
|
|
102806
|
+
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
102807
|
+
script.async = true;
|
|
102808
|
+
document.body.appendChild(script);
|
|
102809
|
+
});
|
|
102810
|
+
};
|
|
102811
|
+
exports.initializeMathJax = initializeMathJax;
|
|
102806
102812
|
var renderMath = function renderMath(el, renderOpts) {
|
|
102807
|
-
var
|
|
102813
|
+
var usedForMmlOutput = typeof el === "string";
|
|
102808
102814
|
var executeOn = document.body;
|
|
102809
|
-
if (
|
|
102810
|
-
|
|
102811
|
-
div.innerHTML = el;
|
|
102812
|
-
executeOn = div;
|
|
102815
|
+
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
102816
|
+
return mr.renderMath(el, renderOpts);
|
|
102813
102817
|
}
|
|
102814
|
-
|
|
102815
|
-
|
|
102816
|
-
|
|
102817
|
-
|
|
102818
|
-
|
|
102819
|
-
|
|
102820
|
-
|
|
102821
|
-
(
|
|
102818
|
+
if (!usedForMmlOutput) {
|
|
102819
|
+
if (window.mathjaxLoadedComplete) {
|
|
102820
|
+
renderContentWithMathJax(el);
|
|
102821
|
+
} else if (window.mathjaxLoadedP) {
|
|
102822
|
+
window.mathjaxLoadedP.then(function () {
|
|
102823
|
+
window.mathjaxLoadedComplete = true;
|
|
102824
|
+
renderContentWithMathJax(el);
|
|
102825
|
+
})["catch"](function (error) {
|
|
102826
|
+
return console.error("Error in initializing MathJax:", error);
|
|
102827
|
+
});
|
|
102822
102828
|
}
|
|
102823
|
-
|
|
102829
|
+
} else {
|
|
102830
|
+
if (window.MathJax && window.mathjaxLoadedP) {
|
|
102831
|
+
var div = document.createElement("div");
|
|
102832
|
+
div.innerHTML = el;
|
|
102833
|
+
executeOn = div;
|
|
102824
102834
|
try {
|
|
102825
102835
|
MathJax.texReset();
|
|
102826
102836
|
MathJax.typesetClear();
|
|
@@ -102829,76 +102839,38 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
102829
102839
|
var list = updatedDocument.math.list;
|
|
102830
102840
|
var item = list.next;
|
|
102831
102841
|
var mathMl = toMMl(item.data.root);
|
|
102832
|
-
var parsedMathMl = mathMl.replaceAll(
|
|
102842
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
102833
102843
|
return parsedMathMl;
|
|
102834
102844
|
} catch (error) {
|
|
102835
|
-
console.error(
|
|
102845
|
+
console.error("Error rendering math:", error.message);
|
|
102836
102846
|
}
|
|
102837
102847
|
return el;
|
|
102838
102848
|
}
|
|
102839
|
-
|
|
102840
|
-
window.mathjaxLoadedP.then(function () {
|
|
102841
|
-
var mathJaxInstance = getGlobal().instance;
|
|
102842
|
-
if (mathJaxInstance) {
|
|
102843
|
-
mathJaxInstance.texReset();
|
|
102844
|
-
mathJaxInstance.typesetClear();
|
|
102845
|
-
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
102846
|
-
try {
|
|
102847
|
-
removeExcessMjxContainers(executeOn);
|
|
102848
|
-
removePlaceholdersAndRestoreDisplay();
|
|
102849
|
-
var _updatedDocument = mathJaxInstance.startup.document;
|
|
102850
|
-
var _list = _updatedDocument.math.list;
|
|
102851
|
-
for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
|
|
102852
|
-
var _mathMl = toMMl(_item.data.root);
|
|
102853
|
-
var _parsedMathMl = _mathMl.replaceAll('\n', '');
|
|
102854
|
-
_item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
|
|
102855
|
-
}
|
|
102856
|
-
} catch (e) {
|
|
102857
|
-
console.error('Error post-processing MathJax typesetting:', e.toString());
|
|
102858
|
-
}
|
|
102859
|
-
mathJaxInstance.startup.document.clear();
|
|
102860
|
-
})["catch"](function (error) {
|
|
102861
|
-
console.error('Error in typesetting with MathJax:', error);
|
|
102862
|
-
});
|
|
102863
|
-
}
|
|
102864
|
-
})["catch"](function (error) {
|
|
102865
|
-
console.error('Error in initializing MathJax:', error);
|
|
102866
|
-
});
|
|
102867
|
-
}
|
|
102868
|
-
};
|
|
102869
|
-
if (skipWaitForMathRenderingLib) {
|
|
102870
|
-
return renderMathAccessible();
|
|
102871
|
-
} else {
|
|
102872
|
-
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
102873
|
-
removePlaceholdersAndRestoreDisplay();
|
|
102874
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
102875
|
-
}
|
|
102876
|
-
if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
|
|
102877
|
-
return renderMathAccessible();
|
|
102878
|
-
}
|
|
102879
|
-
var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
|
|
102880
|
-
var mathElements = executeOn.querySelectorAll('[data-latex]');
|
|
102881
|
-
mathElements.forEach(createPlaceholder);
|
|
102882
|
-
var checkIntervalId;
|
|
102883
|
-
var maxWaitTime = 500;
|
|
102884
|
-
var startTime = Date.now();
|
|
102885
|
-
var checkForLib = function checkForLib() {
|
|
102886
|
-
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
102887
|
-
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
102888
|
-
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
102889
|
-
clearInterval(checkIntervalId);
|
|
102890
|
-
if (mathRenderingHasLoaded) {
|
|
102891
|
-
removePlaceholdersAndRestoreDisplay();
|
|
102892
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
102893
|
-
}
|
|
102894
|
-
renderMathAccessibleCallback();
|
|
102895
|
-
}
|
|
102896
|
-
};
|
|
102897
|
-
checkIntervalId = setInterval(checkForLib, 100);
|
|
102898
|
-
};
|
|
102899
|
-
waitForMathRenderingLib(renderMathAccessible);
|
|
102849
|
+
return el;
|
|
102900
102850
|
}
|
|
102901
102851
|
};
|
|
102852
|
+
(function () {
|
|
102853
|
+
if (window.checkIntervalId) {
|
|
102854
|
+
return;
|
|
102855
|
+
}
|
|
102856
|
+
window.checkIntervalId = undefined;
|
|
102857
|
+
var maxWaitTime = 5000;
|
|
102858
|
+
var startTime = Date.now();
|
|
102859
|
+
var checkForLib = function checkForLib() {
|
|
102860
|
+
var mathElements = document.body.querySelectorAll("[data-latex]");
|
|
102861
|
+
mathElements.forEach(createPlaceholder);
|
|
102862
|
+
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
102863
|
+
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
102864
|
+
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
102865
|
+
clearInterval(window.checkIntervalId);
|
|
102866
|
+
removePlaceholdersAndRestoreDisplay();
|
|
102867
|
+
}
|
|
102868
|
+
if (hasExceededMaxWait) {
|
|
102869
|
+
initializeMathJax(renderContentWithMathJax);
|
|
102870
|
+
}
|
|
102871
|
+
};
|
|
102872
|
+
window.checkIntervalId = setInterval(checkForLib, 50);
|
|
102873
|
+
})();
|
|
102902
102874
|
var _default = renderMath;
|
|
102903
102875
|
exports["default"] = _default;
|
|
102904
102876
|
})(renderMath$1);
|