@frontify/fondue 12.0.0-beta.340 → 12.0.0-beta.342
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/AutoformatPlugin/index.es.js +15 -14
- package/dist/components/RichTextEditor/Plugins/AutoformatPlugin/index.es.js.map +1 -1
- 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/package.json +10 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Plugin as
|
|
2
|
-
import { AUTOFORMAT_PLUGIN as
|
|
3
|
-
import { createAutoformatPlugin as u, autoformatPunctuation as c, autoformatArrow as n, autoformatLegal as s, autoformatSubscriptNumbers as l, autoformatSubscriptSymbols as d, autoformatSuperscriptNumbers as
|
|
1
|
+
import { Plugin as i } from "../Plugin.es.js";
|
|
2
|
+
import { AUTOFORMAT_PLUGIN as p } from "./id.es.js";
|
|
3
|
+
import { createAutoformatPlugin as u, autoformatPunctuation as c, autoformatArrow as n, autoformatLegal as s, autoformatSubscriptNumbers as l, autoformatSubscriptSymbols as d, autoformatSuperscriptNumbers as f, autoformatSuperscriptSymbols as y, autoformatFraction as g, MARK_UNDERLINE as h, MARK_BOLD as E, MARK_ITALIC as T, MARK_STRIKETHROUGH as b, MARK_CODE as k, ELEMENT_UL as r, unwrapList as m, toggleList as e, ELEMENT_OL as a } from "@udecode/plate";
|
|
4
4
|
import { TextStyles as o } from "../TextStylePlugin/types.es.js";
|
|
5
|
-
import { ELEMENT_CHECK_ITEM as
|
|
6
|
-
class
|
|
5
|
+
import { ELEMENT_CHECK_ITEM as L } from "../CheckboxListPlugin/id.es.js";
|
|
6
|
+
class K extends i {
|
|
7
7
|
constructor(t) {
|
|
8
|
-
super(
|
|
8
|
+
super(p, {
|
|
9
9
|
...t
|
|
10
10
|
});
|
|
11
11
|
}
|
|
@@ -19,35 +19,36 @@ class S extends p {
|
|
|
19
19
|
...s,
|
|
20
20
|
...l,
|
|
21
21
|
...d,
|
|
22
|
-
...y,
|
|
23
22
|
...f,
|
|
23
|
+
...y,
|
|
24
|
+
...g,
|
|
24
25
|
{
|
|
25
26
|
mode: "mark",
|
|
26
|
-
type: [
|
|
27
|
+
type: [h],
|
|
27
28
|
match: ["_", "_"],
|
|
28
29
|
ignoreTrim: !0
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
mode: "mark",
|
|
32
|
-
type: [
|
|
33
|
+
type: [E],
|
|
33
34
|
match: ["**", "**"],
|
|
34
35
|
ignoreTrim: !0
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
mode: "mark",
|
|
38
|
-
type: [
|
|
39
|
+
type: [T],
|
|
39
40
|
match: ["*", "*"],
|
|
40
41
|
ignoreTrim: !0
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
mode: "mark",
|
|
44
|
-
type: [
|
|
45
|
+
type: [b],
|
|
45
46
|
match: ["~~", "~~"],
|
|
46
47
|
ignoreTrim: !0
|
|
47
48
|
},
|
|
48
49
|
{
|
|
49
50
|
mode: "mark",
|
|
50
|
-
type: [
|
|
51
|
+
type: [k],
|
|
51
52
|
match: ["`", "`"],
|
|
52
53
|
ignoreTrim: !0
|
|
53
54
|
},
|
|
@@ -87,7 +88,7 @@ class S extends p {
|
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
mode: "block",
|
|
90
|
-
type:
|
|
91
|
+
type: L,
|
|
91
92
|
match: ["[] "]
|
|
92
93
|
}
|
|
93
94
|
]
|
|
@@ -97,6 +98,6 @@ class S extends p {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
export {
|
|
100
|
-
|
|
101
|
+
K as AutoformatPlugin
|
|
101
102
|
};
|
|
102
103
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/AutoformatPlugin/index.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Plugin, PluginProps } from '../Plugin';\nimport { AUTOFORMAT_PLUGIN } from './id';\nimport {\n ELEMENT_OL,\n ELEMENT_UL,\n MARK_BOLD,\n MARK_CODE,\n MARK_ITALIC,\n MARK_STRIKETHROUGH,\n MARK_UNDERLINE,\n autoformatArrow,\n autoformatLegal,\n autoformatPunctuation,\n autoformatSubscriptNumbers,\n autoformatSubscriptSymbols,\n autoformatSuperscriptNumbers,\n autoformatSuperscriptSymbols,\n createAutoformatPlugin,\n toggleList,\n unwrapList,\n} from '@udecode/plate';\nimport { TextStyles } from '../TextStylePlugin';\nimport { ELEMENT_CHECK_ITEM } from '../CheckboxListPlugin';\n\nexport class AutoformatPlugin extends Plugin {\n constructor(props?: PluginProps) {\n super(AUTOFORMAT_PLUGIN, {\n ...props,\n });\n }\n\n plugins() {\n return [\n createAutoformatPlugin({\n options: {\n rules: [\n ...autoformatPunctuation,\n ...autoformatArrow,\n ...autoformatLegal,\n ...autoformatSubscriptNumbers,\n ...autoformatSubscriptSymbols,\n ...autoformatSuperscriptNumbers,\n ...autoformatSuperscriptSymbols,\n {\n mode: 'mark',\n type: [MARK_UNDERLINE],\n match: ['_', '_'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_BOLD],\n match: ['**', '**'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_ITALIC],\n match: ['*', '*'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_STRIKETHROUGH],\n match: ['~~', '~~'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_CODE],\n match: ['`', '`'],\n ignoreTrim: true,\n },\n {\n mode: 'block',\n match: ['# '],\n type: TextStyles.heading1,\n },\n {\n mode: 'block',\n match: ['## '],\n type: TextStyles.heading2,\n },\n {\n mode: 'block',\n match: ['### '],\n type: TextStyles.heading3,\n },\n {\n mode: 'block',\n match: ['#### '],\n type: TextStyles.heading4,\n },\n {\n mode: 'block',\n type: ELEMENT_UL,\n match: ['- '],\n preFormat: unwrapList,\n format: (editor) => toggleList(editor, { type: ELEMENT_UL }),\n },\n {\n mode: 'block',\n type: ELEMENT_OL,\n match: ['1. ', '1) '],\n preFormat: unwrapList,\n format: (editor) => toggleList(editor, { type: ELEMENT_OL }),\n },\n {\n mode: 'block',\n type: ELEMENT_CHECK_ITEM,\n match: ['[] '],\n },\n ],\n },\n }),\n ];\n }\n}\n"],"names":["AutoformatPlugin","Plugin","props","AUTOFORMAT_PLUGIN","createAutoformatPlugin","autoformatPunctuation","autoformatArrow","autoformatLegal","autoformatSubscriptNumbers","autoformatSubscriptSymbols","autoformatSuperscriptNumbers","autoformatSuperscriptSymbols","MARK_UNDERLINE","MARK_BOLD","MARK_ITALIC","MARK_STRIKETHROUGH","MARK_CODE","TextStyles","ELEMENT_UL","unwrapList","editor","toggleList","ELEMENT_OL","ELEMENT_CHECK_ITEM"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/AutoformatPlugin/index.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Plugin, PluginProps } from '../Plugin';\nimport { AUTOFORMAT_PLUGIN } from './id';\nimport {\n ELEMENT_OL,\n ELEMENT_UL,\n MARK_BOLD,\n MARK_CODE,\n MARK_ITALIC,\n MARK_STRIKETHROUGH,\n MARK_UNDERLINE,\n autoformatArrow,\n autoformatFraction,\n autoformatLegal,\n autoformatPunctuation,\n autoformatSubscriptNumbers,\n autoformatSubscriptSymbols,\n autoformatSuperscriptNumbers,\n autoformatSuperscriptSymbols,\n createAutoformatPlugin,\n toggleList,\n unwrapList,\n} from '@udecode/plate';\nimport { TextStyles } from '../TextStylePlugin';\nimport { ELEMENT_CHECK_ITEM } from '../CheckboxListPlugin';\n\nexport class AutoformatPlugin extends Plugin {\n constructor(props?: PluginProps) {\n super(AUTOFORMAT_PLUGIN, {\n ...props,\n });\n }\n\n plugins() {\n return [\n createAutoformatPlugin({\n options: {\n rules: [\n ...autoformatPunctuation,\n ...autoformatArrow,\n ...autoformatLegal,\n ...autoformatSubscriptNumbers,\n ...autoformatSubscriptSymbols,\n ...autoformatSuperscriptNumbers,\n ...autoformatSuperscriptSymbols,\n ...autoformatFraction,\n {\n mode: 'mark',\n type: [MARK_UNDERLINE],\n match: ['_', '_'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_BOLD],\n match: ['**', '**'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_ITALIC],\n match: ['*', '*'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_STRIKETHROUGH],\n match: ['~~', '~~'],\n ignoreTrim: true,\n },\n {\n mode: 'mark',\n type: [MARK_CODE],\n match: ['`', '`'],\n ignoreTrim: true,\n },\n {\n mode: 'block',\n match: ['# '],\n type: TextStyles.heading1,\n },\n {\n mode: 'block',\n match: ['## '],\n type: TextStyles.heading2,\n },\n {\n mode: 'block',\n match: ['### '],\n type: TextStyles.heading3,\n },\n {\n mode: 'block',\n match: ['#### '],\n type: TextStyles.heading4,\n },\n {\n mode: 'block',\n type: ELEMENT_UL,\n match: ['- '],\n preFormat: unwrapList,\n format: (editor) => toggleList(editor, { type: ELEMENT_UL }),\n },\n {\n mode: 'block',\n type: ELEMENT_OL,\n match: ['1. ', '1) '],\n preFormat: unwrapList,\n format: (editor) => toggleList(editor, { type: ELEMENT_OL }),\n },\n {\n mode: 'block',\n type: ELEMENT_CHECK_ITEM,\n match: ['[] '],\n },\n ],\n },\n }),\n ];\n }\n}\n"],"names":["AutoformatPlugin","Plugin","props","AUTOFORMAT_PLUGIN","createAutoformatPlugin","autoformatPunctuation","autoformatArrow","autoformatLegal","autoformatSubscriptNumbers","autoformatSubscriptSymbols","autoformatSuperscriptNumbers","autoformatSuperscriptSymbols","autoformatFraction","MARK_UNDERLINE","MARK_BOLD","MARK_ITALIC","MARK_STRIKETHROUGH","MARK_CODE","TextStyles","ELEMENT_UL","unwrapList","editor","toggleList","ELEMENT_OL","ELEMENT_CHECK_ITEM"],"mappings":";;;;;AA2BO,MAAMA,UAAyBC,EAAO;AAAA,EACzC,YAAYC,GAAqB;AAC7B,UAAMC,GAAmB;AAAA,MACrB,GAAGD;AAAA,IAAA,CACN;AAAA,EACL;AAAA,EAEA,UAAU;AACC,WAAA;AAAA,MACHE,EAAuB;AAAA,QACnB,SAAS;AAAA,UACL,OAAO;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH,GAAGC;AAAA,YACH;AAAA,cACI,MAAM;AAAA,cACN,MAAM,CAACC,CAAc;AAAA,cACrB,OAAO,CAAC,KAAK,GAAG;AAAA,cAChB,YAAY;AAAA,YAChB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAM,CAACC,CAAS;AAAA,cAChB,OAAO,CAAC,MAAM,IAAI;AAAA,cAClB,YAAY;AAAA,YAChB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAM,CAACC,CAAW;AAAA,cAClB,OAAO,CAAC,KAAK,GAAG;AAAA,cAChB,YAAY;AAAA,YAChB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAM,CAACC,CAAkB;AAAA,cACzB,OAAO,CAAC,MAAM,IAAI;AAAA,cAClB,YAAY;AAAA,YAChB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAM,CAACC,CAAS;AAAA,cAChB,OAAO,CAAC,KAAK,GAAG;AAAA,cAChB,YAAY;AAAA,YAChB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,OAAO,CAAC,IAAI;AAAA,cACZ,MAAMC,EAAW;AAAA,YACrB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,OAAO,CAAC,KAAK;AAAA,cACb,MAAMA,EAAW;AAAA,YACrB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,OAAO,CAAC,MAAM;AAAA,cACd,MAAMA,EAAW;AAAA,YACrB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,OAAO,CAAC,OAAO;AAAA,cACf,MAAMA,EAAW;AAAA,YACrB;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAMC;AAAA,cACN,OAAO,CAAC,IAAI;AAAA,cACZ,WAAWC;AAAA,cACX,QAAQ,CAACC,MAAWC,EAAWD,GAAQ,EAAE,MAAMF,GAAY;AAAA,YAC/D;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAMI;AAAA,cACN,OAAO,CAAC,OAAO,KAAK;AAAA,cACpB,WAAWH;AAAA,cACX,QAAQ,CAACC,MAAWC,EAAWD,GAAQ,EAAE,MAAME,GAAY;AAAA,YAC/D;AAAA,YACA;AAAA,cACI,MAAM;AAAA,cACN,MAAMC;AAAA,cACN,OAAO,CAAC,KAAK;AAAA,YACjB;AAAA,UACJ;AAAA,QACJ;AAAA,MAAA,CACH;AAAA,IAAA;AAAA,EAET;AACJ;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -36,7 +36,7 @@ ${j2("Ctrl+B")}`),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(n3,{})}),c
|
|
|
36
36
|
`]},Ch0={renderAfterEditable:gh0};class IT extends t0{constructor(l){super(wh0,{button:vh0,showIn:[c0.BOTTOM,c0.TOP],...l})}plugins(){return[w.createComboboxPlugin(),w.createEmojiPlugin(Ch0)]}}const Mh0="soft-break-plugin";class ZT extends t0{constructor(l){super(Mh0,{...l})}plugins(){return[w.createSoftBreakPlugin()]}}const Ih0="italic-plugin",k5="tw-italic",pT=({attributes:e,children:l})=>t.jsx("span",{...e,className:k5,children:l});class NT extends e0{constructor(l=w.MARK_ITALIC,o=pT){super(l,o)}}const Zh0=({editor:e,id:l})=>t.jsx(C0,{id:l,children:t.jsx(w.MarkToolbarButton,{tooltip:b0(`Italic
|
|
37
37
|
${j2("Ctrl+I")}`),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(a3,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})}),ph0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class ST extends t0{constructor(l){super(Ih0,{button:Zh0,markupElement:new NT,...l})}plugins(){return[w.createItalicPlugin({deserializeHtml:{rules:[...ph0,{validNodeName:["SPAN"],validClassName:k5}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Nh0=e=>!!e.match(/^(https?:\/\/|mailto:|tel:).+/),Sh0=w.createComponentAs(e=>{var o;const l=w.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((o=l.style)==null?void 0:o.display)==="none"?null:w.createElementAs("div",l)}),yh0=w.createComponentAs(e=>{var o;const l=zh0({...e,floatingOptions:{strategy:"fixed"}});return((o=l.style)==null?void 0:o.display)==="none"?null:w.createElementAs("div",l)});w.FloatingLink.EditRoot=yh0;w.FloatingLink.InsertRoot=Sh0;const X2=w.FloatingLink,T1="link-plugin",Rh0=()=>{const e=w.useFloatingLinkUrlInput({}),{styles:l}=C1();return t.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:t.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between",children:[t.jsx("span",{style:l[T1],className:"tw-pointer-events-none",children:e.defaultValue}),t.jsxs("span",{className:"tw-flex tw-gap-2",children:[t.jsx("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",children:t.jsx(X2.EditButton,{children:t.jsx(Ge,{})})}),t.jsx("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",children:t.jsx(X2.UnlinkButton,{children:t.jsx(i3,{})})})]})]})})},d7=(e,l)=>{const o=w.getAboveNode(e,{match:{type:w.ELEMENT_LINK}});return Array.isArray(o)?l(o[0]):""},bh0=e=>d7(e,l=>{var o,i;return((i=(o=l.chosenLink)==null?void 0:o.searchResult)==null?void 0:i.link)||""}),Hh0=e=>d7(e,l=>l.url||""),yT=e=>{var l,o;return e.url||((o=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:o.link)||""},kh0=e=>d7(e,yT),zh0=({floatingOptions:e,...l})=>{const o=w.useEditorRef(),i=w.usePlateSelectors().keyEditor(),s=w.useFloatingLinkSelectors().mode(),r=w.useFloatingLinkSelectors().isOpen(o.id),{triggerFloatingLinkHotkeys:c="command+k, ctrl+k"}=w.getPluginOptions(o,w.ELEMENT_LINK),d=n.useCallback(()=>{const f=w.getAboveNode(o,{match:{type:w.getPluginType(o,w.ELEMENT_LINK)}});if(f){const[,g]=f;return w.getRangeBoundingClientRect(o,{anchor:w.getStartPoint(o,g),focus:w.getEndPoint(o,g)})}return w.getDefaultBoundingClientRect()},[o]),h=r&&s==="edit",{update:u,style:L,floating:m}=w.useVirtualFloatingLink({editorId:o.id,open:h,getBoundingClientRect:d,...e});return n.useEffect(()=>{const f=kh0(o);if(f&&w.floatingLinkActions.url(f),o.selection&&w.someNode(o,{match:{type:w.getPluginType(o,w.ELEMENT_LINK)}})){w.floatingLinkActions.show("edit",o.id),u();return}w.floatingLinkSelectors.mode()==="edit"&&w.floatingLinkActions.hide()},[o,i,u]),w.useHotkeys(c,f=>{f.preventDefault(),w.floatingLinkSelectors.mode()==="edit"&&w.triggerFloatingLinkEdit(o)},{enableOnContentEditable:!0},[]),w.useFloatingLinkEnter(),w.useFloatingLinkEscape(),{style:{...L,zIndex:1},...l,ref:w.useComposedRef(l.ref,m)}},Th0=({state:e,onTextChange:l,onUrlChange:o,onToggleTab:i,onCancel:s,onSave:r,isValidUrlOrEmpty:c,hasValues:d,testId:h,children:u})=>t.jsxs("div",{"data-test-id":h,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[t.jsx(Y2,{label:{children:"Text",htmlFor:"linkText",required:!0},children:t.jsx(m1,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:l})}),u,t.jsxs("div",{className:"tw-pt-5",children:[t.jsx(Y2,{label:{children:"URL",htmlFor:"url",required:!0},children:t.jsx(m1,{id:"url",value:e.url,placeholder:"https://example.com",focusOnMount:!0,onChange:o})}),!c()&&t.jsx("div",{className:"tw-text-red-65 tw-mt-3",children:"Please enter a valid URL."})]}),t.jsx("div",{className:"tw-pt-5",children:t.jsx(j1,{value:"new-tab",label:"Open in new tab",state:e.newTab,onChange:i})}),t.jsx("div",{className:"tw-mt-3",children:t.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[t.jsx(y0,{onClick:s,size:a0.Medium,style:X.Default,emphasis:h0.Default,children:"Cancel"}),t.jsx(y0,{onClick:r,size:a0.Medium,icon:t.jsx(ze,{}),disabled:!c()||!d,children:"Save"})]})})]}),Vh0={url:"",text:"",newTab:x0.Unchecked},Dh0=()=>{const[e,l]=n.useReducer((o,i)=>{const{type:s,payload:r}=i;switch(s){case"NEW_TAB":return{...o,newTab:x0.Checked};case"SAME_TAB":return{...o,newTab:x0.Unchecked};case"URL":case"TEXT":case"INIT":return{...o,...r};default:return o}},Vh0);return[e,l]},Fh0=()=>{const e=w.useEditorRef(),[l,o]=Dh0();n.useEffect(()=>{const L=bh0(e),m=Hh0(e);o({type:"INIT",payload:{text:w.floatingLinkSelectors.text(),newTab:w.floatingLinkSelectors.newTab()?x0.Checked:x0.Unchecked,url:L&&m===""?L:w.floatingLinkSelectors.url()}})},[o,e]);const i=L=>{o({type:"TEXT",payload:{text:L}})},s=L=>{o({type:"URL",payload:{url:L}})},r=L=>{o(L?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{w.floatingLinkActions.hide()},d=L=>{!u()||!h||(w.floatingLinkActions.text(l.text),w.floatingLinkActions.url(l.url),w.floatingLinkActions.newTab(l.newTab===x0.Checked),w.submitFloatingLink(e)&&(L==null||L.preventDefault()))},h=l.url!==""&&l.text!=="",u=()=>{const{isUrl:L}=w.getPluginOptions(e,w.ELEMENT_LINK);return!l.url||L&&L(l.url)};return w.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:l,onTextChange:i,onUrlChange:s,onToggleTab:r,onCancel:c,onSave:d,hasValues:h,isValidUrlOrEmpty:u}},Bh0=()=>t.jsx(Th0,{...Fh0(),testId:"floating-link-insert"}),Oh0=({readOnly:e})=>{const l=w.useFloatingLinkSelectors().isEditing();if(e)return null;const o=t.jsx(Bh0,{}),i=l?o:t.jsx(Rh0,{});return t.jsxs(t.Fragment,{children:[t.jsx(X2.InsertRoot,{children:o}),t.jsx(X2.EditRoot,{children:i})]})},Ph0=({id:e,editorId:l})=>{const o=w.usePlateEditorState(w.useEventPlateId(l)),i=!!w.isRangeInSameBlock(o,{at:o.selection}),s=j0(i);return t.jsx(C0,{id:e,children:t.jsx(w.LinkToolbarButton,{tooltip:b0(i?`Link
|
|
38
38
|
${j2("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.jsx(p0,{icon:t.jsx(Pe,{})}),classNames:s,styles:N0,actionHandler:"onMouseDown"})})},Uh0=e=>({...w.useElementProps({...e,elementToAttributes:o=>({href:yT(o),target:o.target||"_self"})}),onMouseOver:o=>{o.stopPropagation()}}),Qh0=e=>{const l=Uh0(e),{attributes:o,children:i}=e,{styles:s}=C1();return t.jsx("a",{...o,href:l.href,target:l.target,style:s[T1],children:i})};class Yh0 extends e0{constructor(l=w.ELEMENT_LINK,o=Qh0){super(l,o)}}const RT=w.createPluginFactory({...w.createLinkPlugin(),renderAfterEditable:Oh0,options:{isUrl:Nh0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class bT extends t0{constructor({styles:o=R0[T1],...i}={}){super(T1,{button:Ph0,markupElement:new Yh0,...i});W(this,"styles",{});this.styles=o}plugins(){return[RT()]}}const h7="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",HT=`${h7} tw-break-after-column tw-break-inside-avoid-column`,D0=e=>{const l=e.breakAfterColumn;return v([l==="active"&&HT,l==="inactive"&&h7])},L7=e=>v([D0(e),e.align?i7[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),kT=({attributes:e,children:l,element:o})=>t.jsx("p",{className:L7(o),...e,children:t.jsx("span",{className:"tw-w-auto tw-min-w-[10px]",children:l})});class zT extends e0{constructor(l=w.ELEMENT_LIC,o=kT){super(l,o)}}const TT="text-style-plugin",z5="list-plugin",Eh0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:o}})=>{const{insertBreak:i,deleteBackward:s,deleteForward:r,deleteFragment:c}=e;return o?e.insertSoftBreak=()=>{w.insertBreakList(e)||i()}:e.insertBreak=()=>{w.insertBreakList(e)||i()},e.deleteBackward=d=>{w.deleteBackwardList(e,d)||s(d)},e.deleteForward=d=>{w.deleteForwardList(e)||r(d)},e.deleteFragment=d=>{w.deleteFragmentList(e)||c(d)},e.insertFragment=w.insertFragmentList(e),e.normalizeNode=w.normalizeList(e,{validLiChildrenTypes:l}),e},a2="textStyle",VT=w.createPluginFactory({key:a2,isLeaf:!0});class u7 extends t0{constructor(o){super(z5,{leafMarkupElements:[new zT,new WT],...o});W(this,"isSoftBreak");this.isSoftBreak=(o==null?void 0:o.isSoftBreak)??!1}plugins(){return[w.createListPlugin({withOverrides:Eh0,options:{isSoftBreak:this.isSoftBreak}}),VT()]}}const Gh0=e=>w.getAboveNode(e,{match:{type:w.ELEMENT_LI},mode:"lowest"})||w.someNode(e,{match:{type:G0},mode:"lowest"}),Wh0=({editor:e,type:l,children:o})=>{const i=e!=null&&e.selection?w.getMark(e,a2)===l.id:w.someNode(e,{match:{type:l}});return t.jsx("button",{"data-test-id":"textstyle-option",type:"button",className:v(["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]",i?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:s=>{s.preventDefault(),s.stopPropagation(),!(!e||!e.selection)&&(w.setMarks(e,{[a2]:l.id}),Gh0(e)||w.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))},children:o})},qh0=({label:e,open:l,onClick:o},i)=>t.jsx("button",{ref:i,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:s=>{s.preventDefault(),s.stopPropagation(),o()},children:t.jsxs("div",{className:v(["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"]),children:[t.jsx("span",{className:"tw-text-xs tw-truncate",children:e}),t.jsx("div",{className:v(["tw-transition-transform",l&&"tw-rotate-180"]),children:t.jsx(ke,{})})]})}),Kh0=n.forwardRef(qh0),$h0=e=>Array.isArray(e.children)?(e.children.find(o=>w.isText(o))??{})[a2]:w.ELEMENT_PARAGRAPH,Xh0=[w.ELEMENT_LI,w.ELEMENT_UL,w.ELEMENT_OL],Jh0=e=>!e||!e.selection?[]:Array.from(w.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((o,[i])=>{if(!w.isNode(i))return o;const s=i.type===w.ELEMENT_LIC||i.type===G0?$h0(i):i.textStyle;return s&&!o.includes(s)&&!Xh0.includes(s)&&o.push(s),o},[]),_h0=6,eL0=10,tL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:o,maxHeight:i}=F3(e.elements.reference,e.rects.popper.height,_h0+eL0,0);o==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${i}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},J2="Mixed";var T=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(T||{});const lL0=e=>{const[l,o]=n.useState(!1),[i,s]=n.useState(null),[r,c]=n.useState(null),d=w.usePlateEditorState(e),h=Jh0(d);let u=J2;h.length===1?u=h[0]:h.length===0&&(u="p");const L=n.useCallback(()=>{o(f=>!f)},[o]),m=B1.usePopper(i,r,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},tL0]});return n.useEffect(()=>{const f=g=>{if(l){const x=g.target;if(r&&r.contains(x)||i&&i.contains(x))return;o(!1)}};return document.addEventListener("pointerdown",f),()=>{document.removeEventListener("pointerdown",f)}},[l,r,o,i]),{state:{isOpen:l,toggle:L,editor:d},dropdownProps:{...m.attributes.popper,style:m.styles.popper},key:u,dropdownRef:c,triggerRef:s}},nL0=({editorId:e,textStyles:l=[]})=>{var m;const{state:{editor:o,toggle:i,isOpen:s},dropdownProps:r,triggerRef:c,dropdownRef:d,key:h}=lL0(e);let u=J2;const L=l.find(f=>{var g;return f.id===h&&((g=f.props)==null?void 0:g.label)});return L&&(u=((m=L.props)==null?void 0:m.label)||J2),t.jsxs(t.Fragment,{children:[t.jsx(Kh0,{label:u,open:s,onClick:i,ref:c}),s&&t.jsx("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:d,...r,children:l.map(f=>{var g;return t.jsx(Wh0,{editor:o,type:f,children:t.jsx("span",{style:f.styles??{},children:(g=f.props)==null?void 0:g.label})},f.id)})})]})},aL0=({editorId:e,id:l,textStyles:o})=>t.jsx(C0,{id:l,children:t.jsx(nL0,{editorId:e,textStyles:o})}),oL0=(e,l)=>o=>t.jsx(e,{...o,textStyles:l}),iL0="textstyle-custom1-plugin";class sL0 extends t0{constructor({styles:o=R0.custom1,...i}={}){super(T.custom1,{label:"Custom 1",markupElement:new rL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[cL0(this.styles)]}}class rL0 extends e0{constructor(l=iL0,o=DT){super(l,o)}}const DT=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("p",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},cL0=e=>w.createPluginFactory({key:T.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom1}]}})({component:l=>t.jsx(DT,{...l,styles:e})}),dL0="textstyle-custom2-plugin";class hL0 extends t0{constructor({styles:o=R0.custom2,...i}={}){super(T.custom2,{label:"Custom 2",markupElement:new LL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[uL0(this.styles)]}}class LL0 extends e0{constructor(l=dL0,o=FT){super(l,o)}}const FT=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("p",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},uL0=e=>w.createPluginFactory({key:T.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom2}]}})({component:l=>t.jsx(FT,{...l,styles:e})}),wL0="textstyle-custom3-plugin";class mL0 extends t0{constructor({styles:o=R0.custom3,...i}={}){super(T.custom3,{label:"Custom 3",markupElement:new fL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[xL0(this.styles)]}}class fL0 extends e0{constructor(l=wL0,o=BT){super(l,o)}}const BT=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("p",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},xL0=e=>w.createPluginFactory({key:T.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom3}]}})({component:l=>t.jsx(BT,{...l,styles:e})}),vL0="textstyle-heading1-plugin";class gL0 extends t0{constructor({styles:o=R0.heading1,...i}={}){super(T.heading1,{label:"Heading 1",markupElement:new AL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[jL0(this.styles)]}}class AL0 extends e0{constructor(l=vL0,o=re){super(l,o)}}const re=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("h1",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},jL0=e=>w.createPluginFactory({key:T.heading1,isElement:!0,component:re,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.jsx(re,{...l,styles:e})}),CL0="textstyle-heading2-plugin";class ML0 extends t0{constructor({styles:o=R0.heading2,...i}={}){super(T.heading2,{label:"Heading 2",markupElement:new IL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[ZL0(this.styles)]}}class IL0 extends e0{constructor(l=CL0,o=ce){super(l,o)}}const ce=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("h2",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},ZL0=e=>w.createPluginFactory({key:T.heading2,isElement:!0,component:ce,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.jsx(ce,{...l,styles:e})}),pL0="textstyle-heading3-plugin";class NL0 extends t0{constructor({styles:o=R0.heading3,...i}={}){super(T.heading3,{label:"Heading 3",markupElement:new SL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[yL0(this.styles)]}}class SL0 extends e0{constructor(l=pL0,o=de){super(l,o)}}const de=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("h3",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},yL0=e=>w.createPluginFactory({key:T.heading3,isElement:!0,component:de,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.jsx(de,{...l,styles:e})}),RL0="textstyle-heading4-plugin";class bL0 extends t0{constructor({styles:o=R0.heading4,...i}={}){super(T.heading4,{label:"Heading 4",markupElement:new HL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[kL0(this.styles)]}}class HL0 extends e0{constructor(l=RL0,o=he){super(l,o)}}const he=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("h4",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},kL0=e=>w.createPluginFactory({key:T.heading4,isElement:!0,component:he,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.jsx(he,{...l,styles:e})}),zL0="textstyle-imageCaption-plugin";class TL0 extends t0{constructor({styles:o=R0.imageCaption,...i}={}){super(T.imageCaption,{label:"Image Caption",markupElement:new VL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[DL0(this.styles)]}}class VL0 extends e0{constructor(l=zL0,o=Le){super(l,o)}}const Le=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("p",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},DL0=e=>w.createPluginFactory({key:T.imageCaption,isElement:!0,component:Le,deserializeHtml:{rules:[{validClassName:T.imageCaption}]}})({component:l=>t.jsx(Le,{...l,styles:e})}),FL0="textstyle-imageTitle-plugin";class BL0 extends t0{constructor({styles:o=R0.imageTitle,...i}={}){super(T.imageTitle,{label:"Image Title",markupElement:new OL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[PL0(this.styles)]}}class OL0 extends e0{constructor(l=FL0,o=ue){super(l,o)}}const ue=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("p",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},PL0=e=>w.createPluginFactory({key:T.imageTitle,isElement:!0,component:ue,deserializeHtml:{rules:[{validClassName:T.imageTitle}]}})({component:l=>t.jsx(ue,{...l,styles:e})});class OT extends t0{constructor({styles:o=R0.p,...i}={}){super(T.p,{markupElement:new UT,label:"Body Text",...i});W(this,"styles",{});this.styles=o}plugins(){return[QT(this.styles)]}}const PT="tw-m-0 tw-px-0 tw-py-0",_2=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align,r=v([s&&V0[s],PT,D0(e)]);return t.jsx("p",{...l,className:r,style:i,children:o})};class UT extends e0{constructor(l=T.p,o=_2){super(l,o)}}const QT=e=>w.createPluginFactory({...w.createParagraphPlugin(),key:T.p,isElement:!0,component:_2})({component:l=>t.jsx(_2,{...l,styles:e})}),UL0="textstyle-quote-plugin";class QL0 extends t0{constructor({styles:o=R0.quote,...i}={}){super(T.quote,{label:"Quote",markupElement:new YL0,...i});W(this,"styles",{});this.styles=o}plugins(){return[YT(this.styles)]}}class YL0 extends e0{constructor(l=UL0,o=e5){super(l,o)}}const e5=({element:e,attributes:l,children:o,styles:i})=>{const s=e.align;return t.jsx("blockquote",{...l,className:v([s&&V0[s],D0(e)]),style:i,children:o})},YT=e=>w.createPluginFactory({key:T.quote,isElement:!0,component:e5,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.jsx(e5,{...l,styles:e})});class ET extends t0{constructor({...o}){super(TT,{button:oL0(aL0,o.textStyles),...o});W(this,"textStyles");this.textStyles=o.textStyles}plugins(){return this.textStyles.map(o=>o.plugins()).flat()}}const w7="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item",GT=({attributes:e,children:l,element:o})=>{const{styles:i}=C1();return t.jsx("li",{style:m7(o,i),...e,className:w7,children:l})};class WT extends e0{constructor(l=w.ELEMENT_LI,o=GT){super(l,o)}}const m7=(e,l)=>({...l[qT(e)??T.p],counterIncrement:"count"}),qT=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const o of e.children){const i=qT(o);i&&(!l||i.startsWith(l))&&(l=i)}else l=e.textStyle;return l},EL0=["[&>li>p]:before:tw-content-[counter(count,decimal)_'._']","[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']","[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']"],GL0=(e,l)=>{const o=w.findNodePath(e,l);if(!o)return 0;const i=w.getNodeAncestors(e,o);return Array.from(i).filter(s=>s[0].type===w.ELEMENT_LI).length},f7=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 [&>li>p]:before:tw-tabular-nums ${EL0[e%3]}`,x7={counterReset:"count"},KT=({attributes:e,children:l,element:o})=>{const i=w.usePlateEditorRef(),s=GL0(i,o);return t.jsx("ol",{className:f7(s),...e,style:x7,children:l})};class $T extends e0{constructor(l=w.ELEMENT_OL,o=KT){super(l,o)}}const XT=({editor:e,id:l})=>t.jsx(C0,{id:l,children:t.jsx(w.ListToolbarButton,{tooltip:b0("Ordered list"),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(Ye,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})});class JT extends u7{constructor(l){super({id:z5,button:XT,markupElement:new $T,...l})}}const v7="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",_T=({attributes:e,children:l})=>t.jsx("ul",{className:v7,...e,children:l});class eV extends e0{constructor(l=w.ELEMENT_UL,o=_T){super(l,o)}}const tV=({editor:e,id:l})=>t.jsx(C0,{id:l,children:t.jsx(w.ListToolbarButton,{tooltip:b0("Bullet list"),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(Ue,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})});class lV extends u7{constructor(l){super({id:z5,button:tV,markupElement:new eV,...l})}}class WL0{constructor(){W(this,"toolbarButtons",{[c0.BOTTOM]:[],[c0.FLOATING]:[],[c0.TOP]:[]})}createGroupOfButtons(l){const o=[],i=[],s=[];for(const{markupElement:r,button:c,id:d,showIn:h}of l){if(!c)continue;const u={id:(r==null?void 0:r.getId())||d,button:c};h.includes(c0.BOTTOM)&&o.push(u),h.includes(c0.TOP)&&i.push(u),h.includes(c0.FLOATING)&&s.push(u)}o.length>0&&this.toolbarButtons[c0.BOTTOM].push(o),i.length>0&&this.toolbarButtons[c0.TOP].push(i),s.length>0&&this.toolbarButtons[c0.FLOATING].push(s)}at(l){return this.toolbarButtons[l]}}class nV{constructor(l){W(this,"platePlugins",new Map);W(this,"markupElements",{});W(this,"inlineElements",[]);W(this,"toolbarButtons",new WL0);W(this,"styles",{});this.props=l}setPlugin(...l){for(const o of l){const i=Array.isArray(o)?o:[o];for(const s of i)this.addElement(s.markupElement),this.addElement(s.markupInputElement),this.addLeafElements(s.leafMarkupElements),this.addPlugin(s),this.addInline(s.inline()),s.styles&&this.addStyles(s.styles,s.id),s.textStyles&&this.addTextStylesOfSubPlugins(s.textStyles);this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(i)}return this}addTextStylesOfSubPlugins(l){for(const o of l)o.styles&&this.addStyles(o.styles,o.id)}addLeafElements(l){if(l===void 0)return;const o=Array.isArray(l)?l:[l];for(const i of o)this.addElement(i)}addElement(l){if(l===void 0)return;const o=l.getId(),i=l.getNode();i&&!this.markupElements[o]&&(this.markupElements[o]=i)}addPlugin(l){l.id&&!this.platePlugins.has(l.id)&&this.platePlugins.set(l.id,l.plugins())}addInline(l){l&&this.inlineElements.push(l)}addStyles(l,o){this.styles[o]=l}get elements(){return{...this.defaultElementsFromPlugins,...this.markupElements}}get defaultElementsFromPlugins(){const l={};for(const o of this.platePlugins.values())for(const i of o){const{key:s,component:r}=i;r&&(l[s]=r)}return l}get plugins(){const l=[];for(const o of this.platePlugins.values())l.push(...o);return l}get buttons(){return this.toolbarButtons}get inline(){return this.inlineElements}get hasToolbar(){var l;return!((l=this.props)!=null&&l.noToolbar)}get getStyles(){return this.styles}}const aV="reset-formatting-plugin",oV="reset-formatting",qL0=e=>{!e||!e.selection||(w.removeMark(e,{key:[w.MARK_BOLD,w.MARK_ITALIC,w.MARK_CODE,w.MARK_UNDERLINE,w.MARK_STRIKETHROUGH]}),w.unwrapList(e,{}),w.setElements(e,{type:w.ELEMENT_PARAGRAPH,align:void 0}))},KL0=w.withPlateProvider(({id:e,...l})=>{const o=w.usePlateEditorState(w.useEventPlateId(e));return t.jsx(w.ToolbarButton,{tooltip:b0("Clear formatting"),onMouseDown:()=>{qL0(o)},...l})}),$L0=({id:e})=>t.jsx(C0,{id:e,children:t.jsx(KL0,{icon:t.jsx(p0,{icon:t.jsx(Fe,{})}),classNames:j0(),styles:N0})}),iV=w.createPluginFactory({key:oV,isElement:!1});class sV extends t0{constructor(l){super(aV,{button:$L0,...l})}plugins(){return[iV()]}}const XL0="strikethrough-plugin",g7="!tw-line-through",rV=({attributes:e,children:l})=>t.jsx("span",{...e,className:g7,children:l});class cV extends e0{constructor(l=w.MARK_STRIKETHROUGH,o=rV){super(l,o)}}const JL0=({editor:e,id:l})=>t.jsx(C0,{id:l,children:t.jsx(w.MarkToolbarButton,{tooltip:b0("Strikethrough"),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(vb,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})});class dV extends t0{constructor(l){super(XL0,{button:JL0,markupElement:new cV,...l})}plugins(){return[w.createStrikethroughPlugin()]}}const _L0="underline-plugin",T5="tw-underline",hV=({attributes:e,children:l})=>t.jsx("span",{...e,className:T5,children:l});class LV extends e0{constructor(l=w.MARK_UNDERLINE,o=hV){super(l,o)}}const eu0=({editor:e,id:l})=>t.jsx(C0,{id:l,children:t.jsx(w.MarkToolbarButton,{tooltip:b0(`Underline
|
|
39
|
-
${j2("Ctrl+U")}`),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(o3,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})}),tu0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class uV extends t0{constructor(l){super(_L0,{button:eu0,markupElement:new LV,...l})}plugins(){return[w.createUnderlinePlugin({deserializeHtml:{rules:[...tu0,{validNodeName:["SPAN"],validClassName:T5}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const lu0="autoformat-plugin";class nu0 extends t0{constructor(l){super(lu0,{...l})}plugins(){return[w.createAutoformatPlugin({options:{rules:[...w.autoformatPunctuation,...w.autoformatArrow,...w.autoformatLegal,...w.autoformatSubscriptNumbers,...w.autoformatSubscriptSymbols,...w.autoformatSuperscriptNumbers,...w.autoformatSuperscriptSymbols,{mode:"mark",type:[w.MARK_UNDERLINE],match:["_","_"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_BOLD],match:["**","**"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_ITALIC],match:["*","*"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_STRIKETHROUGH],match:["~~","~~"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_CODE],match:["`","`"],ignoreTrim:!0},{mode:"block",match:["# "],type:T.heading1},{mode:"block",match:["## "],type:T.heading2},{mode:"block",match:["### "],type:T.heading3},{mode:"block",match:["#### "],type:T.heading4},{mode:"block",type:w.ELEMENT_UL,match:["- "],preFormat:w.unwrapList,format:l=>w.toggleList(l,{type:w.ELEMENT_UL})},{mode:"block",type:w.ELEMENT_OL,match:["1. ","1) "],preFormat:w.unwrapList,format:l=>w.toggleList(l,{type:w.ELEMENT_OL})},{mode:"block",type:G0,match:["[] "]}]}})]}}const wV=e=>Array.from(w.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,o2=(e,{key:l=E1,value:o,at:i})=>{const s=r=>w.isBlock(e,r);o?w.setElements(e,{[l]:o},{mode:"lowest",match:s,at:i}):w.unsetNodes(e,l,{match:s,mode:"lowest",at:i})},au0=(e,l,o)=>{o2(e,{at:l,value:o})},we=(e,l)=>{const o=Array.from(w.getNodeEntries(e,{at:[],match:i=>!!i.breakAfterColumn}));for(const[i,[,s]]of o.entries())au0(e,s,i<l-1?"active":"inactive")},mV=(e,l,o)=>{if(o.preventDefault(),o.stopPropagation(),!!(e!=null&&e.selection)&&w.someNode(e,{match:s=>!!s.breakAfterColumn}))o2(e,{value:void 0});else{const s=wV(e),r=Math.max(l-s-1,0);if(r===0)return;const c=Array.from(w.getNodeEntries(e,{at:e.selection,match:d=>w.isBlock(e,d),mode:"lowest"})).slice(-r);for(const d of c)o2(e,{value:"active",at:d[1]})}we(e,l)},ou0=(e,{options:{hotkey:l}})=>o=>{var i;if(!o.defaultPrevented&&l&&hF(l,o)){const s=e.plugins.find(c=>c.key===E1),r=((i=s==null?void 0:s.options)==null?void 0:i.columns)??1;mV(e,r,o)}},iu0=({id:e,...l})=>{var h,u;const o=w.usePlateEditorState(w.useEventPlateId(e)),i=!!(o!=null&&o.selection)&&w.someNode(o,{match:L=>!!L.breakAfterColumn}),s=(u=(h=o==null?void 0:o.pluginsByKey.breakAfterColumn)==null?void 0:h.options)==null?void 0:u.columns,r=Number(s)||1,c=su0(o,r,i),d=j0(c);return t.jsx(w.ToolbarButton,{active:i,tooltip:b0(c?`Column Break
|
|
39
|
+
${j2("Ctrl+U")}`),type:w.getPluginType(e,l),icon:t.jsx(p0,{icon:t.jsx(o3,{})}),classNames:j0(),styles:N0,actionHandler:"onMouseDown"})}),tu0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class uV extends t0{constructor(l){super(_L0,{button:eu0,markupElement:new LV,...l})}plugins(){return[w.createUnderlinePlugin({deserializeHtml:{rules:[...tu0,{validNodeName:["SPAN"],validClassName:T5}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const lu0="autoformat-plugin";class nu0 extends t0{constructor(l){super(lu0,{...l})}plugins(){return[w.createAutoformatPlugin({options:{rules:[...w.autoformatPunctuation,...w.autoformatArrow,...w.autoformatLegal,...w.autoformatSubscriptNumbers,...w.autoformatSubscriptSymbols,...w.autoformatSuperscriptNumbers,...w.autoformatSuperscriptSymbols,...w.autoformatFraction,{mode:"mark",type:[w.MARK_UNDERLINE],match:["_","_"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_BOLD],match:["**","**"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_ITALIC],match:["*","*"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_STRIKETHROUGH],match:["~~","~~"],ignoreTrim:!0},{mode:"mark",type:[w.MARK_CODE],match:["`","`"],ignoreTrim:!0},{mode:"block",match:["# "],type:T.heading1},{mode:"block",match:["## "],type:T.heading2},{mode:"block",match:["### "],type:T.heading3},{mode:"block",match:["#### "],type:T.heading4},{mode:"block",type:w.ELEMENT_UL,match:["- "],preFormat:w.unwrapList,format:l=>w.toggleList(l,{type:w.ELEMENT_UL})},{mode:"block",type:w.ELEMENT_OL,match:["1. ","1) "],preFormat:w.unwrapList,format:l=>w.toggleList(l,{type:w.ELEMENT_OL})},{mode:"block",type:G0,match:["[] "]}]}})]}}const wV=e=>Array.from(w.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,o2=(e,{key:l=E1,value:o,at:i})=>{const s=r=>w.isBlock(e,r);o?w.setElements(e,{[l]:o},{mode:"lowest",match:s,at:i}):w.unsetNodes(e,l,{match:s,mode:"lowest",at:i})},au0=(e,l,o)=>{o2(e,{at:l,value:o})},we=(e,l)=>{const o=Array.from(w.getNodeEntries(e,{at:[],match:i=>!!i.breakAfterColumn}));for(const[i,[,s]]of o.entries())au0(e,s,i<l-1?"active":"inactive")},mV=(e,l,o)=>{if(o.preventDefault(),o.stopPropagation(),!!(e!=null&&e.selection)&&w.someNode(e,{match:s=>!!s.breakAfterColumn}))o2(e,{value:void 0});else{const s=wV(e),r=Math.max(l-s-1,0);if(r===0)return;const c=Array.from(w.getNodeEntries(e,{at:e.selection,match:d=>w.isBlock(e,d),mode:"lowest"})).slice(-r);for(const d of c)o2(e,{value:"active",at:d[1]})}we(e,l)},ou0=(e,{options:{hotkey:l}})=>o=>{var i;if(!o.defaultPrevented&&l&&hF(l,o)){const s=e.plugins.find(c=>c.key===E1),r=((i=s==null?void 0:s.options)==null?void 0:i.columns)??1;mV(e,r,o)}},iu0=({id:e,...l})=>{var h,u;const o=w.usePlateEditorState(w.useEventPlateId(e)),i=!!(o!=null&&o.selection)&&w.someNode(o,{match:L=>!!L.breakAfterColumn}),s=(u=(h=o==null?void 0:o.pluginsByKey.breakAfterColumn)==null?void 0:h.options)==null?void 0:u.columns,r=Number(s)||1,c=su0(o,r,i),d=j0(c);return t.jsx(w.ToolbarButton,{active:i,tooltip:b0(c?`Column Break
|
|
40
40
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:L=>mV(o,r,L),...l,classNames:d})},su0=(e,l,o)=>wV(e)+1<l||o,fV=({id:e})=>t.jsx(C0,{id:e,children:t.jsx(iu0,{icon:t.jsx(p0,{icon:t.jsx(l3,{})}),classNames:j0(),styles:N0})}),ru0=(e,l)=>{const o=w.getStartPoint(e,l);setTimeout(()=>{w.select(e,{anchor:o,focus:o})})},cu0=e=>{var o;const l=e.plugins.find(i=>i.key===E1);return((o=l==null?void 0:l.options)==null?void 0:o.columns)??1},du0=e=>{const{apply:l}=e,o=cu0(e);e.apply=i=>{switch(i.type){case"split_node":i.properties={...i.properties,breakAfterColumn:void 0};break;case"merge_node":const s=w.getPointBefore(e,i.path);if(!s)break;const r=w.getParentNode(e,s.path);if(o2(e,{at:s,value:void 0}),we(e,o),r!=null&&r[0].breakAfterColumn)return ru0(e,i.path),e;break}l(i)},setTimeout(()=>we(e,o))},E1="breakAfterColumn",A7="normal";class hu0 extends t0{constructor(o){super("break-after-plugin",{button:fV,...o});W(this,"columns");W(this,"gap");this.columns=(o==null?void 0:o.columns)??1,this.gap=(o==null?void 0:o.gap)??A7}plugins(){return[xV(this.columns,this.gap)]}}const xV=(e,l)=>w.createPluginFactory({key:E1,handlers:{onKeyDown:ou0},useHooks:du0,options:{columns:e,gap:l,hotkey:["shift+ctrl+enter"]}})(),Lu0=12,uu0=26,wu0=124,mu0=e=>e.map((l,o)=>({group:l,buttonGroupWidth:l.reduce((i,s)=>s.id===TT?wu0:uu0+i,Lu0),index:o})),fu0=(e,l)=>l.reduce((o,{group:i,buttonGroupWidth:s,index:r})=>{const c=Math.max(0,o.length-1);return o[c]=o[c]??[],(o[c]??[{actions:[],buttonGroupWidth:0}]).reduce((h,{buttonGroupWidth:u})=>h+u,0)+s<=e?o[c].push({group:i,buttonGroupWidth:s,index:r}):o.push([{group:i,buttonGroupWidth:s,index:r}]),o.filter(h=>h.length)},[]),xu0=({index:e,children:l})=>t.jsx("div",{"data-test-id":`toolbar-group-${e}`,className:"tw-flex tw-items-center tw-h-9 tw-p-2",children:l}),vu0=({toolbarButtons:e,editorId:l,toolbarWidth:o})=>{const i=w.usePlateEditorRef(l),{editorWidth:s}=oT(),{position:r}=C1(),c=o||s||0,d=mu0(e.at(r)),h=fu0(c,d),u=ZV[r];return t.jsx(u.ToolbarWrapper,{editorWidth:s,toolbarWidth:o,toolbarButtonGroups:h,children:h.map((L,m)=>t.jsx("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",children:L.map(({group:f,index:g})=>t.jsx(xu0,{index:g,children:f.map((x,j)=>t.jsx(x.button,{editor:i,editorId:l,id:x.id},j.toString()))},g))},m))})},vV=e=>w.createPlugins(e.plugins,{components:w.createPlateUI(e.elements)}),j7=(e,l)=>({create:()=>vV(l),toolbar:o=>l.hasToolbar?t.jsx(vu0,{toolbarButtons:l.buttons,editorId:e,toolbarWidth:o}):null,inline:()=>t.jsx(t.Fragment,{children:l.inline.map((o,i)=>t.jsx(o,{},i))}),styles:()=>l.getStyles}),gu0="mention-plugin",Au0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),C7=(e,l)=>`${e}:${l}`,M7=e=>{const l=new Map;for(const o of e){const i=C7(o.data.category,o.data.id),s=o.text;l.set(i,s)}return l},gV=(e,l,o)=>e.get(l)??o;var K0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(K0||{});const I7=({attributes:e,element:l,nodeProps:o,children:i})=>t.jsx("span",{...e,dir:"auto","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)"},...o,children:i}),ju0=({children:e,...l})=>t.jsxs(I7,{...l,children:[t.jsx("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"},children:t.jsx(d5,{})}),e]}),Cu0=({children:e,...l})=>t.jsxs(I7,{...l,children:["@",e]}),Mu0=({children:e,...l})=>t.jsx(I7,{...l,children:e}),Iu0=({category:e,children:l,...o})=>{const i={[K0.USER]:Mu0,[K0.GROUP]:ju0,[K0.ALL]:Cu0},s=i[e]??i[K0.USER];return t.jsx(s,{...o,children:l})},Z7=e=>l=>{const{element:o,children:i}=l,s=C7(o==null?void 0:o.category,String(o==null?void 0:o.id));return t.jsxs(Iu0,{category:o==null?void 0:o.category,...l,children:[gV(e,s,String(o==null?void 0:o.id)),i]})};class AV extends e0{constructor(l=w.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=Z7(M7(l)),this}}const Zu0=({image:e,category:l,text:o,id:i})=>{if(e)return t.jsx("img",{src:e,alt:`${i}-${l}-${o}`});switch(l){case K0.GROUP:return t.jsx(d5,{});case K0.ALL:return t.jsx($e,{});default:return t.jsx(We,{})}},pu0=({item:e})=>{const{data:{image:l,category:o},key:i,text:s}=e;return t.jsxs("div",{className:"tw-flex tw-items-center tw-w-full tw-min-h-[inherit]",children:[t.jsx("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",children:t.jsx(Zu0,{image:l,category:o,text:s,id:i})}),t.jsx("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis",children:s})]})},H4=[`
|
|
41
41
|
color: var(--text-color-weak);
|
|
42
42
|
padding-left: 1.25rem;
|