@frontify/guideline-blocks-settings 0.28.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/_virtual/_commonjsHelpers.es.js +7 -0
- package/dist/_virtual/_commonjsHelpers.es.js.map +1 -0
- package/dist/_virtual/index.es.js +5 -0
- package/dist/_virtual/index.es.js.map +1 -0
- package/dist/_virtual/index.es2.js +5 -0
- package/dist/_virtual/index.es2.js.map +1 -0
- package/dist/_virtual/index.es3.js +5 -0
- package/dist/_virtual/index.es3.js.map +1 -0
- package/dist/_virtual/jsx-runtime.es.js +5 -0
- package/dist/_virtual/jsx-runtime.es.js.map +1 -0
- package/dist/_virtual/react-dom.development.es.js +5 -0
- package/dist/_virtual/react-dom.development.es.js.map +1 -0
- package/dist/_virtual/react-dom.production.min.es.js +5 -0
- package/dist/_virtual/react-dom.production.min.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js.map +1 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js +5 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js.map +1 -0
- package/dist/_virtual/react.development.es.js +5 -0
- package/dist/_virtual/react.development.es.js.map +1 -0
- package/dist/_virtual/react.production.min.es.js +5 -0
- package/dist/_virtual/react.production.min.es.js.map +1 -0
- package/dist/_virtual/scheduler.development.es.js +5 -0
- package/dist/_virtual/scheduler.development.es.js.map +1 -0
- package/dist/_virtual/scheduler.production.min.es.js +5 -0
- package/dist/_virtual/scheduler.production.min.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentItem.es.js +180 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +145 -0
- package/dist/components/Attachments/Attachments.es.js.map +1 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +150 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +73 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar.es.js +113 -0
- package/dist/components/BlockItemWrapper/Toolbar.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/constants.es.js +6 -0
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.es.js +39 -0
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js +42 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -0
- package/dist/components/RichTextEditor/SerializedText.es.js +13 -0
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -0
- package/dist/components/RichTextEditor/constants.es.js +5 -0
- package/dist/components/RichTextEditor/constants.es.js.map +1 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +34 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +54 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +30 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +16 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +37 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +69 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +105 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +20 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +58 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +43 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +62 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +86 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +10 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +75 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +14 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +37 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +29 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +8 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +80 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +93 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +27 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +39 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +46 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +48 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +55 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +62 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +61 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +34 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +168 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +16 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +19 -0
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +17 -0
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +15 -0
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js +12 -0
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +61 -0
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js +25 -0
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js +8 -0
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js +13 -0
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js.map +1 -0
- package/dist/helpers/addHttps.es.js +14 -0
- package/dist/helpers/addHttps.es.js.map +1 -0
- package/dist/helpers/convertToRichTextValue.es.js +6 -0
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js +32 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -0
- package/dist/helpers/hasRichTextValue.es.js +15 -0
- package/dist/helpers/hasRichTextValue.es.js.map +1 -0
- package/dist/helpers/isDownloadable.es.js +6 -0
- package/dist/helpers/isDownloadable.es.js.map +1 -0
- package/dist/helpers/mapColorPalettes.es.js +16 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +31 -0
- package/dist/hooks/useAttachments.es.js.map +1 -0
- package/dist/hooks/useDndSensors.es.js +20 -0
- package/dist/hooks/useDndSensors.es.js.map +1 -0
- package/dist/index.cjs.js +253 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +962 -0
- package/dist/index.es.js +178 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +253 -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/style.css +1 -0
- package/dist/utilities/color/getReadableColor.es.js +14 -0
- package/dist/utilities/color/getReadableColor.es.js.map +1 -0
- package/dist/utilities/color/isDark.es.js +10 -0
- package/dist/utilities/color/isDark.es.js.map +1 -0
- package/dist/utilities/color/setAlpha.es.js +6 -0
- package/dist/utilities/color/setAlpha.es.js.map +1 -0
- package/dist/utilities/color/toColorObject.es.js +9 -0
- package/dist/utilities/color/toColorObject.es.js.map +1 -0
- package/dist/utilities/color/toHex8String.es.js +7 -0
- package/dist/utilities/color/toHex8String.es.js.map +1 -0
- package/dist/utilities/color/toHexString.es.js +7 -0
- package/dist/utilities/color/toHexString.es.js.map +1 -0
- package/dist/utilities/color/toRgbaString.es.js +7 -0
- package/dist/utilities/color/toRgbaString.es.js.map +1 -0
- package/dist/utilities/color/toShortRgba.es.js +11 -0
- package/dist/utilities/color/toShortRgba.es.js.map +1 -0
- package/dist/utilities/moveItemInArray.es.js +12 -0
- package/dist/utilities/moveItemInArray.es.js.map +1 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js +8 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -0
- package/dist/utilities/react/getBorderStyles.es.js +12 -0
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -0
- package/dist/utilities/react/getRadiusStyles.es.js +8 -0
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -0
- package/dist/utilities/react/joinClassNames.es.js +5 -0
- package/dist/utilities/react/joinClassNames.es.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
buttonPrimary: {
|
|
3
|
+
fontFamily: "var(--f-theme-settings-button-primary-font-family)",
|
|
4
|
+
fontSize: "var(--f-theme-settings-button-primary-font-size)",
|
|
5
|
+
fontWeight: "var(--f-theme-settings-button-primary-font-weight)",
|
|
6
|
+
lineHeight: "var(--f-theme-settings-button-primary-line-height)",
|
|
7
|
+
paddingTop: "var(--f-theme-settings-button-primary-padding-top)",
|
|
8
|
+
paddingRight: "var(--f-theme-settings-button-primary-padding-right)",
|
|
9
|
+
paddingBottom: "var(--f-theme-settings-button-primary-padding-bottom)",
|
|
10
|
+
paddingLeft: "var(--f-theme-settings-button-primary-padding-left)",
|
|
11
|
+
fontStyle: "var(--f-theme-settings-button-primary-font-style)",
|
|
12
|
+
textTransform: "var(--f-theme-settings-button-primary-text-transform)",
|
|
13
|
+
backgroundColor: "var(--f-theme-settings-button-primary-background-color)",
|
|
14
|
+
borderColor: "var(--f-theme-settings-button-primary-border-color)",
|
|
15
|
+
borderRadius: "var(--f-theme-settings-button-primary-border-radius)",
|
|
16
|
+
borderWidth: "var(--f-theme-settings-button-primary-border-width)",
|
|
17
|
+
color: "var(--f-theme-settings-button-primary-color)",
|
|
18
|
+
display: "inline-block",
|
|
19
|
+
hover: {
|
|
20
|
+
backgroundColor: "var(--f-theme-settings-button-primary-background-color-hover)",
|
|
21
|
+
borderColor: "var(--f-theme-settings-button-primary-border-color-hover)",
|
|
22
|
+
color: "var(--f-theme-settings-button-primary-color-hover)"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
buttonSecondary: {
|
|
26
|
+
fontFamily: "var(--f-theme-settings-button-secondary-font-family)",
|
|
27
|
+
fontSize: "var(--f-theme-settings-button-secondary-font-size)",
|
|
28
|
+
fontWeight: "var(--f-theme-settings-button-secondary-font-weight)",
|
|
29
|
+
lineHeight: "var(--f-theme-settings-button-secondary-line-height)",
|
|
30
|
+
paddingTop: "var(--f-theme-settings-button-secondary-padding-top)",
|
|
31
|
+
paddingRight: "var(--f-theme-settings-button-secondary-padding-right)",
|
|
32
|
+
paddingBottom: "var(--f-theme-settings-button-secondary-padding-bottom)",
|
|
33
|
+
paddingLeft: "var(--f-theme-settings-button-secondary-padding-left)",
|
|
34
|
+
fontStyle: "var(--f-theme-settings-button-secondary-font-style)",
|
|
35
|
+
textTransform: "var(--f-theme-settings-button-secondary-text-transform)",
|
|
36
|
+
backgroundColor: "var(--f-theme-settings-button-secondary-background-color)",
|
|
37
|
+
borderColor: "var(--f-theme-settings-button-secondary-border-color)",
|
|
38
|
+
borderRadius: "var(--f-theme-settings-button-secondary-border-radius)",
|
|
39
|
+
borderWidth: "var(--f-theme-settings-button-secondary-border-width)",
|
|
40
|
+
color: "var(--f-theme-settings-button-secondary-color)",
|
|
41
|
+
display: "inline-block",
|
|
42
|
+
hover: {
|
|
43
|
+
backgroundColor: "var(--f-theme-settings-button-secondary-background-color-hover)",
|
|
44
|
+
borderColor: "var(--f-theme-settings-button-secondary-border-color-hover)",
|
|
45
|
+
color: "var(--f-theme-settings-button-secondary-color-hover)"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
buttonTertiary: {
|
|
49
|
+
fontFamily: "var(--f-theme-settings-button-tertiary-font-family)",
|
|
50
|
+
fontSize: "var(--f-theme-settings-button-tertiary-font-size)",
|
|
51
|
+
fontWeight: "var(--f-theme-settings-button-tertiary-font-weight)",
|
|
52
|
+
lineHeight: "var(--f-theme-settings-button-tertiary-line-height)",
|
|
53
|
+
paddingTop: "var(--f-theme-settings-button-tertiary-padding-top)",
|
|
54
|
+
paddingRight: "var(--f-theme-settings-button-tertiary-padding-right)",
|
|
55
|
+
paddingBottom: "var(--f-theme-settings-button-tertiary-padding-bottom)",
|
|
56
|
+
paddingLeft: "var(--f-theme-settings-button-tertiary-padding-left)",
|
|
57
|
+
fontStyle: "var(--f-theme-settings-button-tertiary-font-style)",
|
|
58
|
+
textTransform: "var(--f-theme-settings-button-tertiary-text-transform)",
|
|
59
|
+
backgroundColor: "var(--f-theme-settings-button-tertiary-background-color)",
|
|
60
|
+
borderColor: "var(--f-theme-settings-button-tertiary-border-color)",
|
|
61
|
+
borderRadius: "var(--f-theme-settings-button-tertiary-border-radius)",
|
|
62
|
+
borderWidth: "var(--f-theme-settings-button-tertiary-border-width)",
|
|
63
|
+
color: "var(--f-theme-settings-button-tertiary-color)",
|
|
64
|
+
display: "inline-block",
|
|
65
|
+
hover: {
|
|
66
|
+
backgroundColor: "var(--f-theme-settings-button-tertiary-background-color-hover)",
|
|
67
|
+
borderColor: "var(--f-theme-settings-button-tertiary-border-color-hover)",
|
|
68
|
+
color: "var(--f-theme-settings-button-tertiary-color-hover)"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
t as BlockButtonStyles
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=styles.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { CSSProperties } from 'react';\n\nexport const BlockButtonStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n buttonPrimary: {\n fontFamily: 'var(--f-theme-settings-button-primary-font-family)',\n fontSize: 'var(--f-theme-settings-button-primary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-primary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-primary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-primary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-primary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-primary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-primary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-primary-font-style)',\n textTransform: 'var(--f-theme-settings-button-primary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-primary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-primary-border-width)',\n color: 'var(--f-theme-settings-button-primary-color)',\n display: 'inline-block',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-primary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-primary-border-color-hover)',\n color: 'var(--f-theme-settings-button-primary-color-hover)',\n },\n },\n\n buttonSecondary: {\n fontFamily: 'var(--f-theme-settings-button-secondary-font-family)',\n fontSize: 'var(--f-theme-settings-button-secondary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-secondary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-secondary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-secondary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-secondary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-secondary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-secondary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-secondary-font-style)',\n textTransform: 'var(--f-theme-settings-button-secondary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-secondary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-secondary-border-width)',\n color: 'var(--f-theme-settings-button-secondary-color)',\n display: 'inline-block',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-secondary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-secondary-border-color-hover)',\n color: 'var(--f-theme-settings-button-secondary-color-hover)',\n },\n },\n\n buttonTertiary: {\n fontFamily: 'var(--f-theme-settings-button-tertiary-font-family)',\n fontSize: 'var(--f-theme-settings-button-tertiary-font-size)',\n fontWeight: 'var(--f-theme-settings-button-tertiary-font-weight)',\n lineHeight: 'var(--f-theme-settings-button-tertiary-line-height)',\n paddingTop: 'var(--f-theme-settings-button-tertiary-padding-top)',\n paddingRight: 'var(--f-theme-settings-button-tertiary-padding-right)',\n paddingBottom: 'var(--f-theme-settings-button-tertiary-padding-bottom)',\n paddingLeft: 'var(--f-theme-settings-button-tertiary-padding-left)',\n fontStyle: 'var(--f-theme-settings-button-tertiary-font-style)',\n textTransform: 'var(--f-theme-settings-button-tertiary-text-transform)' as CSSProperties['textTransform'],\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color)',\n borderRadius: 'var(--f-theme-settings-button-tertiary-border-radius)',\n borderWidth: 'var(--f-theme-settings-button-tertiary-border-width)',\n color: 'var(--f-theme-settings-button-tertiary-color)',\n display: 'inline-block',\n hover: {\n backgroundColor: 'var(--f-theme-settings-button-tertiary-background-color-hover)',\n borderColor: 'var(--f-theme-settings-button-tertiary-border-color-hover)',\n color: 'var(--f-theme-settings-button-tertiary-color-hover)',\n },\n },\n};\n"],"names":["BlockButtonStyles"],"mappings":"AAIO,MAAMA,IAA+E;AAAA,EACxF,eAAe;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,MACH,iBAAiB;AAAA,MACjB,aAAa;AAAA,MACb,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEA,iBAAiB;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,MACH,iBAAiB;AAAA,MACjB,aAAa;AAAA,MACb,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEA,gBAAgB;AAAA,IACZ,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,eAAe;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,MACH,iBAAiB;AAAA,MACjB,aAAa;AAAA,MACb,OAAO;AAAA,IACX;AAAA,EACJ;AACJ;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { triggerFloatingButtonEdit as r } from "./triggerFloatingButtonEdit.es.js";
|
|
2
|
+
import { triggerFloatingButtonInsert as i } from "./triggerFloatingButtonInsert.es.js";
|
|
3
|
+
import { floatingButtonSelectors as n } from "../components/FloatingButton/floatingButtonStore.es.js";
|
|
4
|
+
const f = (t, {
|
|
5
|
+
focused: o
|
|
6
|
+
} = {}) => {
|
|
7
|
+
if (n.mode() === "edit") {
|
|
8
|
+
r(t);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
i(t, {
|
|
12
|
+
focused: o
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
f as triggerFloatingButton
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=triggerFloatingButton.es.js.map
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value } from '@udecode/plate';\nimport { floatingButtonSelectors } from '../components';\nimport { triggerFloatingButtonEdit, triggerFloatingButtonInsert } from '.';\n\nexport const triggerFloatingButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {}\n) => {\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n return;\n }\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n};\n"],"names":["triggerFloatingButton","editor","focused","floatingButtonSelectors","triggerFloatingButtonEdit","triggerFloatingButtonInsert"],"mappings":";;;AAMa,MAAAA,IAAwB,CACjCC,GACA;AAAA,EACI,SAAAC;AACJ,IAEI,OACH;AACG,MAAAC,EAAwB,KAAK,MAAM,QAAQ;AAC3C,IAAAC,EAA0BH,CAAM;AAChC;AAAA;AAGJ,EAAAI,EAA4BJ,GAAQ;AAAA,IAChC,SAAAC;AAAA,EAAA,CACH;AACL;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findNode as g, getPluginType as l, getEditorString as u } from "@udecode/plate";
|
|
2
|
+
import { floatingButtonActions as t } from "../components/FloatingButton/floatingButtonStore.es.js";
|
|
3
|
+
import { ELEMENT_BUTTON as f } from "../createButtonPlugin.es.js";
|
|
4
|
+
const E = (i) => {
|
|
5
|
+
const o = g(i, {
|
|
6
|
+
match: { type: l(i, f) }
|
|
7
|
+
});
|
|
8
|
+
if (!o)
|
|
9
|
+
return;
|
|
10
|
+
const [r, e] = o;
|
|
11
|
+
let n = u(i, e);
|
|
12
|
+
t.url(r.url), t.newTab(r.target === void 0), n === r.url && (n = ""), t.text(n), t.isEditing(!0);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
E as triggerFloatingButtonEdit
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=triggerFloatingButtonEdit.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerFloatingButtonEdit.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, findNode, getEditorString, getPluginType } from '@udecode/plate';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\nimport { floatingButtonActions } from '../components/FloatingButton/floatingButtonStore';\n\nexport const triggerFloatingButtonEdit = <V extends Value>(editor: PlateEditor<V>) => {\n const entry = findNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (!entry) {\n return;\n }\n\n const [link, path] = entry;\n\n let text = getEditorString(editor, path);\n\n floatingButtonActions.url(link.url);\n\n floatingButtonActions.newTab(link.target === undefined);\n\n if (text === link.url) {\n text = '';\n }\n\n floatingButtonActions.text(text);\n\n floatingButtonActions.isEditing(true);\n};\n"],"names":["triggerFloatingButtonEdit","editor","entry","findNode","getPluginType","ELEMENT_BUTTON","link","path","text","getEditorString","floatingButtonActions"],"mappings":";;;AAMa,MAAAA,IAA4B,CAAkBC,MAA2B;AAC5E,QAAAC,IAAQC,EAAyBF,GAAQ;AAAA,IAC3C,OAAO,EAAE,MAAMG,EAAcH,GAAQI,CAAc,EAAE;AAAA,EAAA,CACxD;AACD,MAAI,CAACH;AACD;AAGE,QAAA,CAACI,GAAMC,CAAI,IAAIL;AAEjB,MAAAM,IAAOC,EAAgBR,GAAQM,CAAI;AAEjB,EAAAG,EAAA,IAAIJ,EAAK,GAAG,GAEZI,EAAA,OAAOJ,EAAK,WAAW,MAAS,GAElDE,MAASF,EAAK,QACPE,IAAA,KAGXE,EAAsB,KAAKF,CAAI,GAE/BE,EAAsB,UAAU,EAAI;AACxC;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isRangeAcrossBlocks as e, someNode as r, getPluginType as s, getEditorString as i } from "@udecode/plate";
|
|
2
|
+
import { floatingButtonSelectors as g, floatingButtonActions as n } from "../components/FloatingButton/floatingButtonStore.es.js";
|
|
3
|
+
import { ELEMENT_BUTTON as u } from "../createButtonPlugin.es.js";
|
|
4
|
+
const l = (t, {
|
|
5
|
+
focused: o
|
|
6
|
+
} = {}) => {
|
|
7
|
+
g.mode() || !o || e(t, { at: t.selection }) || r(t, {
|
|
8
|
+
match: { type: s(t, u) }
|
|
9
|
+
}) || (n.text(i(t, t.selection)), n.show("insert", t.id));
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
l as triggerFloatingButtonInsert
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=triggerFloatingButtonInsert.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerFloatingButtonInsert.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, getEditorString, getPluginType, isRangeAcrossBlocks, someNode } from '@udecode/plate';\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Trigger floating button.\n *\n * Do not trigger when:\n * - selection is across blocks\n * - selection has more than one leaf node\n * - lowest selection is not text\n * - selection has a button node\n */\nexport const triggerFloatingButtonInsert = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {}\n) => {\n if (floatingButtonSelectors.mode()) {\n return;\n }\n\n if (!focused) {\n return;\n }\n\n if (isRangeAcrossBlocks(editor, { at: editor.selection })) {\n return;\n }\n\n const hasButton = someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (hasButton) {\n return;\n }\n\n floatingButtonActions.text(getEditorString(editor, editor.selection));\n floatingButtonActions.show('insert', editor.id);\n};\n"],"names":["triggerFloatingButtonInsert","editor","focused","floatingButtonSelectors","isRangeAcrossBlocks","someNode","getPluginType","ELEMENT_BUTTON","floatingButtonActions","getEditorString"],"mappings":";;;AAea,MAAAA,IAA8B,CACvCC,GACA;AAAA,EACI,SAAAC;AACJ,IAEI,OACH;AAgBD,EAfIC,EAAwB,UAIxB,CAACD,KAIDE,EAAoBH,GAAQ,EAAE,IAAIA,EAAO,UAAA,CAAW,KAItCI,EAASJ,GAAQ;AAAA,IAC/B,OAAO,EAAE,MAAMK,EAAcL,GAAQM,CAAc,EAAE;AAAA,EAAA,CACxD,MAKDC,EAAsB,KAAKC,EAAgBR,GAAQA,EAAO,SAAS,CAAC,GAC9CO,EAAA,KAAK,UAAUP,EAAO,EAAE;AAClD;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isCollapsed as i, getAboveNode as a, getPluginType as l, isStartPoint as g, getPreviousNodeEndPoint as x, isEndPoint as P, getNextNodeStartPoint as m, select as u, insertNodes as E, withRemoveEmptyNodes as h, mockPlugin as r } from "@udecode/plate";
|
|
2
|
+
import { Path as w } from "slate";
|
|
3
|
+
import { ELEMENT_BUTTON as p } from "./createButtonPlugin.es.js";
|
|
4
|
+
const B = (t, { type: N }) => {
|
|
5
|
+
const { apply: f, normalizeNode: y } = t;
|
|
6
|
+
return t.apply = (s) => {
|
|
7
|
+
if (s.type !== "set_selection") {
|
|
8
|
+
f(s);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const n = s.newProperties;
|
|
12
|
+
if (!(n != null && n.focus) || !n.anchor || !i(n)) {
|
|
13
|
+
f(s);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const c = a(t, {
|
|
17
|
+
at: n,
|
|
18
|
+
match: { type: l(t, p) }
|
|
19
|
+
});
|
|
20
|
+
if (c) {
|
|
21
|
+
const [, o] = c;
|
|
22
|
+
let e;
|
|
23
|
+
g(t, n.focus, o) && (e = x(t, o)), P(t, n.focus, o) && (e = m(t, o)), e && (s.newProperties = {
|
|
24
|
+
anchor: e,
|
|
25
|
+
focus: e
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
f(s);
|
|
29
|
+
}, t.normalizeNode = ([s, n]) => {
|
|
30
|
+
if (s.type === l(t, p)) {
|
|
31
|
+
const c = t.selection;
|
|
32
|
+
if (c && i(c) && P(t, c.focus, n)) {
|
|
33
|
+
const o = m(t, n);
|
|
34
|
+
if (o)
|
|
35
|
+
u(t, o);
|
|
36
|
+
else {
|
|
37
|
+
const e = w.next(n);
|
|
38
|
+
E(t, { text: "" }, { at: e }), u(t, e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
y([s, n]);
|
|
43
|
+
}, h(
|
|
44
|
+
t,
|
|
45
|
+
r({
|
|
46
|
+
options: { types: N }
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
B as withButton
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=withButton.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n AnyObject,\n EText,\n PlateEditor,\n Value,\n WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@udecode/plate';\nimport { Path, Point, Range } from 'slate';\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<AnyObject, Value, PlateEditor<Value>>({\n options: { types: type },\n })\n );\n};\n"],"names":["withButton","editor","type","apply","normalizeNode","operation","range","isCollapsed","entry","getAboveNode","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin"],"mappings":";;;AAiCO,MAAMA,IAA2B,CAACC,GAAQ,EAAE,MAAAC,QAAW;AACpD,QAAA,EAAE,OAAAC,GAAO,eAAAC,EAAkB,IAAAH;AAE1B,SAAAA,EAAA,QAAQ,CAACI,MAAc;AACtB,QAAAA,EAAU,SAAS,iBAAiB;AACpC,MAAAF,EAAME,CAAS;AACf;AAAA;AAGJ,UAAMC,IAAQD,EAAU;AACpB,QAAA,EAACC,KAAA,QAAAA,EAAO,UAAS,CAACA,EAAM,UAAU,CAACC,EAAYD,CAAc,GAAG;AAChE,MAAAH,EAAME,CAAS;AACf;AAAA;AAGE,UAAAG,IAAQC,EAAaR,GAAQ;AAAA,MAC/B,IAAIK;AAAA,MACJ,OAAO,EAAE,MAAMI,EAAcT,GAAQU,CAAc,EAAE;AAAA,IAAA,CACxD;AAED,QAAIH,GAAO;AACD,YAAA,CAAG,EAAAI,CAAI,IAAIJ;AAEb,UAAAK;AAEJ,MAAIC,EAAab,GAAQK,EAAM,OAAOM,CAAI,MAC3BC,IAAAE,EAAwBd,GAAQW,CAAI,IAG/CI,EAAWf,GAAQK,EAAM,OAAOM,CAAI,MACzBC,IAAAI,EAAsBhB,GAAQW,CAAI,IAG7CC,MACAR,EAAU,gBAAgB;AAAA,QACtB,QAAQQ;AAAA,QACR,OAAOA;AAAA,MAAA;AAAA;AAKnB,IAAAV,EAAME,CAAS;AAAA,EAAA,GAGnBJ,EAAO,gBAAgB,CAAC,CAACiB,GAAMN,CAAI,MAAM;AACrC,QAAIM,EAAK,SAASR,EAAcT,GAAQU,CAAc,GAAG;AACrD,YAAML,IAAQL,EAAO;AAEjB,UAAAK,KAASC,EAAYD,CAAK,KAAKU,EAAWf,GAAQK,EAAM,OAAOM,CAAI,GAAG;AAChE,cAAAO,IAAYF,EAAsBhB,GAAQW,CAAI;AAGpD,YAAIO;AACA,UAAAC,EAAOnB,GAAQkB,CAAS;AAAA,aACrB;AAEG,gBAAAE,IAAWC,EAAK,KAAKV,CAAI;AACnB,UAAAW,EAAAtB,GAAQ,EAAE,MAAM,MAAsB,EAAE,IAAIoB,GAAU,GAClED,EAAOnB,GAAQoB,CAAQ;AAAA;AAAA;AAAA;AAKrB,IAAAjB,EAAA,CAACc,GAAMN,CAAI,CAAC;AAAA,EAAA,GAGvBY;AAAA,IACHvB;AAAA,IACAwB,EAAiD;AAAA,MAC7C,SAAS,EAAE,OAAOvB,EAAK;AAAA,IAAA,CAC1B;AAAA,EAAA;AAET;"}
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { j as t } from "../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { useFloatingLinkSelectors as e } from "@udecode/plate";
|
|
3
|
+
import { FloatingLink as i } from "./FloatingLink.es.js";
|
|
4
|
+
import { InsertLinkModal as m } from "./InsertLinkModal/InsertLinkModal.es.js";
|
|
5
|
+
import { EditModal as l } from "./EditLinkModal/EditModal.es.js";
|
|
6
|
+
const j = ({ readOnly: n }) => {
|
|
7
|
+
const r = e().isEditing();
|
|
8
|
+
if (n)
|
|
9
|
+
return null;
|
|
10
|
+
const o = /* @__PURE__ */ t.jsx(m, {}), s = r ? o : /* @__PURE__ */ t.jsx(l, {});
|
|
11
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ t.jsx(i.InsertRoot, { children: o }),
|
|
13
|
+
/* @__PURE__ */ t.jsx(i.EditRoot, { children: s })
|
|
14
|
+
] });
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
j as CustomFloatingLink
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=CustomFloatingLink.es.js.map
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomFloatingLink.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TEditableProps, useFloatingLinkSelectors } from '@udecode/plate';\n\nimport { EditModal } from './EditLinkModal';\nimport { FloatingLink } from './FloatingLink';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nexport const CustomFloatingLink = ({ readOnly }: TEditableProps) => {\n const isEditing = useFloatingLinkSelectors().isEditing();\n\n if (readOnly) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = isEditing ? input : <EditModal />;\n\n return (\n <>\n <FloatingLink.InsertRoot>{input}</FloatingLink.InsertRoot>\n\n <FloatingLink.EditRoot>{editContent}</FloatingLink.EditRoot>\n </>\n );\n};\n"],"names":["CustomFloatingLink","readOnly","isEditing","useFloatingLinkSelectors","input","InsertLinkModal","editContent","jsx","EditModal","jsxs","Fragment","FloatingLink"],"mappings":";;;;;AAQO,MAAMA,IAAqB,CAAC,EAAE,UAAAC,QAA+B;AAC1D,QAAAC,IAAYC,IAA2B;AAE7C,MAAIF;AACO,WAAA;AAGL,QAAAG,0BAASC,GAAgB,CAAA,CAAA,GACzBC,IAAcJ,IAAYE,IAAQG,gBAAAA,EAAAA,IAACC,GAAU,CAAA,CAAA;AAEnD,SAEQC,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,IAACH,gBAAAA,EAAAA,IAAAI,EAAa,YAAb,EAAyB,UAAMP,EAAA,CAAA;AAAA,IAE/BG,gBAAAA,EAAAA,IAAAI,EAAa,UAAb,EAAuB,UAAYL,EAAA,CAAA;AAAA,EACxC,EAAA,CAAA;AAER;"}
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { j as t } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { IconPen16 as s, IconTrashBin16 as o } from "@frontify/fondue";
|
|
3
|
+
import { useFloatingLinkUrlInput as i } from "@udecode/plate";
|
|
4
|
+
import { FloatingLink as n } from "../FloatingLink.es.js";
|
|
5
|
+
import { BlockStyles as r } from "../../../styles.es.js";
|
|
6
|
+
const c = () => {
|
|
7
|
+
const e = i({});
|
|
8
|
+
return /* @__PURE__ */ t.jsx("div", { "data-test-id": "floating-link-edit", className: "tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]", children: /* @__PURE__ */ t.jsxs("span", { "data-test-id": "preview-link-flyout", className: "tw-flex tw-justify-between", children: [
|
|
9
|
+
/* @__PURE__ */ t.jsx("span", { className: "tw-pointer-events-none", style: r.p, children: e.defaultValue }),
|
|
10
|
+
/* @__PURE__ */ t.jsxs("span", { className: "tw-flex tw-gap-2", children: [
|
|
11
|
+
/* @__PURE__ */ t.jsx(
|
|
12
|
+
"span",
|
|
13
|
+
{
|
|
14
|
+
role: "button",
|
|
15
|
+
tabIndex: 0,
|
|
16
|
+
"data-test-id": "edit-link-button",
|
|
17
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
18
|
+
children: /* @__PURE__ */ t.jsx(n.EditButton, { children: /* @__PURE__ */ t.jsx(s, {}) })
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ t.jsx(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
role: "button",
|
|
25
|
+
tabIndex: 0,
|
|
26
|
+
"data-test-id": "remove-link-button",
|
|
27
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
28
|
+
children: /* @__PURE__ */ t.jsx(n.UnlinkButton, { children: /* @__PURE__ */ t.jsx(o, {}) })
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
] })
|
|
32
|
+
] }) });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
c as EditModal
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=EditModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen16, IconTrashBin16 } from '@frontify/fondue';\nimport { useFloatingLinkUrlInput } from '@udecode/plate';\nimport { FloatingLink } from '../FloatingLink';\nimport { BlockStyles } from '../../../styles';\n\nexport const EditModal = () => {\n const urlHtmlProps = useFloatingLinkUrlInput({});\n\n return (\n <div data-test-id=\"floating-link-edit\" className=\"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]\">\n <span data-test-id={'preview-link-flyout'} className=\"tw-flex tw-justify-between\">\n <span className=\"tw-pointer-events-none\" style={BlockStyles.p}>\n {urlHtmlProps.defaultValue}\n </span>\n <span className=\"tw-flex tw-gap-2\">\n <span\n role=\"button\"\n tabIndex={0}\n data-test-id={'edit-link-button'}\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <FloatingLink.EditButton>\n <IconPen16 />\n </FloatingLink.EditButton>\n </span>\n\n <span\n role=\"button\"\n tabIndex={0}\n data-test-id={'remove-link-button'}\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n >\n <FloatingLink.UnlinkButton>\n <IconTrashBin16 />\n </FloatingLink.UnlinkButton>\n </span>\n </span>\n </span>\n </div>\n );\n};\n"],"names":["EditModal","urlHtmlProps","useFloatingLinkUrlInput","jsx","jsxs","BlockStyles","FloatingLink","IconPen16","IconTrashBin16"],"mappings":";;;;;AAOO,MAAMA,IAAY,MAAM;AACrB,QAAAC,IAAeC,EAAwB,CAAA,CAAE;AAG3C,SAAAC,gBAAAA,EAAAA,IAAC,OAAI,EAAA,gBAAa,sBAAqB,WAAU,4DAC7C,UAAAC,gBAAAA,EAAAA,KAAC,QAAK,EAAA,gBAAc,uBAAuB,WAAU,8BACjD,UAAA;AAAA,IAAAD,gBAAAA,EAAAA,IAAC,UAAK,WAAU,0BAAyB,OAAOE,EAAY,GACvD,YAAa,aAClB,CAAA;AAAA,IACAD,gBAAAA,EAAAA,KAAC,QAAK,EAAA,WAAU,oBACZ,UAAA;AAAA,MAAAD,gBAAAA,EAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,UAAU;AAAA,UACV,gBAAc;AAAA,UACd,WAAU;AAAA,UAEV,gCAACG,EAAa,YAAb,EACG,UAAAH,gBAAAA,MAACI,IAAU,CAAA,GACf;AAAA,QAAA;AAAA,MACJ;AAAA,MAEAJ,gBAAAA,EAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,UAAU;AAAA,UACV,gBAAc;AAAA,UACd,WAAU;AAAA,UAEV,gCAACG,EAAa,cAAb,EACG,UAAAH,gBAAAA,MAACK,IAAe,CAAA,GACpB;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA,GACJ;AAAA,EAAA,EACJ,CAAA,EACJ,CAAA;AAER;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useEditorRef as F, usePlateSelectors as h, useFloatingLinkSelectors as l, getPluginOptions as C, ELEMENT_LINK as n, getAboveNode as R, getPluginType as d, getRangeBoundingClientRect as P, getStartPoint as b, getEndPoint as N, getDefaultBoundingClientRect as O, useVirtualFloatingLink as S, floatingLinkActions as o, someNode as x, floatingLinkSelectors as c, useHotkeys as B, triggerFloatingLinkEdit as I, useFloatingLinkEnter as v, useFloatingLinkEscape as A, useComposedRef as D } from "@udecode/plate";
|
|
2
|
+
import { r as a } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
3
|
+
import { getUrlFromEditor as H } from "../../utils/getUrl.es.js";
|
|
4
|
+
const K = ({ floatingOptions: g, ...i }) => {
|
|
5
|
+
const t = F(), u = h().keyEditor(), f = l().mode(), m = l().isOpen(t.id), { triggerFloatingLinkHotkeys: k = "command+k, ctrl+k" } = C(t, n), p = a.useCallback(() => {
|
|
6
|
+
const e = R(t, {
|
|
7
|
+
match: { type: d(t, n) }
|
|
8
|
+
});
|
|
9
|
+
if (e) {
|
|
10
|
+
const [, s] = e;
|
|
11
|
+
return P(t, {
|
|
12
|
+
anchor: b(t, s),
|
|
13
|
+
focus: N(t, s)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return O();
|
|
17
|
+
}, [t]), E = m && f === "edit", { update: r, style: L, floating: y } = S({
|
|
18
|
+
editorId: t.id,
|
|
19
|
+
open: E,
|
|
20
|
+
getBoundingClientRect: p,
|
|
21
|
+
...g
|
|
22
|
+
});
|
|
23
|
+
return a.useEffect(() => {
|
|
24
|
+
const e = H(t);
|
|
25
|
+
if (e && o.url(e), t.selection && x(t, {
|
|
26
|
+
match: { type: d(t, n) }
|
|
27
|
+
})) {
|
|
28
|
+
o.show("edit", t.id), r();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
c.mode() === "edit" && o.hide();
|
|
32
|
+
}, [t, u, r]), B(
|
|
33
|
+
k,
|
|
34
|
+
(e) => {
|
|
35
|
+
e.preventDefault(), c.mode() === "edit" && I(t);
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
enableOnContentEditable: !0
|
|
39
|
+
},
|
|
40
|
+
[]
|
|
41
|
+
), v(), A(), {
|
|
42
|
+
style: {
|
|
43
|
+
...L,
|
|
44
|
+
zIndex: 1e3
|
|
45
|
+
},
|
|
46
|
+
...i,
|
|
47
|
+
ref: D(i.ref, y)
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
K as useFloatingLinkEdit
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=useFloatingLinkEdit.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingLinkEdit.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LINK,\n FloatingLinkProps,\n HTMLPropsAs,\n LinkPlugin,\n floatingLinkActions,\n floatingLinkSelectors,\n getAboveNode,\n getDefaultBoundingClientRect,\n getEndPoint,\n getPluginOptions,\n getPluginType,\n getRangeBoundingClientRect,\n getStartPoint,\n someNode,\n triggerFloatingLinkEdit,\n useComposedRef,\n useEditorRef,\n useFloatingLinkEnter,\n useFloatingLinkEscape,\n useFloatingLinkSelectors,\n useHotkeys,\n usePlateSelectors,\n useVirtualFloatingLink,\n} from '@udecode/plate';\nimport { useCallback, useEffect } from 'react';\nimport { getUrlFromEditor } from '../../utils';\n\nexport const useFloatingLinkEdit = ({ floatingOptions, ...props }: FloatingLinkProps): HTMLPropsAs<'div'> => {\n const editor = useEditorRef();\n const keyEditor = usePlateSelectors().keyEditor();\n const mode = useFloatingLinkSelectors().mode();\n const open = useFloatingLinkSelectors().isOpen(editor.id);\n\n const { triggerFloatingLinkHotkeys = 'command+k, ctrl+k' } = getPluginOptions<LinkPlugin>(editor, ELEMENT_LINK);\n\n const getBoundingClientRect = useCallback(() => {\n const entry = getAboveNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_LINK) },\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 } = useVirtualFloatingLink({\n editorId: editor.id,\n open: isOpen,\n getBoundingClientRect,\n ...floatingOptions,\n });\n\n useEffect(() => {\n const url = getUrlFromEditor(editor);\n if (url) {\n floatingLinkActions.url(url);\n }\n\n if (\n editor.selection &&\n someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_LINK) },\n })\n ) {\n floatingLinkActions.show('edit', editor.id);\n update();\n return;\n }\n\n if (floatingLinkSelectors.mode() === 'edit') {\n floatingLinkActions.hide();\n }\n }, [editor, keyEditor, update]);\n\n useHotkeys(\n triggerFloatingLinkHotkeys,\n (e) => {\n e.preventDefault();\n\n if (floatingLinkSelectors.mode() === 'edit') {\n triggerFloatingLinkEdit(editor);\n }\n },\n {\n enableOnContentEditable: true,\n },\n []\n );\n\n useFloatingLinkEnter();\n\n useFloatingLinkEscape();\n\n return {\n style: {\n ...style,\n zIndex: 1000,\n },\n ...props,\n ref: useComposedRef<HTMLElement | null>(props.ref, floating),\n };\n};\n"],"names":["useFloatingLinkEdit","floatingOptions","props","editor","useEditorRef","keyEditor","usePlateSelectors","mode","useFloatingLinkSelectors","open","triggerFloatingLinkHotkeys","getPluginOptions","ELEMENT_LINK","getBoundingClientRect","useCallback","entry","getAboveNode","getPluginType","path","getRangeBoundingClientRect","getStartPoint","getEndPoint","getDefaultBoundingClientRect","isOpen","update","style","floating","useVirtualFloatingLink","useEffect","url","getUrlFromEditor","floatingLinkActions","someNode","floatingLinkSelectors","useHotkeys","triggerFloatingLinkEdit","useFloatingLinkEnter","useFloatingLinkEscape","useComposedRef"],"mappings":";;;AA8BO,MAAMA,IAAsB,CAAC,EAAE,iBAAAC,GAAiB,GAAGC,QAAmD;AACzG,QAAMC,IAASC,KACTC,IAAYC,IAAoB,aAChCC,IAAOC,IAA2B,QAClCC,IAAOD,EAA2B,EAAA,OAAOL,EAAO,EAAE,GAElD,EAAE,4BAAAO,IAA6B,oBAAA,IAAwBC,EAA6BR,GAAQS,CAAY,GAExGC,IAAwBC,EAAAA,YAAY,MAAM;AACtC,UAAAC,IAAQC,EAAab,GAAQ;AAAA,MAC/B,OAAO,EAAE,MAAMc,EAAcd,GAAQS,CAAY,EAAE;AAAA,IAAA,CACtD;AAED,QAAIG,GAAO;AACD,YAAA,CAAG,EAAAG,CAAI,IAAIH;AACjB,aAAOI,EAA2BhB,GAAQ;AAAA,QACtC,QAAQiB,EAAcjB,GAAQe,CAAI;AAAA,QAClC,OAAOG,EAAYlB,GAAQe,CAAI;AAAA,MAAA,CAClC;AAAA;AAGL,WAAOI,EAA6B;AAAA,EAAA,GACrC,CAACnB,CAAM,CAAC,GAELoB,IAASd,KAAQF,MAAS,QAE1B,EAAE,QAAAiB,GAAQ,OAAAC,GAAO,UAAAC,EAAA,IAAaC,EAAuB;AAAA,IACvD,UAAUxB,EAAO;AAAA,IACjB,MAAMoB;AAAA,IACN,uBAAAV;AAAA,IACA,GAAGZ;AAAA,EAAA,CACN;AAED2B,SAAAA,EAAAA,UAAU,MAAM;AACN,UAAAC,IAAMC,EAAiB3B,CAAM;AAM/B,QALA0B,KACAE,EAAoB,IAAIF,CAAG,GAI3B1B,EAAO,aACP6B,EAAS7B,GAAQ;AAAA,MACb,OAAO,EAAE,MAAMc,EAAcd,GAAQS,CAAY,EAAE;AAAA,IAAA,CACtD,GACH;AACsB,MAAAmB,EAAA,KAAK,QAAQ5B,EAAO,EAAE,GACnCqB;AACP;AAAA;AAGA,IAAAS,EAAsB,KAAK,MAAM,UACjCF,EAAoB,KAAK;AAAA,EAE9B,GAAA,CAAC5B,GAAQE,GAAWmB,CAAM,CAAC,GAE9BU;AAAA,IACIxB;AAAA,IACA,CAAC,MAAM;AACH,QAAE,eAAe,GAEbuB,EAAsB,KAAK,MAAM,UACjCE,EAAwBhC,CAAM;AAAA,IAEtC;AAAA,IACA;AAAA,MACI,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC;AAAA,EAAA,GAGgBiC,KAECC,KAEf;AAAA,IACH,OAAO;AAAA,MACH,GAAGZ;AAAA,MACH,QAAQ;AAAA,IACZ;AAAA,IACA,GAAGvB;AAAA,IACH,KAAKoC,EAAmCpC,EAAM,KAAKwB,CAAQ;AAAA,EAAA;AAEnE;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createComponentAs as e, createElementAs as s, FloatingLink as i } from "@udecode/plate";
|
|
2
|
+
import { useFloatingLinkInsert as r } from "./InsertLinkModal/useFloatingLinkInsert.es.js";
|
|
3
|
+
import { useFloatingLinkEdit as l } from "./EditLinkModal/useFloatingLinkEdit.es.js";
|
|
4
|
+
const a = e((o) => {
|
|
5
|
+
var n;
|
|
6
|
+
const t = r({
|
|
7
|
+
...o,
|
|
8
|
+
floatingOptions: {
|
|
9
|
+
strategy: "absolute"
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return ((n = t.style) == null ? void 0 : n.display) === "none" ? null : s("div", t);
|
|
13
|
+
}), g = e((o) => {
|
|
14
|
+
var n;
|
|
15
|
+
const t = l({
|
|
16
|
+
...o,
|
|
17
|
+
floatingOptions: {
|
|
18
|
+
strategy: "absolute"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return ((n = t.style) == null ? void 0 : n.display) === "none" ? null : s("div", t);
|
|
22
|
+
});
|
|
23
|
+
i.EditRoot = g;
|
|
24
|
+
i.InsertRoot = a;
|
|
25
|
+
const c = i;
|
|
26
|
+
export {
|
|
27
|
+
c as FloatingLink
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=FloatingLink.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingLink.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n FloatingLinkProps,\n FloatingLink as PlateFloatingLink,\n createComponentAs,\n createElementAs,\n} from '@udecode/plate';\nimport { useFloatingLinkEdit } from './EditLinkModal';\nimport { useFloatingLinkInsert } from './InsertLinkModal/useFloatingLinkInsert';\n\nconst FloatingLinkInsertRoot = createComponentAs<FloatingLinkProps>((props) => {\n const htmlProps = useFloatingLinkInsert({\n ...props,\n floatingOptions: {\n strategy: 'absolute',\n },\n });\n\n if (htmlProps.style?.display === 'none') {\n return null;\n }\n\n return createElementAs('div', htmlProps);\n});\n\nconst FloatingLinkEditRoot = createComponentAs<FloatingLinkProps>((props) => {\n const htmlProps = useFloatingLinkEdit({\n ...props,\n floatingOptions: {\n strategy: 'absolute',\n },\n });\n\n if (htmlProps.style?.display === 'none') {\n return null;\n }\n\n return createElementAs('div', htmlProps);\n});\n\nPlateFloatingLink.EditRoot = FloatingLinkEditRoot;\nPlateFloatingLink.InsertRoot = FloatingLinkInsertRoot;\n\nexport const FloatingLink = PlateFloatingLink;\n"],"names":["FloatingLinkInsertRoot","createComponentAs","props","htmlProps","useFloatingLinkInsert","_a","createElementAs","FloatingLinkEditRoot","useFloatingLinkEdit","PlateFloatingLink","FloatingLink"],"mappings":";;;AAWA,MAAMA,IAAyBC,EAAqC,CAACC,MAAU;;AAC3E,QAAMC,IAAYC,EAAsB;AAAA,IACpC,GAAGF;AAAA,IACH,iBAAiB;AAAA,MACb,UAAU;AAAA,IACd;AAAA,EAAA,CACH;AAEG,WAAAG,IAAAF,EAAU,UAAV,gBAAAE,EAAiB,aAAY,SACtB,OAGJC,EAAgB,OAAOH,CAAS;AAC3C,CAAC,GAEKI,IAAuBN,EAAqC,CAACC,MAAU;;AACzE,QAAMC,IAAYK,EAAoB;AAAA,IAClC,GAAGN;AAAA,IACH,iBAAiB;AAAA,MACb,UAAU;AAAA,IACd;AAAA,EAAA,CACH;AAEG,WAAAG,IAAAF,EAAU,UAAV,gBAAAE,EAAiB,aAAY,SACtB,OAGJC,EAAgB,OAAOH,CAAS;AAC3C,CAAC;AAEDM,EAAkB,WAAWF;AAC7BE,EAAkB,aAAaT;AAExB,MAAMU,IAAeD;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { j as t } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { InsertModal as o } from "./InsertModal.es.js";
|
|
3
|
+
import { useInsertModal as r } from "./useInsertModal.es.js";
|
|
4
|
+
const i = () => /* @__PURE__ */ t.jsx(o, { ...r(), testId: "floating-link-insert" });
|
|
5
|
+
export {
|
|
6
|
+
i as InsertLinkModal
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=InsertLinkModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsertLinkModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { InsertModal, useInsertModal } from '.';\n\nexport const InsertLinkModal = () => <InsertModal {...useInsertModal()} testId=\"floating-link-insert\" />;\n"],"names":["InsertLinkModal","jsx","InsertModal","useInsertModal"],"mappings":";;;AAIa,MAAAA,IAAkB,MAAOC,gBAAAA,EAAAA,IAAAC,GAAA,EAAa,GAAGC,EAAe,GAAG,QAAO,uBAAuB,CAAA;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as e } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { FormControl as i, TextInput as n, Checkbox as j, Button as d, ButtonSize as o, ButtonStyle as p, ButtonEmphasis as v, IconCheckMark20 as b } from "@frontify/fondue";
|
|
3
|
+
import { LinkSelector as k } from "../../../shared/LinkSelector/LinkSelector.es.js";
|
|
4
|
+
const T = ({
|
|
5
|
+
state: l,
|
|
6
|
+
onTextChange: s,
|
|
7
|
+
onUrlChange: t,
|
|
8
|
+
onToggleTab: a,
|
|
9
|
+
onCancel: c,
|
|
10
|
+
onSave: x,
|
|
11
|
+
isValidUrlOrEmpty: r,
|
|
12
|
+
hasValues: u,
|
|
13
|
+
testId: m,
|
|
14
|
+
appBridge: h,
|
|
15
|
+
children: w
|
|
16
|
+
}) => /* @__PURE__ */ e.jsxs("div", { "data-test-id": m, className: "tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto", children: [
|
|
17
|
+
/* @__PURE__ */ e.jsx(
|
|
18
|
+
i,
|
|
19
|
+
{
|
|
20
|
+
label: {
|
|
21
|
+
children: "Text",
|
|
22
|
+
htmlFor: "linkText",
|
|
23
|
+
required: !0
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ e.jsx(n, { id: "linkText", value: l.text, placeholder: "Link Text", onChange: s })
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
w,
|
|
29
|
+
/* @__PURE__ */ e.jsxs("div", { className: "tw-pt-5", children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(
|
|
31
|
+
i,
|
|
32
|
+
{
|
|
33
|
+
label: {
|
|
34
|
+
children: "URL",
|
|
35
|
+
htmlFor: "url",
|
|
36
|
+
required: !0
|
|
37
|
+
},
|
|
38
|
+
children: /* @__PURE__ */ e.jsx(
|
|
39
|
+
n,
|
|
40
|
+
{
|
|
41
|
+
id: "url",
|
|
42
|
+
value: l.url,
|
|
43
|
+
placeholder: "https://example.com",
|
|
44
|
+
focusOnMount: !0,
|
|
45
|
+
onChange: t
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
!r(l == null ? void 0 : l.url) && /* @__PURE__ */ e.jsx("div", { className: "tw-text-red-65 tw-mt-3", children: "Please enter a valid URL." })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ e.jsx("div", { className: "tw-mt-3", children: /* @__PURE__ */ e.jsx(k, { url: l.url, appBridge: h, onUrlChange: t }) }),
|
|
53
|
+
/* @__PURE__ */ e.jsx("div", { className: "tw-mt-3", children: /* @__PURE__ */ e.jsx(j, { value: "new-tab", label: "Open in new tab", state: l.newTab, onChange: a }) }),
|
|
54
|
+
/* @__PURE__ */ e.jsx("div", { className: "tw-mt-3", children: /* @__PURE__ */ e.jsxs("div", { className: "tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10", children: [
|
|
55
|
+
/* @__PURE__ */ e.jsx(
|
|
56
|
+
d,
|
|
57
|
+
{
|
|
58
|
+
onClick: c,
|
|
59
|
+
size: o.Medium,
|
|
60
|
+
style: p.Default,
|
|
61
|
+
emphasis: v.Default,
|
|
62
|
+
children: "Cancel"
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ e.jsx(
|
|
66
|
+
d,
|
|
67
|
+
{
|
|
68
|
+
onClick: x,
|
|
69
|
+
size: o.Medium,
|
|
70
|
+
icon: /* @__PURE__ */ e.jsx(b, {}),
|
|
71
|
+
disabled: !u || !r(l == null ? void 0 : l.url),
|
|
72
|
+
children: "Save"
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }) })
|
|
76
|
+
] });
|
|
77
|
+
export {
|
|
78
|
+
T as InsertModal
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=InsertModal.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsertModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n Button,\n ButtonEmphasis,\n ButtonSize,\n ButtonStyle,\n Checkbox,\n FormControl,\n IconCheckMark20,\n TextInput,\n} from '@frontify/fondue';\nimport { FC, ReactNode } from 'react';\nimport { LinkSelector } from '../../../shared/LinkSelector';\nimport { InsertModalStateProps } from './types';\n\ntype Props = {\n state: InsertModalStateProps;\n onTextChange: (value: string) => void;\n onUrlChange: (value: string) => void;\n onToggleTab: (checked: boolean) => void;\n onCancel: () => void;\n onSave: (event: React.MouseEvent<HTMLButtonElement, MouseEvent> | KeyboardEvent | undefined) => void;\n hasValues: boolean;\n isValidUrlOrEmpty: (url: string) => boolean | undefined;\n testId?: string;\n children?: ReactNode;\n appBridge: AppBridgeBlock;\n};\n\nexport const InsertModal: FC<Props> = ({\n state,\n onTextChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n isValidUrlOrEmpty,\n hasValues,\n testId,\n appBridge,\n children,\n}) => (\n <div data-test-id={testId} className=\"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto\">\n <FormControl\n label={{\n children: 'Text',\n htmlFor: 'linkText',\n required: true,\n }}\n >\n <TextInput id=\"linkText\" value={state.text} placeholder=\"Link Text\" onChange={onTextChange} />\n </FormControl>\n\n {children}\n\n <div className=\"tw-pt-5\">\n <FormControl\n label={{\n children: 'URL',\n htmlFor: 'url',\n required: true,\n }}\n >\n <TextInput\n id=\"url\"\n value={state.url}\n placeholder=\"https://example.com\"\n focusOnMount\n onChange={onUrlChange}\n />\n </FormControl>\n {!isValidUrlOrEmpty(state?.url) && <div className=\"tw-text-red-65 tw-mt-3\">Please enter a valid URL.</div>}\n </div>\n\n <div className=\"tw-mt-3\">\n <LinkSelector url={state.url} appBridge={appBridge} onUrlChange={onUrlChange} />\n </div>\n\n <div className=\"tw-mt-3\">\n <Checkbox value=\"new-tab\" label=\"Open in new tab\" state={state.newTab} onChange={onToggleTab} />\n </div>\n <div className=\"tw-mt-3\">\n <div className={'tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10'}>\n <Button\n onClick={onCancel}\n size={ButtonSize.Medium}\n style={ButtonStyle.Default}\n emphasis={ButtonEmphasis.Default}\n >\n Cancel\n </Button>\n <Button\n onClick={onSave}\n size={ButtonSize.Medium}\n icon={<IconCheckMark20 />}\n disabled={!hasValues || !isValidUrlOrEmpty(state?.url)}\n >\n Save\n </Button>\n </div>\n </div>\n </div>\n);\n"],"names":["InsertModal","state","onTextChange","onUrlChange","onToggleTab","onCancel","onSave","isValidUrlOrEmpty","hasValues","testId","appBridge","children","jsxs","jsx","FormControl","TextInput","LinkSelector","Checkbox","Button","ButtonSize","ButtonStyle","ButtonEmphasis","IconCheckMark20"],"mappings":";;;AA+BO,MAAMA,IAAyB,CAAC;AAAA,EACnC,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AACJ,MACKC,gBAAAA,EAAAA,KAAA,OAAA,EAAI,gBAAcH,GAAQ,WAAU,+EACjC,UAAA;AAAA,EAAAI,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU;AAAA,MACd;AAAA,MAEA,UAAAD,gBAAAA,EAAAA,IAACE,GAAU,EAAA,IAAG,YAAW,OAAOd,EAAM,MAAM,aAAY,aAAY,UAAUC,EAAc,CAAA;AAAA,IAAA;AAAA,EAChG;AAAA,EAECS;AAAA,EAEDC,gBAAAA,EAAAA,KAAC,OAAI,EAAA,WAAU,WACX,UAAA;AAAA,IAAAC,gBAAAA,EAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,OAAO;AAAA,UACH,UAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,QACd;AAAA,QAEA,UAAAD,gBAAAA,EAAA;AAAA,UAACE;AAAA,UAAA;AAAA,YACG,IAAG;AAAA,YACH,OAAOd,EAAM;AAAA,YACb,aAAY;AAAA,YACZ,cAAY;AAAA,YACZ,UAAUE;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IACJ;AAAA,IACC,CAACI,EAAkBN,KAAA,gBAAAA,EAAO,GAAG,KAAMY,gBAAAA,EAAA,IAAA,OAAA,EAAI,WAAU,0BAAyB,UAAyB,4BAAA,CAAA;AAAA,EAAA,GACxG;AAAA,EAEAA,gBAAAA,EAAA,IAAC,OAAI,EAAA,WAAU,WACX,UAAAA,gBAAAA,EAAAA,IAACG,GAAa,EAAA,KAAKf,EAAM,KAAK,WAAAS,GAAsB,aAAAP,EAAA,CAA0B,EAClF,CAAA;AAAA,EAECU,gBAAAA,MAAA,OAAA,EAAI,WAAU,WACX,gCAACI,GAAS,EAAA,OAAM,WAAU,OAAM,mBAAkB,OAAOhB,EAAM,QAAQ,UAAUG,EAAa,CAAA,GAClG;AAAA,wBACC,OAAI,EAAA,WAAU,WACX,UAACQ,gBAAAA,EAAA,KAAA,OAAA,EAAI,WAAW,8EACZ,UAAA;AAAA,IAAAC,gBAAAA,EAAA;AAAA,MAACK;AAAA,MAAA;AAAA,QACG,SAASb;AAAA,QACT,MAAMc,EAAW;AAAA,QACjB,OAAOC,EAAY;AAAA,QACnB,UAAUC,EAAe;AAAA,QAC5B,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,IACAR,gBAAAA,EAAA;AAAA,MAACK;AAAA,MAAA;AAAA,QACG,SAASZ;AAAA,QACT,MAAMa,EAAW;AAAA,QACjB,4BAAOG,GAAgB,EAAA;AAAA,QACvB,UAAU,CAACd,KAAa,CAACD,EAAkBN,KAAA,gBAAAA,EAAO,GAAG;AAAA,QACxD,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAAA,EAAA,CACJ,EACJ,CAAA;AAAA,EACJ,CAAA;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useEditorRef as f, useFloatingLinkSelectors as s, getPluginOptions as p, ELEMENT_LINK as m, useHotkeys as k, triggerFloatingLinkInsert as E, useVirtualFloatingLink as L, getSelectionBoundingClientRect as F, floatingLinkActions as r, useFloatingLinkEscape as I, useComposedRef as y } from "@udecode/plate";
|
|
2
|
+
import { r as C } from "../../../../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.es.js";
|
|
3
|
+
import { useFocused as R } from "slate-react";
|
|
4
|
+
const B = ({ floatingOptions: l, ...n }) => {
|
|
5
|
+
const e = f(), o = R(), u = s().mode(), t = s().isOpen(e.id), { triggerFloatingLinkHotkeys: d } = p(e, m);
|
|
6
|
+
k(
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8
|
+
d,
|
|
9
|
+
(c) => {
|
|
10
|
+
E(e, { focused: o }) && c.preventDefault();
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
enableOnContentEditable: !0
|
|
14
|
+
},
|
|
15
|
+
[o]
|
|
16
|
+
);
|
|
17
|
+
const { update: i, style: a, floating: g } = L({
|
|
18
|
+
editorId: e.id,
|
|
19
|
+
open: t && u === "insert",
|
|
20
|
+
getBoundingClientRect: F,
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
|
+
whileElementsMounted: () => {
|
|
23
|
+
},
|
|
24
|
+
...l
|
|
25
|
+
});
|
|
26
|
+
return C.useEffect(() => {
|
|
27
|
+
t ? (i(), r.updated(!0)) : r.updated(!1);
|
|
28
|
+
}, [t, i]), I(), {
|
|
29
|
+
style: {
|
|
30
|
+
...a,
|
|
31
|
+
zIndex: 1e3
|
|
32
|
+
},
|
|
33
|
+
...n,
|
|
34
|
+
ref: y(n.ref, g)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
B as useFloatingLinkInsert
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=useFloatingLinkInsert.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingLinkInsert.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LINK,\n FloatingLinkProps,\n HTMLPropsAs,\n LinkPlugin,\n floatingLinkActions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n triggerFloatingLinkInsert,\n useComposedRef,\n useEditorRef,\n useFloatingLinkEscape,\n useFloatingLinkSelectors,\n useHotkeys,\n useVirtualFloatingLink,\n} from '@udecode/plate';\nimport { useEffect } from 'react';\nimport { useFocused } from 'slate-react';\n\nexport const useFloatingLinkInsert = ({ floatingOptions, ...props }: FloatingLinkProps): HTMLPropsAs<'div'> => {\n const editor = useEditorRef();\n const focused = useFocused();\n const mode = useFloatingLinkSelectors().mode();\n const open = useFloatingLinkSelectors().isOpen(editor.id);\n\n const { triggerFloatingLinkHotkeys } = getPluginOptions<LinkPlugin>(editor, ELEMENT_LINK);\n\n useHotkeys(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n triggerFloatingLinkHotkeys!,\n (e) => {\n if (triggerFloatingLinkInsert(editor, { focused })) {\n e.preventDefault();\n }\n },\n {\n enableOnContentEditable: true,\n },\n [focused]\n );\n\n const { update, style, floating } = useVirtualFloatingLink({\n editorId: editor.id,\n open: open && mode === 'insert',\n getBoundingClientRect: getSelectionBoundingClientRect,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n whileElementsMounted: () => {},\n ...floatingOptions,\n });\n\n // wait for update before focusing input\n useEffect(() => {\n if (open) {\n update();\n floatingLinkActions.updated(true);\n } else {\n floatingLinkActions.updated(false);\n }\n }, [open, update]);\n\n useFloatingLinkEscape();\n\n return {\n style: {\n ...style,\n zIndex: 1000,\n },\n ...props,\n ref: useComposedRef<HTMLElement | null>(props.ref, floating),\n };\n};\n"],"names":["useFloatingLinkInsert","floatingOptions","props","editor","useEditorRef","focused","useFocused","mode","useFloatingLinkSelectors","open","triggerFloatingLinkHotkeys","getPluginOptions","ELEMENT_LINK","useHotkeys","e","triggerFloatingLinkInsert","update","style","floating","useVirtualFloatingLink","getSelectionBoundingClientRect","useEffect","floatingLinkActions","useFloatingLinkEscape","useComposedRef"],"mappings":";;;AAqBO,MAAMA,IAAwB,CAAC,EAAE,iBAAAC,GAAiB,GAAGC,QAAmD;AAC3G,QAAMC,IAASC,KACTC,IAAUC,KACVC,IAAOC,IAA2B,QAClCC,IAAOD,EAA2B,EAAA,OAAOL,EAAO,EAAE,GAElD,EAAE,4BAAAO,EAA+B,IAAAC,EAA6BR,GAAQS,CAAY;AAExF,EAAAC;AAAA;AAAA,IAEIH;AAAA,IACA,CAACI,MAAM;AACH,MAAIC,EAA0BZ,GAAQ,EAAE,SAAAE,EAAS,CAAA,KAC7CS,EAAE,eAAe;AAAA,IAEzB;AAAA,IACA;AAAA,MACI,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAACT,CAAO;AAAA,EAAA;AAGZ,QAAM,EAAE,QAAAW,GAAQ,OAAAC,GAAO,UAAAC,EAAA,IAAaC,EAAuB;AAAA,IACvD,UAAUhB,EAAO;AAAA,IACjB,MAAMM,KAAQF,MAAS;AAAA,IACvB,uBAAuBa;AAAA;AAAA,IAEvB,sBAAsB,MAAM;AAAA,IAAC;AAAA,IAC7B,GAAGnB;AAAA,EAAA,CACN;AAGDoB,SAAAA,EAAAA,UAAU,MAAM;AACZ,IAAIZ,KACOO,KACPM,EAAoB,QAAQ,EAAI,KAEhCA,EAAoB,QAAQ,EAAK;AAAA,EACrC,GACD,CAACb,GAAMO,CAAM,CAAC,GAEKO,KAEf;AAAA,IACH,OAAO;AAAA,MACH,GAAGN;AAAA,MACH,QAAQ;AAAA,IACZ;AAAA,IACA,GAAGf;AAAA,IACH,KAAKsB,EAAmCtB,EAAM,KAAKgB,CAAQ;AAAA,EAAA;AAEnE;"}
|