@frontify/guideline-blocks-settings 0.33.4 → 0.34.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.
- package/dist/components/Attachments/AttachmentItem.es.js +174 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +160 -0
- package/dist/components/Attachments/Attachments.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +29 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.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 +71 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +33 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +28 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +35 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +44 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +25 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js +29 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +22 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +12 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +20 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +6 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +11 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.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/Link/LinkInput.es.js +63 -0
- package/dist/components/Link/LinkInput.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +60 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +86 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js +70 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js +38 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js +25 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/Link/utils/getUrl.es.js +18 -0
- package/dist/components/Link/utils/getUrl.es.js.map +1 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/Link/utils/url.es.js +17 -0
- package/dist/components/Link/utils/url.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 +20 -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 +35 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +41 -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 +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +26 -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 +28 -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 +48 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.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 +104 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.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 +57 -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 +41 -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 +67 -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 +81 -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 +52 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +32 -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 +35 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.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 +66 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +79 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +22 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.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 +45 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +51 -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 +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +167 -0
- package/dist/components/RichTextEditor/plugins/styles.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 +28 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +53 -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 +4 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1190 -0
- package/dist/index.es.js +217 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +4 -0
- package/dist/index.umd.js.map +1 -0
- 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/styles.css +1 -0
- package/dist/styles.css.es.js +2 -0
- package/dist/styles.css.es.js.map +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 +9 -6
- package/.eslintrc.cjs +0 -27
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -787
- package/postcss.config.cjs +0 -8
- package/setupTests.ts +0 -23
- package/src/components/Attachments/AttachmentItem.tsx +0 -247
- package/src/components/Attachments/Attachments.spec.ct.tsx +0 -165
- package/src/components/Attachments/Attachments.tsx +0 -241
- package/src/components/Attachments/AttachmentsButtonTrigger.tsx +0 -30
- package/src/components/Attachments/index.ts +0 -4
- package/src/components/Attachments/types.ts +0 -40
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +0 -48
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +0 -212
- package/src/components/BlockInjectButton/index.ts +0 -4
- package/src/components/BlockInjectButton/types.ts +0 -18
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +0 -145
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +0 -76
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +0 -96
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +0 -42
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +0 -44
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +0 -24
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +0 -37
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +0 -89
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +0 -140
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +0 -61
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +0 -77
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +0 -30
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +0 -63
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +0 -259
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +0 -36
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +0 -70
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +0 -19
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx +0 -9
- package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +0 -15
- package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/context/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/helpers.ts +0 -33
- package/src/components/BlockItemWrapper/Toolbar/hooks/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +0 -59
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +0 -24
- package/src/components/BlockItemWrapper/Toolbar/index.ts +0 -10
- package/src/components/BlockItemWrapper/Toolbar/types.ts +0 -18
- package/src/components/BlockItemWrapper/constants.ts +0 -4
- package/src/components/BlockItemWrapper/index.ts +0 -6
- package/src/components/BlockItemWrapper/types.ts +0 -24
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +0 -20
- package/src/components/DownloadButton/DownloadButton.tsx +0 -36
- package/src/components/DownloadButton/index.ts +0 -3
- package/src/components/DownloadButton/types.ts +0 -5
- package/src/components/Link/LinkInput.spec.ct.tsx +0 -142
- package/src/components/Link/LinkInput.tsx +0 -86
- package/src/components/Link/LinkSelector/DocumentLink.tsx +0 -81
- package/src/components/Link/LinkSelector/DocumentLinks.tsx +0 -102
- package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +0 -196
- package/src/components/Link/LinkSelector/LinkSelector.tsx +0 -96
- package/src/components/Link/LinkSelector/LoadingIndicator.tsx +0 -11
- package/src/components/Link/LinkSelector/PageLink.tsx +0 -96
- package/src/components/Link/LinkSelector/PageLinks.tsx +0 -71
- package/src/components/Link/LinkSelector/SectionLink.tsx +0 -36
- package/src/components/Link/LinkSelector/index.ts +0 -3
- package/src/components/Link/index.ts +0 -6
- package/src/components/Link/types.ts +0 -6
- package/src/components/Link/utils/getUrl.ts +0 -30
- package/src/components/Link/utils/index.ts +0 -5
- package/src/components/Link/utils/relativeUrlRegex.spec.ts +0 -32
- package/src/components/Link/utils/relativeUrlRegex.ts +0 -3
- package/src/components/Link/utils/url.spec.ts +0 -75
- package/src/components/Link/utils/url.ts +0 -21
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +0 -231
- package/src/components/RichTextEditor/RichTextEditor.tsx +0 -62
- package/src/components/RichTextEditor/SerializedText.tsx +0 -29
- package/src/components/RichTextEditor/constants.ts +0 -3
- package/src/components/RichTextEditor/index.ts +0 -6
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +0 -55
- package/src/components/RichTextEditor/pluginPresets/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +0 -74
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +0 -20
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +0 -56
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +0 -19
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +0 -42
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +0 -37
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +0 -81
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +0 -143
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +0 -31
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +0 -46
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +0 -12
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +0 -21
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +0 -71
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +0 -118
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +0 -7
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +0 -17
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +0 -68
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +0 -198
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +0 -28
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +0 -14
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +0 -18
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +0 -83
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +0 -23
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +0 -45
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +0 -106
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +0 -26
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +0 -43
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +0 -45
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +0 -5
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +0 -88
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +0 -73
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +0 -136
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +0 -38
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +0 -36
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +0 -3
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +0 -49
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +0 -12
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +0 -44
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +0 -15
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +0 -58
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/index.ts +0 -6
- package/src/components/RichTextEditor/plugins/styles.ts +0 -178
- package/src/components/RichTextEditor/types.ts +0 -23
- package/src/components/index.ts +0 -8
- package/src/helpers/addHttps.spec.ts +0 -42
- package/src/helpers/addHttps.ts +0 -15
- package/src/helpers/convertToRichTextValue.spec.ts +0 -32
- package/src/helpers/convertToRichTextValue.ts +0 -6
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +0 -69
- package/src/helpers/customCoordinatesGetterFactory.ts +0 -39
- package/src/helpers/hasRichTextValue.spec.ts +0 -63
- package/src/helpers/hasRichTextValue.ts +0 -29
- package/src/helpers/index.ts +0 -8
- package/src/helpers/isDownloadable.spec.ts +0 -47
- package/src/helpers/isDownloadable.ts +0 -7
- package/src/helpers/mapColorPalettes.spec.ts +0 -47
- package/src/helpers/mapColorPalettes.ts +0 -65
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useAttachments.spec.tsx +0 -127
- package/src/hooks/useAttachments.tsx +0 -90
- package/src/hooks/useDndSensors.spec.ts +0 -40
- package/src/hooks/useDndSensors.ts +0 -23
- package/src/index.ts +0 -138
- package/src/settings/background.spec.ts +0 -173
- package/src/settings/background.ts +0 -52
- package/src/settings/border.spec.ts +0 -76
- package/src/settings/border.ts +0 -90
- package/src/settings/borderRadius.spec.ts +0 -30
- package/src/settings/borderRadius.ts +0 -73
- package/src/settings/borderRadiusExtended.spec.ts +0 -52
- package/src/settings/borderRadiusExtended.ts +0 -84
- package/src/settings/defaultValues.ts +0 -21
- package/src/settings/gutter.spec.ts +0 -60
- package/src/settings/gutter.ts +0 -75
- package/src/settings/index.ts +0 -14
- package/src/settings/margin.spec.ts +0 -42
- package/src/settings/margin.ts +0 -72
- package/src/settings/marginExtended.spec.ts +0 -45
- package/src/settings/marginExtended.ts +0 -91
- package/src/settings/padding.spec.ts +0 -42
- package/src/settings/padding.ts +0 -73
- package/src/settings/paddingExtended.spec.ts +0 -45
- package/src/settings/paddingExtended.ts +0 -91
- package/src/settings/security.spec.ts +0 -87
- package/src/settings/security.ts +0 -61
- package/src/settings/securityDownloadable.spec.ts +0 -46
- package/src/settings/securityDownloadable.ts +0 -33
- package/src/settings/securityGlobalControl.ts +0 -42
- package/src/settings/types.ts +0 -128
- package/src/styles.css +0 -3
- package/src/utilities/color/getReadableColor.spec.ts +0 -32
- package/src/utilities/color/getReadableColor.ts +0 -34
- package/src/utilities/color/index.ts +0 -10
- package/src/utilities/color/isDark.spec.ts +0 -33
- package/src/utilities/color/isDark.ts +0 -29
- package/src/utilities/color/setAlpha.spec.ts +0 -28
- package/src/utilities/color/setAlpha.ts +0 -14
- package/src/utilities/color/toColorObject.spec.ts +0 -19
- package/src/utilities/color/toColorObject.ts +0 -16
- package/src/utilities/color/toHex8String.spec.ts +0 -17
- package/src/utilities/color/toHex8String.ts +0 -14
- package/src/utilities/color/toHexString.spec.ts +0 -17
- package/src/utilities/color/toHexString.ts +0 -10
- package/src/utilities/color/toRgbaString.spec.ts +0 -12
- package/src/utilities/color/toRgbaString.ts +0 -14
- package/src/utilities/color/toShortRgba.spec.ts +0 -16
- package/src/utilities/color/toShortRgba.ts +0 -35
- package/src/utilities/index.ts +0 -5
- package/src/utilities/moveItemInArray.spec.ts +0 -17
- package/src/utilities/moveItemInArray.ts +0 -21
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +0 -18
- package/src/utilities/react/getBackgroundColorStyles.ts +0 -10
- package/src/utilities/react/getBorderStyles.spec.ts +0 -39
- package/src/utilities/react/getBorderStyles.ts +0 -20
- package/src/utilities/react/getRadiusStyles.spec.ts +0 -25
- package/src/utilities/react/getRadiusStyles.ts +0 -8
- package/src/utilities/react/index.ts +0 -6
- package/src/utilities/react/joinClassNames.spec.ts +0 -18
- package/src/utilities/react/joinClassNames.ts +0 -10
- package/tailwind.config.ts +0 -27
- package/tsconfig.json +0 -24
- package/tsconfig.node.json +0 -12
- package/vite.config.ts +0 -71
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { relativeUrlRegex } from './relativeUrlRegex';
|
|
5
|
-
|
|
6
|
-
describe('Regex values', () => {
|
|
7
|
-
it.each([
|
|
8
|
-
{
|
|
9
|
-
input: '/document/123',
|
|
10
|
-
shouldMatch: true,
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
input: '/r/123',
|
|
14
|
-
shouldMatch: true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
input: '/wrong/123',
|
|
18
|
-
shouldMatch: false,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
input: '/r/',
|
|
22
|
-
shouldMatch: false,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
input: '/document/',
|
|
26
|
-
shouldMatch: false,
|
|
27
|
-
},
|
|
28
|
-
])('should only match internal documents starting with /r/ or /document/', ({ input, shouldMatch }) => {
|
|
29
|
-
const isMatching = relativeUrlRegex.test(input);
|
|
30
|
-
expect(isMatching).toBe(shouldMatch);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { isValidUrl } from './url';
|
|
5
|
-
|
|
6
|
-
describe('LinkPlugin URL utils', () => {
|
|
7
|
-
it('should validate isValidUrl', () => {
|
|
8
|
-
const testData = [
|
|
9
|
-
{
|
|
10
|
-
input: 'https://frontify.com',
|
|
11
|
-
shouldBeValid: true,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
input: 'http://frontify.com',
|
|
15
|
-
shouldBeValid: true,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
input: 'http://frontify.com/any/path',
|
|
19
|
-
shouldBeValid: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
input: 'https://product.frontify.com/any/path/with#3/',
|
|
23
|
-
shouldBeValid: true,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
input: 'mailto:hello@frontify.com',
|
|
27
|
-
shouldBeValid: true,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
input: 'tel:+123456789',
|
|
31
|
-
shouldBeValid: true,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
input: 'tel:',
|
|
35
|
-
shouldBeValid: false,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
input: 'anyword:',
|
|
39
|
-
shouldBeValid: false,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
input: '/r/123',
|
|
43
|
-
shouldBeValid: true,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
input: '/document/123',
|
|
47
|
-
shouldBeValid: true,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
input: '/wrongpage/123',
|
|
51
|
-
shouldBeValid: false,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
input: '+123456789',
|
|
55
|
-
shouldBeValid: false,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
input: 'hello@frontify.com',
|
|
59
|
-
shouldBeValid: false,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
input: 'frontify.com',
|
|
63
|
-
shouldBeValid: false,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
input: 'frontify',
|
|
67
|
-
shouldBeValid: false,
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
for (const data of testData) {
|
|
71
|
-
const isValid = isValidUrl(data.input);
|
|
72
|
-
expect(isValid).toBe(data.shouldBeValid);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { addHttps } from '../../../helpers';
|
|
4
|
-
import { relativeUrlRegex } from './relativeUrlRegex';
|
|
5
|
-
|
|
6
|
-
export const isValidUrl = (url: string) => {
|
|
7
|
-
if (relativeUrlRegex.test(url)) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
const parsedUrl = new URL(url);
|
|
12
|
-
const validProtocols = ['http:', 'https:', 'mailto:', 'tel:'];
|
|
13
|
-
return validProtocols.includes(parsedUrl.protocol) && parsedUrl.pathname !== '';
|
|
14
|
-
} catch (error) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const isValidUrlOrEmpty = (url: string): boolean => {
|
|
20
|
-
return isValidUrl(addHttps(url)) || url === '';
|
|
21
|
-
};
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { DocumentApiDummy, getAppBridgeBlockStub } from '@frontify/app-bridge';
|
|
4
|
-
import { PluginComposer } from '@frontify/fondue';
|
|
5
|
-
import { mount } from 'cypress/react18';
|
|
6
|
-
import type { SinonStub } from 'sinon';
|
|
7
|
-
import { ButtonPlugin, LinkPlugin, RichTextEditor, TextStyles } from '.';
|
|
8
|
-
import { convertToRteValue } from '../../helpers';
|
|
9
|
-
|
|
10
|
-
const RteHtmlSelector = '[data-test-id="rte-content-html"]';
|
|
11
|
-
const RichTextSelector = '[data-test-id="rich-text-editor"]';
|
|
12
|
-
const ButtonSelector = '[data-test-id="button"]';
|
|
13
|
-
const CheckboxSelector = '[data-test-id="checkbox-icon-box"]';
|
|
14
|
-
const ToolbarButtonSelector = '[data-testid="ToolbarButton"]';
|
|
15
|
-
const InternalDocumentLinkSelector = '[data-test-id="internal-link-selector-document-link"]';
|
|
16
|
-
const FloatingLinkModalSelector = '[data-test-id="floating-link-insert"]';
|
|
17
|
-
const FloatingButtonModalSelector = '[data-test-id="floating-button-insert"]';
|
|
18
|
-
const UrlInputSelector = 'input[id="url"]';
|
|
19
|
-
|
|
20
|
-
const apiDocuments = [{ ...DocumentApiDummy.with(1), permanentLink: '/r/document' }];
|
|
21
|
-
|
|
22
|
-
const appBridge = getAppBridgeBlockStub({
|
|
23
|
-
blockId: 1,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('RichTextEditor', () => {
|
|
27
|
-
it('should render a rich text editor in edit mode', () => {
|
|
28
|
-
mount(<RichTextEditor isEditing />);
|
|
29
|
-
cy.get(RichTextSelector).should('exist');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should render a rich text html in view mode', () => {
|
|
33
|
-
mount(<RichTextEditor isEditing={false} value="test" />);
|
|
34
|
-
cy.get(RteHtmlSelector).should('exist');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should render a json value in view mode', () => {
|
|
38
|
-
mount(<RichTextEditor isEditing={false} value={convertToRteValue(TextStyles.heading1, 'Test Heading')} />);
|
|
39
|
-
cy.get(RteHtmlSelector).should('exist');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should render a html value in view mode', () => {
|
|
43
|
-
mount(<RichTextEditor isEditing={false} value="<p>Test Paragraph</p>" />);
|
|
44
|
-
cy.get(RteHtmlSelector).should('exist');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should not render html output if value is empty', () => {
|
|
48
|
-
mount(<RichTextEditor isEditing={false} value="" />);
|
|
49
|
-
cy.get(RteHtmlSelector).should('not.exist');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should not render html output if value is undefined', () => {
|
|
53
|
-
mount(<RichTextEditor isEditing={false} />);
|
|
54
|
-
cy.get(RteHtmlSelector).should('not.exist');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should be able to select internal link', () => {
|
|
58
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
59
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
60
|
-
|
|
61
|
-
mount(
|
|
62
|
-
<RichTextEditor
|
|
63
|
-
isEditing={true}
|
|
64
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
65
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
66
|
-
/>,
|
|
67
|
-
);
|
|
68
|
-
cy.get(RichTextSelector).click();
|
|
69
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
70
|
-
cy.get(ToolbarButtonSelector).click();
|
|
71
|
-
cy.get(ButtonSelector).first().click();
|
|
72
|
-
cy.get(InternalDocumentLinkSelector).click();
|
|
73
|
-
cy.get(ButtonSelector).last().click();
|
|
74
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
75
|
-
const linkTag = cy.get(RichTextSelector).find('a[href="/r/document"]');
|
|
76
|
-
linkTag.should('exist');
|
|
77
|
-
linkTag.should('have.attr', 'target', '_self');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should be able to select internal link with target blank', () => {
|
|
81
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
82
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
83
|
-
|
|
84
|
-
mount(
|
|
85
|
-
<RichTextEditor
|
|
86
|
-
isEditing={true}
|
|
87
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
88
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
89
|
-
/>,
|
|
90
|
-
);
|
|
91
|
-
cy.get(RichTextSelector).click();
|
|
92
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
93
|
-
cy.get(ToolbarButtonSelector).click();
|
|
94
|
-
cy.get(ButtonSelector).first().click();
|
|
95
|
-
cy.get(InternalDocumentLinkSelector).click();
|
|
96
|
-
cy.get(ButtonSelector).last().click();
|
|
97
|
-
cy.get(CheckboxSelector).click();
|
|
98
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
99
|
-
const linkTag = cy.get(RichTextSelector).find('a[href="/r/document"]');
|
|
100
|
-
linkTag.should('exist');
|
|
101
|
-
linkTag.should('have.attr', 'target', '_blank');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('should prepend the URL with https:// if not exists', () => {
|
|
105
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
106
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
107
|
-
|
|
108
|
-
mount(
|
|
109
|
-
<RichTextEditor
|
|
110
|
-
isEditing={true}
|
|
111
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
112
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
113
|
-
/>,
|
|
114
|
-
);
|
|
115
|
-
cy.get(RichTextSelector).click();
|
|
116
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
117
|
-
cy.get(ToolbarButtonSelector).click();
|
|
118
|
-
cy.get(UrlInputSelector).type('frontify.com');
|
|
119
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
120
|
-
cy.get(RichTextSelector).find('a[href="https://frontify.com"]').should('exist');
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should allow URLs that start with /document/', () => {
|
|
124
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
125
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
126
|
-
|
|
127
|
-
mount(
|
|
128
|
-
<RichTextEditor
|
|
129
|
-
isEditing={true}
|
|
130
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
131
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
132
|
-
/>,
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
cy.get(RichTextSelector).click();
|
|
136
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
137
|
-
cy.get(ToolbarButtonSelector).click();
|
|
138
|
-
cy.get(UrlInputSelector).type('/document/test');
|
|
139
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
140
|
-
cy.get(RichTextSelector).find('a[href="/document/test"]').should('exist');
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('should not add https:// to the URL for mailto: links', () => {
|
|
144
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
145
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
146
|
-
|
|
147
|
-
mount(
|
|
148
|
-
<RichTextEditor
|
|
149
|
-
isEditing={true}
|
|
150
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
151
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
152
|
-
/>,
|
|
153
|
-
);
|
|
154
|
-
cy.get(RichTextSelector).click();
|
|
155
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
156
|
-
cy.get(ToolbarButtonSelector).click();
|
|
157
|
-
cy.get(UrlInputSelector).type('mailto:info@frontify.com');
|
|
158
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
159
|
-
cy.get(RichTextSelector).find('a[href="mailto:info@frontify.com"]').should('exist');
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('should create a link with a link typed in the RTE', () => {
|
|
163
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
164
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
165
|
-
|
|
166
|
-
mount(
|
|
167
|
-
<RichTextEditor
|
|
168
|
-
isEditing={true}
|
|
169
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
170
|
-
/>,
|
|
171
|
-
);
|
|
172
|
-
cy.get(RichTextSelector).click();
|
|
173
|
-
cy.get(RichTextSelector).type('mailto:info@frontify.com {enter}');
|
|
174
|
-
cy.get(RichTextSelector).find('a[href="mailto:info@frontify.com"]').should('exist');
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('should not create a link with a : after a word', () => {
|
|
178
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
179
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
180
|
-
|
|
181
|
-
mount(
|
|
182
|
-
<RichTextEditor
|
|
183
|
-
isEditing={true}
|
|
184
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
185
|
-
/>,
|
|
186
|
-
);
|
|
187
|
-
cy.get(RichTextSelector).click();
|
|
188
|
-
cy.get(RichTextSelector).type('list:{enter}');
|
|
189
|
-
cy.get(RichTextSelector).find('a').should('not.exist');
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it('should allow URLs that start with /document/', () => {
|
|
193
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
194
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
195
|
-
|
|
196
|
-
mount(
|
|
197
|
-
<RichTextEditor
|
|
198
|
-
isEditing={true}
|
|
199
|
-
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
200
|
-
value={convertToRteValue('p', 'This is a link')}
|
|
201
|
-
/>,
|
|
202
|
-
);
|
|
203
|
-
cy.get(RichTextSelector).click();
|
|
204
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
205
|
-
cy.get(ToolbarButtonSelector).click();
|
|
206
|
-
cy.get(UrlInputSelector).type('/document/test');
|
|
207
|
-
cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
|
|
208
|
-
cy.get(RichTextSelector).find('a[href="/document/test"]').should('exist');
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('should be able to select internal button link', () => {
|
|
212
|
-
(appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
|
|
213
|
-
(appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
|
|
214
|
-
|
|
215
|
-
mount(
|
|
216
|
-
<RichTextEditor
|
|
217
|
-
isEditing={true}
|
|
218
|
-
plugins={new PluginComposer().setPlugin([new ButtonPlugin({ appBridge })])}
|
|
219
|
-
value={convertToRteValue('p', 'This is a button')}
|
|
220
|
-
/>,
|
|
221
|
-
);
|
|
222
|
-
cy.get(RichTextSelector).click();
|
|
223
|
-
cy.get(RichTextSelector).type('{selectall}');
|
|
224
|
-
cy.get(ToolbarButtonSelector).click();
|
|
225
|
-
cy.get(ButtonSelector).first().click();
|
|
226
|
-
cy.get(InternalDocumentLinkSelector).click();
|
|
227
|
-
cy.get(ButtonSelector).last().click();
|
|
228
|
-
cy.get(FloatingButtonModalSelector).find(ButtonSelector).last().click();
|
|
229
|
-
cy.get(RichTextSelector).find('a[href="/r/document"]').should('exist');
|
|
230
|
-
});
|
|
231
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
|
|
5
|
-
import { RichTextEditor as FondueRichTextEditor } from '@frontify/fondue';
|
|
6
|
-
import { RichTextEditorProps } from './types';
|
|
7
|
-
import { SerializedText } from './SerializedText';
|
|
8
|
-
import { floatingButtonActions, floatingButtonSelectors } from './plugins/ButtonPlugin/components';
|
|
9
|
-
|
|
10
|
-
export const RichTextEditor = ({
|
|
11
|
-
id = 'rte',
|
|
12
|
-
isEditing,
|
|
13
|
-
value,
|
|
14
|
-
columns,
|
|
15
|
-
gap,
|
|
16
|
-
placeholder,
|
|
17
|
-
plugins,
|
|
18
|
-
onTextChange,
|
|
19
|
-
showSerializedText,
|
|
20
|
-
}: RichTextEditorProps) => {
|
|
21
|
-
const [shouldPreventPageLeave, setShouldPreventPageLeave] = useState(false);
|
|
22
|
-
|
|
23
|
-
const saveText = (newContent: string) => {
|
|
24
|
-
if (onTextChange && newContent !== value) {
|
|
25
|
-
onTextChange(newContent);
|
|
26
|
-
}
|
|
27
|
-
setShouldPreventPageLeave(false);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const unloadHandler = (event: BeforeUnloadEvent) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
return (event.returnValue = 'Unprocessed changes');
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (shouldPreventPageLeave) {
|
|
37
|
-
window.addEventListener('beforeunload', unloadHandler);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return () => window.removeEventListener('beforeunload', unloadHandler);
|
|
41
|
-
}, [shouldPreventPageLeave]);
|
|
42
|
-
|
|
43
|
-
if (isEditing) {
|
|
44
|
-
return (
|
|
45
|
-
<FondueRichTextEditor
|
|
46
|
-
id={id}
|
|
47
|
-
value={value}
|
|
48
|
-
border={false}
|
|
49
|
-
placeholder={placeholder}
|
|
50
|
-
plugins={plugins}
|
|
51
|
-
onValueChanged={() => setShouldPreventPageLeave(true)}
|
|
52
|
-
onTextChange={saveText}
|
|
53
|
-
hideExternalFloatingModals={(editorId: string) => {
|
|
54
|
-
if (floatingButtonSelectors.isOpen(editorId)) {
|
|
55
|
-
floatingButtonActions.reset();
|
|
56
|
-
}
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
return <SerializedText value={value} columns={columns} gap={gap} show={showSerializedText} plugins={plugins} />;
|
|
62
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { serializeRawToHtmlAsync } from '@frontify/fondue';
|
|
5
|
-
import { SerializedTextProps } from './types';
|
|
6
|
-
|
|
7
|
-
export const SerializedText = ({ value = '', gap, columns, show = true, plugins }: SerializedTextProps) => {
|
|
8
|
-
const [html, setHtml] = useState<string | null>(null);
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
(async () => {
|
|
12
|
-
setHtml(await serializeRawToHtmlAsync(value, plugins, columns, gap));
|
|
13
|
-
})();
|
|
14
|
-
}, [value, columns, gap, plugins]);
|
|
15
|
-
|
|
16
|
-
if (!show || html === '<br />') {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return html !== null ? (
|
|
21
|
-
<div
|
|
22
|
-
className="tw-w-full tw-whitespace-pre-wrap"
|
|
23
|
-
data-test-id="rte-content-html"
|
|
24
|
-
dangerouslySetInnerHTML={{ __html: html }}
|
|
25
|
-
/>
|
|
26
|
-
) : (
|
|
27
|
-
<div className="tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full" />
|
|
28
|
-
);
|
|
29
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
4
|
-
import {
|
|
5
|
-
AlignCenterPlugin,
|
|
6
|
-
AlignJustifyPlugin,
|
|
7
|
-
AlignLeftPlugin,
|
|
8
|
-
AlignRightPlugin,
|
|
9
|
-
AutoformatPlugin,
|
|
10
|
-
BoldPlugin,
|
|
11
|
-
CheckboxListPlugin,
|
|
12
|
-
CodePlugin,
|
|
13
|
-
ItalicPlugin,
|
|
14
|
-
OrderedListPlugin,
|
|
15
|
-
PluginComposer,
|
|
16
|
-
ResetFormattingPlugin,
|
|
17
|
-
SoftBreakPlugin,
|
|
18
|
-
StrikethroughPlugin,
|
|
19
|
-
TextStylePlugin,
|
|
20
|
-
UnderlinePlugin,
|
|
21
|
-
UnorderedListPlugin,
|
|
22
|
-
} from '@frontify/fondue';
|
|
23
|
-
import { ButtonPlugin, LinkPlugin, TextStylePluginsWithoutImage, TextStylesWithoutImage } from '../plugins';
|
|
24
|
-
|
|
25
|
-
export const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {
|
|
26
|
-
return new PluginComposer()
|
|
27
|
-
.setPlugin(
|
|
28
|
-
new SoftBreakPlugin(),
|
|
29
|
-
new TextStylePlugin({
|
|
30
|
-
textStyles: TextStylePluginsWithoutImage,
|
|
31
|
-
}),
|
|
32
|
-
)
|
|
33
|
-
.setPlugin(
|
|
34
|
-
[
|
|
35
|
-
new BoldPlugin(),
|
|
36
|
-
new ItalicPlugin(),
|
|
37
|
-
new UnderlinePlugin(),
|
|
38
|
-
new StrikethroughPlugin(),
|
|
39
|
-
new LinkPlugin({ appBridge }),
|
|
40
|
-
new ButtonPlugin({ appBridge }),
|
|
41
|
-
new CodePlugin(),
|
|
42
|
-
],
|
|
43
|
-
[
|
|
44
|
-
new AlignLeftPlugin({ validTypes: TextStylesWithoutImage }),
|
|
45
|
-
new AlignCenterPlugin({ validTypes: TextStylesWithoutImage }),
|
|
46
|
-
new AlignRightPlugin({ validTypes: TextStylesWithoutImage }),
|
|
47
|
-
new AlignJustifyPlugin({ validTypes: TextStylesWithoutImage }),
|
|
48
|
-
new UnorderedListPlugin(),
|
|
49
|
-
new CheckboxListPlugin(),
|
|
50
|
-
new OrderedListPlugin(),
|
|
51
|
-
new ResetFormattingPlugin(),
|
|
52
|
-
new AutoformatPlugin(),
|
|
53
|
-
],
|
|
54
|
-
);
|
|
55
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { HTMLPropsAs, PlateRenderElementProps, Value, useElementProps } from '@udecode/plate';
|
|
4
|
-
import { CSSProperties, HTMLAttributeAnchorTarget, ReactElement, ReactNode, useState } from 'react';
|
|
5
|
-
import { RichTextButtonStyle, TButtonElement } from '../types';
|
|
6
|
-
import { BlockButtonStyles } from '../utils';
|
|
7
|
-
|
|
8
|
-
export type ButtonRootProps = PlateRenderElementProps<Value, TButtonElement> & HTMLPropsAs<'a'>;
|
|
9
|
-
|
|
10
|
-
const useButton = (props: ButtonRootProps): HTMLPropsAs<'a'> & { buttonStyle: RichTextButtonStyle } => {
|
|
11
|
-
const _props = useElementProps<TButtonElement, 'a'>({
|
|
12
|
-
...props,
|
|
13
|
-
elementToAttributes: (element) => ({
|
|
14
|
-
url: element.href,
|
|
15
|
-
buttonStyle: element.buttonStyle || 'primary',
|
|
16
|
-
target: element.target || '_blank',
|
|
17
|
-
}),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
...(_props as HTMLPropsAs<'a'> & { buttonStyle: RichTextButtonStyle }),
|
|
22
|
-
// quick fix: hovering <a> with href loses the editor focus
|
|
23
|
-
onMouseOver: (e) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const ButtonMarkupElementNode = (props: ButtonRootProps) => {
|
|
30
|
-
const { href, target, buttonStyle } = useButton(props);
|
|
31
|
-
const { attributes, children } = props;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<HoverableButtonLink
|
|
35
|
-
attributes={attributes}
|
|
36
|
-
href={href}
|
|
37
|
-
target={target}
|
|
38
|
-
styles={BlockButtonStyles[`button${buttonStyle.charAt(0).toUpperCase() + buttonStyle.slice(1)}`]}
|
|
39
|
-
>
|
|
40
|
-
{children}
|
|
41
|
-
</HoverableButtonLink>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type Props = {
|
|
46
|
-
attributes: ButtonRootProps['attributes'];
|
|
47
|
-
children: ReactNode;
|
|
48
|
-
styles?: CSSProperties & { hover?: CSSProperties };
|
|
49
|
-
href?: string;
|
|
50
|
-
target?: HTMLAttributeAnchorTarget;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const HoverableButtonLink = ({
|
|
54
|
-
attributes,
|
|
55
|
-
styles = { hover: {} },
|
|
56
|
-
children,
|
|
57
|
-
href = '#',
|
|
58
|
-
target,
|
|
59
|
-
}: Props): ReactElement => {
|
|
60
|
-
const [hovered, setHovered] = useState(false);
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<a
|
|
64
|
-
{...attributes}
|
|
65
|
-
onMouseEnter={() => setHovered(true)}
|
|
66
|
-
onMouseLeave={() => setHovered(false)}
|
|
67
|
-
href={href}
|
|
68
|
-
target={target}
|
|
69
|
-
style={hovered ? { ...styles, ...styles.hover } : styles}
|
|
70
|
-
>
|
|
71
|
-
{children}
|
|
72
|
-
</a>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { MarkupElement } from '@frontify/fondue';
|
|
4
|
-
import { ELEMENT_BUTTON } from '../createButtonPlugin';
|
|
5
|
-
import { ButtonMarkupElementNode } from './ButtonMarkupElementNode';
|
|
6
|
-
|
|
7
|
-
export class ButtonMarkupElement extends MarkupElement {
|
|
8
|
-
constructor(id = ELEMENT_BUTTON, node = ButtonMarkupElementNode) {
|
|
9
|
-
super(id, node);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { IconButton16, PluginButtonProps, buttonStyles } from '@frontify/fondue';
|
|
4
|
-
import { getPluginType } from '@udecode/plate';
|
|
5
|
-
import { ELEMENT_BUTTON } from '../createButtonPlugin';
|
|
6
|
-
import { ButtonToolbarButton } from './ButtonToolbarButton';
|
|
7
|
-
|
|
8
|
-
export const ButtonButton = ({ editor, id }: PluginButtonProps) => (
|
|
9
|
-
<div data-plugin-id={id}>
|
|
10
|
-
<ButtonToolbarButton
|
|
11
|
-
type={getPluginType(editor, ELEMENT_BUTTON)}
|
|
12
|
-
icon={
|
|
13
|
-
<span className="tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex">
|
|
14
|
-
<IconButton16 />
|
|
15
|
-
</span>
|
|
16
|
-
}
|
|
17
|
-
styles={buttonStyles}
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
);
|