@frontify/fondue 12.0.0-beta.134 → 12.0.0-beta.135
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/components/RichTextEditor/serializer/markdown/MarkdownToSlate.es.js +3 -3
- package/dist/components/RichTextEditor/serializer/markdown/MarkdownToSlate.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.d.ts +2 -2
- package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.es.js +30 -28
- package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/markdown/options.es.js +23 -22
- package/dist/components/RichTextEditor/serializer/markdown/options.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.d.ts +2 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.es.js +16 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.d.ts +2 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.es.js +52 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/types.d.ts +4 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.d.ts +2 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.es.js +12 -0
- package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/markdown/{remarkMention → remarkFondue}/types.d.ts +2 -6
- package/dist/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.es.js +7 -4
- package/dist/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/markdown/types.d.ts +7 -2
- package/dist/components/RichTextEditor/serializer/markdown/types.es.js +1 -0
- package/dist/components/RichTextEditor/serializer/markdown/types.es.js.map +1 -1
- package/dist/index.cjs.js +20 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +24 -23
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.d.ts +0 -3
- package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.es.js +0 -49
- package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.es.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { visit as s } from "unist-util-visit";
|
|
2
|
-
import { MENTION_SERIALIZE_REGEX as h } from "../utils.es.js";
|
|
3
|
-
const o = (t) => {
|
|
4
|
-
s(t, "paragraph", n);
|
|
5
|
-
function n(e) {
|
|
6
|
-
const { children: r } = e;
|
|
7
|
-
e.children = [];
|
|
8
|
-
for (const i of r) {
|
|
9
|
-
if (!p(i, "text") || !i.value) {
|
|
10
|
-
e.children.push(i);
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const l = [...i.value.matchAll(h)];
|
|
14
|
-
if (l === null || l.length === 0) {
|
|
15
|
-
e.children.push(i);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
u(l, e, i.value);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}, p = (t, n) => t[n] !== "" && !!t.value, u = (t, n, e) => {
|
|
22
|
-
t[0].index > 0 && n.children.push({
|
|
23
|
-
type: "text",
|
|
24
|
-
value: e.slice(0, t[0].index)
|
|
25
|
-
});
|
|
26
|
-
for (const [i, l] of t.entries())
|
|
27
|
-
if (n.children.push({
|
|
28
|
-
type: "mention",
|
|
29
|
-
children: [{ type: "text", value: l[0] }]
|
|
30
|
-
}), t.length > i + 1 && e) {
|
|
31
|
-
const c = l.index + l[0].length;
|
|
32
|
-
n.children.push({
|
|
33
|
-
type: "text",
|
|
34
|
-
value: e.slice(c, t[i + 1].index)
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const r = t[t.length - 1];
|
|
38
|
-
r.index + r[0].length < e.length ? n.children.push({
|
|
39
|
-
type: "text",
|
|
40
|
-
value: e.slice(r.index + r[0].length)
|
|
41
|
-
}) : n.children.push({
|
|
42
|
-
type: "text",
|
|
43
|
-
value: ""
|
|
44
|
-
});
|
|
45
|
-
}, f = () => o, d = f;
|
|
46
|
-
export {
|
|
47
|
-
d as default
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../../../src/components/RichTextEditor/serializer/markdown/remarkMention/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { VisitorResult, visit } from 'unist-util-visit';\nimport { MENTION_SERIALIZE_REGEX } from '../utils';\nimport { NodeChild, NodeChildKey, ParagraphNode, RegExpMatchArray, Transformer } from './types';\n\nconst transformer = (tree: ParagraphNode) => {\n visit(tree, 'paragraph', visitor);\n\n function visitor(node: ParagraphNode): VisitorResult {\n const { children } = node;\n node.children = [];\n\n for (const child of children) {\n if (!is(child, 'text') || !child.value) {\n node.children.push(child);\n continue;\n }\n\n const matches = [...child.value.matchAll(MENTION_SERIALIZE_REGEX)] as RegExpMatchArray[];\n\n if (matches === null || matches.length === 0) {\n node.children.push(child);\n continue;\n }\n\n createNodes(matches, node, child.value);\n }\n }\n};\n\nconst is = (node: NodeChild, key: NodeChildKey): boolean => node[key] !== '' && !!node.value;\n\nconst createNodes = (matches: RegExpMatchArray[], node: ParagraphNode, value: string) => {\n if (matches[0].index > 0) {\n node.children.push({\n type: 'text',\n value: value.slice(0, matches[0].index),\n });\n }\n\n for (const [index, match] of matches.entries()) {\n node.children.push({\n type: 'mention',\n children: [{ type: 'text', value: match[0] }],\n });\n\n if (matches.length > index + 1 && value) {\n const startAt = match.index + match[0].length;\n node.children.push({\n type: 'text',\n value: value.slice(startAt, matches[index + 1].index),\n });\n }\n }\n\n const lastMatch = matches[matches.length - 1];\n\n if (lastMatch.index + lastMatch[0].length < value.length) {\n node.children.push({\n type: 'text',\n value: value.slice(lastMatch.index + lastMatch[0].length),\n });\n } else {\n node.children.push({\n type: 'text',\n value: '',\n });\n }\n};\n\nconst plugin = (): Transformer => {\n return transformer;\n};\n\nexport default plugin;\n"],"names":["transformer","tree","visit","visitor","node","children","child","is","matches","MENTION_SERIALIZE_REGEX","createNodes","key","value","index","match","startAt","lastMatch","plugin","remarkMention"],"mappings":";;AAMA,MAAMA,IAAc,CAACC,MAAwB;AACnC,EAAAC,EAAAD,GAAM,aAAaE,CAAO;AAEhC,WAASA,EAAQC,GAAoC;AAC3C,UAAA,EAAE,UAAAC,EAAa,IAAAD;AACrB,IAAAA,EAAK,WAAW;AAEhB,eAAWE,KAASD,GAAU;AAC1B,UAAI,CAACE,EAAGD,GAAO,MAAM,KAAK,CAACA,EAAM,OAAO;AAC/B,QAAAF,EAAA,SAAS,KAAKE,CAAK;AACxB;AAAA,MACJ;AAEA,YAAME,IAAU,CAAC,GAAGF,EAAM,MAAM,SAASG,CAAuB,CAAC;AAEjE,UAAID,MAAY,QAAQA,EAAQ,WAAW,GAAG;AACrC,QAAAJ,EAAA,SAAS,KAAKE,CAAK;AACxB;AAAA,MACJ;AAEY,MAAAI,EAAAF,GAASJ,GAAME,EAAM,KAAK;AAAA,IAC1C;AAAA,EACJ;AACJ,GAEMC,IAAK,CAACH,GAAiBO,MAA+BP,EAAKO,CAAG,MAAM,MAAM,CAAC,CAACP,EAAK,OAEjFM,IAAc,CAACF,GAA6BJ,GAAqBQ,MAAkB;AACrF,EAAIJ,EAAQ,CAAC,EAAE,QAAQ,KACnBJ,EAAK,SAAS,KAAK;AAAA,IACf,MAAM;AAAA,IACN,OAAOQ,EAAM,MAAM,GAAGJ,EAAQ,CA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