@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/index.esm.js
CHANGED
@@ -3660,6 +3660,12 @@ const disableRules = [
|
|
3660
3660
|
'html_block',
|
3661
3661
|
];
|
3662
3662
|
|
3663
|
+
const decodeHTML = (html) => {
|
3664
|
+
const textArea = document.createElement('textarea');
|
3665
|
+
textArea.innerHTML = html;
|
3666
|
+
return textArea.value;
|
3667
|
+
};
|
3668
|
+
|
3663
3669
|
/* eslint-disable no-param-reassign */
|
3664
3670
|
|
3665
3671
|
const componentName$C = getComponentName('enriched-text');
|
@@ -3788,7 +3794,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3788
3794
|
}
|
3789
3795
|
|
3790
3796
|
#initProcessor() {
|
3791
|
-
this.processor = new MarkdownIt();
|
3797
|
+
this.processor = new MarkdownIt('commonmark', { html: true });
|
3792
3798
|
this.#storeOrigRenderers();
|
3793
3799
|
this.#updateProcessorRules();
|
3794
3800
|
this.#customizeLinkRenderer();
|
@@ -3808,11 +3814,11 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3808
3814
|
return;
|
3809
3815
|
}
|
3810
3816
|
|
3811
|
-
let html = this.
|
3817
|
+
let html = decodeHTML(this.innerHTML);
|
3812
3818
|
|
3813
3819
|
try {
|
3814
3820
|
const tokens = this.processor.parse(html, { references: undefined });
|
3815
|
-
html = this.processor.renderer.render(tokens, { breaks: true });
|
3821
|
+
html = this.processor.renderer.render(tokens, { html: true, breaks: true });
|
3816
3822
|
} catch (e) {
|
3817
3823
|
// eslint-disable-next-line no-console
|
3818
3824
|
console.warn('Not parsing invalid markdown token');
|
@@ -3838,7 +3844,10 @@ const EnrichedTextClass = compose(
|
|
3838
3844
|
fontSize: {},
|
3839
3845
|
fontFamily: {},
|
3840
3846
|
fontWeight: {},
|
3841
|
-
fontWeightBold:
|
3847
|
+
fontWeightBold: [
|
3848
|
+
{ selector: () => ':host strong', property: 'font-weight' },
|
3849
|
+
{ selector: () => ':host b', property: 'font-weight' },
|
3850
|
+
],
|
3842
3851
|
textColor: { property: 'color' },
|
3843
3852
|
textLineHeight: { property: 'line-height' },
|
3844
3853
|
textAlign: {},
|