@frontify/guideline-blocks-settings 3.0.2 → 4.0.0-alpha.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 (260) hide show
  1. package/dist/_virtual/_rolldown/runtime.es.js +17 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +116 -168
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +145 -137
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +25 -28
  7. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
  8. package/dist/components/BlockInjectButton/BlockInjectButton.es.js +114 -126
  9. package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +53 -74
  11. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  12. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +26 -31
  13. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
  14. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +22 -25
  15. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
  16. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +17 -28
  17. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
  18. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +25 -35
  19. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
  20. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +41 -34
  21. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
  22. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +41 -36
  23. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
  24. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +24 -33
  25. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
  26. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +20 -11
  27. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
  28. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +18 -10
  29. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
  30. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +10 -12
  31. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -1
  32. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +13 -13
  33. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -1
  34. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +21 -19
  35. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
  36. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +18 -25
  37. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
  38. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -17
  39. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
  40. package/dist/components/BlockItemWrapper/constants.es.js +6 -6
  41. package/dist/components/BlockItemWrapper/constants.es.js.map +1 -1
  42. package/dist/components/Link/LinkInput.es.js +70 -63
  43. package/dist/components/Link/LinkInput.es.js.map +1 -1
  44. package/dist/components/Link/utils/getUrl.es.js +10 -12
  45. package/dist/components/Link/utils/getUrl.es.js.map +1 -1
  46. package/dist/components/Link/utils/relativeUrlRegex.es.js +6 -5
  47. package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -1
  48. package/dist/components/Link/utils/url.es.js +21 -17
  49. package/dist/components/Link/utils/url.es.js.map +1 -1
  50. package/dist/components/RichTextEditor/RichTextEditor.es.js +61 -68
  51. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  52. package/dist/components/RichTextEditor/SerializedText.es.js +25 -22
  53. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  54. package/dist/components/RichTextEditor/constants.es.js +6 -5
  55. package/dist/components/RichTextEditor/constants.es.js.map +1 -1
  56. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +30 -37
  57. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
  58. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +31 -39
  59. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
  60. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -11
  61. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
  62. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +19 -23
  63. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
  64. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +24 -26
  65. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
  66. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +46 -53
  67. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
  68. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +52 -54
  69. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
  70. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +68 -68
  71. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
  72. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +91 -103
  73. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
  74. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +26 -32
  75. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
  76. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +47 -53
  77. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
  78. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +12 -18
  79. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
  80. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +21 -25
  81. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
  82. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +29 -37
  83. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
  84. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +13 -17
  85. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
  86. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +56 -62
  87. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
  88. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +9 -12
  89. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
  90. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +23 -24
  91. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
  92. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +28 -33
  93. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
  94. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -80
  95. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
  96. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +23 -23
  97. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
  98. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +18 -18
  99. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
  100. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -12
  101. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
  102. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +9 -8
  103. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
  104. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +11 -10
  105. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
  106. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +85 -84
  107. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
  108. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +13 -16
  109. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
  110. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +13 -16
  111. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
  112. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +10 -13
  113. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
  114. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +45 -51
  115. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
  116. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +20 -22
  117. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
  118. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -12
  119. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -1
  120. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +48 -57
  121. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
  122. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +46 -48
  123. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
  124. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +12 -8
  125. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
  126. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +62 -71
  127. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
  128. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +76 -77
  129. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
  130. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +17 -21
  131. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
  132. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +17 -10
  133. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
  134. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -10
  135. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
  136. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +22 -26
  137. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
  138. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +6 -5
  139. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -1
  140. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -40
  141. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
  142. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +10 -10
  143. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
  144. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +26 -26
  145. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
  146. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +40 -46
  147. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
  148. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +40 -46
  149. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
  150. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +40 -46
  151. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
  152. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +41 -47
  153. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
  154. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +41 -47
  155. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
  156. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +41 -47
  157. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
  158. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +41 -47
  159. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
  160. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +44 -38
  161. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
  162. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +41 -47
  163. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
  164. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +40 -46
  165. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
  166. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -41
  167. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
  168. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +40 -48
  169. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
  170. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js +29 -29
  171. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js.map +1 -1
  172. package/dist/components/RichTextEditor/plugins/styles.es.js +167 -166
  173. package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
  174. package/dist/helpers/addHttps.es.js +12 -12
  175. package/dist/helpers/addHttps.es.js.map +1 -1
  176. package/dist/helpers/convertToRichTextValue.es.js +14 -6
  177. package/dist/helpers/convertToRichTextValue.es.js.map +1 -1
  178. package/dist/helpers/hasRichTextValue.es.js +13 -14
  179. package/dist/helpers/hasRichTextValue.es.js.map +1 -1
  180. package/dist/helpers/isDownloadable.es.js +6 -5
  181. package/dist/helpers/isDownloadable.es.js.map +1 -1
  182. package/dist/hooks/useAttachments.es.js +65 -73
  183. package/dist/hooks/useAttachments.es.js.map +1 -1
  184. package/dist/hooks/useIsInViewport.es.js +20 -21
  185. package/dist/hooks/useIsInViewport.es.js.map +1 -1
  186. package/dist/index.cjs.js +2 -10
  187. package/dist/index.cjs.js.map +1 -1
  188. package/dist/index.d.ts +16 -34
  189. package/dist/index.es.js +219 -213
  190. package/dist/index.es.js.map +1 -1
  191. package/dist/index.umd.js +2 -10
  192. package/dist/index.umd.js.map +1 -1
  193. package/dist/settings/background.es.js +20 -21
  194. package/dist/settings/background.es.js.map +1 -1
  195. package/dist/settings/border.es.js +62 -64
  196. package/dist/settings/border.es.js.map +1 -1
  197. package/dist/settings/borderRadius.es.js +49 -52
  198. package/dist/settings/borderRadius.es.js.map +1 -1
  199. package/dist/settings/borderRadiusExtended.es.js +58 -60
  200. package/dist/settings/borderRadiusExtended.es.js.map +1 -1
  201. package/dist/settings/defaultValues.es.js +16 -19
  202. package/dist/settings/defaultValues.es.js.map +1 -1
  203. package/dist/settings/gutter.es.js +48 -52
  204. package/dist/settings/gutter.es.js.map +1 -1
  205. package/dist/settings/margin.es.js +49 -52
  206. package/dist/settings/margin.es.js.map +1 -1
  207. package/dist/settings/marginExtended.es.js +62 -64
  208. package/dist/settings/marginExtended.es.js.map +1 -1
  209. package/dist/settings/padding.es.js +49 -52
  210. package/dist/settings/padding.es.js.map +1 -1
  211. package/dist/settings/paddingExtended.es.js +62 -64
  212. package/dist/settings/paddingExtended.es.js.map +1 -1
  213. package/dist/settings/securityDownloadable.es.js +16 -16
  214. package/dist/settings/securityDownloadable.es.js.map +1 -1
  215. package/dist/settings/securityGlobalControl.es.js +26 -32
  216. package/dist/settings/securityGlobalControl.es.js.map +1 -1
  217. package/dist/settings/types.es.js +41 -47
  218. package/dist/settings/types.es.js.map +1 -1
  219. package/dist/styles.css +2 -1
  220. package/dist/utilities/color/getReadableColor.es.js +15 -13
  221. package/dist/utilities/color/getReadableColor.es.js.map +1 -1
  222. package/dist/utilities/color/isDark.es.js +14 -9
  223. package/dist/utilities/color/isDark.es.js.map +1 -1
  224. package/dist/utilities/color/setAlpha.es.js +7 -6
  225. package/dist/utilities/color/setAlpha.es.js.map +1 -1
  226. package/dist/utilities/color/toColorObject.es.js +14 -8
  227. package/dist/utilities/color/toColorObject.es.js.map +1 -1
  228. package/dist/utilities/color/toHex8String.es.js +7 -6
  229. package/dist/utilities/color/toHex8String.es.js.map +1 -1
  230. package/dist/utilities/color/toHexString.es.js +7 -6
  231. package/dist/utilities/color/toHexString.es.js.map +1 -1
  232. package/dist/utilities/color/toRgbaString.es.js +7 -6
  233. package/dist/utilities/color/toRgbaString.es.js.map +1 -1
  234. package/dist/utilities/color/toShortRgba.es.js +18 -11
  235. package/dist/utilities/color/toShortRgba.es.js.map +1 -1
  236. package/dist/utilities/react/getBackgroundColorStyles.es.js +7 -8
  237. package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
  238. package/dist/utilities/react/getBorderStyles.es.js +12 -11
  239. package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
  240. package/dist/utilities/react/getRadiusStyles.es.js +7 -8
  241. package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
  242. package/dist/utilities/react/joinClassNames.es.js +6 -5
  243. package/dist/utilities/react/joinClassNames.es.js.map +1 -1
  244. package/package.json +7 -9
  245. package/dist/components/Link/LinkSelector/DocumentLink.es.js +0 -64
  246. package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +0 -1
  247. package/dist/components/Link/LinkSelector/DocumentLinks.es.js +0 -65
  248. package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +0 -1
  249. package/dist/components/Link/LinkSelector/LinkSelector.es.js +0 -72
  250. package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +0 -1
  251. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +0 -7
  252. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +0 -1
  253. package/dist/components/Link/LinkSelector/PageLink.es.js +0 -69
  254. package/dist/components/Link/LinkSelector/PageLink.es.js.map +0 -1
  255. package/dist/components/Link/LinkSelector/PageLinks.es.js +0 -38
  256. package/dist/components/Link/LinkSelector/PageLinks.es.js.map +0 -1
  257. package/dist/components/Link/LinkSelector/SectionLink.es.js +0 -26
  258. package/dist/components/Link/LinkSelector/SectionLink.es.js.map +0 -1
  259. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +0 -5
  260. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +0 -1
@@ -1,25 +1,24 @@
1
- import { getPluginOptions as c, focusEditor as f } from "@frontify/fondue/rte";
2
- import { floatingButtonSelectors as o, floatingButtonActions as m } from "../components/FloatingButton/floatingButtonStore.es.js";
3
- import { ELEMENT_BUTTON as a } from "../createButtonPlugin.es.js";
4
- import { upsertButton as p } from "./upsertButton.es.js";
5
- const S = (t) => {
6
- if (!t.selection)
7
- return;
8
- const { isUrl: n, forceSubmit: r } = c(t, a), e = o.url();
9
- if (!(n?.(e) || r))
10
- return;
11
- const i = o.text(), s = o.buttonStyle(), u = o.newTab() ? void 0 : "_self";
12
- return m.reset(), p(t, {
13
- url: e,
14
- text: i,
15
- buttonStyle: s,
16
- target: u,
17
- isUrl: (l) => r || !n ? !0 : n(l)
18
- }), setTimeout(() => {
19
- f(t, t.selection ?? void 0);
20
- }, 0), !0;
1
+ import { floatingButtonActions as e, floatingButtonSelectors as t } from "../components/FloatingButton/floatingButtonStore.es.js";
2
+ import { upsertButton as n } from "./upsertButton.es.js";
3
+ import { ELEMENT_BUTTON as r } from "../createButtonPlugin.es.js";
4
+ import { focusEditor as i, getPluginOptions as a } from "@frontify/fondue/rte";
5
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts
6
+ var o = (o) => {
7
+ if (!o.selection) return;
8
+ let { isUrl: s, forceSubmit: c } = a(o, r), l = t.url();
9
+ if (!(s?.(l) || c)) return;
10
+ let u = t.text(), d = t.buttonStyle(), f = t.newTab() ? void 0 : "_self";
11
+ return e.reset(), n(o, {
12
+ url: l,
13
+ text: u,
14
+ buttonStyle: d,
15
+ target: f,
16
+ isUrl: (e) => c || !s ? !0 : s(e)
17
+ }), setTimeout(() => {
18
+ i(o, o.selection ?? void 0);
19
+ }, 0), !0;
21
20
  };
22
- export {
23
- S as submitFloatingButton
24
- };
25
- //# sourceMappingURL=submitFloatingButton.es.js.map
21
+ //#endregion
22
+ export { o as submitFloatingButton };
23
+
24
+ //# sourceMappingURL=submitFloatingButton.es.js.map
@@ -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,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
+ {"version":3,"file":"submitFloatingButton.es.js","names":[],"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"],"mappings":";;;;;AASA,IAAa,KAAyC,MAA2B;CAC7E,IAAI,CAAC,EAAO,WACR;CAGJ,IAAM,EAAE,UAAO,mBAAgB,EAAkC,GAAQ,CAAc,GACjF,IAAM,EAAwB,IAAI;CAGxC,IAAI,EADY,IAAQ,CAAG,KAAK,IAE5B;CAGJ,IAAM,IAAO,EAAwB,KAAK,GACpC,IAAc,EAAwB,YAAY,GAClD,IAAS,EAAwB,OAAO,IAAI,KAAA,IAAY;CAgB9D,OAdA,EAAsB,MAAM,GAE5B,EAAa,GAAQ;EACjB;EACA;EACA;EACA;EACA,QAAQ,MAAU,KAAe,CAAC,IAAQ,KAAO,EAAM,CAAI;CAC/D,CAAC,GAED,iBAAiB;EACb,EAAY,GAAQ,EAAO,aAAa,KAAA,CAAS;CACrD,GAAG,CAAC,GAEG;AACX"}
@@ -1,34 +1,29 @@
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
- import { ELEMENT_BUTTON as u } from "../createButtonPlugin.es.js";
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) }
8
- }))
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
14
- }), !0;
15
- if (o(t, {
16
- at: t.selection?.focus,
17
- match: { type: c(t, u) }
18
- }))
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
24
- }), !0;
25
- }
26
- l(t, {
27
- match: { type: c(t, u) },
28
- ...e
29
- });
1
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
2
+ import { getAboveNode as t, getPluginType as n, isElement as r, splitNodes as i, unwrapNodes as a, withoutNormalizing as o } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts
4
+ var s = (c, l) => o(c, () => {
5
+ if (l?.split) {
6
+ if (t(c, {
7
+ at: c.selection?.anchor,
8
+ match: { type: n(c, "button") }
9
+ })) return i(c, {
10
+ at: c.selection?.anchor,
11
+ match: (e) => r(e) && e.type === n(c, "button")
12
+ }), s(c, { at: c.selection?.anchor }), !0;
13
+ if (t(c, {
14
+ at: c.selection?.focus,
15
+ match: { type: n(c, "button") }
16
+ })) return i(c, {
17
+ at: c.selection?.focus,
18
+ match: (e) => r(e) && e.type === n(c, "button")
19
+ }), s(c, { at: c.selection?.focus }), !0;
20
+ }
21
+ a(c, {
22
+ match: { type: n(c, e) },
23
+ ...l
24
+ });
30
25
  });
31
- export {
32
- p as unwrapButton
33
- };
34
- //# sourceMappingURL=unwrapButton.es.js.map
26
+ //#endregion
27
+ export { s as unwrapButton };
28
+
29
+ //# 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","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
+ {"version":3,"file":"unwrapButton.es.js","names":[],"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"],"mappings":";;;AAmBA,IAAa,KACT,GACA,MAIO,EAAmB,SAAc;CACpC,IAAI,GAAS,OAAO;EAOhB,IAN0B,EAAa,GAAQ;GAC3C,IAAI,EAAO,WAAW;GACtB,OAAO,EAAE,MAAM,EAAc,GAAA,QAAsB,EAAE;EACzD,CAGI,GAQA,OAPA,EAAW,GAAQ;GACf,IAAI,EAAO,WAAW;GACtB,QAAQ,MAAM,EAAU,CAAC,KAAK,EAAE,SAAS,EAAc,GAAA,QAAsB;EACjF,CAAC,GACD,EAAa,GAAQ,EACjB,IAAI,EAAO,WAAW,OAC1B,CAAC,GACM;EAQX,IANyB,EAAa,GAAQ;GAC1C,IAAI,EAAO,WAAW;GACtB,OAAO,EAAE,MAAM,EAAc,GAAA,QAAsB,EAAE;EACzD,CAGI,GAQA,OAPA,EAAW,GAAQ;GACf,IAAI,EAAO,WAAW;GACtB,QAAQ,MAAM,EAAU,CAAC,KAAK,EAAE,SAAS,EAAc,GAAA,QAAsB;EACjF,CAAC,GACD,EAAa,GAAQ,EACjB,IAAI,EAAO,WAAW,MAC1B,CAAC,GACM;CAEf;CAEA,EAAY,GAAQ;EAChB,OAAO,EAAE,MAAM,EAAc,GAAQ,CAAc,EAAE;EACrD,GAAG;CACP,CAAC;AAGL,CAAC"}
@@ -1,84 +1,65 @@
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
- }) => {
16
- const f = n.selection;
17
- if (!f)
18
- return;
19
- const u = P(n, {
20
- at: f,
21
- match: { type: a(n, p) }
22
- });
23
- if (r && u)
24
- return n.insertText(e), !0;
25
- if (!l?.(e))
26
- return;
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
37
- });
38
- const E = R(N ?? {}), i = n.selection?.focus.path;
39
- if (!i)
40
- return;
41
- const y = d(n, i);
42
- return t?.length || (t = e), M(
43
- n,
44
- {
45
- ...E,
46
- url: e,
47
- target: o,
48
- children: [
49
- {
50
- ...y,
51
- text: t
52
- }
53
- ]
54
- },
55
- h
56
- ), !0;
1
+ import { insertButton as e } from "./insertButton.es.js";
2
+ import { unwrapButton as t } from "./unwrapButton.es.js";
3
+ import { upsertButtonText as n } from "./upsertButtonText.es.js";
4
+ import { wrapButton as r } from "./wrapButton.es.js";
5
+ import { ELEMENT_BUTTON as i } from "../createButtonPlugin.es.js";
6
+ import { findNode as a, getAboveNode as o, getEditorString as s, getNodeLeaf as c, getNodeProps as l, getPluginOptions as u, getPluginType as d, isDefined as f, isExpanded as p, removeNodes as m, setNodes as h } from "@frontify/fondue/rte";
7
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts
8
+ var g = (t, { url: n, text: r, buttonStyle: s, target: h, insertTextInButton: g, insertNodesOptions: b, isUrl: x = u(t, i).isUrl }) => {
9
+ let S = t.selection;
10
+ if (!S) return;
11
+ let C = o(t, {
12
+ at: S,
13
+ match: { type: d(t, i) }
14
+ });
15
+ if (g && C) return t.insertText(n), !0;
16
+ if (!x?.(n)) return;
17
+ if (f(r) && r.length === 0 && (r = n), C) return y(n, t, C, h, s, r), !0;
18
+ let [w, T] = a(t, {
19
+ at: S,
20
+ match: { type: d(t, "button") }
21
+ }) ?? [], E = _(t, T, r);
22
+ if (p(S)) return v(C, t, n, s, h, r), !0;
23
+ E && m(t, { at: T });
24
+ let D = l(w ?? {}), O = t.selection?.focus.path;
25
+ if (!O) return;
26
+ let k = c(t, O);
27
+ return r?.length || (r = n), e(t, {
28
+ ...D,
29
+ url: n,
30
+ target: h,
31
+ children: [{
32
+ ...k,
33
+ text: r
34
+ }]
35
+ }, b), !0;
57
36
  };
58
- function j(n, e, t) {
59
- return e && t?.length && t !== I(n, e);
37
+ function _(e, t, n) {
38
+ return t && n?.length && n !== s(e, t);
60
39
  }
61
- function k(n, e, t, s, o, r) {
62
- n ? m(e, {
63
- at: n[1]
64
- }) : m(e, {
65
- split: !0
66
- }), _(e, {
67
- url: t,
68
- buttonStyle: s,
69
- target: o
70
- }), g(e, { text: r });
40
+ function v(e, i, a, o, s, c) {
41
+ e ? t(i, { at: e[1] }) : t(i, { split: !0 }), r(i, {
42
+ url: a,
43
+ buttonStyle: o,
44
+ target: s
45
+ }), n(i, {
46
+ url: a,
47
+ target: s,
48
+ text: c
49
+ });
71
50
  }
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 },
76
- {
77
- at: t[1]
78
- }
79
- ), g(e, { text: r });
51
+ function y(e, t, r, i, a, o) {
52
+ (e !== r[0]?.url || i !== r[0]?.target || a !== r[0]?.buttonStyle) && h(t, {
53
+ url: e,
54
+ target: i,
55
+ buttonStyle: a
56
+ }, { at: r[1] }), n(t, {
57
+ url: e,
58
+ text: o,
59
+ target: i
60
+ });
80
61
  }
81
- export {
82
- K as upsertButton
83
- };
84
- //# sourceMappingURL=upsertButton.es.js.map
62
+ //#endregion
63
+ export { g as upsertButton };
64
+
65
+ //# 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","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
+ {"version":3,"file":"upsertButton.es.js","names":[],"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"],"mappings":";;;;;;;AAiDA,IAAa,KACT,GACA,EACI,QACA,SACA,gBACA,WACA,uBACA,uBACA,WAAQ,EAAkC,GAAQ,CAAc,CAAC,CAAC,YAErE;CACD,IAAM,IAAK,EAAO;CAClB,IAAI,CAAC,GACD;CAGJ,IAAM,IAAc,EAA6B,GAAQ;EACrD;EACA,OAAO,EAAE,MAAM,EAAc,GAAQ,CAAc,EAAE;CACzD,CAAC;CAGD,IAAI,KAAsB,GAGtB,OADA,EAAO,WAAW,CAAG,GACd;CAGX,IAAI,CAAC,IAAQ,CAAG,GACZ;CAOJ,IAJI,EAAU,CAAI,KAAK,EAAK,WAAW,MACnC,IAAO,IAGP,GAEA,OADA,EAA0B,GAAK,GAAQ,GAAa,GAAQ,GAAa,CAAI,GACtE;CASX,IAAM,CAAC,GAAY,KALC,EAAyB,GAAQ;EACjD;EACA,OAAO,EAAE,MAAM,EAAc,GAAA,QAAsB,EAAE;CACzD,CAEiC,KAAe,CAAC,GAE3C,IAAoB,EAA2B,GAAQ,GAAY,CAAI;CAE7E,IAAI,EAAW,CAAE,GAEb,OADA,EAA0B,GAAa,GAAQ,GAAK,GAAa,GAAQ,CAAI,GACtE;CAGX,AAAI,KACA,EAAY,GAAQ,EAChB,IAAI,EACR,CAAC;CAGL,IAAM,IAAQ,EAAa,KAAe,CAAC,CAAW,GAEhD,IAAO,EAAO,WAAW,MAAM;CACrC,IAAI,CAAC,GACD;CAIJ,IAAM,IAAO,EAAY,GAAQ,CAAI;CAsBrC,OAnBK,GAAM,WACP,IAAO,IAGX,EACI,GACA;EACI,GAAG;EACH;EACA;EACA,UAAU,CACN;GACI,GAAG;GACH;EACJ,CACJ;CACJ,GACA,CACJ,GACO;AACX;AAEA,SAAS,EAAyC,GAAwB,GAAmB,GAAe;CACxG,OAAO,KAAc,GAAM,UAAU,MAAS,EAAgB,GAAQ,CAAU;AACpF;AAEA,SAAS,EACL,GACA,GACA,GACA,GACA,GACA,GACF;CAiBE,AAhBI,IACA,EAAa,GAAQ,EACjB,IAAI,EAAY,GACpB,CAAC,IAED,EAAa,GAAQ,EACjB,OAAO,GACX,CAAC,GAGL,EAAW,GAAQ;EACf;EACA;EACA;CACJ,CAAC,GAED,EAAiB,GAAQ;EAAE;EAAK;EAAQ;CAAK,CAAC;AAClD;AAEA,SAAS,EACL,GACA,GACA,GACA,GACA,GACA,GACF;CAeE,CAbI,MAAQ,EAAY,EAAE,EAAE,OACxB,MAAW,EAAY,EAAE,EAAE,UAC3B,MAAgB,EAAY,EAAE,EAAE,gBAEhC,EACI,GACA;EAAE;EAAK;EAAQ;CAAY,GAC3B,EACI,IAAI,EAAY,GACpB,CACJ,GAGJ,EAAiB,GAAQ;EAAE;EAAK;EAAM;CAAO,CAAC;AAClD"}
@@ -1,24 +1,24 @@
1
- import { getAboveNode as i, getPluginType as c, getEditorString as p, replaceNodeChildren as u } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as g } from "../createButtonPlugin.es.js";
3
- const f = (t, { text: e }) => {
4
- const n = i(t, {
5
- match: { type: c(t, g) }
6
- });
7
- if (n) {
8
- const [r, o] = n;
9
- if (e?.length && e !== p(t, o)) {
10
- const s = r.children[0];
11
- u(t, {
12
- at: o,
13
- nodes: { ...s, text: e },
14
- insertOptions: {
15
- select: !0
16
- }
17
- });
18
- }
19
- }
1
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
2
+ import { getAboveNode as t, getEditorString as n, getPluginType as r, replaceNodeChildren as i } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts
4
+ var a = (a, { text: o }) => {
5
+ let s = t(a, { match: { type: r(a, e) } });
6
+ if (s) {
7
+ let [e, t] = s;
8
+ if (o?.length && o !== n(a, t)) {
9
+ let n = e.children[0];
10
+ i(a, {
11
+ at: t,
12
+ nodes: {
13
+ ...n,
14
+ text: o
15
+ },
16
+ insertOptions: { select: !0 }
17
+ });
18
+ }
19
+ }
20
20
  };
21
- export {
22
- f as upsertButtonText
23
- };
24
- //# sourceMappingURL=upsertButtonText.es.js.map
21
+ //#endregion
22
+ export { a as upsertButtonText };
23
+
24
+ //# sourceMappingURL=upsertButtonText.es.js.map
@@ -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,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
+ {"version":3,"file":"upsertButtonText.es.js","names":[],"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"],"mappings":";;;AAoBA,IAAa,KAAqC,GAAwB,EAAE,cAAmC;CAC3G,IAAM,IAAY,EAA6B,GAAQ,EACnD,OAAO,EAAE,MAAM,EAAc,GAAQ,CAAc,EAAE,EACzD,CAAC;CAED,IAAI,GAAW;EACX,IAAM,CAAC,GAAe,KAAiB;EAEvC,IAAI,GAAM,UAAU,MAAS,EAAgB,GAAQ,CAAa,GAAG;GACjE,IAAM,IAAY,EAAc,SAAS;GAGzC,EAA2B,GAAQ;IAC/B,IAAI;IACJ,OAAO;KAAE,GAAG;KAAW;IAAK;IAC5B,eAAe,EACX,QAAQ,GACZ;GACJ,CAAC;EACL;CACJ;AACJ"}
@@ -1,19 +1,19 @@
1
- import { wrapNodes as i, getPluginType as m } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as n } from "../createButtonPlugin.es.js";
3
- const s = (t, { url: p, buttonStyle: r, target: o, ...e }) => {
4
- i(
5
- t,
6
- {
7
- type: m(t, n),
8
- url: p,
9
- buttonStyle: r,
10
- target: o,
11
- children: []
12
- },
13
- { split: !0, ...e }
14
- );
1
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
2
+ import { getPluginType as t, wrapNodes as n } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts
4
+ var r = (r, { url: i, buttonStyle: a, target: o, ...s }) => {
5
+ n(r, {
6
+ type: t(r, e),
7
+ url: i,
8
+ buttonStyle: a,
9
+ target: o,
10
+ children: []
11
+ }, {
12
+ split: !0,
13
+ ...s
14
+ });
15
15
  };
16
- export {
17
- s as wrapButton
18
- };
19
- //# sourceMappingURL=wrapButton.es.js.map
16
+ //#endregion
17
+ export { r as wrapButton };
18
+
19
+ //# sourceMappingURL=wrapButton.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, type WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n"],"names":["wrapButton","editor","url","buttonStyle","target","options","wrapNodes","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAeO,MAAMA,IAAa,CACtBC,GACA,EAAE,KAAAC,GAAK,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,QAC9B;AACD,EAAAC;AAAA,IACIL;AAAA,IACA;AAAA,MACI,MAAMM,EAAcN,GAAQO,CAAc;AAAA,MAC1C,KAAAN;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,UAAU,CAAA;AAAA,IAAC;AAAA,IAEf,EAAE,OAAO,IAAM,GAAGC,EAAA;AAAA,EAAQ;AAElC;"}
1
+ {"version":3,"file":"wrapButton.es.js","names":[],"sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, type WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n"],"mappings":";;;AAeA,IAAa,KACT,GACA,EAAE,QAAK,gBAAa,WAAQ,GAAG,QAC9B;CACD,EACI,GACA;EACI,MAAM,EAAc,GAAQ,CAAc;EAC1C;EACA;EACA;EACA,UAAU,CAAC;CACf,GACA;EAAE,OAAO;EAAM,GAAG;CAAQ,CAC9B;AACJ"}
@@ -1,13 +1,14 @@
1
- import { getPluginType as i } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as m } from "../createButtonPlugin.es.js";
3
- const u = (t, { url: r, text: e = "", buttonStyle: o = "primary", target: p, children: n }) => ({
4
- type: i(t, m),
5
- url: r,
6
- target: p,
7
- buttonStyle: o,
8
- children: n ?? [{ text: e }]
1
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
2
+ import { getPluginType as t } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts
4
+ var n = (n, { url: r, text: i = "", buttonStyle: a = "primary", target: o, children: s }) => ({
5
+ type: t(n, e),
6
+ url: r,
7
+ target: o,
8
+ buttonStyle: a,
9
+ children: s ?? [{ text: i }]
9
10
  });
10
- export {
11
- u as createButtonNode
12
- };
13
- //# sourceMappingURL=createButtonNode.es.js.map
11
+ //#endregion
12
+ export { n as createButtonNode };
13
+
14
+ //# sourceMappingURL=createButtonNode.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createButtonNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type TText, type Value, getPluginType } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle, type TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n"],"names":["createButtonNode","editor","url","text","buttonStyle","target","children","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAeO,MAAMA,IAAmB,CAC5BC,GACA,EAAE,KAAAC,GAAK,MAAAC,IAAO,IAAI,aAAAC,IAAc,WAAW,QAAAC,GAAQ,UAAAC,SAI5C;AAAA,EACH,MAHSC,EAAcN,GAAQO,CAAc;AAAA,EAI7C,KAAAN;AAAA,EACA,QAAAG;AAAA,EACA,aAAAD;AAAA,EACA,UAAUE,KAAY,CAAC,EAAE,MAAAH,GAAM;AAAA;"}
1
+ {"version":3,"file":"createButtonNode.es.js","names":[],"sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type TText, type Value, getPluginType } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle, type TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n"],"mappings":";;;AAeA,IAAa,KACT,GACA,EAAE,QAAK,UAAO,IAAI,iBAAc,WAAW,WAAQ,mBAI5C;CACH,MAHS,EAAc,GAAQ,CAG/B;CACA;CACA;CACA;CACA,UAAU,KAAY,CAAC,EAAE,QAAK,CAAC;AACnC"}
@@ -1,10 +1,11 @@
1
- import { getAboveNode as o } from "@frontify/fondue/rte";
2
1
  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";
2
+ import { getAboveNode as t } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts
4
+ var n = (n) => {
5
+ let r = t(n, { match: { type: e } });
6
+ return Array.isArray(r) && r[0]?.buttonStyle || "primary";
6
7
  };
7
- export {
8
- n as getButtonStyle
9
- };
10
- //# sourceMappingURL=getButtonStyle.es.js.map
8
+ //#endregion
9
+ export { n as getButtonStyle };
10
+
11
+ //# 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"],"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
+ {"version":3,"file":"getButtonStyle.es.js","names":[],"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"],"mappings":";;;AAMA,IAAa,KAAkB,MAA6C;CACxE,IAAM,IAAW,EAA6B,GAAQ,EAAE,OAAO,EAAE,MAAM,EAAe,EAAE,CAAC;CAMzF,OAJK,MAAM,QAAQ,CAAQ,KAInB,EAAS,EAAE,EAAE,eAHV;AAIf"}
@@ -1,10 +1,11 @@
1
- import { getAboveNode as e } from "@frontify/fondue/rte";
2
- import { ELEMENT_BUTTON as n } from "../createButtonPlugin.es.js";
3
- const i = (r, t) => {
4
- const o = e(r, { match: { type: n } });
5
- return Array.isArray(o) ? t(o[0]) : "";
6
- }, c = (r) => i(r, (t) => t.url ?? "");
7
- export {
8
- c as getUrlFromEditor
9
- };
10
- //# sourceMappingURL=getUrl.es.js.map
1
+ import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
2
+ import { getAboveNode as t } from "@frontify/fondue/rte";
3
+ //#region src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts
4
+ var n = (n, r) => {
5
+ let i = t(n, { match: { type: e } });
6
+ return Array.isArray(i) ? r(i[0]) : "";
7
+ }, r = (e) => n(e, (e) => e.url ?? "");
8
+ //#endregion
9
+ export { r as getUrlFromEditor };
10
+
11
+ //# sourceMappingURL=getUrl.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUrl.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n"],"names":["getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_BUTTON","getUrlFromEditor","link"],"mappings":";;AAMA,MAAMA,IAAc,CAACC,GAAqBC,MAAiD;AACvF,QAAMC,IAAWC,EAA6BH,GAAQ,EAAE,OAAO,EAAE,MAAMI,EAAA,GAAkB;AAEzF,SAAK,MAAM,QAAQF,CAAQ,IAIpBD,EAAGC,EAAS,CAAC,CAAC,IAHV;AAIf,GAEaG,IAAmB,CAACL,MACtBD,EAAYC,GAAQ,CAACM,MAASA,EAAK,OAAO,EAAE;"}
1
+ {"version":3,"file":"getUrl.es.js","names":[],"sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue/rte';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n"],"mappings":";;;AAMA,IAAM,KAAe,GAAqB,MAAiD;CACvF,IAAM,IAAW,EAA6B,GAAQ,EAAE,OAAO,EAAE,MAAM,EAAe,EAAE,CAAC;CAMzF,OAJK,MAAM,QAAQ,CAAQ,IAIpB,EAAG,EAAS,EAAE,IAHV;AAIf,GAEa,KAAoB,MACtB,EAAY,IAAS,MAAS,EAAK,OAAO,EAAE"}