@brightspace-ui/core 2.35.3 → 2.36.0

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.
Files changed (2) hide show
  1. package/helpers/mathjax.js +12 -12
  2. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  const mathjaxContextAttribute = 'data-mathjax-context';
7
- const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.1.2';
7
+ const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.2.2';
8
8
 
9
9
  const mathjaxFontMappings = new Map([
10
10
  ['MJXTEX', 'MathJax_Main-Regular'],
@@ -31,6 +31,7 @@ const mathjaxFontMappings = new Map([
31
31
  ]);
32
32
 
33
33
  let mathJaxLoaded;
34
+ let renderingPromise = Promise.resolve();
34
35
 
35
36
  export class HtmlBlockMathRenderer {
36
37
 
@@ -70,7 +71,8 @@ export class HtmlBlockMathRenderer {
70
71
  });
71
72
 
72
73
  await window.MathJax.startup.promise;
73
- window.MathJax.typesetShadow(elem.getRootNode(), elem);
74
+ renderingPromise = renderingPromise.then(() => window.MathJax.typesetShadow(elem.getRootNode(), elem));
75
+ await renderingPromise;
74
76
  return elem;
75
77
  }
76
78
 
@@ -82,8 +84,10 @@ export class HtmlBlockMathRenderer {
82
84
  temp.shadowRoot.innerHTML = `<div><mjx-doc><mjx-head></mjx-head><mjx-body>${inner}</mjx-body></mjx-doc></div>`;
83
85
 
84
86
  elem.appendChild(temp);
87
+
85
88
  await window.MathJax.startup.promise;
86
- window.MathJax.typesetShadow(temp.shadowRoot);
89
+ renderingPromise = renderingPromise.then(() => window.MathJax.typesetShadow(temp.shadowRoot));
90
+ await renderingPromise;
87
91
 
88
92
  return temp.shadowRoot.firstChild;
89
93
  }
@@ -94,13 +98,9 @@ export function loadMathJax(mathJaxConfig) {
94
98
 
95
99
  if (mathJaxLoaded) return mathJaxLoaded;
96
100
 
97
- const loadOptions = ['ui/menu'];
98
- if (mathJaxConfig && mathJaxConfig.renderLatex) {
99
- loadOptions.push('[tex]/all-packages');
100
- }
101
-
102
101
  window.MathJax = {
103
102
  chtml: {
103
+ adaptiveCSS: false,
104
104
  scale: (mathJaxConfig && mathJaxConfig.outputScale) || 1
105
105
  },
106
106
  options: {
@@ -108,7 +108,7 @@ export function loadMathJax(mathJaxConfig) {
108
108
  settings: { zoom: 'None' }
109
109
  }
110
110
  },
111
- loader: { load: loadOptions },
111
+ loader: { load: ['ui/menu'] },
112
112
  startup: {
113
113
  ready: () => {
114
114
 
@@ -188,15 +188,15 @@ export function loadMathJax(mathJaxConfig) {
188
188
  // renders the document. The MathDocument is returned in case
189
189
  // you need to rerender the shadowRoot later.
190
190
  //
191
- window.MathJax.typesetShadow = function(root, elem) {
191
+ window.MathJax.typesetShadow = async function(root, elem) {
192
192
  const InputJax = startup.getInputJax();
193
193
  const OutputJax = startup.getOutputJax();
194
194
  const html = mathjax.document(root, { InputJax, OutputJax });
195
195
 
196
196
  if (elem) html.options.elements = [elem];
197
197
 
198
- html.render().typeset();
199
- return html;
198
+ await mathjax.handleRetriesFor(() => html.render());
199
+ html.typeset();
200
200
  };
201
201
 
202
202
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.35.3",
3
+ "version": "2.36.0",
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",