@frontify/fondue 12.0.0-beta.129 → 12.0.0-beta.130
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/Plugins/ListPlugin/ListItemContentMarkupElement.es.js +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.es.js +10 -6
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.es.js +6 -6
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/styles.css.es.js +5 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/styles.css.es.js.map +1 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.es.js +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/styles.css.es.js +5 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/styles.css.es.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/style.css.es.js +0 -5
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/style.css.es.js.map +0 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/style.css.es.js +0 -5
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/style.css.es.js.map +0 -1
package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.es.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getColumnBreakClasses as u } from "../ColumnBreakPlugin/utils/getColumn
|
|
|
7
7
|
import { MarkupElement as T } from "../MarkupElement.es.js";
|
|
8
8
|
import { justifyClassNames as x } from "../TextStylePlugin/TextStyles/alignment.es.js";
|
|
9
9
|
import { MARK_TEXT_STYLE as g } from "./ListPlugin.es.js";
|
|
10
|
-
import "./OrderedListPlugin/
|
|
10
|
+
import "./OrderedListPlugin/styles.css.es.js";
|
|
11
11
|
import { TextStyles as i } from "../TextStylePlugin/TextStyles/textStyles.es.js";
|
|
12
12
|
const C = (e) => {
|
|
13
13
|
const r = Object.values(i).find((t) => (e == null ? void 0 : e[g]) === t) ?? i.ELEMENT_PARAGRAPH;
|
package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemContentMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context/RichTextEditorContext';\nimport { TextStylesToDesignTokenMap } from '@components/RichTextEditor/types';\nimport { ELEMENT_LIC, PlateRenderElementProps, TNode } from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { getColumnBreakClasses } from '../ColumnBreakPlugin/utils/getColumnBreakClasses';\nimport { MarkupElement } from '../MarkupElement';\nimport { TextStyles } from '../TextStylePlugin';\nimport { justifyClassNames } from '../TextStylePlugin/TextStyles/alignment';\nimport { MARK_TEXT_STYLE } from './ListPlugin';\nimport './OrderedListPlugin/
|
|
1
|
+
{"version":3,"file":"ListItemContentMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context/RichTextEditorContext';\nimport { TextStylesToDesignTokenMap } from '@components/RichTextEditor/types';\nimport { ELEMENT_LIC, PlateRenderElementProps, TNode } from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { getColumnBreakClasses } from '../ColumnBreakPlugin/utils/getColumnBreakClasses';\nimport { MarkupElement } from '../MarkupElement';\nimport { TextStyles } from '../TextStylePlugin';\nimport { justifyClassNames } from '../TextStylePlugin/TextStyles/alignment';\nimport { MARK_TEXT_STYLE } from './ListPlugin';\nimport './OrderedListPlugin/styles.css';\n\nexport const getTextStyle = (styledNode: TNode) => {\n const textStyles =\n Object.values(TextStyles).find((textStyle) => styledNode?.[MARK_TEXT_STYLE] === textStyle) ??\n TextStyles.ELEMENT_PARAGRAPH;\n\n return TextStylesToDesignTokenMap[textStyles];\n};\n\nexport const ListItemContentMarkupElementNode = ({ attributes, children, element }: PlateRenderElementProps) => {\n const { designTokens } = useRichTextEditorContext();\n const align = element.align as string;\n const isEmpty = element.children.every((child) => child.text === '');\n\n return (\n <p\n className={merge([\n getColumnBreakClasses(element),\n align ? justifyClassNames[align] : 'tw-justify-start tw-flex',\n ])}\n {...attributes}\n >\n <span\n className={merge([\n isEmpty && 'tw-w-4',\n designTokens[getTextStyle(element.children[0])]?.textDecoration === 'underline' && 'tw-underline',\n ])}\n >\n {children}\n </span>\n </p>\n );\n};\n\nexport class ListItemContentMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_LIC, node = ListItemContentMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["getTextStyle","styledNode","textStyles","TextStyles","textStyle","MARK_TEXT_STYLE","TextStylesToDesignTokenMap","ListItemContentMarkupElementNode","attributes","children","element","designTokens","useRichTextEditorContext","align","isEmpty","child","React","merge","getColumnBreakClasses","justifyClassNames","_a","ListItemContentMarkupElement","MarkupElement","id","ELEMENT_LIC","node"],"mappings":";;;;;;;;;;;AAca,MAAAA,IAAe,CAACC,MAAsB;AAC/C,QAAMC,IACF,OAAO,OAAOC,CAAU,EAAE,KAAK,CAACC,OAAcH,KAAA,gBAAAA,EAAaI,QAAqBD,CAAS,KACzFD,EAAW;AAEf,SAAOG,EAA2BJ,CAAU;AAChD,GAEaK,IAAmC,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,SAAAC,QAAuC;;AACtG,QAAA,EAAE,cAAAC,MAAiBC,KACnBC,IAAQH,EAAQ,OAChBI,IAAUJ,EAAQ,SAAS,MAAM,CAACK,MAAUA,EAAM,SAAS,EAAE;AAG/D,SAAA,gBAAAC,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAM;AAAA,QACbC,EAAsBR,CAAO;AAAA,QAC7BG,IAAQM,EAAkBN,CAAK,IAAI;AAAA,MAAA,CACtC;AAAA,MACA,GAAGL;AAAA,IAAA;AAAA,IAEJ,gBAAAQ,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAWC,EAAM;AAAA,UACbH,KAAW;AAAA,YACXM,IAAAT,EAAaX,EAAaU,EAAQ,SAAS,CAAC,CAAC,CAAC,MAA9C,gBAAAU,EAAiD,oBAAmB,eAAe;AAAA,QAAA,CACtF;AAAA,MAAA;AAAA,MAEAX;AAAA,IACL;AAAA,EAAA;AAGZ;AAEO,MAAMY,UAAqCC,EAAc;AAAA,EAC5D,YAAYC,IAAKC,GAAaC,IAAOlB,GAAkC;AACnE,UAAMgB,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
|
@@ -4,16 +4,20 @@ import { merge as l } from "../../../../utilities/merge.es.js";
|
|
|
4
4
|
import a from "react";
|
|
5
5
|
import { MarkupElement as u } from "../MarkupElement.es.js";
|
|
6
6
|
import { getTextStyle as E } from "./ListItemContentMarkupElement.es.js";
|
|
7
|
-
import "./OrderedListPlugin/
|
|
8
|
-
const d = ({ attributes:
|
|
9
|
-
var
|
|
10
|
-
const { designTokens: s } = c(), i = (n = (
|
|
7
|
+
import "./OrderedListPlugin/styles.css.es.js";
|
|
8
|
+
const d = ({ attributes: m, children: t, element: r }) => {
|
|
9
|
+
var o, n;
|
|
10
|
+
const { designTokens: s } = c(), i = (n = (o = r.children[0]) == null ? void 0 : o.children) == null ? void 0 : n[0], e = s[E(i)];
|
|
11
11
|
return /* @__PURE__ */ a.createElement(
|
|
12
12
|
"li",
|
|
13
13
|
{
|
|
14
14
|
style: e,
|
|
15
|
-
...
|
|
16
|
-
className: l([
|
|
15
|
+
...m,
|
|
16
|
+
className: l([
|
|
17
|
+
(e == null ? void 0 : e.textTransform) === "uppercase" && "marker:tw-uppercase",
|
|
18
|
+
"!tw-no-underline",
|
|
19
|
+
"listElement"
|
|
20
|
+
])
|
|
17
21
|
},
|
|
18
22
|
t
|
|
19
23
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context/RichTextEditorContext';\nimport { ELEMENT_LI, PlateRenderElementProps, TDescendant } from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { MarkupElement } from '../MarkupElement';\nimport { getTextStyle } from './ListItemContentMarkupElement';\nimport './OrderedListPlugin/
|
|
1
|
+
{"version":3,"file":"ListItemMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context/RichTextEditorContext';\nimport { ELEMENT_LI, PlateRenderElementProps, TDescendant } from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { MarkupElement } from '../MarkupElement';\nimport { getTextStyle } from './ListItemContentMarkupElement';\nimport './OrderedListPlugin/styles.css';\n\nexport const ListItemMarkupElementNode = ({ attributes, children, element }: PlateRenderElementProps) => {\n const { designTokens } = useRichTextEditorContext();\n const licElement = (element.children[0]?.children as TDescendant[])?.[0];\n const tokenStyles = designTokens[getTextStyle(licElement)];\n\n return (\n <li\n style={tokenStyles}\n {...attributes}\n className={merge([\n tokenStyles?.textTransform === 'uppercase' && 'marker:tw-uppercase',\n '!tw-no-underline',\n 'listElement',\n ])}\n >\n {children}\n </li>\n );\n};\n\nexport class ListItemMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_LI, node = ListItemMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["ListItemMarkupElementNode","attributes","children","element","designTokens","useRichTextEditorContext","licElement","_b","_a","tokenStyles","getTextStyle","React","merge","ListItemMarkupElement","MarkupElement","id","ELEMENT_LI","node"],"mappings":";;;;;;;AAUO,MAAMA,IAA4B,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,SAAAC,QAAuC;;AAC/F,QAAA,EAAE,cAAAC,MAAiBC,KACnBC,KAAcC,KAAAC,IAAAL,EAAQ,SAAS,CAAC,MAAlB,gBAAAK,EAAqB,aAArB,gBAAAD,EAAkD,IAChEE,IAAcL,EAAaM,EAAaJ,CAAU,CAAC;AAGrD,SAAA,gBAAAK,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,OAAOF;AAAA,MACN,GAAGR;AAAA,MACJ,WAAWW,EAAM;AAAA,SACbH,KAAA,gBAAAA,EAAa,mBAAkB,eAAe;AAAA,QAC9C;AAAA,QACA;AAAA,MAAA,CACH;AAAA,IAAA;AAAA,IAEAP;AAAA,EAAA;AAGb;AAEO,MAAMW,UAA8BC,EAAc;AAAA,EACrD,YAAYC,IAAKC,GAAYC,IAAOjB,GAA2B;AAC3D,UAAMe,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { usePlateEditorRef as
|
|
1
|
+
import { usePlateEditorRef as c, ELEMENT_OL as n, findNodePath as l, getNodeAncestors as a } from "@udecode/plate";
|
|
2
2
|
import m from "react";
|
|
3
3
|
import { MarkupElement as p } from "../../MarkupElement.es.js";
|
|
4
|
-
import "./
|
|
4
|
+
import "./styles.css.es.js";
|
|
5
5
|
const i = ["decimal", "alpha", "roman"], d = (e, r) => {
|
|
6
|
-
const t =
|
|
6
|
+
const t = l(e, r);
|
|
7
7
|
if (!t)
|
|
8
8
|
return 0;
|
|
9
|
-
const o =
|
|
9
|
+
const o = a(e, t);
|
|
10
10
|
return Array.from(o).filter((s) => s[0].type === n).length;
|
|
11
11
|
}, u = (e) => `tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${i[e % 3]}`, E = ({
|
|
12
12
|
attributes: e,
|
|
13
13
|
children: r,
|
|
14
14
|
element: t
|
|
15
15
|
}) => {
|
|
16
|
-
const o =
|
|
17
|
-
return /* @__PURE__ */ m.createElement("ol", { className: u(s), ...e }, r);
|
|
16
|
+
const o = c(), s = d(o, t);
|
|
17
|
+
return /* @__PURE__ */ m.createElement("ol", { className: u(s), ...e, style: { counterReset: "count" } }, r);
|
|
18
18
|
};
|
|
19
19
|
class x extends p {
|
|
20
20
|
constructor(r = n, t = E) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_OL,\n PlateEditor,\n PlateRenderLeafProps,\n TElement,\n findNodePath,\n getNodeAncestors,\n usePlateEditorRef,\n} from '@udecode/plate';\nimport React from 'react';\nimport { MarkupElement } from '../../MarkupElement';\nimport './
|
|
1
|
+
{"version":3,"file":"OrderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_OL,\n PlateEditor,\n PlateRenderLeafProps,\n TElement,\n findNodePath,\n getNodeAncestors,\n usePlateEditorRef,\n} from '@udecode/plate';\nimport React from 'react';\nimport { MarkupElement } from '../../MarkupElement';\nimport './styles.css';\n\nconst LIST_TYPES = ['decimal', 'alpha', 'roman'];\n\nconst getNestingLevel = (editor: PlateEditor, element: TElement) => {\n const path = findNodePath(editor, element);\n if (!path) {\n return 0;\n }\n\n const nodeAncestors = getNodeAncestors(editor, path);\n return Array.from(nodeAncestors).filter((node) => node[0].type === ELEMENT_OL).length;\n};\n\nexport const getOrderedListClasses = (nestingLevel: number) =>\n `tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${LIST_TYPES[nestingLevel % 3]}`;\n\nexport const OrderedListMarkupElementNode = ({\n attributes,\n children,\n element,\n}: PlateRenderLeafProps & { element: TElement }) => {\n const editor = usePlateEditorRef();\n const nestingLevel = getNestingLevel(editor, element);\n\n return (\n <ol className={getOrderedListClasses(nestingLevel)} {...attributes} style={{ counterReset: 'count' }}>\n {children}\n </ol>\n );\n};\n\nexport class OrderedListMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_OL, node = OrderedListMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["LIST_TYPES","getNestingLevel","editor","element","path","findNodePath","nodeAncestors","getNodeAncestors","node","ELEMENT_OL","getOrderedListClasses","nestingLevel","OrderedListMarkupElementNode","attributes","children","usePlateEditorRef","React","OrderedListMarkupElement","MarkupElement","id"],"mappings":";;;;AAeA,MAAMA,IAAa,CAAC,WAAW,SAAS,OAAO,GAEzCC,IAAkB,CAACC,GAAqBC,MAAsB;AAC1D,QAAAC,IAAOC,EAAaH,GAAQC,CAAO;AACzC,MAAI,CAACC;AACM,WAAA;AAGL,QAAAE,IAAgBC,EAAiBL,GAAQE,CAAI;AACnD,SAAO,MAAM,KAAKE,CAAa,EAAE,OAAO,CAACE,MAASA,EAAK,CAAC,EAAE,SAASC,CAAU,EAAE;AACnF,GAEaC,IAAwB,CAACC,MAClC,uDAAuDX,EAAWW,IAAe,CAAC,KAEzEC,IAA+B,CAAC;AAAA,EACzC,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAX;AACJ,MAAoD;AAChD,QAAMD,IAASa,KACTJ,IAAeV,EAAgBC,GAAQC,CAAO;AAEpD,SACK,gBAAAa,EAAA,cAAA,MAAA,EAAG,WAAWN,EAAsBC,CAAY,GAAI,GAAGE,GAAY,OAAO,EAAE,cAAc,aACtFC,CACL;AAER;AAEO,MAAMG,UAAiCC,EAAc;AAAA,EACxD,YAAYC,IAAKV,GAAYD,IAAOI,GAA8B;AAC9D,UAAMO,GAAIX,CAAI;AAAA,EAClB;AACJ;"}
|
package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/styles.css.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "react";
|
|
2
2
|
import { ELEMENT_UL as m } from "@udecode/plate";
|
|
3
3
|
import { MarkupElement as p } from "../../MarkupElement.es.js";
|
|
4
|
-
import "./
|
|
4
|
+
import "./styles.css.es.js";
|
|
5
5
|
const n = "tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]", s = ({ attributes: e, children: t }) => /* @__PURE__ */ o.createElement("ul", { className: n, ...e }, t);
|
|
6
6
|
class i extends p {
|
|
7
7
|
constructor(t = m, r = s) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnorderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React from 'react';\nimport { ELEMENT_UL, PlateRenderLeafProps } from '@udecode/plate';\nimport { MarkupElement } from '../../MarkupElement';\nimport './
|
|
1
|
+
{"version":3,"file":"UnorderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React from 'react';\nimport { ELEMENT_UL, PlateRenderLeafProps } from '@udecode/plate';\nimport { MarkupElement } from '../../MarkupElement';\nimport './styles.css';\n\nexport const UL_CLASSES = 'tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]';\n\nexport const UnorderedListMarkupElementNode = ({ attributes, children }: PlateRenderLeafProps) => (\n <ul className={UL_CLASSES} {...attributes}>\n {children}\n </ul>\n);\n\nexport class UnorderedListMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_UL, node = UnorderedListMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["UL_CLASSES","UnorderedListMarkupElementNode","attributes","children","React","UnorderedListMarkupElement","MarkupElement","id","ELEMENT_UL","node"],"mappings":";;;;AAOO,MAAMA,IAAa,uDAEbC,IAAiC,CAAC,EAAE,YAAAC,GAAY,UAAAC,EAAS,MACjE,gBAAAC,EAAA,cAAA,MAAA,EAAG,WAAWJ,GAAa,GAAGE,EAAA,GAC1BC,CACL;AAGG,MAAME,UAAmCC,EAAc;AAAA,EAC1D,YAAYC,IAAKC,GAAYC,IAAOR,GAAgC;AAChE,UAAMM,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/styles.css.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -36,7 +36,7 @@ ${Y1("Shift+Ctrl+k")}`),active:r,onMouseDown:async o=>{c&&(o.preventDefault(),o.
|
|
|
36
36
|
color: var(--box-neutral-inverse-color-hover);
|
|
37
37
|
`]},wr0={renderAfterEditable:Lr0};class sH extends w0{constructor(l){super(rr0,{button:mr0,showIn:[e0.BOTTOM,e0.TOP],...l})}plugins(){return[s.createComboboxPlugin(),s.createEmojiPlugin(wr0)]}}const hr0="soft-break-plugin";class mH extends w0{constructor(l){super(hr0,{...l})}plugins(){return[s.createSoftBreakPlugin()]}}const fr0="italic-plugin",Q2="tw-italic",LH=({attributes:e,children:l})=>t.createElement("span",{...e,className:Q2},l);class dH extends m0{constructor(l=s.MARK_ITALIC,a=LH){super(l,a)}}const vr0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.MarkToolbarButton,{tooltip:C0(`Italic
|
|
38
38
|
${Y1("Ctrl+I")}`),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(Xe,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),gr0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class uH extends w0{constructor(l){super(fr0,{button:vr0,markupElement:new dH,...l})}plugins(){return[s.createItalicPlugin({deserializeHtml:{rules:[...gr0,{validNodeName:["SPAN"],validClassName:Q2}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Ar0=s.createComponentAs(e=>{var a;const l=s.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:s.createElementAs("div",l)}),Cr0=s.createComponentAs(e=>{var a;const l=Zr0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:s.createElementAs("div",l)});s.FloatingLink.EditRoot=Cr0;s.FloatingLink.InsertRoot=Ar0;const h2=s.FloatingLink,Er0=()=>{const e=s.useFloatingLinkUrlInput({}),{designTokens:l}=t0();return t.createElement("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]"},t.createElement("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between"},t.createElement("span",{style:l.link,className:"tw-pointer-events-none"},e.defaultValue),t.createElement("span",{className:"tw-flex tw-gap-2"},t.createElement("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"},t.createElement(h2.EditButton,null,t.createElement(M2,null))),t.createElement("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"},t.createElement(h2.UnlinkButton,null,t.createElement(x2,null))))))},J5=(e,l)=>{const a=s.getAboveNode(e,{match:{type:s.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},Mr0=e=>J5(e,l=>{var a,c;return((c=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:c.link)||""}),Ir0=e=>J5(e,l=>l.url||""),wH=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},xr0=e=>J5(e,wH),Zr0=({floatingOptions:e,...l})=>{const a=s.useEditorRef(),c=s.usePlateSelectors().keyEditor(),r=s.useFloatingLinkSelectors().mode(),o=s.useFloatingLinkSelectors().isOpen(a.id),{triggerFloatingLinkHotkeys:i="command+k, ctrl+k"}=s.getPluginOptions(a,s.ELEMENT_LINK),m=t.useCallback(()=>{const h=s.getAboveNode(a,{match:{type:s.getPluginType(a,s.ELEMENT_LINK)}});if(h){const[,g]=h;return s.getRangeBoundingClientRect(a,{anchor:s.getStartPoint(a,g),focus:s.getEndPoint(a,g)})}return s.getDefaultBoundingClientRect()},[a]),L=o&&r==="edit",{update:u,style:d,floating:w}=s.useVirtualFloatingLink({editorId:a.id,open:L,getBoundingClientRect:m,...e});return t.useEffect(()=>{const h=xr0(a);if(h&&s.floatingLinkActions.url(h),a.selection&&s.someNode(a,{match:{type:s.getPluginType(a,s.ELEMENT_LINK)}})){s.floatingLinkActions.show("edit",a.id),u();return}s.floatingLinkSelectors.mode()==="edit"&&s.floatingLinkActions.hide()},[a,c,u]),s.useHotkeys(i,h=>{h.preventDefault(),s.floatingLinkSelectors.mode()==="edit"&&s.triggerFloatingLinkEdit(a)},{enableOnContentEditable:!0},[]),s.useFloatingLinkEnter(),s.useFloatingLinkEscape(),{style:{...d,zIndex:1},...l,ref:s.useComposedRef(l.ref,w)}},Nr0={url:"",text:"",newTab:G.Unchecked},pr0=()=>{const[e,l]=t.useReducer((a,c)=>{const{type:r,payload:o}=c;switch(r){case"NEW_TAB":return{...a,newTab:G.Checked};case"SAME_TAB":return{...a,newTab:G.Unchecked};case"URL":case"TEXT":case"INIT":return{...a,...o};default:return a}},Nr0);return[e,l]},Sr0=()=>{const e=s.useEditorRef(),[l,a]=pr0();t.useEffect(()=>{const d=Mr0(e),w=Ir0(e);a({type:"INIT",payload:{text:s.floatingLinkSelectors.text(),newTab:s.floatingLinkSelectors.newTab()?G.Checked:G.Unchecked,url:d&&w===""?d:s.floatingLinkSelectors.url()}})},[a,e]);const c=d=>{a({type:"TEXT",payload:{text:d}})},r=d=>{a({type:"URL",payload:{url:d}})},o=d=>{a(d?{type:"NEW_TAB"}:{type:"SAME_TAB"})},i=()=>{s.floatingLinkActions.hide()},m=d=>{!u()||!L||(s.floatingLinkActions.text(l.text),s.floatingLinkActions.url(l.url),s.floatingLinkActions.newTab(l.newTab===G.Checked),s.submitFloatingLink(e)&&(d==null||d.preventDefault()))},L=l.url!==""&&l.text!=="",u=()=>{const{isUrl:d}=s.getPluginOptions(e,s.ELEMENT_LINK);return!l.url||d&&d(l.url)};return s.useHotkeys("enter",m,{enableOnTags:["INPUT"]},[]),{state:l,onTextChange:c,onUrlChange:r,onToggleTab:o,onCancel:i,onSave:m,hasValues:L,isValidUrlOrEmpty:u}},yr0=()=>t.createElement(tH,{...Sr0(),testId:"floating-link-insert"}),Rr0=({readOnly:e})=>{const l=s.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(yr0,null),c=l?a:t.createElement(Er0,null);return t.createElement(t.Fragment,null,t.createElement(h2.InsertRoot,null,a),t.createElement(h2.EditRoot,null,c))},kr0="link-plugin",Hr0=({id:e})=>t.createElement(u0,{id:e},t.createElement(s.LinkToolbarButton,{tooltip:C0(`Link
|
|
39
|
-
${Y1("Ctrl+K")}`),icon:t.createElement(f0,{icon:t.createElement(Te,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),zr0=e=>({...s.useElementProps({...e,elementToAttributes:a=>({href:wH(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),br0=e=>{const l=zr0(e),a=t0(),{attributes:c,children:r}=e;return t.createElement("a",{...c,href:l.href,target:l.target,style:a==null?void 0:a.designTokens.link},r)};class Tr0 extends m0{constructor(l=s.ELEMENT_LINK,a=br0){super(l,a)}}const hH=s.createPluginFactory({...s.createLinkPlugin(),renderAfterEditable:Rr0,options:{isUrl:Uk,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class fH extends w0{constructor(l){super(kr0,{button:Hr0,markupElement:new Tr0,...l})}plugins(){return[hH()]}}const Y2="list-plugin";const Vr0=["decimal","alpha","roman"],jr0=(e,l)=>{const a=s.findNodePath(e,l);if(!a)return 0;const c=s.getNodeAncestors(e,a);return Array.from(c).filter(r=>r[0].type===s.ELEMENT_OL).length},$5=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${Vr0[e%3]}`,vH=({attributes:e,children:l,element:a})=>{const c=s.usePlateEditorRef(),r=jr0(c,a);return t.createElement("ol",{className:$5(r),...e},l)};class gH extends m0{constructor(l=s.ELEMENT_OL,a=vH){super(l,a)}}const AH=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.ListToolbarButton,{tooltip:C0("Ordered list"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(De,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),CH="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",Dr0=`${CH} tw-break-after-column tw-break-inside-avoid-column`,T0=e=>{const l=e.breakAfterColumn;return f([l==="active"&&Dr0,l==="inactive"&&CH])},EH="text-style-plugin",MH=[N.ELEMENT_HEADING1,N.ELEMENT_HEADING2,N.ELEMENT_HEADING3,N.ELEMENT_HEADING4,N.ELEMENT_CUSTOM1,N.ELEMENT_CUSTOM2,N.ELEMENT_CUSTOM3,N.ELEMENT_QUOTE,N.ELEMENT_PARAGRAPH],Br0=e=>s.getAboveNode(e,{match:{type:s.ELEMENT_LI},mode:"lowest"}),Fr0=({editor:e,type:l,children:a})=>{const c=e!=null&&e.selection&&Br0(e)?s.getMark(e,k1)===l:s.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:f(["tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]",c?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:r=>{if(!e||!e.selection)return;s.getAboveNode(e,{match:{type:s.ELEMENT_LI},mode:"lowest"})?s.setMarks(e,{[k1]:l}):s.getPreventDefaultHandler(s.toggleNodeType,e,{activeType:l,inactiveType:l})(r)}},a)},Pr0=({label:e,open:l,onClick:a},c)=>t.createElement("button",{ref:c,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:s.getPreventDefaultHandler(a)},t.createElement("div",{className:f(["tw-relative tw-inline-flex tw-flex-row tw-items-center tw-justify-between tw-overflow-hidden tw-text-text tw-rounded tw-gap-1 tw-px-2 hover:tw-text-box-selected-inverse hover:tw-bg-box-selected tw-h-6 tw-w-28",l&&"tw-text-box-selected-inverse tw-bg-box-selected"])},t.createElement("span",{className:"tw-text-xs tw-truncate"},e),t.createElement("div",{className:f(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(Ne,null)))),Or0=t.forwardRef(Pr0),Ur0=e=>Array.isArray(e.children)?(e.children.find(a=>s.isText(a))??{})[k1]??N.ELEMENT_PARAGRAPH:N.ELEMENT_PARAGRAPH,Qr0=e=>!e||!e.selection?[]:Array.from(s.getNodeEntries(e,{unhang:!0,mode:"lowest",at:e.selection,reverse:!0,match:a=>s.isElement(a)&&s.isType(e,a,nc0)})).reduce((a,[c])=>{if(!s.isNode(c))return a;const r=c.type===s.ELEMENT_LIC?Ur0(c):c.type;return r&&!a.includes(r)&&a.push(r),a},[]),Yr0=6,Gr0=10,Wr0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=IR(e.elements.reference,e.rects.popper.height,Yr0+Gr0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${c}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},qr0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),m=s.usePlateEditorState(e),L=Qr0(m),u=L.length===1?lc0[L[0]]:ec0,d=t.useCallback(()=>{a(h=>!h)},[a]),w=b1.usePopper(c,o,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},Wr0]});return t.useEffect(()=>{const h=g=>{if(l){const v=g.target;if(o&&o.contains(v)||c&&c.contains(v))return;a(!1)}};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[l,o,a,c]),{state:{isOpen:l,toggle:d,editor:m},dropdownProps:{...w.attributes.popper,style:w.styles.popper},label:u,dropdownRef:i,triggerRef:r}},Kr0=({editorId:e,textStyles:l=MH})=>{const{designTokens:a}=t0(),{state:{editor:c,toggle:r,isOpen:o},dropdownProps:i,triggerRef:m,dropdownRef:L,label:u}=qr0(e);return t.createElement(t.Fragment,null,t.createElement(Or0,{label:u,open:o,onClick:r,ref:m}),o&&t.createElement("div",{className:"tw-divide-y tw-divide-line tw-bg-base tw-shadow-md tw-border tw-border-line tw-z-[1000] tw-overflow-auto tw-min-h-[40px]",ref:L,...i},l.map(d=>t.createElement(Fr0,{editor:c,type:d,key:d},t.createElement("span",{style:a[d]},pk[d])))))},Xr0=({editorId:e,id:l,textStyles:a})=>t.createElement(u0,{id:l},t.createElement(Kr0,{editorId:e,textStyles:a})),Jr0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),$r0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom1},a)},_r0=s.createPluginFactory({key:N.ELEMENT_CUSTOM1,isElement:!0,component:$r0,deserializeHtml:{rules:[{validClassName:"custom1"}]}}),eo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom2},a)},to0=s.createPluginFactory({key:N.ELEMENT_CUSTOM2,isElement:!0,component:eo0,deserializeHtml:{rules:[{validClassName:"custom2"}]}}),lo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom3},a)},no0=s.createPluginFactory({key:N.ELEMENT_CUSTOM3,isElement:!0,component:lo0,deserializeHtml:{rules:[{validClassName:"custom3"}]}}),ao0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h1",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading1},a)},co0=s.createPluginFactory({key:N.ELEMENT_HEADING1,isElement:!0,component:ao0,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}}),ro0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h2",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading2},a)},oo0=s.createPluginFactory({key:N.ELEMENT_HEADING2,isElement:!0,component:ro0,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}}),io0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h3",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading3},a)},so0=s.createPluginFactory({key:N.ELEMENT_HEADING3,isElement:!0,component:io0,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}}),mo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h4",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading4},a)},Lo0=s.createPluginFactory({key:N.ELEMENT_HEADING4,isElement:!0,component:mo0,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}}),do0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("blockquote",{...l,className:f([r&&b0[r],T0(e)]),style:c.quote},a)},uo0=s.createPluginFactory({key:N.ELEMENT_QUOTE,isElement:!0,component:do0,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}}),IH="tw-m-0 tw-px-0 tw-py-0",_5=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align,o=f([r&&b0[r],IH,T0(e)]);return t.createElement("p",{...l,className:o,style:c.p},a)};class xH extends m0{constructor(l=s.ELEMENT_PARAGRAPH,a=_5){super(l,a)}}const ZH=s.createPluginFactory({...s.createParagraphPlugin(),key:N.ELEMENT_PARAGRAPH,isElement:!0,component:_5}),wo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.imageCaption},a)},ho0=s.createPluginFactory({key:N.ELEMENT_IMAGE_CAPTION,isElement:!0,component:wo0,deserializeHtml:{rules:[{validClassName:"imageCaption"}]}}),fo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.imageTitle},a)},vo0=s.createPluginFactory({key:N.ELEMENT_IMAGE_TITLE,isElement:!0,component:fo0,deserializeHtml:{rules:[{validClassName:"imageTitle"}]}}),go0={[N.ELEMENT_HEADING1]:co0,[N.ELEMENT_HEADING2]:oo0,[N.ELEMENT_HEADING3]:so0,[N.ELEMENT_HEADING4]:Lo0,[N.ELEMENT_CUSTOM1]:_r0,[N.ELEMENT_CUSTOM2]:to0,[N.ELEMENT_CUSTOM3]:no0,[N.ELEMENT_IMAGE_TITLE]:vo0,[N.ELEMENT_IMAGE_CAPTION]:ho0,[N.ELEMENT_QUOTE]:uo0,[N.ELEMENT_PARAGRAPH]:ZH},Ao0=e=>e.map(l=>go0[l]());class NH extends w0{constructor({textStyles:l=MH,...a}={}){super(EH,{button:Jr0(Xr0,l),textStyles:l,...a})}plugins(){var l;return Ao0(((l=this.props)==null?void 0:l.textStyles)??[])}}const f2=e=>{const l=Object.values(N).find(a=>(e==null?void 0:e[k1])===a)??N.ELEMENT_PARAGRAPH;return ac0[l]},Co0=({attributes:e,children:l,element:a})=>{var i;const{designTokens:c}=t0(),r=a.align,o=a.children.every(m=>m.text==="");return t.createElement("p",{className:f([T0(a),r?Sk[r]:"tw-justify-start tw-flex"]),...e},t.createElement("span",{className:f([o&&"tw-w-4",((i=c[f2(a.children[0])])==null?void 0:i.textDecoration)==="underline"&&"tw-underline"])},l))};class Eo0 extends m0{constructor(l=s.ELEMENT_LIC,a=Co0){super(l,a)}}const Mo0=({attributes:e,children:l,element:a})=>{var i,m;const{designTokens:c}=t0(),r=(m=(i=a.children[0])==null?void 0:i.children)==null?void 0:m[0],o=c[f2(r)];return t.createElement("li",{style:o,...e,className:f([(o==null?void 0:o.textTransform)==="uppercase"&&"marker:tw-uppercase","!tw-no-underline"])},l)};class Io0 extends m0{constructor(l=s.ELEMENT_LI,a=Mo0){super(l,a)}}const xo0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:c,deleteBackward:r,deleteForward:o,deleteFragment:i}=e;return a?e.insertSoftBreak=()=>{s.insertBreakList(e)||c()}:e.insertBreak=()=>{s.insertBreakList(e)||c()},e.deleteBackward=m=>{s.deleteBackwardList(e,m)||r(m)},e.deleteForward=m=>{s.deleteForwardList(e)||o(m)},e.deleteFragment=m=>{s.deleteFragmentList(e)||i(m)},e.insertFragment=s.insertFragmentList(e),e.normalizeNode=s.normalizeList(e,{validLiChildrenTypes:l}),e},k1="textStyle",Zo0=s.createPluginFactory({key:k1,isLeaf:!0});class pH extends w0{constructor(a){super(Y2,{leafMarkupElements:[new Eo0,new Io0],...a});n0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[s.createListPlugin({withOverrides:xo0,options:{isSoftBreak:this.isSoftBreak}}),Zo0()]}}class SH extends pH{constructor(l){super({id:Y2,button:AH,markupElement:new gH,...l})}}const et="tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",yH=({attributes:e,children:l})=>t.createElement("ul",{className:et,...e},l);class RH extends m0{constructor(l=s.ELEMENT_UL,a=yH){super(l,a)}}const kH=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.ListToolbarButton,{tooltip:C0("Bullet list"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(Ve,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"}));class HH extends pH{constructor(l){super({id:Y2,button:kH,markupElement:new RH,...l})}}const No0="paragraph-plugin";class zH extends w0{constructor(l){super(No0,{markupElement:new xH,...l})}plugins(){return[ZH()]}}class po0{constructor(){n0(this,"toolbarButtons",{[e0.BOTTOM]:[],[e0.FLOATING]:[],[e0.TOP]:[]})}createGroupOfButtons(l){const a=[],c=[],r=[];for(const{markupElement:o,button:i,id:m,showIn:L}of l){if(!i)continue;const u={id:(o==null?void 0:o.getId())||m,button:i};L.includes(e0.BOTTOM)&&a.push(u),L.includes(e0.TOP)&&c.push(u),L.includes(e0.FLOATING)&&r.push(u)}a.length>0&&this.toolbarButtons[e0.BOTTOM].push(a),c.length>0&&this.toolbarButtons[e0.TOP].push(c),r.length>0&&this.toolbarButtons[e0.FLOATING].push(r)}at(l){return this.toolbarButtons[l]}}class bH{constructor(l){n0(this,"platePlugins",new Map);n0(this,"markupElements",{});n0(this,"inlineElements",[]);n0(this,"toolbarButtons",new po0);this.props=l}setPlugin(...l){for(const a of l){const c=Array.isArray(a)?a:[a];for(const r of c)this.addElement(r.markupElement),this.addElement(r.markupInputElement),this.addLeafElements(r.leafMarkupElements),this.addPlugin(r),this.addInline(r.inline());this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(c)}return this}addLeafElements(l){if(l===void 0)return;const a=Array.isArray(l)?l:[l];for(const c of a)this.addElement(c)}addElement(l){if(l===void 0)return;const a=l.getId(),c=l.getNode();c&&!this.markupElements[a]&&(this.markupElements[a]=c)}addPlugin(l){l.id&&!this.platePlugins.has(l.id)&&this.platePlugins.set(l.id,l.plugins())}addInline(l){l&&this.inlineElements.push(l)}get elements(){return{...this.defaultElementsFromPlugins,...this.markupElements}}get defaultElementsFromPlugins(){const l={};for(const a of this.platePlugins.values())for(const c of a){const{key:r,component:o}=c;o&&(l[r]=o)}return l}get plugins(){const l=[];for(const a of this.platePlugins.values())l.push(...a);return l}get buttons(){return this.toolbarButtons}get inline(){return this.inlineElements}get hasToolbar(){var l;return!((l=this.props)!=null&&l.noToolbar)}}const TH="reset-formatting-plugin",VH="reset-formatting",So0=e=>{!e||!e.selection||(s.removeMark(e,{key:[s.MARK_BOLD,s.MARK_ITALIC,s.MARK_CODE,s.MARK_UNDERLINE,s.MARK_STRIKETHROUGH]}),s.unwrapList(e,{}),s.setElements(e,{type:s.ELEMENT_PARAGRAPH,align:void 0}))},yo0=s.withPlateProvider(({id:e,...l})=>{const a=s.usePlateEditorState(s.useEventPlateId(e));return t.createElement(s.ToolbarButton,{tooltip:C0("Clear formatting"),onMouseDown:()=>{So0(a)},...l})}),Ro0=({id:e})=>t.createElement(u0,{id:e},t.createElement(yo0,{icon:t.createElement(f0,{icon:t.createElement(He,null)}),classNames:s0,styles:v0})),jH=s.createPluginFactory({key:VH,isElement:!1});class DH extends w0{constructor(l){super(TH,{button:Ro0,...l})}plugins(){return[jH()]}}const ko0="strikethrough-plugin",tt="tw-line-through",BH=({attributes:e,children:l})=>t.createElement("span",{...e,className:tt},l);class FH extends m0{constructor(l=s.MARK_STRIKETHROUGH,a=BH){super(l,a)}}const Ho0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.MarkToolbarButton,{tooltip:C0("Strikethrough"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(mS,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"}));class PH extends w0{constructor(l){super(ko0,{button:Ho0,markupElement:new FH,...l})}plugins(){return[s.createStrikethroughPlugin()]}}const zo0="underline-plugin",G2="tw-underline",OH=({attributes:e,children:l})=>t.createElement("span",{...e,className:G2},l);class UH extends m0{constructor(l=s.MARK_UNDERLINE,a=OH){super(l,a)}}const bo0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.MarkToolbarButton,{tooltip:C0(`Underline
|
|
39
|
+
${Y1("Ctrl+K")}`),icon:t.createElement(f0,{icon:t.createElement(Te,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),zr0=e=>({...s.useElementProps({...e,elementToAttributes:a=>({href:wH(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),br0=e=>{const l=zr0(e),a=t0(),{attributes:c,children:r}=e;return t.createElement("a",{...c,href:l.href,target:l.target,style:a==null?void 0:a.designTokens.link},r)};class Tr0 extends m0{constructor(l=s.ELEMENT_LINK,a=br0){super(l,a)}}const hH=s.createPluginFactory({...s.createLinkPlugin(),renderAfterEditable:Rr0,options:{isUrl:Uk,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class fH extends w0{constructor(l){super(kr0,{button:Hr0,markupElement:new Tr0,...l})}plugins(){return[hH()]}}const Y2="list-plugin";const Vr0=["decimal","alpha","roman"],jr0=(e,l)=>{const a=s.findNodePath(e,l);if(!a)return 0;const c=s.getNodeAncestors(e,a);return Array.from(c).filter(r=>r[0].type===s.ELEMENT_OL).length},$5=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${Vr0[e%3]}`,vH=({attributes:e,children:l,element:a})=>{const c=s.usePlateEditorRef(),r=jr0(c,a);return t.createElement("ol",{className:$5(r),...e,style:{counterReset:"count"}},l)};class gH extends m0{constructor(l=s.ELEMENT_OL,a=vH){super(l,a)}}const AH=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.ListToolbarButton,{tooltip:C0("Ordered list"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(De,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),CH="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",Dr0=`${CH} tw-break-after-column tw-break-inside-avoid-column`,T0=e=>{const l=e.breakAfterColumn;return f([l==="active"&&Dr0,l==="inactive"&&CH])},EH="text-style-plugin",MH=[N.ELEMENT_HEADING1,N.ELEMENT_HEADING2,N.ELEMENT_HEADING3,N.ELEMENT_HEADING4,N.ELEMENT_CUSTOM1,N.ELEMENT_CUSTOM2,N.ELEMENT_CUSTOM3,N.ELEMENT_QUOTE,N.ELEMENT_PARAGRAPH],Br0=e=>s.getAboveNode(e,{match:{type:s.ELEMENT_LI},mode:"lowest"}),Fr0=({editor:e,type:l,children:a})=>{const c=e!=null&&e.selection&&Br0(e)?s.getMark(e,k1)===l:s.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:f(["tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]",c?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:r=>{if(!e||!e.selection)return;s.getAboveNode(e,{match:{type:s.ELEMENT_LI},mode:"lowest"})?s.setMarks(e,{[k1]:l}):s.getPreventDefaultHandler(s.toggleNodeType,e,{activeType:l,inactiveType:l})(r)}},a)},Pr0=({label:e,open:l,onClick:a},c)=>t.createElement("button",{ref:c,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:s.getPreventDefaultHandler(a)},t.createElement("div",{className:f(["tw-relative tw-inline-flex tw-flex-row tw-items-center tw-justify-between tw-overflow-hidden tw-text-text tw-rounded tw-gap-1 tw-px-2 hover:tw-text-box-selected-inverse hover:tw-bg-box-selected tw-h-6 tw-w-28",l&&"tw-text-box-selected-inverse tw-bg-box-selected"])},t.createElement("span",{className:"tw-text-xs tw-truncate"},e),t.createElement("div",{className:f(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(Ne,null)))),Or0=t.forwardRef(Pr0),Ur0=e=>Array.isArray(e.children)?(e.children.find(a=>s.isText(a))??{})[k1]??N.ELEMENT_PARAGRAPH:N.ELEMENT_PARAGRAPH,Qr0=e=>!e||!e.selection?[]:Array.from(s.getNodeEntries(e,{unhang:!0,mode:"lowest",at:e.selection,reverse:!0,match:a=>s.isElement(a)&&s.isType(e,a,nc0)})).reduce((a,[c])=>{if(!s.isNode(c))return a;const r=c.type===s.ELEMENT_LIC?Ur0(c):c.type;return r&&!a.includes(r)&&a.push(r),a},[]),Yr0=6,Gr0=10,Wr0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=IR(e.elements.reference,e.rects.popper.height,Yr0+Gr0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${c}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},qr0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),m=s.usePlateEditorState(e),L=Qr0(m),u=L.length===1?lc0[L[0]]:ec0,d=t.useCallback(()=>{a(h=>!h)},[a]),w=b1.usePopper(c,o,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},Wr0]});return t.useEffect(()=>{const h=g=>{if(l){const v=g.target;if(o&&o.contains(v)||c&&c.contains(v))return;a(!1)}};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[l,o,a,c]),{state:{isOpen:l,toggle:d,editor:m},dropdownProps:{...w.attributes.popper,style:w.styles.popper},label:u,dropdownRef:i,triggerRef:r}},Kr0=({editorId:e,textStyles:l=MH})=>{const{designTokens:a}=t0(),{state:{editor:c,toggle:r,isOpen:o},dropdownProps:i,triggerRef:m,dropdownRef:L,label:u}=qr0(e);return t.createElement(t.Fragment,null,t.createElement(Or0,{label:u,open:o,onClick:r,ref:m}),o&&t.createElement("div",{className:"tw-divide-y tw-divide-line tw-bg-base tw-shadow-md tw-border tw-border-line tw-z-[1000] tw-overflow-auto tw-min-h-[40px]",ref:L,...i},l.map(d=>t.createElement(Fr0,{editor:c,type:d,key:d},t.createElement("span",{style:a[d]},pk[d])))))},Xr0=({editorId:e,id:l,textStyles:a})=>t.createElement(u0,{id:l},t.createElement(Kr0,{editorId:e,textStyles:a})),Jr0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),$r0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom1},a)},_r0=s.createPluginFactory({key:N.ELEMENT_CUSTOM1,isElement:!0,component:$r0,deserializeHtml:{rules:[{validClassName:"custom1"}]}}),eo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom2},a)},to0=s.createPluginFactory({key:N.ELEMENT_CUSTOM2,isElement:!0,component:eo0,deserializeHtml:{rules:[{validClassName:"custom2"}]}}),lo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.custom3},a)},no0=s.createPluginFactory({key:N.ELEMENT_CUSTOM3,isElement:!0,component:lo0,deserializeHtml:{rules:[{validClassName:"custom3"}]}}),ao0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h1",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading1},a)},co0=s.createPluginFactory({key:N.ELEMENT_HEADING1,isElement:!0,component:ao0,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}}),ro0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h2",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading2},a)},oo0=s.createPluginFactory({key:N.ELEMENT_HEADING2,isElement:!0,component:ro0,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}}),io0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h3",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading3},a)},so0=s.createPluginFactory({key:N.ELEMENT_HEADING3,isElement:!0,component:io0,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}}),mo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("h4",{...l,className:f([r&&b0[r],T0(e)]),style:c.heading4},a)},Lo0=s.createPluginFactory({key:N.ELEMENT_HEADING4,isElement:!0,component:mo0,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}}),do0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("blockquote",{...l,className:f([r&&b0[r],T0(e)]),style:c.quote},a)},uo0=s.createPluginFactory({key:N.ELEMENT_QUOTE,isElement:!0,component:do0,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}}),IH="tw-m-0 tw-px-0 tw-py-0",_5=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align,o=f([r&&b0[r],IH,T0(e)]);return t.createElement("p",{...l,className:o,style:c.p},a)};class xH extends m0{constructor(l=s.ELEMENT_PARAGRAPH,a=_5){super(l,a)}}const ZH=s.createPluginFactory({...s.createParagraphPlugin(),key:N.ELEMENT_PARAGRAPH,isElement:!0,component:_5}),wo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.imageCaption},a)},ho0=s.createPluginFactory({key:N.ELEMENT_IMAGE_CAPTION,isElement:!0,component:wo0,deserializeHtml:{rules:[{validClassName:"imageCaption"}]}}),fo0=({element:e,attributes:l,children:a})=>{const{designTokens:c}=t0(),r=e.align;return t.createElement("p",{...l,className:f([r&&b0[r],T0(e)]),style:c.imageTitle},a)},vo0=s.createPluginFactory({key:N.ELEMENT_IMAGE_TITLE,isElement:!0,component:fo0,deserializeHtml:{rules:[{validClassName:"imageTitle"}]}}),go0={[N.ELEMENT_HEADING1]:co0,[N.ELEMENT_HEADING2]:oo0,[N.ELEMENT_HEADING3]:so0,[N.ELEMENT_HEADING4]:Lo0,[N.ELEMENT_CUSTOM1]:_r0,[N.ELEMENT_CUSTOM2]:to0,[N.ELEMENT_CUSTOM3]:no0,[N.ELEMENT_IMAGE_TITLE]:vo0,[N.ELEMENT_IMAGE_CAPTION]:ho0,[N.ELEMENT_QUOTE]:uo0,[N.ELEMENT_PARAGRAPH]:ZH},Ao0=e=>e.map(l=>go0[l]());class NH extends w0{constructor({textStyles:l=MH,...a}={}){super(EH,{button:Jr0(Xr0,l),textStyles:l,...a})}plugins(){var l;return Ao0(((l=this.props)==null?void 0:l.textStyles)??[])}}const f2=e=>{const l=Object.values(N).find(a=>(e==null?void 0:e[k1])===a)??N.ELEMENT_PARAGRAPH;return ac0[l]},Co0=({attributes:e,children:l,element:a})=>{var i;const{designTokens:c}=t0(),r=a.align,o=a.children.every(m=>m.text==="");return t.createElement("p",{className:f([T0(a),r?Sk[r]:"tw-justify-start tw-flex"]),...e},t.createElement("span",{className:f([o&&"tw-w-4",((i=c[f2(a.children[0])])==null?void 0:i.textDecoration)==="underline"&&"tw-underline"])},l))};class Eo0 extends m0{constructor(l=s.ELEMENT_LIC,a=Co0){super(l,a)}}const Mo0=({attributes:e,children:l,element:a})=>{var i,m;const{designTokens:c}=t0(),r=(m=(i=a.children[0])==null?void 0:i.children)==null?void 0:m[0],o=c[f2(r)];return t.createElement("li",{style:o,...e,className:f([(o==null?void 0:o.textTransform)==="uppercase"&&"marker:tw-uppercase","!tw-no-underline","listElement"])},l)};class Io0 extends m0{constructor(l=s.ELEMENT_LI,a=Mo0){super(l,a)}}const xo0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:c,deleteBackward:r,deleteForward:o,deleteFragment:i}=e;return a?e.insertSoftBreak=()=>{s.insertBreakList(e)||c()}:e.insertBreak=()=>{s.insertBreakList(e)||c()},e.deleteBackward=m=>{s.deleteBackwardList(e,m)||r(m)},e.deleteForward=m=>{s.deleteForwardList(e)||o(m)},e.deleteFragment=m=>{s.deleteFragmentList(e)||i(m)},e.insertFragment=s.insertFragmentList(e),e.normalizeNode=s.normalizeList(e,{validLiChildrenTypes:l}),e},k1="textStyle",Zo0=s.createPluginFactory({key:k1,isLeaf:!0});class pH extends w0{constructor(a){super(Y2,{leafMarkupElements:[new Eo0,new Io0],...a});n0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[s.createListPlugin({withOverrides:xo0,options:{isSoftBreak:this.isSoftBreak}}),Zo0()]}}class SH extends pH{constructor(l){super({id:Y2,button:AH,markupElement:new gH,...l})}}const et="tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",yH=({attributes:e,children:l})=>t.createElement("ul",{className:et,...e},l);class RH extends m0{constructor(l=s.ELEMENT_UL,a=yH){super(l,a)}}const kH=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.ListToolbarButton,{tooltip:C0("Bullet list"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(Ve,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"}));class HH extends pH{constructor(l){super({id:Y2,button:kH,markupElement:new RH,...l})}}const No0="paragraph-plugin";class zH extends w0{constructor(l){super(No0,{markupElement:new xH,...l})}plugins(){return[ZH()]}}class po0{constructor(){n0(this,"toolbarButtons",{[e0.BOTTOM]:[],[e0.FLOATING]:[],[e0.TOP]:[]})}createGroupOfButtons(l){const a=[],c=[],r=[];for(const{markupElement:o,button:i,id:m,showIn:L}of l){if(!i)continue;const u={id:(o==null?void 0:o.getId())||m,button:i};L.includes(e0.BOTTOM)&&a.push(u),L.includes(e0.TOP)&&c.push(u),L.includes(e0.FLOATING)&&r.push(u)}a.length>0&&this.toolbarButtons[e0.BOTTOM].push(a),c.length>0&&this.toolbarButtons[e0.TOP].push(c),r.length>0&&this.toolbarButtons[e0.FLOATING].push(r)}at(l){return this.toolbarButtons[l]}}class bH{constructor(l){n0(this,"platePlugins",new Map);n0(this,"markupElements",{});n0(this,"inlineElements",[]);n0(this,"toolbarButtons",new po0);this.props=l}setPlugin(...l){for(const a of l){const c=Array.isArray(a)?a:[a];for(const r of c)this.addElement(r.markupElement),this.addElement(r.markupInputElement),this.addLeafElements(r.leafMarkupElements),this.addPlugin(r),this.addInline(r.inline());this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(c)}return this}addLeafElements(l){if(l===void 0)return;const a=Array.isArray(l)?l:[l];for(const c of a)this.addElement(c)}addElement(l){if(l===void 0)return;const a=l.getId(),c=l.getNode();c&&!this.markupElements[a]&&(this.markupElements[a]=c)}addPlugin(l){l.id&&!this.platePlugins.has(l.id)&&this.platePlugins.set(l.id,l.plugins())}addInline(l){l&&this.inlineElements.push(l)}get elements(){return{...this.defaultElementsFromPlugins,...this.markupElements}}get defaultElementsFromPlugins(){const l={};for(const a of this.platePlugins.values())for(const c of a){const{key:r,component:o}=c;o&&(l[r]=o)}return l}get plugins(){const l=[];for(const a of this.platePlugins.values())l.push(...a);return l}get buttons(){return this.toolbarButtons}get inline(){return this.inlineElements}get hasToolbar(){var l;return!((l=this.props)!=null&&l.noToolbar)}}const TH="reset-formatting-plugin",VH="reset-formatting",So0=e=>{!e||!e.selection||(s.removeMark(e,{key:[s.MARK_BOLD,s.MARK_ITALIC,s.MARK_CODE,s.MARK_UNDERLINE,s.MARK_STRIKETHROUGH]}),s.unwrapList(e,{}),s.setElements(e,{type:s.ELEMENT_PARAGRAPH,align:void 0}))},yo0=s.withPlateProvider(({id:e,...l})=>{const a=s.usePlateEditorState(s.useEventPlateId(e));return t.createElement(s.ToolbarButton,{tooltip:C0("Clear formatting"),onMouseDown:()=>{So0(a)},...l})}),Ro0=({id:e})=>t.createElement(u0,{id:e},t.createElement(yo0,{icon:t.createElement(f0,{icon:t.createElement(He,null)}),classNames:s0,styles:v0})),jH=s.createPluginFactory({key:VH,isElement:!1});class DH extends w0{constructor(l){super(TH,{button:Ro0,...l})}plugins(){return[jH()]}}const ko0="strikethrough-plugin",tt="tw-line-through",BH=({attributes:e,children:l})=>t.createElement("span",{...e,className:tt},l);class FH extends m0{constructor(l=s.MARK_STRIKETHROUGH,a=BH){super(l,a)}}const Ho0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.MarkToolbarButton,{tooltip:C0("Strikethrough"),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(mS,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"}));class PH extends w0{constructor(l){super(ko0,{button:Ho0,markupElement:new FH,...l})}plugins(){return[s.createStrikethroughPlugin()]}}const zo0="underline-plugin",G2="tw-underline",OH=({attributes:e,children:l})=>t.createElement("span",{...e,className:G2},l);class UH extends m0{constructor(l=s.MARK_UNDERLINE,a=OH){super(l,a)}}const bo0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(s.MarkToolbarButton,{tooltip:C0(`Underline
|
|
40
40
|
${Y1("Ctrl+U")}`),type:s.getPluginType(e,l),icon:t.createElement(f0,{icon:t.createElement(Je,null)}),classNames:s0,styles:v0,actionHandler:"onMouseDown"})),To0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class QH extends w0{constructor(l){super(zo0,{button:bo0,markupElement:new UH,...l})}plugins(){return[s.createUnderlinePlugin({deserializeHtml:{rules:[...To0,{validNodeName:["SPAN"],validClassName:G2}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const YH=e=>Array.from(s.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,H1=(e,{key:l=I1,value:a,at:c})=>{const r=o=>J1.isBlock(e,o);a?J1.setElements(e,{[l]:a},{mode:"lowest",match:r,at:c}):J1.unsetNodes(e,l,{match:r,mode:"lowest",at:c})},Vo0=(e,l,a)=>{H1(e,{at:l,value:a})},fe=(e,l)=>{const a=Array.from(s.getNodeEntries(e,{at:[],match:c=>!!c.breakAfterColumn}));for(const[c,[,r]]of a.entries())Vo0(e,r,c<l-1?"active":"inactive")},GH=(e,l,a)=>{if(!!(e!=null&&e.selection)&&s.someNode(e,{match:r=>!!r.breakAfterColumn}))H1(e,{value:void 0});else{const r=YH(e),o=Math.max(l-r-1,0);if(o===0)return;const i=Array.from(s.getNodeEntries(e,{at:e.selection,match:m=>s.isBlock(e,m),mode:"lowest"})).slice(-o);s.getPreventDefaultHandler(()=>{for(const m of i)H1(e,{value:"active",at:m[1]})})(a)}fe(e,l)},jo0=e=>l=>{var a;if(!l.defaultPrevented&&Qz("shift+ctrl+enter",l)){const c=e.plugins.find(o=>o.key===I1),r=((a=c==null?void 0:c.options)==null?void 0:a.columns)??1;GH(e,r,l)}},Do0=({id:e,...l})=>{var L;const a=s.usePlateEditorState(s.useEventPlateId(e)),c=!!(a!=null&&a.selection)&&s.someNode(a,{match:u=>!!u.breakAfterColumn}),r=a.pluginsByKey.breakAfterColumn,o=(L=r==null?void 0:r.options)==null?void 0:L.columns,i=Number(o)||1,m=Bo0(a,i,c);return t.createElement(s.ToolbarButton,{active:c,tooltip:C0(m?`Column Break
|
|
41
41
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:u=>GH(a,i,u),...l,classNames:{root:`${s0.root} ${m?"":"!tw-cursor-not-allowed !tw-opacity-50"}`,active:s0.active}})},Bo0=(e,l,a)=>YH(e)+1<l||a,WH=({id:e})=>t.createElement(u0,{id:e},t.createElement(Do0,{icon:t.createElement(f0,{icon:t.createElement(qe,null)}),classNames:s0,styles:v0})),Fo0=(e,l)=>{const a=s.getStartPoint(e,l);setTimeout(()=>{s.select(e,{anchor:a,focus:a})})},Po0=e=>{var a;const l=e.plugins.find(c=>c.key===I1);return((a=l==null?void 0:l.options)==null?void 0:a.columns)??1},Oo0=e=>{const{apply:l}=e,a=Po0(e);e.apply=c=>{switch(c.type){case"split_node":c.properties={...c.properties,breakAfterColumn:void 0};break;case"merge_node":const r=s.getPointBefore(e,c.path);if(!r)break;const o=s.getParentNode(e,r.path);if(H1(e,{at:r,value:void 0}),fe(e,a),o!=null&&o[0].breakAfterColumn)return Fo0(e,c.path),e;break}l(c)},setTimeout(()=>fe(e,a))},I1="breakAfterColumn",lt="normal";class Uo0 extends w0{constructor(a){super("break-after-plugin",{button:WH,...a});n0(this,"columns");n0(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??lt}plugins(){return[qH(this.columns,this.gap)]}}const qH=(e,l)=>s.createPluginFactory({key:I1,handlers:{onKeyDown:jo0},useHooks:Oo0,options:{columns:e,gap:l}})(),Qo0=12,Yo0=26,Go0=124,Wo0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((c,r)=>r.id===EH?Go0:Yo0+c,Qo0),index:a})),qo0=(e,l)=>l.reduce((a,{group:c,buttonGroupWidth:r,index:o})=>{const i=Math.max(0,a.length-1);return a[i]=a[i]??[],(a[i]??[{actions:[],buttonGroupWidth:0}]).reduce((L,{buttonGroupWidth:u})=>L+u,0)+r<=e?a[i].push({group:c,buttonGroupWidth:r,index:o}):a.push([{group:c,buttonGroupWidth:r,index:o}]),a.filter(L=>L.length)},[]),Ko0=({toolbarButtons:e,editorId:l})=>{const a=s.usePlateEditorRef(l),{editorWidth:c}=Nc0(),{position:r}=t0(),o=Wo0(e.at(r)),i=qo0(c||0,o),m=_H[r];return t.createElement(m.ToolbarWrapper,{editorWidth:c,toolbarButtonGroups:i},i.map((L,u)=>t.createElement("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",key:u},L.map(({group:d,index:w})=>t.createElement(ic0,{index:w,key:w},d.map((h,g)=>t.createElement(h.button,{editor:a,editorId:l,id:h.id,key:g.toString()})))))))},KH=e=>s.createPlugins(e.plugins,{components:s.createPlateUI(e.elements)}),nt=(e,l)=>({create:()=>KH(l),toolbar:()=>l.hasToolbar?t.createElement(Ko0,{toolbarButtons:l.buttons,editorId:e}):null,inline:()=>t.createElement(t.Fragment,null,l.inline.map((a,c)=>t.createElement(a,{key:c})))}),Xo0="mention-plugin",Jo0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),at=(e,l)=>`${e}:${l}`,ct=e=>{const l=new Map;for(const a of e){const c=at(a.data.category,a.data.id),r=a.text;l.set(c,r)}return l},XH=(e,l,a)=>e.get(l)??a;var P0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(P0||{});const rt=({attributes:e,element:l,nodeProps:a,children:c})=>t.createElement("span",{...e,"data-slate-value":l==null?void 0:l.value,"data-slate-key":l==null?void 0:l.key,"data-slate-category":l==null?void 0:l.category,contentEditable:!1,style:{lineHeight:"10px",padding:"1px",margin:"0 1px",fontWeight:"bold",verticalAlign:"baseline",display:"inline-block",borderRadius:"2px",backgroundColor:"rgb(227, 232, 246)",color:"rgb(130, 95, 255)"},...a},c),$o0=({children:e,...l})=>t.createElement(rt,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(I2,null)),e),_o0=({children:e,...l})=>t.createElement(rt,{...l},"@",e),ei0=({children:e,...l})=>t.createElement(rt,{...l},e),ti0=({category:e,children:l,...a})=>{const c={[P0.USER]:ei0,[P0.GROUP]:$o0,[P0.ALL]:_o0},r=c[e]??c[P0.USER];return t.createElement(r,{...a},l)},ot=e=>l=>{const{element:a,children:c}=l,r=at(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(ti0,{category:a==null?void 0:a.category,...l},XH(e,r,String(a==null?void 0:a.id)),c)};class JH extends m0{constructor(l=s.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=ot(ct(l)),this}}const li0=({image:e,category:l,text:a,id:c})=>{if(e)return t.createElement("img",{src:e,alt:`${c}-${l}-${a}`});switch(l){case P0.GROUP:return t.createElement(I2,null);case P0.ALL:return t.createElement(Oe,null);default:return t.createElement(Fe,null)}},ni0=({item:e})=>{const{data:{image:l,category:a},key:c,text:r}=e;return t.createElement("div",{className:"tw-flex tw-items-center tw-w-full tw-min-h-[inherit]"},t.createElement("span",{className:"tw-flex tw-items-center tw-justify-center tw-rounded-full tw-mr-2.5 tw-bg-base-alt tw-border tw-border-line-weak tw-w-[22px] tw-h-[22px] tw-shrink-0 tw-overflow-hidden group-hover:tw-border-base group-aria-selected:tw-border-base"},t.createElement(li0,{image:l,category:a,text:r,id:c})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},r))},Vt=[`
|
|
42
42
|
color: var(--text-color-weak);
|