@frontify/guideline-blocks-settings 0.33.4 → 0.33.5
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 +78 -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 +54 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +30 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +16 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +43 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +69 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +105 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +58 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +43 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +68 -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 +53 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +43 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +29 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +8 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +66 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +93 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +27 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +52 -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 +52 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +54 -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 +1193 -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 +8 -2
- 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,28 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, TText, Value, getPluginType } from '@udecode/plate';
|
|
4
|
-
import { RichTextButtonStyle, TButtonElement } from '..';
|
|
5
|
-
import { ELEMENT_BUTTON } from '../createButtonPlugin';
|
|
6
|
-
|
|
7
|
-
export interface CreateButtonNodeOptions {
|
|
8
|
-
url: string;
|
|
9
|
-
text?: string;
|
|
10
|
-
buttonStyle?: RichTextButtonStyle;
|
|
11
|
-
target?: string;
|
|
12
|
-
children?: TText[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const createButtonNode = <V extends Value>(
|
|
16
|
-
editor: PlateEditor<V>,
|
|
17
|
-
{ url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,
|
|
18
|
-
): TButtonElement => {
|
|
19
|
-
const type = getPluginType(editor, ELEMENT_BUTTON);
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
type,
|
|
23
|
-
url,
|
|
24
|
-
target,
|
|
25
|
-
buttonStyle,
|
|
26
|
-
children: children ?? [{ text }],
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, getAboveNode } from '@udecode/plate';
|
|
4
|
-
import { ELEMENT_BUTTON, RichTextButtonStyle, TButtonElement } from '..';
|
|
5
|
-
|
|
6
|
-
export const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {
|
|
7
|
-
const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });
|
|
8
|
-
|
|
9
|
-
if (!Array.isArray(linkNode)) {
|
|
10
|
-
return 'primary';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';
|
|
14
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, getAboveNode } from '@udecode/plate';
|
|
4
|
-
import { ELEMENT_BUTTON, TButtonElement } from '..';
|
|
5
|
-
|
|
6
|
-
const getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {
|
|
7
|
-
const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });
|
|
8
|
-
|
|
9
|
-
if (!Array.isArray(linkNode)) {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return cb(linkNode[0]);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const getUrlFromEditor = (editor: PlateEditor) => {
|
|
17
|
-
return getLinkNode(editor, (link) => link.url ?? '');
|
|
18
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
export * from './getUrl';
|
|
4
|
-
export * from './createButtonNode';
|
|
5
|
-
export * from './triggerFloatingButton';
|
|
6
|
-
export * from './triggerFloatingButtonEdit';
|
|
7
|
-
export * from './triggerFloatingButtonInsert';
|
|
8
|
-
export * from './styles';
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { CSSProperties } from 'react';
|
|
4
|
-
|
|
5
|
-
export const BlockButtonStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {
|
|
6
|
-
buttonPrimary: {
|
|
7
|
-
fontFamily: 'var(--f-theme-settings-button-primary-font-family)',
|
|
8
|
-
fontSize: 'var(--f-theme-settings-button-primary-font-size)',
|
|
9
|
-
fontWeight: 'var(--f-theme-settings-button-primary-font-weight)',
|
|
10
|
-
lineHeight: 'var(--f-theme-settings-button-primary-line-height)',
|
|
11
|
-
paddingTop: 'var(--f-theme-settings-button-primary-padding-top)',
|
|
12
|
-
paddingRight: 'var(--f-theme-settings-button-primary-padding-right)',
|
|
13
|
-
paddingBottom: 'var(--f-theme-settings-button-primary-padding-bottom)',
|
|
14
|
-
paddingLeft: 'var(--f-theme-settings-button-primary-padding-left)',
|
|
15
|
-
fontStyle: 'var(--f-theme-settings-button-primary-font-style)',
|
|
16
|
-
textTransform: 'var(--f-theme-settings-button-primary-text-transform)' as CSSProperties['textTransform'],
|
|
17
|
-
backgroundColor: 'var(--f-theme-settings-button-primary-background-color)',
|
|
18
|
-
borderColor: 'var(--f-theme-settings-button-primary-border-color)',
|
|
19
|
-
borderRadius: 'var(--f-theme-settings-button-primary-border-radius)',
|
|
20
|
-
borderWidth: 'var(--f-theme-settings-button-primary-border-width)',
|
|
21
|
-
color: 'var(--f-theme-settings-button-primary-color)',
|
|
22
|
-
marginTop: '10px',
|
|
23
|
-
marginBottom: '10px',
|
|
24
|
-
display: 'inline-block',
|
|
25
|
-
hover: {
|
|
26
|
-
backgroundColor: 'var(--f-theme-settings-button-primary-background-color-hover)',
|
|
27
|
-
borderColor: 'var(--f-theme-settings-button-primary-border-color-hover)',
|
|
28
|
-
color: 'var(--f-theme-settings-button-primary-color-hover)',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
buttonSecondary: {
|
|
33
|
-
fontFamily: 'var(--f-theme-settings-button-secondary-font-family)',
|
|
34
|
-
fontSize: 'var(--f-theme-settings-button-secondary-font-size)',
|
|
35
|
-
fontWeight: 'var(--f-theme-settings-button-secondary-font-weight)',
|
|
36
|
-
lineHeight: 'var(--f-theme-settings-button-secondary-line-height)',
|
|
37
|
-
paddingTop: 'var(--f-theme-settings-button-secondary-padding-top)',
|
|
38
|
-
paddingRight: 'var(--f-theme-settings-button-secondary-padding-right)',
|
|
39
|
-
paddingBottom: 'var(--f-theme-settings-button-secondary-padding-bottom)',
|
|
40
|
-
paddingLeft: 'var(--f-theme-settings-button-secondary-padding-left)',
|
|
41
|
-
fontStyle: 'var(--f-theme-settings-button-secondary-font-style)',
|
|
42
|
-
textTransform: 'var(--f-theme-settings-button-secondary-text-transform)' as CSSProperties['textTransform'],
|
|
43
|
-
backgroundColor: 'var(--f-theme-settings-button-secondary-background-color)',
|
|
44
|
-
borderColor: 'var(--f-theme-settings-button-secondary-border-color)',
|
|
45
|
-
borderRadius: 'var(--f-theme-settings-button-secondary-border-radius)',
|
|
46
|
-
borderWidth: 'var(--f-theme-settings-button-secondary-border-width)',
|
|
47
|
-
color: 'var(--f-theme-settings-button-secondary-color)',
|
|
48
|
-
display: 'inline-block',
|
|
49
|
-
marginTop: '10px',
|
|
50
|
-
marginBottom: '10px',
|
|
51
|
-
hover: {
|
|
52
|
-
backgroundColor: 'var(--f-theme-settings-button-secondary-background-color-hover)',
|
|
53
|
-
borderColor: 'var(--f-theme-settings-button-secondary-border-color-hover)',
|
|
54
|
-
color: 'var(--f-theme-settings-button-secondary-color-hover)',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
buttonTertiary: {
|
|
59
|
-
fontFamily: 'var(--f-theme-settings-button-tertiary-font-family)',
|
|
60
|
-
fontSize: 'var(--f-theme-settings-button-tertiary-font-size)',
|
|
61
|
-
fontWeight: 'var(--f-theme-settings-button-tertiary-font-weight)',
|
|
62
|
-
lineHeight: 'var(--f-theme-settings-button-tertiary-line-height)',
|
|
63
|
-
paddingTop: 'var(--f-theme-settings-button-tertiary-padding-top)',
|
|
64
|
-
paddingRight: 'var(--f-theme-settings-button-tertiary-padding-right)',
|
|
65
|
-
paddingBottom: 'var(--f-theme-settings-button-tertiary-padding-bottom)',
|
|
66
|
-
paddingLeft: 'var(--f-theme-settings-button-tertiary-padding-left)',
|
|
67
|
-
fontStyle: 'var(--f-theme-settings-button-tertiary-font-style)',
|
|
68
|
-
textTransform: 'var(--f-theme-settings-button-tertiary-text-transform)' as CSSProperties['textTransform'],
|
|
69
|
-
backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color)',
|
|
70
|
-
borderColor: 'var(--f-theme-settings-button-tertiary-border-color)',
|
|
71
|
-
borderRadius: 'var(--f-theme-settings-button-tertiary-border-radius)',
|
|
72
|
-
borderWidth: 'var(--f-theme-settings-button-tertiary-border-width)',
|
|
73
|
-
color: 'var(--f-theme-settings-button-tertiary-color)',
|
|
74
|
-
display: 'inline-block',
|
|
75
|
-
marginTop: '10px',
|
|
76
|
-
marginBottom: '10px',
|
|
77
|
-
hover: {
|
|
78
|
-
backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color-hover)',
|
|
79
|
-
borderColor: 'var(--f-theme-settings-button-tertiary-border-color-hover)',
|
|
80
|
-
color: 'var(--f-theme-settings-button-tertiary-color-hover)',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, Value } from '@udecode/plate';
|
|
4
|
-
import { floatingButtonSelectors } from '../components';
|
|
5
|
-
import { triggerFloatingButtonEdit, triggerFloatingButtonInsert } from '.';
|
|
6
|
-
|
|
7
|
-
export const triggerFloatingButton = <V extends Value>(
|
|
8
|
-
editor: PlateEditor<V>,
|
|
9
|
-
{
|
|
10
|
-
focused,
|
|
11
|
-
}: {
|
|
12
|
-
focused?: boolean;
|
|
13
|
-
} = {},
|
|
14
|
-
) => {
|
|
15
|
-
if (floatingButtonSelectors.mode() === 'edit') {
|
|
16
|
-
triggerFloatingButtonEdit(editor);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
triggerFloatingButtonInsert(editor, {
|
|
21
|
-
focused,
|
|
22
|
-
});
|
|
23
|
-
};
|
package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, Value, findNode, getEditorString, getPluginType } from '@udecode/plate';
|
|
4
|
-
import { ELEMENT_BUTTON, TButtonElement } from '..';
|
|
5
|
-
import { floatingButtonActions } from '../components/FloatingButton/floatingButtonStore';
|
|
6
|
-
|
|
7
|
-
export const triggerFloatingButtonEdit = <V extends Value>(editor: PlateEditor<V>) => {
|
|
8
|
-
const entry = findNode<TButtonElement>(editor, {
|
|
9
|
-
match: { type: getPluginType(editor, ELEMENT_BUTTON) },
|
|
10
|
-
});
|
|
11
|
-
if (!entry) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const [link, path] = entry;
|
|
16
|
-
|
|
17
|
-
let text = getEditorString(editor, path);
|
|
18
|
-
|
|
19
|
-
floatingButtonActions.url(link.url);
|
|
20
|
-
|
|
21
|
-
floatingButtonActions.newTab(link.target === undefined);
|
|
22
|
-
|
|
23
|
-
if (text === link.url) {
|
|
24
|
-
text = '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
floatingButtonActions.text(text);
|
|
28
|
-
|
|
29
|
-
floatingButtonActions.isEditing(true);
|
|
30
|
-
};
|
package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { PlateEditor, Value, getEditorString, getPluginType, isRangeAcrossBlocks, someNode } from '@udecode/plate';
|
|
4
|
-
import { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';
|
|
5
|
-
import { ELEMENT_BUTTON } from '../createButtonPlugin';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Trigger floating button.
|
|
9
|
-
*
|
|
10
|
-
* Do not trigger when:
|
|
11
|
-
* - selection is across blocks
|
|
12
|
-
* - selection has more than one leaf node
|
|
13
|
-
* - lowest selection is not text
|
|
14
|
-
* - selection has a button node
|
|
15
|
-
*/
|
|
16
|
-
export const triggerFloatingButtonInsert = <V extends Value>(
|
|
17
|
-
editor: PlateEditor<V>,
|
|
18
|
-
{
|
|
19
|
-
focused,
|
|
20
|
-
}: {
|
|
21
|
-
focused?: boolean;
|
|
22
|
-
} = {},
|
|
23
|
-
) => {
|
|
24
|
-
if (floatingButtonSelectors.mode()) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!focused) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (isRangeAcrossBlocks(editor, { at: editor.selection })) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const hasButton = someNode(editor, {
|
|
37
|
-
match: { type: getPluginType(editor, ELEMENT_BUTTON) },
|
|
38
|
-
});
|
|
39
|
-
if (hasButton) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
floatingButtonActions.text(getEditorString(editor, editor.selection));
|
|
44
|
-
floatingButtonActions.show('insert', editor.id);
|
|
45
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AnyObject,
|
|
5
|
-
EText,
|
|
6
|
-
PlateEditor,
|
|
7
|
-
Value,
|
|
8
|
-
WithOverride,
|
|
9
|
-
getAboveNode,
|
|
10
|
-
getNextNodeStartPoint,
|
|
11
|
-
getPluginType,
|
|
12
|
-
getPreviousNodeEndPoint,
|
|
13
|
-
insertNodes,
|
|
14
|
-
isCollapsed,
|
|
15
|
-
isEndPoint,
|
|
16
|
-
isStartPoint,
|
|
17
|
-
mockPlugin,
|
|
18
|
-
select,
|
|
19
|
-
withRemoveEmptyNodes,
|
|
20
|
-
} from '@udecode/plate';
|
|
21
|
-
import { Path, Point, Range } from 'slate';
|
|
22
|
-
import { ELEMENT_BUTTON } from './createButtonPlugin';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Insert space after a url to wrap a button.
|
|
26
|
-
* Lookup from the block start to the cursor to check if there is an url.
|
|
27
|
-
* If not found, lookup before the cursor for a space character to check the url.
|
|
28
|
-
*
|
|
29
|
-
* On insert data:
|
|
30
|
-
* Paste a string inside a button element will edit its children text but not its url.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
export const withButton: WithOverride = (editor, { type }) => {
|
|
35
|
-
const { apply, normalizeNode } = editor;
|
|
36
|
-
|
|
37
|
-
editor.apply = (operation) => {
|
|
38
|
-
if (operation.type !== 'set_selection') {
|
|
39
|
-
apply(operation);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const range = operation.newProperties;
|
|
44
|
-
if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {
|
|
45
|
-
apply(operation);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const entry = getAboveNode(editor, {
|
|
50
|
-
at: range as Range,
|
|
51
|
-
match: { type: getPluginType(editor, ELEMENT_BUTTON) },
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (entry) {
|
|
55
|
-
const [, path] = entry;
|
|
56
|
-
|
|
57
|
-
let newPoint: Point | undefined;
|
|
58
|
-
|
|
59
|
-
if (isStartPoint(editor, range.focus, path)) {
|
|
60
|
-
newPoint = getPreviousNodeEndPoint(editor, path);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (isEndPoint(editor, range.focus, path)) {
|
|
64
|
-
newPoint = getNextNodeStartPoint(editor, path);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (newPoint) {
|
|
68
|
-
operation.newProperties = {
|
|
69
|
-
anchor: newPoint,
|
|
70
|
-
focus: newPoint,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
apply(operation);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
editor.normalizeNode = ([node, path]) => {
|
|
79
|
-
if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {
|
|
80
|
-
const range = editor.selection as Range | null;
|
|
81
|
-
|
|
82
|
-
if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {
|
|
83
|
-
const nextPoint = getNextNodeStartPoint(editor, path);
|
|
84
|
-
|
|
85
|
-
// select next text node if any
|
|
86
|
-
if (nextPoint) {
|
|
87
|
-
select(editor, nextPoint);
|
|
88
|
-
} else {
|
|
89
|
-
// insert text node then select
|
|
90
|
-
const nextPath = Path.next(path);
|
|
91
|
-
insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });
|
|
92
|
-
select(editor, nextPath);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
normalizeNode([node, path]);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return withRemoveEmptyNodes<Value, PlateEditor<Value>>(
|
|
101
|
-
editor,
|
|
102
|
-
mockPlugin<AnyObject, Value, PlateEditor<Value>>({
|
|
103
|
-
options: { types: type },
|
|
104
|
-
}),
|
|
105
|
-
);
|
|
106
|
-
};
|
package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { TEditableProps, useFloatingLinkSelectors } from '@udecode/plate';
|
|
4
|
-
|
|
5
|
-
import { EditModal } from './EditLinkModal';
|
|
6
|
-
import { FloatingLink } from './FloatingLink';
|
|
7
|
-
import { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';
|
|
8
|
-
|
|
9
|
-
export const CustomFloatingLink = ({ readOnly }: TEditableProps) => {
|
|
10
|
-
const isEditing = useFloatingLinkSelectors().isEditing();
|
|
11
|
-
|
|
12
|
-
if (readOnly) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const input = <InsertLinkModal />;
|
|
17
|
-
const editContent = isEditing ? input : <EditModal />;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<FloatingLink.InsertRoot>{input}</FloatingLink.InsertRoot>
|
|
22
|
-
|
|
23
|
-
<FloatingLink.EditRoot>{editContent}</FloatingLink.EditRoot>
|
|
24
|
-
</>
|
|
25
|
-
);
|
|
26
|
-
};
|
package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { IconPen16, IconTrashBin16 } from '@frontify/fondue';
|
|
4
|
-
import { useFloatingLinkUrlInput } from '@udecode/plate';
|
|
5
|
-
import { FloatingLink } from '../FloatingLink';
|
|
6
|
-
|
|
7
|
-
export const EditModal = () => {
|
|
8
|
-
const urlHtmlProps = useFloatingLinkUrlInput({});
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div
|
|
12
|
-
data-test-id="floating-link-edit"
|
|
13
|
-
className="tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]"
|
|
14
|
-
>
|
|
15
|
-
<span data-test-id={'preview-link-flyout'} className="tw-flex tw-justify-between tw-items-center">
|
|
16
|
-
<span className="tw-pointer-events-none">{urlHtmlProps.defaultValue}</span>
|
|
17
|
-
<span className="tw-flex tw-gap-2">
|
|
18
|
-
<span
|
|
19
|
-
role="button"
|
|
20
|
-
tabIndex={0}
|
|
21
|
-
data-test-id={'edit-link-button'}
|
|
22
|
-
className="tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"
|
|
23
|
-
>
|
|
24
|
-
<FloatingLink.EditButton>
|
|
25
|
-
<IconPen16 />
|
|
26
|
-
</FloatingLink.EditButton>
|
|
27
|
-
</span>
|
|
28
|
-
|
|
29
|
-
<span
|
|
30
|
-
role="button"
|
|
31
|
-
tabIndex={0}
|
|
32
|
-
data-test-id={'remove-link-button'}
|
|
33
|
-
className="tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"
|
|
34
|
-
>
|
|
35
|
-
<FloatingLink.UnlinkButton>
|
|
36
|
-
<IconTrashBin16 />
|
|
37
|
-
</FloatingLink.UnlinkButton>
|
|
38
|
-
</span>
|
|
39
|
-
</span>
|
|
40
|
-
</span>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
@@ -1,113 +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
|
-
floatingLinkSelectors,
|
|
10
|
-
getAboveNode,
|
|
11
|
-
getDefaultBoundingClientRect,
|
|
12
|
-
getEndPoint,
|
|
13
|
-
getPluginOptions,
|
|
14
|
-
getPluginType,
|
|
15
|
-
getRangeBoundingClientRect,
|
|
16
|
-
getStartPoint,
|
|
17
|
-
someNode,
|
|
18
|
-
triggerFloatingLinkEdit,
|
|
19
|
-
useComposedRef,
|
|
20
|
-
useEditorRef,
|
|
21
|
-
useFloatingLinkEnter,
|
|
22
|
-
useFloatingLinkEscape,
|
|
23
|
-
useFloatingLinkSelectors,
|
|
24
|
-
useHotkeys,
|
|
25
|
-
usePlateSelectors,
|
|
26
|
-
useVirtualFloatingLink,
|
|
27
|
-
} from '@udecode/plate';
|
|
28
|
-
import { useCallback, useEffect } from 'react';
|
|
29
|
-
import { getLinkFromEditor } from '../../../../../Link';
|
|
30
|
-
|
|
31
|
-
export const useFloatingLinkEdit = ({ floatingOptions, ...props }: FloatingLinkProps): HTMLPropsAs<'div'> => {
|
|
32
|
-
const editor = useEditorRef();
|
|
33
|
-
const keyEditor = usePlateSelectors().keyEditor();
|
|
34
|
-
const mode = useFloatingLinkSelectors().mode();
|
|
35
|
-
const open = useFloatingLinkSelectors().isOpen(editor.id);
|
|
36
|
-
|
|
37
|
-
const { triggerFloatingLinkHotkeys = 'command+k, ctrl+k' } = getPluginOptions<LinkPlugin>(editor, ELEMENT_LINK);
|
|
38
|
-
|
|
39
|
-
const getBoundingClientRect = useCallback(() => {
|
|
40
|
-
const entry = getAboveNode(editor, {
|
|
41
|
-
match: { type: getPluginType(editor, ELEMENT_LINK) },
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (entry) {
|
|
45
|
-
const [, path] = entry;
|
|
46
|
-
return getRangeBoundingClientRect(editor, {
|
|
47
|
-
anchor: getStartPoint(editor, path),
|
|
48
|
-
focus: getEndPoint(editor, path),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return getDefaultBoundingClientRect();
|
|
53
|
-
}, [editor]);
|
|
54
|
-
|
|
55
|
-
const isOpen = open && mode === 'edit';
|
|
56
|
-
|
|
57
|
-
const { update, style, floating } = useVirtualFloatingLink({
|
|
58
|
-
editorId: editor.id,
|
|
59
|
-
open: isOpen,
|
|
60
|
-
getBoundingClientRect,
|
|
61
|
-
...floatingOptions,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
const url = getLinkFromEditor(editor);
|
|
66
|
-
if (url) {
|
|
67
|
-
floatingLinkActions.url(url);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
editor.selection &&
|
|
72
|
-
someNode(editor, {
|
|
73
|
-
match: { type: getPluginType(editor, ELEMENT_LINK) },
|
|
74
|
-
})
|
|
75
|
-
) {
|
|
76
|
-
floatingLinkActions.show('edit', editor.id);
|
|
77
|
-
update();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (floatingLinkSelectors.mode() === 'edit') {
|
|
82
|
-
floatingLinkActions.hide();
|
|
83
|
-
}
|
|
84
|
-
}, [editor, keyEditor, update]);
|
|
85
|
-
|
|
86
|
-
useHotkeys(
|
|
87
|
-
triggerFloatingLinkHotkeys,
|
|
88
|
-
(e) => {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
|
|
91
|
-
if (floatingLinkSelectors.mode() === 'edit') {
|
|
92
|
-
triggerFloatingLinkEdit(editor);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
enableOnContentEditable: true,
|
|
97
|
-
},
|
|
98
|
-
[],
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
useFloatingLinkEnter();
|
|
102
|
-
|
|
103
|
-
useFloatingLinkEscape();
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
style: {
|
|
107
|
-
...style,
|
|
108
|
-
zIndex: 1000,
|
|
109
|
-
},
|
|
110
|
-
...props,
|
|
111
|
-
ref: useComposedRef<HTMLElement | null>(props.ref, floating),
|
|
112
|
-
};
|
|
113
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
FloatingLinkProps,
|
|
5
|
-
FloatingLink as PlateFloatingLink,
|
|
6
|
-
createComponentAs,
|
|
7
|
-
createElementAs,
|
|
8
|
-
} from '@udecode/plate';
|
|
9
|
-
import { useFloatingLinkEdit } from './EditLinkModal';
|
|
10
|
-
import { useFloatingLinkInsert } from './InsertLinkModal/useFloatingLinkInsert';
|
|
11
|
-
|
|
12
|
-
const FloatingLinkInsertRoot = createComponentAs<FloatingLinkProps>((props) => {
|
|
13
|
-
const htmlProps = useFloatingLinkInsert({
|
|
14
|
-
...props,
|
|
15
|
-
floatingOptions: {
|
|
16
|
-
strategy: 'absolute',
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (htmlProps.style?.display === 'none') {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return createElementAs('div', htmlProps);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const FloatingLinkEditRoot = createComponentAs<FloatingLinkProps>((props) => {
|
|
28
|
-
const htmlProps = useFloatingLinkEdit({
|
|
29
|
-
...props,
|
|
30
|
-
floatingOptions: {
|
|
31
|
-
strategy: 'absolute',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (htmlProps.style?.display === 'none') {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return createElementAs('div', htmlProps);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
PlateFloatingLink.EditRoot = FloatingLinkEditRoot;
|
|
43
|
-
PlateFloatingLink.InsertRoot = FloatingLinkInsertRoot;
|
|
44
|
-
|
|
45
|
-
export const FloatingLink = PlateFloatingLink;
|