@brightspace-ui/core 1.230.3 → 1.230.4
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/helpers/mathjax.js +48 -1
- package/package.json +1 -1
package/helpers/mathjax.js
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
|
+
/* When updating MathJax, update mathjaxBaseUrl to use the new version
|
|
2
|
+
* and verify that the font mappings included in mathjaxFontMappings
|
|
3
|
+
* match what's present in the MathJax-src repo.
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
const mathjaxContextAttribute = 'data-mathjax-context';
|
|
7
|
+
const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.1.2';
|
|
8
|
+
|
|
9
|
+
const mathjaxFontMappings = new Map([
|
|
10
|
+
['MJXTEX', 'MathJax_Main-Regular'],
|
|
11
|
+
['MJXTEX-B', 'MathJax_Main-Bold'],
|
|
12
|
+
['MJXTEX-I', 'MathJax_Math-Italic'],
|
|
13
|
+
['MJXTEX-MI', 'MathJax_Main-Italic'],
|
|
14
|
+
['MJXTEX-BI', 'MathJax_Math-BoldItalic'],
|
|
15
|
+
['MJXTEX-S1', 'MathJax_Size1-Regular'],
|
|
16
|
+
['MJXTEX-S2', 'MathJax_Size2-Regular'],
|
|
17
|
+
['MJXTEX-S3', 'MathJax_Size3-Regular'],
|
|
18
|
+
['MJXTEX-S4', 'MathJax_Size4-Regular'],
|
|
19
|
+
['MJXTEX-A', 'MathJax_AMS-Regular'],
|
|
20
|
+
['MJXTEX-C', 'MathJax_Calligraphic-Regular'],
|
|
21
|
+
['MJXTEX-CB', 'MathJax_Calligraphic-Bold'],
|
|
22
|
+
['MJXTEX-FR', 'MathJax_Fraktur-Regular'],
|
|
23
|
+
['MJXTEX-FRB', 'MathJax_Fraktur-Bold'],
|
|
24
|
+
['MJXTEX-SS', 'MathJax_SansSerif-Regular'],
|
|
25
|
+
['MJXTEX-SSB', 'MathJax_SansSerif-Bold'],
|
|
26
|
+
['MJXTEX-SSI', 'MathJax_SansSerif-Italic'],
|
|
27
|
+
['MJXTEX-SC', 'MathJax_Script-Regular'],
|
|
28
|
+
['MJXTEX-T', 'MathJax_Typewriter-Regular'],
|
|
29
|
+
['MJXTEX-V', 'MathJax_Vector-Regular'],
|
|
30
|
+
['MJXTEX-VB', 'MathJax_Vector-Bold']
|
|
31
|
+
]);
|
|
2
32
|
|
|
3
33
|
let mathJaxLoaded;
|
|
4
34
|
|
|
@@ -158,6 +188,23 @@ export function loadMathJax(mathJaxConfig) {
|
|
|
158
188
|
}
|
|
159
189
|
};
|
|
160
190
|
|
|
191
|
+
if (mathJaxConfig && mathJaxConfig.deferTypeset && !document.head.querySelector('#d2l-mathjax-fonts') && !document.head.querySelector('#MJX-CHTML-styles')) {
|
|
192
|
+
const styleElem = document.createElement('style');
|
|
193
|
+
styleElem.id = 'd2l-mathjax-fonts';
|
|
194
|
+
|
|
195
|
+
let fontImportStyles = '';
|
|
196
|
+
mathjaxFontMappings.forEach((font, family) => {
|
|
197
|
+
fontImportStyles +=
|
|
198
|
+
`\n@font-face {
|
|
199
|
+
font-family: ${family};
|
|
200
|
+
src: url("${mathjaxBaseUrl}/output/chtml/fonts/woff-v2/${font}.woff") format("woff");
|
|
201
|
+
}`;
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
styleElem.textContent = fontImportStyles;
|
|
205
|
+
document.head.appendChild(styleElem);
|
|
206
|
+
}
|
|
207
|
+
|
|
161
208
|
mathJaxLoaded = new Promise(resolve => {
|
|
162
209
|
const script = document.createElement('script');
|
|
163
210
|
script.async = 'async';
|
|
@@ -167,7 +214,7 @@ export function loadMathJax(mathJaxConfig) {
|
|
|
167
214
|
? 'tex-mml-chtml'
|
|
168
215
|
: 'mml-chtml';
|
|
169
216
|
|
|
170
|
-
script.src =
|
|
217
|
+
script.src = `${mathjaxBaseUrl}/${component}.js`;
|
|
171
218
|
document.head.appendChild(script);
|
|
172
219
|
});
|
|
173
220
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.230.
|
|
3
|
+
"version": "1.230.4",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|