@brightspace-ui/core 2.10.2 → 2.10.5
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
|
}
|
|
@@ -78,25 +78,23 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
78
78
|
import '@brightspace-ui/core/components/icons/icon.js';
|
|
79
79
|
</script>
|
|
80
80
|
<d2l-html-block>
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
<mn>3</mn>
|
|
85
|
-
<mi>x</mi>
|
|
86
|
-
<mo>−</mo>
|
|
87
|
-
<mn>1</mn>
|
|
88
|
-
</msqrt>
|
|
89
|
-
<mo>+</mo>
|
|
90
|
-
<mo stretchy="false">(</mo>
|
|
91
|
-
<mn>1</mn>
|
|
92
|
-
<mo>+</mo>
|
|
81
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
|
82
|
+
<msqrt>
|
|
83
|
+
<mn>3</mn>
|
|
93
84
|
<mi>x</mi>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</
|
|
99
|
-
|
|
85
|
+
<mo>−</mo>
|
|
86
|
+
<mn>1</mn>
|
|
87
|
+
</msqrt>
|
|
88
|
+
<mo>+</mo>
|
|
89
|
+
<mo stretchy="false">(</mo>
|
|
90
|
+
<mn>1</mn>
|
|
91
|
+
<mo>+</mo>
|
|
92
|
+
<mi>x</mi>
|
|
93
|
+
<msup>
|
|
94
|
+
<mo stretchy="false">)</mo>
|
|
95
|
+
<mn>2</mn>
|
|
96
|
+
</msup>
|
|
97
|
+
</math>
|
|
100
98
|
</d2l-html-block>
|
|
101
99
|
```
|
|
102
100
|
|
|
@@ -109,9 +107,7 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
109
107
|
import '@brightspace-ui/core/tools/mathjax-test-context.js';
|
|
110
108
|
</script>
|
|
111
109
|
<d2l-html-block>
|
|
112
|
-
<div class="latex-container">
|
|
113
110
|
$$ f(x) = \int \mathrm{e}^{-x}\,\mathrm{d}x $$ $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$
|
|
114
|
-
</div>
|
|
115
111
|
</d2l-html-block>
|
|
116
112
|
```
|
|
117
113
|
|
|
@@ -142,6 +142,18 @@
|
|
|
142
142
|
</mfrac>
|
|
143
143
|
</mrow>
|
|
144
144
|
<mtext>.</mtext>
|
|
145
|
+
<mspace linebreak="newline"></mspace>
|
|
146
|
+
<msup>
|
|
147
|
+
<mi>e</mi>
|
|
148
|
+
<mrow>
|
|
149
|
+
<mi>i</mi>
|
|
150
|
+
<mi>π<!-- π --></mi>
|
|
151
|
+
</mrow>
|
|
152
|
+
</msup>
|
|
153
|
+
<mo>+</mo>
|
|
154
|
+
<mn>1</mn>
|
|
155
|
+
<mo>=</mo>
|
|
156
|
+
<mn>0</mn>
|
|
145
157
|
</math>
|
|
146
158
|
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
|
|
147
159
|
<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
|
@@ -3480,6 +3480,12 @@
|
|
|
3480
3480
|
"type": "Boolean",
|
|
3481
3481
|
"default": "false"
|
|
3482
3482
|
},
|
|
3483
|
+
{
|
|
3484
|
+
"name": "inline",
|
|
3485
|
+
"description": "Whether to display the HTML in inline mode",
|
|
3486
|
+
"type": "boolean",
|
|
3487
|
+
"default": "false"
|
|
3488
|
+
},
|
|
3483
3489
|
{
|
|
3484
3490
|
"name": "no-deferred-rendering",
|
|
3485
3491
|
"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.",
|
|
@@ -3495,6 +3501,13 @@
|
|
|
3495
3501
|
"type": "Boolean",
|
|
3496
3502
|
"default": "false"
|
|
3497
3503
|
},
|
|
3504
|
+
{
|
|
3505
|
+
"name": "inline",
|
|
3506
|
+
"attribute": "inline",
|
|
3507
|
+
"description": "Whether to display the HTML in inline mode",
|
|
3508
|
+
"type": "boolean",
|
|
3509
|
+
"default": "false"
|
|
3510
|
+
},
|
|
3498
3511
|
{
|
|
3499
3512
|
"name": "noDeferredRendering",
|
|
3500
3513
|
"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": "2.10.
|
|
3
|
+
"version": "2.10.5",
|
|
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",
|