@brightspace-ui/core 2.15.3 → 2.15.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.
Files changed (2) hide show
  1. package/helpers/mathjax.js +10 -5
  2. package/package.json +1 -1
@@ -56,19 +56,24 @@ export class HtmlBlockMathRenderer {
56
56
 
57
57
  await loadMathJax(mathJaxConfig);
58
58
 
59
+ // MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
60
+ // This work-around should be removed when linebreaks are natively supported.
61
+ // MathJax issue: https://github.com/mathjax/MathJax/issues/2312
62
+ // A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
63
+ const lineBreakStyle = 'display: block; height: 0.5rem;';
64
+
59
65
  // If we're opting out of deferred rendering, we need to rely
60
66
  // on the global MathJax install for rendering.
61
67
  if (options.noDeferredRendering) {
68
+ elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
69
+ elm.setAttribute('style', lineBreakStyle);
70
+ });
62
71
  await window.MathJax.startup.promise;
63
72
  window.MathJax.typeset([elem]);
64
73
  return elem;
65
74
  }
66
75
 
67
- // MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
68
- // This work-around should be removed when linebreaks are natively supported.
69
- // MathJax issue: https://github.com/mathjax/MathJax/issues/2312
70
- // A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
71
- const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', '<mspace linebreak="newline" style="display: block; height: 0.5rem;">');
76
+ const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', `<mspace linebreak="newline" style="${lineBreakStyle}">`);
72
77
 
73
78
  const temp = document.createElement('div');
74
79
  temp.style.display = 'none';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.15.3",
3
+ "version": "2.15.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",