@brightspace-ui/core 3.2.0 → 3.2.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.
@@ -78,7 +78,7 @@
78
78
  <li>ordered item 1</li>
79
79
  <li>ordered item 2</li>
80
80
  </ol>
81
- <div><a href="https://d2l.com">anchor</a></div>">
81
+ <div><a href="https://d2l.com">anchor</a></div>">
82
82
  </d2l-html-block>
83
83
  </template>
84
84
  </d2l-demo-snippet>
@@ -494,7 +494,7 @@
494
494
  &lt;/mrow&gt;
495
495
  &lt;mo&gt;)&lt;/mo&gt;
496
496
  &lt;/mrow&gt;
497
- &lt;/math&gt; and other symbols.">
497
+ &lt;/math&gt; and other symbols.">
498
498
  </d2l-html-block>
499
499
  </template>
500
500
  </d2l-demo-snippet>
@@ -504,7 +504,7 @@
504
504
  <d2l-demo-snippet>
505
505
  <template>
506
506
  <d2l-html-block html="&lt;div&gt;$$ f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x $$ $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$&lt;/div&gt;
507
- &lt;div&gt;$$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$&lt;/div&gt;">
507
+ &lt;div&gt;$$ {\color{red}x} + {\color{blue}y} = {\color{green}z} $$&lt;/div&gt;">
508
508
  </d2l-html-block>
509
509
  </template>
510
510
  </d2l-demo-snippet>
@@ -231,12 +231,19 @@ class HtmlBlock extends LitElement {
231
231
  'd2l-html-block-compact': this.compact
232
232
  };
233
233
 
234
- return html`
235
- <div class="${classMap(renderContainerClasses)}">
236
- ${(this._embedsFeatureEnabled() && !this.noDeferredRendering) ? until(this._processEmbeds(), nothing) : nothing}
237
- </div>
238
- ${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
239
- `;
234
+ if (this._embedsFeatureEnabled()) {
235
+ return html`
236
+ <div class="${classMap(renderContainerClasses)}">
237
+ ${!this.noDeferredRendering ? until(this._processEmbeds(), nothing) : nothing}
238
+ </div>
239
+ ${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
240
+ `;
241
+ } else {
242
+ return html`
243
+ <div class="${classMap(renderContainerClasses)}"></div>
244
+ ${this.noDeferredRendering ? html`<slot @slotchange="${this._handleSlotChange}"></slot>` : ''}
245
+ `;
246
+ }
240
247
  }
241
248
 
242
249
  async updated(changedProperties) {
@@ -64,6 +64,24 @@ class HtmlBlockMathRenderer {
64
64
  elm.style.height = '0.5rem';
65
65
  });
66
66
 
67
+ if (context.enableMML3Support) {
68
+ // There's a bug in the experimental MML3 plugin that causes mi and mo elements containing non-breaking
69
+ // spaces to break MathJax's math processing (e.g. <mo>&nbsp;</mo>, <mi>Some&nbsp;Identifier</mi>).
70
+ // Unfortunately, WIRIS tends to add a lot of these in chemistry equations, so they break math processing.
71
+ //
72
+ // In order to address this, we can just remove any non-breaking spaces entirely, replacing them with
73
+ // empty strings. MathJax will ignore any empty elements as a result, and while this may mean intended
74
+ // whitespace is occasionally removed, it's necessary for MathJax to render anything at all.
75
+ //
76
+ // NOTE: MathJax evidently has a fix for this in MathJax 4, so we should consider trying to remove this when
77
+ // the update comes out of beta and we decide to take it on.
78
+ //
79
+ // See https://github.com/mathjax/MathJax/issues/3030 for some related discussion.
80
+ elem.querySelectorAll('mo, mi').forEach(elm => {
81
+ elm.innerHTML = elm.innerHTML.replace(/&nbsp;/g, '');
82
+ });
83
+ }
84
+
67
85
  // If we're using deferred rendering, we need to create a document structure
68
86
  // within the element so MathJax can appropriately process math.
69
87
  if (!options.noDeferredRendering) elem.innerHTML = `<mjx-doc><mjx-head></mjx-head><mjx-body>${elem.innerHTML}</mjx-body></mjx-doc>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
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",