@frontify/guideline-blocks-settings 3.0.2 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.es.js +17 -0
- package/dist/components/Attachments/AttachmentItem.es.js +116 -168
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +145 -137
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +25 -28
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +114 -126
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +53 -74
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +26 -31
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +22 -25
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +17 -28
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +25 -35
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +41 -34
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +41 -36
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +24 -33
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +20 -11
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +18 -10
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +10 -12
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +13 -13
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +21 -19
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +18 -25
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -17
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/constants.es.js +6 -6
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -1
- package/dist/components/Link/LinkInput.es.js +70 -63
- package/dist/components/Link/LinkInput.es.js.map +1 -1
- package/dist/components/Link/utils/getUrl.es.js +10 -12
- package/dist/components/Link/utils/getUrl.es.js.map +1 -1
- package/dist/components/Link/utils/relativeUrlRegex.es.js +6 -5
- package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -1
- package/dist/components/Link/utils/url.es.js +21 -17
- package/dist/components/Link/utils/url.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +61 -68
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +25 -22
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/constants.es.js +6 -5
- package/dist/components/RichTextEditor/constants.es.js.map +1 -1
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +30 -37
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +31 -39
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -11
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +19 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +24 -26
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +46 -53
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +52 -54
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +68 -68
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +91 -103
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +26 -32
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +47 -53
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +12 -18
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +21 -25
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +29 -37
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +13 -17
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +56 -62
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +9 -12
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +23 -24
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +28 -33
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -80
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +23 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +18 -18
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -12
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +9 -8
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +11 -10
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +85 -84
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +13 -16
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +13 -16
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +10 -13
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +45 -51
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +20 -22
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -12
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +48 -57
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +46 -48
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +12 -8
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +62 -71
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +76 -77
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +17 -21
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +17 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +22 -26
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +6 -5
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -40
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +10 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +26 -26
- package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +44 -38
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -41
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +40 -48
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js +29 -29
- package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/styles.es.js +167 -166
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
- package/dist/helpers/addHttps.es.js +12 -12
- package/dist/helpers/addHttps.es.js.map +1 -1
- package/dist/helpers/convertToRichTextValue.es.js +14 -6
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -1
- package/dist/helpers/hasRichTextValue.es.js +13 -14
- package/dist/helpers/hasRichTextValue.es.js.map +1 -1
- package/dist/helpers/isDownloadable.es.js +6 -5
- package/dist/helpers/isDownloadable.es.js.map +1 -1
- package/dist/hooks/useAttachments.es.js +65 -73
- package/dist/hooks/useAttachments.es.js.map +1 -1
- package/dist/hooks/useIsInViewport.es.js +20 -21
- package/dist/hooks/useIsInViewport.es.js.map +1 -1
- package/dist/index.cjs.js +2 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +16 -34
- package/dist/index.es.js +219 -213
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js +20 -21
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/border.es.js +62 -64
- package/dist/settings/border.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js +49 -52
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/settings/borderRadiusExtended.es.js +58 -60
- package/dist/settings/borderRadiusExtended.es.js.map +1 -1
- package/dist/settings/defaultValues.es.js +16 -19
- package/dist/settings/defaultValues.es.js.map +1 -1
- package/dist/settings/gutter.es.js +48 -52
- package/dist/settings/gutter.es.js.map +1 -1
- package/dist/settings/margin.es.js +49 -52
- package/dist/settings/margin.es.js.map +1 -1
- package/dist/settings/marginExtended.es.js +62 -64
- package/dist/settings/marginExtended.es.js.map +1 -1
- package/dist/settings/padding.es.js +49 -52
- package/dist/settings/padding.es.js.map +1 -1
- package/dist/settings/paddingExtended.es.js +62 -64
- package/dist/settings/paddingExtended.es.js.map +1 -1
- package/dist/settings/securityDownloadable.es.js +16 -16
- package/dist/settings/securityDownloadable.es.js.map +1 -1
- package/dist/settings/securityGlobalControl.es.js +26 -32
- package/dist/settings/securityGlobalControl.es.js.map +1 -1
- package/dist/settings/types.es.js +41 -47
- package/dist/settings/types.es.js.map +1 -1
- package/dist/styles.css +2 -1
- package/dist/utilities/color/getReadableColor.es.js +15 -13
- package/dist/utilities/color/getReadableColor.es.js.map +1 -1
- package/dist/utilities/color/isDark.es.js +14 -9
- package/dist/utilities/color/isDark.es.js.map +1 -1
- package/dist/utilities/color/setAlpha.es.js +7 -6
- package/dist/utilities/color/setAlpha.es.js.map +1 -1
- package/dist/utilities/color/toColorObject.es.js +14 -8
- package/dist/utilities/color/toColorObject.es.js.map +1 -1
- package/dist/utilities/color/toHex8String.es.js +7 -6
- package/dist/utilities/color/toHex8String.es.js.map +1 -1
- package/dist/utilities/color/toHexString.es.js +7 -6
- package/dist/utilities/color/toHexString.es.js.map +1 -1
- package/dist/utilities/color/toRgbaString.es.js +7 -6
- package/dist/utilities/color/toRgbaString.es.js.map +1 -1
- package/dist/utilities/color/toShortRgba.es.js +18 -11
- package/dist/utilities/color/toShortRgba.es.js.map +1 -1
- package/dist/utilities/react/getBackgroundColorStyles.es.js +7 -8
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js +12 -11
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/dist/utilities/react/getRadiusStyles.es.js +7 -8
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
- package/dist/utilities/react/joinClassNames.es.js +6 -5
- package/dist/utilities/react/joinClassNames.es.js.map +1 -1
- package/package.json +7 -9
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +0 -64
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +0 -65
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +0 -72
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +0 -7
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/PageLink.es.js +0 -69
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/PageLinks.es.js +0 -38
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/SectionLink.es.js +0 -26
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +0 -1
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +0 -5
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floatingButtonStore.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createStore } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle } from '../../types';\n\nexport type FloatingButtonMode = '' | 'insert' | 'edit';\n\nexport const floatingButtonStore: any = createStore('floatingButton')({\n openEditorId: null as null | string,\n mouseDown: false,\n updated: false,\n url: '',\n text: '',\n buttonStyle: 'primary' as RichTextButtonStyle,\n newTab: false,\n mode: '' as FloatingButtonMode,\n isEditing: false,\n})\n .extendActions((set) => ({\n reset: () => {\n set.url('');\n set.text('');\n set.buttonStyle('primary');\n set.newTab(false);\n set.mode('');\n set.isEditing(false);\n },\n }))\n .extendActions((set) => ({\n show: (mode: FloatingButtonMode, editorId: string) => {\n set.mode(mode);\n set.isEditing(false);\n set.openEditorId(editorId);\n },\n hide: () => {\n set.reset();\n set.openEditorId(null);\n },\n }))\n .extendSelectors((state) => ({\n isOpen: (editorId: string) => state.openEditorId === editorId,\n }));\n\nexport const floatingButtonActions = floatingButtonStore.set;\nexport const floatingButtonSelectors = floatingButtonStore.get;\n// oxlint-disable-next-line typescript/no-unsafe-return\nexport const useFloatingButtonSelectors = () => floatingButtonStore.use;\n"],"
|
|
1
|
+
{"version":3,"file":"floatingButtonStore.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createStore } from '@frontify/fondue/rte';\n\nimport { type RichTextButtonStyle } from '../../types';\n\nexport type FloatingButtonMode = '' | 'insert' | 'edit';\n\nexport const floatingButtonStore: any = createStore('floatingButton')({\n openEditorId: null as null | string,\n mouseDown: false,\n updated: false,\n url: '',\n text: '',\n buttonStyle: 'primary' as RichTextButtonStyle,\n newTab: false,\n mode: '' as FloatingButtonMode,\n isEditing: false,\n})\n .extendActions((set) => ({\n reset: () => {\n set.url('');\n set.text('');\n set.buttonStyle('primary');\n set.newTab(false);\n set.mode('');\n set.isEditing(false);\n },\n }))\n .extendActions((set) => ({\n show: (mode: FloatingButtonMode, editorId: string) => {\n set.mode(mode);\n set.isEditing(false);\n set.openEditorId(editorId);\n },\n hide: () => {\n set.reset();\n set.openEditorId(null);\n },\n }))\n .extendSelectors((state) => ({\n isOpen: (editorId: string) => state.openEditorId === editorId,\n }));\n\nexport const floatingButtonActions = floatingButtonStore.set;\nexport const floatingButtonSelectors = floatingButtonStore.get;\n// oxlint-disable-next-line typescript/no-unsafe-return\nexport const useFloatingButtonSelectors = () => floatingButtonStore.use;\n"],"mappings":";;AAQA,IAAa,IAA2B,EAAY,gBAAgB,CAAC,CAAC;CAClE,cAAc;CACd,WAAW;CACX,SAAS;CACT,KAAK;CACL,MAAM;CACN,aAAa;CACb,QAAQ;CACR,MAAM;CACN,WAAW;AACf,CAAC,CAAC,CACG,eAAe,OAAS,EACrB,aAAa;CAMT,AALA,EAAI,IAAI,EAAE,GACV,EAAI,KAAK,EAAE,GACX,EAAI,YAAY,SAAS,GACzB,EAAI,OAAO,EAAK,GAChB,EAAI,KAAK,EAAE,GACX,EAAI,UAAU,EAAK;AACvB,EACJ,EAAE,CAAC,CACF,eAAe,OAAS;CACrB,OAAO,GAA0B,MAAqB;EAGlD,AAFA,EAAI,KAAK,CAAI,GACb,EAAI,UAAU,EAAK,GACnB,EAAI,aAAa,CAAQ;CAC7B;CACA,YAAY;EAER,AADA,EAAI,MAAM,GACV,EAAI,aAAa,IAAI;CACzB;AACJ,EAAE,CAAC,CACF,iBAAiB,OAAW,EACzB,SAAS,MAAqB,EAAM,iBAAiB,EACzD,EAAE,GAEO,IAAwB,EAAoB,KAC5C,IAA0B,EAAoB,KAE9C,UAAmC,EAAoB"}
|
|
@@ -1,54 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
[]
|
|
46
|
-
), U(), V(), {
|
|
47
|
-
style: B,
|
|
48
|
-
ref: k(E)
|
|
49
|
-
};
|
|
1
|
+
import { floatingButtonActions as e, floatingButtonSelectors as t, useFloatingButtonSelectors as n } from "./floatingButtonStore.es.js";
|
|
2
|
+
import { getUrlFromEditor as r } from "../../utils/getUrl.es.js";
|
|
3
|
+
import { triggerFloatingButtonEdit as i } from "../../utils/triggerFloatingButtonEdit.es.js";
|
|
4
|
+
import { ELEMENT_BUTTON as a } from "../../createButtonPlugin.es.js";
|
|
5
|
+
import { useFloatingButtonEnter as o } from "./useFloatingButtonEnter.es.js";
|
|
6
|
+
import { useFloatingButtonEscape as s } from "./useFloatingButtonEscape.es.js";
|
|
7
|
+
import { useVirtualFloatingButton as c } from "./useVirtualFloatingButton.es.js";
|
|
8
|
+
import { useCallback as l, useEffect as u } from "react";
|
|
9
|
+
import { getAboveNode as d, getDefaultBoundingClientRect as f, getEndPoint as p, getPluginOptions as m, getPluginType as h, getRangeBoundingClientRect as g, getStartPoint as _, someNode as v, useComposedRef as y, useEditorRef as b, useEditorVersion as x, useHotkeys as S } from "@frontify/fondue/rte";
|
|
10
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts
|
|
11
|
+
var C = (C) => {
|
|
12
|
+
let w = b(), T = n().mode(), E = n().isOpen(w.id), D = x(), { triggerFloatingButtonHotkeys: O } = m(w, a), k = l(() => {
|
|
13
|
+
let e = d(w, { match: { type: h(w, a) } });
|
|
14
|
+
if (e) {
|
|
15
|
+
let [, t] = e;
|
|
16
|
+
return g(w, {
|
|
17
|
+
anchor: _(w, t),
|
|
18
|
+
focus: p(w, t)
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return f();
|
|
22
|
+
}, [w]), { update: A, style: j, floating: M } = c({
|
|
23
|
+
open: E && T === "edit",
|
|
24
|
+
getBoundingClientRect: k,
|
|
25
|
+
...C
|
|
26
|
+
});
|
|
27
|
+
return u(() => {
|
|
28
|
+
let n = r(w);
|
|
29
|
+
if (n && e.url(n), w.selection && v(w, { match: { type: h(w, "button") } })) {
|
|
30
|
+
e.show("edit", w.id), A();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
t.mode() === "edit" && e.reset();
|
|
34
|
+
}, [
|
|
35
|
+
w,
|
|
36
|
+
D,
|
|
37
|
+
A
|
|
38
|
+
]), S(O, (e) => {
|
|
39
|
+
e.preventDefault(), t.mode() === "edit" && i(w);
|
|
40
|
+
}, { enableOnContentEditable: !0 }, []), o(), s(), {
|
|
41
|
+
style: j,
|
|
42
|
+
ref: y(M)
|
|
43
|
+
};
|
|
50
44
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=useFloatingButtonEdit.es.js.map
|
|
45
|
+
//#endregion
|
|
46
|
+
export { C as useFloatingButtonEdit };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=useFloatingButtonEdit.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingButtonEdit.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getAboveNode,\n getDefaultBoundingClientRect,\n getEndPoint,\n getPluginOptions,\n getPluginType,\n getRangeBoundingClientRect,\n getStartPoint,\n someNode,\n useComposedRef,\n useEditorRef,\n useEditorVersion,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useCallback, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { getUrlFromEditor } from '../../utils';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\n\nimport {\n floatingButtonActions,\n floatingButtonSelectors,\n useFloatingButtonEnter,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonEdit = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n const version = useEditorVersion();\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n const getBoundingClientRect = useCallback(() => {\n const entry = getAboveNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n return getRangeBoundingClientRect(editor, {\n anchor: getStartPoint(editor, path),\n focus: getEndPoint(editor, path),\n });\n }\n\n return getDefaultBoundingClientRect();\n }, [editor]);\n\n const isOpen = open && mode === 'edit';\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: isOpen,\n getBoundingClientRect,\n ...floatingOptions,\n });\n\n useEffect(() => {\n const url = getUrlFromEditor(editor);\n if (url) {\n floatingButtonActions.url(url);\n }\n\n if (\n editor.selection &&\n someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n })\n ) {\n floatingButtonActions.show('edit', editor.id);\n update();\n return;\n }\n\n if (floatingButtonSelectors.mode() === 'edit') {\n floatingButtonActions.reset();\n }\n }, [editor, version, update]);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n }\n },\n {\n enableOnContentEditable: true,\n },\n [],\n );\n\n useFloatingButtonEnter();\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useFloatingButtonEdit.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getAboveNode,\n getDefaultBoundingClientRect,\n getEndPoint,\n getPluginOptions,\n getPluginType,\n getRangeBoundingClientRect,\n getStartPoint,\n someNode,\n useComposedRef,\n useEditorRef,\n useEditorVersion,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useCallback, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { getUrlFromEditor } from '../../utils';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\n\nimport {\n floatingButtonActions,\n floatingButtonSelectors,\n useFloatingButtonEnter,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonEdit = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n const version = useEditorVersion();\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n const getBoundingClientRect = useCallback(() => {\n const entry = getAboveNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n return getRangeBoundingClientRect(editor, {\n anchor: getStartPoint(editor, path),\n focus: getEndPoint(editor, path),\n });\n }\n\n return getDefaultBoundingClientRect();\n }, [editor]);\n\n const isOpen = open && mode === 'edit';\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: isOpen,\n getBoundingClientRect,\n ...floatingOptions,\n });\n\n useEffect(() => {\n const url = getUrlFromEditor(editor);\n if (url) {\n floatingButtonActions.url(url);\n }\n\n if (\n editor.selection &&\n someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n })\n ) {\n floatingButtonActions.show('edit', editor.id);\n update();\n return;\n }\n\n if (floatingButtonSelectors.mode() === 'edit') {\n floatingButtonActions.reset();\n }\n }, [editor, version, update]);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n }\n },\n {\n enableOnContentEditable: true,\n },\n [],\n );\n\n useFloatingButtonEnter();\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"mappings":";;;;;;;;;;AAgCA,IAAa,KACT,MACsE;CACtE,IAAM,IAAS,EAAa,GACtB,IAAO,EAA2B,CAAC,CAAC,KAAK,GACzC,IAAO,EAA2B,CAAC,CAAC,OAAO,EAAO,EAAE,GACpD,IAAU,EAAiB,GAE3B,EAAE,oCAAiC,EAA+B,GAAQ,CAAc,GAExF,IAAwB,QAAkB;EAC5C,IAAM,IAAQ,EAAa,GAAQ,EAC/B,OAAO,EAAE,MAAM,EAAc,GAAQ,CAAc,EAAE,EACzD,CAAC;EAED,IAAI,GAAO;GACP,IAAM,GAAG,KAAQ;GACjB,OAAO,EAA2B,GAAQ;IACtC,QAAQ,EAAc,GAAQ,CAAI;IAClC,OAAO,EAAY,GAAQ,CAAI;GACnC,CAAC;EACL;EAEA,OAAO,EAA6B;CACxC,GAAG,CAAC,CAAM,CAAC,GAIL,EAAE,WAAQ,UAAO,gBAAa,EAAyB;EACzD,MAHW,KAAQ,MAAS;EAI5B;EACA,GAAG;CACP,CAAC;CA2CD,OAzCA,QAAgB;EACZ,IAAM,IAAM,EAAiB,CAAM;EAKnC,IAJI,KACA,EAAsB,IAAI,CAAG,GAI7B,EAAO,aACP,EAAS,GAAQ,EACb,OAAO,EAAE,MAAM,EAAc,GAAA,QAAsB,EAAE,EACzD,CAAC,GACH;GAEE,AADA,EAAsB,KAAK,QAAQ,EAAO,EAAE,GAC5C,EAAO;GACP;EACJ;EAEA,AAAI,EAAwB,KAAK,MAAM,UACnC,EAAsB,MAAM;CAEpC,GAAG;EAAC;EAAQ;EAAS;CAAM,CAAC,GAE5B,EACI,IACC,MAAM;EAGH,AAFA,EAAE,eAAe,GAEb,EAAwB,KAAK,MAAM,UACnC,EAA0B,CAAM;CAExC,GACA,EACI,yBAAyB,GAC7B,GACA,CAAC,CACL,GAEA,EAAuB,GAEvB,EAAwB,GAEjB;EACH;EACA,KAAK,EAAmC,CAAQ;CACpD;AACJ"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
enableOnFormTags: ["INPUT"]
|
|
12
|
-
},
|
|
13
|
-
[]
|
|
14
|
-
);
|
|
1
|
+
import { submitFloatingButton as e } from "../../transforms/submitFloatingButton.es.js";
|
|
2
|
+
import { useEditorRef as t, useHotkeys as n } from "@frontify/fondue/rte";
|
|
3
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts
|
|
4
|
+
var r = () => {
|
|
5
|
+
let r = t();
|
|
6
|
+
n("*", (t) => {
|
|
7
|
+
t.key === "Enter" && e(r) && t.preventDefault();
|
|
8
|
+
}, { enableOnFormTags: ["INPUT"] }, []);
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=useFloatingButtonEnter.es.js.map
|
|
10
|
+
//#endregion
|
|
11
|
+
export { r as useFloatingButtonEnter };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=useFloatingButtonEnter.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingButtonEnter.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { submitFloatingButton } from '../../transforms/submitFloatingButton';\n\nexport const useFloatingButtonEnter = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n '*',\n (e) => {\n if (e.key === 'Enter' && submitFloatingButton(editor)) {\n e.preventDefault();\n }\n },\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useFloatingButtonEnter.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { submitFloatingButton } from '../../transforms/submitFloatingButton';\n\nexport const useFloatingButtonEnter = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n '*',\n (e) => {\n if (e.key === 'Enter' && submitFloatingButton(editor)) {\n e.preventDefault();\n }\n },\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n};\n"],"mappings":";;;AAMA,IAAa,UAA+B;CACxC,IAAM,IAAS,EAAa;CAE5B,EACI,MACC,MAAM;EACH,AAAI,EAAE,QAAQ,WAAW,EAAqB,CAAM,KAChD,EAAE,eAAe;CAEzB,GACA,EACI,kBAAkB,CAAC,OAAO,EAC9B,GACA,CAAC,CACL;AACJ"}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
enableOnContentEditable: !0
|
|
19
|
-
},
|
|
20
|
-
[]
|
|
21
|
-
);
|
|
1
|
+
import { floatingButtonActions as e, floatingButtonSelectors as t } from "./floatingButtonStore.es.js";
|
|
2
|
+
import { focusEditor as n, useEditorRef as r, useHotkeys as i } from "@frontify/fondue/rte";
|
|
3
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts
|
|
4
|
+
var a = () => {
|
|
5
|
+
let a = r();
|
|
6
|
+
i("escape", () => {
|
|
7
|
+
if (t.mode() === "edit") {
|
|
8
|
+
if (t.isEditing()) {
|
|
9
|
+
e.show("edit", a.id), n(a, a.selection ?? void 0);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
e.reset();
|
|
13
|
+
}
|
|
14
|
+
}, {
|
|
15
|
+
enableOnFormTags: ["INPUT"],
|
|
16
|
+
enableOnContentEditable: !0
|
|
17
|
+
}, []);
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=useFloatingButtonEscape.es.js.map
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as useFloatingButtonEscape };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=useFloatingButtonEscape.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingButtonEscape.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { focusEditor, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from './floatingButtonStore';\n\nexport const useFloatingButtonEscape = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n 'escape',\n () => {\n if (floatingButtonSelectors.mode() !== 'edit') {\n return;\n }\n\n if (floatingButtonSelectors.isEditing()) {\n floatingButtonActions.show('edit', editor.id);\n focusEditor(editor, editor.selection ?? undefined);\n return;\n }\n\n floatingButtonActions.reset();\n },\n {\n enableOnFormTags: ['INPUT'],\n enableOnContentEditable: true,\n },\n [],\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useFloatingButtonEscape.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { focusEditor, useEditorRef, useHotkeys } from '@frontify/fondue/rte';\n\nimport { floatingButtonActions, floatingButtonSelectors } from './floatingButtonStore';\n\nexport const useFloatingButtonEscape = () => {\n const editor = useEditorRef();\n\n useHotkeys(\n 'escape',\n () => {\n if (floatingButtonSelectors.mode() !== 'edit') {\n return;\n }\n\n if (floatingButtonSelectors.isEditing()) {\n floatingButtonActions.show('edit', editor.id);\n focusEditor(editor, editor.selection ?? undefined);\n return;\n }\n\n floatingButtonActions.reset();\n },\n {\n enableOnFormTags: ['INPUT'],\n enableOnContentEditable: true,\n },\n [],\n );\n};\n"],"mappings":";;;AAMA,IAAa,UAAgC;CACzC,IAAM,IAAS,EAAa;CAE5B,EACI,gBACM;EACE,MAAwB,KAAK,MAAM,QAIvC;OAAI,EAAwB,UAAU,GAAG;IAErC,AADA,EAAsB,KAAK,QAAQ,EAAO,EAAE,GAC5C,EAAY,GAAQ,EAAO,aAAa,KAAA,CAAS;IACjD;GACJ;GAEA,EAAsB,MAAM;EAF5B;CAGJ,GACA;EACI,kBAAkB,CAAC,OAAO;EAC1B,yBAAyB;CAC7B,GACA,CAAC,CACL;AACJ"}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ELEMENT_BUTTON as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
...r
|
|
27
|
-
});
|
|
28
|
-
return E(() => {
|
|
29
|
-
t && n(), O.updated(t);
|
|
30
|
-
}, [t, n]), y(), {
|
|
31
|
-
style: l,
|
|
32
|
-
ref: a(g)
|
|
33
|
-
};
|
|
1
|
+
import { floatingButtonActions as e, useFloatingButtonSelectors as t } from "./floatingButtonStore.es.js";
|
|
2
|
+
import { triggerFloatingButtonInsert as n } from "../../utils/triggerFloatingButtonInsert.es.js";
|
|
3
|
+
import { ELEMENT_BUTTON as r } from "../../createButtonPlugin.es.js";
|
|
4
|
+
import { useFloatingButtonEscape as i } from "./useFloatingButtonEscape.es.js";
|
|
5
|
+
import { useVirtualFloatingButton as a } from "./useVirtualFloatingButton.es.js";
|
|
6
|
+
import { useEffect as o } from "react";
|
|
7
|
+
import { getPluginOptions as s, getSelectionBoundingClientRect as c, useComposedRef as l, useEditorRef as u, useFocused as d, useHotkeys as f } from "@frontify/fondue/rte";
|
|
8
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts
|
|
9
|
+
var p = (p) => {
|
|
10
|
+
let m = u(), h = d(), g = t().mode(), _ = t().isOpen(m.id), { triggerFloatingButtonHotkeys: v } = s(m, r);
|
|
11
|
+
f(v, (e) => {
|
|
12
|
+
e.preventDefault(), n(m, { focused: h });
|
|
13
|
+
}, { enableOnContentEditable: !0 }, [h]);
|
|
14
|
+
let { update: y, style: b, floating: x } = a({
|
|
15
|
+
open: _ && g === "insert",
|
|
16
|
+
getBoundingClientRect: c,
|
|
17
|
+
whileElementsMounted: void 0,
|
|
18
|
+
...p
|
|
19
|
+
});
|
|
20
|
+
return o(() => {
|
|
21
|
+
_ && y(), e.updated(_);
|
|
22
|
+
}, [_, y]), i(), {
|
|
23
|
+
style: b,
|
|
24
|
+
ref: l(x)
|
|
25
|
+
};
|
|
34
26
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=useFloatingButtonInsert.es.js.map
|
|
27
|
+
//#endregion
|
|
28
|
+
export { p as useFloatingButtonInsert };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=useFloatingButtonInsert.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingButtonInsert.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n useComposedRef,\n useEditorRef,\n useFocused,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { triggerFloatingButtonInsert } from '../../utils/triggerFloatingButtonInsert';\n\nimport {\n floatingButtonActions,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonInsert = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const focused = useFocused();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n },\n {\n enableOnContentEditable: true,\n },\n [focused],\n );\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: open && mode === 'insert',\n getBoundingClientRect: getSelectionBoundingClientRect,\n whileElementsMounted: undefined,\n ...floatingOptions,\n });\n\n // wait for update before focusing input\n useEffect(() => {\n if (open) {\n update();\n }\n floatingButtonActions.updated(open);\n }, [open, update]);\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"
|
|
1
|
+
{"version":3,"file":"useFloatingButtonInsert.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type UseVirtualFloatingOptions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n useComposedRef,\n useEditorRef,\n useFocused,\n useHotkeys,\n} from '@frontify/fondue/rte';\nimport { type Ref, useEffect } from 'react';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { triggerFloatingButtonInsert } from '../../utils/triggerFloatingButtonInsert';\n\nimport {\n floatingButtonActions,\n useFloatingButtonEscape,\n useFloatingButtonSelectors,\n useVirtualFloatingButton,\n} from '.';\n\nexport const useFloatingButtonInsert = (\n floatingOptions: UseVirtualFloatingOptions,\n): React.HTMLAttributes<HTMLDivElement> & { ref: Ref<HTMLDivElement> } => {\n const editor = useEditorRef();\n const focused = useFocused();\n const mode = useFloatingButtonSelectors().mode();\n const open = useFloatingButtonSelectors().isOpen(editor.id);\n\n const { triggerFloatingButtonHotkeys } = getPluginOptions<ButtonPlugin>(editor, ELEMENT_BUTTON);\n\n useHotkeys(\n triggerFloatingButtonHotkeys,\n (e) => {\n e.preventDefault();\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n },\n {\n enableOnContentEditable: true,\n },\n [focused],\n );\n\n const { update, style, floating } = useVirtualFloatingButton({\n open: open && mode === 'insert',\n getBoundingClientRect: getSelectionBoundingClientRect,\n whileElementsMounted: undefined,\n ...floatingOptions,\n });\n\n // wait for update before focusing input\n useEffect(() => {\n if (open) {\n update();\n }\n floatingButtonActions.updated(open);\n }, [open, update]);\n\n useFloatingButtonEscape();\n\n return {\n style,\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"mappings":";;;;;;;;AAuBA,IAAa,KACT,MACsE;CACtE,IAAM,IAAS,EAAa,GACtB,IAAU,EAAW,GACrB,IAAO,EAA2B,CAAC,CAAC,KAAK,GACzC,IAAO,EAA2B,CAAC,CAAC,OAAO,EAAO,EAAE,GAEpD,EAAE,oCAAiC,EAA+B,GAAQ,CAAc;CAE9F,EACI,IACC,MAAM;EAGH,AAFA,EAAE,eAAe,GAEjB,EAA4B,GAAQ,EAChC,WACJ,CAAC;CACL,GACA,EACI,yBAAyB,GAC7B,GACA,CAAC,CAAO,CACZ;CAEA,IAAM,EAAE,WAAQ,UAAO,gBAAa,EAAyB;EACzD,MAAM,KAAQ,MAAS;EACvB,uBAAuB;EACvB,sBAAsB,KAAA;EACtB,GAAG;CACP,CAAC;CAYD,OATA,QAAgB;EAIZ,AAHI,KACA,EAAO,GAEX,EAAsB,QAAQ,CAAI;CACtC,GAAG,CAAC,GAAM,CAAM,CAAC,GAEjB,EAAwB,GAEjB;EACH;EACA,KAAK,EAAmC,CAAQ;CACpD;AACJ"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
padding: e
|
|
11
|
-
})
|
|
12
|
-
],
|
|
13
|
-
...t
|
|
1
|
+
import { flip as e, offset as t, useVirtualFloating as n } from "@frontify/fondue/rte";
|
|
2
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts
|
|
3
|
+
var r = 12, i = -22, a = 96, o = (o) => n({
|
|
4
|
+
placement: "bottom-start",
|
|
5
|
+
middleware: [t({
|
|
6
|
+
mainAxis: r,
|
|
7
|
+
alignmentAxis: i
|
|
8
|
+
}), e({ padding: a })],
|
|
9
|
+
...o
|
|
14
10
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=useVirtualFloatingButton.es.js.map
|
|
11
|
+
//#endregion
|
|
12
|
+
export { o as useVirtualFloatingButton };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=useVirtualFloatingButton.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVirtualFloatingButton.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type UseVirtualFloatingOptions, flip, offset, useVirtualFloating } from '@frontify/fondue/rte';\nimport { type CSSProperties, type Ref } from 'react';\n\nconst OFFSET_Y = 12;\nconst OFFSET_X = -22;\nconst PADDING = 96;\n\nexport const useVirtualFloatingButton = (\n floatingOptions?: UseVirtualFloatingOptions,\n): { style: CSSProperties; update: () => void; floating: Ref<HTMLDivElement> } =>\n useVirtualFloating({\n placement: 'bottom-start',\n middleware: [\n offset({\n mainAxis: OFFSET_Y,\n alignmentAxis: OFFSET_X,\n }),\n flip({\n padding: PADDING,\n }),\n ],\n ...floatingOptions,\n });\n"],"
|
|
1
|
+
{"version":3,"file":"useVirtualFloatingButton.es.js","names":[],"sources":["../../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type UseVirtualFloatingOptions, flip, offset, useVirtualFloating } from '@frontify/fondue/rte';\nimport { type CSSProperties, type Ref } from 'react';\n\nconst OFFSET_Y = 12;\nconst OFFSET_X = -22;\nconst PADDING = 96;\n\nexport const useVirtualFloatingButton = (\n floatingOptions?: UseVirtualFloatingOptions,\n): { style: CSSProperties; update: () => void; floating: Ref<HTMLDivElement> } =>\n useVirtualFloating({\n placement: 'bottom-start',\n middleware: [\n offset({\n mainAxis: OFFSET_Y,\n alignmentAxis: OFFSET_X,\n }),\n flip({\n padding: PADDING,\n }),\n ],\n ...floatingOptions,\n });\n"],"mappings":";;AAKA,IAAM,IAAW,IACX,IAAW,KACX,IAAU,IAEH,KACT,MAEA,EAAmB;CACf,WAAW;CACX,YAAY,CACR,EAAO;EACH,UAAU;EACV,eAAe;CACnB,CAAC,GACD,EAAK,EACD,SAAS,EACb,CAAC,CACL;CACA,GAAG;AACP,CAAC"}
|
|
@@ -1,63 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
plugins() {
|
|
54
|
-
return [B(this.appBridge)];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
d as BUTTON_PLUGIN,
|
|
59
|
-
y as ButtonPlugin,
|
|
60
|
-
g as ELEMENT_BUTTON,
|
|
61
|
-
B as createButtonPlugin
|
|
1
|
+
import { isValidUrl as e } from "../../../Link/utils/url.es.js";
|
|
2
|
+
import { withButton as t } from "./withButton.es.js";
|
|
3
|
+
import { BlockButtonStyles as n } from "./utils/styles.es.js";
|
|
4
|
+
import { ButtonMarkupElement as r } from "./ButtonMarkupElement/index.es.js";
|
|
5
|
+
import { ButtonButton as i } from "./components/ButtonButton.es.js";
|
|
6
|
+
import { CustomFloatingButton as a } from "./components/FloatingButton/CustomFloatingButton.es.js";
|
|
7
|
+
import { Plugin as o, createPluginFactory as s } from "@frontify/fondue/rte";
|
|
8
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts
|
|
9
|
+
var c = "button", l = "button-plugin", u = (n) => s({
|
|
10
|
+
key: c,
|
|
11
|
+
isElement: !0,
|
|
12
|
+
isInline: !0,
|
|
13
|
+
props: ({ element: e }) => ({ nodeProps: {
|
|
14
|
+
href: e?.url,
|
|
15
|
+
target: e?.target
|
|
16
|
+
} }),
|
|
17
|
+
withOverrides: t,
|
|
18
|
+
renderAfterEditable: a,
|
|
19
|
+
options: {
|
|
20
|
+
isUrl: e,
|
|
21
|
+
rangeBeforeOptions: {
|
|
22
|
+
matchString: " ",
|
|
23
|
+
skipInvalid: !0,
|
|
24
|
+
afterMatch: !0
|
|
25
|
+
},
|
|
26
|
+
triggerFloatingButtonHotkeys: "command+shift+k, ctrl+shift+k",
|
|
27
|
+
appBridge: n
|
|
28
|
+
},
|
|
29
|
+
then: (e, { type: t }) => ({ deserializeHtml: {
|
|
30
|
+
rules: [{
|
|
31
|
+
validNodeName: "A",
|
|
32
|
+
validClassName: "btn"
|
|
33
|
+
}],
|
|
34
|
+
getNode: (e) => ({
|
|
35
|
+
type: t,
|
|
36
|
+
url: e.getAttribute("href"),
|
|
37
|
+
target: e.getAttribute("target") || "_blank"
|
|
38
|
+
})
|
|
39
|
+
} })
|
|
40
|
+
})(), d = class extends o {
|
|
41
|
+
styles = {};
|
|
42
|
+
appBridge;
|
|
43
|
+
constructor({ styles: e = n, ...t }) {
|
|
44
|
+
super(l, {
|
|
45
|
+
button: i,
|
|
46
|
+
markupElement: new r(),
|
|
47
|
+
...t
|
|
48
|
+
}), this.styles = e, this.appBridge = t?.appBridge;
|
|
49
|
+
}
|
|
50
|
+
plugins() {
|
|
51
|
+
return [u(this.appBridge)];
|
|
52
|
+
}
|
|
62
53
|
};
|
|
63
|
-
//#
|
|
54
|
+
//#endregion
|
|
55
|
+
export { l as BUTTON_PLUGIN, d as ButtonPlugin, c as ELEMENT_BUTTON, u as createButtonPlugin };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=createButtonPlugin.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createButtonPlugin.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"createButtonPlugin.es.js","names":[],"sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n type PlatePlugin,\n Plugin,\n type PluginProps,\n type RangeBeforeOptions,\n createPluginFactory,\n} from '@frontify/fondue/rte';\nimport { type CSSProperties } from 'react';\n\nimport { isValidUrl } from '../../../Link/utils/url';\n\nimport { ButtonMarkupElement } from './ButtonMarkupElement';\nimport { ButtonButton } from './components/ButtonButton';\nimport { CustomFloatingButton } from './components/FloatingButton/CustomFloatingButton';\nimport { BlockButtonStyles } from './utils';\nimport { withButton } from './withButton';\n\nexport const ELEMENT_BUTTON = 'button';\nexport const BUTTON_PLUGIN = 'button-plugin';\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging\nexport interface ButtonPlugin {\n forceSubmit?: boolean;\n\n /**\n * Allow custom config for rangeBeforeOptions.\n * @example default\n * {\n * matchString: ' ',\n * skipInvalid: true,\n * afterMatch: true,\n * }\n */\n rangeBeforeOptions?: RangeBeforeOptions;\n\n /**\n * Hotkeys to trigger floating button.\n * @default 'command+k, ctrl+k'\n */\n triggerFloatingButtonHotkeys: string;\n\n /**\n * Callback to validate an url.\n * @default isUrl\n */\n isUrl: (text: string) => boolean;\n\n /**\n * Callback to optionally get the href for a url\n * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com)\n */\n getUrlHref?: (url: string) => string | undefined;\n\n /**\n * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The\n * default behavior is to use the browser's native `prompt`.\n */\n getLinkUrl?: (prevUrl: string | null) => Promise<string | null>;\n}\n\n/**\n * Enables support for hyperlinks.\n */\nexport const createButtonPlugin = (appBridge: AppBridgeBlock): PlatePlugin =>\n createPluginFactory({\n key: ELEMENT_BUTTON,\n isElement: true,\n isInline: true,\n props: ({ element }) => ({\n nodeProps: { href: element?.url, target: element?.target },\n }),\n withOverrides: withButton,\n renderAfterEditable: CustomFloatingButton,\n options: {\n isUrl: isValidUrl,\n rangeBeforeOptions: {\n matchString: ' ',\n skipInvalid: true,\n afterMatch: true,\n },\n triggerFloatingButtonHotkeys: 'command+shift+k, ctrl+shift+k',\n appBridge,\n },\n then: (_editor, { type }) => ({\n deserializeHtml: {\n rules: [\n {\n validNodeName: 'A',\n validClassName: 'btn',\n },\n ],\n getNode: (el) => ({\n type,\n url: el.getAttribute('href'),\n target: el.getAttribute('target') || '_blank',\n }),\n },\n }),\n })();\n\nexport type ButtonPluginProps = Omit<PluginProps, 'styles'> & {\n styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;\n} & { appBridge: AppBridgeBlock };\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging\nexport class ButtonPlugin extends Plugin {\n public styles: CSSProperties = {};\n private appBridge: AppBridgeBlock;\n constructor({ styles = BlockButtonStyles, ...props }: ButtonPluginProps) {\n super(BUTTON_PLUGIN, {\n button: ButtonButton,\n markupElement: new ButtonMarkupElement(),\n ...props,\n });\n this.styles = styles;\n this.appBridge = props?.appBridge;\n }\n\n plugins() {\n return [createButtonPlugin(this.appBridge)];\n }\n}\n"],"mappings":";;;;;;;;AAoBA,IAAa,IAAiB,UACjB,IAAgB,iBA6ChB,KAAsB,MAC/B,EAAoB;CAChB,KAAK;CACL,WAAW;CACX,UAAU;CACV,QAAQ,EAAE,kBAAe,EACrB,WAAW;EAAE,MAAM,GAAS;EAAK,QAAQ,GAAS;CAAO,EAC7D;CACA,eAAe;CACf,qBAAqB;CACrB,SAAS;EACL,OAAO;EACP,oBAAoB;GAChB,aAAa;GACb,aAAa;GACb,YAAY;EAChB;EACA,8BAA8B;EAC9B;CACJ;CACA,OAAO,GAAS,EAAE,eAAY,EAC1B,iBAAiB;EACb,OAAO,CACH;GACI,eAAe;GACf,gBAAgB;EACpB,CACJ;EACA,UAAU,OAAQ;GACd;GACA,KAAK,EAAG,aAAa,MAAM;GAC3B,QAAQ,EAAG,aAAa,QAAQ,KAAK;EACzC;CACJ,EACJ;AACJ,CAAC,CAAC,CAAC,GAOM,IAAb,cAAkC,EAAO;CACrC,SAA+B,CAAC;CAChC;CACA,YAAY,EAAE,YAAS,GAAmB,GAAG,KAA4B;EAOrE,AANA,MAAM,GAAe;GACjB,QAAQ;GACR,eAAe,IAAI,EAAoB;GACvC,GAAG;EACP,CAAC,GACD,KAAK,SAAS,GACd,KAAK,YAAY,GAAO;CAC5B;CAEA,UAAU;EACN,OAAO,CAAC,EAAmB,KAAK,SAAS,CAAC;CAC9C;AACJ"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[n(t, o)],
|
|
7
|
-
r
|
|
8
|
-
);
|
|
1
|
+
import { createButtonNode as e } from "../utils/createButtonNode.es.js";
|
|
2
|
+
import { insertNodes as t } from "@frontify/fondue/rte";
|
|
3
|
+
//#region src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts
|
|
4
|
+
var n = (n, r, i) => {
|
|
5
|
+
t(n, [e(n, r)], i);
|
|
9
6
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=insertButton.es.js.map
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as insertButton };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=insertButton.es.js.map
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type InsertNodesOptions, type PlateEditor, type TText, type Value, insertNodes } from '@frontify/fondue/rte';\n\nimport { type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions, createButtonNode } from '../utils/index';\n\nexport const insertButton = <V extends Value>(\n editor: PlateEditor<V>,\n createButtonNodeOptions: CreateButtonNodeOptions,\n options?: InsertNodesOptions<V>,\n) => {\n insertNodes<TButtonElement | TText>(\n editor,\n [createButtonNode(editor, createButtonNodeOptions)],\n options as InsertNodesOptions,\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"insertButton.es.js","names":[],"sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type InsertNodesOptions, type PlateEditor, type TText, type Value, insertNodes } from '@frontify/fondue/rte';\n\nimport { type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions, createButtonNode } from '../utils/index';\n\nexport const insertButton = <V extends Value>(\n editor: PlateEditor<V>,\n createButtonNodeOptions: CreateButtonNodeOptions,\n options?: InsertNodesOptions<V>,\n) => {\n insertNodes<TButtonElement | TText>(\n editor,\n [createButtonNode(editor, createButtonNodeOptions)],\n options as InsertNodesOptions,\n );\n};\n"],"mappings":";;;AAOA,IAAa,KACT,GACA,GACA,MACC;CACD,EACI,GACA,CAAC,EAAiB,GAAQ,CAAuB,CAAC,GAClD,CACJ;AACJ"}
|