@nectary/components 5.18.4 → 5.19.1
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/bundle.js +125 -25
- package/button/index.js +1 -1
- package/button/types.d.ts +4 -0
- package/field-v2/global/index.d.ts +1 -0
- package/field-v2/global/index.js +2 -0
- package/field-v2/index.d.ts +21 -0
- package/field-v2/index.js +159 -0
- package/field-v2/types.d.ts +58 -0
- package/field-v2/types.js +1 -0
- package/link/index.d.ts +3 -0
- package/link/index.js +56 -7
- package/link/types.d.ts +2 -0
- package/package.json +1 -1
- package/readme.md +2 -2
- package/rich-text/index.js +1 -0
- package/rich-text/utils.js +14 -5
- package/rich-textarea/utils.js +42 -12
- package/utils/component-names.d.ts +2 -2
- package/utils/component-names.js +1 -0
- package/utils/element.d.ts +1 -0
- package/utils/markdown.d.ts +4 -1
- package/utils/markdown.js +13 -1
package/utils/markdown.js
CHANGED
|
@@ -8,6 +8,7 @@ const regEm2Underscore = new RegExp("(?<!\\\\)__(?<em2>.+?)(?<!\\\\)__");
|
|
|
8
8
|
const regEm1Underscore = new RegExp("(?<!\\\\)_(?<em1>.+?)(?<!\\\\)_");
|
|
9
9
|
const regCodeTag = new RegExp("(?<!\\\\)`(?<code>.+?)(?<!\\\\)`");
|
|
10
10
|
const regStrikethrough = new RegExp("(?<!\\\\)~~(?<strike>.+?)(?<!\\\\)~~");
|
|
11
|
+
const regButtonPlaceholder = new RegExp("(?<!\\\\)\\[\\[(?<button>[a-zA-Z0-9_-]+)\\]\\]");
|
|
11
12
|
const regLink = new RegExp("(?<!\\\\)!?\\[(?<linktext>[^\\]]*?)\\]\\((?<linkhref>[^)]+?)\\)(\\{(?<linkattrs>[^)]+?)\\})?");
|
|
12
13
|
const regChip = new RegExp("(?<!\\\\)\\{\\{(?<chip>[a-zA-Z0-9_-]+)\\}\\}");
|
|
13
14
|
const regEmoji = new RegExp("(?<emoji>(?![0-9*#])\\p{Emoji})", "u");
|
|
@@ -17,6 +18,7 @@ const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~\{\}])/;
|
|
|
17
18
|
const allRegs = [
|
|
18
19
|
regEscapedChars,
|
|
19
20
|
regCodeTag,
|
|
21
|
+
regButtonPlaceholder,
|
|
20
22
|
regLink,
|
|
21
23
|
regChip,
|
|
22
24
|
regEm3Star,
|
|
@@ -60,13 +62,23 @@ const createLineParser = (visitor) => function parseLine(regs, md, context = INI
|
|
|
60
62
|
visitor.escaped(groups.escaped);
|
|
61
63
|
continue;
|
|
62
64
|
}
|
|
65
|
+
if (groups?.button != null) {
|
|
66
|
+
visitor.buttonPlaceholder(groups.button);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
63
69
|
if (groups?.linkhref != null) {
|
|
64
|
-
|
|
70
|
+
const rawText = groups.linktext;
|
|
71
|
+
const isCode = rawText.length >= 2 && rawText.startsWith("`") && rawText.endsWith("`") && !rawText.slice(1, -1).includes("`");
|
|
72
|
+
const linkText = isCode ? rawText.slice(1, -1) : rawText;
|
|
73
|
+
visitor.link(linkText, groups.linkhref, groups.linkattrs?.split(" "), isCode);
|
|
65
74
|
}
|
|
66
75
|
if (groups?.code != null) {
|
|
67
76
|
visitor.codetag(groups.code);
|
|
68
77
|
}
|
|
69
78
|
if (groups?.chip != null) {
|
|
79
|
+
if (visitor.linkPlaceholder(groups.chip)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
70
82
|
visitor.tag(groups.chip);
|
|
71
83
|
}
|
|
72
84
|
if (groups?.emoji != null) {
|