@pie-element/math-templated 2.22.7-next.1 → 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 +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/module/print.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;
|
|
@@ -21807,90 +21807,6 @@ withMask$1.withMask = withMask;
|
|
|
21807
21807
|
var dragInTheBlank = {};
|
|
21808
21808
|
var mathRenderingAccessible = {};
|
|
21809
21809
|
var renderMath$3 = {};
|
|
21810
|
-
var mathjaxScript = {};
|
|
21811
|
-
Object.defineProperty(mathjaxScript, "__esModule", {
|
|
21812
|
-
value: true
|
|
21813
|
-
});
|
|
21814
|
-
mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
|
|
21815
|
-
var _renderMath = renderMath$3;
|
|
21816
|
-
var MathJaxVersion = '3.2.2';
|
|
21817
|
-
mathjaxScript.MathJaxVersion = MathJaxVersion;
|
|
21818
|
-
var initializeMathJax = function initializeMathJax(renderOpts) {
|
|
21819
|
-
if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
|
|
21820
|
-
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
21821
|
-
}
|
|
21822
|
-
var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
|
|
21823
|
-
macros: {
|
|
21824
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
21825
|
-
overarc: '\\overparen',
|
|
21826
|
-
napprox: '\\not\\approx',
|
|
21827
|
-
longdiv: '\\enclose{longdiv}'
|
|
21828
|
-
},
|
|
21829
|
-
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
21830
|
-
processEscapes: true,
|
|
21831
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
21832
|
-
} : {
|
|
21833
|
-
macros: {
|
|
21834
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
21835
|
-
overarc: '\\overparen',
|
|
21836
|
-
napprox: '\\not\\approx',
|
|
21837
|
-
longdiv: '\\enclose{longdiv}'
|
|
21838
|
-
},
|
|
21839
|
-
displayMath: [['$$', '$$'], ['\\[', '\\]']]
|
|
21840
|
-
};
|
|
21841
|
-
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
21842
|
-
window.MathJax = {
|
|
21843
|
-
startup: {
|
|
21844
|
-
typeset: false,
|
|
21845
|
-
ready: function ready() {
|
|
21846
|
-
var mathjax = MathJax._.mathjax.mathjax;
|
|
21847
|
-
var STATE = MathJax._.core.MathItem.STATE;
|
|
21848
|
-
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
21849
|
-
var rerender = Menu.prototype.rerender;
|
|
21850
|
-
Menu.prototype.rerender = function () {
|
|
21851
|
-
var _this = this;
|
|
21852
|
-
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
21853
|
-
mathjax.handleRetriesFor(function () {
|
|
21854
|
-
return rerender.call(_this, start);
|
|
21855
|
-
});
|
|
21856
|
-
};
|
|
21857
|
-
MathJax.startup.defaultReady();
|
|
21858
|
-
var globalObj = (0, _renderMath.getGlobal)();
|
|
21859
|
-
globalObj.instance = MathJax;
|
|
21860
|
-
resolve();
|
|
21861
|
-
}
|
|
21862
|
-
},
|
|
21863
|
-
loader: {
|
|
21864
|
-
load: ['input/mml']
|
|
21865
|
-
},
|
|
21866
|
-
tex: texConfig,
|
|
21867
|
-
chtml: {
|
|
21868
|
-
fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
|
|
21869
|
-
displayAlign: 'center'
|
|
21870
|
-
},
|
|
21871
|
-
customKey: '@pie-lib/math-rendering-accessible@1',
|
|
21872
|
-
options: {
|
|
21873
|
-
enableEnrichment: true,
|
|
21874
|
-
sre: {
|
|
21875
|
-
speech: 'deep'
|
|
21876
|
-
},
|
|
21877
|
-
menuOptions: {
|
|
21878
|
-
settings: {
|
|
21879
|
-
assistiveMml: true,
|
|
21880
|
-
collapsible: false,
|
|
21881
|
-
explorer: false
|
|
21882
|
-
}
|
|
21883
|
-
}
|
|
21884
|
-
}
|
|
21885
|
-
};
|
|
21886
|
-
var script = document.createElement('script');
|
|
21887
|
-
script.type = 'text/javascript';
|
|
21888
|
-
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
21889
|
-
script.async = true;
|
|
21890
|
-
document.body.appendChild(script);
|
|
21891
|
-
});
|
|
21892
|
-
};
|
|
21893
|
-
mathjaxScript.initializeMathJax = initializeMathJax;
|
|
21894
21810
|
var normalization$1 = {};
|
|
21895
21811
|
var slicedToArray = {
|
|
21896
21812
|
exports: {}
|
|
@@ -81566,9 +81482,8 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81566
81482
|
Object.defineProperty(exports, "__esModule", {
|
|
81567
81483
|
value: true
|
|
81568
81484
|
});
|
|
81569
|
-
exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
|
|
81485
|
+
exports.initializeMathJax = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = exports.MathJaxVersion = void 0;
|
|
81570
81486
|
var _typeof2 = _interopRequireDefault(_typeof$b.exports);
|
|
81571
|
-
var _mathjaxScript = mathjaxScript;
|
|
81572
81487
|
var _normalization = normalization$1;
|
|
81573
81488
|
var mr = _interopRequireWildcard(mathRendering);
|
|
81574
81489
|
var _SerializedMmlVisitor = SerializedMmlVisitor;
|
|
@@ -81616,11 +81531,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81616
81531
|
return visitor.visitTree(node);
|
|
81617
81532
|
};
|
|
81618
81533
|
var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
81619
|
-
var NEWLINE_LATEX =
|
|
81620
|
-
var mathRenderingKEY =
|
|
81621
|
-
var mathRenderingAccessibleKEY =
|
|
81534
|
+
var NEWLINE_LATEX = "\\newline ";
|
|
81535
|
+
var mathRenderingKEY = "@pie-lib/math-rendering@2";
|
|
81536
|
+
var mathRenderingAccessibleKEY = "@pie-lib/math-rendering-accessible@1";
|
|
81537
|
+
var MathJaxVersion = "3.2.2";
|
|
81538
|
+
exports.MathJaxVersion = MathJaxVersion;
|
|
81622
81539
|
var getGlobal = function getGlobal() {
|
|
81623
|
-
if (typeof window !==
|
|
81540
|
+
if (typeof window !== "undefined") {
|
|
81624
81541
|
if (!window[mathRenderingAccessibleKEY]) {
|
|
81625
81542
|
window[mathRenderingAccessibleKEY] = {};
|
|
81626
81543
|
}
|
|
@@ -81630,16 +81547,13 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81630
81547
|
}
|
|
81631
81548
|
};
|
|
81632
81549
|
exports.getGlobal = getGlobal;
|
|
81633
|
-
var defaultOpts = function defaultOpts() {
|
|
81634
|
-
return getGlobal().opts || ({});
|
|
81635
|
-
};
|
|
81636
81550
|
var fixMathElement = function fixMathElement(element) {
|
|
81637
81551
|
if (element.dataset.mathHandled) {
|
|
81638
81552
|
return;
|
|
81639
81553
|
}
|
|
81640
|
-
var property =
|
|
81554
|
+
var property = "innerText";
|
|
81641
81555
|
if (element.textContent) {
|
|
81642
|
-
property =
|
|
81556
|
+
property = "textContent";
|
|
81643
81557
|
}
|
|
81644
81558
|
if (element[property]) {
|
|
81645
81559
|
element[property] = (0, _normalization.wrapMath)((0, _normalization.unWrapMath)(element[property]).unwrapped);
|
|
@@ -81650,7 +81564,7 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81650
81564
|
exports.fixMathElement = fixMathElement;
|
|
81651
81565
|
var fixMathElements = function fixMathElements() {
|
|
81652
81566
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
81653
|
-
var mathElements = el.querySelectorAll(
|
|
81567
|
+
var mathElements = el.querySelectorAll("[data-latex]");
|
|
81654
81568
|
mathElements.forEach(function (item) {
|
|
81655
81569
|
return fixMathElement(item);
|
|
81656
81570
|
});
|
|
@@ -81658,25 +81572,25 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81658
81572
|
exports.fixMathElements = fixMathElements;
|
|
81659
81573
|
var adjustMathMLStyle = function adjustMathMLStyle() {
|
|
81660
81574
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
81661
|
-
var nodes = el.querySelectorAll(
|
|
81575
|
+
var nodes = el.querySelectorAll("math");
|
|
81662
81576
|
nodes.forEach(function (node) {
|
|
81663
|
-
return node.setAttribute(
|
|
81577
|
+
return node.setAttribute("displaystyle", "true");
|
|
81664
81578
|
});
|
|
81665
81579
|
};
|
|
81666
81580
|
var createPlaceholder = function createPlaceholder(element) {
|
|
81667
81581
|
var _element$previousSibl;
|
|
81668
|
-
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains(
|
|
81582
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
81669
81583
|
var _element$parentNode;
|
|
81670
|
-
element.dataset.originalDisplay = element.style.display ||
|
|
81671
|
-
element.style.display =
|
|
81672
|
-
var placeholder = document.createElement(
|
|
81673
|
-
placeholder.style.cssText =
|
|
81674
|
-
placeholder.classList.add(
|
|
81584
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
81585
|
+
element.style.display = "none";
|
|
81586
|
+
var placeholder = document.createElement("span");
|
|
81587
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
81588
|
+
placeholder.classList.add("math-placeholder");
|
|
81675
81589
|
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
81676
81590
|
}
|
|
81677
81591
|
};
|
|
81678
81592
|
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
81679
|
-
document.querySelectorAll(
|
|
81593
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
81680
81594
|
var _targetElement$datase;
|
|
81681
81595
|
var targetElement = placeholder.nextElementSibling;
|
|
81682
81596
|
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
@@ -81687,9 +81601,9 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81687
81601
|
});
|
|
81688
81602
|
};
|
|
81689
81603
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
81690
|
-
var elements = content.querySelectorAll(
|
|
81604
|
+
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
81691
81605
|
elements.forEach(function (element) {
|
|
81692
|
-
var mjxContainers = element.querySelectorAll(
|
|
81606
|
+
var mjxContainers = element.querySelectorAll("mjx-container");
|
|
81693
81607
|
if (mjxContainers.length > 1) {
|
|
81694
81608
|
for (var i = 1; i < mjxContainers.length; i++) {
|
|
81695
81609
|
mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
|
|
@@ -81697,28 +81611,124 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81697
81611
|
}
|
|
81698
81612
|
});
|
|
81699
81613
|
};
|
|
81700
|
-
var
|
|
81701
|
-
|
|
81702
|
-
|
|
81614
|
+
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
81615
|
+
executeOn = executeOn || document.body;
|
|
81616
|
+
fixMathElements(executeOn);
|
|
81617
|
+
adjustMathMLStyle(executeOn);
|
|
81618
|
+
var mathJaxInstance = getGlobal().instance;
|
|
81619
|
+
if (mathJaxInstance) {
|
|
81620
|
+
mathJaxInstance.texReset();
|
|
81621
|
+
mathJaxInstance.typesetClear();
|
|
81622
|
+
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
81623
|
+
try {
|
|
81624
|
+
removeExcessMjxContainers(executeOn);
|
|
81625
|
+
var updatedDocument = mathJaxInstance.startup.document;
|
|
81626
|
+
var list = updatedDocument.math.list;
|
|
81627
|
+
for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
|
|
81628
|
+
var mathMl = toMMl(item.data.root);
|
|
81629
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
81630
|
+
item.data.typesetRoot.setAttribute("data-mathml", parsedMathMl);
|
|
81631
|
+
}
|
|
81632
|
+
} catch (e) {
|
|
81633
|
+
console.error("Error post-processing MathJax typesetting:", e.toString());
|
|
81634
|
+
}
|
|
81635
|
+
mathJaxInstance.startup.document.clear();
|
|
81636
|
+
})["catch"](function (error) {
|
|
81637
|
+
console.error("Error in typesetting with MathJax:", error);
|
|
81638
|
+
});
|
|
81639
|
+
}
|
|
81703
81640
|
};
|
|
81641
|
+
var initializeMathJax = function initializeMathJax(callback) {
|
|
81642
|
+
var texConfig = {
|
|
81643
|
+
macros: {
|
|
81644
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
81645
|
+
overarc: "\\overparen",
|
|
81646
|
+
napprox: "\\not\\approx",
|
|
81647
|
+
longdiv: "\\enclose{longdiv}"
|
|
81648
|
+
},
|
|
81649
|
+
displayMath: [["$$", "$$"], ["\\[", "\\]"]]
|
|
81650
|
+
};
|
|
81651
|
+
window.mathjaxLoadedP = new Promise(function (resolve) {
|
|
81652
|
+
window.MathJax = {
|
|
81653
|
+
startup: {
|
|
81654
|
+
typeset: false,
|
|
81655
|
+
ready: function ready() {
|
|
81656
|
+
var mathjax = MathJax._.mathjax.mathjax;
|
|
81657
|
+
var STATE = MathJax._.core.MathItem.STATE;
|
|
81658
|
+
var Menu = MathJax._.ui.menu.Menu.Menu;
|
|
81659
|
+
var rerender = Menu.prototype.rerender;
|
|
81660
|
+
Menu.prototype.rerender = function () {
|
|
81661
|
+
var _this = this;
|
|
81662
|
+
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
|
|
81663
|
+
mathjax.handleRetriesFor(function () {
|
|
81664
|
+
return rerender.call(_this, start);
|
|
81665
|
+
});
|
|
81666
|
+
};
|
|
81667
|
+
MathJax.startup.defaultReady();
|
|
81668
|
+
var globalObj = getGlobal();
|
|
81669
|
+
globalObj.instance = MathJax;
|
|
81670
|
+
window.mathjaxLoadedComplete = true;
|
|
81671
|
+
console.log("MathJax has initialised!", new Date().toString());
|
|
81672
|
+
if (callback) {
|
|
81673
|
+
callback();
|
|
81674
|
+
}
|
|
81675
|
+
resolve();
|
|
81676
|
+
}
|
|
81677
|
+
},
|
|
81678
|
+
loader: {
|
|
81679
|
+
load: ["input/mml"],
|
|
81680
|
+
preLoad: function preLoad() {}
|
|
81681
|
+
},
|
|
81682
|
+
tex: texConfig,
|
|
81683
|
+
chtml: {
|
|
81684
|
+
fontURL: "https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2",
|
|
81685
|
+
displayAlign: "center"
|
|
81686
|
+
},
|
|
81687
|
+
customKey: "@pie-lib/math-rendering-accessible@1",
|
|
81688
|
+
options: {
|
|
81689
|
+
enableEnrichment: true,
|
|
81690
|
+
sre: {
|
|
81691
|
+
speech: "deep"
|
|
81692
|
+
},
|
|
81693
|
+
menuOptions: {
|
|
81694
|
+
settings: {
|
|
81695
|
+
assistiveMml: true,
|
|
81696
|
+
collapsible: false,
|
|
81697
|
+
explorer: false
|
|
81698
|
+
}
|
|
81699
|
+
}
|
|
81700
|
+
}
|
|
81701
|
+
};
|
|
81702
|
+
var script = document.createElement("script");
|
|
81703
|
+
script.type = "text/javascript";
|
|
81704
|
+
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
81705
|
+
script.async = true;
|
|
81706
|
+
document.body.appendChild(script);
|
|
81707
|
+
});
|
|
81708
|
+
};
|
|
81709
|
+
exports.initializeMathJax = initializeMathJax;
|
|
81704
81710
|
var renderMath = function renderMath(el, renderOpts) {
|
|
81705
|
-
var
|
|
81711
|
+
var usedForMmlOutput = typeof el === "string";
|
|
81706
81712
|
var executeOn = document.body;
|
|
81707
|
-
if (
|
|
81708
|
-
|
|
81709
|
-
div.innerHTML = el;
|
|
81710
|
-
executeOn = div;
|
|
81713
|
+
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
81714
|
+
return mr.renderMath(el, renderOpts);
|
|
81711
81715
|
}
|
|
81712
|
-
|
|
81713
|
-
|
|
81714
|
-
|
|
81715
|
-
|
|
81716
|
-
|
|
81717
|
-
|
|
81718
|
-
|
|
81719
|
-
(
|
|
81716
|
+
if (!usedForMmlOutput) {
|
|
81717
|
+
if (window.mathjaxLoadedComplete) {
|
|
81718
|
+
renderContentWithMathJax(el);
|
|
81719
|
+
} else if (window.mathjaxLoadedP) {
|
|
81720
|
+
window.mathjaxLoadedP.then(function () {
|
|
81721
|
+
window.mathjaxLoadedComplete = true;
|
|
81722
|
+
renderContentWithMathJax(el);
|
|
81723
|
+
})["catch"](function (error) {
|
|
81724
|
+
return console.error("Error in initializing MathJax:", error);
|
|
81725
|
+
});
|
|
81720
81726
|
}
|
|
81721
|
-
|
|
81727
|
+
} else {
|
|
81728
|
+
if (window.MathJax && window.mathjaxLoadedP) {
|
|
81729
|
+
var div = document.createElement("div");
|
|
81730
|
+
div.innerHTML = el;
|
|
81731
|
+
executeOn = div;
|
|
81722
81732
|
try {
|
|
81723
81733
|
MathJax.texReset();
|
|
81724
81734
|
MathJax.typesetClear();
|
|
@@ -81727,76 +81737,38 @@ getDefaultExportFromCjs(mathRendering);
|
|
|
81727
81737
|
var list = updatedDocument.math.list;
|
|
81728
81738
|
var item = list.next;
|
|
81729
81739
|
var mathMl = toMMl(item.data.root);
|
|
81730
|
-
var parsedMathMl = mathMl.replaceAll(
|
|
81740
|
+
var parsedMathMl = mathMl.replaceAll("\n", "");
|
|
81731
81741
|
return parsedMathMl;
|
|
81732
81742
|
} catch (error) {
|
|
81733
|
-
console.error(
|
|
81743
|
+
console.error("Error rendering math:", error.message);
|
|
81734
81744
|
}
|
|
81735
81745
|
return el;
|
|
81736
81746
|
}
|
|
81737
|
-
|
|
81738
|
-
window.mathjaxLoadedP.then(function () {
|
|
81739
|
-
var mathJaxInstance = getGlobal().instance;
|
|
81740
|
-
if (mathJaxInstance) {
|
|
81741
|
-
mathJaxInstance.texReset();
|
|
81742
|
-
mathJaxInstance.typesetClear();
|
|
81743
|
-
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
81744
|
-
try {
|
|
81745
|
-
removeExcessMjxContainers(executeOn);
|
|
81746
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81747
|
-
var _updatedDocument = mathJaxInstance.startup.document;
|
|
81748
|
-
var _list = _updatedDocument.math.list;
|
|
81749
|
-
for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
|
|
81750
|
-
var _mathMl = toMMl(_item.data.root);
|
|
81751
|
-
var _parsedMathMl = _mathMl.replaceAll('\n', '');
|
|
81752
|
-
_item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
|
|
81753
|
-
}
|
|
81754
|
-
} catch (e) {
|
|
81755
|
-
console.error('Error post-processing MathJax typesetting:', e.toString());
|
|
81756
|
-
}
|
|
81757
|
-
mathJaxInstance.startup.document.clear();
|
|
81758
|
-
})["catch"](function (error) {
|
|
81759
|
-
console.error('Error in typesetting with MathJax:', error);
|
|
81760
|
-
});
|
|
81761
|
-
}
|
|
81762
|
-
})["catch"](function (error) {
|
|
81763
|
-
console.error('Error in initializing MathJax:', error);
|
|
81764
|
-
});
|
|
81765
|
-
}
|
|
81766
|
-
};
|
|
81767
|
-
if (skipWaitForMathRenderingLib) {
|
|
81768
|
-
return renderMathAccessible();
|
|
81769
|
-
} else {
|
|
81770
|
-
if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
|
|
81771
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81772
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
81773
|
-
}
|
|
81774
|
-
if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
|
|
81775
|
-
return renderMathAccessible();
|
|
81776
|
-
}
|
|
81777
|
-
var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
|
|
81778
|
-
var mathElements = executeOn.querySelectorAll('[data-latex]');
|
|
81779
|
-
mathElements.forEach(createPlaceholder);
|
|
81780
|
-
var checkIntervalId;
|
|
81781
|
-
var maxWaitTime = 500;
|
|
81782
|
-
var startTime = Date.now();
|
|
81783
|
-
var checkForLib = function checkForLib() {
|
|
81784
|
-
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
81785
|
-
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
81786
|
-
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
81787
|
-
clearInterval(checkIntervalId);
|
|
81788
|
-
if (mathRenderingHasLoaded) {
|
|
81789
|
-
removePlaceholdersAndRestoreDisplay();
|
|
81790
|
-
return mr.renderMath(executeOn, renderOpts);
|
|
81791
|
-
}
|
|
81792
|
-
renderMathAccessibleCallback();
|
|
81793
|
-
}
|
|
81794
|
-
};
|
|
81795
|
-
checkIntervalId = setInterval(checkForLib, 100);
|
|
81796
|
-
};
|
|
81797
|
-
waitForMathRenderingLib(renderMathAccessible);
|
|
81747
|
+
return el;
|
|
81798
81748
|
}
|
|
81799
81749
|
};
|
|
81750
|
+
(function () {
|
|
81751
|
+
if (window.checkIntervalId) {
|
|
81752
|
+
return;
|
|
81753
|
+
}
|
|
81754
|
+
window.checkIntervalId = undefined;
|
|
81755
|
+
var maxWaitTime = 5000;
|
|
81756
|
+
var startTime = Date.now();
|
|
81757
|
+
var checkForLib = function checkForLib() {
|
|
81758
|
+
var mathElements = document.body.querySelectorAll("[data-latex]");
|
|
81759
|
+
mathElements.forEach(createPlaceholder);
|
|
81760
|
+
var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
|
|
81761
|
+
var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
|
|
81762
|
+
if (mathRenderingHasLoaded || hasExceededMaxWait) {
|
|
81763
|
+
clearInterval(window.checkIntervalId);
|
|
81764
|
+
removePlaceholdersAndRestoreDisplay();
|
|
81765
|
+
}
|
|
81766
|
+
if (hasExceededMaxWait) {
|
|
81767
|
+
initializeMathJax(renderContentWithMathJax);
|
|
81768
|
+
}
|
|
81769
|
+
};
|
|
81770
|
+
window.checkIntervalId = setInterval(checkForLib, 50);
|
|
81771
|
+
})();
|
|
81800
81772
|
var _default = renderMath;
|
|
81801
81773
|
exports["default"] = _default;
|
|
81802
81774
|
})(renderMath$3);
|
package/package.json
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "2.22.7-next.
|
|
7
|
+
"version": "2.22.7-next.2+a5588cfdc",
|
|
8
8
|
"description": "",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
|
-
"@pie-lib/pie-toolbox": "
|
|
12
|
+
"@pie-lib/pie-toolbox": "2.0.2",
|
|
13
13
|
"prop-types": "^15.6.1",
|
|
14
14
|
"react": "^16.8.1",
|
|
15
15
|
"react-dom": "^16.8.1"
|
|
16
16
|
},
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "a5588cfdccb40e970e93736dea60de4b01f1a85d",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"postpublish": "../../scripts/postpublish"
|
|
22
22
|
},
|