@descope/web-components-ui 1.0.304 → 1.0.306
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +43 -98
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +43 -98
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1612.js +1 -1
- package/dist/umd/1621.js +2 -2
- package/dist/umd/3951.js +1 -1
- package/dist/umd/4024.js +1 -1
- package/dist/umd/4052.js +1 -1
- package/dist/umd/4569.js +1 -0
- package/dist/umd/4746.js +1 -1
- package/dist/umd/5806.js +1 -1
- package/dist/umd/6770.js +1 -1
- package/dist/umd/7056.js +1 -1
- package/dist/umd/7531.js +1 -1
- package/dist/umd/7911.js +1 -1
- package/dist/umd/9092.js +2 -2
- package/dist/umd/9314.js +1 -1
- package/dist/umd/9423.js +2 -2
- package/dist/umd/9562.js +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -1
- package/dist/umd/descope-enriched-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
- package/package.json +3 -3
- package/src/components/descope-enriched-text/EnrichedTextClass.js +33 -27
- package/src/components/descope-enriched-text/consts.js +11 -72
- package/dist/umd/9927.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
var merge = require('lodash.merge');
|
4
4
|
var Color = require('color');
|
5
|
-
var
|
5
|
+
var MarkdownIt = require('markdown-it');
|
6
6
|
|
7
7
|
const DESCOPE_PREFIX = 'descope';
|
8
8
|
const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
|
@@ -4565,85 +4565,24 @@ var text$3 = /*#__PURE__*/Object.freeze({
|
|
4565
4565
|
vars: vars$r
|
4566
4566
|
});
|
4567
4567
|
|
4568
|
-
const ruleSet = {
|
4569
|
-
custom: ['image'],
|
4570
|
-
core: [
|
4571
|
-
'block',
|
4572
|
-
'inline',
|
4573
|
-
'abbr', // Parse abbreviation definitions, i.e. `*[abbr]: description`
|
4574
|
-
'abbr2', // Enclose abbreviations in <abbr> tags
|
4575
|
-
'references',
|
4576
|
-
'footnote_tail',
|
4577
|
-
'replacements', // Simple typographical replacements
|
4578
|
-
'smartquotes', // Convert straight quotation marks to typographic ones
|
4579
|
-
],
|
4580
|
-
inline: [
|
4581
|
-
'text',
|
4582
|
-
'newline', // Proceess '\n'
|
4583
|
-
'backticks', // Parse backticks
|
4584
|
-
'del', // Process ~~deleted text~~
|
4585
|
-
'emphasis', // Process *this* and _that_
|
4586
|
-
'sub', // Process ~subscript~
|
4587
|
-
'sup', // Process ^superscript^
|
4588
|
-
'links', // Process [links](<to> "stuff")
|
4589
|
-
'escape', // Proceess escaped chars and hardbreaks
|
4590
|
-
'ins', // Process ++inserted text++
|
4591
|
-
'mark', // Process ==highlighted text==
|
4592
|
-
'footnote_inline', // Process inline footnotes (^[...])
|
4593
|
-
'footnote_ref', // Process footnote references ([^...])
|
4594
|
-
'autolink', // Process autolinks '<protocol:...>'
|
4595
|
-
'htmltag', // Process html tags
|
4596
|
-
'entity', // Process html entity - {, ¯, ", ...
|
4597
|
-
],
|
4598
|
-
block: [
|
4599
|
-
'code', // Code block (4 spaces padded)
|
4600
|
-
'fences', // fences (``` lang, ~~~ lang)
|
4601
|
-
'blockquote', // Block quotes
|
4602
|
-
'list',
|
4603
|
-
'heading', // heading (#, ##, ...)
|
4604
|
-
'paragraph',
|
4605
|
-
'hr', // Horizontal rule
|
4606
|
-
'footnote', // Process footnote reference list
|
4607
|
-
'lheading', // lheading (---, ===)
|
4608
|
-
'htmlblock', // HTML block
|
4609
|
-
'table', // GFM table, non-standard
|
4610
|
-
'deflist', // Definition lists
|
4611
|
-
],
|
4612
|
-
};
|
4613
|
-
|
4614
4568
|
const textRuleSet = {
|
4615
|
-
|
4616
|
-
|
4617
|
-
|
4618
|
-
|
4619
|
-
|
4620
|
-
|
4621
|
-
|
4622
|
-
|
4623
|
-
|
4624
|
-
|
4625
|
-
|
4626
|
-
'ins', // Process ++inserted text++
|
4627
|
-
'footnote_inline', // Process inline footnotes (^[...])
|
4628
|
-
'footnote_ref', // Process footnote references ([^...])
|
4629
|
-
'autolink', // Process autolinks '<protocol:...>'
|
4630
|
-
],
|
4631
|
-
block: [
|
4632
|
-
'code', // Code block (4 spaces padded)
|
4633
|
-
'fences', // fences (``` lang, ~~~ lang)
|
4634
|
-
'blockquote', // Block quotes
|
4635
|
-
'list',
|
4636
|
-
'heading', // heading (#, ##, ...)
|
4637
|
-
'paragraph',
|
4638
|
-
'footnote', // Process footnote reference list
|
4639
|
-
'htmlblock', // HTML block
|
4640
|
-
],
|
4569
|
+
components: {
|
4570
|
+
core: {
|
4571
|
+
rules: ['block', 'inline'],
|
4572
|
+
},
|
4573
|
+
block: {
|
4574
|
+
rules: ['blockquote', 'code', 'heading', 'list', 'paragraph', 'list'],
|
4575
|
+
},
|
4576
|
+
inline: {
|
4577
|
+
rules: ['backticks', 'strikethrough', 'link', 'emphasis', 'strikethrough', 'newline', 'text'],
|
4578
|
+
},
|
4579
|
+
},
|
4641
4580
|
};
|
4642
4581
|
|
4643
4582
|
const componentName$z = getComponentName('enriched-text');
|
4644
4583
|
|
4645
4584
|
let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName: componentName$z, baseSelector: ':host > div' }) {
|
4646
|
-
#
|
4585
|
+
#origLinkRenderer;
|
4647
4586
|
|
4648
4587
|
constructor() {
|
4649
4588
|
super();
|
@@ -4692,7 +4631,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
4692
4631
|
}
|
4693
4632
|
|
4694
4633
|
static get observedAttributes() {
|
4695
|
-
return ['readonly'];
|
4634
|
+
return ['readonly', 'link-target-blank'];
|
4696
4635
|
}
|
4697
4636
|
|
4698
4637
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
@@ -4702,21 +4641,24 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
4702
4641
|
if (attrName === 'readonly') {
|
4703
4642
|
this.onReadOnlyChange(newValue === 'true');
|
4704
4643
|
}
|
4644
|
+
|
4645
|
+
if (attrName === 'link-target-blank') {
|
4646
|
+
this.#initProcessor();
|
4647
|
+
}
|
4705
4648
|
}
|
4706
4649
|
}
|
4707
4650
|
|
4708
|
-
#
|
4709
|
-
if (
|
4710
|
-
|
4651
|
+
#customizeLinkRenderer() {
|
4652
|
+
if (this.linkTargetBlank) {
|
4653
|
+
this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
4654
|
+
// Add a new `target` attribute, or replace the value of the existing one.
|
4655
|
+
tokens[idx].attrSet('target', '_blank');
|
4656
|
+
// Pass the token to the default renderer.
|
4657
|
+
return this.#origLinkRenderer(tokens, idx, options, env, self);
|
4658
|
+
};
|
4659
|
+
} else {
|
4660
|
+
this.processor.renderer.rules.link_open = this.#origLinkRenderer;
|
4711
4661
|
}
|
4712
|
-
|
4713
|
-
ruleSet?.core && this.processor.core.ruler.disable(ruleSet.core);
|
4714
|
-
ruleSet?.inline && this.processor.inline.ruler.disable(ruleSet.inline);
|
4715
|
-
ruleSet?.block && this.processor.block.ruler.disable(ruleSet.block);
|
4716
|
-
|
4717
|
-
this.processor.renderer.rules.image = () => {
|
4718
|
-
return '';
|
4719
|
-
};
|
4720
4662
|
}
|
4721
4663
|
|
4722
4664
|
#enableCustomRules() {
|
@@ -4725,25 +4667,28 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
4725
4667
|
}
|
4726
4668
|
|
4727
4669
|
const customRuleSet = textRuleSet;
|
4728
|
-
|
4729
|
-
customRuleSet?.core && this.processor?.core.ruler.enable(customRuleSet?.core);
|
4730
|
-
customRuleSet?.inline && this.processor?.inline.ruler.enable(customRuleSet?.inline);
|
4731
|
-
customRuleSet?.block && this.processor?.block.ruler.enable(customRuleSet?.block);
|
4732
|
-
|
4733
|
-
if (customRuleSet?.custom?.includes('image')) {
|
4734
|
-
this.processor.renderer.rules.image = this.#origImageRenderer;
|
4735
|
-
}
|
4670
|
+
this.processor.configure(customRuleSet || {});
|
4736
4671
|
}
|
4737
4672
|
|
4738
4673
|
#updateProcessorRules() {
|
4739
|
-
this.#disableAllRules();
|
4740
4674
|
this.#enableCustomRules();
|
4741
4675
|
}
|
4742
4676
|
|
4677
|
+
#storeOrigRenderers() {
|
4678
|
+
const defaultLinkRenderer = (tokens, idx, options, _, self) =>
|
4679
|
+
self.renderToken(tokens, idx, options);
|
4680
|
+
this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
|
4681
|
+
}
|
4682
|
+
|
4743
4683
|
#initProcessor() {
|
4744
|
-
this.processor = new
|
4745
|
-
this.#
|
4684
|
+
this.processor = new MarkdownIt();
|
4685
|
+
this.#storeOrigRenderers();
|
4746
4686
|
this.#updateProcessorRules();
|
4687
|
+
this.#customizeLinkRenderer();
|
4688
|
+
}
|
4689
|
+
|
4690
|
+
get linkTargetBlank() {
|
4691
|
+
return this.getAttribute('link-target-blank') === 'true';
|
4747
4692
|
}
|
4748
4693
|
|
4749
4694
|
get contentNode() {
|
@@ -4758,7 +4703,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
4758
4703
|
let html = this.textContent;
|
4759
4704
|
|
4760
4705
|
try {
|
4761
|
-
const tokens = this.processor.parse(this.textContent);
|
4706
|
+
const tokens = this.processor.parse(this.textContent, { references: undefined });
|
4762
4707
|
html = this.processor.renderer.render(tokens, { breaks: true });
|
4763
4708
|
} catch (e) {
|
4764
4709
|
// eslint-disable-next-line no-console
|