@frontify/guideline-blocks-settings 0.27.0 → 0.28.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.
- package/.eslintrc.js +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +24 -5
- package/dist/_virtual/_commonjsHelpers.es.js +7 -0
- package/dist/_virtual/_commonjsHelpers.es.js.map +1 -0
- package/dist/_virtual/index.es.js +5 -0
- package/dist/_virtual/index.es.js.map +1 -0
- package/dist/_virtual/index.es2.js +5 -0
- package/dist/_virtual/index.es2.js.map +1 -0
- package/dist/_virtual/index.es3.js +5 -0
- package/dist/_virtual/index.es3.js.map +1 -0
- package/dist/_virtual/jsx-runtime.es.js +5 -0
- package/dist/_virtual/jsx-runtime.es.js.map +1 -0
- package/dist/_virtual/react-dom.development.es.js +5 -0
- package/dist/_virtual/react-dom.development.es.js.map +1 -0
- package/dist/_virtual/react-dom.production.min.es.js +5 -0
- package/dist/_virtual/react-dom.production.min.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js.map +1 -0
- package/dist/_virtual/react.development.es.js +5 -0
- package/dist/_virtual/react.development.es.js.map +1 -0
- package/dist/_virtual/react.production.min.es.js +5 -0
- package/dist/_virtual/react.production.min.es.js.map +1 -0
- package/dist/_virtual/scheduler.development.es.js +5 -0
- package/dist/_virtual/scheduler.development.es.js.map +1 -0
- package/dist/_virtual/scheduler.production.min.es.js +5 -0
- package/dist/_virtual/scheduler.production.min.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentItem.es.js +180 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +145 -0
- package/dist/components/Attachments/Attachments.es.js.map +1 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +150 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +73 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar.es.js +113 -0
- package/dist/components/BlockItemWrapper/Toolbar.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/constants.es.js +6 -0
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.es.js +39 -0
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js +42 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -0
- package/dist/components/RichTextEditor/SerializedText.es.js +13 -0
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -0
- package/dist/components/RichTextEditor/constants.es.js +5 -0
- package/dist/components/RichTextEditor/constants.es.js.map +1 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +34 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +54 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +30 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +16 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +37 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +69 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +105 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +58 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +43 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +62 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +86 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +10 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +75 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +14 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +37 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +29 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +8 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +80 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +93 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +27 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +48 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +55 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +62 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +61 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +34 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +168 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +16 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +19 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +17 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +15 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js +12 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +61 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js +25 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js +8 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js +13 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js.map +1 -0
- package/dist/helpers/addHttps.es.js +14 -0
- package/dist/helpers/addHttps.es.js.map +1 -0
- package/dist/helpers/convertToRichTextValue.es.js +6 -0
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js +32 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -0
- package/dist/helpers/hasRichTextValue.es.js +15 -0
- package/dist/helpers/hasRichTextValue.es.js.map +1 -0
- package/dist/helpers/isDownloadable.es.js +6 -0
- package/dist/helpers/isDownloadable.es.js.map +1 -0
- package/dist/helpers/mapColorPalettes.es.js +16 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +31 -0
- package/dist/hooks/useAttachments.es.js.map +1 -0
- package/dist/hooks/useDndSensors.es.js +20 -0
- package/dist/hooks/useDndSensors.es.js.map +1 -0
- package/dist/index.cjs.js +252 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +816 -1
- package/dist/index.es.js +172 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +252 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js +22 -0
- package/dist/settings/background.es.js.map +1 -0
- package/dist/settings/border.es.js +61 -0
- package/dist/settings/border.es.js.map +1 -0
- package/dist/settings/borderRadius.es.js +56 -0
- package/dist/settings/borderRadius.es.js.map +1 -0
- package/dist/settings/borderRadiusExtended.es.js +64 -0
- package/dist/settings/borderRadiusExtended.es.js.map +1 -0
- package/dist/settings/defaultValues.es.js +19 -0
- package/dist/settings/defaultValues.es.js.map +1 -0
- package/dist/settings/gutter.es.js +56 -0
- package/dist/settings/gutter.es.js.map +1 -0
- package/dist/settings/margin.es.js +53 -0
- package/dist/settings/margin.es.js.map +1 -0
- package/dist/settings/marginExtended.es.js +65 -0
- package/dist/settings/marginExtended.es.js.map +1 -0
- package/dist/settings/padding.es.js +53 -0
- package/dist/settings/padding.es.js.map +1 -0
- package/dist/settings/paddingExtended.es.js +65 -0
- package/dist/settings/paddingExtended.es.js.map +1 -0
- package/dist/settings/securityDownloadable.es.js +19 -0
- package/dist/settings/securityDownloadable.es.js.map +1 -0
- package/dist/settings/securityGlobalControl.es.js +33 -0
- package/dist/settings/securityGlobalControl.es.js.map +1 -0
- package/dist/settings/types.es.js +48 -0
- package/dist/settings/types.es.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/utilities/color/getReadableColor.es.js +14 -0
- package/dist/utilities/color/getReadableColor.es.js.map +1 -0
- package/dist/utilities/color/isDark.es.js +10 -0
- package/dist/utilities/color/isDark.es.js.map +1 -0
- package/dist/utilities/color/setAlpha.es.js +6 -0
- package/dist/utilities/color/setAlpha.es.js.map +1 -0
- package/dist/utilities/color/toColorObject.es.js +9 -0
- package/dist/utilities/color/toColorObject.es.js.map +1 -0
- package/dist/utilities/color/toHex8String.es.js +7 -0
- package/dist/utilities/color/toHex8String.es.js.map +1 -0
- package/dist/utilities/color/toHexString.es.js +7 -0
- package/dist/utilities/color/toHexString.es.js.map +1 -0
- package/dist/utilities/color/toRgbaString.es.js +7 -0
- package/dist/utilities/color/toRgbaString.es.js.map +1 -0
- package/dist/utilities/color/toShortRgba.es.js +11 -0
- package/dist/utilities/color/toShortRgba.es.js.map +1 -0
- package/dist/utilities/moveItemInArray.es.js +12 -0
- package/dist/utilities/moveItemInArray.es.js.map +1 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js +8 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -0
- package/dist/utilities/react/getBorderStyles.es.js +12 -0
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -0
- package/dist/utilities/react/getRadiusStyles.es.js +8 -0
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -0
- package/dist/utilities/react/joinClassNames.es.js +5 -0
- package/dist/utilities/react/joinClassNames.es.js.map +1 -0
- package/package.json +46 -10
- package/postcss.config.js +8 -0
- package/setupTests.ts +13 -0
- package/src/components/Attachments/AttachmentItem.tsx +257 -0
- package/src/components/Attachments/Attachments.spec.ct.tsx +151 -0
- package/src/components/Attachments/Attachments.tsx +221 -0
- package/src/components/Attachments/index.ts +4 -0
- package/src/components/Attachments/types.ts +30 -0
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +48 -0
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +212 -0
- package/src/components/BlockInjectButton/index.ts +4 -0
- package/src/components/BlockInjectButton/types.ts +18 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +146 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +76 -0
- package/src/components/BlockItemWrapper/Toolbar.tsx +128 -0
- package/src/components/BlockItemWrapper/constants.ts +4 -0
- package/src/components/BlockItemWrapper/index.ts +5 -0
- package/src/components/BlockItemWrapper/types.ts +46 -0
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +20 -0
- package/src/components/DownloadButton/DownloadButton.tsx +36 -0
- package/src/components/DownloadButton/index.ts +3 -0
- package/src/components/DownloadButton/types.ts +5 -0
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +204 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +62 -0
- package/src/components/RichTextEditor/SerializedText.tsx +25 -0
- package/src/components/RichTextEditor/constants.ts +3 -0
- package/src/components/RichTextEditor/index.ts +6 -0
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +53 -0
- package/src/components/RichTextEditor/pluginPresets/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +74 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +20 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +56 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +19 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +42 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +37 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +81 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +143 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +31 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +46 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +12 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +21 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +71 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +116 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +7 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +17 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +68 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +198 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +28 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +14 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +18 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +77 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +23 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +45 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +106 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +26 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +43 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +45 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +5 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +105 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +16 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +73 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +136 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +38 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +36 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +48 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +12 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.ts +30 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.spec.ts +35 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.spec.ts +75 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.ts +21 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +59 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +44 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +15 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/index.ts +6 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.tsx +97 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.spec.ct.tsx +138 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.tsx +83 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.tsx +68 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.tsx +37 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/styles.ts +179 -0
- package/src/components/RichTextEditor/serializer/index.ts +3 -0
- package/src/components/RichTextEditor/serializer/nodes/button.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +29 -0
- package/src/components/RichTextEditor/serializer/nodes/default.ts +52 -0
- package/src/components/RichTextEditor/serializer/nodes/link.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/mentionHtmlNode.ts +17 -0
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +134 -0
- package/src/components/RichTextEditor/serializer/serializeToHtml.ts +49 -0
- package/src/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.ts +21 -0
- package/src/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.ts +32 -0
- package/src/components/RichTextEditor/types.ts +23 -0
- package/src/components/index.ts +7 -0
- package/src/helpers/addHttps.spec.ts +42 -0
- package/src/helpers/addHttps.ts +15 -0
- package/src/helpers/convertToRichTextValue.spec.ts +32 -0
- package/src/helpers/convertToRichTextValue.ts +6 -0
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +69 -0
- package/src/helpers/customCoordinatesGetterFactory.ts +39 -0
- package/src/helpers/hasRichTextValue.spec.ts +63 -0
- package/src/helpers/hasRichTextValue.ts +29 -0
- package/src/helpers/index.ts +8 -0
- package/src/helpers/isDownloadable.spec.ts +47 -0
- package/src/helpers/isDownloadable.ts +7 -0
- package/src/helpers/mapColorPalettes.spec.ts +146 -0
- package/src/helpers/mapColorPalettes.ts +22 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAttachments.spec.ts +79 -0
- package/src/hooks/useAttachments.ts +46 -0
- package/src/hooks/useDndSensors.spec.ts +40 -0
- package/src/hooks/useDndSensors.ts +23 -0
- package/src/index.ts +8 -0
- package/src/settings/background.spec.ts +173 -0
- package/src/settings/background.ts +49 -0
- package/src/settings/border.spec.ts +76 -0
- package/src/settings/border.ts +90 -0
- package/src/settings/borderRadius.spec.ts +30 -0
- package/src/settings/borderRadius.ts +73 -0
- package/src/settings/borderRadiusExtended.spec.ts +52 -0
- package/src/settings/borderRadiusExtended.ts +84 -0
- package/src/settings/defaultValues.ts +21 -0
- package/src/settings/gutter.spec.ts +60 -0
- package/src/settings/gutter.ts +75 -0
- package/src/settings/index.ts +14 -0
- package/src/settings/margin.spec.ts +42 -0
- package/src/settings/margin.ts +72 -0
- package/src/settings/marginExtended.spec.ts +45 -0
- package/src/settings/marginExtended.ts +91 -0
- package/src/settings/padding.spec.ts +42 -0
- package/src/settings/padding.ts +73 -0
- package/src/settings/paddingExtended.spec.ts +45 -0
- package/src/settings/paddingExtended.ts +91 -0
- package/src/settings/security.spec.ts +87 -0
- package/src/settings/security.ts +61 -0
- package/src/settings/securityDownloadable.spec.ts +46 -0
- package/src/settings/securityDownloadable.ts +33 -0
- package/src/settings/securityGlobalControl.ts +42 -0
- package/src/settings/types.ts +128 -0
- package/src/utilities/color/getReadableColor.spec.ts +32 -0
- package/src/utilities/color/getReadableColor.ts +34 -0
- package/src/utilities/color/index.ts +10 -0
- package/src/utilities/color/isDark.spec.ts +33 -0
- package/src/utilities/color/isDark.ts +29 -0
- package/src/utilities/color/setAlpha.spec.ts +28 -0
- package/src/utilities/color/setAlpha.ts +14 -0
- package/src/utilities/color/toColorObject.spec.ts +19 -0
- package/src/utilities/color/toColorObject.ts +16 -0
- package/src/utilities/color/toHex8String.spec.ts +17 -0
- package/src/utilities/color/toHex8String.ts +14 -0
- package/src/utilities/color/toHexString.spec.ts +17 -0
- package/src/utilities/color/toHexString.ts +10 -0
- package/src/utilities/color/toRgbaString.spec.ts +12 -0
- package/src/utilities/color/toRgbaString.ts +14 -0
- package/src/utilities/color/toShortRgba.spec.ts +16 -0
- package/src/utilities/color/toShortRgba.ts +35 -0
- package/src/utilities/index.ts +5 -0
- package/src/utilities/moveItemInArray.spec.ts +17 -0
- package/src/utilities/moveItemInArray.ts +21 -0
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +18 -0
- package/src/utilities/react/getBackgroundColorStyles.ts +11 -0
- package/src/utilities/react/getBorderStyles.spec.ts +39 -0
- package/src/utilities/react/getBorderStyles.ts +21 -0
- package/src/utilities/react/getRadiusStyles.spec.ts +25 -0
- package/src/utilities/react/getRadiusStyles.ts +8 -0
- package/src/utilities/react/index.ts +6 -0
- package/src/utilities/react/joinClassNames.spec.ts +18 -0
- package/src/utilities/react/joinClassNames.ts +10 -0
- package/tailwind.config.js +27 -0
- package/tsconfig.json +3 -1
- package/vite.config.ts +11 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { j as a } from "../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { useElementProps as p } from "@udecode/plate";
|
|
3
|
+
import { r as l } from "../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
4
|
+
import { BlockButtonStyles as c } from "../utils/styles.es.js";
|
|
5
|
+
const i = (e) => ({
|
|
6
|
+
...p({
|
|
7
|
+
...e,
|
|
8
|
+
elementToAttributes: (t) => ({
|
|
9
|
+
url: t.href,
|
|
10
|
+
buttonStyle: t.buttonStyle || "primary",
|
|
11
|
+
target: t.target || "_blank"
|
|
12
|
+
})
|
|
13
|
+
}),
|
|
14
|
+
// quick fix: hovering <a> with href loses the editor focus
|
|
15
|
+
onMouseOver: (t) => {
|
|
16
|
+
t.stopPropagation();
|
|
17
|
+
}
|
|
18
|
+
}), x = (e) => {
|
|
19
|
+
const { href: o, target: t, buttonStyle: r } = i(e), { attributes: s, children: n } = e;
|
|
20
|
+
return /* @__PURE__ */ a.jsx(
|
|
21
|
+
m,
|
|
22
|
+
{
|
|
23
|
+
attributes: s,
|
|
24
|
+
href: o,
|
|
25
|
+
target: t,
|
|
26
|
+
styles: c[`button${r.charAt(0).toUpperCase() + r.slice(1)}`],
|
|
27
|
+
children: n
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}, m = ({
|
|
31
|
+
attributes: e,
|
|
32
|
+
styles: o = { hover: {} },
|
|
33
|
+
children: t,
|
|
34
|
+
href: r = "#",
|
|
35
|
+
target: s
|
|
36
|
+
}) => {
|
|
37
|
+
const [n, u] = l.useState(!1);
|
|
38
|
+
return /* @__PURE__ */ a.jsx(
|
|
39
|
+
"a",
|
|
40
|
+
{
|
|
41
|
+
...e,
|
|
42
|
+
onMouseEnter: () => u(!0),
|
|
43
|
+
onMouseLeave: () => u(!1),
|
|
44
|
+
href: r,
|
|
45
|
+
target: s,
|
|
46
|
+
style: n ? { ...o, ...o.hover } : o,
|
|
47
|
+
children: t
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
x as ButtonMarkupElementNode
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=ButtonMarkupElementNode.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonMarkupElementNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { HTMLPropsAs, PlateRenderElementProps, Value, useElementProps } from '@udecode/plate';\nimport { CSSProperties, HTMLAttributeAnchorTarget, ReactElement, ReactNode, useState } from 'react';\nimport { RichTextButtonStyle, TButtonElement } from '../types';\nimport { BlockButtonStyles } from '../utils';\n\nexport type ButtonRootProps = PlateRenderElementProps<Value, TButtonElement> & HTMLPropsAs<'a'>;\n\nconst useButton = (props: ButtonRootProps): HTMLPropsAs<'a'> & { buttonStyle: RichTextButtonStyle } => {\n const _props = useElementProps<TButtonElement, 'a'>({\n ...props,\n elementToAttributes: (element) => ({\n url: element.href,\n buttonStyle: element.buttonStyle || 'primary',\n target: element.target || '_blank',\n }),\n });\n\n return {\n ...(_props as HTMLPropsAs<'a'> & { buttonStyle: RichTextButtonStyle }),\n // quick fix: hovering <a> with href loses the editor focus\n onMouseOver: (e) => {\n e.stopPropagation();\n },\n };\n};\n\nexport const ButtonMarkupElementNode = (props: ButtonRootProps) => {\n const { href, target, buttonStyle } = useButton(props);\n const { attributes, children } = props;\n\n return (\n <HoverableButtonLink\n attributes={attributes}\n href={href}\n target={target}\n styles={BlockButtonStyles[`button${buttonStyle.charAt(0).toUpperCase() + buttonStyle.slice(1)}`]}\n >\n {children}\n </HoverableButtonLink>\n );\n};\n\ntype Props = {\n attributes: ButtonRootProps['attributes'];\n children: ReactNode;\n styles?: CSSProperties & { hover?: CSSProperties };\n href?: string;\n target?: HTMLAttributeAnchorTarget;\n};\n\nconst HoverableButtonLink = ({\n attributes,\n styles = { hover: {} },\n children,\n href = '#',\n target,\n}: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n\n return (\n <a\n {...attributes}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n href={href}\n target={target}\n style={hovered ? { ...styles, ...styles.hover } : styles}\n >\n {children}\n </a>\n );\n};\n"],"names":["useButton","props","useElementProps","element","e","ButtonMarkupElementNode","href","target","buttonStyle","attributes","children","jsx","HoverableButtonLink","BlockButtonStyles","styles","hovered","setHovered","useState"],"mappings":";;;;AASA,MAAMA,IAAY,CAACC,OAUR;AAAA,EACH,GAVWC,EAAqC;AAAA,IAChD,GAAGD;AAAA,IACH,qBAAqB,CAACE,OAAa;AAAA,MAC/B,KAAKA,EAAQ;AAAA,MACb,aAAaA,EAAQ,eAAe;AAAA,MACpC,QAAQA,EAAQ,UAAU;AAAA,IAAA;AAAA,EAC9B,CACH;AAAA;AAAA,EAKG,aAAa,CAACC,MAAM;AAChB,IAAAA,EAAE,gBAAgB;AAAA,EACtB;AAAA,IAIKC,IAA0B,CAACJ,MAA2B;AAC/D,QAAM,EAAE,MAAAK,GAAM,QAAAC,GAAQ,aAAAC,EAAY,IAAIR,EAAUC,CAAK,GAC/C,EAAE,YAAAQ,GAAY,UAAAC,EAAa,IAAAT;AAG7B,SAAAU,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,YAAAH;AAAA,MACA,MAAAH;AAAA,MACA,QAAAC;AAAA,MACA,QAAQM,EAAkB,SAASL,EAAY,OAAO,CAAC,EAAE,YAAgB,IAAAA,EAAY,MAAM,CAAC,GAAG;AAAA,MAE9F,UAAAE;AAAA,IAAA;AAAA,EAAA;AAGb,GAUME,IAAsB,CAAC;AAAA,EACzB,YAAAH;AAAA,EACA,QAAAK,IAAS,EAAE,OAAO,GAAG;AAAA,EACrB,UAAAJ;AAAA,EACA,MAAAJ,IAAO;AAAA,EACP,QAAAC;AACJ,MAA2B;AACvB,QAAM,CAACQ,GAASC,CAAU,IAAIC,WAAS,EAAK;AAGxC,SAAAN,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGF;AAAA,MACJ,cAAc,MAAMO,EAAW,EAAI;AAAA,MACnC,cAAc,MAAMA,EAAW,EAAK;AAAA,MACpC,MAAAV;AAAA,MACA,QAAAC;AAAA,MACA,OAAOQ,IAAU,EAAE,GAAGD,GAAQ,GAAGA,EAAO,UAAUA;AAAA,MAEjD,UAAAJ;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MarkupElement as o } from "@frontify/fondue";
|
|
2
|
+
import { ELEMENT_BUTTON as e } from "../createButtonPlugin.es.js";
|
|
3
|
+
import { ButtonMarkupElementNode as m } from "./ButtonMarkupElementNode.es.js";
|
|
4
|
+
class s extends o {
|
|
5
|
+
constructor(t = e, r = m) {
|
|
6
|
+
super(t, r);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as ButtonMarkupElement
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.es.js.map
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MarkupElement } from '@frontify/fondue';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { ButtonMarkupElementNode } from './ButtonMarkupElementNode';\n\nexport class ButtonMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_BUTTON, node = ButtonMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["ButtonMarkupElement","MarkupElement","id","ELEMENT_BUTTON","node","ButtonMarkupElementNode"],"mappings":";;;AAMO,MAAMA,UAA4BC,EAAc;AAAA,EACnD,YAAYC,IAAKC,GAAgBC,IAAOC,GAAyB;AAC7D,UAAMH,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { j as t } from "../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { IconButton16 as r, buttonStyles as e } from "@frontify/fondue";
|
|
3
|
+
import { getPluginType as s } from "@udecode/plate";
|
|
4
|
+
import { ELEMENT_BUTTON as i } from "../createButtonPlugin.es.js";
|
|
5
|
+
import { ButtonToolbarButton as m } from "./ButtonToolbarButton.es.js";
|
|
6
|
+
const a = ({ editor: o, id: n }) => /* @__PURE__ */ t.jsx("div", { "data-plugin-id": n, children: /* @__PURE__ */ t.jsx(
|
|
7
|
+
m,
|
|
8
|
+
{
|
|
9
|
+
type: s(o, i),
|
|
10
|
+
icon: /* @__PURE__ */ t.jsx("span", { className: "tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex", children: /* @__PURE__ */ t.jsx(r, {}) }),
|
|
11
|
+
styles: e
|
|
12
|
+
}
|
|
13
|
+
) });
|
|
14
|
+
export {
|
|
15
|
+
a as ButtonButton
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ButtonButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconButton16, PluginButtonProps, buttonStyles } from '@frontify/fondue';\nimport { getPluginType } from '@udecode/plate';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { ButtonToolbarButton } from './ButtonToolbarButton';\n\nexport const ButtonButton = ({ editor, id }: PluginButtonProps) => (\n <div data-plugin-id={id}>\n <ButtonToolbarButton\n type={getPluginType(editor, ELEMENT_BUTTON)}\n icon={\n <span className=\"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex\">\n <IconButton16 />\n </span>\n }\n styles={buttonStyles}\n />\n </div>\n);\n"],"names":["ButtonButton","editor","id","jsx","ButtonToolbarButton","getPluginType","ELEMENT_BUTTON","IconButton16","buttonStyles"],"mappings":";;;;;AAOa,MAAAA,IAAe,CAAC,EAAE,QAAAC,GAAQ,IAAAC,QACnCC,gBAAAA,EAAAA,IAAC,OAAI,EAAA,kBAAgBD,GACjB,UAAAC,gBAAAA,EAAA;AAAA,EAACC;AAAA,EAAA;AAAA,IACG,MAAMC,EAAcJ,GAAQK,CAAc;AAAA,IAC1C,MACKH,gBAAAA,EAAA,IAAA,QAAA,EAAK,WAAU,2DACZ,UAAAA,gBAAAA,MAACI,IAAa,CAAA,GAClB;AAAA,IAEJ,QAAQC;AAAA,EAAA;AACZ,EACJ,CAAA;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { j as i } from "../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { getTooltip as a, getHotkeyByPlatform as l, getButtonClassNames as c } from "@frontify/fondue";
|
|
3
|
+
import { useEditorRef as u, isRangeInSameBlock as m, someNode as f, ToolbarButton as p, focusEditor as g } from "@udecode/plate";
|
|
4
|
+
import { triggerFloatingButton as B } from "../utils/triggerFloatingButton.es.js";
|
|
5
|
+
const y = ({ type: s, ...n }) => {
|
|
6
|
+
const t = u(), o = !!m(t, {
|
|
7
|
+
at: t.selection
|
|
8
|
+
}), r = !!(t != null && t.selection) && f(t, { match: { type: s } });
|
|
9
|
+
return /* @__PURE__ */ i.jsx(
|
|
10
|
+
p,
|
|
11
|
+
{
|
|
12
|
+
tooltip: a(
|
|
13
|
+
o ? `Button
|
|
14
|
+
${l("Ctrl+Shift+K")}` : "Buttons can only be set for a single text block."
|
|
15
|
+
),
|
|
16
|
+
classNames: c(o),
|
|
17
|
+
active: r,
|
|
18
|
+
onMouseDown: async (e) => {
|
|
19
|
+
t && (e.preventDefault(), e.stopPropagation(), g(t, t.selection ?? t.prevSelection ?? void 0), setTimeout(() => {
|
|
20
|
+
B(t, { focused: !0 });
|
|
21
|
+
}, 0));
|
|
22
|
+
},
|
|
23
|
+
...n
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
y as ButtonToolbarButton
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=ButtonToolbarButton.es.js.map
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonToolbarButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { getButtonClassNames, getHotkeyByPlatform, getTooltip } from '@frontify/fondue';\nimport {\n BlockToolbarButtonProps,\n ToolbarButton,\n focusEditor,\n isRangeInSameBlock,\n someNode,\n useEditorRef,\n} from '@udecode/plate';\n\nimport { triggerFloatingButton } from '../utils';\n\nexport interface LinkToolbarButtonProps extends BlockToolbarButtonProps {\n /**\n * Default onMouseDown is getting the link url by calling this promise before inserting the image.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\nexport const ButtonToolbarButton = ({ type, ...props }: LinkToolbarButtonProps) => {\n const editor = useEditorRef();\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n\n const isLink = !!editor?.selection && someNode(editor, { match: { type } });\n\n return (\n <ToolbarButton\n tooltip={getTooltip(\n isEnabled\n ? `Button\\n${getHotkeyByPlatform('Ctrl+Shift+K')}`\n : 'Buttons can only be set for a single text block.'\n )}\n classNames={getButtonClassNames(isEnabled)}\n active={isLink}\n onMouseDown={async (event) => {\n if (!editor) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n\n setTimeout(() => {\n triggerFloatingButton(editor, { focused: true });\n }, 0);\n }}\n {...props}\n />\n );\n};\n"],"names":["ButtonToolbarButton","type","props","editor","useEditorRef","isEnabled","isRangeInSameBlock","isLink","someNode","jsx","ToolbarButton","getTooltip","getHotkeyByPlatform","getButtonClassNames","event","focusEditor","triggerFloatingButton"],"mappings":";;;;AAqBO,MAAMA,IAAsB,CAAC,EAAE,MAAAC,GAAM,GAAGC,QAAoC;AAC/E,QAAMC,IAASC,KACTC,IAAY,CAAC,CAACC,EAAmBH,GAAQ;AAAA,IAC3C,IAAIA,EAAO;AAAA,EAAA,CACd,GAEKI,IAAS,CAAC,EAACJ,KAAA,QAAAA,EAAQ,cAAaK,EAASL,GAAQ,EAAE,OAAO,EAAE,MAAAF,EAAK,EAAG,CAAA;AAGtE,SAAAQ,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASC;AAAA,QACLN,IACM;AAAA,EAAWO,EAAoB,cAAc,MAC7C;AAAA,MACV;AAAA,MACA,YAAYC,EAAoBR,CAAS;AAAA,MACzC,QAAQE;AAAA,MACR,aAAa,OAAOO,MAAU;AAC1B,QAAKX,MAILW,EAAM,eAAe,GACrBA,EAAM,gBAAgB,GAEtBC,EAAYZ,GAAQA,EAAO,aAAaA,EAAO,iBAAiB,MAAS,GAEzE,WAAW,MAAM;AACb,UAAAa,EAAsBb,GAAQ,EAAE,SAAS,GAAM,CAAA;AAAA,WAChD,CAAC;AAAA,MACR;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { j as t } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { EditModal as s } from "./EditButtonModal/EditModal.es.js";
|
|
3
|
+
import { FloatingButton as n } from "./FloatingButton.es.js";
|
|
4
|
+
import { useFloatingButtonSelectors as e } from "./floatingButtonStore.es.js";
|
|
5
|
+
import { InsertButtonModal as m } from "./InsertButtonModal/InsertButtonModal.es.js";
|
|
6
|
+
const x = () => {
|
|
7
|
+
const i = e().isEditing(), o = /* @__PURE__ */ t.jsx(m, {}), r = i ? o : /* @__PURE__ */ t.jsx(s, {});
|
|
8
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
9
|
+
/* @__PURE__ */ t.jsx(n.InsertRoot, { children: o }),
|
|
10
|
+
/* @__PURE__ */ t.jsx(n.EditRoot, { children: r })
|
|
11
|
+
] });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
x as CustomFloatingButton
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=CustomFloatingButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomFloatingButton.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { EditModal } from './EditButtonModal/EditModal';\nimport { FloatingButton } from './FloatingButton';\nimport { useFloatingButtonSelectors } from './floatingButtonStore';\nimport { InsertButtonModal } from './InsertButtonModal/InsertButtonModal';\n\nexport const CustomFloatingButton = () => {\n const isEditing = useFloatingButtonSelectors().isEditing();\n\n const input = <InsertButtonModal />;\n const editContent = isEditing ? input : <EditModal />;\n return (\n <>\n <FloatingButton.InsertRoot>{input}</FloatingButton.InsertRoot>\n <FloatingButton.EditRoot>{editContent}</FloatingButton.EditRoot>\n </>\n );\n};\n"],"names":["CustomFloatingButton","isEditing","useFloatingButtonSelectors","input","InsertButtonModal","editContent","jsx","EditModal","jsxs","Fragment","FloatingButton"],"mappings":";;;;;AAOO,MAAMA,IAAuB,MAAM;AAChC,QAAAC,IAAYC,IAA6B,aAEzCC,0BAASC,GAAkB,CAAA,CAAA,GAC3BC,IAAcJ,IAAYE,IAAQG,gBAAAA,EAAAA,IAACC,GAAU,CAAA,CAAA;AACnD,SAEQC,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,IAACH,gBAAAA,EAAAA,IAAAI,EAAe,YAAf,EAA2B,UAAMP,EAAA,CAAA;AAAA,IACjCG,gBAAAA,EAAAA,IAAAI,EAAe,UAAf,EAAyB,UAAYL,EAAA,CAAA;AAAA,EAC1C,EAAA,CAAA;AAER;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { j as t } from "../../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { IconPen16 as o, IconTrashBin16 as s } from "@frontify/fondue";
|
|
3
|
+
import { useFloatingButtonUrlInput as r } from "../FloatingButtonUrlInput.es.js";
|
|
4
|
+
import { BlockStyles as a } from "../../../../styles.es.js";
|
|
5
|
+
import { FloatingButton as n } from "../FloatingButton.es.js";
|
|
6
|
+
const p = () => {
|
|
7
|
+
const e = r({});
|
|
8
|
+
return /* @__PURE__ */ t.jsx("div", { "data-test-id": "floating-button-edit", className: "tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]", children: /* @__PURE__ */ t.jsxs("span", { "data-test-id": "preview-button-flyout", className: "tw-flex tw-justify-between", children: [
|
|
9
|
+
/* @__PURE__ */ t.jsx("span", { className: "tw-pointer-events-none", style: a.p, children: e.defaultValue }),
|
|
10
|
+
/* @__PURE__ */ t.jsxs("span", { className: "tw-flex tw-gap-2", children: [
|
|
11
|
+
/* @__PURE__ */ t.jsx(
|
|
12
|
+
"span",
|
|
13
|
+
{
|
|
14
|
+
role: "button",
|
|
15
|
+
tabIndex: 0,
|
|
16
|
+
"data-test-id": "edit-button-button",
|
|
17
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
18
|
+
children: /* @__PURE__ */ t.jsx(n.EditButton, { children: /* @__PURE__ */ t.jsx(o, {}) })
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ t.jsx(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
role: "button",
|
|
25
|
+
tabIndex: 0,
|
|
26
|
+
"data-test-id": "remove-button-button",
|
|
27
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
28
|
+
children: /* @__PURE__ */ t.jsx(n.UnlinkButton, { children: /* @__PURE__ */ t.jsx(s, {}) })
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
] })
|
|
32
|
+
] }) });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
p as EditModal
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=EditModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditModal.es.js","sources":["../../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen16, IconTrashBin16 } from '@frontify/fondue';\nimport { FloatingButton, useFloatingButtonUrlInput } from '..';\nimport { BlockStyles } from '../../../..';\n\nexport const EditModal = () => {\n const urlHtmlProps = useFloatingButtonUrlInput({});\n\n return (\n <div data-test-id=\"floating-button-edit\" className=\"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]\">\n <span data-test-id=\"preview-button-flyout\" className=\"tw-flex tw-justify-between\">\n <span className=\"tw-pointer-events-none\" style={BlockStyles.p}>\n {urlHtmlProps.defaultValue}\n </span>\n <span className=\"tw-flex tw-gap-2\">\n <span\n role=\"button\"\n tabIndex={0}\n data-test-id=\"edit-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <FloatingButton.EditButton>\n <IconPen16 />\n </FloatingButton.EditButton>\n </span>\n\n <span\n role=\"button\"\n tabIndex={0}\n data-test-id=\"remove-button-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <FloatingButton.UnlinkButton>\n <IconTrashBin16 />\n </FloatingButton.UnlinkButton>\n </span>\n </span>\n </span>\n </div>\n );\n};\n"],"names":["EditModal","urlHtmlProps","useFloatingButtonUrlInput","jsx","jsxs","BlockStyles","FloatingButton","IconPen16","IconTrashBin16"],"mappings":";;;;;AAMO,MAAMA,IAAY,MAAM;AACrB,QAAAC,IAAeC,EAA0B,CAAA,CAAE;AAG7C,SAAAC,gBAAAA,EAAAA,IAAC,OAAI,EAAA,gBAAa,wBAAuB,WAAU,4DAC/C,UAAAC,gBAAAA,EAAAA,KAAC,QAAK,EAAA,gBAAa,yBAAwB,WAAU,8BACjD,UAAA;AAAA,IAAAD,gBAAAA,EAAAA,IAAC,UAAK,WAAU,0BAAyB,OAAOE,EAAY,GACvD,YAAa,aAClB,CAAA;AAAA,IACAD,gBAAAA,EAAAA,KAAC,QAAK,EAAA,WAAU,oBACZ,UAAA;AAAA,MAAAD,gBAAAA,EAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UAEV,gCAACG,EAAe,YAAf,EACG,UAAAH,gBAAAA,MAACI,IAAU,CAAA,GACf;AAAA,QAAA;AAAA,MACJ;AAAA,MAEAJ,gBAAAA,EAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UAEV,gCAACG,EAAe,cAAf,EACG,UAAAH,gBAAAA,MAACK,IAAe,CAAA,GACpB;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA,GACJ;AAAA,EAAA,EACJ,CAAA,EACJ,CAAA;AAER;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createComponentAs as r, createElementAs as i } from "@udecode/plate";
|
|
2
|
+
import { useFloatingButtonEdit as e } from "./useFloatingButtonEdit.es.js";
|
|
3
|
+
import { useFloatingButtonInsert as l } from "./useFloatingButtonInsert.es.js";
|
|
4
|
+
import { FloatingButtonEditButton as s } from "./FloatingButtonEditButton.es.js";
|
|
5
|
+
import { UnlinkButton as u } from "./UnlinkButton.es.js";
|
|
6
|
+
const m = r((n) => {
|
|
7
|
+
var o;
|
|
8
|
+
const t = e(n);
|
|
9
|
+
return ((o = t.style) == null ? void 0 : o.display) === "none" ? null : i("div", t);
|
|
10
|
+
}), p = r((n) => {
|
|
11
|
+
var o;
|
|
12
|
+
const t = l(n);
|
|
13
|
+
return ((o = t.style) == null ? void 0 : o.display) === "none" ? null : i("div", t);
|
|
14
|
+
}), g = {
|
|
15
|
+
EditRoot: m,
|
|
16
|
+
InsertRoot: p,
|
|
17
|
+
EditButton: s,
|
|
18
|
+
UnlinkButton: u
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
g as FloatingButton,
|
|
22
|
+
m as FloatingButtonEditRoot,
|
|
23
|
+
p as FloatingButtonInsertRoot
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=FloatingButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingButton.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { HTMLPropsAs, UseVirtualFloatingOptions, createComponentAs, createElementAs } from '@udecode/plate';\nimport { useFloatingButtonEdit } from './useFloatingButtonEdit';\nimport { useFloatingButtonInsert } from './useFloatingButtonInsert';\nimport { FloatingButtonEditButton } from './FloatingButtonEditButton';\nimport { UnlinkButton } from './UnlinkButton';\n\nexport type FloatingButtonProps = HTMLPropsAs<'div'> & {\n floatingOptions?: UseVirtualFloatingOptions;\n};\n\nexport const FloatingButtonEditRoot = createComponentAs<FloatingButtonProps>((props) => {\n const htmlProps = useFloatingButtonEdit(props);\n\n if (htmlProps.style?.display === 'none') {\n return null;\n }\n\n return createElementAs('div', htmlProps);\n});\n\nexport const FloatingButtonInsertRoot = createComponentAs<FloatingButtonProps>((props) => {\n const htmlProps = useFloatingButtonInsert(props);\n\n if (htmlProps.style?.display === 'none') {\n return null;\n }\n return createElementAs('div', htmlProps);\n});\n\nexport const FloatingButton = {\n EditRoot: FloatingButtonEditRoot,\n InsertRoot: FloatingButtonInsertRoot,\n EditButton: FloatingButtonEditButton,\n UnlinkButton,\n};\n"],"names":["FloatingButtonEditRoot","createComponentAs","props","htmlProps","useFloatingButtonEdit","_a","createElementAs","FloatingButtonInsertRoot","useFloatingButtonInsert","FloatingButton","FloatingButtonEditButton","UnlinkButton"],"mappings":";;;;;AAYa,MAAAA,IAAyBC,EAAuC,CAACC,MAAU;;AAC9E,QAAAC,IAAYC,EAAsBF,CAAK;AAEzC,WAAAG,IAAAF,EAAU,UAAV,gBAAAE,EAAiB,aAAY,SACtB,OAGJC,EAAgB,OAAOH,CAAS;AAC3C,CAAC,GAEYI,IAA2BN,EAAuC,CAACC,MAAU;;AAChF,QAAAC,IAAYK,EAAwBN,CAAK;AAE3C,WAAAG,IAAAF,EAAU,UAAV,gBAAAE,EAAiB,aAAY,SACtB,OAEJC,EAAgB,OAAOH,CAAS;AAC3C,CAAC,GAEYM,IAAiB;AAAA,EAC1B,UAAUT;AAAA,EACV,YAAYO;AAAA,EACZ,YAAYG;AAAA,EACZ,cAAAC;AACJ;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
2
|
+
import { createComponentAs as n, createElementAs as e, useEditorRef as i } from "@udecode/plate";
|
|
3
|
+
import { triggerFloatingButtonEdit as s } from "../../utils/triggerFloatingButtonEdit.es.js";
|
|
4
|
+
const u = (o) => {
|
|
5
|
+
const t = i();
|
|
6
|
+
return {
|
|
7
|
+
onClick: r.useCallback(() => {
|
|
8
|
+
s(t);
|
|
9
|
+
}, [t]),
|
|
10
|
+
...o
|
|
11
|
+
};
|
|
12
|
+
}, l = n((o) => {
|
|
13
|
+
const t = u(o);
|
|
14
|
+
return e("button", t);
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
l as FloatingButtonEditButton,
|
|
18
|
+
u as useFloatingButtonEditButton
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=FloatingButtonEditButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingButtonEditButton.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback } from 'react';\nimport { AsProps, HTMLPropsAs, createComponentAs, createElementAs, useEditorRef } from '@udecode/plate';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\n\nexport const useFloatingButtonEditButton = (props: HTMLPropsAs<'button'>): HTMLPropsAs<'button'> => {\n const editor = useEditorRef();\n\n return {\n onClick: useCallback(() => {\n triggerFloatingButtonEdit(editor);\n }, [editor]),\n ...props,\n };\n};\n\nexport const FloatingButtonEditButton = createComponentAs<AsProps<'button'>>((props) => {\n const htmlProps = useFloatingButtonEditButton(props);\n\n return createElementAs('button', htmlProps);\n});\n"],"names":["useFloatingButtonEditButton","props","editor","useEditorRef","useCallback","triggerFloatingButtonEdit","FloatingButtonEditButton","createComponentAs","htmlProps","createElementAs"],"mappings":";;;AAMa,MAAAA,IAA8B,CAACC,MAAwD;AAChG,QAAMC,IAASC;AAER,SAAA;AAAA,IACH,SAASC,cAAY,MAAM;AACvB,MAAAC,EAA0BH,CAAM;AAAA,IAAA,GACjC,CAACA,CAAM,CAAC;AAAA,IACX,GAAGD;AAAA,EAAA;AAEX,GAEaK,IAA2BC,EAAqC,CAACN,MAAU;AAC9E,QAAAO,IAAYR,EAA4BC,CAAK;AAE5C,SAAAQ,EAAgB,UAAUD,CAAS;AAC9C,CAAC;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { r as o } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
2
|
+
import { mergeProps as s, useComposedRef as l } from "@udecode/plate";
|
|
3
|
+
import { useFloatingButtonSelectors as a, floatingButtonActions as f, floatingButtonSelectors as c } from "./floatingButtonStore.es.js";
|
|
4
|
+
const g = (r) => {
|
|
5
|
+
const u = a().updated(), e = o.useRef(null);
|
|
6
|
+
o.useEffect(() => {
|
|
7
|
+
e.current && u && setTimeout(() => {
|
|
8
|
+
var t;
|
|
9
|
+
(t = e.current) == null || t.focus();
|
|
10
|
+
}, 0);
|
|
11
|
+
}, [u]);
|
|
12
|
+
const n = o.useCallback((t) => {
|
|
13
|
+
f.url(t.target.value);
|
|
14
|
+
}, []);
|
|
15
|
+
return s(
|
|
16
|
+
{
|
|
17
|
+
onChange: n,
|
|
18
|
+
defaultValue: c.url()
|
|
19
|
+
},
|
|
20
|
+
{ ...r, ref: l(r.ref, e) }
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
g as useFloatingButtonUrlInput
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=FloatingButtonUrlInput.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingButtonUrlInput.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ChangeEventHandler, useCallback, useEffect, useRef } from 'react';\nimport { HTMLPropsAs, mergeProps, useComposedRef } from '@udecode/plate';\nimport { floatingButtonActions, floatingButtonSelectors, useFloatingButtonSelectors } from './floatingButtonStore';\n\nexport const useFloatingButtonUrlInput = (props: HTMLPropsAs<'input'>): HTMLPropsAs<'input'> => {\n const updated = useFloatingButtonSelectors().updated();\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (ref.current && updated) {\n setTimeout(() => {\n ref.current?.focus();\n }, 0);\n }\n }, [updated]);\n\n const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((e) => {\n floatingButtonActions.url(e.target.value);\n }, []);\n\n return mergeProps(\n {\n onChange,\n defaultValue: floatingButtonSelectors.url(),\n },\n { ...props, ref: useComposedRef<HTMLInputElement>(props.ref, ref) }\n );\n};\n"],"names":["useFloatingButtonUrlInput","props","updated","useFloatingButtonSelectors","ref","useRef","useEffect","_a","onChange","useCallback","e","floatingButtonActions","mergeProps","floatingButtonSelectors","useComposedRef"],"mappings":";;;AAMa,MAAAA,IAA4B,CAACC,MAAsD;AACtF,QAAAC,IAAUC,IAA6B,WACvCC,IAAMC,SAAyB,IAAI;AAEzCC,EAAAA,EAAAA,UAAU,MAAM;AACR,IAAAF,EAAI,WAAWF,KACf,WAAW,MAAM;;AACb,OAAAK,IAAAH,EAAI,YAAJ,QAAAG,EAAa;AAAA,OACd,CAAC;AAAA,EACR,GACD,CAACL,CAAO,CAAC;AAEN,QAAAM,IAAiDC,cAAY,CAACC,MAAM;AAChD,IAAAC,EAAA,IAAID,EAAE,OAAO,KAAK;AAAA,EAC5C,GAAG,CAAE,CAAA;AAEE,SAAAE;AAAA,IACH;AAAA,MACI,UAAAJ;AAAA,MACA,cAAcK,EAAwB,IAAI;AAAA,IAC9C;AAAA,IACA,EAAE,GAAGZ,GAAO,KAAKa,EAAiCb,EAAM,KAAKG,CAAG,EAAE;AAAA,EAAA;AAE1E;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { j as e } from "../../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { FormControl as d } from "@frontify/fondue";
|
|
3
|
+
import { r as m } from "../../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
4
|
+
import { InsertModal as y } from "../../../../LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js";
|
|
5
|
+
import { useInsertModal as f } from "./useInsertModal.es.js";
|
|
6
|
+
import { BlockStyles as n } from "../../../../styles.es.js";
|
|
7
|
+
const j = () => {
|
|
8
|
+
const r = f(), { state: t, onButtonStyleChange: o } = r;
|
|
9
|
+
return /* @__PURE__ */ e.jsx(y, { ...r, testId: "floating-button-insert", children: /* @__PURE__ */ e.jsx("div", { className: "tw-pt-5", children: /* @__PURE__ */ e.jsxs(
|
|
10
|
+
d,
|
|
11
|
+
{
|
|
12
|
+
label: {
|
|
13
|
+
children: "Button Style",
|
|
14
|
+
htmlFor: "buttonStyle",
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ e.jsx(
|
|
19
|
+
i,
|
|
20
|
+
{
|
|
21
|
+
id: "primary",
|
|
22
|
+
styles: n.buttonPrimary,
|
|
23
|
+
isActive: t.buttonStyle === "primary",
|
|
24
|
+
onClick: () => o("primary"),
|
|
25
|
+
children: t.text || "Primary Button"
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ e.jsx(
|
|
29
|
+
i,
|
|
30
|
+
{
|
|
31
|
+
id: "secondary",
|
|
32
|
+
styles: n.buttonSecondary,
|
|
33
|
+
isActive: t.buttonStyle === "secondary",
|
|
34
|
+
onClick: () => o("secondary"),
|
|
35
|
+
children: t.text || "Secondary Button"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ e.jsx(
|
|
39
|
+
i,
|
|
40
|
+
{
|
|
41
|
+
id: "tertiary",
|
|
42
|
+
styles: n.buttonTertiary,
|
|
43
|
+
isActive: t.buttonStyle === "tertiary",
|
|
44
|
+
onClick: () => o("tertiary"),
|
|
45
|
+
children: t.text || "Tertiary Button"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
) }) });
|
|
51
|
+
}, i = ({ id: r, styles: t, isActive: o, onClick: l, children: a }) => {
|
|
52
|
+
const [u, s] = m.useState(!1), c = () => t && t.hover && u ? { ...t, ...t.hover } : t;
|
|
53
|
+
return /* @__PURE__ */ e.jsx(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
"data-test-id": `floating-button-insert-${r}`,
|
|
57
|
+
onMouseEnter: () => s(!0),
|
|
58
|
+
onMouseLeave: () => s(!1),
|
|
59
|
+
onClick: l,
|
|
60
|
+
style: c(),
|
|
61
|
+
className: o ? "tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit" : "tw-w-fit",
|
|
62
|
+
children: a
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
j as InsertButtonModal
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=InsertButtonModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsertButtonModal.es.js","sources":["../../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FormControl } from '@frontify/fondue';\nimport { CSSProperties, ReactElement, ReactNode, useState } from 'react';\nimport { InsertModal } from '../../../../LinkPlugin/FloatingLink/InsertLinkModal/InsertModal';\nimport { useInsertModal } from './useInsertModal';\nimport { BlockStyles } from '../../../../styles';\n\nexport const InsertButtonModal = () => {\n const modalProps = useInsertModal();\n const { state, onButtonStyleChange } = modalProps;\n\n return (\n <InsertModal {...modalProps} testId=\"floating-button-insert\">\n <div className=\"tw-pt-5\">\n <FormControl\n label={{\n children: 'Button Style',\n htmlFor: 'buttonStyle',\n required: true,\n }}\n >\n <HoverableButton\n id=\"primary\"\n styles={BlockStyles.buttonPrimary}\n isActive={state.buttonStyle === 'primary'}\n onClick={() => onButtonStyleChange('primary')}\n >\n {state.text || 'Primary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"secondary\"\n styles={BlockStyles.buttonSecondary}\n isActive={state.buttonStyle === 'secondary'}\n onClick={() => onButtonStyleChange('secondary')}\n >\n {state.text || 'Secondary Button'}\n </HoverableButton>\n\n <HoverableButton\n id=\"tertiary\"\n styles={BlockStyles.buttonTertiary}\n isActive={state.buttonStyle === 'tertiary'}\n onClick={() => onButtonStyleChange('tertiary')}\n >\n {state.text || 'Tertiary Button'}\n </HoverableButton>\n </FormControl>\n </div>\n </InsertModal>\n );\n};\n\ntype Props = {\n id: string;\n styles?: CSSProperties & { hover?: CSSProperties };\n isActive: boolean;\n onClick: () => void;\n children: ReactNode;\n};\n\nconst HoverableButton = ({ id, styles, isActive, onClick, children }: Props): ReactElement => {\n const [hovered, setHovered] = useState(false);\n const getStyles = () => (styles && styles.hover && hovered ? { ...styles, ...styles.hover } : styles);\n\n return (\n <button\n data-test-id={`floating-button-insert-${id}`}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={onClick}\n style={getStyles()}\n className={\n isActive ? 'tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit' : 'tw-w-fit'\n }\n >\n {children}\n </button>\n );\n};\n"],"names":["InsertButtonModal","modalProps","useInsertModal","state","onButtonStyleChange","jsx","InsertModal","jsxs","FormControl","HoverableButton","BlockStyles","id","styles","isActive","onClick","children","hovered","setHovered","useState","getStyles"],"mappings":";;;;;;AAQO,MAAMA,IAAoB,MAAM;AACnC,QAAMC,IAAaC,KACb,EAAE,OAAAC,GAAO,qBAAAC,EAAwB,IAAAH;AAGnC,SAAAI,gBAAAA,EAAA,IAACC,KAAa,GAAGL,GAAY,QAAO,0BAChC,UAAAI,gBAAAA,EAAAA,IAAC,OAAI,EAAA,WAAU,WACX,UAAAE,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU;AAAA,MACd;AAAA,MAEA,UAAA;AAAA,QAAAH,gBAAAA,EAAA;AAAA,UAACI;AAAA,UAAA;AAAA,YACG,IAAG;AAAA,YACH,QAAQC,EAAY;AAAA,YACpB,UAAUP,EAAM,gBAAgB;AAAA,YAChC,SAAS,MAAMC,EAAoB,SAAS;AAAA,YAE3C,YAAM,QAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,QAEAC,gBAAAA,EAAA;AAAA,UAACI;AAAA,UAAA;AAAA,YACG,IAAG;AAAA,YACH,QAAQC,EAAY;AAAA,YACpB,UAAUP,EAAM,gBAAgB;AAAA,YAChC,SAAS,MAAMC,EAAoB,WAAW;AAAA,YAE7C,YAAM,QAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,QAEAC,gBAAAA,EAAA;AAAA,UAACI;AAAA,UAAA;AAAA,YACG,IAAG;AAAA,YACH,QAAQC,EAAY;AAAA,YACpB,UAAUP,EAAM,gBAAgB;AAAA,YAChC,SAAS,MAAMC,EAAoB,UAAU;AAAA,YAE5C,YAAM,QAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,EAER,CAAA,EACJ,CAAA;AAER,GAUMK,IAAkB,CAAC,EAAE,IAAAE,GAAI,QAAAC,GAAQ,UAAAC,GAAU,SAAAC,GAAS,UAAAC,QAAoC;AAC1F,QAAM,CAACC,GAASC,CAAU,IAAIC,WAAS,EAAK,GACtCC,IAAY,MAAOP,KAAUA,EAAO,SAASI,IAAU,EAAE,GAAGJ,GAAQ,GAAGA,EAAO,MAAA,IAAUA;AAG1F,SAAAP,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,gBAAc,0BAA0BM;AAAA,MACxC,cAAc,MAAMM,EAAW,EAAI;AAAA,MACnC,cAAc,MAAMA,EAAW,EAAK;AAAA,MACpC,SAAAH;AAAA,MACA,OAAOK,EAAU;AAAA,MACjB,WACIN,IAAW,8EAA8E;AAAA,MAG5F,UAAAE;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { r as d } from "../../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
2
|
+
import { useEditorRef as b, getPluginOptions as h, useHotkeys as E } from "@udecode/plate";
|
|
3
|
+
import { floatingButtonSelectors as u, floatingButtonActions as a } from "../floatingButtonStore.es.js";
|
|
4
|
+
import { ELEMENT_BUTTON as g } from "../../../createButtonPlugin.es.js";
|
|
5
|
+
import { submitFloatingButton as B } from "../../../transforms/submitFloatingButton.es.js";
|
|
6
|
+
import { getButtonStyle as x } from "../../../utils/getButtonStyle.es.js";
|
|
7
|
+
import { CheckboxState as r } from "@frontify/fondue";
|
|
8
|
+
import { isValidUrlOrEmpty as i } from "../../../../LinkPlugin/utils/url.es.js";
|
|
9
|
+
import { addHttps as U } from "../../../../../../../helpers/addHttps.es.js";
|
|
10
|
+
const N = {
|
|
11
|
+
url: "",
|
|
12
|
+
text: "",
|
|
13
|
+
buttonStyle: "primary",
|
|
14
|
+
newTab: r.Unchecked
|
|
15
|
+
}, k = () => {
|
|
16
|
+
const [n, o] = d.useReducer((e, s) => {
|
|
17
|
+
const { type: c, payload: l } = s;
|
|
18
|
+
switch (c) {
|
|
19
|
+
case "NEW_TAB":
|
|
20
|
+
return {
|
|
21
|
+
...e,
|
|
22
|
+
newTab: r.Checked
|
|
23
|
+
};
|
|
24
|
+
case "SAME_TAB":
|
|
25
|
+
return {
|
|
26
|
+
...e,
|
|
27
|
+
newTab: r.Unchecked
|
|
28
|
+
};
|
|
29
|
+
case "URL":
|
|
30
|
+
case "TEXT":
|
|
31
|
+
case "BUTTON_STYLE":
|
|
32
|
+
case "INIT":
|
|
33
|
+
return {
|
|
34
|
+
...e,
|
|
35
|
+
...l
|
|
36
|
+
};
|
|
37
|
+
default:
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
}, N);
|
|
41
|
+
return [n, o];
|
|
42
|
+
}, F = () => {
|
|
43
|
+
const n = b(), [o, e] = k();
|
|
44
|
+
d.useEffect(() => {
|
|
45
|
+
const t = x(n);
|
|
46
|
+
e({
|
|
47
|
+
type: "INIT",
|
|
48
|
+
payload: {
|
|
49
|
+
text: u.text(),
|
|
50
|
+
buttonStyle: t,
|
|
51
|
+
newTab: u.newTab() ? r.Checked : r.Unchecked,
|
|
52
|
+
url: u.url()
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, [e, n]);
|
|
56
|
+
const s = (t) => {
|
|
57
|
+
e({
|
|
58
|
+
type: "TEXT",
|
|
59
|
+
payload: { text: t }
|
|
60
|
+
});
|
|
61
|
+
}, c = (t) => {
|
|
62
|
+
e({
|
|
63
|
+
type: "BUTTON_STYLE",
|
|
64
|
+
payload: { buttonStyle: t }
|
|
65
|
+
});
|
|
66
|
+
}, l = (t) => {
|
|
67
|
+
e({
|
|
68
|
+
type: "URL",
|
|
69
|
+
payload: { url: t }
|
|
70
|
+
});
|
|
71
|
+
}, m = (t) => {
|
|
72
|
+
e(t ? { type: "NEW_TAB" } : { type: "SAME_TAB" });
|
|
73
|
+
}, y = () => {
|
|
74
|
+
a.hide();
|
|
75
|
+
}, p = (t) => {
|
|
76
|
+
if (!i(o.url) || !T)
|
|
77
|
+
return;
|
|
78
|
+
const S = U(o.url);
|
|
79
|
+
a.text(o.text), a.url(S), a.buttonStyle(o.buttonStyle), a.newTab(o.newTab === r.Checked), B(n) && (t == null || t.preventDefault());
|
|
80
|
+
}, T = o.url !== "" && o.text !== "", { appBridge: f } = h(n, g);
|
|
81
|
+
return E(
|
|
82
|
+
"enter",
|
|
83
|
+
p,
|
|
84
|
+
{
|
|
85
|
+
enableOnFormTags: ["INPUT"]
|
|
86
|
+
},
|
|
87
|
+
[]
|
|
88
|
+
), {
|
|
89
|
+
state: o,
|
|
90
|
+
onTextChange: s,
|
|
91
|
+
onButtonStyleChange: c,
|
|
92
|
+
onUrlChange: l,
|
|
93
|
+
onToggleTab: m,
|
|
94
|
+
onCancel: y,
|
|
95
|
+
onSave: p,
|
|
96
|
+
hasValues: T,
|
|
97
|
+
isValidUrlOrEmpty: i,
|
|
98
|
+
appBridge: f
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
k as InsertModalState,
|
|
103
|
+
F as useInsertModal
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=useInsertModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInsertModal.es.js","sources":["../../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Dispatch, Reducer, useEffect, useReducer } from 'react';\nimport { getPluginOptions, useEditorRef, useHotkeys } from '@udecode/plate';\nimport { InsertModalDispatchType, InsertModalStateProps } from './types';\nimport { floatingButtonActions, floatingButtonSelectors } from '../floatingButtonStore';\nimport { ELEMENT_BUTTON } from '../../../createButtonPlugin';\nimport { submitFloatingButton } from '../../../transforms/submitFloatingButton';\nimport { RichTextButtonStyle } from '../../../types';\nimport { getButtonStyle } from '../../../utils/getButtonStyle';\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport { CheckboxState } from '@frontify/fondue';\nimport { addHttps } from '../../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../LinkPlugin/utils/url';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n buttonStyle: 'primary',\n newTab: CheckboxState.Unchecked,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: CheckboxState.Checked,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: CheckboxState.Unchecked,\n };\n case 'URL':\n case 'TEXT':\n case 'BUTTON_STYLE':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const buttonStyle = getButtonStyle(editor);\n\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingButtonSelectors.text(),\n buttonStyle,\n newTab: floatingButtonSelectors.newTab() ? CheckboxState.Checked : CheckboxState.Unchecked,\n url: floatingButtonSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onButtonStyleChange = (value: RichTextButtonStyle) => {\n dispatch({\n type: 'BUTTON_STYLE',\n payload: { buttonStyle: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingButtonActions.hide();\n };\n\n const onSave = (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n const urlToSave = addHttps(state.url);\n\n floatingButtonActions.text(state.text);\n floatingButtonActions.url(urlToSave);\n floatingButtonActions.buttonStyle(state.buttonStyle);\n floatingButtonActions.newTab(state.newTab === CheckboxState.Checked);\n\n if (submitFloatingButton(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n []\n );\n\n return {\n state,\n onTextChange,\n onButtonStyleChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n hasValues,\n isValidUrlOrEmpty,\n appBridge,\n };\n};\n"],"names":["initialState","CheckboxState","InsertModalState","state","dispatch","useReducer","action","type","payload","useInsertModal","editor","useEditorRef","useEffect","buttonStyle","getButtonStyle","floatingButtonSelectors","onTextChange","value","onButtonStyleChange","onUrlChange","onToggleTab","checked","onCancel","floatingButtonActions","onSave","event","isValidUrlOrEmpty","hasValues","urlToSave","addHttps","submitFloatingButton","appBridge","getPluginOptions","ELEMENT_BUTTON","useHotkeys"],"mappings":";;;;;;;;;AAeA,MAAMA,IAAsC;AAAA,EACxC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQC,EAAc;AAC1B,GAEaC,IAAmB,MAAkE;AAC9F,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAAA,WAAoE,CAACF,GAAOG,MAAW;AACvG,UAAA,EAAE,MAAAC,GAAM,SAAAC,EAAY,IAAAF;AAE1B,YAAQC,GAAM;AAAA,MACV,KAAK;AACM,eAAA;AAAA,UACH,GAAGJ;AAAAA,UACH,QAAQF,EAAc;AAAA,QAAA;AAAA,MAE9B,KAAK;AACM,eAAA;AAAA,UACH,GAAGE;AAAAA,UACH,QAAQF,EAAc;AAAA,QAAA;AAAA,MAE9B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACM,eAAA;AAAA,UACH,GAAGE;AAAAA,UACH,GAAGK;AAAA,QAAA;AAAA,MAEX;AACWL,eAAAA;AAAAA,IACf;AAAA,KACDH,CAAY;AAER,SAAA,CAACG,GAAOC,CAAQ;AAC3B,GAEaK,IAAiB,MAAM;AAChC,QAAMC,IAASC,KACT,CAACR,GAAOC,CAAQ,IAAIF,EAAiB;AAE3CU,EAAAA,EAAAA,UAAU,MAAM;AACN,UAAAC,IAAcC,EAAeJ,CAAM;AAEhC,IAAAN,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,QACL,MAAMW,EAAwB,KAAK;AAAA,QACnC,aAAAF;AAAA,QACA,QAAQE,EAAwB,OAAA,IAAWd,EAAc,UAAUA,EAAc;AAAA,QACjF,KAAKc,EAAwB,IAAI;AAAA,MACrC;AAAA,IAAA,CACH;AAAA,EAAA,GACF,CAACX,GAAUM,CAAM,CAAC;AAEf,QAAAM,IAAe,CAACC,MAAkB;AAC3B,IAAAb,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,MAAMa,EAAM;AAAA,IAAA,CAC1B;AAAA,EAAA,GAGCC,IAAsB,CAACD,MAA+B;AAC/C,IAAAb,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,aAAaa,EAAM;AAAA,IAAA,CACjC;AAAA,EAAA,GAGCE,IAAc,CAACF,MAAkB;AAC1B,IAAAb,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,KAAKa,EAAM;AAAA,IAAA,CACzB;AAAA,EAAA,GAGCG,IAAc,CAACC,MAAqB;AAC5B,IAAAjB,EAAAiB,IAAS,EAAE,MAAM,UAAU,IAAc,EAAE,MAAM,WAAA,CAArB;AAAA,EAAiC,GAGrEC,IAAW,MAAM;AACnB,IAAAC,EAAsB,KAAK;AAAA,EAAA,GAGzBC,IAAS,CAACC,MAAuF;AACnG,QAAI,CAACC,EAAkBvB,EAAM,GAAG,KAAK,CAACwB;AAClC;AAGE,UAAAC,IAAYC,EAAS1B,EAAM,GAAG;AAEd,IAAAoB,EAAA,KAAKpB,EAAM,IAAI,GACrCoB,EAAsB,IAAIK,CAAS,GACbL,EAAA,YAAYpB,EAAM,WAAW,GACnDoB,EAAsB,OAAOpB,EAAM,WAAWF,EAAc,OAAO,GAE/D6B,EAAqBpB,CAAM,MAC3Be,KAAA,QAAAA,EAAO;AAAA,EACX,GAGEE,IAAYxB,EAAM,QAAQ,MAAMA,EAAM,SAAS,IAE/C,EAAE,WAAA4B,EAAc,IAAAC,EAAgDtB,GAAQuB,CAAc;AAE5F,SAAAC;AAAA,IACI;AAAA,IACAV;AAAA,IACA;AAAA,MACI,kBAAkB,CAAC,OAAO;AAAA,IAC9B;AAAA,IACA,CAAC;AAAA,EAAA,GAGE;AAAA,IACH,OAAArB;AAAA,IACA,cAAAa;AAAA,IACA,qBAAAE;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAE;AAAA,IACA,QAAAE;AAAA,IACA,WAAAG;AAAA,IACA,mBAAAD;AAAA,IACA,WAAAK;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
2
|
+
import { createComponentAs as n, createElementAs as e, Button as s, useEditorRef as c, focusEditor as i } from "@udecode/plate";
|
|
3
|
+
import { unwrapButton as u } from "../../transforms/unwrapButton.es.js";
|
|
4
|
+
const m = (o) => {
|
|
5
|
+
const t = c();
|
|
6
|
+
return {
|
|
7
|
+
onClick: r.useCallback(() => {
|
|
8
|
+
u(t), i(t, t.selection ?? void 0);
|
|
9
|
+
}, [t]),
|
|
10
|
+
...o
|
|
11
|
+
};
|
|
12
|
+
}, f = n((o) => {
|
|
13
|
+
const t = m(o);
|
|
14
|
+
return e(s, t);
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
f as UnlinkButton,
|
|
18
|
+
m as useUnlinkButton
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=UnlinkButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnlinkButton.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback } from 'react';\nimport {\n AsProps,\n Button,\n HTMLPropsAs,\n createComponentAs,\n createElementAs,\n focusEditor,\n useEditorRef,\n} from '@udecode/plate';\nimport { unwrapButton } from '../../transforms/index';\n\nexport const useUnlinkButton = (props: HTMLPropsAs<'button'>): HTMLPropsAs<'button'> => {\n const editor = useEditorRef();\n\n return {\n onClick: useCallback(() => {\n unwrapButton(editor);\n focusEditor(editor, editor.selection ?? undefined);\n }, [editor]),\n ...props,\n };\n};\n\nexport const UnlinkButton = createComponentAs<AsProps<'button'>>((props) => {\n const htmlProps = useUnlinkButton(props);\n\n return createElementAs(Button, htmlProps);\n});\n"],"names":["useUnlinkButton","props","editor","useEditorRef","useCallback","unwrapButton","focusEditor","UnlinkButton","createComponentAs","htmlProps","createElementAs","Button"],"mappings":";;;AAca,MAAAA,IAAkB,CAACC,MAAwD;AACpF,QAAMC,IAASC;AAER,SAAA;AAAA,IACH,SAASC,cAAY,MAAM;AACvB,MAAAC,EAAaH,CAAM,GACPI,EAAAJ,GAAQA,EAAO,aAAa,MAAS;AAAA,IAAA,GAClD,CAACA,CAAM,CAAC;AAAA,IACX,GAAGD;AAAA,EAAA;AAEX,GAEaM,IAAeC,EAAqC,CAACP,MAAU;AAClE,QAAAQ,IAAYT,EAAgBC,CAAK;AAEhC,SAAAS,EAAgBC,GAAQF,CAAS;AAC5C,CAAC;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createStore as i } from "@udecode/plate";
|
|
2
|
+
const e = i("floatingButton")({
|
|
3
|
+
openEditorId: null,
|
|
4
|
+
mouseDown: !1,
|
|
5
|
+
updated: !1,
|
|
6
|
+
url: "",
|
|
7
|
+
text: "",
|
|
8
|
+
buttonStyle: "primary",
|
|
9
|
+
newTab: !1,
|
|
10
|
+
mode: "",
|
|
11
|
+
isEditing: !1
|
|
12
|
+
}).extendActions((t) => ({
|
|
13
|
+
reset: () => {
|
|
14
|
+
t.url(""), t.text(""), t.buttonStyle("primary"), t.newTab(!1), t.mode(""), t.isEditing(!1);
|
|
15
|
+
}
|
|
16
|
+
})).extendActions((t) => ({
|
|
17
|
+
show: (o, n) => {
|
|
18
|
+
t.mode(o), t.isEditing(!1), t.openEditorId(n);
|
|
19
|
+
},
|
|
20
|
+
hide: () => {
|
|
21
|
+
t.reset(), t.openEditorId(null);
|
|
22
|
+
}
|
|
23
|
+
})).extendSelectors((t) => ({
|
|
24
|
+
isOpen: (o) => t.openEditorId === o
|
|
25
|
+
})), r = e.set, d = e.get, s = () => e.use;
|
|
26
|
+
export {
|
|
27
|
+
r as floatingButtonActions,
|
|
28
|
+
d as floatingButtonSelectors,
|
|
29
|
+
e as floatingButtonStore,
|
|
30
|
+
s as useFloatingButtonSelectors
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=floatingButtonStore.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floatingButtonStore.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createStore } from '@udecode/plate';\nimport { RichTextButtonStyle } from '../../types';\n\nexport type FloatingButtonMode = '' | 'insert' | 'edit';\n\nexport const floatingButtonStore: any = createStore('floatingButton')({\n openEditorId: null as null | string,\n mouseDown: false,\n updated: false,\n url: '',\n text: '',\n buttonStyle: 'primary' as RichTextButtonStyle,\n newTab: false,\n mode: '' as FloatingButtonMode,\n isEditing: false,\n})\n .extendActions((set) => ({\n reset: () => {\n set.url('');\n set.text('');\n set.buttonStyle('primary');\n set.newTab(false);\n set.mode('');\n set.isEditing(false);\n },\n }))\n .extendActions((set) => ({\n show: (mode: FloatingButtonMode, editorId: string) => {\n set.mode(mode);\n set.isEditing(false);\n set.openEditorId(editorId);\n },\n hide: () => {\n set.reset();\n set.openEditorId(null);\n },\n }))\n .extendSelectors((state) => ({\n isOpen: (editorId: string) => state.openEditorId === editorId,\n }));\n\nexport const floatingButtonActions = floatingButtonStore.set;\nexport const floatingButtonSelectors = floatingButtonStore.get;\nexport const useFloatingButtonSelectors = () => floatingButtonStore.use;\n"],"names":["floatingButtonStore","createStore","set","mode","editorId","state","floatingButtonActions","floatingButtonSelectors","useFloatingButtonSelectors"],"mappings":";AAOa,MAAAA,IAA2BC,EAAY,gBAAgB,EAAE;AAAA,EAClE,cAAc;AAAA,EACd,WAAW;AAAA,EACX,SAAS;AAAA,EACT,KAAK;AAAA,EACL,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AACf,CAAC,EACI,cAAc,CAACC,OAAS;AAAA,EACrB,OAAO,MAAM;AACT,IAAAA,EAAI,IAAI,EAAE,GACVA,EAAI,KAAK,EAAE,GACXA,EAAI,YAAY,SAAS,GACzBA,EAAI,OAAO,EAAK,GAChBA,EAAI,KAAK,EAAE,GACXA,EAAI,UAAU,EAAK;AAAA,EACvB;AACJ,EAAE,EACD,cAAc,CAACA,OAAS;AAAA,EACrB,MAAM,CAACC,GAA0BC,MAAqB;AAClD,IAAAF,EAAI,KAAKC,CAAI,GACbD,EAAI,UAAU,EAAK,GACnBA,EAAI,aAAaE,CAAQ;AAAA,EAC7B;AAAA,EACA,MAAM,MAAM;AACR,IAAAF,EAAI,MAAM,GACVA,EAAI,aAAa,IAAI;AAAA,EACzB;AACJ,EAAE,EACD,gBAAgB,CAACG,OAAW;AAAA,EACzB,QAAQ,CAACD,MAAqBC,EAAM,iBAAiBD;AACzD,EAAE,GAEOE,IAAwBN,EAAoB,KAC5CO,IAA0BP,EAAoB,KAC9CQ,IAA6B,MAAMR,EAAoB;"}
|