@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,88 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
ButtonEmphasis,
|
|
7
|
-
ButtonSize,
|
|
8
|
-
ButtonStyle,
|
|
9
|
-
FormControl,
|
|
10
|
-
IconCheckMark20,
|
|
11
|
-
TextInput,
|
|
12
|
-
} from '@frontify/fondue';
|
|
13
|
-
import { FC, ReactNode } from 'react';
|
|
14
|
-
import { InsertModalStateProps } from './types';
|
|
15
|
-
import { LinkInput } from '../../../../../Link/LinkInput';
|
|
16
|
-
|
|
17
|
-
type InsertModalProps = {
|
|
18
|
-
state: InsertModalStateProps;
|
|
19
|
-
onTextChange: (value: string) => void;
|
|
20
|
-
onUrlChange: (value: string) => void;
|
|
21
|
-
onToggleTab: (checked: boolean) => void;
|
|
22
|
-
onCancel: () => void;
|
|
23
|
-
onSave: (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => void;
|
|
24
|
-
hasValues: boolean;
|
|
25
|
-
isValidUrlOrEmpty: (url: string) => boolean;
|
|
26
|
-
testId?: string;
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
appBridge: AppBridgeBlock;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const InsertModal: FC<InsertModalProps> = ({
|
|
32
|
-
state,
|
|
33
|
-
onTextChange,
|
|
34
|
-
onUrlChange,
|
|
35
|
-
onToggleTab,
|
|
36
|
-
onCancel,
|
|
37
|
-
onSave,
|
|
38
|
-
isValidUrlOrEmpty,
|
|
39
|
-
hasValues,
|
|
40
|
-
testId,
|
|
41
|
-
appBridge,
|
|
42
|
-
children,
|
|
43
|
-
}) => (
|
|
44
|
-
<div data-test-id={testId} className="tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto">
|
|
45
|
-
<FormControl
|
|
46
|
-
label={{
|
|
47
|
-
children: 'Text',
|
|
48
|
-
htmlFor: 'linkText',
|
|
49
|
-
required: true,
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<TextInput id="linkText" value={state.text} placeholder="Link Text" onChange={onTextChange} />
|
|
53
|
-
</FormControl>
|
|
54
|
-
|
|
55
|
-
{children}
|
|
56
|
-
|
|
57
|
-
<div className="tw-mt-5">
|
|
58
|
-
<LinkInput
|
|
59
|
-
url={state.url}
|
|
60
|
-
newTab={state.newTab}
|
|
61
|
-
onUrlChange={onUrlChange}
|
|
62
|
-
onToggleTab={onToggleTab}
|
|
63
|
-
isValidUrlOrEmpty={isValidUrlOrEmpty}
|
|
64
|
-
appBridge={appBridge}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
<div className="tw-mt-3">
|
|
68
|
-
<div className={'tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10'}>
|
|
69
|
-
<Button
|
|
70
|
-
onClick={onCancel}
|
|
71
|
-
size={ButtonSize.Medium}
|
|
72
|
-
style={ButtonStyle.Default}
|
|
73
|
-
emphasis={ButtonEmphasis.Default}
|
|
74
|
-
>
|
|
75
|
-
Cancel
|
|
76
|
-
</Button>
|
|
77
|
-
<Button
|
|
78
|
-
onClick={onSave}
|
|
79
|
-
size={ButtonSize.Medium}
|
|
80
|
-
icon={<IconCheckMark20 />}
|
|
81
|
-
disabled={!hasValues || !isValidUrlOrEmpty(state?.url)}
|
|
82
|
-
>
|
|
83
|
-
Save
|
|
84
|
-
</Button>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { CheckboxState } from '@frontify/fondue';
|
|
4
|
-
|
|
5
|
-
export type InsertModalDispatchType = { type: string; payload?: Partial<InsertModalStateProps> };
|
|
6
|
-
|
|
7
|
-
export type InsertModalStateProps = {
|
|
8
|
-
url: string;
|
|
9
|
-
text: string;
|
|
10
|
-
newTab: CheckboxState;
|
|
11
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ELEMENT_LINK,
|
|
5
|
-
FloatingLinkProps,
|
|
6
|
-
HTMLPropsAs,
|
|
7
|
-
LinkPlugin,
|
|
8
|
-
floatingLinkActions,
|
|
9
|
-
getPluginOptions,
|
|
10
|
-
getSelectionBoundingClientRect,
|
|
11
|
-
triggerFloatingLinkInsert,
|
|
12
|
-
useComposedRef,
|
|
13
|
-
useEditorRef,
|
|
14
|
-
useFloatingLinkEscape,
|
|
15
|
-
useFloatingLinkSelectors,
|
|
16
|
-
useHotkeys,
|
|
17
|
-
useVirtualFloatingLink,
|
|
18
|
-
} from '@udecode/plate';
|
|
19
|
-
import { useEffect } from 'react';
|
|
20
|
-
import { useFocused } from 'slate-react';
|
|
21
|
-
|
|
22
|
-
export const useFloatingLinkInsert = ({ floatingOptions, ...props }: FloatingLinkProps): HTMLPropsAs<'div'> => {
|
|
23
|
-
const editor = useEditorRef();
|
|
24
|
-
const focused = useFocused();
|
|
25
|
-
const mode = useFloatingLinkSelectors().mode();
|
|
26
|
-
const open = useFloatingLinkSelectors().isOpen(editor.id);
|
|
27
|
-
|
|
28
|
-
const { triggerFloatingLinkHotkeys } = getPluginOptions<LinkPlugin>(editor, ELEMENT_LINK);
|
|
29
|
-
|
|
30
|
-
useHotkeys(
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
|
-
triggerFloatingLinkHotkeys!,
|
|
33
|
-
(e) => {
|
|
34
|
-
if (triggerFloatingLinkInsert(editor, { focused })) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
enableOnContentEditable: true,
|
|
40
|
-
},
|
|
41
|
-
[focused],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const { update, style, floating } = useVirtualFloatingLink({
|
|
45
|
-
editorId: editor.id,
|
|
46
|
-
open: open && mode === 'insert',
|
|
47
|
-
getBoundingClientRect: getSelectionBoundingClientRect,
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
49
|
-
whileElementsMounted: () => {},
|
|
50
|
-
...floatingOptions,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// wait for update before focusing input
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (open) {
|
|
56
|
-
update();
|
|
57
|
-
floatingLinkActions.updated(true);
|
|
58
|
-
} else {
|
|
59
|
-
floatingLinkActions.updated(false);
|
|
60
|
-
}
|
|
61
|
-
}, [open, update]);
|
|
62
|
-
|
|
63
|
-
useFloatingLinkEscape();
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
style: {
|
|
67
|
-
...style,
|
|
68
|
-
zIndex: 1000,
|
|
69
|
-
},
|
|
70
|
-
...props,
|
|
71
|
-
ref: useComposedRef<HTMLElement | null>(props.ref, floating),
|
|
72
|
-
};
|
|
73
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
4
|
-
import { CheckboxState } from '@frontify/fondue';
|
|
5
|
-
import {
|
|
6
|
-
ELEMENT_LINK,
|
|
7
|
-
floatingLinkActions,
|
|
8
|
-
floatingLinkSelectors,
|
|
9
|
-
getPluginOptions,
|
|
10
|
-
submitFloatingLink,
|
|
11
|
-
useEditorRef,
|
|
12
|
-
useHotkeys,
|
|
13
|
-
} from '@udecode/plate';
|
|
14
|
-
import { Dispatch, Reducer, useEffect, useReducer } from 'react';
|
|
15
|
-
import { getLegacyUrl, getUrl } from '../../../../../Link/utils';
|
|
16
|
-
import { InsertModalDispatchType, InsertModalStateProps } from './types';
|
|
17
|
-
import { addHttps } from '../../../../../../helpers';
|
|
18
|
-
import { isValidUrlOrEmpty } from '../../../../../Link/utils/url';
|
|
19
|
-
|
|
20
|
-
const initialState: InsertModalStateProps = {
|
|
21
|
-
url: '',
|
|
22
|
-
text: '',
|
|
23
|
-
newTab: CheckboxState.Unchecked,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {
|
|
27
|
-
const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {
|
|
28
|
-
const { type, payload } = action;
|
|
29
|
-
|
|
30
|
-
switch (type) {
|
|
31
|
-
case 'NEW_TAB':
|
|
32
|
-
return {
|
|
33
|
-
...state,
|
|
34
|
-
newTab: CheckboxState.Checked,
|
|
35
|
-
};
|
|
36
|
-
case 'SAME_TAB':
|
|
37
|
-
return {
|
|
38
|
-
...state,
|
|
39
|
-
newTab: CheckboxState.Unchecked,
|
|
40
|
-
};
|
|
41
|
-
case 'URL':
|
|
42
|
-
case 'TEXT':
|
|
43
|
-
case 'INIT':
|
|
44
|
-
return {
|
|
45
|
-
...state,
|
|
46
|
-
...payload,
|
|
47
|
-
};
|
|
48
|
-
default:
|
|
49
|
-
return state;
|
|
50
|
-
}
|
|
51
|
-
}, initialState);
|
|
52
|
-
|
|
53
|
-
return [state, dispatch];
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const useInsertModal = () => {
|
|
57
|
-
const editor = useEditorRef();
|
|
58
|
-
const [state, dispatch] = InsertModalState();
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const legacyUrl = getLegacyUrl(editor);
|
|
62
|
-
const url = getUrl(editor);
|
|
63
|
-
|
|
64
|
-
dispatch({
|
|
65
|
-
type: 'INIT',
|
|
66
|
-
payload: {
|
|
67
|
-
text: floatingLinkSelectors.text(),
|
|
68
|
-
newTab: floatingLinkSelectors.newTab() ? CheckboxState.Checked : CheckboxState.Unchecked,
|
|
69
|
-
url: legacyUrl && url === '' ? legacyUrl : floatingLinkSelectors.url(),
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
}, [dispatch, editor]);
|
|
73
|
-
|
|
74
|
-
const onTextChange = (value: string) => {
|
|
75
|
-
dispatch({
|
|
76
|
-
type: 'TEXT',
|
|
77
|
-
payload: { text: value },
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onUrlChange = (value: string) => {
|
|
82
|
-
dispatch({
|
|
83
|
-
type: 'URL',
|
|
84
|
-
payload: { url: value },
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const onToggleTab = (checked: boolean) => {
|
|
89
|
-
checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const onCancel = () => {
|
|
93
|
-
floatingLinkActions.hide();
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const onSave = (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => {
|
|
97
|
-
if (!isValidUrlOrEmpty(state.url) || !hasValues) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const urlToSave = addHttps(state.url);
|
|
102
|
-
|
|
103
|
-
floatingLinkActions.text(state.text);
|
|
104
|
-
floatingLinkActions.url(urlToSave);
|
|
105
|
-
floatingLinkActions.newTab(state.newTab === CheckboxState.Checked);
|
|
106
|
-
|
|
107
|
-
if (submitFloatingLink(editor)) {
|
|
108
|
-
event?.preventDefault();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const hasValues = state.url !== '' && state.text !== '';
|
|
113
|
-
|
|
114
|
-
const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_LINK);
|
|
115
|
-
|
|
116
|
-
useHotkeys(
|
|
117
|
-
'enter',
|
|
118
|
-
onSave,
|
|
119
|
-
{
|
|
120
|
-
enableOnFormTags: ['INPUT'],
|
|
121
|
-
},
|
|
122
|
-
[],
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
return {
|
|
126
|
-
state,
|
|
127
|
-
onTextChange,
|
|
128
|
-
onUrlChange,
|
|
129
|
-
onToggleTab,
|
|
130
|
-
onCancel,
|
|
131
|
-
onSave,
|
|
132
|
-
hasValues,
|
|
133
|
-
isValidUrlOrEmpty,
|
|
134
|
-
appBridge,
|
|
135
|
-
};
|
|
136
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
IconLink,
|
|
5
|
-
IconSize,
|
|
6
|
-
PluginButtonProps,
|
|
7
|
-
getButtonClassNames,
|
|
8
|
-
getHotkeyByPlatform,
|
|
9
|
-
getTooltip,
|
|
10
|
-
} from '@frontify/fondue';
|
|
11
|
-
import { LinkToolbarButton, isRangeInSameBlock, useEventPlateId, usePlateEditorState } from '@udecode/plate';
|
|
12
|
-
|
|
13
|
-
export const LinkButton = ({ id, editorId }: PluginButtonProps) => {
|
|
14
|
-
const editor = usePlateEditorState(useEventPlateId(editorId));
|
|
15
|
-
const isEnabled = !!isRangeInSameBlock(editor, {
|
|
16
|
-
at: editor.selection,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div data-plugin-id={id}>
|
|
21
|
-
<LinkToolbarButton
|
|
22
|
-
tooltip={getTooltip(
|
|
23
|
-
isEnabled
|
|
24
|
-
? `Link\n${getHotkeyByPlatform('Ctrl+K')}`
|
|
25
|
-
: 'Links can only be set for a single text block.',
|
|
26
|
-
)}
|
|
27
|
-
icon={
|
|
28
|
-
<span className="tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex">
|
|
29
|
-
<IconLink size={IconSize.Size16} />
|
|
30
|
-
</span>
|
|
31
|
-
}
|
|
32
|
-
classNames={getButtonClassNames(isEnabled)}
|
|
33
|
-
styles={{ root: { width: '24px', height: '24px' } }}
|
|
34
|
-
actionHandler="onMouseDown"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
};
|
package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { HTMLPropsAs, LinkRootProps, useElementProps } from '@udecode/plate';
|
|
4
|
-
import type { MouseEvent } from 'react';
|
|
5
|
-
import { TLinkElement } from '../types';
|
|
6
|
-
import { BlockStyles } from '../../styles';
|
|
7
|
-
import { LINK_PLUGIN } from '../id';
|
|
8
|
-
|
|
9
|
-
const useLink = (props: LinkRootProps): HTMLPropsAs<'a'> => {
|
|
10
|
-
const _props = useElementProps<TLinkElement, 'a'>({
|
|
11
|
-
...props,
|
|
12
|
-
elementToAttributes: (element) => ({
|
|
13
|
-
href: element.url || element.chosenLink?.searchResult?.link || '',
|
|
14
|
-
target: element.target || '_self',
|
|
15
|
-
}),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
..._props,
|
|
20
|
-
// quick fix: hovering <a> with href loses the editor focus
|
|
21
|
-
onMouseOver: (event: MouseEvent) => {
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const LinkMarkupElementNode = (props: LinkRootProps) => {
|
|
28
|
-
const htmlProps = useLink(props);
|
|
29
|
-
const { attributes, children } = props;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<a {...attributes} href={htmlProps.href} target={htmlProps.target} style={BlockStyles[LINK_PLUGIN]}>
|
|
33
|
-
{children}
|
|
34
|
-
</a>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { MarkupElement } from '@frontify/fondue';
|
|
4
|
-
import { ELEMENT_LINK } from '@udecode/plate';
|
|
5
|
-
import { LinkMarkupElementNode } from './LinkMarkupElementNode';
|
|
6
|
-
|
|
7
|
-
export class LinkMarkupElement extends MarkupElement {
|
|
8
|
-
constructor(id = ELEMENT_LINK, node = LinkMarkupElementNode) {
|
|
9
|
-
super(id, node);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { CSSProperties } from 'react';
|
|
4
|
-
import { AppBridgeBlock } from '@frontify/app-bridge';
|
|
5
|
-
import { Plugin, PluginProps } from '@frontify/fondue';
|
|
6
|
-
import { createLinkPlugin as createPlateLinkPlugin, createPluginFactory } from '@udecode/plate';
|
|
7
|
-
|
|
8
|
-
import { CustomFloatingLink } from './FloatingLink/CustomFloatingLink';
|
|
9
|
-
import { LINK_PLUGIN } from './id';
|
|
10
|
-
import { LinkButton } from './LinkButton';
|
|
11
|
-
import { LinkMarkupElement } from './LinkMarkupElement';
|
|
12
|
-
import { isValidUrl } from '../../../Link/utils/url';
|
|
13
|
-
import { BlockStyles } from '../styles';
|
|
14
|
-
|
|
15
|
-
export const createLinkPlugin = (appBridge: AppBridgeBlock) =>
|
|
16
|
-
createPluginFactory({
|
|
17
|
-
...createPlateLinkPlugin(),
|
|
18
|
-
renderAfterEditable: CustomFloatingLink,
|
|
19
|
-
options: {
|
|
20
|
-
isUrl: isValidUrl,
|
|
21
|
-
rangeBeforeOptions: {
|
|
22
|
-
matchString: ' ',
|
|
23
|
-
skipInvalid: true,
|
|
24
|
-
afterMatch: true,
|
|
25
|
-
},
|
|
26
|
-
triggerFloatingLinkHotkeys: 'command+k, ctrl+k',
|
|
27
|
-
appBridge,
|
|
28
|
-
},
|
|
29
|
-
})();
|
|
30
|
-
|
|
31
|
-
export type LinkPluginProps = PluginProps & { appBridge: AppBridgeBlock };
|
|
32
|
-
|
|
33
|
-
export class LinkPlugin extends Plugin {
|
|
34
|
-
private appBridge: AppBridgeBlock;
|
|
35
|
-
public styles: CSSProperties = {};
|
|
36
|
-
constructor(props?: LinkPluginProps, styles = BlockStyles[LINK_PLUGIN]) {
|
|
37
|
-
super(LINK_PLUGIN, {
|
|
38
|
-
button: LinkButton,
|
|
39
|
-
markupElement: new LinkMarkupElement(),
|
|
40
|
-
...props,
|
|
41
|
-
});
|
|
42
|
-
this.styles = styles;
|
|
43
|
-
this.appBridge = props?.appBridge as AppBridgeBlock;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
plugins() {
|
|
47
|
-
return [createLinkPlugin(this.appBridge)];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { TLinkElement as TPlateLinkElement } from '@udecode/plate';
|
|
4
|
-
|
|
5
|
-
export type TLinkElement = TPlateLinkElement & {
|
|
6
|
-
chosenLink?: {
|
|
7
|
-
searchResult?: {
|
|
8
|
-
link?: string;
|
|
9
|
-
};
|
|
10
|
-
openInNewTab?: boolean;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { createPluginFactory } from '@udecode/plate';
|
|
4
|
-
import type { CSSProperties } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
MarkupElement,
|
|
7
|
-
Plugin,
|
|
8
|
-
PluginProps,
|
|
9
|
-
TextStyleRenderElementProps,
|
|
10
|
-
alignmentClassnames,
|
|
11
|
-
getColumnBreakClasses,
|
|
12
|
-
merge,
|
|
13
|
-
} from '@frontify/fondue';
|
|
14
|
-
import { BlockStyles, TextStyles } from '../styles';
|
|
15
|
-
|
|
16
|
-
const ID = 'textstyle-custom1-plugin';
|
|
17
|
-
|
|
18
|
-
export class Custom1Plugin extends Plugin {
|
|
19
|
-
public styles: CSSProperties = {};
|
|
20
|
-
constructor({ styles = BlockStyles.custom1, ...props }: PluginProps = {}) {
|
|
21
|
-
super(TextStyles.custom1, {
|
|
22
|
-
label: 'Custom 1',
|
|
23
|
-
markupElement: new Custom1MarkupElement(),
|
|
24
|
-
...props,
|
|
25
|
-
});
|
|
26
|
-
this.styles = styles;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
plugins() {
|
|
30
|
-
return [createCustom1Plugin(this.styles)];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
class Custom1MarkupElement extends MarkupElement {
|
|
35
|
-
constructor(id = ID, node = Custom1MarkupElementNode) {
|
|
36
|
-
super(id, node);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Custom1MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {
|
|
41
|
-
const align = element.align as string;
|
|
42
|
-
return (
|
|
43
|
-
<p
|
|
44
|
-
{...attributes}
|
|
45
|
-
style={styles}
|
|
46
|
-
className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</p>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const createCustom1Plugin = (styles: CSSProperties) =>
|
|
54
|
-
createPluginFactory({
|
|
55
|
-
key: TextStyles.custom1,
|
|
56
|
-
isElement: true,
|
|
57
|
-
deserializeHtml: {
|
|
58
|
-
rules: [{ validClassName: TextStyles.custom1 }],
|
|
59
|
-
},
|
|
60
|
-
})({
|
|
61
|
-
component: (props: TextStyleRenderElementProps) => <Custom1MarkupElementNode {...props} styles={styles} />,
|
|
62
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { createPluginFactory } from '@udecode/plate';
|
|
4
|
-
import type { CSSProperties } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
MarkupElement,
|
|
7
|
-
Plugin,
|
|
8
|
-
PluginProps,
|
|
9
|
-
TextStyleRenderElementProps,
|
|
10
|
-
alignmentClassnames,
|
|
11
|
-
getColumnBreakClasses,
|
|
12
|
-
merge,
|
|
13
|
-
} from '@frontify/fondue';
|
|
14
|
-
import { BlockStyles, TextStyles } from '../styles';
|
|
15
|
-
|
|
16
|
-
const ID = 'textstyle-custom2-plugin';
|
|
17
|
-
|
|
18
|
-
export class Custom2Plugin extends Plugin {
|
|
19
|
-
public styles: CSSProperties = {};
|
|
20
|
-
constructor({ styles = BlockStyles.custom2, ...props }: PluginProps = {}) {
|
|
21
|
-
super(TextStyles.custom2, {
|
|
22
|
-
label: 'Custom 2',
|
|
23
|
-
markupElement: new Custom2MarkupElement(),
|
|
24
|
-
...props,
|
|
25
|
-
});
|
|
26
|
-
this.styles = styles;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
plugins() {
|
|
30
|
-
return [createCustom2Plugin(this.styles)];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
class Custom2MarkupElement extends MarkupElement {
|
|
35
|
-
constructor(id = ID, node = Custom2MarkupElementNode) {
|
|
36
|
-
super(id, node);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Custom2MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {
|
|
41
|
-
const align = element.align as string;
|
|
42
|
-
return (
|
|
43
|
-
<p
|
|
44
|
-
{...attributes}
|
|
45
|
-
className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}
|
|
46
|
-
style={styles}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</p>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const createCustom2Plugin = (styles: CSSProperties) =>
|
|
54
|
-
createPluginFactory({
|
|
55
|
-
key: TextStyles.custom2,
|
|
56
|
-
isElement: true,
|
|
57
|
-
deserializeHtml: {
|
|
58
|
-
rules: [{ validClassName: TextStyles.custom2 }],
|
|
59
|
-
},
|
|
60
|
-
})({
|
|
61
|
-
component: (props: TextStyleRenderElementProps) => <Custom2MarkupElementNode {...props} styles={styles} />,
|
|
62
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateRenderElementProps, createPluginFactory } from '@udecode/plate';
|
|
4
|
-
import type { CSSProperties } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
MarkupElement,
|
|
7
|
-
Plugin,
|
|
8
|
-
PluginProps,
|
|
9
|
-
TextStyleRenderElementProps,
|
|
10
|
-
TextStyles,
|
|
11
|
-
alignmentClassnames,
|
|
12
|
-
getColumnBreakClasses,
|
|
13
|
-
merge,
|
|
14
|
-
} from '@frontify/fondue';
|
|
15
|
-
import { BlockStyles } from '../styles';
|
|
16
|
-
|
|
17
|
-
const ID = 'textstyle-custom3-plugin';
|
|
18
|
-
|
|
19
|
-
export class Custom3Plugin extends Plugin {
|
|
20
|
-
public styles: CSSProperties = {};
|
|
21
|
-
constructor({ styles = BlockStyles.custom3, ...props }: PluginProps = {}) {
|
|
22
|
-
super(TextStyles.custom3, {
|
|
23
|
-
label: 'Custom 3',
|
|
24
|
-
markupElement: new Custom3MarkupElement(),
|
|
25
|
-
...props,
|
|
26
|
-
});
|
|
27
|
-
this.styles = styles;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
plugins() {
|
|
31
|
-
return [createCustom3Plugin(this.styles)];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
class Custom3MarkupElement extends MarkupElement {
|
|
36
|
-
constructor(id = ID, node = Custom3MarkupElementNode) {
|
|
37
|
-
super(id, node);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const Custom3MarkupElementNode = ({ element, attributes, children, styles }: TextStyleRenderElementProps) => {
|
|
42
|
-
const align = element.align as string;
|
|
43
|
-
return (
|
|
44
|
-
<p
|
|
45
|
-
{...attributes}
|
|
46
|
-
className={merge([align && alignmentClassnames[align], getColumnBreakClasses(element)])}
|
|
47
|
-
style={styles}
|
|
48
|
-
>
|
|
49
|
-
{children}
|
|
50
|
-
</p>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const createCustom3Plugin = (styles: CSSProperties) =>
|
|
55
|
-
createPluginFactory({
|
|
56
|
-
key: TextStyles.custom3,
|
|
57
|
-
isElement: true,
|
|
58
|
-
deserializeHtml: {
|
|
59
|
-
rules: [{ validClassName: TextStyles.custom3 }],
|
|
60
|
-
},
|
|
61
|
-
})({
|
|
62
|
-
component: (props: PlateRenderElementProps) => <Custom3MarkupElementNode {...props} styles={styles} />,
|
|
63
|
-
});
|