@frontify/guideline-blocks-settings 0.34.10 → 0.34.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Attachments/AttachmentItem.es.js +21 -21
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +1 -1
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +20 -23
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +5 -5
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +6 -6
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +9 -9
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +4 -4
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +5 -5
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.es.js +7 -7
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -1
- package/dist/components/Link/LinkInput.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +7 -7
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +4 -4
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +56 -53
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/PageLink.es.js +4 -4
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/PageLinks.es.js +4 -4
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
- package/dist/components/Link/utils/getUrl.es.js.map +1 -1
- package/dist/components/Link/utils/url.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +9 -9
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +5 -5
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +6 -6
- 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.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +1 -1
- 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 +9 -9
- 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
- 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 +8 -8
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +8 -8
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -1
- package/dist/helpers/mapColorPalettes.es.js.map +1 -1
- package/dist/hooks/useAttachments.es.js.map +1 -1
- package/dist/hooks/useDndSensors.es.js.map +1 -1
- package/dist/hooks/useIsInViewport.es.js.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +34 -34
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/border.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/settings/borderRadiusExtended.es.js.map +1 -1
- package/dist/settings/gutter.es.js.map +1 -1
- package/dist/settings/margin.es.js.map +1 -1
- package/dist/settings/marginExtended.es.js.map +1 -1
- package/dist/settings/padding.es.js.map +1 -1
- package/dist/settings/paddingExtended.es.js.map +1 -1
- package/dist/settings/securityDownloadable.es.js.map +1 -1
- package/dist/settings/securityGlobalControl.es.js +1 -1
- package/dist/settings/securityGlobalControl.es.js.map +1 -1
- package/dist/settings/types.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/color/getReadableColor.es.js.map +1 -1
- package/dist/utilities/color/isDark.es.js.map +1 -1
- package/dist/utilities/color/toColorObject.es.js.map +1 -1
- package/dist/utilities/color/toHex8String.es.js.map +1 -1
- package/dist/utilities/color/toHexString.es.js.map +1 -1
- package/dist/utilities/color/toRgbaString.es.js.map +1 -1
- package/dist/utilities/color/toShortRgba.es.js.map +1 -1
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js +4 -4
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
- package/package.json +28 -28
|
@@ -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 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';\nimport { type Ref, useCallback, useEffect } from 'react';\nimport { ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { getUrlFromEditor } from '../../utils';\nimport { triggerFloatingButtonEdit } from '../../utils/triggerFloatingButtonEdit';\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 ...style,\n zIndex: 1000,\n },\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"names":["useFloatingButtonEdit","floatingOptions","editor","useEditorRef","mode","useFloatingButtonSelectors","open","version","useEditorVersion","triggerFloatingButtonHotkeys","getPluginOptions","ELEMENT_BUTTON","getBoundingClientRect","useCallback","entry","getAboveNode","getPluginType","path","getRangeBoundingClientRect","getStartPoint","getEndPoint","getDefaultBoundingClientRect","isOpen","update","style","floating","useVirtualFloatingButton","useEffect","url","getUrlFromEditor","floatingButtonActions","someNode","floatingButtonSelectors","useHotkeys","triggerFloatingButtonEdit","useFloatingButtonEnter","useFloatingButtonEscape","useComposedRef"],"mappings":";;;;;;;;;
|
|
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';\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 ...style,\n zIndex: 1000,\n },\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"names":["useFloatingButtonEdit","floatingOptions","editor","useEditorRef","mode","useFloatingButtonSelectors","open","version","useEditorVersion","triggerFloatingButtonHotkeys","getPluginOptions","ELEMENT_BUTTON","getBoundingClientRect","useCallback","entry","getAboveNode","getPluginType","path","getRangeBoundingClientRect","getStartPoint","getEndPoint","getDefaultBoundingClientRect","isOpen","update","style","floating","useVirtualFloatingButton","useEffect","url","getUrlFromEditor","floatingButtonActions","someNode","floatingButtonSelectors","useHotkeys","triggerFloatingButtonEdit","useFloatingButtonEnter","useFloatingButtonEscape","useComposedRef"],"mappings":";;;;;;;;;AAgCa,MAAAA,IAAwB,CACjCC,MACsE;AACtE,QAAMC,IAASC,KACTC,IAAOC,IAA6B,QACpCC,IAAOD,EAA6B,EAAA,OAAOH,EAAO,EAAE,GACpDK,IAAUC,KAEV,EAAE,8BAAAC,EAAiC,IAAAC,EAA+BR,GAAQS,CAAc,GAExFC,IAAwBC,EAAY,MAAM;AACtC,UAAAC,IAAQC,EAAab,GAAQ;AAAA,MAC/B,OAAO,EAAE,MAAMc,EAAcd,GAAQS,CAAc,EAAE;AAAA,IAAA,CACxD;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,IACL;AAEA,WAAOI,EAA6B;AAAA,EAAA,GACrC,CAACnB,CAAM,CAAC,GAELoB,IAAShB,KAAQF,MAAS,QAE1B,EAAE,QAAAmB,GAAQ,OAAAC,GAAO,UAAAC,EAAA,IAAaC,EAAyB;AAAA,IACzD,MAAMJ;AAAA,IACN,uBAAAV;AAAA,IACA,GAAGX;AAAA,EAAA,CACN;AAED,SAAA0B,EAAU,MAAM;AACN,UAAAC,IAAMC,EAAiB3B,CAAM;AAM/B,QALA0B,KACAE,EAAsB,IAAIF,CAAG,GAI7B1B,EAAO,aACP6B,EAAS7B,GAAQ;AAAA,MACb,OAAO,EAAE,MAAMc,EAAcd,GAAQS,CAAc,EAAE;AAAA,IAAA,CACxD,GACH;AACwB,MAAAmB,EAAA,KAAK,QAAQ5B,EAAO,EAAE,GACrCqB;AACP;AAAA,IACJ;AAEI,IAAAS,EAAwB,KAAK,MAAM,UACnCF,EAAsB,MAAM;AAAA,EAEjC,GAAA,CAAC5B,GAAQK,GAASgB,CAAM,CAAC,GAE5BU;AAAA,IACIxB;AAAA,IACA,CAAC,MAAM;AACH,QAAE,eAAe,GAEbuB,EAAwB,KAAK,MAAM,UACnCE,EAA0BhC,CAAM;AAAA,IAExC;AAAA,IACA;AAAA,MACI,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC;AAAA,EAAA,GAGkBiC,KAECC,KAEjB;AAAA,IACH,OAAO;AAAA,MACH,GAAGZ;AAAA,MACH,QAAQ;AAAA,IACZ;AAAA,IACA,KAAKa,EAAmCZ,CAAQ;AAAA,EAAA;AAExD;"}
|
|
@@ -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';\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"],"names":["useFloatingButtonEnter","editor","useEditorRef","useHotkeys","e","submitFloatingButton"],"mappings":";;
|
|
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';\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"],"names":["useFloatingButtonEnter","editor","useEditorRef","useHotkeys","e","submitFloatingButton"],"mappings":";;AAMO,MAAMA,IAAyB,MAAM;AACxC,QAAMC,IAASC;AAEf,EAAAC;AAAA,IACI;AAAA,IACA,CAACC,MAAM;AACH,MAAIA,EAAE,QAAQ,WAAWC,EAAqBJ,CAAM,KAChDG,EAAE,eAAe;AAAA,IAEzB;AAAA,IACA;AAAA,MACI,kBAAkB,CAAC,OAAO;AAAA,IAC9B;AAAA,IACA,CAAC;AAAA,EAAA;AAET;"}
|
|
@@ -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';\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"],"names":["useFloatingButtonEscape","editor","useEditorRef","useHotkeys","floatingButtonSelectors","floatingButtonActions","focusEditor"],"mappings":";;
|
|
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';\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"],"names":["useFloatingButtonEscape","editor","useEditorRef","useHotkeys","floatingButtonSelectors","floatingButtonActions","focusEditor"],"mappings":";;AAMO,MAAMA,IAA0B,MAAM;AACzC,QAAMC,IAASC;AAEf,EAAAC;AAAA,IACI;AAAA,IACA,MAAM;AACE,UAAAC,EAAwB,KAAK,MAAM,QAInC;AAAA,YAAAA,EAAwB,aAAa;AACf,UAAAC,EAAA,KAAK,QAAQJ,EAAO,EAAE,GAChCK,EAAAL,GAAQA,EAAO,aAAa,MAAS;AACjD;AAAA,QACJ;AAEA,QAAAI,EAAsB,MAAM;AAAA;AAAA,IAChC;AAAA,IACA;AAAA,MACI,kBAAkB,CAAC,OAAO;AAAA,MAC1B,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAAC;AAAA,EAAA;AAET;"}
|
|
@@ -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 UseVirtualFloatingOptions,\n getPluginOptions,\n getSelectionBoundingClientRect,\n useComposedRef,\n useEditorRef,\n useFocused,\n useHotkeys,\n} from '@frontify/fondue';\nimport { type Ref, useEffect } from 'react';\nimport { ButtonPlugin, ELEMENT_BUTTON } from '../../createButtonPlugin';\nimport { triggerFloatingButtonInsert } from '../../utils/triggerFloatingButtonInsert';\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 ...style,\n zIndex: 1000,\n },\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"names":["useFloatingButtonInsert","floatingOptions","editor","useEditorRef","focused","useFocused","mode","useFloatingButtonSelectors","open","triggerFloatingButtonHotkeys","getPluginOptions","ELEMENT_BUTTON","useHotkeys","e","triggerFloatingButtonInsert","update","style","floating","useVirtualFloatingButton","getSelectionBoundingClientRect","useEffect","floatingButtonActions","useFloatingButtonEscape","useComposedRef"],"mappings":";;;;;;;
|
|
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';\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 ...style,\n zIndex: 1000,\n },\n ref: useComposedRef<HTMLElement | null>(floating),\n };\n};\n"],"names":["useFloatingButtonInsert","floatingOptions","editor","useEditorRef","focused","useFocused","mode","useFloatingButtonSelectors","open","triggerFloatingButtonHotkeys","getPluginOptions","ELEMENT_BUTTON","useHotkeys","e","triggerFloatingButtonInsert","update","style","floating","useVirtualFloatingButton","getSelectionBoundingClientRect","useEffect","floatingButtonActions","useFloatingButtonEscape","useComposedRef"],"mappings":";;;;;;;AAuBa,MAAAA,IAA0B,CACnCC,MACsE;AACtE,QAAMC,IAASC,KACTC,IAAUC,KACVC,IAAOC,IAA6B,QACpCC,IAAOD,EAA6B,EAAA,OAAOL,EAAO,EAAE,GAEpD,EAAE,8BAAAO,EAAiC,IAAAC,EAA+BR,GAAQS,CAAc;AAE9F,EAAAC;AAAA,IACIH;AAAA,IACA,CAACI,MAAM;AACH,MAAAA,EAAE,eAAe,GAEjBC,EAA4BZ,GAAQ;AAAA,QAChC,SAAAE;AAAA,MAAA,CACH;AAAA,IACL;AAAA,IACA;AAAA,MACI,yBAAyB;AAAA,IAC7B;AAAA,IACA,CAACA,CAAO;AAAA,EAAA;AAGZ,QAAM,EAAE,QAAAW,GAAQ,OAAAC,GAAO,UAAAC,EAAA,IAAaC,EAAyB;AAAA,IACzD,MAAMV,KAAQF,MAAS;AAAA,IACvB,uBAAuBa;AAAA,IACvB,sBAAsB;AAAA,IACtB,GAAGlB;AAAA,EAAA,CACN;AAGD,SAAAmB,EAAU,MAAM;AACZ,IAAIZ,KACOO,KAEXM,EAAsB,QAAQb,CAAI;AAAA,EAAA,GACnC,CAACA,GAAMO,CAAM,CAAC,GAEOO,KAEjB;AAAA,IACH,OAAO;AAAA,MACH,GAAGN;AAAA,MACH,QAAQ;AAAA,IACZ;AAAA,IACA,KAAKO,EAAmCN,CAAQ;AAAA,EAAA;AAExD;"}
|
|
@@ -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 { UseVirtualFloatingOptions, flip, offset, useVirtualFloating } from '@frontify/fondue';\nimport { 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"],"names":["OFFSET_Y","OFFSET_X","PADDING","useVirtualFloatingButton","floatingOptions","useVirtualFloating","offset","flip"],"mappings":";AAKA,MAAMA,IAAW,IACXC,IAAW,KACXC,IAAU,IAEHC,IAA2B,CACpCC,MAEAC,EAAmB;AAAA,EACf,WAAW;AAAA,EACX,YAAY;AAAA,IACRC,EAAO;AAAA,MACH,UAAUN;AAAA,MACV,eAAeC;AAAA,IAAA,CAClB;AAAA,IACDM,EAAK;AAAA,MACD,SAASL;AAAA,IAAA,CACZ;AAAA,EACL;AAAA,EACA,GAAGE;AACP,CAAC;"}
|
|
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';\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"],"names":["OFFSET_Y","OFFSET_X","PADDING","useVirtualFloatingButton","floatingOptions","useVirtualFloating","offset","flip"],"mappings":";AAKA,MAAMA,IAAW,IACXC,IAAW,KACXC,IAAU,IAEHC,IAA2B,CACpCC,MAEAC,EAAmB;AAAA,EACf,WAAW;AAAA,EACX,YAAY;AAAA,IACRC,EAAO;AAAA,MACH,UAAUN;AAAA,MACV,eAAeC;AAAA,IAAA,CAClB;AAAA,IACDM,EAAK;AAAA,MACD,SAASL;AAAA,IAAA,CACZ;AAAA,EACL;AAAA,EACA,GAAGE;AACP,CAAC;"}
|
|
@@ -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 { AppBridgeBlock } from '@frontify/app-bridge';\nimport { PlatePlugin
|
|
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';\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// eslint-disable-next-line @typescript-eslint/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// eslint-disable-next-line @typescript-eslint/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"],"names":["ELEMENT_BUTTON","BUTTON_PLUGIN","createButtonPlugin","appBridge","createPluginFactory","element","withButton","CustomFloatingButton","isValidUrl","_editor","type","el","ButtonPlugin","Plugin","styles","BlockButtonStyles","props","ButtonButton","ButtonMarkupElement","__publicField"],"mappings":";;;;;;;;;;AAoBO,MAAMA,IAAiB,UACjBC,IAAgB,iBA6ChBC,IAAqB,CAACC,MAC/BC,EAAoB;AAAA,EAChB,KAAKJ;AAAA,EACL,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO,CAAC,EAAE,SAAAK,SAAe;AAAA,IACrB,WAAW,EAAE,MAAMA,KAAA,gBAAAA,EAAS,KAAK,QAAQA,KAAA,gBAAAA,EAAS,OAAO;AAAA,EAAA;AAAA,EAE7D,eAAeC;AAAA,EACf,qBAAqBC;AAAA,EACrB,SAAS;AAAA,IACL,OAAOC;AAAA,IACP,oBAAoB;AAAA,MAChB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,YAAY;AAAA,IAChB;AAAA,IACA,8BAA8B;AAAA,IAC9B,WAAAL;AAAA,EACJ;AAAA,EACA,MAAM,CAACM,GAAS,EAAE,MAAAC,SAAY;AAAA,IAC1B,iBAAiB;AAAA,MACb,OAAO;AAAA,QACH;AAAA,UACI,eAAe;AAAA,UACf,gBAAgB;AAAA,QACpB;AAAA,MACJ;AAAA,MACA,SAAS,CAACC,OAAQ;AAAA,QACd,MAAAD;AAAA,QACA,KAAKC,EAAG,aAAa,MAAM;AAAA,QAC3B,QAAQA,EAAG,aAAa,QAAQ,KAAK;AAAA,MAAA;AAAA,IAE7C;AAAA,EAAA;AAER,CAAC,EAAE;AAOA,MAAMC,UAAqBC,EAAO;AAAA,EAGrC,YAAY,EAAE,QAAAC,IAASC,GAAmB,GAAGC,KAA4B;AACrE,UAAMf,GAAe;AAAA,MACjB,QAAQgB;AAAA,MACR,eAAe,IAAIC,EAAoB;AAAA,MACvC,GAAGF;AAAA,IAAA,CACN;AAPE,IAAAG,EAAA,gBAAwB,CAAA;AACvB,IAAAA,EAAA;AAOJ,SAAK,SAASL,GACd,KAAK,YAAYE,KAAA,gBAAAA,EAAO;AAAA,EAC5B;AAAA,EAEA,UAAU;AACN,WAAO,CAACd,EAAmB,KAAK,SAAS,CAAC;AAAA,EAC9C;AACJ;"}
|
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 { InsertNodesOptions, PlateEditor, TText, Value, insertNodes } from '@frontify/fondue';\nimport { TButtonElement } from '../types';\nimport { 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"],"names":["insertButton","editor","createButtonNodeOptions","options","insertNodes","createButtonNode"],"mappings":";;
|
|
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';\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"],"names":["insertButton","editor","createButtonNodeOptions","options","insertNodes","createButtonNode"],"mappings":";;AAOO,MAAMA,IAAe,CACxBC,GACAC,GACAC,MACC;AACD,EAAAC;AAAA,IACIH;AAAA,IACA,CAACI,EAAiBJ,GAAQC,CAAuB,CAAC;AAAA,IAClDC;AAAA,EAAA;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, focusEditor, getPluginOptions } from '@frontify/fondue';\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n"],"names":["submitFloatingButton","editor","isUrl","forceSubmit","getPluginOptions","ELEMENT_BUTTON","url","floatingButtonSelectors","text","buttonStyle","target","floatingButtonActions","upsertButton","_url","focusEditor"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"submitFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, focusEditor, getPluginOptions } from '@frontify/fondue';\n\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\n\nimport { upsertButton } from '.';\n\nexport const submitFloatingButton = <V extends Value>(editor: PlateEditor<V>) => {\n if (!editor.selection) {\n return;\n }\n\n const { isUrl, forceSubmit } = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON);\n const url = floatingButtonSelectors.url();\n\n const isValid = isUrl?.(url) || forceSubmit;\n if (!isValid) {\n return;\n }\n\n const text = floatingButtonSelectors.text();\n const buttonStyle = floatingButtonSelectors.buttonStyle();\n const target = floatingButtonSelectors.newTab() ? undefined : '_self';\n\n floatingButtonActions.reset();\n\n upsertButton(editor, {\n url,\n text,\n buttonStyle,\n target,\n isUrl: (_url) => (forceSubmit || !isUrl ? true : isUrl(_url)),\n });\n\n setTimeout(() => {\n focusEditor(editor, editor.selection ?? undefined);\n }, 0);\n\n return true;\n};\n"],"names":["submitFloatingButton","editor","isUrl","forceSubmit","getPluginOptions","ELEMENT_BUTTON","url","floatingButtonSelectors","text","buttonStyle","target","floatingButtonActions","upsertButton","_url","focusEditor"],"mappings":";;;;AASa,MAAAA,IAAuB,CAAkBC,MAA2B;AACzE,MAAA,CAACA,EAAO;AACR;AAGJ,QAAM,EAAE,OAAAC,GAAO,aAAAC,EAAA,IAAgBC,EAAkCH,GAAQI,CAAc,GACjFC,IAAMC,EAAwB;AAGpC,MAAI,GADYL,KAAA,gBAAAA,EAAQI,OAAQH;AAE5B;AAGE,QAAAK,IAAOD,EAAwB,QAC/BE,IAAcF,EAAwB,eACtCG,IAASH,EAAwB,OAAO,IAAI,SAAY;AAE9D,SAAAI,EAAsB,MAAM,GAE5BC,EAAaX,GAAQ;AAAA,IACjB,KAAAK;AAAA,IACA,MAAAE;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAO,CAACG,MAAUV,KAAe,CAACD,IAAQ,KAAOA,EAAMW,CAAI;AAAA,EAAA,CAC9D,GAED,WAAW,MAAM;AACD,IAAAC,EAAAb,GAAQA,EAAO,aAAa,MAAS;AAAA,KAClD,CAAC,GAEG;AACX;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n PlateEditor,\n UnwrapNodesOptions,\n Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n"],"names":["unwrapButton","editor","options","withoutNormalizing","getAboveNode","_a","getPluginType","ELEMENT_BUTTON","splitNodes","_b","n","isElement","_c","_d","_e","_f","unwrapNodes"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"unwrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type UnwrapNodesOptions,\n type Value,\n getAboveNode,\n getPluginType,\n isElement,\n splitNodes,\n unwrapNodes,\n withoutNormalizing,\n} from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Unwrap button node.\n */\nexport const unwrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n options?: UnwrapNodesOptions & {\n split?: boolean;\n },\n) => {\n return withoutNormalizing(editor, () => {\n if (options?.split) {\n const buttonAboveAnchor = getAboveNode(editor, {\n at: editor.selection?.anchor,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor in button\n if (buttonAboveAnchor) {\n splitNodes(editor, {\n at: editor.selection?.anchor,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.anchor,\n });\n return true;\n }\n const buttonAboveFocus = getAboveNode(editor, {\n at: editor.selection?.focus,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // focus in button\n if (buttonAboveFocus) {\n splitNodes(editor, {\n at: editor.selection?.focus,\n match: (n) => isElement(n) && n.type === getPluginType(editor, ELEMENT_BUTTON),\n });\n unwrapButton(editor, {\n at: editor.selection?.focus,\n });\n return true;\n }\n }\n\n unwrapNodes(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n ...options,\n });\n\n return;\n });\n};\n"],"names":["unwrapButton","editor","options","withoutNormalizing","getAboveNode","_a","getPluginType","ELEMENT_BUTTON","splitNodes","_b","n","isElement","_c","_d","_e","_f","unwrapNodes"],"mappings":";;AAmBa,MAAAA,IAAe,CACxBC,GACAC,MAIOC,EAAmBF,GAAQ,MAAM;;AACpC,MAAIC,KAAA,QAAAA,EAAS,OAAO;AAOhB,QAN0BE,EAAaH,GAAQ;AAAA,MAC3C,KAAII,IAAAJ,EAAO,cAAP,gBAAAI,EAAkB;AAAA,MACtB,OAAO,EAAE,MAAMC,EAAcL,GAAQM,CAAc,EAAE;AAAA,IAAA,CACxD;AAIG,aAAAC,EAAWP,GAAQ;AAAA,QACf,KAAIQ,IAAAR,EAAO,cAAP,gBAAAQ,EAAkB;AAAA,QACtB,OAAO,CAACC,MAAMC,EAAUD,CAAC,KAAKA,EAAE,SAASJ,EAAcL,GAAQM,CAAc;AAAA,MAAA,CAChF,GACDP,EAAaC,GAAQ;AAAA,QACjB,KAAIW,IAAAX,EAAO,cAAP,gBAAAW,EAAkB;AAAA,MAAA,CACzB,GACM;AAQX,QANyBR,EAAaH,GAAQ;AAAA,MAC1C,KAAIY,IAAAZ,EAAO,cAAP,gBAAAY,EAAkB;AAAA,MACtB,OAAO,EAAE,MAAMP,EAAcL,GAAQM,CAAc,EAAE;AAAA,IAAA,CACxD;AAIG,aAAAC,EAAWP,GAAQ;AAAA,QACf,KAAIa,IAAAb,EAAO,cAAP,gBAAAa,EAAkB;AAAA,QACtB,OAAO,CAACJ,MAAMC,EAAUD,CAAC,KAAKA,EAAE,SAASJ,EAAcL,GAAQM,CAAc;AAAA,MAAA,CAChF,GACDP,EAAaC,GAAQ;AAAA,QACjB,KAAIc,IAAAd,EAAO,cAAP,gBAAAc,EAAkB;AAAA,MAAA,CACzB,GACM;AAAA,EAEf;AAEA,EAAAC,EAAYf,GAAQ;AAAA,IAChB,OAAO,EAAE,MAAMK,EAAcL,GAAQM,CAAc,EAAE;AAAA,IACrD,GAAGL;AAAA,EAAA,CACN;AAED,CACH;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n InsertNodesOptions,\n Path,\n PlateEditor,\n TNode,\n TNodeEntry,\n UnwrapNodesOptions,\n Value,\n WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue';\n\nimport { ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { RichTextButtonStyle, TButtonElement } from '../types';\nimport { CreateButtonNodeOptions } from '../utils/index';\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n"],"names":["upsertButton","editor","url","text","buttonStyle","target","insertTextInButton","insertNodesOptions","isUrl","getPluginOptions","ELEMENT_BUTTON","at","buttonAbove","getAboveNode","getPluginType","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","props","getNodeProps","path","_a","leaf","getNodeLeaf","insertButton","getEditorString","unwrapButton","wrapButton","upsertButtonText","_b","_c","setNodes"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type InsertNodesOptions,\n type Path,\n type PlateEditor,\n type TNode,\n type TNodeEntry,\n type UnwrapNodesOptions,\n type Value,\n type WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue';\n\nimport { type ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { type RichTextButtonStyle, type TButtonElement } from '../types';\nimport { type CreateButtonNodeOptions } from '../utils/index';\n\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n"],"names":["upsertButton","editor","url","text","buttonStyle","target","insertTextInButton","insertNodesOptions","isUrl","getPluginOptions","ELEMENT_BUTTON","at","buttonAbove","getAboveNode","getPluginType","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","props","getNodeProps","path","_a","leaf","getNodeLeaf","insertButton","getEditorString","unwrapButton","wrapButton","upsertButtonText","_b","_c","setNodes"],"mappings":";;;;;;AAiDa,MAAAA,IAAe,CACxBC,GACA;AAAA,EACI,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,OAAAC,IAAQC,EAAkCR,GAAQS,CAAc,EAAE;AACtE,MACC;;AACD,QAAMC,IAAKV,EAAO;AAClB,MAAI,CAACU;AACD;AAGE,QAAAC,IAAcC,EAA6BZ,GAAQ;AAAA,IACrD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAE;AAAA,EAAA,CACxD;AAGD,MAAIJ,KAAsBM;AAEtB,WAAAX,EAAO,WAAWC,CAAG,GACd;AAGP,MAAA,EAACM,KAAA,QAAAA,EAAQN;AACT;AAOJ,MAJIa,EAAUZ,CAAI,KAAKA,EAAK,WAAW,MAC5BA,IAAAD,IAGPU;AACA,WAAAI,EAA0Bd,GAAKD,GAAQW,GAAaP,GAAQD,GAAaD,CAAI,GACtE;AAIL,QAAAc,IAAcC,EAAyBjB,GAAQ;AAAA,IACjD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAE;AAAA,EAAA,CACxD,GAEK,CAACS,GAAYC,CAAU,IAAIH,KAAe,CAAA,GAE1CI,IAAoBC,EAA2BrB,GAAQmB,GAAYjB,CAAI;AAEzE,MAAAoB,EAAWZ,CAAE;AACb,WAAAa,EAA0BZ,GAAaX,GAAQC,GAAKE,GAAaC,GAAQF,CAAI,GACtE;AAGX,EAAIkB,KACAI,EAAYxB,GAAQ;AAAA,IAChB,IAAImB;AAAA,EAAA,CACP;AAGL,QAAMM,IAAQC,EAAaR,KAAe,CAAY,CAAA,GAEhDS,KAAOC,IAAA5B,EAAO,cAAP,gBAAA4B,EAAkB,MAAM;AACrC,MAAI,CAACD;AACD;AAIE,QAAAE,IAAOC,EAAY9B,GAAQ2B,CAAI;AAGjC,SAACzB,KAAA,QAAAA,EAAM,WACAA,IAAAD,IAGX8B;AAAA,IACI/B;AAAA,IACA;AAAA,MACI,GAAGyB;AAAA,MACH,KAAAxB;AAAA,MACA,QAAAG;AAAA,MACA,UAAU;AAAA,QACN;AAAA,UACI,GAAGyB;AAAA,UACH,MAAA3B;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,IACAI;AAAA,EAAA,GAEG;AACX;AAEA,SAASe,EAAyCrB,GAAwBmB,GAAmBjB,GAAe;AACxG,SAAOiB,MAAcjB,KAAA,gBAAAA,EAAM,WAAUA,MAAS8B,EAAgBhC,GAAQmB,CAAU;AACpF;AAEA,SAASI,EACLZ,GACAX,GACAC,GACAE,GACAC,GACAF,GACF;AACE,EAAIS,IACAsB,EAAajC,GAAQ;AAAA,IACjB,IAAIW,EAAY,CAAC;AAAA,EAAA,CACpB,IAEDsB,EAAajC,GAAQ;AAAA,IACjB,OAAO;AAAA,EAAA,CACV,GAGLkC,EAAWlC,GAAQ;AAAA,IACf,KAAAC;AAAA,IACA,aAAAE;AAAA,IACA,QAAAC;AAAA,EAAA,CACH,GAED+B,EAAiBnC,GAAQ,EAAE,KAAAC,GAAK,QAAAG,GAAQ,MAAAF,EAAM,CAAA;AAClD;AAEA,SAASa,EACLd,GACAD,GACAW,GACAP,GACAD,GACAD,GACF;;AACE,GACID,QAAQ2B,IAAAjB,EAAY,CAAC,MAAb,gBAAAiB,EAAgB,QACxBxB,QAAWgC,IAAAzB,EAAY,CAAC,MAAb,gBAAAyB,EAAgB,WAC3BjC,QAAgBkC,IAAA1B,EAAY,CAAC,MAAb,gBAAA0B,EAAgB,iBAEhCC;AAAA,IACItC;AAAA,IACA,EAAE,KAAAC,GAAK,QAAAG,GAAQ,aAAAD,EAAY;AAAA,IAC3B;AAAA,MACI,IAAIQ,EAAY,CAAC;AAAA,IACrB;AAAA,EAAA,GAIRwB,EAAiBnC,GAAQ,EAAE,KAAAC,GAAK,MAAAC,GAAM,QAAAE,EAAQ,CAAA;AAClD;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n PlateEditor,\n TText,\n Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\nimport { UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n"],"names":["upsertButtonText","editor","text","newButton","getAboveNode","getPluginType","ELEMENT_BUTTON","newButtonNode","newButtonPath","getEditorString","firstText","replaceNodeChildren"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateEditor,\n type TText,\n type Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nimport { type UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n"],"names":["upsertButtonText","editor","text","newButton","getAboveNode","getPluginType","ELEMENT_BUTTON","newButtonNode","newButtonPath","getEditorString","firstText","replaceNodeChildren"],"mappings":";;AAoBO,MAAMA,IAAmB,CAAkBC,GAAwB,EAAE,MAAAC,QAAmC;AACrG,QAAAC,IAAYC,EAA6BH,GAAQ;AAAA,IACnD,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAE;AAAA,EAAA,CACxD;AAED,MAAIH,GAAW;AACL,UAAA,CAACI,GAAeC,CAAa,IAAIL;AAEvC,QAAID,KAAA,QAAAA,EAAM,UAAUA,MAASO,EAAgBR,GAAQO,CAAa,GAAG;AAC3D,YAAAE,IAAYH,EAAc,SAAS,CAAC;AAG1C,MAAAI,EAA2BV,GAAQ;AAAA,QAC/B,IAAIO;AAAA,QACJ,OAAO,EAAE,GAAGE,GAAW,MAAAR,EAAK;AAAA,QAC5B,eAAe;AAAA,UACX,QAAQ;AAAA,QACZ;AAAA,MAAA,CACH;AAAA,IACL;AAAA,EACJ;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, RichTextButtonStyle, TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n"],"names":["wrapButton","editor","url","buttonStyle","target","options","wrapNodes","getPluginType","ELEMENT_BUTTON"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"wrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type Value, type WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n"],"names":["wrapButton","editor","url","buttonStyle","target","options","wrapNodes","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAea,MAAAA,IAAa,CACtBC,GACA,EAAE,KAAAC,GAAK,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,QAC9B;AACD,EAAAC;AAAA,IACIL;AAAA,IACA;AAAA,MACI,MAAMM,EAAcN,GAAQO,CAAc;AAAA,MAC1C,KAAAN;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,UAAU,CAAC;AAAA,IACf;AAAA,IACA,EAAE,OAAO,IAAM,GAAGC,EAAQ;AAAA,EAAA;AAElC;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createButtonNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, TText, Value, getPluginType } from '@frontify/fondue';\nimport { RichTextButtonStyle, TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n"],"names":["createButtonNode","editor","url","text","buttonStyle","target","children","getPluginType","ELEMENT_BUTTON"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createButtonNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, type TText, type Value, getPluginType } from '@frontify/fondue';\n\nimport { type RichTextButtonStyle, type TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n"],"names":["createButtonNode","editor","url","text","buttonStyle","target","children","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAea,MAAAA,IAAmB,CAC5BC,GACA,EAAE,KAAAC,GAAK,MAAAC,IAAO,IAAI,aAAAC,IAAc,WAAW,QAAAC,GAAQ,UAAAC,SAI5C;AAAA,EACH,MAHSC,EAAcN,GAAQO,CAAc;AAAA,EAI7C,KAAAN;AAAA,EACA,QAAAG;AAAA,EACA,aAAAD;AAAA,EACA,UAAUE,KAAY,CAAC,EAAE,MAAAH,GAAM;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, RichTextButtonStyle, TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n"],"names":["getButtonStyle","editor","linkNode","getAboveNode","ELEMENT_BUTTON","_a"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON, type RichTextButtonStyle, type TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n"],"names":["getButtonStyle","editor","linkNode","getAboveNode","ELEMENT_BUTTON","_a"],"mappings":";;AAMa,MAAAA,IAAiB,CAACC,MAA6C;;AAClE,QAAAC,IAAWC,EAA6BF,GAAQ,EAAE,OAAO,EAAE,MAAMG,EAAe,EAAA,CAAG;AAEzF,SAAK,MAAM,QAAQF,CAAQ,OAInBG,IAAAH,EAAS,CAAC,MAAV,gBAAAG,EAAa,gBAAuC;AAChE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrl.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n"],"names":["getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_BUTTON","getUrlFromEditor","link"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getUrl.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type PlateEditor, getAboveNode } from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON, type TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n"],"names":["getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_BUTTON","getUrlFromEditor","link"],"mappings":";;AAMA,MAAMA,IAAc,CAACC,GAAqBC,MAAiD;AACjF,QAAAC,IAAWC,EAA6BH,GAAQ,EAAE,OAAO,EAAE,MAAMI,EAAe,EAAA,CAAG;AAEzF,SAAK,MAAM,QAAQF,CAAQ,IAIpBD,EAAGC,EAAS,CAAC,CAAC,IAHV;AAIf,GAEaG,IAAmB,CAACL,MACtBD,EAAYC,GAAQ,CAACM,MAASA,EAAK,OAAO,EAAE;"}
|
|
@@ -1 +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 marginTop: '10px',\n marginBottom: '10px',\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 marginTop: '10px',\n marginBottom: '10px',\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 marginTop: '10px',\n marginBottom: '10px',\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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,OAAO;AAAA,MACH,iBAAiB;AAAA,MACjB,aAAa;AAAA,MACb,OAAO;AAAA,IACX;AAAA,EACJ;AACJ;"}
|
|
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 { type 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 marginTop: '10px',\n marginBottom: '10px',\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 marginTop: '10px',\n marginBottom: '10px',\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 marginTop: '10px',\n marginBottom: '10px',\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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,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,WAAW;AAAA,IACX,cAAc;AAAA,IACd,OAAO;AAAA,MACH,iBAAiB;AAAA,MACjB,aAAa;AAAA,MACb,OAAO;AAAA,IACX;AAAA,EACJ;AACJ;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map
CHANGED
|
@@ -1 +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 '@frontify/fondue';\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":";;;
|
|
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 { type PlateEditor, type Value } from '@frontify/fondue';\n\nimport { floatingButtonSelectors } from '../components';\n\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":";;;AAQa,MAAAA,IAAwB,CACjCC,GACA;AAAA,EACI,SAAAC;AACJ,IAEI,OACH;AACG,MAAAC,EAAwB,KAAK,MAAM,QAAQ;AAC3C,IAAAC,EAA0BH,CAAM;AAChC;AAAA,EACJ;AAEA,EAAAI,EAA4BJ,GAAQ;AAAA,IAChC,SAAAC;AAAA,EAAA,CACH;AACL;"}
|
|
@@ -1 +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 '@frontify/fondue';\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":";;;
|
|
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 { type PlateEditor, type Value, findNode, getEditorString, getPluginType } from '@frontify/fondue';\n\nimport { ELEMENT_BUTTON, type 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":";;;AAOa,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;"}
|
|
@@ -1 +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
|
|
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 {\n type PlateEditor,\n type Value,\n getEditorString,\n getPluginType,\n isRangeAcrossBlocks,\n someNode,\n} from '@frontify/fondue';\n\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 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":";;;AAuBa,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,MAIDC,EAAsB,KAAKC,EAAgBR,GAAQA,EAAO,SAAS,CAAC,GAC9CO,EAAA,KAAK,UAAUP,EAAO,EAAE;AAClD;"}
|
|
@@ -1 +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 EText,\n Path,\n PlateEditor,\n Point,\n Range,\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 '@frontify/fondue';\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<Record<string, any>, 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":";;
|
|
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 type EText,\n Path,\n type PlateEditor,\n type Point,\n type Range,\n type Value,\n type 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 '@frontify/fondue';\n\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<Record<string, any>, 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":";;AAmCO,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,IACJ;AAEA,UAAMC,IAAQD,EAAU;AACpB,QAAA,EAACC,KAAA,QAAAA,EAAO,UAAS,CAACA,EAAM,UAAU,CAACC,EAAYD,CAAc,GAAG;AAChE,MAAAH,EAAME,CAAS;AACf;AAAA,IACJ;AAEM,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,IAGnB;AAEA,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,QAC3B;AAAA,MACJ;AAAA,IACJ;AAEc,IAAAjB,EAAA,CAACc,GAAMN,CAAI,CAAC;AAAA,EAAA,GAGvBY;AAAA,IACHvB;AAAA,IACAwB,EAA2D;AAAA,MACvD,SAAS,EAAE,OAAOvB,EAAK;AAAA,IAAA,CAC1B;AAAA,EAAA;AAET;"}
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map
CHANGED
|
@@ -1 +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 {\n LinkFloatingToolbarState,\n UseVirtualFloatingOptions,\n flip,\n offset,\n useFloatingLinkEdit,\n useFloatingLinkEditState,\n useFloatingLinkInsert,\n useFloatingLinkInsertState,\n} from '@frontify/fondue';\nimport { EditModal } from './EditLinkModal';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport type LinkFloatingToolbarProps = {\n state?: LinkFloatingToolbarState;\n};\n\nexport const CustomFloatingLink = () => {\n const insertState = useFloatingLinkInsertState({\n floatingOptions,\n });\n const { props: insertProps, ref: insertRef, hidden } = useFloatingLinkInsert(insertState);\n\n const editState = useFloatingLinkEditState({\n floatingOptions,\n });\n\n const { props: editProps, ref: editRef, editButtonProps, unlinkButtonProps } = useFloatingLinkEdit(editState);\n\n if (hidden) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = editState.isEditing ? (\n input\n ) : (\n <EditModal editButtonProps={editButtonProps} unlinkButtonProps={unlinkButtonProps} />\n );\n\n return (\n <>\n {insertState.isOpen && !editState.isOpen && (\n <div ref={insertRef} {...insertProps} style={{ ...insertProps.style, zIndex: 1000 }}>\n {input}\n </div>\n )}\n\n {editState.isOpen && (\n <div ref={editRef} {...editProps} style={{ ...editProps.style, zIndex: 1000 }}>\n {editContent}\n </div>\n )}\n </>\n );\n};\n"],"names":["floatingOptions","offset","flip","CustomFloatingLink","insertState","useFloatingLinkInsertState","insertProps","insertRef","hidden","useFloatingLinkInsert","editState","useFloatingLinkEditState","editProps","editRef","editButtonProps","unlinkButtonProps","useFloatingLinkEdit","input","InsertLinkModal","editContent","jsx","EditModal","jsxs","Fragment"],"mappings":";;;;
|
|
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 {\n type LinkFloatingToolbarState,\n type UseVirtualFloatingOptions,\n flip,\n offset,\n useFloatingLinkEdit,\n useFloatingLinkEditState,\n useFloatingLinkInsert,\n useFloatingLinkInsertState,\n} from '@frontify/fondue';\n\nimport { EditModal } from './EditLinkModal';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport type LinkFloatingToolbarProps = {\n state?: LinkFloatingToolbarState;\n};\n\nexport const CustomFloatingLink = () => {\n const insertState = useFloatingLinkInsertState({\n floatingOptions,\n });\n const { props: insertProps, ref: insertRef, hidden } = useFloatingLinkInsert(insertState);\n\n const editState = useFloatingLinkEditState({\n floatingOptions,\n });\n\n const { props: editProps, ref: editRef, editButtonProps, unlinkButtonProps } = useFloatingLinkEdit(editState);\n\n if (hidden) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = editState.isEditing ? (\n input\n ) : (\n <EditModal editButtonProps={editButtonProps} unlinkButtonProps={unlinkButtonProps} />\n );\n\n return (\n <>\n {insertState.isOpen && !editState.isOpen && (\n <div ref={insertRef} {...insertProps} style={{ ...insertProps.style, zIndex: 1000 }}>\n {input}\n </div>\n )}\n\n {editState.isOpen && (\n <div ref={editRef} {...editProps} style={{ ...editProps.style, zIndex: 1000 }}>\n {editContent}\n </div>\n )}\n </>\n );\n};\n"],"names":["floatingOptions","offset","flip","CustomFloatingLink","insertState","useFloatingLinkInsertState","insertProps","insertRef","hidden","useFloatingLinkInsert","editState","useFloatingLinkEditState","editProps","editRef","editButtonProps","unlinkButtonProps","useFloatingLinkEdit","input","InsertLinkModal","editContent","jsx","EditModal","jsxs","Fragment"],"mappings":";;;;AAgBA,MAAMA,IAA6C;AAAA,EAC/C,WAAW;AAAA,EACX,UAAU;AAAA,EACV,YAAY;AAAA,IACRC,EAAO,EAAE;AAAA,IACTC,EAAK;AAAA,MACD,SAAS;AAAA,MACT,oBAAoB,CAAC,cAAc,aAAa,SAAS;AAAA,IAAA,CAC5D;AAAA,EACL;AACJ,GAMaC,IAAqB,MAAM;AACpC,QAAMC,IAAcC,EAA2B;AAAA,IAC3C,iBAAAL;AAAA,EAAA,CACH,GACK,EAAE,OAAOM,GAAa,KAAKC,GAAW,QAAAC,EAAO,IAAIC,EAAsBL,CAAW,GAElFM,IAAYC,EAAyB;AAAA,IACvC,iBAAAX;AAAA,EAAA,CACH,GAEK,EAAE,OAAOY,GAAW,KAAKC,GAAS,iBAAAC,GAAiB,mBAAAC,EAAsB,IAAAC,EAAoBN,CAAS;AAE5G,MAAIF;AACO,WAAA;AAGL,QAAAS,sBAASC,GAAgB,CAAA,CAAA,GACzBC,IAAcT,EAAU,YAC1BO,IAEC,gBAAAG,EAAAC,GAAA,EAAU,iBAAAP,GAAkC,mBAAAC,EAAsC,CAAA;AAGvF,SAES,gBAAAO,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAAnB,EAAY,UAAU,CAACM,EAAU,UAC7B,gBAAAU,EAAA,OAAA,EAAI,KAAKb,GAAY,GAAGD,GAAa,OAAO,EAAE,GAAGA,EAAY,OAAO,QAAQ,OACxE,UACLW,GAAA;AAAA,IAGHP,EAAU,UACP,gBAAAU,EAAC,OAAI,EAAA,KAAKP,GAAU,GAAGD,GAAW,OAAO,EAAE,GAAGA,EAAU,OAAO,QAAQ,OAClE,UACLO,GAAA;AAAA,EAER,EAAA,CAAA;AAER;"}
|
|
@@ -1 +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 {
|
|
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 { FloatingModalWrapper, IconPen16, IconTrashBin16, useLinkOpenButtonState } from '@frontify/fondue';\nimport { type MouseEvent } from 'react';\n\nimport { getUrlFromLinkOrLegacyLink } from '../../../../../Link';\n\ntype EditModalProps = {\n editButtonProps: {\n onClick: () => void;\n };\n unlinkButtonProps: {\n onMouseDown: (e: MouseEvent<HTMLButtonElement>) => void;\n onClick: () => void;\n };\n};\n\nexport const EditModal = ({ editButtonProps, unlinkButtonProps }: EditModalProps) => {\n const { element } = useLinkOpenButtonState();\n const url = element ? getUrlFromLinkOrLegacyLink(element) : '';\n\n return (\n <FloatingModalWrapper data-test-id=\"floating-link-edit\" padding=\"16px\" minWidth=\"400px\">\n <span data-test-id=\"preview-link-flyout\" className=\"tw-flex tw-justify-between tw-items-center\">\n <span className=\"tw-pointer-events-none\">{url}</span>\n <span className=\"tw-flex tw-gap-2\">\n <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 {...editButtonProps}\n >\n <IconPen16 />\n </button>\n\n <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 {...unlinkButtonProps}\n >\n <IconTrashBin16 />\n </button>\n </span>\n </span>\n </FloatingModalWrapper>\n );\n};\n"],"names":["EditModal","editButtonProps","unlinkButtonProps","element","useLinkOpenButtonState","url","getUrlFromLinkOrLegacyLink","jsx","FloatingModalWrapper","jsxs","IconPen16","IconTrashBin16"],"mappings":";;;AAiBO,MAAMA,IAAY,CAAC,EAAE,iBAAAC,GAAiB,mBAAAC,QAAwC;AAC3E,QAAA,EAAE,SAAAC,MAAYC,KACdC,IAAMF,IAAUG,EAA2BH,CAAO,IAAI;AAE5D,SACK,gBAAAI,EAAAC,GAAA,EAAqB,gBAAa,sBAAqB,SAAQ,QAAO,UAAS,SAC5E,UAAC,gBAAAC,EAAA,QAAA,EAAK,gBAAa,uBAAsB,WAAU,8CAC/C,UAAA;AAAA,IAAC,gBAAAF,EAAA,QAAA,EAAK,WAAU,0BAA0B,UAAIF,GAAA;AAAA,IAC9C,gBAAAI,EAAC,QAAK,EAAA,WAAU,oBACZ,UAAA;AAAA,MAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UACT,GAAGN;AAAA,UAEJ,4BAACS,GAAU,EAAA;AAAA,QAAA;AAAA,MACf;AAAA,MAEA,gBAAAH;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UACT,GAAGL;AAAA,UAEJ,4BAACS,GAAe,EAAA;AAAA,QAAA;AAAA,MACpB;AAAA,IAAA,GACJ;AAAA,EAAA,EACJ,CAAA,EACJ,CAAA;AAER;"}
|
|
@@ -1 +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 {
|
|
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 { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n Button,\n ButtonEmphasis,\n ButtonSize,\n ButtonStyle,\n FloatingModalWrapper,\n FormControl,\n IconCheckMark20,\n TextInput,\n} from '@frontify/fondue';\nimport { type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { LinkInput } from '../../../../../Link';\n\nimport { type 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: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => void;\n hasValues: boolean;\n isValidUrlOrEmpty: (url: string) => boolean;\n testId?: string;\n children?: ReactNode;\n appBridge: AppBridgeBlock;\n};\n\nexport const InsertModal = ({\n state,\n onTextChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n isValidUrlOrEmpty,\n hasValues,\n testId,\n appBridge,\n children,\n}: Props): ReactElement => (\n <FloatingModalWrapper data-test-id={testId} padding=\"28px\" minWidth=\"400px\">\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-mt-5\">\n <LinkInput\n url={state.url}\n newTab={state.newTab}\n onUrlChange={onUrlChange}\n onToggleTab={onToggleTab}\n isValidUrlOrEmpty={isValidUrlOrEmpty}\n appBridge={appBridge}\n />\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={!isValidUrlOrEmpty(state?.url) || !hasValues}\n >\n Save\n </Button>\n </div>\n </div>\n </FloatingModalWrapper>\n);\n"],"names":["InsertModal","state","onTextChange","onUrlChange","onToggleTab","onCancel","onSave","isValidUrlOrEmpty","hasValues","testId","appBridge","children","FloatingModalWrapper","jsx","FormControl","TextInput","LinkInput","jsxs","Button","ButtonSize","ButtonStyle","ButtonEmphasis","IconCheckMark20"],"mappings":";;;AAiCO,MAAMA,IAAc,CAAC;AAAA,EACxB,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,wBACKC,GAAqB,EAAA,gBAAcH,GAAQ,SAAQ,QAAO,UAAS,SAChE,UAAA;AAAA,EAAA,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU;AAAA,MACd;AAAA,MAEA,UAAA,gBAAAD,EAACE,GAAU,EAAA,IAAG,YAAW,OAAOd,EAAM,MAAM,aAAY,aAAY,UAAUC,EAAc,CAAA;AAAA,IAAA;AAAA,EAChG;AAAA,EAECS;AAAA,EAED,gBAAAE,EAAC,OAAI,EAAA,WAAU,WACX,UAAA,gBAAAA;AAAA,IAACG;AAAA,IAAA;AAAA,MACG,KAAKf,EAAM;AAAA,MACX,QAAQA,EAAM;AAAA,MACd,aAAAE;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAG;AAAA,MACA,WAAAG;AAAA,IAAA;AAAA,EAAA,GAER;AAAA,oBACC,OAAI,EAAA,WAAU,WACX,UAAC,gBAAAO,EAAA,OAAA,EAAI,WAAW,8EACZ,UAAA;AAAA,IAAA,gBAAAJ;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,IACA,gBAAAR;AAAA,MAACK;AAAA,MAAA;AAAA,QACG,SAASZ;AAAA,QACT,MAAMa,EAAW;AAAA,QACjB,wBAAOG,GAAgB,EAAA;AAAA,QACvB,UAAU,CAACf,EAAkBN,KAAA,gBAAAA,EAAO,GAAG,KAAK,CAACO;AAAA,QAChD,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAAA,EAAA,CACJ,EACJ,CAAA;AAAA,EACJ,CAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CheckboxState as r, useEditorRef as h, floatingLinkSelectors as i, getPluginOptions as m, ELEMENT_LINK as b, useHotkeys as E, floatingLinkActions as a, submitFloatingLink as k } from "@frontify/fondue";
|
|
2
|
+
import { useEffect as U, useReducer as x } from "react";
|
|
3
3
|
import { getLegacyUrl as w, getUrl as I } from "../../utils/getUrl.es.js";
|
|
4
4
|
import { isValidUrlOrEmpty as T } from "../../../../../Link/utils/url.es.js";
|
|
5
5
|
import { addHttps as L } from "../../../../../../helpers/addHttps.es.js";
|
|
@@ -8,7 +8,7 @@ const N = {
|
|
|
8
8
|
text: "",
|
|
9
9
|
newTab: r.Unchecked
|
|
10
10
|
}, A = () => {
|
|
11
|
-
const [o, n] =
|
|
11
|
+
const [o, n] = x((t, s) => {
|
|
12
12
|
const { type: c, payload: l } = s;
|
|
13
13
|
switch (c) {
|
|
14
14
|
case "NEW_TAB":
|
|
@@ -34,8 +34,8 @@ const N = {
|
|
|
34
34
|
}, N);
|
|
35
35
|
return [o, n];
|
|
36
36
|
}, R = () => {
|
|
37
|
-
const o =
|
|
38
|
-
|
|
37
|
+
const o = h(), [n, t] = A();
|
|
38
|
+
U(() => {
|
|
39
39
|
const e = w(o), f = I(o), y = i.newTab();
|
|
40
40
|
t({
|
|
41
41
|
type: "INIT",
|
|
@@ -61,9 +61,9 @@ const N = {
|
|
|
61
61
|
}, d = () => {
|
|
62
62
|
a.reset();
|
|
63
63
|
}, u = (e) => {
|
|
64
|
-
!T(n.url) || !p || (a.text(n.text), a.url(L(n.url)), a.newTab(n.newTab === r.Checked),
|
|
65
|
-
}, p = n.url !== "" && n.text !== "", { appBridge: g } =
|
|
66
|
-
return
|
|
64
|
+
!T(n.url) || !p || (a.text(n.text), a.url(L(n.url)), a.newTab(n.newTab === r.Checked), k(o) && (e == null || e.preventDefault()));
|
|
65
|
+
}, p = n.url !== "" && n.text !== "", { appBridge: g } = m(o, b);
|
|
66
|
+
return E(
|
|
67
67
|
"enter",
|
|
68
68
|
u,
|
|
69
69
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInsertModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {
|
|
1
|
+
{"version":3,"file":"useInsertModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n CheckboxState,\n ELEMENT_LINK,\n floatingLinkActions,\n floatingLinkSelectors,\n getPluginOptions,\n submitFloatingLink,\n useEditorRef,\n useHotkeys,\n} from '@frontify/fondue';\nimport { type Dispatch, type MouseEvent, type Reducer, useEffect, useReducer } from 'react';\n\nimport { addHttps } from '../../../../../../helpers';\nimport { isValidUrlOrEmpty } from '../../../../../Link';\nimport { getLegacyUrl, getUrl } from '../../utils';\n\nimport { type InsertModalDispatchType, type InsertModalStateProps } from './types';\n\nconst initialState: InsertModalStateProps = {\n url: '',\n text: '',\n newTab: CheckboxState.Unchecked,\n};\n\nexport const InsertModalState = (): [InsertModalStateProps, Dispatch<InsertModalDispatchType>] => {\n const [state, dispatch] = useReducer<Reducer<InsertModalStateProps, InsertModalDispatchType>>((state, action) => {\n const { type, payload } = action;\n\n switch (type) {\n case 'NEW_TAB':\n return {\n ...state,\n newTab: CheckboxState.Checked,\n };\n case 'SAME_TAB':\n return {\n ...state,\n newTab: CheckboxState.Unchecked,\n };\n case 'URL':\n case 'TEXT':\n case 'INIT':\n return {\n ...state,\n ...payload,\n };\n default:\n return state;\n }\n }, initialState);\n\n return [state, dispatch];\n};\n\nexport const useInsertModal = () => {\n const editor = useEditorRef();\n const [state, dispatch] = InsertModalState();\n\n useEffect(() => {\n const legacyUrl = getLegacyUrl(editor);\n const url = getUrl(editor);\n const isNewTab = floatingLinkSelectors.newTab();\n dispatch({\n type: 'INIT',\n payload: {\n text: floatingLinkSelectors.text(),\n newTab: isNewTab ? CheckboxState.Checked : CheckboxState.Unchecked,\n url: legacyUrl && url === '' ? legacyUrl : floatingLinkSelectors.url(),\n },\n });\n }, [dispatch, editor]);\n\n const onTextChange = (value: string) => {\n dispatch({\n type: 'TEXT',\n payload: { text: value },\n });\n };\n\n const onUrlChange = (value: string) => {\n dispatch({\n type: 'URL',\n payload: { url: value },\n });\n };\n\n const onToggleTab = (checked: boolean) => {\n checked ? dispatch({ type: 'NEW_TAB' }) : dispatch({ type: 'SAME_TAB' });\n };\n\n const onCancel = () => {\n floatingLinkActions.reset();\n };\n\n const onSave = (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => {\n if (!isValidUrlOrEmpty(state.url) || !hasValues) {\n return;\n }\n\n floatingLinkActions.text(state.text);\n floatingLinkActions.url(addHttps(state.url));\n floatingLinkActions.newTab(state.newTab === CheckboxState.Checked);\n\n if (submitFloatingLink(editor)) {\n event?.preventDefault();\n }\n };\n\n const hasValues = state.url !== '' && state.text !== '';\n\n const { appBridge } = getPluginOptions<{ appBridge: AppBridgeBlock }>(editor, ELEMENT_LINK);\n\n useHotkeys(\n 'enter',\n onSave,\n {\n enableOnFormTags: ['INPUT'],\n },\n [],\n );\n\n return { state, onTextChange, onUrlChange, onToggleTab, onCancel, onSave, hasValues, isValidUrlOrEmpty, appBridge };\n};\n"],"names":["initialState","CheckboxState","InsertModalState","state","dispatch","useReducer","action","type","payload","useInsertModal","editor","useEditorRef","useEffect","legacyUrl","getLegacyUrl","url","getUrl","isNewTab","floatingLinkSelectors","onTextChange","value","onUrlChange","onToggleTab","checked","onCancel","floatingLinkActions","onSave","event","isValidUrlOrEmpty","hasValues","addHttps","submitFloatingLink","appBridge","getPluginOptions","ELEMENT_LINK","useHotkeys"],"mappings":";;;;;AAqBA,MAAMA,IAAsC;AAAA,EACxC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQC,EAAc;AAC1B,GAEaC,IAAmB,MAAkE;AAC9F,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAoE,CAACF,GAAOG,MAAW;AACvG,UAAA,EAAE,MAAAC,GAAM,SAAAC,EAAY,IAAAF;AAE1B,YAAQC,GAAM;AAAA,MACV,KAAK;AACM,eAAA;AAAA,UACH,GAAGJ;AAAAA,UACH,QAAQF,EAAc;AAAA,QAAA;AAAA,MAE9B,KAAK;AACM,eAAA;AAAA,UACH,GAAGE;AAAAA,UACH,QAAQF,EAAc;AAAA,QAAA;AAAA,MAE9B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACM,eAAA;AAAA,UACH,GAAGE;AAAAA,UACH,GAAGK;AAAA,QAAA;AAAA,MAEX;AACWL,eAAAA;AAAAA,IACf;AAAA,KACDH,CAAY;AAER,SAAA,CAACG,GAAOC,CAAQ;AAC3B,GAEaK,IAAiB,MAAM;AAChC,QAAMC,IAASC,KACT,CAACR,GAAOC,CAAQ,IAAIF,EAAiB;AAE3C,EAAAU,EAAU,MAAM;AACN,UAAAC,IAAYC,EAAaJ,CAAM,GAC/BK,IAAMC,EAAON,CAAM,GACnBO,IAAWC,EAAsB;AAC9B,IAAAd,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,QACL,MAAMc,EAAsB,KAAK;AAAA,QACjC,QAAQD,IAAWhB,EAAc,UAAUA,EAAc;AAAA,QACzD,KAAKY,KAAaE,MAAQ,KAAKF,IAAYK,EAAsB,IAAI;AAAA,MACzE;AAAA,IAAA,CACH;AAAA,EAAA,GACF,CAACd,GAAUM,CAAM,CAAC;AAEf,QAAAS,IAAe,CAACC,MAAkB;AAC3B,IAAAhB,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,MAAMgB,EAAM;AAAA,IAAA,CAC1B;AAAA,EAAA,GAGCC,IAAc,CAACD,MAAkB;AAC1B,IAAAhB,EAAA;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,KAAKgB,EAAM;AAAA,IAAA,CACzB;AAAA,EAAA,GAGCE,IAAc,CAACC,MAAqB;AAC5B,IAAAnB,EAAAmB,IAAS,EAAE,MAAM,UAAU,IAAc,EAAE,MAAM,WAAA,CAArB;AAAA,EAAiC,GAGrEC,IAAW,MAAM;AACnB,IAAAC,EAAoB,MAAM;AAAA,EAAA,GAGxBC,IAAS,CAACC,MAA4F;AACxG,IAAI,CAACC,EAAkBzB,EAAM,GAAG,KAAK,CAAC0B,MAIlBJ,EAAA,KAAKtB,EAAM,IAAI,GACnCsB,EAAoB,IAAIK,EAAS3B,EAAM,GAAG,CAAC,GAC3CsB,EAAoB,OAAOtB,EAAM,WAAWF,EAAc,OAAO,GAE7D8B,EAAmBrB,CAAM,MACzBiB,KAAA,QAAAA,EAAO;AAAA,EACX,GAGEE,IAAY1B,EAAM,QAAQ,MAAMA,EAAM,SAAS,IAE/C,EAAE,WAAA6B,EAAc,IAAAC,EAAgDvB,GAAQwB,CAAY;AAE1F,SAAAC;AAAA,IACI;AAAA,IACAT;AAAA,IACA;AAAA,MACI,kBAAkB,CAAC,OAAO;AAAA,IAC9B;AAAA,IACA,CAAC;AAAA,EAAA,GAGE,EAAE,OAAAvB,GAAO,cAAAgB,GAAc,aAAAE,GAAa,aAAAC,GAAa,UAAAE,GAAU,QAAAE,GAAQ,WAAAG,GAAW,mBAAAD,GAAmB,WAAAI;AAC5G;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n PluginButtonProps,\n getHotkeyByPlatform,\n getTooltip,\n isRangeInSameBlock,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue';\nimport { LinkToolbarButton } from './LinkToolbarButton';\n\nexport const LinkButton = ({ id, editorId }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n\n return (\n <div data-plugin-id={id}>\n <LinkToolbarButton\n disabled={!isEnabled}\n tooltip={getTooltip(\n isEnabled\n ? `Link\\n${getHotkeyByPlatform('Ctrl+K')}`\n : 'Links can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n"],"names":["LinkButton","id","editorId","editor","useEditorState","useEventPlateId","isEnabled","isRangeInSameBlock","jsx","LinkToolbarButton","getTooltip","getHotkeyByPlatform"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"LinkButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PluginButtonProps,\n getHotkeyByPlatform,\n getTooltip,\n isRangeInSameBlock,\n useEditorState,\n useEventPlateId,\n} from '@frontify/fondue';\n\nimport { LinkToolbarButton } from './LinkToolbarButton';\n\nexport const LinkButton = ({ id, editorId }: PluginButtonProps) => {\n const editor = useEditorState(useEventPlateId(editorId));\n const isEnabled = !!isRangeInSameBlock(editor, {\n at: editor.selection,\n });\n\n return (\n <div data-plugin-id={id}>\n <LinkToolbarButton\n disabled={!isEnabled}\n tooltip={getTooltip(\n isEnabled\n ? `Link\\n${getHotkeyByPlatform('Ctrl+K')}`\n : 'Links can only be set for a single text block.',\n )}\n />\n </div>\n );\n};\n"],"names":["LinkButton","id","editorId","editor","useEditorState","useEventPlateId","isEnabled","isRangeInSameBlock","jsx","LinkToolbarButton","getTooltip","getHotkeyByPlatform"],"mappings":";;;AAaO,MAAMA,IAAa,CAAC,EAAE,IAAAC,GAAI,UAAAC,QAAkC;AAC/D,QAAMC,IAASC,EAAeC,EAAgBH,CAAQ,CAAC,GACjDI,IAAY,CAAC,CAACC,EAAmBJ,GAAQ;AAAA,IAC3C,IAAIA,EAAO;AAAA,EAAA,CACd;AAGG,SAAA,gBAAAK,EAAC,OAAI,EAAA,kBAAgBP,GACjB,UAAA,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,UAAU,CAACH;AAAA,MACX,SAASI;AAAA,QACLJ,IACM;AAAA,EAASK,EAAoB,QAAQ,CAAC,KACtC;AAAA,MACV;AAAA,IAAA;AAAA,EAER,EAAA,CAAA;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkMarkupElementNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateRenderElementProps,\n TLinkElement as TPlateLinkElement,\n useRichTextEditorContext,\n} from '@frontify/fondue';\nimport { LINK_PLUGIN } from '../id';\n\nexport type TLinkElement = TPlateLinkElement & {\n chosenLink?: {\n searchResult?: {\n link?: string;\n };\n openInNewTab?: boolean;\n };\n};\n\nexport const LinkMarkupElementNode = (props: PlateRenderElementProps & { element: TLinkElement }) => {\n const { attributes, children } = props;\n\n const { styles } = useRichTextEditorContext();\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n\n return (\n <a {...attributes} href={href} target={target} style={styles[LINK_PLUGIN]}>\n {children}\n </a>\n );\n};\n"],"names":["LinkMarkupElementNode","props","attributes","children","styles","useRichTextEditorContext","href","_b","_a","target","jsx","LINK_PLUGIN"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"LinkMarkupElementNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type PlateRenderElementProps,\n type TLinkElement as TPlateLinkElement,\n useRichTextEditorContext,\n} from '@frontify/fondue';\n\nimport { LINK_PLUGIN } from '../id';\n\nexport type TLinkElement = TPlateLinkElement & {\n chosenLink?: {\n searchResult?: {\n link?: string;\n };\n openInNewTab?: boolean;\n };\n};\n\nexport const LinkMarkupElementNode = (props: PlateRenderElementProps & { element: TLinkElement }) => {\n const { attributes, children } = props;\n\n const { styles } = useRichTextEditorContext();\n const href = props.element.url || props.element.chosenLink?.searchResult?.link || '';\n const target = props.element.target || '_self';\n\n return (\n <a {...attributes} href={href} target={target} style={styles[LINK_PLUGIN]}>\n {children}\n </a>\n );\n};\n"],"names":["LinkMarkupElementNode","props","attributes","children","styles","useRichTextEditorContext","href","_b","_a","target","jsx","LINK_PLUGIN"],"mappings":";;;AAmBa,MAAAA,IAAwB,CAACC,MAA+D;;AAC3F,QAAA,EAAE,YAAAC,GAAY,UAAAC,EAAa,IAAAF,GAE3B,EAAE,QAAAG,MAAWC,KACbC,IAAOL,EAAM,QAAQ,SAAOM,KAAAC,IAAAP,EAAM,QAAQ,eAAd,gBAAAO,EAA0B,iBAA1B,gBAAAD,EAAwC,SAAQ,IAC5EE,IAASR,EAAM,QAAQ,UAAU;AAGnC,SAAA,gBAAAS,EAAC,KAAG,EAAA,GAAGR,GAAY,MAAAI,GAAY,QAAAG,GAAgB,OAAOL,EAAOO,CAAW,GACnE,UAAAR,EACL,CAAA;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, MarkupElement, type PlateRenderElementProps } from '@frontify/fondue';\n\nimport { LinkMarkupElementNode, TLinkElement } from './LinkMarkupElementNode';\n\nexport class LinkMarkupElement extends MarkupElement {\n constructor(\n id = ELEMENT_LINK,\n node: (props: PlateRenderElementProps & { element: TLinkElement }) => JSX.Element = LinkMarkupElementNode,\n ) {\n super(id, node);\n }\n}\n"],"names":["LinkMarkupElement","MarkupElement","id","ELEMENT_LINK","node","LinkMarkupElementNode"],"mappings":";;AAMO,MAAMA,UAA0BC,EAAc;AAAA,EACjD,YACIC,IAAKC,GACLC,IAAoFC,GACtF;AACE,UAAMH,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LINK, MarkupElement, type PlateRenderElementProps } from '@frontify/fondue';\n\nimport { LinkMarkupElementNode, type TLinkElement } from './LinkMarkupElementNode';\n\nexport class LinkMarkupElement extends MarkupElement {\n constructor(\n id = ELEMENT_LINK,\n node: (props: PlateRenderElementProps & { element: TLinkElement }) => JSX.Element = LinkMarkupElementNode,\n ) {\n super(id, node);\n }\n}\n"],"names":["LinkMarkupElement","MarkupElement","id","ELEMENT_LINK","node","LinkMarkupElementNode"],"mappings":";;AAMO,MAAMA,UAA0BC,EAAc;AAAA,EACjD,YACIC,IAAKC,GACLC,IAAoFC,GACtF;AACE,UAAMH,GAAIE,CAAI;AAAA,EAClB;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkToolbarButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n IconLink16,\n IconStylingWrapper,\n ToolbarButton,\n focusEditor,\n useEditorRef,\n useLinkToolbarButton,\n useLinkToolbarButtonState,\n} from '@frontify/fondue';\
|
|
1
|
+
{"version":3,"file":"LinkToolbarButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n IconLink16,\n IconStylingWrapper,\n ToolbarButton,\n focusEditor,\n useEditorRef,\n useLinkToolbarButton,\n useLinkToolbarButtonState,\n} from '@frontify/fondue';\nimport { type ReactNode, forwardRef } from 'react';\n\nexport const LinkToolbarButton = forwardRef<HTMLButtonElement, { disabled: boolean; tooltip: ReactNode }>(\n (rootProps, ref) => {\n const editor = useEditorRef();\n const state = useLinkToolbarButtonState();\n const { props } = useLinkToolbarButton(state);\n return (\n <ToolbarButton\n onMouseDown={() => {\n focusEditor(editor, editor.selection ?? editor.prevSelection ?? undefined);\n }}\n ref={ref}\n {...props}\n {...rootProps}\n >\n <IconStylingWrapper icon={<IconLink16 />} />\n </ToolbarButton>\n );\n },\n);\n\nLinkToolbarButton.displayName = 'LinkToolbarButton';\n"],"names":["LinkToolbarButton","forwardRef","rootProps","ref","editor","useEditorRef","state","useLinkToolbarButtonState","props","useLinkToolbarButton","jsx","ToolbarButton","focusEditor","IconStylingWrapper","IconLink16"],"mappings":";;;AAaO,MAAMA,IAAoBC;AAAA,EAC7B,CAACC,GAAWC,MAAQ;AAChB,UAAMC,IAASC,KACTC,IAAQC,KACR,EAAE,OAAAC,EAAA,IAAUC,EAAqBH,CAAK;AAExC,WAAA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,aAAa,MAAM;AACf,UAAAC,EAAYR,GAAQA,EAAO,aAAaA,EAAO,iBAAiB,MAAS;AAAA,QAC7E;AAAA,QACA,KAAAD;AAAA,QACC,GAAGK;AAAA,QACH,GAAGN;AAAA,QAEJ,UAAC,gBAAAQ,EAAAG,GAAA,EAAmB,MAAM,gBAAAH,EAACI,IAAW,CAAA,GAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAGtD;AACJ;AAEAd,EAAkB,cAAc;"}
|