@frontify/guideline-blocks-settings 0.35.0 → 0.36.0

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.
Files changed (42) hide show
  1. package/dist/components/RichTextEditor/RichTextEditor.es.js +37 -27
  2. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  3. package/dist/components/RichTextEditor/SerializedText.es.js +8 -8
  4. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  5. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +8 -8
  6. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +27 -0
  7. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -0
  8. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -0
  9. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -0
  10. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +1 -1
  11. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +1 -1
  12. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +1 -1
  13. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +1 -1
  14. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +1 -1
  15. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +1 -1
  16. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +1 -1
  17. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +1 -1
  18. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +1 -1
  19. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +1 -1
  20. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +1 -1
  21. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +1 -1
  22. package/dist/index.cjs.js +3 -3
  23. package/dist/index.cjs.js.map +1 -1
  24. package/dist/index.d.ts +16 -3
  25. package/dist/index.es.js +167 -163
  26. package/dist/index.es.js.map +1 -1
  27. package/dist/index.umd.js +3 -3
  28. package/dist/index.umd.js.map +1 -1
  29. package/dist/settings/border.es.js +1 -1
  30. package/dist/settings/borderRadius.es.js +1 -1
  31. package/dist/settings/borderRadiusExtended.es.js +1 -1
  32. package/dist/settings/gutter.es.js +1 -1
  33. package/dist/settings/margin.es.js +1 -1
  34. package/dist/settings/marginExtended.es.js +1 -1
  35. package/dist/settings/padding.es.js +1 -1
  36. package/dist/settings/paddingExtended.es.js +1 -1
  37. package/dist/settings/securityGlobalControl.es.js +1 -1
  38. package/dist/styles.css +1 -1
  39. package/package.json +4 -4
  40. package/tailwind.config.ts +3 -1
  41. package/dist/styles.css.es.js +0 -2
  42. package/dist/styles.css.es.js.map +0 -1
@@ -1,59 +1,69 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { RichTextEditor as x } from "@frontify/fondue";
3
- import { memo as R, useState as h, useCallback as a, useEffect as p, useRef as v } from "react";
4
- import { useIsInViewport as P } from "../../hooks/useIsInViewport.es.js";
2
+ import { RichTextEditor as V } from "@frontify/fondue";
3
+ import { memo as v, useState as h, useCallback as a, useEffect as p, useRef as P } from "react";
4
+ import { useIsInViewport as C } from "../../hooks/useIsInViewport.es.js";
5
5
  import { SerializedText as I } from "./SerializedText.es.js";
6
- import { floatingButtonSelectors as L, floatingButtonActions as S } from "./plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js";
7
- const E = R(
6
+ import { getResponsiveColumnClasses as L } from "./plugins/ColumnBreakPlugin/helpers.es.js";
7
+ import { floatingButtonSelectors as S, floatingButtonActions as H } from "./plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js";
8
+ const E = v(
8
9
  ({
9
10
  id: d = "rte",
10
11
  isEnabled: i,
11
12
  value: t,
12
13
  columns: n,
13
- gap: r,
14
- placeholder: f,
14
+ gap: o,
15
+ placeholder: c,
15
16
  plugins: s,
16
- onTextChange: o,
17
+ onTextChange: r,
17
18
  showSerializedText: w
18
19
  }) => {
19
- const [c, u] = h(!1), b = a(
20
+ const g = L(n), [f, u] = h(!1), b = a(
20
21
  (e) => {
21
- e !== t && (o == null || o(e)), u(!1);
22
+ e !== t && (r == null || r(e)), u(!1);
22
23
  },
23
- [o, t]
24
- ), g = a(() => u(!0), []), V = a((e) => {
25
- L.isOpen(e) && S.reset();
24
+ [r, t]
25
+ ), x = a(() => u(!0), []), R = a((e) => {
26
+ S.isOpen(e) && H.reset();
26
27
  }, []);
27
28
  return p(() => {
28
29
  const e = (m) => {
29
30
  m.preventDefault(), m.returnValue = "Unprocessed changes";
30
31
  };
31
- return c && window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
32
- }, [c]), i ? /* @__PURE__ */ l(
33
- x,
32
+ return f && window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
33
+ }, [f]), i ? /* @__PURE__ */ l(
34
+ V,
34
35
  {
35
36
  id: d,
36
37
  value: t,
37
38
  border: !1,
38
- placeholder: f,
39
+ placeholder: c,
39
40
  plugins: s,
40
- onValueChanged: g,
41
+ onValueChanged: x,
41
42
  onTextChange: b,
42
- hideExternalFloatingModals: V
43
+ hideExternalFloatingModals: R
43
44
  }
44
- ) : /* @__PURE__ */ l(I, { value: t, columns: n, gap: r, show: w, plugins: s });
45
+ ) : /* @__PURE__ */ l(
46
+ I,
47
+ {
48
+ value: t,
49
+ gap: o,
50
+ customClass: g,
51
+ show: w,
52
+ plugins: s
53
+ }
54
+ );
45
55
  }
46
56
  );
47
57
  E.displayName = "InternalRichTextEditor";
48
- const M = (d) => {
49
- const i = v(null), [t, n] = h(!1), { isEditing: r, ...f } = d, s = a((o) => {
50
- o && n(!0);
58
+ const j = (d) => {
59
+ const i = P(null), [t, n] = h(!1), { isEditing: o, ...c } = d, s = a((r) => {
60
+ r && n(!0);
51
61
  }, []);
52
- return P({ ref: i, disabled: !r, onChange: s }), p(() => {
53
- r || n(!1);
54
- }, [r]), /* @__PURE__ */ l("div", { className: "tw-block tw-w-full", ref: i, children: /* @__PURE__ */ l(E, { ...f, isEnabled: r && t }) });
62
+ return C({ ref: i, disabled: !o, onChange: s }), p(() => {
63
+ o || n(!1);
64
+ }, [o]), /* @__PURE__ */ l("div", { "data-test-id": "rich-text-editor-container", className: "tw-block tw-w-full tw-@container", ref: i, children: /* @__PURE__ */ l(E, { ...c, isEnabled: o && t }) });
55
65
  };
56
66
  export {
57
- M as RichTextEditor
67
+ j as RichTextEditor
58
68
  };
59
69
  //# sourceMappingURL=RichTextEditor.es.js.map
@@ -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 { RichTextEditor as FondueRichTextEditor } from '@frontify/fondue';\nimport { memo, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useIsInViewport } from '../../hooks/useIsInViewport';\n\nimport { SerializedText } from './SerializedText';\nimport { floatingButtonActions, floatingButtonSelectors } from './plugins/ButtonPlugin/components';\nimport { type RichTextEditorProps } from './types';\n\nconst InternalRichTextEditor = memo(\n ({\n id = 'rte',\n isEnabled,\n value,\n columns,\n gap,\n placeholder,\n plugins,\n onTextChange,\n showSerializedText,\n }: Omit<RichTextEditorProps, 'isEditing'> & { isEnabled: boolean }) => {\n const [shouldPreventPageLeave, setShouldPreventPageLeave] = useState(false);\n\n const handleTextChange = useCallback(\n (newContent: string) => {\n if (newContent !== value) {\n onTextChange?.(newContent);\n }\n setShouldPreventPageLeave(false);\n },\n [onTextChange, value],\n );\n\n const handleValueChange = useCallback(() => setShouldPreventPageLeave(true), []);\n\n const handleHideExternalFloatingModals = useCallback((editorId: string) => {\n if (floatingButtonSelectors.isOpen(editorId)) {\n floatingButtonActions.reset();\n }\n }, []);\n\n useEffect(() => {\n const unloadHandler = (event: BeforeUnloadEvent) => {\n event.preventDefault();\n event.returnValue = 'Unprocessed changes';\n };\n\n if (shouldPreventPageLeave) {\n window.addEventListener('beforeunload', unloadHandler);\n }\n\n return () => window.removeEventListener('beforeunload', unloadHandler);\n }, [shouldPreventPageLeave]);\n\n if (isEnabled) {\n return (\n <FondueRichTextEditor\n id={id}\n value={value}\n border={false}\n placeholder={placeholder}\n plugins={plugins}\n onValueChanged={handleValueChange}\n onTextChange={handleTextChange}\n hideExternalFloatingModals={handleHideExternalFloatingModals}\n />\n );\n }\n return <SerializedText value={value} columns={columns} gap={gap} show={showSerializedText} plugins={plugins} />;\n },\n);\nInternalRichTextEditor.displayName = 'InternalRichTextEditor';\n\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const [hasEnteredViewport, setHasEnteredViewport] = useState(false);\n\n const { isEditing, ...internalRteProps } = props;\n\n const onViewportVisibilityChange = useCallback((isInViewport: boolean) => {\n if (isInViewport) {\n setHasEnteredViewport(true);\n }\n }, []);\n\n useIsInViewport({ ref, disabled: !isEditing, onChange: onViewportVisibilityChange });\n\n useEffect(() => {\n if (!isEditing) {\n setHasEnteredViewport(false);\n }\n }, [isEditing]);\n\n return (\n <div className=\"tw-block tw-w-full\" ref={ref}>\n <InternalRichTextEditor {...internalRteProps} isEnabled={isEditing && hasEnteredViewport} />\n </div>\n );\n};\n"],"names":["InternalRichTextEditor","memo","id","isEnabled","value","columns","gap","placeholder","plugins","onTextChange","showSerializedText","shouldPreventPageLeave","setShouldPreventPageLeave","useState","handleTextChange","useCallback","newContent","handleValueChange","handleHideExternalFloatingModals","editorId","floatingButtonSelectors","floatingButtonActions","useEffect","unloadHandler","event","jsx","FondueRichTextEditor","SerializedText","RichTextEditor","props","ref","useRef","hasEnteredViewport","setHasEnteredViewport","isEditing","internalRteProps","onViewportVisibilityChange","isInViewport","useIsInViewport"],"mappings":";;;;;;AAWA,MAAMA,IAAyBC;AAAA,EAC3B,CAAC;AAAA,IACG,IAAAC,IAAK;AAAA,IACL,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,MACmE;AACnE,UAAM,CAACC,GAAwBC,CAAyB,IAAIC,EAAS,EAAK,GAEpEC,IAAmBC;AAAA,MACrB,CAACC,MAAuB;AACpB,QAAIA,MAAeZ,MACfK,KAAA,QAAAA,EAAeO,KAEnBJ,EAA0B,EAAK;AAAA,MACnC;AAAA,MACA,CAACH,GAAcL,CAAK;AAAA,IAAA,GAGlBa,IAAoBF,EAAY,MAAMH,EAA0B,EAAI,GAAG,CAAA,CAAE,GAEzEM,IAAmCH,EAAY,CAACI,MAAqB;AACnE,MAAAC,EAAwB,OAAOD,CAAQ,KACvCE,EAAsB,MAAM;AAAA,IAEpC,GAAG,CAAE,CAAA;AAeL,WAbAC,EAAU,MAAM;AACN,YAAAC,IAAgB,CAACC,MAA6B;AAChD,QAAAA,EAAM,eAAe,GACrBA,EAAM,cAAc;AAAA,MAAA;AAGxB,aAAIb,KACO,OAAA,iBAAiB,gBAAgBY,CAAa,GAGlD,MAAM,OAAO,oBAAoB,gBAAgBA,CAAa;AAAA,IAAA,GACtE,CAACZ,CAAsB,CAAC,GAEvBR,IAEI,gBAAAsB;AAAA,MAACC;AAAAA,MAAA;AAAA,QACG,IAAAxB;AAAA,QACA,OAAAE;AAAA,QACA,QAAQ;AAAA,QACR,aAAAG;AAAA,QACA,SAAAC;AAAA,QACA,gBAAgBS;AAAA,QAChB,cAAcH;AAAA,QACd,4BAA4BI;AAAA,MAAA;AAAA,IAAA,sBAIhCS,GAAe,EAAA,OAAAvB,GAAc,SAAAC,GAAkB,KAAAC,GAAU,MAAMI,GAAoB,SAAAF,EAAkB,CAAA;AAAA,EACjH;AACJ;AACAR,EAAuB,cAAc;AAExB,MAAA4B,IAAiB,CAACC,MAA+B;AACpD,QAAAC,IAAMC,EAAuB,IAAI,GACjC,CAACC,GAAoBC,CAAqB,IAAIpB,EAAS,EAAK,GAE5D,EAAE,WAAAqB,GAAW,GAAGC,EAAA,IAAqBN,GAErCO,IAA6BrB,EAAY,CAACsB,MAA0B;AACtE,IAAIA,KACAJ,EAAsB,EAAI;AAAA,EAElC,GAAG,CAAE,CAAA;AAEL,SAAAK,EAAgB,EAAE,KAAAR,GAAK,UAAU,CAACI,GAAW,UAAUE,GAA4B,GAEnFd,EAAU,MAAM;AACZ,IAAKY,KACDD,EAAsB,EAAK;AAAA,EAC/B,GACD,CAACC,CAAS,CAAC,GAGT,gBAAAT,EAAA,OAAA,EAAI,WAAU,sBAAqB,KAAAK,GAChC,UAAA,gBAAAL,EAACzB,GAAwB,EAAA,GAAGmC,GAAkB,WAAWD,KAAaF,EAAA,CAAoB,EAC9F,CAAA;AAER;"}
1
+ {"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { RichTextEditor as FondueRichTextEditor } from '@frontify/fondue';\nimport { memo, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useIsInViewport } from '../../hooks/useIsInViewport';\n\nimport { SerializedText } from './SerializedText';\nimport { floatingButtonActions, floatingButtonSelectors } from './plugins/ButtonPlugin/components';\nimport { getResponsiveColumnClasses } from './plugins/ColumnBreakPlugin/helpers';\nimport { type RichTextEditorProps } from './types';\n\nconst InternalRichTextEditor = memo(\n ({\n id = 'rte',\n isEnabled,\n value,\n columns,\n gap,\n placeholder,\n plugins,\n onTextChange,\n showSerializedText,\n }: Omit<RichTextEditorProps, 'isEditing'> & { isEnabled: boolean }) => {\n const customClass = getResponsiveColumnClasses(columns);\n const [shouldPreventPageLeave, setShouldPreventPageLeave] = useState(false);\n\n const handleTextChange = useCallback(\n (newContent: string) => {\n if (newContent !== value) {\n onTextChange?.(newContent);\n }\n setShouldPreventPageLeave(false);\n },\n [onTextChange, value],\n );\n\n const handleValueChange = useCallback(() => setShouldPreventPageLeave(true), []);\n\n const handleHideExternalFloatingModals = useCallback((editorId: string) => {\n if (floatingButtonSelectors.isOpen(editorId)) {\n floatingButtonActions.reset();\n }\n }, []);\n\n useEffect(() => {\n const unloadHandler = (event: BeforeUnloadEvent) => {\n event.preventDefault();\n event.returnValue = 'Unprocessed changes';\n };\n\n if (shouldPreventPageLeave) {\n window.addEventListener('beforeunload', unloadHandler);\n }\n\n return () => window.removeEventListener('beforeunload', unloadHandler);\n }, [shouldPreventPageLeave]);\n\n if (isEnabled) {\n return (\n <FondueRichTextEditor\n id={id}\n value={value}\n border={false}\n placeholder={placeholder}\n plugins={plugins}\n onValueChanged={handleValueChange}\n onTextChange={handleTextChange}\n hideExternalFloatingModals={handleHideExternalFloatingModals}\n />\n );\n }\n return (\n <SerializedText\n value={value}\n gap={gap}\n customClass={customClass}\n show={showSerializedText}\n plugins={plugins}\n />\n );\n },\n);\nInternalRichTextEditor.displayName = 'InternalRichTextEditor';\n\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const [hasEnteredViewport, setHasEnteredViewport] = useState(false);\n\n const { isEditing, ...internalRteProps } = props;\n\n const onViewportVisibilityChange = useCallback((isInViewport: boolean) => {\n if (isInViewport) {\n setHasEnteredViewport(true);\n }\n }, []);\n\n useIsInViewport({ ref, disabled: !isEditing, onChange: onViewportVisibilityChange });\n\n useEffect(() => {\n if (!isEditing) {\n setHasEnteredViewport(false);\n }\n }, [isEditing]);\n\n return (\n <div data-test-id=\"rich-text-editor-container\" className=\"tw-block tw-w-full tw-@container\" ref={ref}>\n <InternalRichTextEditor {...internalRteProps} isEnabled={isEditing && hasEnteredViewport} />\n </div>\n );\n};\n"],"names":["InternalRichTextEditor","memo","id","isEnabled","value","columns","gap","placeholder","plugins","onTextChange","showSerializedText","customClass","getResponsiveColumnClasses","shouldPreventPageLeave","setShouldPreventPageLeave","useState","handleTextChange","useCallback","newContent","handleValueChange","handleHideExternalFloatingModals","editorId","floatingButtonSelectors","floatingButtonActions","useEffect","unloadHandler","event","jsx","FondueRichTextEditor","SerializedText","RichTextEditor","props","ref","useRef","hasEnteredViewport","setHasEnteredViewport","isEditing","internalRteProps","onViewportVisibilityChange","isInViewport","useIsInViewport"],"mappings":";;;;;;;AAYA,MAAMA,IAAyBC;AAAA,EAC3B,CAAC;AAAA,IACG,IAAAC,IAAK;AAAA,IACL,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,MACmE;AAC7D,UAAAC,IAAcC,EAA2BP,CAAO,GAChD,CAACQ,GAAwBC,CAAyB,IAAIC,EAAS,EAAK,GAEpEC,IAAmBC;AAAA,MACrB,CAACC,MAAuB;AACpB,QAAIA,MAAed,MACfK,KAAA,QAAAA,EAAeS,KAEnBJ,EAA0B,EAAK;AAAA,MACnC;AAAA,MACA,CAACL,GAAcL,CAAK;AAAA,IAAA,GAGlBe,IAAoBF,EAAY,MAAMH,EAA0B,EAAI,GAAG,CAAA,CAAE,GAEzEM,IAAmCH,EAAY,CAACI,MAAqB;AACnE,MAAAC,EAAwB,OAAOD,CAAQ,KACvCE,EAAsB,MAAM;AAAA,IAEpC,GAAG,CAAE,CAAA;AAeL,WAbAC,EAAU,MAAM;AACN,YAAAC,IAAgB,CAACC,MAA6B;AAChD,QAAAA,EAAM,eAAe,GACrBA,EAAM,cAAc;AAAA,MAAA;AAGxB,aAAIb,KACO,OAAA,iBAAiB,gBAAgBY,CAAa,GAGlD,MAAM,OAAO,oBAAoB,gBAAgBA,CAAa;AAAA,IAAA,GACtE,CAACZ,CAAsB,CAAC,GAEvBV,IAEI,gBAAAwB;AAAA,MAACC;AAAAA,MAAA;AAAA,QACG,IAAA1B;AAAA,QACA,OAAAE;AAAA,QACA,QAAQ;AAAA,QACR,aAAAG;AAAA,QACA,SAAAC;AAAA,QACA,gBAAgBW;AAAA,QAChB,cAAcH;AAAA,QACd,4BAA4BI;AAAA,MAAA;AAAA,IAAA,IAKpC,gBAAAO;AAAA,MAACE;AAAA,MAAA;AAAA,QACG,OAAAzB;AAAA,QACA,KAAAE;AAAA,QACA,aAAAK;AAAA,QACA,MAAMD;AAAA,QACN,SAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGZ;AACJ;AACAR,EAAuB,cAAc;AAExB,MAAA8B,IAAiB,CAACC,MAA+B;AACpD,QAAAC,IAAMC,EAAuB,IAAI,GACjC,CAACC,GAAoBC,CAAqB,IAAIpB,EAAS,EAAK,GAE5D,EAAE,WAAAqB,GAAW,GAAGC,EAAA,IAAqBN,GAErCO,IAA6BrB,EAAY,CAACsB,MAA0B;AACtE,IAAIA,KACAJ,EAAsB,EAAI;AAAA,EAElC,GAAG,CAAE,CAAA;AAEL,SAAAK,EAAgB,EAAE,KAAAR,GAAK,UAAU,CAACI,GAAW,UAAUE,GAA4B,GAEnFd,EAAU,MAAM;AACZ,IAAKY,KACDD,EAAsB,EAAK;AAAA,EAC/B,GACD,CAACC,CAAS,CAAC,GAGT,gBAAAT,EAAA,OAAA,EAAI,gBAAa,8BAA6B,WAAU,oCAAmC,KAAAK,GACxF,UAAC,gBAAAL,EAAA3B,GAAA,EAAwB,GAAGqC,GAAkB,WAAWD,KAAaF,GAAoB,EAC9F,CAAA;AAER;"}
@@ -1,20 +1,20 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { serializeRawToHtmlAsync as i } from "@frontify/fondue";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { serializeRawToHtmlAsync as s } from "@frontify/fondue";
3
3
  import { useState as w, useEffect as o } from "react";
4
- const d = ({ value: e = "", gap: l, columns: r, show: m = !0, plugins: a }) => {
5
- const [t, n] = w(null);
4
+ const c = ({ value: e = "", gap: l, customClass: r, show: i = !0, plugins: a }) => {
5
+ const [t, m] = w(null);
6
6
  return o(() => {
7
- (async () => n(await i(e, a, r, l)))();
8
- }, [e, r, l, a]), !m || t === "<br />" ? null : t !== null ? /* @__PURE__ */ s(
7
+ (async () => m(await s(e, a, void 0, l, r)))();
8
+ }, [e, l, a, r]), !i || t === "<br />" ? null : t !== null ? /* @__PURE__ */ n(
9
9
  "div",
10
10
  {
11
11
  className: "tw-w-full tw-whitespace-pre-wrap",
12
12
  "data-test-id": "rte-content-html",
13
13
  dangerouslySetInnerHTML: { __html: t }
14
14
  }
15
- ) : /* @__PURE__ */ s("div", { className: "tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full" });
15
+ ) : /* @__PURE__ */ n("div", { className: "tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full" });
16
16
  };
17
17
  export {
18
- d as SerializedText
18
+ c as SerializedText
19
19
  };
20
20
  //# sourceMappingURL=SerializedText.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SerializedText.es.js","sources":["../../../src/components/RichTextEditor/SerializedText.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { serializeRawToHtmlAsync } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\n\nimport { type SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, columns, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n (async () => {\n setHtml(await serializeRawToHtmlAsync(value, plugins, columns, gap));\n })();\n }, [value, columns, gap, plugins]);\n\n if (!show || html === '<br />') {\n return null;\n }\n\n return html !== null ? (\n <div\n className=\"tw-w-full tw-whitespace-pre-wrap\"\n data-test-id=\"rte-content-html\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n ) : (\n <div className=\"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full\" />\n );\n};\n"],"names":["SerializedText","value","gap","columns","show","plugins","html","setHtml","useState","useEffect","serializeRawToHtmlAsync","jsx"],"mappings":";;;AAOa,MAAAA,IAAiB,CAAC,EAAE,OAAAC,IAAQ,IAAI,KAAAC,GAAK,SAAAC,GAAS,MAAAC,IAAO,IAAM,SAAAC,QAAmC;AACvG,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwB,IAAI;AAQhD,SANJC,EAAU,MAAM;AACZ,KAAC,YACGF,EAAQ,MAAMG,EAAwBT,GAAOI,GAASF,GAASD,CAAG,CAAC;AAAA,KAExE,CAACD,GAAOE,GAASD,GAAKG,CAAO,CAAC,GAE7B,CAACD,KAAQE,MAAS,WACX,OAGJA,MAAS,OACZ,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,gBAAa;AAAA,MACb,yBAAyB,EAAE,QAAQL,EAAK;AAAA,IAAA;AAAA,EAG5C,IAAA,gBAAAK,EAAC,OAAI,EAAA,WAAU,oFAAoF,CAAA;AAE3G;"}
1
+ {"version":3,"file":"SerializedText.es.js","sources":["../../../src/components/RichTextEditor/SerializedText.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { serializeRawToHtmlAsync } from '@frontify/fondue';\nimport { useEffect, useState } from 'react';\n\nimport { type SerializedTextProps } from './types';\n\nexport const SerializedText = ({ value = '', gap, customClass, show = true, plugins }: SerializedTextProps) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n (async () => {\n setHtml(await serializeRawToHtmlAsync(value, plugins, undefined, gap, customClass));\n })();\n }, [value, gap, plugins, customClass]);\n\n if (!show || html === '<br />') {\n return null;\n }\n\n return html !== null ? (\n <div\n className=\"tw-w-full tw-whitespace-pre-wrap\"\n data-test-id=\"rte-content-html\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n ) : (\n <div className=\"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full\" />\n );\n};\n"],"names":["SerializedText","value","gap","customClass","show","plugins","html","setHtml","useState","useEffect","serializeRawToHtmlAsync","jsx"],"mappings":";;;AAOa,MAAAA,IAAiB,CAAC,EAAE,OAAAC,IAAQ,IAAI,KAAAC,GAAK,aAAAC,GAAa,MAAAC,IAAO,IAAM,SAAAC,QAAmC;AAC3G,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwB,IAAI;AAQhD,SANJC,EAAU,MAAM;AACZ,KAAC,YACGF,EAAQ,MAAMG,EAAwBT,GAAOI,GAAS,QAAWH,GAAKC,CAAW,CAAC;AAAA,KAEvF,CAACF,GAAOC,GAAKG,GAASF,CAAW,CAAC,GAEjC,CAACC,KAAQE,MAAS,WACX,OAGJA,MAAS,OACZ,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,gBAAa;AAAA,MACb,yBAAyB,EAAE,QAAQL,EAAK;AAAA,IAAA;AAAA,EAG5C,IAAA,gBAAAK,EAAC,OAAI,EAAA,WAAU,oFAAoF,CAAA;AAE3G;"}
@@ -1,6 +1,6 @@
1
1
  var n = Object.defineProperty;
2
- var u = (i, t, r) => t in i ? n(i, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[t] = r;
3
- var e = (i, t, r) => (u(i, typeof t != "symbol" ? t + "" : t, r), r);
2
+ var u = (r, t, i) => t in r ? n(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i;
3
+ var e = (r, t, i) => u(r, typeof t != "symbol" ? t + "" : t, i);
4
4
  import { createPluginFactory as a, Plugin as s } from "@frontify/fondue";
5
5
  import { isValidUrl as g } from "../../../Link/utils/url.es.js";
6
6
  import { ButtonMarkupElement as l } from "./ButtonMarkupElement/index.es.js";
@@ -8,7 +8,7 @@ import { ButtonButton as d } from "./components/ButtonButton.es.js";
8
8
  import { CustomFloatingButton as p } from "./components/FloatingButton/CustomFloatingButton.es.js";
9
9
  import { withButton as B } from "./withButton.es.js";
10
10
  import { BlockButtonStyles as m } from "./utils/styles.es.js";
11
- const c = "button", f = "button-plugin", h = (i) => a({
11
+ const c = "button", f = "button-plugin", h = (r) => a({
12
12
  key: c,
13
13
  isElement: !0,
14
14
  isInline: !0,
@@ -25,9 +25,9 @@ const c = "button", f = "button-plugin", h = (i) => a({
25
25
  afterMatch: !0
26
26
  },
27
27
  triggerFloatingButtonHotkeys: "command+shift+k, ctrl+shift+k",
28
- appBridge: i
28
+ appBridge: r
29
29
  },
30
- then: (t, { type: r }) => ({
30
+ then: (t, { type: i }) => ({
31
31
  deserializeHtml: {
32
32
  rules: [
33
33
  {
@@ -36,7 +36,7 @@ const c = "button", f = "button-plugin", h = (i) => a({
36
36
  }
37
37
  ],
38
38
  getNode: (o) => ({
39
- type: r,
39
+ type: i,
40
40
  url: o.getAttribute("href"),
41
41
  target: o.getAttribute("target") || "_blank"
42
42
  })
@@ -44,7 +44,7 @@ const c = "button", f = "button-plugin", h = (i) => a({
44
44
  })
45
45
  })();
46
46
  class v extends s {
47
- constructor({ styles: r = m, ...o }) {
47
+ constructor({ styles: i = m, ...o }) {
48
48
  super(f, {
49
49
  button: d,
50
50
  markupElement: new l(),
@@ -52,7 +52,7 @@ class v extends s {
52
52
  });
53
53
  e(this, "styles", {});
54
54
  e(this, "appBridge");
55
- this.styles = r, this.appBridge = o == null ? void 0 : o.appBridge;
55
+ this.styles = i, this.appBridge = o == null ? void 0 : o.appBridge;
56
56
  }
57
57
  plugins() {
58
58
  return [h(this.appBridge)];
@@ -0,0 +1,27 @@
1
+ var l = Object.defineProperty;
2
+ var e = (n, s, t) => s in n ? l(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
3
+ var u = (n, s, t) => e(n, typeof s != "symbol" ? s + "" : s, t);
4
+ import { Plugin as a, ColumnBreakButton as m, createColumnBreakPlugin as i } from "@frontify/fondue";
5
+ import { getResponsiveColumnClasses as o } from "./helpers.es.js";
6
+ const h = "breakAfterColumn", c = "normal";
7
+ class E extends a {
8
+ constructor(t) {
9
+ super("break-after-plugin", {
10
+ button: m,
11
+ ...t
12
+ });
13
+ u(this, "columns");
14
+ u(this, "gap");
15
+ u(this, "customClass");
16
+ this.columns = (t == null ? void 0 : t.columns) ?? 1, this.gap = (t == null ? void 0 : t.gap) ?? c, this.customClass = o(this.columns);
17
+ }
18
+ plugins() {
19
+ return [i(this.columns, this.gap, this.customClass)];
20
+ }
21
+ }
22
+ export {
23
+ E as BreakAfterPlugin,
24
+ c as GAP_DEFAULT,
25
+ h as KEY_ELEMENT_BREAK_AFTER_COLUMN
26
+ };
27
+ //# sourceMappingURL=ColumnBreakPlugin.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnBreakPlugin.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlatePlugin, Plugin, createColumnBreakPlugin, ColumnBreakButton } from '@frontify/fondue';\nimport { type CSSProperties } from 'react';\n\nimport { getResponsiveColumnClasses } from './helpers';\n\nexport const KEY_ELEMENT_BREAK_AFTER_COLUMN = 'breakAfterColumn';\nexport const GAP_DEFAULT = 'normal';\n\nexport class BreakAfterPlugin extends Plugin {\n private columns: number;\n private gap: CSSProperties['gap'];\n private customClass: string | undefined;\n constructor(props?: { columns?: number; gap?: string | number }) {\n super('break-after-plugin', {\n button: ColumnBreakButton,\n ...props,\n });\n this.columns = props?.columns ?? 1;\n this.gap = props?.gap ?? GAP_DEFAULT;\n this.customClass = getResponsiveColumnClasses(this.columns);\n }\n\n plugins(): PlatePlugin[] {\n return [createColumnBreakPlugin(this.columns, this.gap, this.customClass)];\n }\n}\n"],"names":["KEY_ELEMENT_BREAK_AFTER_COLUMN","GAP_DEFAULT","BreakAfterPlugin","Plugin","props","ColumnBreakButton","__publicField","getResponsiveColumnClasses","createColumnBreakPlugin"],"mappings":";;;;;AAOO,MAAMA,IAAiC,oBACjCC,IAAc;AAEpB,MAAMC,UAAyBC,EAAO;AAAA,EAIzC,YAAYC,GAAqD;AAC7D,UAAM,sBAAsB;AAAA,MACxB,QAAQC;AAAA,MACR,GAAGD;AAAA,IAAA,CACN;AAPG,IAAAE,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAMC,SAAA,WAAUF,KAAA,gBAAAA,EAAO,YAAW,GAC5B,KAAA,OAAMA,KAAA,gBAAAA,EAAO,QAAOH,GACpB,KAAA,cAAcM,EAA2B,KAAK,OAAO;AAAA,EAC9D;AAAA,EAEA,UAAyB;AACd,WAAA,CAACC,EAAwB,KAAK,SAAS,KAAK,KAAK,KAAK,WAAW,CAAC;AAAA,EAC7E;AACJ;"}
@@ -0,0 +1,12 @@
1
+ const m = {
2
+ 1: "tw-columns-1",
3
+ 2: "tw-columns-1 @sm:!tw-columns-2",
4
+ 3: "tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-3",
5
+ 4: "tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-4",
6
+ 5: "tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-5"
7
+ }, n = (s) => s ? m[s] || m[1] : "";
8
+ export {
9
+ m as columnClassMap,
10
+ n as getResponsiveColumnClasses
11
+ };
12
+ //# sourceMappingURL=helpers.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const columnClassMap = {\n 1: 'tw-columns-1',\n 2: 'tw-columns-1 @sm:!tw-columns-2',\n 3: 'tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-3',\n 4: 'tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-4',\n 5: 'tw-columns-1 @sm:!tw-columns-2 @md:!tw-columns-5',\n};\n\nexport const getResponsiveColumnClasses = (columnCount?: number) => {\n if (!columnCount) {\n return '';\n }\n\n return columnClassMap[columnCount as keyof typeof columnClassMap] || columnClassMap[1];\n};\n"],"names":["columnClassMap","getResponsiveColumnClasses","columnCount"],"mappings":"AAEO,MAAMA,IAAiB;AAAA,EAC1B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACP,GAEaC,IAA6B,CAACC,MAClCA,IAIEF,EAAeE,CAA0C,KAAKF,EAAe,CAAC,IAH1E;"}
@@ -1,6 +1,6 @@
1
1
  var a = Object.defineProperty;
2
2
  var l = (t, e, r) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var i = (t, e, r) => (l(t, typeof e != "symbol" ? e + "" : e, r), r);
3
+ var i = (t, e, r) => l(t, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { createPluginFactory as s, createLinkPlugin as p, Plugin as m } from "@frontify/fondue";
5
5
  import { BlockStyles as u } from "../styles.es.js";
6
6
  import { CustomFloatingLink as g } from "./FloatingLink/CustomFloatingLink.es.js";
@@ -1,6 +1,6 @@
1
1
  var a = Object.defineProperty;
2
2
  var c = (t, s, e) => s in t ? a(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
- var n = (t, s, e) => (c(t, typeof s != "symbol" ? s + "" : s, e), e);
3
+ var n = (t, s, e) => c(t, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import { Plugin as i, MarkupElement as p, merge as g, alignmentClassnames as y, getColumnBreakClasses as C, createPluginFactory as k } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as x } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var a = Object.defineProperty;
2
2
  var c = (t, s, e) => s in t ? a(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
- var n = (t, s, e) => (c(t, typeof s != "symbol" ? s + "" : s, e), e);
3
+ var n = (t, s, e) => c(t, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import { Plugin as i, MarkupElement as p, merge as g, alignmentClassnames as y, getColumnBreakClasses as C, createPluginFactory as k } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as x } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var a = Object.defineProperty;
2
2
  var c = (t, s, e) => s in t ? a(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
- var n = (t, s, e) => (c(t, typeof s != "symbol" ? s + "" : s, e), e);
3
+ var n = (t, s, e) => c(t, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import { Plugin as i, TextStyles as o, MarkupElement as p, merge as g, alignmentClassnames as y, getColumnBreakClasses as C, createPluginFactory as k } from "@frontify/fondue";
6
6
  import { BlockStyles as x } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var g = Object.defineProperty;
2
2
  var m = (t, e, n) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var r = (t, e, n) => (m(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var r = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  import { Plugin as u, MarkupElement as c, merge as d, alignmentClassnames as p, getColumnBreakClasses as y, createPluginFactory as h } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as k } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var g = Object.defineProperty;
2
2
  var m = (t, e, n) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var r = (t, e, n) => (m(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var r = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  import { Plugin as u, MarkupElement as c, merge as d, alignmentClassnames as p, getColumnBreakClasses as y, createPluginFactory as h } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as k } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var g = Object.defineProperty;
2
2
  var m = (t, e, n) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var r = (t, e, n) => (m(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var r = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  import { Plugin as u, MarkupElement as c, merge as d, alignmentClassnames as p, getColumnBreakClasses as y, createPluginFactory as h } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as k } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var g = Object.defineProperty;
2
2
  var m = (t, e, n) => e in t ? g(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var r = (t, e, n) => (m(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var r = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { jsx as i } from "react/jsx-runtime";
5
5
  import { Plugin as u, MarkupElement as c, merge as d, alignmentClassnames as p, getColumnBreakClasses as y, createPluginFactory as h } from "@frontify/fondue";
6
6
  import { TextStyles as o, BlockStyles as k } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var r = Object.defineProperty;
2
2
  var p = (t, e, a) => e in t ? r(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
- var o = (t, e, a) => (p(t, typeof e != "symbol" ? e + "" : e, a), a);
3
+ var o = (t, e, a) => p(t, typeof e != "symbol" ? e + "" : e, a);
4
4
  import { jsx as m } from "react/jsx-runtime";
5
5
  import { Plugin as g, MarkupElement as u, merge as c, alignmentClassnames as C, getColumnBreakClasses as y, createPluginFactory as k } from "@frontify/fondue";
6
6
  import { TextStyles as s, BlockStyles as x } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var o = Object.defineProperty;
2
2
  var g = (t, e, l) => e in t ? o(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
3
- var m = (t, e, l) => (g(t, typeof e != "symbol" ? e + "" : e, l), l);
3
+ var m = (t, e, l) => g(t, typeof e != "symbol" ? e + "" : e, l);
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import { Plugin as u, MarkupElement as c, merge as p, alignmentClassnames as T, getColumnBreakClasses as y, createPluginFactory as k } from "@frontify/fondue";
6
6
  import { TextStyles as a, BlockStyles as x } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var m = Object.defineProperty;
2
2
  var u = (t, e, r) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var p = (t, e, r) => (u(t, typeof e != "symbol" ? e + "" : e, r), r);
3
+ var p = (t, e, r) => u(t, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { jsx as o } from "react/jsx-runtime";
5
5
  import { Plugin as g, merge as i, alignmentClassnames as P, getColumnBreakClasses as y, MarkupElement as h, createPluginFactory as k, createParagraphPlugin as x } from "@frontify/fondue";
6
6
  import { TextStyles as n, BlockStyles as E } from "../styles.es.js";
@@ -1,6 +1,6 @@
1
1
  var m = Object.defineProperty;
2
2
  var c = (t, e, s) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var u = (t, e, s) => (c(t, typeof e != "symbol" ? e + "" : e, s), s);
3
+ var u = (t, e, s) => c(t, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  import { Plugin as i, MarkupElement as p, merge as g, alignmentClassnames as k, getColumnBreakClasses as y, createPluginFactory as d } from "@frontify/fondue";
6
6
  import { TextStyles as a, BlockStyles as q } from "../styles.es.js";