@descope/web-components-ui 1.0.346 → 1.0.347
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +13 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-enriched-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-enriched-text/EnrichedTextClass.js +8 -4
- package/src/components/descope-enriched-text/helpers.js +5 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -4984,6 +4984,12 @@ const disableRules = [
|
|
4984
4984
|
'html_block',
|
4985
4985
|
];
|
4986
4986
|
|
4987
|
+
const decodeHTML = (html) => {
|
4988
|
+
const textArea = document.createElement('textarea');
|
4989
|
+
textArea.innerHTML = html;
|
4990
|
+
return textArea.value;
|
4991
|
+
};
|
4992
|
+
|
4987
4993
|
/* eslint-disable no-param-reassign */
|
4988
4994
|
|
4989
4995
|
const componentName$C = getComponentName('enriched-text');
|
@@ -5112,7 +5118,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5112
5118
|
}
|
5113
5119
|
|
5114
5120
|
#initProcessor() {
|
5115
|
-
this.processor = new MarkdownIt();
|
5121
|
+
this.processor = new MarkdownIt('commonmark', { html: true });
|
5116
5122
|
this.#storeOrigRenderers();
|
5117
5123
|
this.#updateProcessorRules();
|
5118
5124
|
this.#customizeLinkRenderer();
|
@@ -5132,11 +5138,11 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5132
5138
|
return;
|
5133
5139
|
}
|
5134
5140
|
|
5135
|
-
let html = this.
|
5141
|
+
let html = decodeHTML(this.innerHTML);
|
5136
5142
|
|
5137
5143
|
try {
|
5138
5144
|
const tokens = this.processor.parse(html, { references: undefined });
|
5139
|
-
html = this.processor.renderer.render(tokens, { breaks: true });
|
5145
|
+
html = this.processor.renderer.render(tokens, { html: true, breaks: true });
|
5140
5146
|
} catch (e) {
|
5141
5147
|
// eslint-disable-next-line no-console
|
5142
5148
|
console.warn('Not parsing invalid markdown token');
|
@@ -5162,7 +5168,10 @@ const EnrichedTextClass = compose(
|
|
5162
5168
|
fontSize: {},
|
5163
5169
|
fontFamily: {},
|
5164
5170
|
fontWeight: {},
|
5165
|
-
fontWeightBold:
|
5171
|
+
fontWeightBold: [
|
5172
|
+
{ selector: () => ':host strong', property: 'font-weight' },
|
5173
|
+
{ selector: () => ':host b', property: 'font-weight' },
|
5174
|
+
],
|
5166
5175
|
textColor: { property: 'color' },
|
5167
5176
|
textLineHeight: { property: 'line-height' },
|
5168
5177
|
textAlign: {},
|