@frontify/guideline-blocks-settings 0.28.3 → 0.28.4
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/CHANGELOG.md +11 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +3 -2
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +7 -7
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +27 -12
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +4 -4
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +33 -33
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -1
- package/dist/index.cjs.js +10 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +5 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +10 -10
- package/src/components/RichTextEditor/serializer/nodes/button.ts +1 -0
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +3 -3
- package/src/components/RichTextEditor/serializer/nodes/default.ts +27 -12
- package/src/components/RichTextEditor/serializer/nodes/link.ts +2 -2
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @frontify/guideline-blocks-settings
|
|
2
2
|
|
|
3
|
+
## 0.28.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#503](https://github.com/Frontify/brand-sdk/pull/503) [`c56e7e9`](https://github.com/Frontify/brand-sdk/commit/c56e7e9112e04ae0e9ae35e4b7a98c11665045f2) Thanks [@fulopdaniel](https://github.com/fulopdaniel)! - feat(RTE): add dir to serializer
|
|
8
|
+
|
|
9
|
+
- [`22684e3`](https://github.com/Frontify/brand-sdk/commit/22684e358fd2b073790a0959606c6a5d44e35c4e) Thanks [@SamuelAlev](https://github.com/SamuelAlev)! - Update dependencies
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`22684e3`](https://github.com/Frontify/brand-sdk/commit/22684e358fd2b073790a0959606c6a5d44e35c4e)]:
|
|
12
|
+
- @frontify/sidebar-settings@0.6.2
|
|
13
|
+
|
|
3
14
|
## 0.28.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { reactCssPropsToCss as s } from "../utlis/reactCssPropsToCss.es.js";
|
|
2
|
-
import { BUTTON_PLUGIN as
|
|
2
|
+
import { BUTTON_PLUGIN as i } from "../../plugins/ButtonPlugin/createButtonPlugin.es.js";
|
|
3
3
|
const b = (e, n, a, u) => {
|
|
4
|
-
const l = u[
|
|
4
|
+
const l = u[i], o = e.buttonStyle ?? "primary", c = `button${o.charAt(0).toUpperCase()}${o.slice(1)}`, t = l[c], r = s(t);
|
|
5
5
|
return `<a href="${e.url}"
|
|
6
6
|
target="${e.target ?? "_blank"}"
|
|
7
|
+
dir="auto"
|
|
7
8
|
style="${r}"
|
|
8
9
|
class="${a}"
|
|
9
10
|
onmouseenter="this.setAttribute('style', '${r} ${s(t == null ? void 0 : t.hover)}');"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/button.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { TElement } from '@udecode/plate';\n\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\nimport { BUTTON_PLUGIN } from '../../plugins';\n\nexport type ButtonStylesType = Record<string, Record<string, CSSProperties & { hover?: CSSProperties }>>;\n\nexport const buttonNode = (node: TElement, children: string, defaultClassNames: string, styles: ButtonStylesType) => {\n const buttonStyles = styles[BUTTON_PLUGIN];\n const buttonTypeString = (node.buttonStyle as string) ?? 'primary';\n const buttonType = `button${buttonTypeString.charAt(0).toUpperCase()}${buttonTypeString.slice(1)}`;\n const buttonStyle = buttonStyles[buttonType];\n\n const defaultStyles = reactCssPropsToCss(buttonStyle);\n\n return `<a href=\"${node.url}\"\n target=\"${node.target ?? '_blank'}\"\n style=\"${defaultStyles}\"\n class=\"${defaultClassNames}\"\n onmouseenter=\"this.setAttribute('style', '${defaultStyles} ${reactCssPropsToCss(buttonStyle?.hover)}');\"\n onmouseleave=\"this.setAttribute('style', '${reactCssPropsToCss(buttonStyle)}');\"\n >${children}</a>`;\n};\n"],"names":["buttonNode","node","children","defaultClassNames","styles","buttonStyles","BUTTON_PLUGIN","buttonTypeString","buttonType","buttonStyle","defaultStyles","reactCssPropsToCss"],"mappings":";;AAUO,MAAMA,IAAa,CAACC,GAAgBC,GAAkBC,GAA2BC,MAA6B;AAC3G,QAAAC,IAAeD,EAAOE,CAAa,GACnCC,IAAoBN,EAAK,eAA0B,WACnDO,IAAa,SAASD,EAAiB,OAAO,CAAC,EAAE,YAAY,CAAC,GAAGA,EAAiB,MAAM,CAAC,CAAC,IAC1FE,IAAcJ,EAAaG,CAAU,GAErCE,IAAgBC,EAAmBF,CAAW;AAE7C,SAAA,YAAYR,EAAK,GAAG;AAAA,0BACLA,EAAK,UAAU,QAAQ;AAAA,
|
|
1
|
+
{"version":3,"file":"button.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/button.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { TElement } from '@udecode/plate';\n\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\nimport { BUTTON_PLUGIN } from '../../plugins';\n\nexport type ButtonStylesType = Record<string, Record<string, CSSProperties & { hover?: CSSProperties }>>;\n\nexport const buttonNode = (node: TElement, children: string, defaultClassNames: string, styles: ButtonStylesType) => {\n const buttonStyles = styles[BUTTON_PLUGIN];\n const buttonTypeString = (node.buttonStyle as string) ?? 'primary';\n const buttonType = `button${buttonTypeString.charAt(0).toUpperCase()}${buttonTypeString.slice(1)}`;\n const buttonStyle = buttonStyles[buttonType];\n\n const defaultStyles = reactCssPropsToCss(buttonStyle);\n\n return `<a href=\"${node.url}\"\n target=\"${node.target ?? '_blank'}\"\n dir=\"auto\"\n style=\"${defaultStyles}\"\n class=\"${defaultClassNames}\"\n onmouseenter=\"this.setAttribute('style', '${defaultStyles} ${reactCssPropsToCss(buttonStyle?.hover)}');\"\n onmouseleave=\"this.setAttribute('style', '${reactCssPropsToCss(buttonStyle)}');\"\n >${children}</a>`;\n};\n"],"names":["buttonNode","node","children","defaultClassNames","styles","buttonStyles","BUTTON_PLUGIN","buttonTypeString","buttonType","buttonStyle","defaultStyles","reactCssPropsToCss"],"mappings":";;AAUO,MAAMA,IAAa,CAACC,GAAgBC,GAAkBC,GAA2BC,MAA6B;AAC3G,QAAAC,IAAeD,EAAOE,CAAa,GACnCC,IAAoBN,EAAK,eAA0B,WACnDO,IAAa,SAASD,EAAiB,OAAO,CAAC,EAAE,YAAY,CAAC,GAAGA,EAAiB,MAAM,CAAC,CAAC,IAC1FE,IAAcJ,EAAaG,CAAU,GAErCE,IAAgBC,EAAmBF,CAAW;AAE7C,SAAA,YAAYR,EAAK,GAAG;AAAA,0BACLA,EAAK,UAAU,QAAQ;AAAA;AAAA,yBAExBS,CAAa;AAAA,yBACbP,CAAiB;AAAA,4DACkBO,CAAa,IAAIC,EAAmBF,KAAA,gBAAAA,EAAa,KAAK,CAAC;AAAA,4DACvDE,EAAmBF,CAAW,CAAC;AAAA,mBACxEP,CAAQ;AAC3B;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { merge as
|
|
2
|
-
import { reactCssPropsToCss as
|
|
3
|
-
const
|
|
4
|
-
<div class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
1
|
+
import { merge as r } from "@frontify/fondue";
|
|
2
|
+
import { reactCssPropsToCss as i } from "../utlis/reactCssPropsToCss.es.js";
|
|
3
|
+
const w = (t, e, s, c) => `<div dir="auto" disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${s}" style="margin-left:${(t.indent ?? 0) * 24}px;">
|
|
4
|
+
<div dir="auto" class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
5
5
|
<input
|
|
6
6
|
class="tw-w-4 tw-h-4 tw-m-0"
|
|
7
7
|
type="checkbox"
|
|
8
8
|
${t.checked ? "checked" : ""}
|
|
9
9
|
onclick="return false;" />
|
|
10
10
|
</div>
|
|
11
|
-
<span class="${
|
|
11
|
+
<span dir="auto" class="${r([
|
|
12
12
|
"tw-flex-1 tw-focus:outline-none",
|
|
13
13
|
t.checked ? "!tw-line-through" : ""
|
|
14
|
-
])}" style="${
|
|
14
|
+
])}" style="${i(c[t.children[0].textStyle])}">${e}</span>
|
|
15
15
|
</div>`;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
w as checkItemNode
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=checkItemNode.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkItemNode.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/checkItemNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { merge } from '@frontify/fondue';\nimport { TElement } from '@udecode/plate';\n\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const checkItemNode = (\n node: TElement,\n children: string,\n defaultClassNames: string,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }>,\n) => {\n return `<div disabled class=\"tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${defaultClassNames}\" style=\"margin-left:${\n ((node.indent as number) ?? 0) * 24\n }px;\">\n <div class=\"tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5\">\n <input\n class=\"tw-w-4 tw-h-4 tw-m-0\"\n type=\"checkbox\"\n ${node.checked ? 'checked' : ''}\n onclick=\"return false;\" />\n </div>\n <span class=\"${merge([\n 'tw-flex-1 tw-focus:outline-none',\n node.checked ? '!tw-line-through' : '',\n ])}\" style=\"${reactCssPropsToCss(styles[node.children[0].textStyle as string])}\">${children}</span>\n</div>`;\n};\n"],"names":["checkItemNode","node","children","defaultClassNames","styles","merge","reactCssPropsToCss"],"mappings":";;AAQO,MAAMA,IAAgB,CACzBC,GACAC,GACAC,GACAC,MAEO,
|
|
1
|
+
{"version":3,"file":"checkItemNode.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/checkItemNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { merge } from '@frontify/fondue';\nimport { TElement } from '@udecode/plate';\n\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const checkItemNode = (\n node: TElement,\n children: string,\n defaultClassNames: string,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }>,\n) => {\n return `<div dir=\"auto\" disabled class=\"tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${defaultClassNames}\" style=\"margin-left:${\n ((node.indent as number) ?? 0) * 24\n }px;\">\n <div dir=\"auto\" class=\"tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5\">\n <input\n class=\"tw-w-4 tw-h-4 tw-m-0\"\n type=\"checkbox\"\n ${node.checked ? 'checked' : ''}\n onclick=\"return false;\" />\n </div>\n <span dir=\"auto\" class=\"${merge([\n 'tw-flex-1 tw-focus:outline-none',\n node.checked ? '!tw-line-through' : '',\n ])}\" style=\"${reactCssPropsToCss(styles[node.children[0].textStyle as string])}\">${children}</span>\n</div>`;\n};\n"],"names":["checkItemNode","node","children","defaultClassNames","styles","merge","reactCssPropsToCss"],"mappings":";;AAQO,MAAMA,IAAgB,CACzBC,GACAC,GACAC,GACAC,MAEO,qFAAqFD,CAAiB,yBACvGF,EAAK,UAAqB,KAAK,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,cAKUA,EAAK,UAAU,YAAY,EAAE;AAAA;AAAA;AAAA,8BAGbI,EAAM;AAAA,EAC5B;AAAA,EACAJ,EAAK,UAAU,qBAAqB;AACvC,CAAA,CAAC,YAAYK,EAAmBF,EAAOH,EAAK,SAAS,CAAC,EAAE,SAAmB,CAAC,CAAC,KAAKC,CAAQ;AAAA;"}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
import { merge as
|
|
2
|
-
import { reactCssPropsToCss as
|
|
3
|
-
import { TextStyles as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
1
|
+
import { merge as u } from "@frontify/fondue";
|
|
2
|
+
import { reactCssPropsToCss as y } from "../utlis/reactCssPropsToCss.es.js";
|
|
3
|
+
import { TextStyles as $ } from "../../plugins/styles.es.js";
|
|
4
|
+
const e = (r, t, a, p) => {
|
|
5
|
+
const i = y(a);
|
|
6
|
+
return r.type === $.heading1 ? `<h1 dir="auto" class="${u([p, "a-h1"])}">${o(
|
|
7
7
|
t,
|
|
8
|
-
|
|
9
|
-
)}</p>` : p.type === o.
|
|
8
|
+
i
|
|
9
|
+
)}</h1>` : r.type === $.heading2 ? `<h2 dir="auto" class="${p}">${o(t, i)}</h2>` : r.type === $.heading3 ? `<h3 dir="auto" class="${p}">${o(t, i)}</h3>` : r.type === $.heading4 ? `<h4 dir="auto" class="${p}">${o(t, i)}</h4>` : r.type === $.custom1 ? `<p dir="auto" class="${u([p, "a-custom1"])}">${o(
|
|
10
10
|
t,
|
|
11
|
-
|
|
12
|
-
)}</p>` : `<p class="${
|
|
13
|
-
|
|
11
|
+
i
|
|
12
|
+
)}</p>` : r.type === $.custom2 ? `<p dir="auto" class="${u([p, "a-custom2"])}">${o(
|
|
13
|
+
t,
|
|
14
|
+
i
|
|
15
|
+
)}</p>` : r.type === $.custom3 ? `<p dir="auto" class="${u([p, "a-custom3"])}">${o(
|
|
16
|
+
t,
|
|
17
|
+
i
|
|
18
|
+
)}</p>` : r.type === $.quote ? `<p dir="auto" class="${u([p, "a-quote"])}">${o(
|
|
19
|
+
t,
|
|
20
|
+
i
|
|
21
|
+
)}</p>` : r.type === $.imageTitle ? `<p dir="auto" class="${u([p, "a-image-title"])}">${o(
|
|
22
|
+
t,
|
|
23
|
+
i
|
|
24
|
+
)}</p>` : r.type === $.imageCaption ? `<p dir="auto" class="${u([p, "a-image-caption"])}">${o(
|
|
25
|
+
t,
|
|
26
|
+
i
|
|
27
|
+
)}</p>` : `<p dir="auto" class="${p}">${o(t, i)}</p>`;
|
|
28
|
+
}, o = (r, t) => `<span dir="auto" style="${t}">${r}</span>`;
|
|
14
29
|
export {
|
|
15
|
-
|
|
30
|
+
e as defaultNode
|
|
16
31
|
};
|
|
17
32
|
//# sourceMappingURL=default.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/default.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { merge } from '@frontify/fondue';\nimport { TElement } from '@udecode/plate';\n\nimport { TextStyles } from '../../plugins';\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const defaultNode = (node: TElement, children: string, styles: CSSProperties, defaultClassNames: string) => {\n const defaultStyles = reactCssPropsToCss(styles);\n\n if (node.type === TextStyles.heading1) {\n return `<h1 class=\"${merge([defaultClassNames, 'a-h1'])}\">${getStyledChild(children
|
|
1
|
+
{"version":3,"file":"default.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/default.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { merge } from '@frontify/fondue';\nimport { TElement } from '@udecode/plate';\n\nimport { TextStyles } from '../../plugins';\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const defaultNode = (node: TElement, children: string, styles: CSSProperties, defaultClassNames: string) => {\n const defaultStyles = reactCssPropsToCss(styles);\n\n if (node.type === TextStyles.heading1) {\n return `<h1 dir=\"auto\" class=\"${merge([defaultClassNames, 'a-h1'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</h1>`;\n }\n if (node.type === TextStyles.heading2) {\n return `<h2 dir=\"auto\" class=\"${defaultClassNames}\">${getStyledChild(children, defaultStyles)}</h2>`;\n }\n if (node.type === TextStyles.heading3) {\n return `<h3 dir=\"auto\" class=\"${defaultClassNames}\">${getStyledChild(children, defaultStyles)}</h3>`;\n }\n if (node.type === TextStyles.heading4) {\n return `<h4 dir=\"auto\" class=\"${defaultClassNames}\">${getStyledChild(children, defaultStyles)}</h4>`;\n }\n if (node.type === TextStyles.custom1) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-custom1'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n if (node.type === TextStyles.custom2) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-custom2'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n if (node.type === TextStyles.custom3) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-custom3'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n if (node.type === TextStyles.quote) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-quote'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n if (node.type === TextStyles.imageTitle) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-image-title'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n if (node.type === TextStyles.imageCaption) {\n return `<p dir=\"auto\" class=\"${merge([defaultClassNames, 'a-image-caption'])}\">${getStyledChild(\n children,\n defaultStyles,\n )}</p>`;\n }\n\n return `<p dir=\"auto\" class=\"${defaultClassNames}\">${getStyledChild(children, defaultStyles)}</p>`;\n};\n\nconst getStyledChild = (children: string, styles: string) => `<span dir=\"auto\" style=\"${styles}\">${children}</span>`;\n"],"names":["defaultNode","node","children","styles","defaultClassNames","defaultStyles","reactCssPropsToCss","TextStyles","merge","getStyledChild"],"mappings":";;;AASO,MAAMA,IAAc,CAACC,GAAgBC,GAAkBC,GAAuBC,MAA8B;AACzG,QAAAC,IAAgBC,EAAmBH,CAAM;AAE3C,SAAAF,EAAK,SAASM,EAAW,WAClB,yBAAyBC,EAAM,CAACJ,GAAmB,MAAM,CAAC,CAAC,KAAKK;AAAA,IACnEP;AAAA,IACAG;AAAA,EACH,CAAA,UAEDJ,EAAK,SAASM,EAAW,WAClB,yBAAyBH,CAAiB,KAAKK,EAAeP,GAAUG,CAAa,CAAC,UAE7FJ,EAAK,SAASM,EAAW,WAClB,yBAAyBH,CAAiB,KAAKK,EAAeP,GAAUG,CAAa,CAAC,UAE7FJ,EAAK,SAASM,EAAW,WAClB,yBAAyBH,CAAiB,KAAKK,EAAeP,GAAUG,CAAa,CAAC,UAE7FJ,EAAK,SAASM,EAAW,UAClB,wBAAwBC,EAAM,CAACJ,GAAmB,WAAW,CAAC,CAAC,KAAKK;AAAA,IACvEP;AAAA,IACAG;AAAA,EACH,CAAA,SAEDJ,EAAK,SAASM,EAAW,UAClB,wBAAwBC,EAAM,CAACJ,GAAmB,WAAW,CAAC,CAAC,KAAKK;AAAA,IACvEP;AAAA,IACAG;AAAA,EACH,CAAA,SAEDJ,EAAK,SAASM,EAAW,UAClB,wBAAwBC,EAAM,CAACJ,GAAmB,WAAW,CAAC,CAAC,KAAKK;AAAA,IACvEP;AAAA,IACAG;AAAA,EACH,CAAA,SAEDJ,EAAK,SAASM,EAAW,QAClB,wBAAwBC,EAAM,CAACJ,GAAmB,SAAS,CAAC,CAAC,KAAKK;AAAA,IACrEP;AAAA,IACAG;AAAA,EACH,CAAA,SAEDJ,EAAK,SAASM,EAAW,aAClB,wBAAwBC,EAAM,CAACJ,GAAmB,eAAe,CAAC,CAAC,KAAKK;AAAA,IAC3EP;AAAA,IACAG;AAAA,EACH,CAAA,SAEDJ,EAAK,SAASM,EAAW,eAClB,wBAAwBC,EAAM,CAACJ,GAAmB,iBAAiB,CAAC,CAAC,KAAKK;AAAA,IAC7EP;AAAA,IACAG;AAAA,EACH,CAAA,SAGE,wBAAwBD,CAAiB,KAAKK,EAAeP,GAAUG,CAAa,CAAC;AAChG,GAEMI,IAAiB,CAACP,GAAkBC,MAAmB,2BAA2BA,CAAM,KAAKD,CAAQ;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import p from "escape-html";
|
|
2
2
|
import { LINK_PLUGIN as e } from "../../plugins/LinkPlugin/id.es.js";
|
|
3
3
|
import { reactCssPropsToCss as f } from "../utlis/reactCssPropsToCss.es.js";
|
|
4
|
-
const
|
|
4
|
+
const u = (r, a, s, $) => {
|
|
5
5
|
var l;
|
|
6
6
|
if (r.chosenLink) {
|
|
7
7
|
const { chosenLink: t } = r;
|
|
8
|
-
return `<a class="${s}" style="${f($[e])}" target=${t != null && t.openInNewTab ? "_blank" : "_self"} href="${p((l = t == null ? void 0 : t.searchResult) == null ? void 0 : l.link)}">${a}</a>`;
|
|
8
|
+
return `<a dir="auto" class="${s}" style="${f($[e])}" target=${t != null && t.openInNewTab ? "_blank" : "_self"} href="${p((l = t == null ? void 0 : t.searchResult) == null ? void 0 : l.link)}">${a}</a>`;
|
|
9
9
|
}
|
|
10
|
-
return `<a class="${s}" style="${f($[e])}" target="${(r == null ? void 0 : r.target) ?? "_blank"}" href="${p(r.url)}">${a}</a>`;
|
|
10
|
+
return `<a dir="auto" class="${s}" style="${f($[e])}" target="${(r == null ? void 0 : r.target) ?? "_blank"}" href="${p(r.url)}">${a}</a>`;
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
u as linkNode
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=link.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/link.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport escapeHtml from 'escape-html';\nimport { TElement } from '@udecode/plate';\n\nimport { LINK_PLUGIN } from '../../plugins/LinkPlugin/id';\nimport { TLinkElement } from '../../plugins/LinkPlugin/types';\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const linkNode = (\n node: TElement,\n children: string,\n defaultClassNames: string,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }>,\n) => {\n if (node.chosenLink) {\n const { chosenLink } = node as TLinkElement;\n return `<a class=\"${defaultClassNames}\" style=\"${reactCssPropsToCss(styles[LINK_PLUGIN])}\" target=${\n chosenLink?.openInNewTab ? '_blank' : '_self'\n } href=\"${escapeHtml(chosenLink?.searchResult?.link)}\">${children}</a>`;\n }\n return `<a class=\"${defaultClassNames}\" style=\"${reactCssPropsToCss(styles[LINK_PLUGIN])}\" target=\"${\n node?.target ?? '_blank'\n }\" href=\"${escapeHtml(node.url as string)}\">${children}</a>`;\n};\n"],"names":["linkNode","node","children","defaultClassNames","styles","chosenLink","reactCssPropsToCss","LINK_PLUGIN","escapeHtml","_a"],"mappings":";;;AAUO,MAAMA,IAAW,CACpBC,GACAC,GACAC,GACAC,MACC;;AACD,MAAIH,EAAK,YAAY;AACX,UAAA,EAAE,YAAAI,EAAe,IAAAJ;AAChB,WAAA,
|
|
1
|
+
{"version":3,"file":"link.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/nodes/link.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport escapeHtml from 'escape-html';\nimport { TElement } from '@udecode/plate';\n\nimport { LINK_PLUGIN } from '../../plugins/LinkPlugin/id';\nimport { TLinkElement } from '../../plugins/LinkPlugin/types';\nimport { reactCssPropsToCss } from '../utlis/reactCssPropsToCss';\n\nexport const linkNode = (\n node: TElement,\n children: string,\n defaultClassNames: string,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }>,\n) => {\n if (node.chosenLink) {\n const { chosenLink } = node as TLinkElement;\n return `<a dir=\"auto\" class=\"${defaultClassNames}\" style=\"${reactCssPropsToCss(styles[LINK_PLUGIN])}\" target=${\n chosenLink?.openInNewTab ? '_blank' : '_self'\n } href=\"${escapeHtml(chosenLink?.searchResult?.link)}\">${children}</a>`;\n }\n return `<a dir=\"auto\" class=\"${defaultClassNames}\" style=\"${reactCssPropsToCss(styles[LINK_PLUGIN])}\" target=\"${\n node?.target ?? '_blank'\n }\" href=\"${escapeHtml(node.url as string)}\">${children}</a>`;\n};\n"],"names":["linkNode","node","children","defaultClassNames","styles","chosenLink","reactCssPropsToCss","LINK_PLUGIN","escapeHtml","_a"],"mappings":";;;AAUO,MAAMA,IAAW,CACpBC,GACAC,GACAC,GACAC,MACC;;AACD,MAAIH,EAAK,YAAY;AACX,UAAA,EAAE,YAAAI,EAAe,IAAAJ;AAChB,WAAA,wBAAwBE,CAAiB,YAAYG,EAAmBF,EAAOG,CAAW,CAAC,CAAC,YAC/FF,KAAA,QAAAA,EAAY,eAAe,WAAW,OAC1C,UAAUG,GAAWC,IAAAJ,KAAA,gBAAAA,EAAY,iBAAZ,gBAAAI,EAA0B,IAAI,CAAC,KAAKP,CAAQ;AAAA,EACrE;AACA,SAAO,wBAAwBC,CAAiB,YAAYG,EAAmBF,EAAOG,CAAW,CAAC,CAAC,cAC/FN,KAAA,gBAAAA,EAAM,WAAU,QACpB,WAAWO,EAAWP,EAAK,GAAa,CAAC,KAAKC,CAAQ;AAC1D;"}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { UL_CLASSES as
|
|
2
|
-
import { isText as _, ELEMENT_UL as
|
|
3
|
-
import { serializeLeafToHtml as
|
|
1
|
+
import { UL_CLASSES as u, getOrderedListClasses as N, LI_CLASSNAMES as p, getLiStyles as f, getLicElementClassNames as L, ELEMENT_CHECK_ITEM as T, alignmentClassnames as C, merge as $, OL_STYLES as M } from "@frontify/fondue";
|
|
2
|
+
import { isText as _, ELEMENT_UL as d, ELEMENT_OL as n, ELEMENT_LI as g, ELEMENT_LIC as k, ELEMENT_LINK as y, ELEMENT_MENTION as S } from "@udecode/plate";
|
|
3
|
+
import { serializeLeafToHtml as h } from "./utlis/serializeLeafToHtml.es.js";
|
|
4
4
|
import { reactCssPropsToCss as E } from "./utlis/reactCssPropsToCss.es.js";
|
|
5
|
-
import { buttonNode as
|
|
5
|
+
import { buttonNode as b } from "./nodes/button.es.js";
|
|
6
6
|
import { linkNode as I } from "./nodes/link.es.js";
|
|
7
7
|
import { defaultNode as O } from "./nodes/default.es.js";
|
|
8
8
|
import { checkItemNode as A } from "./nodes/checkItemNode.es.js";
|
|
9
9
|
import { mentionHtmlNode as H } from "./nodes/mentionHtmlNode.es.js";
|
|
10
10
|
import { ELEMENT_BUTTON as v } from "../plugins/ButtonPlugin/createButtonPlugin.es.js";
|
|
11
|
-
const i = (
|
|
12
|
-
if (_(
|
|
13
|
-
return
|
|
14
|
-
const o = s[
|
|
11
|
+
const i = (t, e) => t.reduce((r, s) => (s.type === e && r++, s.children ? r + i(s.children, e) : r), 0), w = (t, e, { mappedMentionable: r, nestingCount: s = {} }) => {
|
|
12
|
+
if (_(t))
|
|
13
|
+
return h(t);
|
|
14
|
+
const o = s[t.type] || i([t], t.type);
|
|
15
15
|
let l = "";
|
|
16
|
-
for (const
|
|
17
|
-
l += w(
|
|
16
|
+
for (const m of t.children)
|
|
17
|
+
l += w(m, e, {
|
|
18
18
|
nestingCount: {
|
|
19
19
|
...s,
|
|
20
|
-
[
|
|
20
|
+
[m.type]: o
|
|
21
21
|
},
|
|
22
22
|
mappedMentionable: r
|
|
23
23
|
});
|
|
24
|
-
const
|
|
25
|
-
return typeof
|
|
26
|
-
classNames: c(
|
|
24
|
+
const a = x[t.type];
|
|
25
|
+
return typeof a < "u" ? a({
|
|
26
|
+
classNames: c(t.breakAfterColumn, t.align),
|
|
27
27
|
children: l,
|
|
28
28
|
rootNestingCount: o,
|
|
29
|
-
node:
|
|
29
|
+
node: t,
|
|
30
30
|
mappedMentionable: r,
|
|
31
|
-
styles:
|
|
31
|
+
styles: e
|
|
32
32
|
}) : O(
|
|
33
|
-
|
|
33
|
+
t,
|
|
34
34
|
l,
|
|
35
|
-
t
|
|
36
|
-
c(
|
|
35
|
+
e[t.type],
|
|
36
|
+
c(t.breakAfterColumn, t.align)
|
|
37
37
|
);
|
|
38
38
|
}, x = {
|
|
39
|
-
[
|
|
40
|
-
[n]: ({ classNames:
|
|
39
|
+
[d]: (t) => `<ul dir="auto" class="${u} ${t.classNames}">${t.children}</ul>`,
|
|
40
|
+
[n]: ({ classNames: t, children: e, node: r, rootNestingCount: s }) => {
|
|
41
41
|
const o = Math.max(s - i([r], n), 0);
|
|
42
|
-
return `<ol class="${
|
|
42
|
+
return `<ol dir="auto" class="${N(o)} ${t}" style="${E(
|
|
43
43
|
M
|
|
44
|
-
)}">${
|
|
44
|
+
)}">${e}</ol>`;
|
|
45
45
|
},
|
|
46
|
-
[
|
|
47
|
-
|
|
48
|
-
)}">${
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[v]: ({ node:
|
|
52
|
-
[T]: ({ node:
|
|
53
|
-
[
|
|
54
|
-
}, c = (
|
|
55
|
-
const r = "tw-break-words", s =
|
|
46
|
+
[g]: ({ classNames: t, children: e, node: r, styles: s }) => `<li dir="auto" class="${t} ${p}" style="${E(
|
|
47
|
+
f(r, s)
|
|
48
|
+
)}">${e}</li>`,
|
|
49
|
+
[k]: ({ classNames: t, children: e, node: r }) => `<p dir="auto" class="${t} ${L(r)}"><span>${e}</span></p>`,
|
|
50
|
+
[y]: ({ node: t, children: e, classNames: r, styles: s }) => I(t, e, r, s),
|
|
51
|
+
[v]: ({ node: t, children: e, classNames: r, styles: s }) => b(t, e, r, s),
|
|
52
|
+
[T]: ({ node: t, children: e, classNames: r, styles: s }) => A(t, e, r, s),
|
|
53
|
+
[S]: ({ node: t, mappedMentionable: e }) => H(t, { mentionable: e })
|
|
54
|
+
}, c = (t, e) => {
|
|
55
|
+
const r = "tw-break-words", s = t === "active" ? "tw-break-after-column tw-break-inside-avoid-column" : "", o = e ? C[e] : "";
|
|
56
56
|
return $([o, r, s]);
|
|
57
57
|
};
|
|
58
58
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeNodesToHtmlRecursive.es.js","sources":["../../../../src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_CHECK_ITEM,\n LI_CLASSNAMES,\n MappedMentionableItems,\n OL_STYLES,\n UL_CLASSES,\n alignmentClassnames,\n getLiStyles,\n getLicElementClassNames,\n getOrderedListClasses,\n merge,\n} from '@frontify/fondue';\nimport {\n ELEMENT_LI,\n ELEMENT_LIC,\n ELEMENT_LINK,\n ELEMENT_MENTION,\n ELEMENT_OL,\n ELEMENT_UL,\n TDescendant,\n TElement,\n isText,\n} from '@udecode/plate';\nimport { serializeLeafToHtml } from './utlis/serializeLeafToHtml';\nimport { reactCssPropsToCss } from './utlis/reactCssPropsToCss';\nimport type { CSSProperties } from 'react';\nimport { ButtonStylesType, buttonNode } from './nodes/button';\nimport { linkNode } from './nodes/link';\nimport { defaultNode } from './nodes/default';\nimport { checkItemNode } from './nodes/checkItemNode';\nimport { mentionHtmlNode } from './nodes/mentionHtmlNode';\nimport { ELEMENT_BUTTON } from '../plugins';\n\nconst countNodesOfType = (nodes: TDescendant[], type: string): number => {\n return nodes.reduce((acc, node) => {\n if (node.type === type) {\n acc++;\n }\n if (node.children) {\n return acc + countNodesOfType(node.children as TDescendant[], type);\n }\n return acc;\n }, 0);\n};\n\ntype NestingCount = {\n [type: string]: number;\n};\n\ntype SerializeNodeToHtmlRecursiveOptions = {\n mappedMentionable?: MappedMentionableItems;\n nestingCount?: NestingCount;\n};\n\nexport const serializeNodeToHtmlRecursive = (\n node: TDescendant,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }> | ButtonStylesType,\n { mappedMentionable, nestingCount = {} }: SerializeNodeToHtmlRecursiveOptions,\n): string => {\n if (isText(node)) {\n return serializeLeafToHtml(node);\n }\n\n const rootNestingCount = nestingCount[node.type] || countNodesOfType([node], node.type);\n let children = '';\n for (const element of node.children) {\n children += serializeNodeToHtmlRecursive(element, styles, {\n nestingCount: {\n ...nestingCount,\n [element.type as string]: rootNestingCount,\n },\n mappedMentionable,\n });\n }\n\n const htmlMapper = MapNodeTypesToHtml[node.type];\n if (typeof htmlMapper !== 'undefined') {\n return htmlMapper({\n classNames: getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined),\n children,\n rootNestingCount,\n node,\n mappedMentionable,\n styles,\n });\n } else {\n return defaultNode(\n node,\n children,\n styles[node.type],\n getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined),\n );\n }\n};\n\ntype Arguments = {\n classNames: string;\n children: string;\n rootNestingCount: number;\n node: TElement;\n mappedMentionable?: MappedMentionableItems;\n styles: Record<string, CSSProperties & { hover?: CSSProperties }> | ButtonStylesType;\n};\n\nconst MapNodeTypesToHtml: { [key: string]: ({ ...args }: Arguments) => string } = {\n [ELEMENT_UL]: (args) => `<ul class=\"${UL_CLASSES} ${args.classNames}\">${args.children}</ul>`,\n [ELEMENT_OL]: ({ classNames, children, node, rootNestingCount }) => {\n const nestingLevel = Math.max(rootNestingCount - countNodesOfType([node], ELEMENT_OL), 0);\n return `<ol class=\"${getOrderedListClasses(nestingLevel)} ${classNames}\" style=\"${reactCssPropsToCss(\n OL_STYLES,\n )}\">${children}</ol>`;\n },\n [ELEMENT_LI]: ({ classNames, children, node, styles }) =>\n `<li class=\"${classNames} ${LI_CLASSNAMES}\" style=\"${reactCssPropsToCss(\n getLiStyles(node, styles),\n )}\">${children}</li>`,\n [ELEMENT_LIC]: ({ classNames, children, node }) =>\n `<p class=\"${classNames} ${getLicElementClassNames(node)}\"><span>${children}</span></p>`,\n [ELEMENT_LINK]: ({ node, children, classNames, styles }) => linkNode(node, children, classNames, styles),\n [ELEMENT_BUTTON]: ({ node, children, classNames, styles }) =>\n buttonNode(node, children, classNames, styles as ButtonStylesType),\n [ELEMENT_CHECK_ITEM]: ({ node, children, classNames, styles }) => checkItemNode(node, children, classNames, styles),\n [ELEMENT_MENTION]: ({ node, mappedMentionable }) => mentionHtmlNode(node, { mentionable: mappedMentionable }),\n};\n\nconst getClassNames = (breakAfterColumn?: string, align?: string) => {\n const breakWordsClass = 'tw-break-words';\n const columnBreakClasses =\n breakAfterColumn === 'active' ? 'tw-break-after-column tw-break-inside-avoid-column' : '';\n const alignClass = align ? alignmentClassnames[align] : '';\n return merge([alignClass, breakWordsClass, columnBreakClasses]);\n};\n"],"names":["countNodesOfType","nodes","type","acc","node","serializeNodeToHtmlRecursive","styles","mappedMentionable","nestingCount","isText","serializeLeafToHtml","rootNestingCount","children","element","htmlMapper","MapNodeTypesToHtml","getClassNames","defaultNode","ELEMENT_UL","args","UL_CLASSES","ELEMENT_OL","classNames","nestingLevel","getOrderedListClasses","reactCssPropsToCss","OL_STYLES","ELEMENT_LI","LI_CLASSNAMES","getLiStyles","ELEMENT_LIC","getLicElementClassNames","ELEMENT_LINK","linkNode","ELEMENT_BUTTON","buttonNode","ELEMENT_CHECK_ITEM","checkItemNode","ELEMENT_MENTION","mentionHtmlNode","breakAfterColumn","align","breakWordsClass","columnBreakClasses","alignClass","alignmentClassnames","merge"],"mappings":";;;;;;;;;;AAmCA,MAAMA,IAAmB,CAACC,GAAsBC,MACrCD,EAAM,OAAO,CAACE,GAAKC,OAClBA,EAAK,SAASF,KACdC,KAEAC,EAAK,WACED,IAAMH,EAAiBI,EAAK,UAA2BF,CAAI,IAE/DC,IACR,CAAC,GAYKE,IAA+B,CACxCD,GACAE,GACA,EAAE,mBAAAC,GAAmB,cAAAC,IAAe,CAAA,QAC3B;AACL,MAAAC,EAAOL,CAAI;AACX,WAAOM,EAAoBN,CAAI;AAG7B,QAAAO,IAAmBH,EAAaJ,EAAK,IAAI,KAAKJ,EAAiB,CAACI,CAAI,GAAGA,EAAK,IAAI;AACtF,MAAIQ,IAAW;AACJ,aAAAC,KAAWT,EAAK;AACX,IAAAQ,KAAAP,EAA6BQ,GAASP,GAAQ;AAAA,MACtD,cAAc;AAAA,QACV,GAAGE;AAAA,QACH,CAACK,EAAQ,IAAc,GAAGF;AAAA,MAC9B;AAAA,MACA,mBAAAJ;AAAA,IAAA,CACH;AAGC,QAAAO,IAAaC,EAAmBX,EAAK,IAAI;AAC3C,SAAA,OAAOU,IAAe,MACfA,EAAW;AAAA,IACd,YAAYE,EAAcZ,EAAK,kBAAwCA,EAAK,KAA2B;AAAA,IACvG,UAAAQ;AAAA,IACA,kBAAAD;AAAA,IACA,MAAAP;AAAA,IACA,mBAAAG;AAAA,IACA,QAAAD;AAAA,EAAA,CACH,IAEMW;AAAA,IACHb;AAAA,IACAQ;AAAA,IACAN,EAAOF,EAAK,IAAI;AAAA,IAChBY,EAAcZ,EAAK,kBAAwCA,EAAK,KAA2B;AAAA,EAAA;AAGvG,GAWMW,IAA4E;AAAA,EAC9E,CAACG,CAAU,GAAG,CAACC,MAAS,
|
|
1
|
+
{"version":3,"file":"serializeNodesToHtmlRecursive.es.js","sources":["../../../../src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_CHECK_ITEM,\n LI_CLASSNAMES,\n MappedMentionableItems,\n OL_STYLES,\n UL_CLASSES,\n alignmentClassnames,\n getLiStyles,\n getLicElementClassNames,\n getOrderedListClasses,\n merge,\n} from '@frontify/fondue';\nimport {\n ELEMENT_LI,\n ELEMENT_LIC,\n ELEMENT_LINK,\n ELEMENT_MENTION,\n ELEMENT_OL,\n ELEMENT_UL,\n TDescendant,\n TElement,\n isText,\n} from '@udecode/plate';\nimport { serializeLeafToHtml } from './utlis/serializeLeafToHtml';\nimport { reactCssPropsToCss } from './utlis/reactCssPropsToCss';\nimport type { CSSProperties } from 'react';\nimport { ButtonStylesType, buttonNode } from './nodes/button';\nimport { linkNode } from './nodes/link';\nimport { defaultNode } from './nodes/default';\nimport { checkItemNode } from './nodes/checkItemNode';\nimport { mentionHtmlNode } from './nodes/mentionHtmlNode';\nimport { ELEMENT_BUTTON } from '../plugins';\n\nconst countNodesOfType = (nodes: TDescendant[], type: string): number => {\n return nodes.reduce((acc, node) => {\n if (node.type === type) {\n acc++;\n }\n if (node.children) {\n return acc + countNodesOfType(node.children as TDescendant[], type);\n }\n return acc;\n }, 0);\n};\n\ntype NestingCount = {\n [type: string]: number;\n};\n\ntype SerializeNodeToHtmlRecursiveOptions = {\n mappedMentionable?: MappedMentionableItems;\n nestingCount?: NestingCount;\n};\n\nexport const serializeNodeToHtmlRecursive = (\n node: TDescendant,\n styles: Record<string, CSSProperties & { hover?: CSSProperties }> | ButtonStylesType,\n { mappedMentionable, nestingCount = {} }: SerializeNodeToHtmlRecursiveOptions,\n): string => {\n if (isText(node)) {\n return serializeLeafToHtml(node);\n }\n\n const rootNestingCount = nestingCount[node.type] || countNodesOfType([node], node.type);\n let children = '';\n for (const element of node.children) {\n children += serializeNodeToHtmlRecursive(element, styles, {\n nestingCount: {\n ...nestingCount,\n [element.type as string]: rootNestingCount,\n },\n mappedMentionable,\n });\n }\n\n const htmlMapper = MapNodeTypesToHtml[node.type];\n if (typeof htmlMapper !== 'undefined') {\n return htmlMapper({\n classNames: getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined),\n children,\n rootNestingCount,\n node,\n mappedMentionable,\n styles,\n });\n } else {\n return defaultNode(\n node,\n children,\n styles[node.type],\n getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined),\n );\n }\n};\n\ntype Arguments = {\n classNames: string;\n children: string;\n rootNestingCount: number;\n node: TElement;\n mappedMentionable?: MappedMentionableItems;\n styles: Record<string, CSSProperties & { hover?: CSSProperties }> | ButtonStylesType;\n};\n\nconst MapNodeTypesToHtml: { [key: string]: ({ ...args }: Arguments) => string } = {\n [ELEMENT_UL]: (args) => `<ul dir=\"auto\" class=\"${UL_CLASSES} ${args.classNames}\">${args.children}</ul>`,\n [ELEMENT_OL]: ({ classNames, children, node, rootNestingCount }) => {\n const nestingLevel = Math.max(rootNestingCount - countNodesOfType([node], ELEMENT_OL), 0);\n return `<ol dir=\"auto\" class=\"${getOrderedListClasses(nestingLevel)} ${classNames}\" style=\"${reactCssPropsToCss(\n OL_STYLES,\n )}\">${children}</ol>`;\n },\n [ELEMENT_LI]: ({ classNames, children, node, styles }) =>\n `<li dir=\"auto\" class=\"${classNames} ${LI_CLASSNAMES}\" style=\"${reactCssPropsToCss(\n getLiStyles(node, styles),\n )}\">${children}</li>`,\n [ELEMENT_LIC]: ({ classNames, children, node }) =>\n `<p dir=\"auto\" class=\"${classNames} ${getLicElementClassNames(node)}\"><span>${children}</span></p>`,\n [ELEMENT_LINK]: ({ node, children, classNames, styles }) => linkNode(node, children, classNames, styles),\n [ELEMENT_BUTTON]: ({ node, children, classNames, styles }) =>\n buttonNode(node, children, classNames, styles as ButtonStylesType),\n [ELEMENT_CHECK_ITEM]: ({ node, children, classNames, styles }) => checkItemNode(node, children, classNames, styles),\n [ELEMENT_MENTION]: ({ node, mappedMentionable }) => mentionHtmlNode(node, { mentionable: mappedMentionable }),\n};\n\nconst getClassNames = (breakAfterColumn?: string, align?: string) => {\n const breakWordsClass = 'tw-break-words';\n const columnBreakClasses =\n breakAfterColumn === 'active' ? 'tw-break-after-column tw-break-inside-avoid-column' : '';\n const alignClass = align ? alignmentClassnames[align] : '';\n return merge([alignClass, breakWordsClass, columnBreakClasses]);\n};\n"],"names":["countNodesOfType","nodes","type","acc","node","serializeNodeToHtmlRecursive","styles","mappedMentionable","nestingCount","isText","serializeLeafToHtml","rootNestingCount","children","element","htmlMapper","MapNodeTypesToHtml","getClassNames","defaultNode","ELEMENT_UL","args","UL_CLASSES","ELEMENT_OL","classNames","nestingLevel","getOrderedListClasses","reactCssPropsToCss","OL_STYLES","ELEMENT_LI","LI_CLASSNAMES","getLiStyles","ELEMENT_LIC","getLicElementClassNames","ELEMENT_LINK","linkNode","ELEMENT_BUTTON","buttonNode","ELEMENT_CHECK_ITEM","checkItemNode","ELEMENT_MENTION","mentionHtmlNode","breakAfterColumn","align","breakWordsClass","columnBreakClasses","alignClass","alignmentClassnames","merge"],"mappings":"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"}
|