@frontify/guideline-blocks-settings 2.0.0 → 2.0.1

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 (111) hide show
  1. package/dist/components/Attachments/AttachmentItem.es.js +83 -83
  2. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  3. package/dist/components/Attachments/Attachments.es.js +51 -54
  4. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  5. package/dist/components/BlockInjectButton/BlockInjectButton.es.js +56 -57
  6. package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
  7. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +25 -25
  8. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  9. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +3 -3
  10. package/dist/components/Link/LinkInput.es.js +35 -35
  11. package/dist/components/Link/LinkInput.es.js.map +1 -1
  12. package/dist/components/Link/LinkSelector/LinkSelector.es.js +31 -31
  13. package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -1
  14. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +2 -5
  15. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
  16. package/dist/components/Link/utils/getUrl.es.js +9 -15
  17. package/dist/components/Link/utils/getUrl.es.js.map +1 -1
  18. package/dist/components/RichTextEditor/RichTextEditor.es.js +39 -39
  19. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  20. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +24 -25
  21. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
  22. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +6 -6
  23. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
  24. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +25 -25
  25. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
  26. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +29 -33
  27. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
  28. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +6 -6
  29. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
  30. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +22 -23
  31. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
  32. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -63
  33. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
  34. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +6 -6
  35. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
  36. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +6 -7
  37. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
  38. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +21 -21
  39. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
  40. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +15 -19
  41. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
  42. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +5 -5
  43. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +13 -13
  44. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
  45. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +23 -23
  46. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
  47. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +7 -8
  48. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
  49. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +23 -27
  50. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
  51. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +6 -9
  52. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
  53. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +24 -28
  54. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
  55. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +24 -28
  56. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
  57. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +24 -28
  58. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
  59. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +24 -28
  60. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
  61. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +24 -28
  62. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
  63. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +24 -28
  64. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
  65. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +24 -28
  66. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
  67. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +25 -29
  68. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
  69. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +25 -29
  70. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
  71. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +26 -30
  72. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
  73. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +26 -30
  74. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
  75. package/dist/guideline-blocks-settings.css +1 -0
  76. package/dist/helpers/customCoordinatesGetterFactory.es.js +18 -18
  77. package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -1
  78. package/dist/hooks/useAttachments.es.js +6 -6
  79. package/dist/hooks/useAttachments.es.js.map +1 -1
  80. package/dist/index.cjs.js +7 -7
  81. package/dist/index.cjs.js.map +1 -1
  82. package/dist/index.d.ts +0 -15
  83. package/dist/index.es.js +208 -208
  84. package/dist/index.umd.js +7 -7
  85. package/dist/index.umd.js.map +1 -1
  86. package/dist/settings/background.es.js +4 -4
  87. package/dist/settings/background.es.js.map +1 -1
  88. package/dist/settings/border.es.js +17 -17
  89. package/dist/settings/border.es.js.map +1 -1
  90. package/dist/settings/borderRadius.es.js +12 -15
  91. package/dist/settings/borderRadius.es.js.map +1 -1
  92. package/dist/settings/borderRadiusExtended.es.js +25 -28
  93. package/dist/settings/borderRadiusExtended.es.js.map +1 -1
  94. package/dist/settings/gutter.es.js +17 -20
  95. package/dist/settings/gutter.es.js.map +1 -1
  96. package/dist/settings/margin.es.js +14 -14
  97. package/dist/settings/margin.es.js.map +1 -1
  98. package/dist/settings/marginExtended.es.js +29 -29
  99. package/dist/settings/marginExtended.es.js.map +1 -1
  100. package/dist/settings/padding.es.js +14 -14
  101. package/dist/settings/padding.es.js.map +1 -1
  102. package/dist/settings/paddingExtended.es.js +28 -28
  103. package/dist/settings/paddingExtended.es.js.map +1 -1
  104. package/dist/settings/securityDownloadable.es.js +8 -11
  105. package/dist/settings/securityDownloadable.es.js.map +1 -1
  106. package/dist/utilities/color/getReadableColor.es.js +6 -6
  107. package/dist/utilities/color/getReadableColor.es.js.map +1 -1
  108. package/dist/utilities/color/isDark.es.js +4 -4
  109. package/dist/utilities/color/isDark.es.js.map +1 -1
  110. package/package.json +16 -16
  111. package/dist/styles.css +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"createButtonPlugin.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n"],"names":["ELEMENT_BUTTON","BUTTON_PLUGIN","createButtonPlugin","appBridge","createPluginFactory","element","withButton","CustomFloatingButton","isValidUrl","_editor","type","el","ButtonPlugin","Plugin","styles","BlockButtonStyles","props","ButtonButton","ButtonMarkupElement","__publicField"],"mappings":";;;;;;;;;;AAoBO,MAAMA,IAAiB,UACjBC,IAAgB,iBA6ChBC,IAAqB,CAACC,MAC/BC,EAAoB;AAAA,EAChB,KAAKJ;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO,CAAC,EAAE,SAAAK,SAAe;AAAA,IACrB,WAAW,EAAE,MAAMA,KAAA,gBAAAA,EAAS,KAAK,QAAQA,KAAA,gBAAAA,EAAS,OAAA;AAAA,EAAO;AAAA,EAE7D,eAAeC;AAAA,EACf,qBAAqBC;AAAA,EACrB,SAAS;AAAA,IACL,OAAOC;AAAA,IACP,oBAAoB;AAAA,MAChB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,YAAY;AAAA,IAAA;AAAA,IAEhB,8BAA8B;AAAA,IAC9B,WAAAL;AAAA,EAAA;AAAA,EAEJ,MAAM,CAACM,GAAS,EAAE,MAAAC,SAAY;AAAA,IAC1B,iBAAiB;AAAA,MACb,OAAO;AAAA,QACH;AAAA,UACI,eAAe;AAAA,UACf,gBAAgB;AAAA,QAAA;AAAA,MACpB;AAAA,MAEJ,SAAS,CAACC,OAAQ;AAAA,QACd,MAAAD;AAAA,QACA,KAAKC,EAAG,aAAa,MAAM;AAAA,QAC3B,QAAQA,EAAG,aAAa,QAAQ,KAAK;AAAA,MAAA;AAAA,IACzC;AAAA,EACJ;AAER,CAAC,EAAA;AAOE,MAAMC,UAAqBC,EAAO;AAAA,EAGrC,YAAY,EAAE,QAAAC,IAASC,GAAmB,GAAGC,KAA4B;AACrE,UAAMf,GAAe;AAAA,MACjB,QAAQgB;AAAA,MACR,eAAe,IAAIC,EAAA;AAAA,MACnB,GAAGF;AAAA,IAAA,CACN;AAPE,IAAAG,EAAA,gBAAwB,CAAA;AACvB,IAAAA,EAAA;AAOJ,SAAK,SAASL,GACd,KAAK,YAAYE,KAAA,gBAAAA,EAAO;AAAA,EAC5B;AAAA,EAEA,UAAU;AACN,WAAO,CAACd,EAAmB,KAAK,SAAS,CAAC;AAAA,EAC9C;AACJ;"}
1
+ {"version":3,"file":"createButtonPlugin.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n"],"names":["ELEMENT_BUTTON","BUTTON_PLUGIN","createButtonPlugin","appBridge","createPluginFactory","element","withButton","CustomFloatingButton","isValidUrl","_editor","type","el","ButtonPlugin","Plugin","styles","BlockButtonStyles","props","ButtonButton","ButtonMarkupElement"],"mappings":";;;;;;;AAoBO,MAAMA,IAAiB,UACjBC,IAAgB,iBA6ChBC,IAAqB,CAACC,MAC/BC,EAAoB;AAAA,EAChB,KAAKJ;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO,CAAC,EAAE,SAAAK,SAAe;AAAA,IACrB,WAAW,EAAE,MAAMA,GAAS,KAAK,QAAQA,GAAS,OAAA;AAAA,EAAO;AAAA,EAE7D,eAAeC;AAAA,EACf,qBAAqBC;AAAA,EACrB,SAAS;AAAA,IACL,OAAOC;AAAA,IACP,oBAAoB;AAAA,MAChB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,YAAY;AAAA,IAAA;AAAA,IAEhB,8BAA8B;AAAA,IAC9B,WAAAL;AAAA,EAAA;AAAA,EAEJ,MAAM,CAACM,GAAS,EAAE,MAAAC,SAAY;AAAA,IAC1B,iBAAiB;AAAA,MACb,OAAO;AAAA,QACH;AAAA,UACI,eAAe;AAAA,UACf,gBAAgB;AAAA,QAAA;AAAA,MACpB;AAAA,MAEJ,SAAS,CAACC,OAAQ;AAAA,QACd,MAAAD;AAAA,QACA,KAAKC,EAAG,aAAa,MAAM;AAAA,QAC3B,QAAQA,EAAG,aAAa,QAAQ,KAAK;AAAA,MAAA;AAAA,IACzC;AAAA,EACJ;AAER,CAAC,EAAA;AAOE,MAAMC,UAAqBC,EAAO;AAAA,EAC9B,SAAwB,CAAA;AAAA,EACvB;AAAA,EACR,YAAY,EAAE,QAAAC,IAASC,GAAmB,GAAGC,KAA4B;AACrE,UAAMf,GAAe;AAAA,MACjB,QAAQgB;AAAA,MACR,eAAe,IAAIC,EAAA;AAAA,MACnB,GAAGF;AAAA,IAAA,CACN,GACD,KAAK,SAASF,GACd,KAAK,YAAYE,GAAO;AAAA,EAC5B;AAAA,EAEA,UAAU;AACN,WAAO,CAACd,EAAmB,KAAK,SAAS,CAAC;AAAA,EAC9C;AACJ;"}
@@ -1,20 +1,20 @@
1
1
  import { getPluginOptions as c, focusEditor as f } from "@frontify/fondue/rte";
2
- import { floatingButtonSelectors as n, floatingButtonActions as m } from "../components/FloatingButton/floatingButtonStore.es.js";
2
+ import { floatingButtonSelectors as o, floatingButtonActions as m } from "../components/FloatingButton/floatingButtonStore.es.js";
3
3
  import { ELEMENT_BUTTON as a } from "../createButtonPlugin.es.js";
4
4
  import { upsertButton as p } from "./upsertButton.es.js";
5
5
  const S = (t) => {
6
6
  if (!t.selection)
7
7
  return;
8
- const { isUrl: o, forceSubmit: e } = c(t, a), r = n.url();
9
- if (!((o == null ? void 0 : o(r)) || e))
8
+ const { isUrl: n, forceSubmit: r } = c(t, a), e = o.url();
9
+ if (!(n?.(e) || r))
10
10
  return;
11
- const i = n.text(), s = n.buttonStyle(), u = n.newTab() ? void 0 : "_self";
11
+ const i = o.text(), s = o.buttonStyle(), u = o.newTab() ? void 0 : "_self";
12
12
  return m.reset(), p(t, {
13
- url: r,
13
+ url: e,
14
14
  text: i,
15
15
  buttonStyle: s,
16
16
  target: u,
17
- isUrl: (l) => e || !o ? !0 : o(l)
17
+ isUrl: (l) => r || !n ? !0 : n(l)
18
18
  }), setTimeout(() => {
19
19
  f(t, t.selection ?? void 0);
20
20
  }, 0), !0;
@@ -1 +1 @@
1
- {"version":3,"file":"submitFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, focusEditor, getPluginOptions } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n"],"names":["submitFloatingButton","editor","isUrl","forceSubmit","getPluginOptions","ELEMENT_BUTTON","url","floatingButtonSelectors","text","buttonStyle","target","floatingButtonActions","upsertButton","_url","focusEditor"],"mappings":";;;;AASO,MAAMA,IAAuB,CAAkBC,MAA2B;AAC7E,MAAI,CAACA,EAAO;AACR;AAGJ,QAAM,EAAE,OAAAC,GAAO,aAAAC,EAAA,IAAgBC,EAAkCH,GAAQI,CAAc,GACjFC,IAAMC,EAAwB,IAAA;AAGpC,MAAI,GADYL,KAAA,gBAAAA,EAAQI,OAAQH;AAE5B;AAGJ,QAAMK,IAAOD,EAAwB,KAAA,GAC/BE,IAAcF,EAAwB,YAAA,GACtCG,IAASH,EAAwB,OAAA,IAAW,SAAY;AAE9D,SAAAI,EAAsB,MAAA,GAEtBC,EAAaX,GAAQ;AAAA,IACjB,KAAAK;AAAA,IACA,MAAAE;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAO,CAACG,MAAUV,KAAe,CAACD,IAAQ,KAAOA,EAAMW,CAAI;AAAA,EAAA,CAC9D,GAED,WAAW,MAAM;AACb,IAAAC,EAAYb,GAAQA,EAAO,aAAa,MAAS;AAAA,EACrD,GAAG,CAAC,GAEG;AACX;"}
1
+ {"version":3,"file":"submitFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, focusEditor, getPluginOptions } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n"],"names":["submitFloatingButton","editor","isUrl","forceSubmit","getPluginOptions","ELEMENT_BUTTON","url","floatingButtonSelectors","text","buttonStyle","target","floatingButtonActions","upsertButton","_url","focusEditor"],"mappings":";;;;AASO,MAAMA,IAAuB,CAAkBC,MAA2B;AAC7E,MAAI,CAACA,EAAO;AACR;AAGJ,QAAM,EAAE,OAAAC,GAAO,aAAAC,EAAA,IAAgBC,EAAkCH,GAAQI,CAAc,GACjFC,IAAMC,EAAwB,IAAA;AAGpC,MAAI,EADYL,IAAQI,CAAG,KAAKH;AAE5B;AAGJ,QAAMK,IAAOD,EAAwB,KAAA,GAC/BE,IAAcF,EAAwB,YAAA,GACtCG,IAASH,EAAwB,OAAA,IAAW,SAAY;AAE9D,SAAAI,EAAsB,MAAA,GAEtBC,EAAaX,GAAQ;AAAA,IACjB,KAAAK;AAAA,IACA,MAAAE;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAO,CAACG,MAAUV,KAAe,CAACD,IAAQ,KAAOA,EAAMW,CAAI;AAAA,EAAA,CAC9D,GAED,WAAW,MAAM;AACb,IAAAC,EAAYb,GAAQA,EAAO,aAAa,MAAS;AAAA,EACrD,GAAG,CAAC,GAEG;AACX;"}
@@ -1,35 +1,34 @@
1
- import { withoutNormalizing as y, getAboveNode as b, getPluginType as n, splitNodes as f, isElement as p, unwrapNodes as N } from "@frontify/fondue/rte";
1
+ import { withoutNormalizing as h, getAboveNode as o, getPluginType as c, splitNodes as s, isElement as a, unwrapNodes as l } from "@frontify/fondue/rte";
2
2
  import { ELEMENT_BUTTON as u } from "../createButtonPlugin.es.js";
3
- const A = (t, e) => y(t, () => {
4
- var a, s, h, l, m, o;
5
- if (e != null && e.split) {
6
- if (b(t, {
7
- at: (a = t.selection) == null ? void 0 : a.anchor,
8
- match: { type: n(t, u) }
3
+ const p = (t, e) => h(t, () => {
4
+ if (e?.split) {
5
+ if (o(t, {
6
+ at: t.selection?.anchor,
7
+ match: { type: c(t, u) }
9
8
  }))
10
- return f(t, {
11
- at: (s = t.selection) == null ? void 0 : s.anchor,
12
- match: (c) => p(c) && c.type === n(t, u)
13
- }), A(t, {
14
- at: (h = t.selection) == null ? void 0 : h.anchor
9
+ return s(t, {
10
+ at: t.selection?.anchor,
11
+ match: (n) => a(n) && n.type === c(t, u)
12
+ }), p(t, {
13
+ at: t.selection?.anchor
15
14
  }), !0;
16
- if (b(t, {
17
- at: (l = t.selection) == null ? void 0 : l.focus,
18
- match: { type: n(t, u) }
15
+ if (o(t, {
16
+ at: t.selection?.focus,
17
+ match: { type: c(t, u) }
19
18
  }))
20
- return f(t, {
21
- at: (m = t.selection) == null ? void 0 : m.focus,
22
- match: (c) => p(c) && c.type === n(t, u)
23
- }), A(t, {
24
- at: (o = t.selection) == null ? void 0 : o.focus
19
+ return s(t, {
20
+ at: t.selection?.focus,
21
+ match: (n) => a(n) && n.type === c(t, u)
22
+ }), p(t, {
23
+ at: t.selection?.focus
25
24
  }), !0;
26
25
  }
27
- N(t, {
28
- match: { type: n(t, u) },
26
+ l(t, {
27
+ match: { type: c(t, u) },
29
28
  ...e
30
29
  });
31
30
  });
32
31
  export {
33
- A as unwrapButton
32
+ p as unwrapButton
34
33
  };
35
34
  //# sourceMappingURL=unwrapButton.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unwrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type UnwrapNodesOptions,\n type Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n"],"names":["unwrapButton","editor","options","withoutNormalizing","getAboveNode","_a","getPluginType","ELEMENT_BUTTON","splitNodes","_b","n","isElement","_c","_d","_e","_f","unwrapNodes"],"mappings":";;AAmBO,MAAMA,IAAe,CACxBC,GACAC,MAIOC,EAAmBF,GAAQ,MAAM;;AACpC,MAAIC,KAAA,QAAAA,EAAS,OAAO;AAOhB,QAN0BE,EAAaH,GAAQ;AAAA,MAC3C,KAAII,IAAAJ,EAAO,cAAP,gBAAAI,EAAkB;AAAA,MACtB,OAAO,EAAE,MAAMC,EAAcL,GAAQM,CAAc,EAAA;AAAA,IAAE,CACxD;AAIG,aAAAC,EAAWP,GAAQ;AAAA,QACf,KAAIQ,IAAAR,EAAO,cAAP,gBAAAQ,EAAkB;AAAA,QACtB,OAAO,CAACC,MAAMC,EAAUD,CAAC,KAAKA,EAAE,SAASJ,EAAcL,GAAQM,CAAc;AAAA,MAAA,CAChF,GACDP,EAAaC,GAAQ;AAAA,QACjB,KAAIW,IAAAX,EAAO,cAAP,gBAAAW,EAAkB;AAAA,MAAA,CACzB,GACM;AAQX,QANyBR,EAAaH,GAAQ;AAAA,MAC1C,KAAIY,IAAAZ,EAAO,cAAP,gBAAAY,EAAkB;AAAA,MACtB,OAAO,EAAE,MAAMP,EAAcL,GAAQM,CAAc,EAAA;AAAA,IAAE,CACxD;AAIG,aAAAC,EAAWP,GAAQ;AAAA,QACf,KAAIa,IAAAb,EAAO,cAAP,gBAAAa,EAAkB;AAAA,QACtB,OAAO,CAACJ,MAAMC,EAAUD,CAAC,KAAKA,EAAE,SAASJ,EAAcL,GAAQM,CAAc;AAAA,MAAA,CAChF,GACDP,EAAaC,GAAQ;AAAA,QACjB,KAAIc,IAAAd,EAAO,cAAP,gBAAAc,EAAkB;AAAA,MAAA,CACzB,GACM;AAAA,EAEf;AAEA,EAAAC,EAAYf,GAAQ;AAAA,IAChB,OAAO,EAAE,MAAMK,EAAcL,GAAQM,CAAc,EAAA;AAAA,IACnD,GAAGL;AAAA,EAAA,CACN;AAGL,CAAC;"}
1
+ {"version":3,"file":"unwrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type UnwrapNodesOptions,\n type Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n"],"names":["unwrapButton","editor","options","withoutNormalizing","getAboveNode","getPluginType","ELEMENT_BUTTON","splitNodes","isElement","unwrapNodes"],"mappings":";;AAmBO,MAAMA,IAAe,CACxBC,GACAC,MAIOC,EAAmBF,GAAQ,MAAM;AACpC,MAAIC,GAAS,OAAO;AAOhB,QAN0BE,EAAaH,GAAQ;AAAA,MAC3C,IAAIA,EAAO,WAAW;AAAA,MACtB,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAA;AAAA,IAAE,CACxD;AAIG,aAAAC,EAAWN,GAAQ;AAAA,QACf,IAAIA,EAAO,WAAW;AAAA,QACtB,OAAO,CAAC,MAAMO,EAAU,CAAC,KAAK,EAAE,SAASH,EAAcJ,GAAQK,CAAc;AAAA,MAAA,CAChF,GACDN,EAAaC,GAAQ;AAAA,QACjB,IAAIA,EAAO,WAAW;AAAA,MAAA,CACzB,GACM;AAQX,QANyBG,EAAaH,GAAQ;AAAA,MAC1C,IAAIA,EAAO,WAAW;AAAA,MACtB,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAA;AAAA,IAAE,CACxD;AAIG,aAAAC,EAAWN,GAAQ;AAAA,QACf,IAAIA,EAAO,WAAW;AAAA,QACtB,OAAO,CAAC,MAAMO,EAAU,CAAC,KAAK,EAAE,SAASH,EAAcJ,GAAQK,CAAc;AAAA,MAAA,CAChF,GACDN,EAAaC,GAAQ;AAAA,QACjB,IAAIA,EAAO,WAAW;AAAA,MAAA,CACzB,GACM;AAAA,EAEf;AAEA,EAAAQ,EAAYR,GAAQ;AAAA,IAChB,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAA;AAAA,IACnD,GAAGJ;AAAA,EAAA,CACN;AAGL,CAAC;"}
@@ -1,86 +1,84 @@
1
- import { getAboveNode as w, getPluginType as h, getPluginOptions as L, isDefined as O, findNode as R, isExpanded as d, removeNodes as D, getNodeProps as F, getNodeLeaf as I, setNodes as M, getEditorString as _ } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as i } from "../createButtonPlugin.es.js";
3
- import { insertButton as j } from "./insertButton.es.js";
4
- import { upsertButtonText as N } from "./upsertButtonText.es.js";
5
- import { unwrapButton as B } from "./unwrapButton.es.js";
6
- import { wrapButton as k } from "./wrapButton.es.js";
7
- const S = (o, {
8
- url: s,
9
- text: n,
10
- buttonStyle: t,
11
- target: f,
12
- insertTextInButton: e,
13
- insertNodesOptions: c,
14
- isUrl: p = L(o, i).isUrl
1
+ import { getAboveNode as P, getPluginType as a, isDefined as U, findNode as w, isExpanded as L, removeNodes as O, getNodeProps as R, getNodeLeaf as d, getPluginOptions as D, setNodes as F, getEditorString as I } from "@frontify/fondue/rte";
2
+ import { ELEMENT_BUTTON as p } from "../createButtonPlugin.es.js";
3
+ import { insertButton as M } from "./insertButton.es.js";
4
+ import { upsertButtonText as g } from "./upsertButtonText.es.js";
5
+ import { unwrapButton as m } from "./unwrapButton.es.js";
6
+ import { wrapButton as _ } from "./wrapButton.es.js";
7
+ const K = (n, {
8
+ url: e,
9
+ text: t,
10
+ buttonStyle: s,
11
+ target: o,
12
+ insertTextInButton: r,
13
+ insertNodesOptions: h,
14
+ isUrl: l = D(n, p).isUrl
15
15
  }) => {
16
- var g;
17
- const u = o.selection;
18
- if (!u)
16
+ const f = n.selection;
17
+ if (!f)
19
18
  return;
20
- const r = w(o, {
21
- at: u,
22
- match: { type: h(o, i) }
19
+ const u = P(n, {
20
+ at: f,
21
+ match: { type: a(n, p) }
23
22
  });
24
- if (e && r)
25
- return o.insertText(s), !0;
26
- if (!(p != null && p(s)))
23
+ if (r && u)
24
+ return n.insertText(e), !0;
25
+ if (!l?.(e))
27
26
  return;
28
- if (O(n) && n.length === 0 && (n = s), r)
29
- return A(s, o, r, f, t, n), !0;
30
- const T = R(o, {
31
- at: u,
32
- match: { type: h(o, i) }
33
- }), [l, a] = T ?? [], E = q(o, a, n);
34
- if (d(u))
35
- return z(r, o, s, t, f, n), !0;
36
- E && D(o, {
37
- at: a
27
+ if (U(t) && t.length === 0 && (t = e), u)
28
+ return q(e, n, u, o, s, t), !0;
29
+ const B = w(n, {
30
+ at: f,
31
+ match: { type: a(n, p) }
32
+ }), [N, c] = B ?? [], T = j(n, c, t);
33
+ if (L(f))
34
+ return k(u, n, e, s, o, t), !0;
35
+ T && O(n, {
36
+ at: c
38
37
  });
39
- const y = F(l ?? {}), m = (g = o.selection) == null ? void 0 : g.focus.path;
40
- if (!m)
38
+ const E = R(N ?? {}), i = n.selection?.focus.path;
39
+ if (!i)
41
40
  return;
42
- const P = I(o, m);
43
- return n != null && n.length || (n = s), j(
44
- o,
41
+ const y = d(n, i);
42
+ return t?.length || (t = e), M(
43
+ n,
45
44
  {
46
- ...y,
47
- url: s,
48
- target: f,
45
+ ...E,
46
+ url: e,
47
+ target: o,
49
48
  children: [
50
49
  {
51
- ...P,
52
- text: n
50
+ ...y,
51
+ text: t
53
52
  }
54
53
  ]
55
54
  },
56
- c
55
+ h
57
56
  ), !0;
58
57
  };
59
- function q(o, s, n) {
60
- return s && (n == null ? void 0 : n.length) && n !== _(o, s);
58
+ function j(n, e, t) {
59
+ return e && t?.length && t !== I(n, e);
61
60
  }
62
- function z(o, s, n, t, f, e) {
63
- o ? B(s, {
64
- at: o[1]
65
- }) : B(s, {
61
+ function k(n, e, t, s, o, r) {
62
+ n ? m(e, {
63
+ at: n[1]
64
+ }) : m(e, {
66
65
  split: !0
67
- }), k(s, {
68
- url: n,
69
- buttonStyle: t,
70
- target: f
71
- }), N(s, { text: e });
66
+ }), _(e, {
67
+ url: t,
68
+ buttonStyle: s,
69
+ target: o
70
+ }), g(e, { text: r });
72
71
  }
73
- function A(o, s, n, t, f, e) {
74
- var c, p, u;
75
- (o !== ((c = n[0]) == null ? void 0 : c.url) || t !== ((p = n[0]) == null ? void 0 : p.target) || f !== ((u = n[0]) == null ? void 0 : u.buttonStyle)) && M(
76
- s,
77
- { url: o, target: t, buttonStyle: f },
72
+ function q(n, e, t, s, o, r) {
73
+ (n !== t[0]?.url || s !== t[0]?.target || o !== t[0]?.buttonStyle) && F(
74
+ e,
75
+ { url: n, target: s, buttonStyle: o },
78
76
  {
79
- at: n[1]
77
+ at: t[1]
80
78
  }
81
- ), N(s, { text: e });
79
+ ), g(e, { text: r });
82
80
  }
83
81
  export {
84
- S as upsertButton
82
+ K as upsertButton
85
83
  };
86
84
  //# sourceMappingURL=upsertButton.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type InsertNodesOptions,\n type Path,\n type PlateEditor,\n type TNode,\n type TNodeEntry,\n type UnwrapNodesOptions,\n type Value,\n type WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue/rte';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { type RichTextButtonStyle, type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions } from '../utils/index';\n\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n"],"names":["upsertButton","editor","url","text","buttonStyle","target","insertTextInButton","insertNodesOptions","isUrl","getPluginOptions","ELEMENT_BUTTON","at","buttonAbove","getAboveNode","getPluginType","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","props","getNodeProps","path","_a","leaf","getNodeLeaf","insertButton","getEditorString","unwrapButton","wrapButton","upsertButtonText","_b","_c","setNodes"],"mappings":";;;;;;AAiDO,MAAMA,IAAe,CACxBC,GACA;AAAA,EACI,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,OAAAC,IAAQC,EAAkCR,GAAQS,CAAc,EAAE;AACtE,MACC;;AACD,QAAMC,IAAKV,EAAO;AAClB,MAAI,CAACU;AACD;AAGJ,QAAMC,IAAcC,EAA6BZ,GAAQ;AAAA,IACrD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAA;AAAA,EAAE,CACxD;AAGD,MAAIJ,KAAsBM;AAEtB,WAAAX,EAAO,WAAWC,CAAG,GACd;AAGX,MAAI,EAACM,KAAA,QAAAA,EAAQN;AACT;AAOJ,MAJIa,EAAUZ,CAAI,KAAKA,EAAK,WAAW,MACnCA,IAAOD,IAGPU;AACA,WAAAI,EAA0Bd,GAAKD,GAAQW,GAAaP,GAAQD,GAAaD,CAAI,GACtE;AAIX,QAAMc,IAAcC,EAAyBjB,GAAQ;AAAA,IACjD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAA;AAAA,EAAE,CACxD,GAEK,CAACS,GAAYC,CAAU,IAAIH,KAAe,CAAA,GAE1CI,IAAoBC,EAA2BrB,GAAQmB,GAAYjB,CAAI;AAE7E,MAAIoB,EAAWZ,CAAE;AACb,WAAAa,EAA0BZ,GAAaX,GAAQC,GAAKE,GAAaC,GAAQF,CAAI,GACtE;AAGX,EAAIkB,KACAI,EAAYxB,GAAQ;AAAA,IAChB,IAAImB;AAAA,EAAA,CACP;AAGL,QAAMM,IAAQC,EAAaR,KAAe,EAAY,GAEhDS,KAAOC,IAAA5B,EAAO,cAAP,gBAAA4B,EAAkB,MAAM;AACrC,MAAI,CAACD;AACD;AAIJ,QAAME,IAAOC,EAAY9B,GAAQ2B,CAAI;AAGrC,SAAKzB,KAAA,QAAAA,EAAM,WACPA,IAAOD,IAGX8B;AAAA,IACI/B;AAAA,IACA;AAAA,MACI,GAAGyB;AAAA,MACH,KAAAxB;AAAA,MACA,QAAAG;AAAA,MACA,UAAU;AAAA,QACN;AAAA,UACI,GAAGyB;AAAA,UACH,MAAA3B;AAAA,QAAA;AAAA,MACJ;AAAA,IACJ;AAAA,IAEJI;AAAA,EAAA,GAEG;AACX;AAEA,SAASe,EAAyCrB,GAAwBmB,GAAmBjB,GAAe;AACxG,SAAOiB,MAAcjB,KAAA,gBAAAA,EAAM,WAAUA,MAAS8B,EAAgBhC,GAAQmB,CAAU;AACpF;AAEA,SAASI,EACLZ,GACAX,GACAC,GACAE,GACAC,GACAF,GACF;AACE,EAAIS,IACAsB,EAAajC,GAAQ;AAAA,IACjB,IAAIW,EAAY,CAAC;AAAA,EAAA,CACpB,IAEDsB,EAAajC,GAAQ;AAAA,IACjB,OAAO;AAAA,EAAA,CACV,GAGLkC,EAAWlC,GAAQ;AAAA,IACf,KAAAC;AAAA,IACA,aAAAE;AAAA,IACA,QAAAC;AAAA,EAAA,CACH,GAED+B,EAAiBnC,GAAQ,EAAe,MAAAE,GAAM;AAClD;AAEA,SAASa,EACLd,GACAD,GACAW,GACAP,GACAD,GACAD,GACF;;AACE,GACID,QAAQ2B,IAAAjB,EAAY,CAAC,MAAb,gBAAAiB,EAAgB,QACxBxB,QAAWgC,IAAAzB,EAAY,CAAC,MAAb,gBAAAyB,EAAgB,WAC3BjC,QAAgBkC,IAAA1B,EAAY,CAAC,MAAb,gBAAA0B,EAAgB,iBAEhCC;AAAA,IACItC;AAAA,IACA,EAAE,KAAAC,GAAK,QAAAG,GAAQ,aAAAD,EAAA;AAAA,IACf;AAAA,MACI,IAAIQ,EAAY,CAAC;AAAA,IAAA;AAAA,EACrB,GAIRwB,EAAiBnC,GAAQ,EAAO,MAAAE,EAAa,CAAC;AAClD;"}
1
+ {"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type InsertNodesOptions,\n type Path,\n type PlateEditor,\n type TNode,\n type TNodeEntry,\n type UnwrapNodesOptions,\n type Value,\n type WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue/rte';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { type RichTextButtonStyle, type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions } from '../utils/index';\n\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n"],"names":["upsertButton","editor","url","text","buttonStyle","target","insertTextInButton","insertNodesOptions","isUrl","getPluginOptions","ELEMENT_BUTTON","at","buttonAbove","getAboveNode","getPluginType","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","props","getNodeProps","path","leaf","getNodeLeaf","insertButton","getEditorString","unwrapButton","wrapButton","upsertButtonText","setNodes"],"mappings":";;;;;;AAiDO,MAAMA,IAAe,CACxBC,GACA;AAAA,EACI,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,OAAAC,IAAQC,EAAkCR,GAAQS,CAAc,EAAE;AACtE,MACC;AACD,QAAMC,IAAKV,EAAO;AAClB,MAAI,CAACU;AACD;AAGJ,QAAMC,IAAcC,EAA6BZ,GAAQ;AAAA,IACrD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAA;AAAA,EAAE,CACxD;AAGD,MAAIJ,KAAsBM;AAEtB,WAAAX,EAAO,WAAWC,CAAG,GACd;AAGX,MAAI,CAACM,IAAQN,CAAG;AACZ;AAOJ,MAJIa,EAAUZ,CAAI,KAAKA,EAAK,WAAW,MACnCA,IAAOD,IAGPU;AACA,WAAAI,EAA0Bd,GAAKD,GAAQW,GAAaP,GAAQD,GAAaD,CAAI,GACtE;AAIX,QAAMc,IAAcC,EAAyBjB,GAAQ;AAAA,IACjD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAA;AAAA,EAAE,CACxD,GAEK,CAACS,GAAYC,CAAU,IAAIH,KAAe,CAAA,GAE1CI,IAAoBC,EAA2BrB,GAAQmB,GAAYjB,CAAI;AAE7E,MAAIoB,EAAWZ,CAAE;AACb,WAAAa,EAA0BZ,GAAaX,GAAQC,GAAKE,GAAaC,GAAQF,CAAI,GACtE;AAGX,EAAIkB,KACAI,EAAYxB,GAAQ;AAAA,IAChB,IAAImB;AAAA,EAAA,CACP;AAGL,QAAMM,IAAQC,EAAaR,KAAe,EAAY,GAEhDS,IAAO3B,EAAO,WAAW,MAAM;AACrC,MAAI,CAAC2B;AACD;AAIJ,QAAMC,IAAOC,EAAY7B,GAAQ2B,CAAI;AAGrC,SAAKzB,GAAM,WACPA,IAAOD,IAGX6B;AAAA,IACI9B;AAAA,IACA;AAAA,MACI,GAAGyB;AAAA,MACH,KAAAxB;AAAA,MACA,QAAAG;AAAA,MACA,UAAU;AAAA,QACN;AAAA,UACI,GAAGwB;AAAA,UACH,MAAA1B;AAAA,QAAA;AAAA,MACJ;AAAA,IACJ;AAAA,IAEJI;AAAA,EAAA,GAEG;AACX;AAEA,SAASe,EAAyCrB,GAAwBmB,GAAmBjB,GAAe;AACxG,SAAOiB,KAAcjB,GAAM,UAAUA,MAAS6B,EAAgB/B,GAAQmB,CAAU;AACpF;AAEA,SAASI,EACLZ,GACAX,GACAC,GACAE,GACAC,GACAF,GACF;AACE,EAAIS,IACAqB,EAAahC,GAAQ;AAAA,IACjB,IAAIW,EAAY,CAAC;AAAA,EAAA,CACpB,IAEDqB,EAAahC,GAAQ;AAAA,IACjB,OAAO;AAAA,EAAA,CACV,GAGLiC,EAAWjC,GAAQ;AAAA,IACf,KAAAC;AAAA,IACA,aAAAE;AAAA,IACA,QAAAC;AAAA,EAAA,CACH,GAED8B,EAAiBlC,GAAQ,EAAe,MAAAE,GAAM;AAClD;AAEA,SAASa,EACLd,GACAD,GACAW,GACAP,GACAD,GACAD,GACF;AACE,GACID,MAAQU,EAAY,CAAC,GAAG,OACxBP,MAAWO,EAAY,CAAC,GAAG,UAC3BR,MAAgBQ,EAAY,CAAC,GAAG,gBAEhCwB;AAAA,IACInC;AAAA,IACA,EAAE,KAAAC,GAAK,QAAAG,GAAQ,aAAAD,EAAA;AAAA,IACf;AAAA,MACI,IAAIQ,EAAY,CAAC;AAAA,IAAA;AAAA,EACrB,GAIRuB,EAAiBlC,GAAQ,EAAO,MAAAE,EAAa,CAAC;AAClD;"}
@@ -1,16 +1,16 @@
1
1
  import { getAboveNode as i, getPluginType as c, getEditorString as p, replaceNodeChildren as u } from "@frontify/fondue/rte";
2
2
  import { ELEMENT_BUTTON as g } from "../createButtonPlugin.es.js";
3
- const f = (t, { text: n }) => {
4
- const e = i(t, {
3
+ const f = (t, { text: e }) => {
4
+ const n = i(t, {
5
5
  match: { type: c(t, g) }
6
6
  });
7
- if (e) {
8
- const [r, o] = e;
9
- if (n != null && n.length && n !== p(t, o)) {
7
+ if (n) {
8
+ const [r, o] = n;
9
+ if (e?.length && e !== p(t, o)) {
10
10
  const s = r.children[0];
11
11
  u(t, {
12
12
  at: o,
13
- nodes: { ...s, text: n },
13
+ nodes: { ...s, text: e },
14
14
  insertOptions: {
15
15
  select: !0
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type TText,\n type Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nimport { type UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n"],"names":["upsertButtonText","editor","text","newButton","getAboveNode","getPluginType","ELEMENT_BUTTON","newButtonNode","newButtonPath","getEditorString","firstText","replaceNodeChildren"],"mappings":";;AAoBO,MAAMA,IAAmB,CAAkBC,GAAwB,EAAE,MAAAC,QAAmC;AAC3G,QAAMC,IAAYC,EAA6BH,GAAQ;AAAA,IACnD,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAA;AAAA,EAAE,CACxD;AAED,MAAIH,GAAW;AACX,UAAM,CAACI,GAAeC,CAAa,IAAIL;AAEvC,QAAID,KAAA,QAAAA,EAAM,UAAUA,MAASO,EAAgBR,GAAQO,CAAa,GAAG;AACjE,YAAME,IAAYH,EAAc,SAAS,CAAC;AAG1C,MAAAI,EAA2BV,GAAQ;AAAA,QAC/B,IAAIO;AAAA,QACJ,OAAO,EAAE,GAAGE,GAAW,MAAAR,EAAA;AAAA,QACvB,eAAe;AAAA,UACX,QAAQ;AAAA,QAAA;AAAA,MACZ,CACH;AAAA,IACL;AAAA,EACJ;AACJ;"}
1
+ {"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type TText,\n type Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nimport { type UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n"],"names":["upsertButtonText","editor","text","newButton","getAboveNode","getPluginType","ELEMENT_BUTTON","newButtonNode","newButtonPath","getEditorString","firstText","replaceNodeChildren"],"mappings":";;AAoBO,MAAMA,IAAmB,CAAkBC,GAAwB,EAAE,MAAAC,QAAmC;AAC3G,QAAMC,IAAYC,EAA6BH,GAAQ;AAAA,IACnD,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAA;AAAA,EAAE,CACxD;AAED,MAAIH,GAAW;AACX,UAAM,CAACI,GAAeC,CAAa,IAAIL;AAEvC,QAAID,GAAM,UAAUA,MAASO,EAAgBR,GAAQO,CAAa,GAAG;AACjE,YAAME,IAAYH,EAAc,SAAS,CAAC;AAG1C,MAAAI,EAA2BV,GAAQ;AAAA,QAC/B,IAAIO;AAAA,QACJ,OAAO,EAAE,GAAGE,GAAW,MAAAR,EAAA;AAAA,QACvB,eAAe;AAAA,UACX,QAAQ;AAAA,QAAA;AAAA,MACZ,CACH;AAAA,IACL;AAAA,EACJ;AACJ;"}
@@ -1,11 +1,10 @@
1
- import { getAboveNode as e } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as i } from "../createButtonPlugin.es.js";
3
- const y = (o) => {
4
- var t;
5
- const r = e(o, { match: { type: i } });
6
- return Array.isArray(r) && ((t = r[0]) == null ? void 0 : t.buttonStyle) || "primary";
1
+ import { getAboveNode as o } from "@frontify/fondue/rte";
2
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
3
+ const n = (t) => {
4
+ const r = o(t, { match: { type: e } });
5
+ return Array.isArray(r) && r[0]?.buttonStyle || "primary";
7
6
  };
8
7
  export {
9
- y as getButtonStyle
8
+ n as getButtonStyle
10
9
  };
11
10
  //# sourceMappingURL=getButtonStyle.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n"],"names":["getButtonStyle","editor","linkNode","getAboveNode","ELEMENT_BUTTON","_a"],"mappings":";;AAMO,MAAMA,IAAiB,CAACC,MAA6C;;AACxE,QAAMC,IAAWC,EAA6BF,GAAQ,EAAE,OAAO,EAAE,MAAMG,EAAA,GAAkB;AAEzF,SAAK,MAAM,QAAQF,CAAQ,OAInBG,IAAAH,EAAS,CAAC,MAAV,gBAAAG,EAAa,gBAAuC;AAChE;"}
1
+ {"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n"],"names":["getButtonStyle","editor","linkNode","getAboveNode","ELEMENT_BUTTON"],"mappings":";;AAMO,MAAMA,IAAiB,CAACC,MAA6C;AACxE,QAAMC,IAAWC,EAA6BF,GAAQ,EAAE,OAAO,EAAE,MAAMG,EAAA,GAAkB;AAEzF,SAAK,MAAM,QAAQF,CAAQ,KAInBA,EAAS,CAAC,GAAG,eAAuC;AAChE;"}
@@ -1,47 +1,47 @@
1
- import { isCollapsed as l, getAboveNode as a, getPluginType as P, isStartPoint as g, getPreviousNodeEndPoint as x, isEndPoint as i, getNextNodeStartPoint as u, select as m, Path as E, insertNodes as h, withRemoveEmptyNodes as w, mockPlugin as T } from "@frontify/fondue/rte";
1
+ import { isCollapsed as l, getAboveNode as y, getPluginType as P, isStartPoint as g, getPreviousNodeEndPoint as x, isEndPoint as i, getNextNodeStartPoint as u, select as m, Path as E, insertNodes as h, withRemoveEmptyNodes as r, mockPlugin as w } from "@frontify/fondue/rte";
2
2
  import { ELEMENT_BUTTON as p } from "./createButtonPlugin.es.js";
3
3
  const z = (t, { type: N }) => {
4
- const { apply: f, normalizeNode: y } = t;
5
- return t.apply = (s) => {
6
- if (s.type !== "set_selection") {
7
- f(s);
4
+ const { apply: f, normalizeNode: a } = t;
5
+ return t.apply = (e) => {
6
+ if (e.type !== "set_selection") {
7
+ f(e);
8
8
  return;
9
9
  }
10
- const n = s.newProperties;
11
- if (!(n != null && n.focus) || !n.anchor || !l(n)) {
12
- f(s);
10
+ const n = e.newProperties;
11
+ if (!n?.focus || !n.anchor || !l(n)) {
12
+ f(e);
13
13
  return;
14
14
  }
15
- const o = a(t, {
15
+ const o = y(t, {
16
16
  at: n,
17
17
  match: { type: P(t, p) }
18
18
  });
19
19
  if (o) {
20
20
  const [, c] = o;
21
- let e;
22
- g(t, n.focus, c) && (e = x(t, c)), i(t, n.focus, c) && (e = u(t, c)), e && (s.newProperties = {
23
- anchor: e,
24
- focus: e
21
+ let s;
22
+ g(t, n.focus, c) && (s = x(t, c)), i(t, n.focus, c) && (s = u(t, c)), s && (e.newProperties = {
23
+ anchor: s,
24
+ focus: s
25
25
  });
26
26
  }
27
- f(s);
28
- }, t.normalizeNode = ([s, n]) => {
29
- if (s.type === P(t, p)) {
27
+ f(e);
28
+ }, t.normalizeNode = ([e, n]) => {
29
+ if (e.type === P(t, p)) {
30
30
  const o = t.selection;
31
31
  if (o && l(o) && i(t, o.focus, n)) {
32
32
  const c = u(t, n);
33
33
  if (c)
34
34
  m(t, c);
35
35
  else {
36
- const e = E.next(n);
37
- h(t, { text: "" }, { at: e }), m(t, e);
36
+ const s = E.next(n);
37
+ h(t, { text: "" }, { at: s }), m(t, s);
38
38
  }
39
39
  }
40
40
  }
41
- y([s, n]);
42
- }, w(
41
+ a([e, n]);
42
+ }, r(
43
43
  t,
44
- T({
44
+ w({
45
45
  options: { types: N }
46
46
  })
47
47
  );
@@ -1 +1 @@
1
- {"version":3,"file":"withButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type EText,\n Path,\n type PlateEditor,\n type Point,\n type Range,\n type Value,\n type WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<Record<string, any>, Value, PlateEditor<Value>>({\n options: { types: type },\n }),\n );\n};\n"],"names":["withButton","editor","type","apply","normalizeNode","operation","range","isCollapsed","entry","getAboveNode","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin"],"mappings":";;AAmCO,MAAMA,IAA2B,CAACC,GAAQ,EAAE,MAAAC,QAAW;AAC1D,QAAM,EAAE,OAAAC,GAAO,eAAAC,EAAA,IAAkBH;AAEjC,SAAAA,EAAO,QAAQ,CAACI,MAAc;AAC1B,QAAIA,EAAU,SAAS,iBAAiB;AACpC,MAAAF,EAAME,CAAS;AACf;AAAA,IACJ;AAEA,UAAMC,IAAQD,EAAU;AACxB,QAAI,EAACC,KAAA,QAAAA,EAAO,UAAS,CAACA,EAAM,UAAU,CAACC,EAAYD,CAAc,GAAG;AAChE,MAAAH,EAAME,CAAS;AACf;AAAA,IACJ;AAEA,UAAMG,IAAQC,EAAaR,GAAQ;AAAA,MAC/B,IAAIK;AAAA,MACJ,OAAO,EAAE,MAAMI,EAAcT,GAAQU,CAAc,EAAA;AAAA,IAAE,CACxD;AAED,QAAIH,GAAO;AACP,YAAM,CAAA,EAAGI,CAAI,IAAIJ;AAEjB,UAAIK;AAEJ,MAAIC,EAAab,GAAQK,EAAM,OAAOM,CAAI,MACtCC,IAAWE,EAAwBd,GAAQW,CAAI,IAG/CI,EAAWf,GAAQK,EAAM,OAAOM,CAAI,MACpCC,IAAWI,EAAsBhB,GAAQW,CAAI,IAG7CC,MACAR,EAAU,gBAAgB;AAAA,QACtB,QAAQQ;AAAA,QACR,OAAOA;AAAA,MAAA;AAAA,IAGnB;AAEA,IAAAV,EAAME,CAAS;AAAA,EACnB,GAEAJ,EAAO,gBAAgB,CAAC,CAACiB,GAAMN,CAAI,MAAM;AACrC,QAAIM,EAAK,SAASR,EAAcT,GAAQU,CAAc,GAAG;AACrD,YAAML,IAAQL,EAAO;AAErB,UAAIK,KAASC,EAAYD,CAAK,KAAKU,EAAWf,GAAQK,EAAM,OAAOM,CAAI,GAAG;AACtE,cAAMO,IAAYF,EAAsBhB,GAAQW,CAAI;AAGpD,YAAIO;AACA,UAAAC,EAAOnB,GAAQkB,CAAS;AAAA,aACrB;AAEH,gBAAME,IAAWC,EAAK,KAAKV,CAAI;AAC/B,UAAAW,EAAYtB,GAAQ,EAAE,MAAM,GAAA,GAAsB,EAAE,IAAIoB,GAAU,GAClED,EAAOnB,GAAQoB,CAAQ;AAAA,QAC3B;AAAA,MACJ;AAAA,IACJ;AAEA,IAAAjB,EAAc,CAACc,GAAMN,CAAI,CAAC;AAAA,EAC9B,GAEOY;AAAA,IACHvB;AAAA,IACAwB,EAA2D;AAAA,MACvD,SAAS,EAAE,OAAOvB,EAAA;AAAA,IAAK,CAC1B;AAAA,EAAA;AAET;"}
1
+ {"version":3,"file":"withButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type EText,\n Path,\n type PlateEditor,\n type Point,\n type Range,\n type Value,\n type WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<Record<string, any>, Value, PlateEditor<Value>>({\n options: { types: type },\n }),\n );\n};\n"],"names":["withButton","editor","type","apply","normalizeNode","operation","range","isCollapsed","entry","getAboveNode","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin"],"mappings":";;AAmCO,MAAMA,IAA2B,CAACC,GAAQ,EAAE,MAAAC,QAAW;AAC1D,QAAM,EAAE,OAAAC,GAAO,eAAAC,EAAA,IAAkBH;AAEjC,SAAAA,EAAO,QAAQ,CAACI,MAAc;AAC1B,QAAIA,EAAU,SAAS,iBAAiB;AACpC,MAAAF,EAAME,CAAS;AACf;AAAA,IACJ;AAEA,UAAMC,IAAQD,EAAU;AACxB,QAAI,CAACC,GAAO,SAAS,CAACA,EAAM,UAAU,CAACC,EAAYD,CAAc,GAAG;AAChE,MAAAH,EAAME,CAAS;AACf;AAAA,IACJ;AAEA,UAAMG,IAAQC,EAAaR,GAAQ;AAAA,MAC/B,IAAIK;AAAA,MACJ,OAAO,EAAE,MAAMI,EAAcT,GAAQU,CAAc,EAAA;AAAA,IAAE,CACxD;AAED,QAAIH,GAAO;AACP,YAAM,CAAA,EAAGI,CAAI,IAAIJ;AAEjB,UAAIK;AAEJ,MAAIC,EAAab,GAAQK,EAAM,OAAOM,CAAI,MACtCC,IAAWE,EAAwBd,GAAQW,CAAI,IAG/CI,EAAWf,GAAQK,EAAM,OAAOM,CAAI,MACpCC,IAAWI,EAAsBhB,GAAQW,CAAI,IAG7CC,MACAR,EAAU,gBAAgB;AAAA,QACtB,QAAQQ;AAAA,QACR,OAAOA;AAAA,MAAA;AAAA,IAGnB;AAEA,IAAAV,EAAME,CAAS;AAAA,EACnB,GAEAJ,EAAO,gBAAgB,CAAC,CAACiB,GAAMN,CAAI,MAAM;AACrC,QAAIM,EAAK,SAASR,EAAcT,GAAQU,CAAc,GAAG;AACrD,YAAML,IAAQL,EAAO;AAErB,UAAIK,KAASC,EAAYD,CAAK,KAAKU,EAAWf,GAAQK,EAAM,OAAOM,CAAI,GAAG;AACtE,cAAMO,IAAYF,EAAsBhB,GAAQW,CAAI;AAGpD,YAAIO;AACA,UAAAC,EAAOnB,GAAQkB,CAAS;AAAA,aACrB;AAEH,gBAAME,IAAWC,EAAK,KAAKV,CAAI;AAC/B,UAAAW,EAAYtB,GAAQ,EAAE,MAAM,GAAA,GAAsB,EAAE,IAAIoB,GAAU,GAClED,EAAOnB,GAAQoB,CAAQ;AAAA,QAC3B;AAAA,MACJ;AAAA,IACJ;AAEA,IAAAjB,EAAc,CAACc,GAAMN,CAAI,CAAC;AAAA,EAC9B,GAEOY;AAAA,IACHvB;AAAA,IACAwB,EAA2D;AAAA,MACvD,SAAS,EAAE,OAAOvB,EAAA;AAAA,IAAK,CAC1B;AAAA,EAAA;AAET;"}
@@ -1,27 +1,23 @@
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/rte";
5
- import { getResponsiveColumnClasses as o } from "./helpers.es.js";
6
- const h = "breakAfterColumn", c = "normal";
7
- class E extends a {
8
- constructor(t) {
1
+ import { Plugin as t, ColumnBreakButton as n, createColumnBreakPlugin as o } from "@frontify/fondue/rte";
2
+ import { getResponsiveColumnClasses as u } from "./helpers.es.js";
3
+ const m = "breakAfterColumn", l = "normal";
4
+ class i extends t {
5
+ columns;
6
+ gap;
7
+ customClass;
8
+ constructor(s) {
9
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);
10
+ button: n,
11
+ ...s
12
+ }), this.columns = s?.columns ?? 1, this.gap = s?.gap ?? l, this.customClass = u(this.columns);
17
13
  }
18
14
  plugins() {
19
- return [i(this.columns, this.gap, this.customClass)];
15
+ return [o(this.columns, this.gap, this.customClass)];
20
16
  }
21
17
  }
22
18
  export {
23
- E as BreakAfterPlugin,
24
- c as GAP_DEFAULT,
25
- h as KEY_ELEMENT_BREAK_AFTER_COLUMN
19
+ i as BreakAfterPlugin,
20
+ l as GAP_DEFAULT,
21
+ m as KEY_ELEMENT_BREAK_AFTER_COLUMN
26
22
  };
27
23
  //# sourceMappingURL=ColumnBreakPlugin.es.js.map
@@ -1 +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/rte';\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;AAMJ,SAAK,WAAUF,KAAA,gBAAAA,EAAO,YAAW,GACjC,KAAK,OAAMA,KAAA,gBAAAA,EAAO,QAAOH,GACzB,KAAK,cAAcM,EAA2B,KAAK,OAAO;AAAA,EAC9D;AAAA,EAEA,UAAyB;AACrB,WAAO,CAACC,EAAwB,KAAK,SAAS,KAAK,KAAK,KAAK,WAAW,CAAC;AAAA,EAC7E;AACJ;"}
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/rte';\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","getResponsiveColumnClasses","createColumnBreakPlugin"],"mappings":";;AAOO,MAAMA,IAAiC,oBACjCC,IAAc;AAEpB,MAAMC,UAAyBC,EAAO;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACR,YAAYC,GAAqD;AAC7D,UAAM,sBAAsB;AAAA,MACxB,QAAQC;AAAA,MACR,GAAGD;AAAA,IAAA,CACN,GACD,KAAK,UAAUA,GAAO,WAAW,GACjC,KAAK,MAAMA,GAAO,OAAOH,GACzB,KAAK,cAAcK,EAA2B,KAAK,OAAO;AAAA,EAC9D;AAAA,EAEA,UAAyB;AACrB,WAAO,CAACC,EAAwB,KAAK,SAAS,KAAK,KAAK,KAAK,WAAW,CAAC;AAAA,EAC7E;AACJ;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as g, Fragment as k } from "react/jsx-runtime";
2
- import { useFloatingLinkInsertState as b, offset as F, flip as L, useFloatingLinkInsert as P, useFloatingLinkEditState as S, useFloatingLinkEdit as h } from "@frontify/fondue/rte";
2
+ import { useFloatingLinkInsertState as b, useFloatingLinkInsert as F, useFloatingLinkEditState as L, useFloatingLinkEdit as P, offset as S, flip as h } from "@frontify/fondue/rte";
3
3
  import { createPortal as s } from "react-dom";
4
4
  import { BlockStyles as d, TextStyles as a } from "../../styles.es.js";
5
5
  import { InsertLinkModal as x } from "./InsertLinkModal/InsertLinkModal.es.js";
@@ -8,8 +8,8 @@ const l = {
8
8
  placement: "bottom-start",
9
9
  strategy: "absolute",
10
10
  middleware: [
11
- F(12),
12
- L({
11
+ S(12),
12
+ h({
13
13
  padding: 12,
14
14
  fallbackPlacements: ["bottom-end", "top-start", "top-end"]
15
15
  })
@@ -17,9 +17,9 @@ const l = {
17
17
  }, M = () => {
18
18
  const n = b({
19
19
  floatingOptions: l
20
- }), { props: o, ref: p, hidden: m } = P(n), t = S({
20
+ }), { props: o, ref: p, hidden: m } = F(n), t = L({
21
21
  floatingOptions: l
22
- }), { props: i, ref: u, editButtonProps: c, unlinkButtonProps: f } = h(t);
22
+ }), { props: i, ref: u, editButtonProps: c, unlinkButtonProps: f } = P(t);
23
23
  if (m)
24
24
  return null;
25
25
  const r = /* @__PURE__ */ e(x, {}), y = t.isEditing ? r : /* @__PURE__ */ e(E, { editButtonProps: c, unlinkButtonProps: f });