@pie-element/math-templated 3.0.1-next.3 → 3.0.1-next.5
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 +34 -2
- package/module/element.js +34 -2
- package/module/manifest.json +2 -2
- package/module/print.js +34 -2
- 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.0.
|
|
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
|
+
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.6/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.5/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;
|
|
@@ -50037,6 +50037,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
50037
50037
|
return node.setAttribute("displaystyle", "true");
|
|
50038
50038
|
});
|
|
50039
50039
|
};
|
|
50040
|
+
var createPlaceholder = function createPlaceholder(element) {
|
|
50041
|
+
var _element$previousSibl;
|
|
50042
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
50043
|
+
var _element$parentNode;
|
|
50044
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
50045
|
+
element.style.display = "none";
|
|
50046
|
+
var placeholder = document.createElement("span");
|
|
50047
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
50048
|
+
placeholder.classList.add("math-placeholder");
|
|
50049
|
+
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
50050
|
+
}
|
|
50051
|
+
};
|
|
50052
|
+
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
50053
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
50054
|
+
var _targetElement$datase;
|
|
50055
|
+
var targetElement = placeholder.nextElementSibling;
|
|
50056
|
+
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
50057
|
+
targetElement.style.display = targetElement.dataset.originalDisplay;
|
|
50058
|
+
delete targetElement.dataset.originalDisplay;
|
|
50059
|
+
}
|
|
50060
|
+
placeholder.remove();
|
|
50061
|
+
});
|
|
50062
|
+
};
|
|
50040
50063
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
50041
50064
|
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
50042
50065
|
elements.forEach(function (element) {
|
|
@@ -50050,6 +50073,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
50050
50073
|
};
|
|
50051
50074
|
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
50052
50075
|
executeOn = executeOn || document.body;
|
|
50076
|
+
if (!(executeOn instanceof HTMLElement)) return;
|
|
50053
50077
|
fixMathElements(executeOn);
|
|
50054
50078
|
adjustMathMLStyle(executeOn);
|
|
50055
50079
|
var mathJaxInstance = getGlobal().instance;
|
|
@@ -50058,6 +50082,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
50058
50082
|
mathJaxInstance.typesetClear();
|
|
50059
50083
|
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
50060
50084
|
try {
|
|
50085
|
+
removePlaceholdersAndRestoreDisplay();
|
|
50061
50086
|
removeExcessMjxContainers(executeOn);
|
|
50062
50087
|
var updatedDocument = mathJaxInstance.startup.document;
|
|
50063
50088
|
var list = updatedDocument.math.list;
|
|
@@ -50144,6 +50169,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
50144
50169
|
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
50145
50170
|
script.async = true;
|
|
50146
50171
|
document.head.appendChild(script);
|
|
50172
|
+
setTimeout(function () {
|
|
50173
|
+
if (!window.mathjaxLoadedComplete) {
|
|
50174
|
+
var _document, _document$body;
|
|
50175
|
+
var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
|
|
50176
|
+
(mathElements || []).forEach(createPlaceholder);
|
|
50177
|
+
}
|
|
50178
|
+
});
|
|
50147
50179
|
});
|
|
50148
50180
|
};
|
|
50149
50181
|
exports.initializeMathJax = initializeMathJax;
|
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.0.
|
|
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.
|
|
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.6/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.5/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;
|
|
@@ -28927,6 +28927,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28927
28927
|
return node.setAttribute("displaystyle", "true");
|
|
28928
28928
|
});
|
|
28929
28929
|
};
|
|
28930
|
+
var createPlaceholder = function createPlaceholder(element) {
|
|
28931
|
+
var _element$previousSibl;
|
|
28932
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
28933
|
+
var _element$parentNode;
|
|
28934
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
28935
|
+
element.style.display = "none";
|
|
28936
|
+
var placeholder = document.createElement("span");
|
|
28937
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
28938
|
+
placeholder.classList.add("math-placeholder");
|
|
28939
|
+
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
28940
|
+
}
|
|
28941
|
+
};
|
|
28942
|
+
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
28943
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
28944
|
+
var _targetElement$datase;
|
|
28945
|
+
var targetElement = placeholder.nextElementSibling;
|
|
28946
|
+
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
28947
|
+
targetElement.style.display = targetElement.dataset.originalDisplay;
|
|
28948
|
+
delete targetElement.dataset.originalDisplay;
|
|
28949
|
+
}
|
|
28950
|
+
placeholder.remove();
|
|
28951
|
+
});
|
|
28952
|
+
};
|
|
28930
28953
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
28931
28954
|
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
28932
28955
|
elements.forEach(function (element) {
|
|
@@ -28940,6 +28963,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28940
28963
|
};
|
|
28941
28964
|
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
28942
28965
|
executeOn = executeOn || document.body;
|
|
28966
|
+
if (!(executeOn instanceof HTMLElement)) return;
|
|
28943
28967
|
fixMathElements(executeOn);
|
|
28944
28968
|
adjustMathMLStyle(executeOn);
|
|
28945
28969
|
var mathJaxInstance = getGlobal().instance;
|
|
@@ -28948,6 +28972,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28948
28972
|
mathJaxInstance.typesetClear();
|
|
28949
28973
|
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
28950
28974
|
try {
|
|
28975
|
+
removePlaceholdersAndRestoreDisplay();
|
|
28951
28976
|
removeExcessMjxContainers(executeOn);
|
|
28952
28977
|
var updatedDocument = mathJaxInstance.startup.document;
|
|
28953
28978
|
var list = updatedDocument.math.list;
|
|
@@ -29034,6 +29059,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
29034
29059
|
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
29035
29060
|
script.async = true;
|
|
29036
29061
|
document.head.appendChild(script);
|
|
29062
|
+
setTimeout(function () {
|
|
29063
|
+
if (!window.mathjaxLoadedComplete) {
|
|
29064
|
+
var _document, _document$body;
|
|
29065
|
+
var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
|
|
29066
|
+
(mathElements || []).forEach(createPlaceholder);
|
|
29067
|
+
}
|
|
29068
|
+
});
|
|
29037
29069
|
});
|
|
29038
29070
|
};
|
|
29039
29071
|
exports.initializeMathJax = initializeMathJax;
|
package/module/manifest.json
CHANGED
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.0.
|
|
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.
|
|
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.6/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.5/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;
|
|
@@ -28890,6 +28890,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28890
28890
|
return node.setAttribute("displaystyle", "true");
|
|
28891
28891
|
});
|
|
28892
28892
|
};
|
|
28893
|
+
var createPlaceholder = function createPlaceholder(element) {
|
|
28894
|
+
var _element$previousSibl;
|
|
28895
|
+
if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
|
|
28896
|
+
var _element$parentNode;
|
|
28897
|
+
element.dataset.originalDisplay = element.style.display || "";
|
|
28898
|
+
element.style.display = "none";
|
|
28899
|
+
var placeholder = document.createElement("span");
|
|
28900
|
+
placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
|
|
28901
|
+
placeholder.classList.add("math-placeholder");
|
|
28902
|
+
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
|
|
28903
|
+
}
|
|
28904
|
+
};
|
|
28905
|
+
var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
|
|
28906
|
+
document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
|
|
28907
|
+
var _targetElement$datase;
|
|
28908
|
+
var targetElement = placeholder.nextElementSibling;
|
|
28909
|
+
if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
|
|
28910
|
+
targetElement.style.display = targetElement.dataset.originalDisplay;
|
|
28911
|
+
delete targetElement.dataset.originalDisplay;
|
|
28912
|
+
}
|
|
28913
|
+
placeholder.remove();
|
|
28914
|
+
});
|
|
28915
|
+
};
|
|
28893
28916
|
var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
|
|
28894
28917
|
var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
|
|
28895
28918
|
elements.forEach(function (element) {
|
|
@@ -28903,6 +28926,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28903
28926
|
};
|
|
28904
28927
|
var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
|
|
28905
28928
|
executeOn = executeOn || document.body;
|
|
28929
|
+
if (!(executeOn instanceof HTMLElement)) return;
|
|
28906
28930
|
fixMathElements(executeOn);
|
|
28907
28931
|
adjustMathMLStyle(executeOn);
|
|
28908
28932
|
var mathJaxInstance = getGlobal().instance;
|
|
@@ -28911,6 +28935,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28911
28935
|
mathJaxInstance.typesetClear();
|
|
28912
28936
|
mathJaxInstance.typesetPromise([executeOn]).then(function () {
|
|
28913
28937
|
try {
|
|
28938
|
+
removePlaceholdersAndRestoreDisplay();
|
|
28914
28939
|
removeExcessMjxContainers(executeOn);
|
|
28915
28940
|
var updatedDocument = mathJaxInstance.startup.document;
|
|
28916
28941
|
var list = updatedDocument.math.list;
|
|
@@ -28997,6 +29022,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
|
|
|
28997
29022
|
script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
|
|
28998
29023
|
script.async = true;
|
|
28999
29024
|
document.head.appendChild(script);
|
|
29025
|
+
setTimeout(function () {
|
|
29026
|
+
if (!window.mathjaxLoadedComplete) {
|
|
29027
|
+
var _document, _document$body;
|
|
29028
|
+
var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
|
|
29029
|
+
(mathElements || []).forEach(createPlaceholder);
|
|
29030
|
+
}
|
|
29031
|
+
});
|
|
29000
29032
|
});
|
|
29001
29033
|
};
|
|
29002
29034
|
exports.initializeMathJax = initializeMathJax;
|
package/package.json
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "3.0.1-next.
|
|
7
|
+
"version": "3.0.1-next.5+c363be48f",
|
|
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": "2.0.
|
|
12
|
+
"@pie-lib/pie-toolbox": "2.0.8",
|
|
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": "c363be48f9428024d4acc1eed05cd598840ffe3a",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"postpublish": "../../scripts/postpublish"
|
|
22
22
|
},
|