@frontify/fondue 12.0.0-beta.249 → 12.0.0-beta.250

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.
@@ -1,4 +1,4 @@
1
- import { useMemoizedId as O } from "../../hooks/useMemoizedId.es.js";
1
+ import { useMemoizedId as A } from "../../hooks/useMemoizedId.es.js";
2
2
  import { Plate as v } from "@udecode/plate";
3
3
  import r from "react";
4
4
  import { ContentReplacement as w } from "./ContentReplacement.es.js";
@@ -14,42 +14,42 @@ const B = {
14
14
  position: "relative",
15
15
  height: "0"
16
16
  }, U = ({
17
- id: d,
17
+ id: p,
18
18
  value: l,
19
- placeholder: p = "",
20
- readonly: E = !1,
21
- onTextChange: f,
19
+ placeholder: E = "",
20
+ readonly: f = !1,
21
+ onTextChange: u,
22
22
  onBlur: m,
23
- padding: u = F.None,
24
- position: y = G.FLOATING,
23
+ padding: y = F.None,
24
+ position: T = G.FLOATING,
25
25
  plugins: i = C,
26
- updateValueOnChange: T = !1,
27
- onValueChanged: R,
28
- border: h = !0,
29
- toolbarWidth: L
26
+ updateValueOnChange: R = !1,
27
+ onValueChanged: h,
28
+ border: L = !0,
29
+ toolbarWidth: N
30
30
  }) => {
31
- var s, a;
32
- const n = O(d), { localValue: N, onChange: P, memoizedValue: S, config: t } = I({
31
+ var s, c;
32
+ const n = A(p), { localValue: O, onChange: P, memoizedValue: S, config: t } = I({
33
33
  editorId: n,
34
34
  initialValue: l,
35
- onTextChange: f,
35
+ onTextChange: u,
36
36
  plugins: i,
37
- onValueChanged: R
38
- }), e = i.plugins.find((o) => o.key === z), V = ((s = e == null ? void 0 : e.options) == null ? void 0 : s.columns) ?? 1, _ = ((a = e == null ? void 0 : e.options) == null ? void 0 : a.gap) ?? D, g = {
39
- placeholder: p,
40
- renderPlaceholder: ({ children: o, attributes: c }) => {
41
- const A = {
42
- ...c,
37
+ onValueChanged: h
38
+ }), e = i.plugins.find((o) => o.key === z), V = ((s = e == null ? void 0 : e.options) == null ? void 0 : s.columns) ?? 1, _ = ((c = e == null ? void 0 : e.options) == null ? void 0 : c.gap) ?? D, a = {
39
+ placeholder: E,
40
+ renderPlaceholder: ({ children: o, attributes: d }) => {
41
+ const g = {
42
+ ...d,
43
43
  style: {
44
- ...c.style,
44
+ ...d.style,
45
45
  ...B
46
46
  }
47
47
  };
48
- return /* @__PURE__ */ r.createElement("span", { ...A }, o);
48
+ return /* @__PURE__ */ r.createElement("span", { ...g }, o);
49
49
  },
50
- readOnly: E,
51
- onBlur: () => m && m(JSON.stringify(N.current)),
52
- className: `${u}`,
50
+ readOnly: f,
51
+ onBlur: () => m && m(JSON.stringify(O.current)),
52
+ className: `${y}`,
53
53
  style: {
54
54
  columns: V,
55
55
  columnGap: _
@@ -65,8 +65,8 @@ const B = {
65
65
  {
66
66
  value: {
67
67
  styles: t.styles(),
68
- position: y,
69
- border: h
68
+ position: T,
69
+ border: L
70
70
  }
71
71
  },
72
72
  /* @__PURE__ */ r.createElement(
@@ -74,13 +74,13 @@ const B = {
74
74
  {
75
75
  id: n,
76
76
  onChange: P,
77
- editableProps: g,
77
+ editableProps: a,
78
78
  plugins: t.create(),
79
79
  initialValue: S
80
80
  },
81
- t.toolbar(L),
81
+ !a.readOnly && t.toolbar(N),
82
82
  t.inline(),
83
- T && /* @__PURE__ */ r.createElement(w, { value: K({ editorId: n, raw: l, plugins: i }) })
83
+ R && /* @__PURE__ */ r.createElement(w, { value: K({ editorId: n, raw: l, plugins: i }) })
84
84
  )
85
85
  );
86
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { Plate, TEditableProps } from '@udecode/plate';\nimport React from 'react';\nimport { RenderPlaceholderProps } from 'slate-react';\nimport { ContentReplacement } from './ContentReplacement';\nimport { RichTextEditorProvider } from './context/RichTextEditorContext';\nimport { Position } from './EditorPositioningWrapper';\nimport { forceToBlurActiveElement } from './helpers';\nimport { useEditorState } from './hooks';\nimport { GAP_DEFAULT, KEY_ELEMENT_BREAK_AFTER_COLUMN, PluginComposer, defaultPlugins } from './Plugins';\nimport { PaddingSizes, TreeOfNodes } from './types';\nimport { parseRawValue } from './utils';\n\nconst PLACEHOLDER_STYLES: RenderPlaceholderProps['attributes']['style'] = {\n position: 'relative',\n height: '0',\n};\n\nexport type RichTextEditorProps = {\n id?: string;\n placeholder?: string;\n value?: string;\n onTextChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n readonly?: boolean;\n padding?: PaddingSizes;\n position?: Position;\n plugins?: PluginComposer;\n onValueChanged?: (value: TreeOfNodes | null) => void;\n border?: boolean;\n updateValueOnChange?: boolean; // Only set to true when you are sure that performance isn't an issue\n toolbarWidth?: number;\n};\n\nexport const RichTextEditor = ({\n id,\n value,\n placeholder = '',\n readonly = false,\n onTextChange,\n onBlur,\n padding = PaddingSizes.None,\n position = Position.FLOATING,\n plugins = defaultPlugins,\n updateValueOnChange = false,\n onValueChanged,\n border = true,\n toolbarWidth,\n}: RichTextEditorProps) => {\n const editorId = useMemoizedId(id);\n const { localValue, onChange, memoizedValue, config } = useEditorState({\n editorId,\n initialValue: value,\n onTextChange,\n plugins,\n onValueChanged,\n });\n\n const breakAfterPlugin = plugins.plugins.find((plugin) => plugin.key === KEY_ELEMENT_BREAK_AFTER_COLUMN);\n const columns = breakAfterPlugin?.options?.columns ?? 1;\n const columnGap = breakAfterPlugin?.options?.gap ?? GAP_DEFAULT;\n\n const editableProps: TEditableProps = {\n placeholder,\n renderPlaceholder: ({ children, attributes }) => {\n const mergedAttributes = {\n ...attributes,\n style: {\n ...attributes.style,\n ...PLACEHOLDER_STYLES,\n },\n };\n return <span {...mergedAttributes}>{children}</span>;\n },\n readOnly: readonly,\n onBlur: () => onBlur && onBlur(JSON.stringify(localValue.current)),\n className: `${padding}`,\n style: {\n columns,\n columnGap,\n },\n onKeyDown: (event) => {\n if (event.code === 'Tab') {\n // Forcing a blur event because of accessibility\n forceToBlurActiveElement();\n }\n },\n scrollSelectionIntoView: () => {\n // We pass in an empty function here because we don't want the default scroll behaviour\n },\n };\n\n return (\n <RichTextEditorProvider\n value={{\n styles: config.styles(),\n position,\n border,\n }}\n >\n <Plate\n id={editorId}\n onChange={onChange}\n editableProps={editableProps}\n plugins={config.create()}\n initialValue={memoizedValue}\n >\n {config.toolbar(toolbarWidth)}\n {config.inline()}\n {updateValueOnChange && <ContentReplacement value={parseRawValue({ editorId, raw: value, plugins })} />}\n </Plate>\n </RichTextEditorProvider>\n );\n};\nRichTextEditor.displayName = 'FondueRichTextEditor';\n"],"names":["PLACEHOLDER_STYLES","RichTextEditor","id","value","placeholder","readonly","onTextChange","onBlur","padding","PaddingSizes","position","Position","plugins","defaultPlugins","updateValueOnChange","onValueChanged","border","toolbarWidth","editorId","useMemoizedId","localValue","onChange","memoizedValue","config","useEditorState","breakAfterPlugin","plugin","KEY_ELEMENT_BREAK_AFTER_COLUMN","columns","_a","columnGap","_b","GAP_DEFAULT","editableProps","children","attributes","mergedAttributes","React","event","forceToBlurActiveElement","RichTextEditorProvider","Plate","ContentReplacement","parseRawValue"],"mappings":";;;;;;;;;;;;AAeA,MAAMA,IAAoE;AAAA,EACtE,UAAU;AAAA,EACV,QAAQ;AACZ,GAkBaC,IAAiB,CAAC;AAAA,EAC3B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC,IAAW;AAAA,EACX,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAUC,EAAa;AAAA,EACvB,UAAAC,IAAWC,EAAS;AAAA,EACpB,SAAAC,IAAUC;AAAA,EACV,qBAAAC,IAAsB;AAAA,EACtB,gBAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,cAAAC;AACJ,MAA2B;;AACjB,QAAAC,IAAWC,EAAcjB,CAAE,GAC3B,EAAE,YAAAkB,GAAY,UAAAC,GAAU,eAAAC,GAAe,QAAAC,EAAA,IAAWC,EAAe;AAAA,IACnE,UAAAN;AAAA,IACA,cAAcf;AAAA,IACd,cAAAG;AAAA,IACA,SAAAM;AAAA,IACA,gBAAAG;AAAA,EAAA,CACH,GAEKU,IAAmBb,EAAQ,QAAQ,KAAK,CAACc,MAAWA,EAAO,QAAQC,CAA8B,GACjGC,MAAUC,IAAAJ,KAAA,gBAAAA,EAAkB,YAAlB,gBAAAI,EAA2B,YAAW,GAChDC,MAAYC,IAAAN,KAAA,gBAAAA,EAAkB,YAAlB,gBAAAM,EAA2B,QAAOC,GAE9CC,IAAgC;AAAA,IAClC,aAAA7B;AAAA,IACA,mBAAmB,CAAC,EAAE,UAAA8B,GAAU,YAAAC,QAAiB;AAC7C,YAAMC,IAAmB;AAAA,QACrB,GAAGD;AAAA,QACH,OAAO;AAAA,UACH,GAAGA,EAAW;AAAA,UACd,GAAGnC;AAAA,QACP;AAAA,MAAA;AAEJ,aAAQ,gBAAAqC,EAAA,cAAA,QAAA,EAAM,GAAGD,EAAA,GAAmBF,CAAS;AAAA,IACjD;AAAA,IACA,UAAU7B;AAAA,IACV,QAAQ,MAAME,KAAUA,EAAO,KAAK,UAAUa,EAAW,OAAO,CAAC;AAAA,IACjE,WAAW,GAAGZ;AAAA,IACd,OAAO;AAAA,MACH,SAAAoB;AAAA,MACA,WAAAE;AAAA,IACJ;AAAA,IACA,WAAW,CAACQ,MAAU;AACd,MAAAA,EAAM,SAAS,SAEUC;IAEjC;AAAA,IACA,yBAAyB,MAAM;AAAA,IAE/B;AAAA,EAAA;AAIA,SAAA,gBAAAF,EAAA;AAAA,IAACG;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,QAAQjB,EAAO,OAAO;AAAA,QACtB,UAAAb;AAAA,QACA,QAAAM;AAAA,MACJ;AAAA,IAAA;AAAA,IAEA,gBAAAqB,EAAA;AAAA,MAACI;AAAA,MAAA;AAAA,QACG,IAAIvB;AAAA,QACJ,UAAAG;AAAA,QACA,eAAAY;AAAA,QACA,SAASV,EAAO,OAAO;AAAA,QACvB,cAAcD;AAAA,MAAA;AAAA,MAEbC,EAAO,QAAQN,CAAY;AAAA,MAC3BM,EAAO,OAAO;AAAA,MACdT,KAAwB,gBAAAuB,EAAA,cAAAK,GAAA,EAAmB,OAAOC,EAAc,EAAE,UAAAzB,GAAU,KAAKf,GAAO,SAAAS,EAAQ,CAAC,EAAG,CAAA;AAAA,IACzG;AAAA,EAAA;AAGZ;AACAX,EAAe,cAAc;"}
1
+ {"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { Plate, TEditableProps } from '@udecode/plate';\nimport React from 'react';\nimport { RenderPlaceholderProps } from 'slate-react';\nimport { ContentReplacement } from './ContentReplacement';\nimport { RichTextEditorProvider } from './context/RichTextEditorContext';\nimport { Position } from './EditorPositioningWrapper';\nimport { forceToBlurActiveElement } from './helpers';\nimport { useEditorState } from './hooks';\nimport { GAP_DEFAULT, KEY_ELEMENT_BREAK_AFTER_COLUMN, PluginComposer, defaultPlugins } from './Plugins';\nimport { PaddingSizes, TreeOfNodes } from './types';\nimport { parseRawValue } from './utils';\n\nconst PLACEHOLDER_STYLES: RenderPlaceholderProps['attributes']['style'] = {\n position: 'relative',\n height: '0',\n};\n\nexport type RichTextEditorProps = {\n id?: string;\n placeholder?: string;\n value?: string;\n onTextChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n readonly?: boolean;\n padding?: PaddingSizes;\n position?: Position;\n plugins?: PluginComposer;\n onValueChanged?: (value: TreeOfNodes | null) => void;\n border?: boolean;\n updateValueOnChange?: boolean; // Only set to true when you are sure that performance isn't an issue\n toolbarWidth?: number;\n};\n\nexport const RichTextEditor = ({\n id,\n value,\n placeholder = '',\n readonly = false,\n onTextChange,\n onBlur,\n padding = PaddingSizes.None,\n position = Position.FLOATING,\n plugins = defaultPlugins,\n updateValueOnChange = false,\n onValueChanged,\n border = true,\n toolbarWidth,\n}: RichTextEditorProps) => {\n const editorId = useMemoizedId(id);\n const { localValue, onChange, memoizedValue, config } = useEditorState({\n editorId,\n initialValue: value,\n onTextChange,\n plugins,\n onValueChanged,\n });\n\n const breakAfterPlugin = plugins.plugins.find((plugin) => plugin.key === KEY_ELEMENT_BREAK_AFTER_COLUMN);\n const columns = breakAfterPlugin?.options?.columns ?? 1;\n const columnGap = breakAfterPlugin?.options?.gap ?? GAP_DEFAULT;\n\n const editableProps: TEditableProps = {\n placeholder,\n renderPlaceholder: ({ children, attributes }) => {\n const mergedAttributes = {\n ...attributes,\n style: {\n ...attributes.style,\n ...PLACEHOLDER_STYLES,\n },\n };\n return <span {...mergedAttributes}>{children}</span>;\n },\n readOnly: readonly,\n onBlur: () => onBlur && onBlur(JSON.stringify(localValue.current)),\n className: `${padding}`,\n style: {\n columns,\n columnGap,\n },\n onKeyDown: (event) => {\n if (event.code === 'Tab') {\n // Forcing a blur event because of accessibility\n forceToBlurActiveElement();\n }\n },\n scrollSelectionIntoView: () => {\n // We pass in an empty function here because we don't want the default scroll behaviour\n },\n };\n\n return (\n <RichTextEditorProvider\n value={{\n styles: config.styles(),\n position,\n border,\n }}\n >\n <Plate\n id={editorId}\n onChange={onChange}\n editableProps={editableProps}\n plugins={config.create()}\n initialValue={memoizedValue}\n >\n {!editableProps.readOnly && config.toolbar(toolbarWidth)}\n {config.inline()}\n {updateValueOnChange && <ContentReplacement value={parseRawValue({ editorId, raw: value, plugins })} />}\n </Plate>\n </RichTextEditorProvider>\n );\n};\nRichTextEditor.displayName = 'FondueRichTextEditor';\n"],"names":["PLACEHOLDER_STYLES","RichTextEditor","id","value","placeholder","readonly","onTextChange","onBlur","padding","PaddingSizes","position","Position","plugins","defaultPlugins","updateValueOnChange","onValueChanged","border","toolbarWidth","editorId","useMemoizedId","localValue","onChange","memoizedValue","config","useEditorState","breakAfterPlugin","plugin","KEY_ELEMENT_BREAK_AFTER_COLUMN","columns","_a","columnGap","_b","GAP_DEFAULT","editableProps","children","attributes","mergedAttributes","React","event","forceToBlurActiveElement","RichTextEditorProvider","Plate","ContentReplacement","parseRawValue"],"mappings":";;;;;;;;;;;;AAeA,MAAMA,IAAoE;AAAA,EACtE,UAAU;AAAA,EACV,QAAQ;AACZ,GAkBaC,IAAiB,CAAC;AAAA,EAC3B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC,IAAW;AAAA,EACX,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAUC,EAAa;AAAA,EACvB,UAAAC,IAAWC,EAAS;AAAA,EACpB,SAAAC,IAAUC;AAAA,EACV,qBAAAC,IAAsB;AAAA,EACtB,gBAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,cAAAC;AACJ,MAA2B;;AACjB,QAAAC,IAAWC,EAAcjB,CAAE,GAC3B,EAAE,YAAAkB,GAAY,UAAAC,GAAU,eAAAC,GAAe,QAAAC,EAAA,IAAWC,EAAe;AAAA,IACnE,UAAAN;AAAA,IACA,cAAcf;AAAA,IACd,cAAAG;AAAA,IACA,SAAAM;AAAA,IACA,gBAAAG;AAAA,EAAA,CACH,GAEKU,IAAmBb,EAAQ,QAAQ,KAAK,CAACc,MAAWA,EAAO,QAAQC,CAA8B,GACjGC,MAAUC,IAAAJ,KAAA,gBAAAA,EAAkB,YAAlB,gBAAAI,EAA2B,YAAW,GAChDC,MAAYC,IAAAN,KAAA,gBAAAA,EAAkB,YAAlB,gBAAAM,EAA2B,QAAOC,GAE9CC,IAAgC;AAAA,IAClC,aAAA7B;AAAA,IACA,mBAAmB,CAAC,EAAE,UAAA8B,GAAU,YAAAC,QAAiB;AAC7C,YAAMC,IAAmB;AAAA,QACrB,GAAGD;AAAA,QACH,OAAO;AAAA,UACH,GAAGA,EAAW;AAAA,UACd,GAAGnC;AAAA,QACP;AAAA,MAAA;AAEJ,aAAQ,gBAAAqC,EAAA,cAAA,QAAA,EAAM,GAAGD,EAAA,GAAmBF,CAAS;AAAA,IACjD;AAAA,IACA,UAAU7B;AAAA,IACV,QAAQ,MAAME,KAAUA,EAAO,KAAK,UAAUa,EAAW,OAAO,CAAC;AAAA,IACjE,WAAW,GAAGZ;AAAA,IACd,OAAO;AAAA,MACH,SAAAoB;AAAA,MACA,WAAAE;AAAA,IACJ;AAAA,IACA,WAAW,CAACQ,MAAU;AACd,MAAAA,EAAM,SAAS,SAEUC;IAEjC;AAAA,IACA,yBAAyB,MAAM;AAAA,IAE/B;AAAA,EAAA;AAIA,SAAA,gBAAAF,EAAA;AAAA,IAACG;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,QAAQjB,EAAO,OAAO;AAAA,QACtB,UAAAb;AAAA,QACA,QAAAM;AAAA,MACJ;AAAA,IAAA;AAAA,IAEA,gBAAAqB,EAAA;AAAA,MAACI;AAAA,MAAA;AAAA,QACG,IAAIvB;AAAA,QACJ,UAAAG;AAAA,QACA,eAAAY;AAAA,QACA,SAASV,EAAO,OAAO;AAAA,QACvB,cAAcD;AAAA,MAAA;AAAA,MAEb,CAACW,EAAc,YAAYV,EAAO,QAAQN,CAAY;AAAA,MACtDM,EAAO,OAAO;AAAA,MACdT,KAAwB,gBAAAuB,EAAA,cAAAK,GAAA,EAAmB,OAAOC,EAAc,EAAE,UAAAzB,GAAU,KAAKf,GAAO,SAAAS,EAAQ,CAAC,EAAG,CAAA;AAAA,IACzG;AAAA,EAAA;AAGZ;AACAX,EAAe,cAAc;"}
package/dist/index.cjs.js CHANGED
@@ -68,7 +68,7 @@ Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:u=>fV(a,
68
68
  font-weight: bold;
69
69
  line-height: 10px;
70
70
  border-radius: 2px;
71
- `]},TL0=e=>t.createElement(w.MentionInputElement,{...e,styles:VL0});class jL0 extends n0{constructor(l=w.ELEMENT_MENTION_INPUT,a=TL0){super(l,a)}}class DL0 extends a0{constructor(l){super(xL0,{markupElement:new EV().setNodeWithMentionable(l.mentionableItems),markupInputElement:new jL0,...l})}inline(){var l;return kL0(((l=this.props)==null?void 0:l.mentionableItems)||[])}plugins(){return[w.createComboboxPlugin(),w.createMentionPlugin(zL0)]}}const FL0="blur-on-break-plugin",h3=()=>{var e;(e=document.activeElement)==null||e.blur()},BL0=(e,{options:{onBreak:l=()=>{}}})=>a=>{w.Hotkeys.isSplitBlock(a)&&(a.stopPropagation(),a.preventDefault(),h3(),typeof l=="function"&&l(e.children))},OL0="blurOnBreak",PL0=w.createPluginFactory({key:OL0,handlers:{onKeyDown:BL0}});class UL0 extends a0{constructor(a){super(FL0,{...a});U(this,"onBreak");this.onBreak=a==null?void 0:a.onBreak}plugins(){return[PL0({options:{onBreak:this.onBreak}})]}}const O1=new aV;O1.setPlugin(new pz).setPlugin(new Gz({textStyles:[new Oz]})).setPlugin([new Ez,new yz,new wV,new LV,new bz,new xz],[new hz,new wz,new vz,new fz,new nV,new dz,new _z,new iV,new Zz]);class e2{static getInstance(){return this.editor===void 0&&this.init(),this.editor}static init(l=R1(),a=O1){const c=m3(l,a);return this.editor=w.createPlateEditor({id:l,plugins:c.create()}),this}}U(e2,"editor"),U(e2,"editorId",R1());const QL0=e=>new DOMParser().parseFromString(e,"text/html").body.children.length>0,YL0=e=>QL0(e)?e:`<p>${e}</p>`,MV=[{type:w.ELEMENT_PARAGRAPH,children:[{text:""}]}],h2=({editorId:e="parseRawValue",raw:l,plugins:a})=>{const c=e2.init(`${e}_parseRawValue`,a).getInstance();let r=MV;if(!l)return r;try{r=JSON.parse(l)}catch{const o=l.trim().replaceAll(/>\s+</g,"><"),i=YL0(o),s=w.deserializeHtml(c,{element:i,stripWhitespace:!0});s&&(r=s)}return c.children=r,w.normalizeEditor(c,{force:!0}),c.children},R2=e=>e&&typeof e=="object"&&!Array.isArray(e),IV=(e,l)=>{if(!R2(e)||!R2(l))return{};const a=Object.assign({},e);for(const c of Object.keys(l)){if(c in e&&R2(l[c])){a[c]=IV(e[c],l[c]);continue}Object.assign(a,{[c]:l[c]})}return a},GL0=e=>e.hasOwnProperty("type")&&typeof e.type=="string"&&e.type.length>0,WL0=e=>e.hasOwnProperty("children")&&Array.isArray(e.children)&&e.children.length===1,qL0=e=>typeof e=="object"&&e.hasOwnProperty("text")&&typeof e.text=="string"&&e.text.length===0,KL0=e=>WL0(e)&&qL0(e.children[0]),$L0=e=>{if(!e)return!0;if(Array.isArray(e)&&e.length<2){if(e.length===0)return!0;const l=e[0];if(GL0(l)&&KL0(l))return!0}return!1},XL0=({children:e,editorWidth:l,toolbarButtonGroups:a=[],toolbarWidth:c})=>{const[r,o]=t.useState();return t.useEffect(()=>{if(c)o(c);else{const i=az(a);i>0&&o(i+a.length+nz)}},[l,c,a]),t.createElement(w.BalloonToolbar,{floatingOptions:{middleware:[w.flip(),w.shift()]},styles:{root:{border:"none",background:"#ffffff",width:r}}},t.createElement("div",{"data-test-id":"toolbar-floating",className:"tw-rounded tw-min-h-12 tw-border tw-border-line tw-shadow-lg tw-bg-base tw-divide-y tw-divide-line tw-flex tw-flex-wrap"},e))},xV={[h0.BOTTOM]:{PlateWrapperClassNames:"tw-relative tw-w-full tw-flex tw-flex-col",ToolbarWrapper:$i0},[h0.FLOATING]:{PlateWrapperClassNames:"tw-relative tw-w-full",ToolbarWrapper:XL0},[h0.TOP]:{PlateWrapperClassNames:"tw-relative tw-w-full tw-flex tw-flex-col-reverse",ToolbarWrapper:Xi0}},JL0=(e,l)=>{const a=xV[e].PlateWrapperClassNames;return g([a,l&&"tw-border tw-border-line-strong tw-rounded"])},_L0=({children:e,apply:l})=>{for(const a of e)l({type:"remove_node",path:[0],node:a})},eu0=({value:e})=>{const l=w.usePlateEditorRef();return t.useEffect(()=>{e&&(_L0(l),w.insertNodes(l,e))},[l,e]),null},tu0={position:"relative",height:"0"},ZV=({id:e,value:l,placeholder:a="",readonly:c=!1,onTextChange:r,onBlur:o,padding:i=Wt.None,position:s=h0.FLOATING,plugins:m=O1,updateValueOnChange:L=!1,onValueChanged:u,border:h=!0,toolbarWidth:d})=>{var R,N;const v=E0(e),{localValue:f,onChange:E,memoizedValue:A,config:C}=ts0({editorId:v,initialValue:l,onTextChange:r,plugins:m,onValueChanged:u}),x=m.plugins.find(M=>M.key===B1),I=((R=x==null?void 0:x.options)==null?void 0:R.columns)??1,Z=((N=x==null?void 0:x.options)==null?void 0:N.gap)??s3,y={placeholder:a,renderPlaceholder:({children:M,attributes:S})=>{const b={...S,style:{...S.style,...tu0}};return t.createElement("span",{...b},M)},readOnly:c,onBlur:()=>o&&o(JSON.stringify(f.current)),className:`${i}`,style:{columns:I,columnGap:Z},onKeyDown:M=>{M.code==="Tab"&&h3()},scrollSelectionIntoView:()=>{}};return t.createElement(oz,{value:{styles:C.styles(),position:s,border:h}},t.createElement(w.Plate,{id:v,onChange:E,editableProps:y,plugins:C.create(),initialValue:A},C.toolbar(d),C.inline(),L&&t.createElement(eu0,{value:h2({editorId:v,raw:l,plugins:m})})))};ZV.displayName="FondueRichTextEditor";const n7=e=>e.split("").reverse().join(""),x1=(e,l)=>{const a=e.trim(),c=a,r=`${l}${c}${n7(l)}`;if(c.length===e.length)return r;const o=l+c+n7(l);return e.replace(a,o)},lu0=(e,l)=>{const a=`
71
+ `]},TL0=e=>t.createElement(w.MentionInputElement,{...e,styles:VL0});class jL0 extends n0{constructor(l=w.ELEMENT_MENTION_INPUT,a=TL0){super(l,a)}}class DL0 extends a0{constructor(l){super(xL0,{markupElement:new EV().setNodeWithMentionable(l.mentionableItems),markupInputElement:new jL0,...l})}inline(){var l;return kL0(((l=this.props)==null?void 0:l.mentionableItems)||[])}plugins(){return[w.createComboboxPlugin(),w.createMentionPlugin(zL0)]}}const FL0="blur-on-break-plugin",h3=()=>{var e;(e=document.activeElement)==null||e.blur()},BL0=(e,{options:{onBreak:l=()=>{}}})=>a=>{w.Hotkeys.isSplitBlock(a)&&(a.stopPropagation(),a.preventDefault(),h3(),typeof l=="function"&&l(e.children))},OL0="blurOnBreak",PL0=w.createPluginFactory({key:OL0,handlers:{onKeyDown:BL0}});class UL0 extends a0{constructor(a){super(FL0,{...a});U(this,"onBreak");this.onBreak=a==null?void 0:a.onBreak}plugins(){return[PL0({options:{onBreak:this.onBreak}})]}}const O1=new aV;O1.setPlugin(new pz).setPlugin(new Gz({textStyles:[new Oz]})).setPlugin([new Ez,new yz,new wV,new LV,new bz,new xz],[new hz,new wz,new vz,new fz,new nV,new dz,new _z,new iV,new Zz]);class e2{static getInstance(){return this.editor===void 0&&this.init(),this.editor}static init(l=R1(),a=O1){const c=m3(l,a);return this.editor=w.createPlateEditor({id:l,plugins:c.create()}),this}}U(e2,"editor"),U(e2,"editorId",R1());const QL0=e=>new DOMParser().parseFromString(e,"text/html").body.children.length>0,YL0=e=>QL0(e)?e:`<p>${e}</p>`,MV=[{type:w.ELEMENT_PARAGRAPH,children:[{text:""}]}],h2=({editorId:e="parseRawValue",raw:l,plugins:a})=>{const c=e2.init(`${e}_parseRawValue`,a).getInstance();let r=MV;if(!l)return r;try{r=JSON.parse(l)}catch{const o=l.trim().replaceAll(/>\s+</g,"><"),i=YL0(o),s=w.deserializeHtml(c,{element:i,stripWhitespace:!0});s&&(r=s)}return c.children=r,w.normalizeEditor(c,{force:!0}),c.children},R2=e=>e&&typeof e=="object"&&!Array.isArray(e),IV=(e,l)=>{if(!R2(e)||!R2(l))return{};const a=Object.assign({},e);for(const c of Object.keys(l)){if(c in e&&R2(l[c])){a[c]=IV(e[c],l[c]);continue}Object.assign(a,{[c]:l[c]})}return a},GL0=e=>e.hasOwnProperty("type")&&typeof e.type=="string"&&e.type.length>0,WL0=e=>e.hasOwnProperty("children")&&Array.isArray(e.children)&&e.children.length===1,qL0=e=>typeof e=="object"&&e.hasOwnProperty("text")&&typeof e.text=="string"&&e.text.length===0,KL0=e=>WL0(e)&&qL0(e.children[0]),$L0=e=>{if(!e)return!0;if(Array.isArray(e)&&e.length<2){if(e.length===0)return!0;const l=e[0];if(GL0(l)&&KL0(l))return!0}return!1},XL0=({children:e,editorWidth:l,toolbarButtonGroups:a=[],toolbarWidth:c})=>{const[r,o]=t.useState();return t.useEffect(()=>{if(c)o(c);else{const i=az(a);i>0&&o(i+a.length+nz)}},[l,c,a]),t.createElement(w.BalloonToolbar,{floatingOptions:{middleware:[w.flip(),w.shift()]},styles:{root:{border:"none",background:"#ffffff",width:r}}},t.createElement("div",{"data-test-id":"toolbar-floating",className:"tw-rounded tw-min-h-12 tw-border tw-border-line tw-shadow-lg tw-bg-base tw-divide-y tw-divide-line tw-flex tw-flex-wrap"},e))},xV={[h0.BOTTOM]:{PlateWrapperClassNames:"tw-relative tw-w-full tw-flex tw-flex-col",ToolbarWrapper:$i0},[h0.FLOATING]:{PlateWrapperClassNames:"tw-relative tw-w-full",ToolbarWrapper:XL0},[h0.TOP]:{PlateWrapperClassNames:"tw-relative tw-w-full tw-flex tw-flex-col-reverse",ToolbarWrapper:Xi0}},JL0=(e,l)=>{const a=xV[e].PlateWrapperClassNames;return g([a,l&&"tw-border tw-border-line-strong tw-rounded"])},_L0=({children:e,apply:l})=>{for(const a of e)l({type:"remove_node",path:[0],node:a})},eu0=({value:e})=>{const l=w.usePlateEditorRef();return t.useEffect(()=>{e&&(_L0(l),w.insertNodes(l,e))},[l,e]),null},tu0={position:"relative",height:"0"},ZV=({id:e,value:l,placeholder:a="",readonly:c=!1,onTextChange:r,onBlur:o,padding:i=Wt.None,position:s=h0.FLOATING,plugins:m=O1,updateValueOnChange:L=!1,onValueChanged:u,border:h=!0,toolbarWidth:d})=>{var R,N;const v=E0(e),{localValue:f,onChange:E,memoizedValue:A,config:C}=ts0({editorId:v,initialValue:l,onTextChange:r,plugins:m,onValueChanged:u}),x=m.plugins.find(M=>M.key===B1),I=((R=x==null?void 0:x.options)==null?void 0:R.columns)??1,Z=((N=x==null?void 0:x.options)==null?void 0:N.gap)??s3,y={placeholder:a,renderPlaceholder:({children:M,attributes:S})=>{const b={...S,style:{...S.style,...tu0}};return t.createElement("span",{...b},M)},readOnly:c,onBlur:()=>o&&o(JSON.stringify(f.current)),className:`${i}`,style:{columns:I,columnGap:Z},onKeyDown:M=>{M.code==="Tab"&&h3()},scrollSelectionIntoView:()=>{}};return t.createElement(oz,{value:{styles:C.styles(),position:s,border:h}},t.createElement(w.Plate,{id:v,onChange:E,editableProps:y,plugins:C.create(),initialValue:A},!y.readOnly&&C.toolbar(d),C.inline(),L&&t.createElement(eu0,{value:h2({editorId:v,raw:l,plugins:m})})))};ZV.displayName="FondueRichTextEditor";const n7=e=>e.split("").reverse().join(""),x1=(e,l)=>{const a=e.trim(),c=a,r=`${l}${c}${n7(l)}`;if(c.length===e.length)return r;const o=l+c+n7(l);return e.replace(a,o)},lu0=(e,l)=>{const a=`
72
72
  `;return(l.strikethrough||l.bold||l.italic)&&new RegExp(a,"g").test(e)&&(e=e.replaceAll(a,`\\
73
73
  `)),e},nu0=(e,l)=>(l.strikethrough&&l.bold&&l.italic?e=x1(e,"~~***"):l.bold&&l.italic?e=x1(e,"***"):(l.bold&&(e=x1(e,"**")),l.italic&&(e=x1(e,"_")),l.strikethrough&&(e=x1(e,"~~")),l.code&&(e=x1(e,"`"))),e=lu0(e,l),e),k1=e=>!("type"in e),au0={paragraph:"paragraph",blockQuote:"block_quote",codeBlock:"code_block",link:"link",ulList:"ul_list",olList:"ol_list",listItem:"list_item",listItemChild:"lic",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasisMark:"italic",strongMark:"bold",deleteMark:"strikethrough",inlineCodeMark:"code",thematicBreak:"thematic_break",image:"image",mention:"mention"},q2={Blank:"_blank",Self:"_self"},cu0=e=>`@[${e.category}:${e.id}]`,ru0=e=>`${e}
74
74
  `,ou0=(e,l,a,c)=>{const r=a&&a.parentType===e.olList,o=a.children.length===1&&k1(a.children[0]);let i="";for(let s=0;c>s;s++)r?i+=" ":i+=" ";return`${i}${r?"1.":"-"} ${l}${o?`