@descope/web-components-ui 1.0.305 → 1.0.306
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/dist/cjs/index.cjs.js +31 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +31 -6
- 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/package.json +1 -1
- package/src/components/descope-enriched-text/EnrichedTextClass.js +31 -6
package/dist/index.esm.js
CHANGED
@@ -3348,7 +3348,7 @@ const textRuleSet = {
|
|
3348
3348
|
const componentName$z = getComponentName('enriched-text');
|
3349
3349
|
|
3350
3350
|
let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName: componentName$z, baseSelector: ':host > div' }) {
|
3351
|
-
#
|
3351
|
+
#origLinkRenderer;
|
3352
3352
|
|
3353
3353
|
constructor() {
|
3354
3354
|
super();
|
@@ -3397,7 +3397,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3397
3397
|
}
|
3398
3398
|
|
3399
3399
|
static get observedAttributes() {
|
3400
|
-
return ['readonly'];
|
3400
|
+
return ['readonly', 'link-target-blank'];
|
3401
3401
|
}
|
3402
3402
|
|
3403
3403
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
@@ -3407,6 +3407,23 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3407
3407
|
if (attrName === 'readonly') {
|
3408
3408
|
this.onReadOnlyChange(newValue === 'true');
|
3409
3409
|
}
|
3410
|
+
|
3411
|
+
if (attrName === 'link-target-blank') {
|
3412
|
+
this.#initProcessor();
|
3413
|
+
}
|
3414
|
+
}
|
3415
|
+
}
|
3416
|
+
|
3417
|
+
#customizeLinkRenderer() {
|
3418
|
+
if (this.linkTargetBlank) {
|
3419
|
+
this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
3420
|
+
// Add a new `target` attribute, or replace the value of the existing one.
|
3421
|
+
tokens[idx].attrSet('target', '_blank');
|
3422
|
+
// Pass the token to the default renderer.
|
3423
|
+
return this.#origLinkRenderer(tokens, idx, options, env, self);
|
3424
|
+
};
|
3425
|
+
} else {
|
3426
|
+
this.processor.renderer.rules.link_open = this.#origLinkRenderer;
|
3410
3427
|
}
|
3411
3428
|
}
|
3412
3429
|
|
@@ -3417,19 +3434,27 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3417
3434
|
|
3418
3435
|
const customRuleSet = textRuleSet;
|
3419
3436
|
this.processor.configure(customRuleSet || {});
|
3420
|
-
|
3421
|
-
if (customRuleSet?.custom?.includes('image')) {
|
3422
|
-
this.processor.renderer.rules.image = this.#origImageRenderer;
|
3423
|
-
}
|
3424
3437
|
}
|
3425
3438
|
|
3426
3439
|
#updateProcessorRules() {
|
3427
3440
|
this.#enableCustomRules();
|
3428
3441
|
}
|
3429
3442
|
|
3443
|
+
#storeOrigRenderers() {
|
3444
|
+
const defaultLinkRenderer = (tokens, idx, options, _, self) =>
|
3445
|
+
self.renderToken(tokens, idx, options);
|
3446
|
+
this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
|
3447
|
+
}
|
3448
|
+
|
3430
3449
|
#initProcessor() {
|
3431
3450
|
this.processor = new MarkdownIt();
|
3451
|
+
this.#storeOrigRenderers();
|
3432
3452
|
this.#updateProcessorRules();
|
3453
|
+
this.#customizeLinkRenderer();
|
3454
|
+
}
|
3455
|
+
|
3456
|
+
get linkTargetBlank() {
|
3457
|
+
return this.getAttribute('link-target-blank') === 'true';
|
3433
3458
|
}
|
3434
3459
|
|
3435
3460
|
get contentNode() {
|