@brightspace-ui/core 1.242.4 → 1.242.7
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/components/dialog/dialog-mixin.js +2 -1
- package/components/html-block/README.md +16 -20
- package/components/html-block/demo/html-block.html +12 -0
- package/components/html-block/html-block.js +10 -3
- package/custom-elements.json +13 -0
- package/helpers/mathjax.js +8 -1
- package/package.json +1 -1
|
@@ -14,7 +14,8 @@ import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.j
|
|
|
14
14
|
window.D2L = window.D2L || {};
|
|
15
15
|
window.D2L.DialogMixin = window.D2L.DialogMixin || {};
|
|
16
16
|
|
|
17
|
-
window.D2L.DialogMixin.hasNative = (window.HTMLDialogElement !== undefined)
|
|
17
|
+
window.D2L.DialogMixin.hasNative = (window.HTMLDialogElement !== undefined)
|
|
18
|
+
&& (navigator.vendor && navigator.vendor.toLowerCase().indexOf('apple') === -1);
|
|
18
19
|
if (window.D2L.DialogMixin.preferNative === undefined) {
|
|
19
20
|
window.D2L.DialogMixin.preferNative = true;
|
|
20
21
|
}
|
|
@@ -77,25 +77,23 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
77
77
|
import '@brightspace-ui/core/components/icons/icon.js';
|
|
78
78
|
</script>
|
|
79
79
|
<d2l-html-block>
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
<mn>3</mn>
|
|
84
|
-
<mi>x</mi>
|
|
85
|
-
<mo>−</mo>
|
|
86
|
-
<mn>1</mn>
|
|
87
|
-
</msqrt>
|
|
88
|
-
<mo>+</mo>
|
|
89
|
-
<mo stretchy="false">(</mo>
|
|
90
|
-
<mn>1</mn>
|
|
91
|
-
<mo>+</mo>
|
|
80
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
|
81
|
+
<msqrt>
|
|
82
|
+
<mn>3</mn>
|
|
92
83
|
<mi>x</mi>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</
|
|
98
|
-
|
|
84
|
+
<mo>−</mo>
|
|
85
|
+
<mn>1</mn>
|
|
86
|
+
</msqrt>
|
|
87
|
+
<mo>+</mo>
|
|
88
|
+
<mo stretchy="false">(</mo>
|
|
89
|
+
<mn>1</mn>
|
|
90
|
+
<mo>+</mo>
|
|
91
|
+
<mi>x</mi>
|
|
92
|
+
<msup>
|
|
93
|
+
<mo stretchy="false">)</mo>
|
|
94
|
+
<mn>2</mn>
|
|
95
|
+
</msup>
|
|
96
|
+
</math>
|
|
99
97
|
</d2l-html-block>
|
|
100
98
|
```
|
|
101
99
|
|
|
@@ -120,8 +118,6 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
120
118
|
document.getElementsByTagName('html')[0].dataset.mathjaxContext = JSON.stringify({ renderLatex: true });<!-- docs: end hidden content -->
|
|
121
119
|
</script>
|
|
122
120
|
<d2l-html-block>
|
|
123
|
-
<div class="latex-container">
|
|
124
121
|
$$ f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x $$ $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$
|
|
125
|
-
</div>
|
|
126
122
|
</d2l-html-block>
|
|
127
123
|
```
|
|
@@ -141,6 +141,18 @@
|
|
|
141
141
|
</mfrac>
|
|
142
142
|
</mrow>
|
|
143
143
|
<mtext>.</mtext>
|
|
144
|
+
<mspace linebreak="newline"></mspace>
|
|
145
|
+
<msup>
|
|
146
|
+
<mi>e</mi>
|
|
147
|
+
<mrow>
|
|
148
|
+
<mi>i</mi>
|
|
149
|
+
<mi>π<!-- π --></mi>
|
|
150
|
+
</mrow>
|
|
151
|
+
</msup>
|
|
152
|
+
<mo>+</mo>
|
|
153
|
+
<mn>1</mn>
|
|
154
|
+
<mo>=</mo>
|
|
155
|
+
<mn>0</mn>
|
|
144
156
|
</math>
|
|
145
157
|
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
|
|
146
158
|
<msup>
|
|
@@ -130,6 +130,10 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
130
130
|
* @type {Boolean}
|
|
131
131
|
*/
|
|
132
132
|
compact: { type: Boolean },
|
|
133
|
+
/**
|
|
134
|
+
* Whether to display the HTML in inline mode
|
|
135
|
+
*/
|
|
136
|
+
inline: { type: Boolean },
|
|
133
137
|
/**
|
|
134
138
|
* Whether to disable deferred rendering of the user-authored HTML. Do *not* set this
|
|
135
139
|
* unless your HTML relies on script executions that may break upon stamping.
|
|
@@ -149,18 +153,21 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
149
153
|
position: relative;
|
|
150
154
|
text-align: left;
|
|
151
155
|
}
|
|
152
|
-
:host([hidden])
|
|
153
|
-
display: none;
|
|
154
|
-
}
|
|
156
|
+
:host([hidden]),
|
|
155
157
|
:host([no-deferred-rendering]) div.d2l-html-block-rendered {
|
|
156
158
|
display: none;
|
|
157
159
|
}
|
|
160
|
+
:host([inline]),
|
|
161
|
+
:host([inline]) div.d2l-html-block-rendered {
|
|
162
|
+
display: inline;
|
|
163
|
+
}
|
|
158
164
|
`];
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
constructor() {
|
|
162
168
|
super();
|
|
163
169
|
this.compact = false;
|
|
170
|
+
this.inline = false;
|
|
164
171
|
this.noDeferredRendering = false;
|
|
165
172
|
|
|
166
173
|
const rendererContextAttributes = getRenderers().reduce((attrs, currentRenderer) => {
|
package/custom-elements.json
CHANGED
|
@@ -3467,6 +3467,12 @@
|
|
|
3467
3467
|
"type": "Boolean",
|
|
3468
3468
|
"default": "false"
|
|
3469
3469
|
},
|
|
3470
|
+
{
|
|
3471
|
+
"name": "inline",
|
|
3472
|
+
"description": "Whether to display the HTML in inline mode",
|
|
3473
|
+
"type": "boolean",
|
|
3474
|
+
"default": "false"
|
|
3475
|
+
},
|
|
3470
3476
|
{
|
|
3471
3477
|
"name": "no-deferred-rendering",
|
|
3472
3478
|
"description": "Whether to disable deferred rendering of the user-authored HTML. Do *not* set this\nunless your HTML relies on script executions that may break upon stamping.",
|
|
@@ -3482,6 +3488,13 @@
|
|
|
3482
3488
|
"type": "Boolean",
|
|
3483
3489
|
"default": "false"
|
|
3484
3490
|
},
|
|
3491
|
+
{
|
|
3492
|
+
"name": "inline",
|
|
3493
|
+
"attribute": "inline",
|
|
3494
|
+
"description": "Whether to display the HTML in inline mode",
|
|
3495
|
+
"type": "boolean",
|
|
3496
|
+
"default": "false"
|
|
3497
|
+
},
|
|
3485
3498
|
{
|
|
3486
3499
|
"name": "noDeferredRendering",
|
|
3487
3500
|
"attribute": "no-deferred-rendering",
|
package/helpers/mathjax.js
CHANGED
|
@@ -64,14 +64,21 @@ export class HtmlBlockMathRenderer {
|
|
|
64
64
|
return elem;
|
|
65
65
|
}
|
|
66
66
|
|
|
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;">');
|
|
72
|
+
|
|
67
73
|
const temp = document.createElement('div');
|
|
68
74
|
temp.style.display = 'none';
|
|
69
75
|
temp.attachShadow({ mode: 'open' });
|
|
70
|
-
temp.shadowRoot.innerHTML = `<div><mjx-doc><mjx-head></mjx-head><mjx-body>${
|
|
76
|
+
temp.shadowRoot.innerHTML = `<div><mjx-doc><mjx-head></mjx-head><mjx-body>${inner}</mjx-body></mjx-doc></div>`;
|
|
71
77
|
|
|
72
78
|
elem.appendChild(temp);
|
|
73
79
|
await window.MathJax.startup.promise;
|
|
74
80
|
window.MathJax.typesetShadow(temp.shadowRoot);
|
|
81
|
+
|
|
75
82
|
return temp.shadowRoot.firstChild;
|
|
76
83
|
}
|
|
77
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.242.
|
|
3
|
+
"version": "1.242.7",
|
|
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",
|