@contentful/field-editor-rich-text 3.15.0 → 3.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ContentfulEditorProvider.js +8 -8
- package/dist/cjs/RichTextEditor.js +22 -20
- package/dist/cjs/RichTextEditor.styles.js +2 -1
- package/dist/cjs/SdkProvider.js +7 -5
- package/dist/cjs/SyncEditorChanges.js +15 -6
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +17 -15
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +14 -10
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +10 -8
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
- package/dist/cjs/Toolbar/index.js +33 -30
- package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
- package/dist/cjs/__fixtures__/asset/index.js +10 -10
- package/dist/cjs/__fixtures__/content-type/index.js +1 -1
- package/dist/cjs/__fixtures__/entry/index.js +7 -7
- package/dist/cjs/__fixtures__/fixtures.js +8 -6
- package/dist/cjs/__fixtures__/locale/index.js +2 -2
- package/dist/cjs/__fixtures__/space/index.js +1 -1
- package/dist/cjs/constants/Schema.js +1 -0
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +43 -38
- package/dist/cjs/dialogs/openRichTextDialog.js +6 -4
- package/dist/cjs/dialogs/renderRichTextDialog.js +6 -4
- package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +10 -10
- package/dist/cjs/helpers/callbacks.js +3 -3
- package/dist/cjs/helpers/config.js +2 -2
- package/dist/cjs/helpers/editor.js +53 -44
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +5 -4
- package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +22 -5
- package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +29 -5
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +14 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +3 -2
- package/dist/cjs/helpers/toSlateValue.js +14 -3
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +12 -9
- package/dist/cjs/index.js +7 -5
- package/dist/cjs/internal/constants.js +4 -2
- package/dist/cjs/internal/hooks.js +8 -6
- package/dist/cjs/internal/misc.js +15 -12
- package/dist/cjs/internal/queries.js +115 -108
- package/dist/cjs/internal/transforms.js +51 -48
- package/dist/cjs/internal/types/editor.js +3 -1
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +4 -3
- package/dist/cjs/plugins/Break/createResetNodePlugin.js +1 -0
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +35 -33
- package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +7 -5
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +7 -3
- package/dist/cjs/plugins/CommandPalette/onKeyDown.js +6 -1
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +6 -4
- package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +2 -0
- package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
- package/dist/cjs/plugins/DragAndDrop/index.js +9 -1
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +10 -8
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +19 -17
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +9 -7
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +13 -11
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +5 -5
- package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
- package/dist/cjs/plugins/Heading/components/Heading.js +13 -10
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +19 -11
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +7 -2
- package/dist/cjs/plugins/Hr/index.js +19 -14
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +32 -28
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -6
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -6
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +7 -5
- package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +10 -4
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +6 -3
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +6 -4
- package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
- package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +29 -25
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/cjs/plugins/List/components/List.js +9 -7
- package/dist/cjs/plugins/List/components/ListItem.js +6 -4
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +7 -5
- package/dist/cjs/plugins/List/createListPlugin.js +4 -0
- package/dist/cjs/plugins/List/insertListBreak.js +13 -4
- package/dist/cjs/plugins/List/insertListFragment.js +18 -5
- package/dist/cjs/plugins/List/onKeyDownList.js +7 -4
- package/dist/cjs/plugins/List/transforms/insertListItem.js +17 -2
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +8 -2
- package/dist/cjs/plugins/List/transforms/moveListItems.js +7 -2
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +15 -14
- package/dist/cjs/plugins/List/transforms/toggleList.js +8 -3
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/cjs/plugins/List/transforms/unwrapList.js +7 -2
- package/dist/cjs/plugins/List/utils.js +12 -11
- package/dist/cjs/plugins/List/withList.js +6 -2
- package/dist/cjs/plugins/Marks/Bold.js +9 -7
- package/dist/cjs/plugins/Marks/Code.js +15 -7
- package/dist/cjs/plugins/Marks/Italic.js +9 -7
- package/dist/cjs/plugins/Marks/Subscript.js +10 -8
- package/dist/cjs/plugins/Marks/Superscript.js +10 -8
- package/dist/cjs/plugins/Marks/Underline.js +6 -4
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +9 -7
- package/dist/cjs/plugins/Marks/helpers.js +5 -5
- package/dist/cjs/plugins/Normalizer/baseRules.js +2 -0
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/cjs/plugins/Normalizer/utils.js +4 -3
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +23 -3
- package/dist/cjs/plugins/Paragraph/Paragraph.js +6 -4
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +3 -2
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -6
- package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +9 -0
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/cjs/plugins/Quote/components/Quote.js +6 -4
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +6 -4
- package/dist/cjs/plugins/Quote/createQuotePlugin.js +1 -0
- package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
- package/dist/cjs/plugins/Quote/withQuote.js +4 -2
- package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
- package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
- package/dist/cjs/plugins/Table/__tests__/helpers.test.js +4 -4
- package/dist/cjs/plugins/Table/actions/addColumn.js +5 -4
- package/dist/cjs/plugins/Table/actions/addRow.js +6 -3
- package/dist/cjs/plugins/Table/components/Cell.js +7 -5
- package/dist/cjs/plugins/Table/components/HeaderCell.js +7 -5
- package/dist/cjs/plugins/Table/components/Row.js +6 -4
- package/dist/cjs/plugins/Table/components/Table.js +8 -6
- package/dist/cjs/plugins/Table/components/TableActions.js +19 -16
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +7 -4
- package/dist/cjs/plugins/Table/createTablePlugin.js +11 -1
- package/dist/cjs/plugins/Table/helpers.js +16 -12
- package/dist/cjs/plugins/Table/insertTableFragment.js +15 -2
- package/dist/cjs/plugins/Table/onKeyDownTable.js +10 -2
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
- package/dist/cjs/plugins/Text/createTextPlugin.js +22 -5
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +5 -4
- package/dist/cjs/plugins/Tracking/utils.js +6 -3
- package/dist/cjs/plugins/Voids/createVoidsPlugin.js +5 -0
- package/dist/cjs/plugins/Voids/transformVoid.js +1 -0
- package/dist/cjs/plugins/index.js +15 -3
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +12 -10
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +16 -6
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +10 -8
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +9 -5
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +13 -11
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +14 -12
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +14 -11
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +8 -4
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +10 -6
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +5 -3
- package/dist/cjs/plugins/shared/ToolbarButton.js +8 -6
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +10 -5
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +11 -6
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +15 -13
- package/dist/cjs/plugins/shared/utils.js +4 -1
- package/dist/cjs/test-utils/assertOutput.js +1 -0
- package/dist/cjs/test-utils/hyperscript.d.js +1 -0
- package/dist/cjs/test-utils/randomId.js +3 -1
- package/dist/cjs/test-utils/validation.js +8 -5
- package/dist/esm/ContentfulEditorProvider.js +4 -1
- package/dist/esm/RichTextEditor.js +13 -13
- package/dist/esm/RichTextEditor.styles.js +1 -0
- package/dist/esm/SdkProvider.js +2 -2
- package/dist/esm/SyncEditorChanges.js +18 -3
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +10 -8
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +28 -27
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/constants/Schema.js +1 -0
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +34 -31
- package/dist/esm/dialogs/openRichTextDialog.js +2 -2
- package/dist/esm/dialogs/renderRichTextDialog.js +2 -2
- package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +10 -10
- package/dist/esm/helpers/callbacks.js +1 -1
- package/dist/esm/helpers/config.js +9 -1
- package/dist/esm/helpers/editor.js +22 -6
- package/dist/esm/helpers/extractNodes.js +3 -1
- package/dist/esm/helpers/formatDateAndTime.js +11 -2
- package/dist/esm/helpers/getAllowedResourcesForNodeType.js +19 -2
- package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +26 -2
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +20 -6
- package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +1 -0
- package/dist/esm/helpers/toSlateValue.js +17 -3
- package/dist/esm/helpers/validations.js +5 -1
- package/dist/esm/internal/misc.js +23 -2
- package/dist/esm/internal/queries.js +11 -2
- package/dist/esm/internal/transforms.js +14 -3
- package/dist/esm/internal/types/editor.js +3 -1
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +4 -3
- package/dist/esm/plugins/Break/createResetNodePlugin.js +1 -0
- package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/esm/plugins/CommandPalette/components/CommandList.js +30 -30
- package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +2 -2
- package/dist/esm/plugins/CommandPalette/createCommandPalettePlugin.js +11 -1
- package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +2 -0
- package/dist/esm/plugins/CommandPalette/onKeyDown.js +5 -0
- package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
- package/dist/esm/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/esm/plugins/CommandPalette/utils/fetchEntries.js +2 -0
- package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
- package/dist/esm/plugins/DragAndDrop/index.js +9 -1
- package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -6
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +14 -14
- package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +5 -5
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +4 -4
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +9 -9
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +4 -4
- package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
- package/dist/esm/plugins/Heading/components/Heading.js +8 -7
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +14 -8
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +6 -1
- package/dist/esm/plugins/Hr/index.js +8 -5
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +25 -23
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +5 -1
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +6 -3
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
- package/dist/esm/plugins/Hyperlink/utils.js +1 -1
- package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +13 -13
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +29 -25
- package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/esm/plugins/List/components/List.js +1 -1
- package/dist/esm/plugins/List/components/ListItem.js +1 -1
- package/dist/esm/plugins/List/components/ToolbarListButton.js +3 -3
- package/dist/esm/plugins/List/createListPlugin.js +4 -0
- package/dist/esm/plugins/List/insertListBreak.js +13 -4
- package/dist/esm/plugins/List/insertListFragment.js +18 -5
- package/dist/esm/plugins/List/onKeyDownList.js +5 -2
- package/dist/esm/plugins/List/transforms/insertListItem.js +20 -3
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +8 -2
- package/dist/esm/plugins/List/transforms/moveListItems.js +7 -2
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +15 -14
- package/dist/esm/plugins/List/transforms/toggleList.js +8 -3
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/esm/plugins/List/transforms/unwrapList.js +7 -2
- package/dist/esm/plugins/List/utils.js +7 -2
- package/dist/esm/plugins/List/withList.js +6 -2
- package/dist/esm/plugins/Marks/Bold.js +2 -2
- package/dist/esm/plugins/Marks/Code.js +8 -2
- package/dist/esm/plugins/Marks/Italic.js +2 -2
- package/dist/esm/plugins/Marks/Subscript.js +2 -2
- package/dist/esm/plugins/Marks/Superscript.js +2 -2
- package/dist/esm/plugins/Marks/Underline.js +2 -2
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +4 -4
- package/dist/esm/plugins/Marks/helpers.js +1 -1
- package/dist/esm/plugins/Normalizer/baseRules.js +4 -0
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/esm/plugins/Normalizer/utils.js +1 -0
- package/dist/esm/plugins/Normalizer/withNormalizer.js +22 -2
- package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
- package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +2 -1
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -3
- package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
- package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +27 -1
- package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
- package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
- package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/esm/plugins/Quote/components/Quote.js +1 -1
- package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
- package/dist/esm/plugins/Quote/createQuotePlugin.js +1 -0
- package/dist/esm/plugins/Quote/shouldResetQuote.js +6 -1
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +4 -2
- package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
- package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
- package/dist/esm/plugins/Table/__tests__/helpers.test.js +4 -4
- package/dist/esm/plugins/Table/actions/addColumn.js +2 -1
- package/dist/esm/plugins/Table/actions/addRow.js +3 -0
- package/dist/esm/plugins/Table/components/Cell.js +2 -2
- package/dist/esm/plugins/Table/components/HeaderCell.js +2 -2
- package/dist/esm/plugins/Table/components/Row.js +1 -1
- package/dist/esm/plugins/Table/components/Table.js +3 -3
- package/dist/esm/plugins/Table/components/TableActions.js +12 -11
- package/dist/esm/plugins/Table/components/ToolbarButton.js +3 -2
- package/dist/esm/plugins/Table/createTablePlugin.js +11 -1
- package/dist/esm/plugins/Table/helpers.js +10 -1
- package/dist/esm/plugins/Table/insertTableFragment.js +15 -2
- package/dist/esm/plugins/Table/onKeyDownTable.js +10 -2
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
- package/dist/esm/plugins/Text/createTextPlugin.js +22 -5
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +2 -1
- package/dist/esm/plugins/Tracking/utils.js +1 -0
- package/dist/esm/plugins/Voids/createVoidsPlugin.js +5 -0
- package/dist/esm/plugins/Voids/transformVoid.js +4 -1
- package/dist/esm/plugins/index.js +12 -0
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +15 -5
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +8 -4
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +8 -8
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +9 -9
- package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +9 -8
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +7 -3
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +5 -3
- package/dist/esm/plugins/shared/ResourceNewBadge.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +3 -3
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +5 -2
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
- package/dist/esm/plugins/shared/utils.js +4 -1
- package/dist/esm/test-utils/assertOutput.js +1 -0
- package/dist/esm/test-utils/hyperscript.d.js +1 -0
- package/dist/esm/test-utils/jsx.js +5 -1
- package/dist/esm/test-utils/randomId.js +3 -1
- package/dist/esm/test-utils/setEmptyDataAttribute.js +4 -1
- package/dist/esm/test-utils/validation.js +7 -4
- package/package.json +2 -2
|
@@ -16,16 +16,16 @@ _export(exports, {
|
|
|
16
16
|
return addOrEditLink;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
20
|
const _f36components = require("@contentful/f36-components");
|
|
21
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
21
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
22
22
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
23
23
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
24
24
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
25
25
|
const _emotion = require("emotion");
|
|
26
26
|
const _editor = require("../../helpers/editor");
|
|
27
|
-
const _getAllowedResourcesForNodeType = _interop_require_default(require("../../helpers/getAllowedResourcesForNodeType"));
|
|
28
|
-
const _getLinkedContentTypeIdsForNodeType = _interop_require_default(require("../../helpers/getLinkedContentTypeIdsForNodeType"));
|
|
27
|
+
const _getAllowedResourcesForNodeType = /*#__PURE__*/ _interop_require_default(require("../../helpers/getAllowedResourcesForNodeType"));
|
|
28
|
+
const _getLinkedContentTypeIdsForNodeType = /*#__PURE__*/ _interop_require_default(require("../../helpers/getLinkedContentTypeIdsForNodeType"));
|
|
29
29
|
const _validations = require("../../helpers/validations");
|
|
30
30
|
const _internal = require("../../internal");
|
|
31
31
|
const _queries = require("../../internal/queries");
|
|
@@ -59,7 +59,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
if (cache && cache.has(obj)) {
|
|
60
60
|
return cache.get(obj);
|
|
61
61
|
}
|
|
62
|
-
var newObj = {
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
63
65
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
66
|
for(var key in obj){
|
|
65
67
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -140,7 +142,7 @@ function HyperlinkModal(props) {
|
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
function entityToLink(entity) {
|
|
143
|
-
const { id
|
|
145
|
+
const { id, type } = entity.sys;
|
|
144
146
|
return {
|
|
145
147
|
sys: {
|
|
146
148
|
id,
|
|
@@ -150,7 +152,8 @@ function HyperlinkModal(props) {
|
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
function entityToResourceLink(entity) {
|
|
153
|
-
const { urn
|
|
155
|
+
const { urn } = entity.sys;
|
|
156
|
+
// @ts-expect-error wait for update of app-sdk version
|
|
154
157
|
return {
|
|
155
158
|
sys: {
|
|
156
159
|
urn,
|
|
@@ -183,6 +186,7 @@ function HyperlinkModal(props) {
|
|
|
183
186
|
const options = {
|
|
184
187
|
allowedResources: (0, _getAllowedResourcesForNodeType.default)(props.sdk.field, _richtexttypes.INLINES.RESOURCE_HYPERLINK)
|
|
185
188
|
};
|
|
189
|
+
// @ts-expect-error wait for update of app-sdk version
|
|
186
190
|
const entry = await props.sdk.dialogs.selectSingleResourceEntry(options);
|
|
187
191
|
if (entry) {
|
|
188
192
|
setLinkTarget('');
|
|
@@ -203,30 +207,30 @@ function HyperlinkModal(props) {
|
|
|
203
207
|
event.preventDefault();
|
|
204
208
|
setLinkEntity(null);
|
|
205
209
|
}
|
|
206
|
-
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
210
|
+
return /*#__PURE__*/ _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
207
211
|
sdk: props.sdk
|
|
208
|
-
}, _react.createElement(_react.Fragment, null, _react.createElement(_f36components.ModalContent, null, _react.createElement(_f36components.Form, null, !props.linkType && _react.createElement(_f36components.FormControl, {
|
|
212
|
+
}, /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_f36components.ModalContent, null, /*#__PURE__*/ _react.createElement(_f36components.Form, null, !props.linkType && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
209
213
|
id: "link-text",
|
|
210
214
|
isRequired: true
|
|
211
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link text"), _react.createElement(_f36components.TextInput, {
|
|
215
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link text"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
|
|
212
216
|
testId: "link-text-input",
|
|
213
217
|
name: "link-text",
|
|
214
218
|
value: linkText,
|
|
215
219
|
onChange: (event)=>setLinkText(event.target.value)
|
|
216
|
-
})), enabledLinkTypes.length > 1 && _react.createElement(_f36components.FormControl, {
|
|
220
|
+
})), enabledLinkTypes.length > 1 && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
217
221
|
id: "link-type"
|
|
218
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link type"), _react.createElement(_f36components.Select, {
|
|
222
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link type"), /*#__PURE__*/ _react.createElement(_f36components.Select, {
|
|
219
223
|
value: linkType,
|
|
220
224
|
onChange: (event)=>setLinkType(event.target.value),
|
|
221
225
|
testId: "link-type-input",
|
|
222
226
|
isDisabled: props.readonly
|
|
223
|
-
}, enabledLinkTypes.map((nodeType)
|
|
227
|
+
}, enabledLinkTypes.map((nodeType)=>/*#__PURE__*/ _react.createElement(_f36components.Select.Option, {
|
|
224
228
|
key: nodeType,
|
|
225
229
|
value: nodeType
|
|
226
|
-
}, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === _richtexttypes.INLINES.HYPERLINK && _react.createElement(_f36components.FormControl, {
|
|
230
|
+
}, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === _richtexttypes.INLINES.HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
227
231
|
id: "linkTarget",
|
|
228
232
|
isRequired: true
|
|
229
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link target"), _react.createElement(_f36components.TextInput, {
|
|
233
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link target"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
|
|
230
234
|
ref: linkTargetInputRef,
|
|
231
235
|
name: "linkTarget",
|
|
232
236
|
value: linkTarget,
|
|
@@ -236,46 +240,46 @@ function HyperlinkModal(props) {
|
|
|
236
240
|
},
|
|
237
241
|
testId: "link-target-input",
|
|
238
242
|
isDisabled: props.readonly
|
|
239
|
-
}), _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== _richtexttypes.INLINES.HYPERLINK && _react.createElement("div", null, _react.createElement(_f36components.FormLabel, {
|
|
243
|
+
}), /*#__PURE__*/ _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== _richtexttypes.INLINES.HYPERLINK && /*#__PURE__*/ _react.createElement("div", null, /*#__PURE__*/ _react.createElement(_f36components.FormLabel, {
|
|
240
244
|
isRequired: true,
|
|
241
245
|
htmlFor: ""
|
|
242
|
-
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? _react.createElement(_react.Fragment, null, !props.readonly && _react.createElement(_f36components.TextLink, {
|
|
246
|
+
}, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, !props.readonly && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
243
247
|
testId: "entity-selection-link",
|
|
244
248
|
onClick: resetLinkEntity,
|
|
245
249
|
className: styles.removeSelectionLabel
|
|
246
|
-
}, "Remove selection"), _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
250
|
+
}, "Remove selection"), /*#__PURE__*/ _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
247
251
|
sdk: props.sdk,
|
|
248
252
|
locale: props.sdk.field.locale,
|
|
249
253
|
entryId: linkEntity.sys.id,
|
|
250
254
|
isDisabled: true,
|
|
251
255
|
isSelected: false
|
|
252
|
-
}), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && _react.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
|
|
256
|
+
}), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
|
|
253
257
|
sdk: props.sdk,
|
|
254
258
|
link: linkEntity.sys,
|
|
255
259
|
isDisabled: true,
|
|
256
260
|
isSelected: false
|
|
257
|
-
}), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
261
|
+
}), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
258
262
|
sdk: props.sdk,
|
|
259
263
|
locale: props.sdk.field.locale,
|
|
260
264
|
assetId: linkEntity.sys.id,
|
|
261
265
|
isDisabled: true,
|
|
262
266
|
isSelected: false
|
|
263
|
-
}))) : _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && _react.createElement(_f36components.TextLink, {
|
|
267
|
+
}))) : /*#__PURE__*/ _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
264
268
|
testId: "entity-selection-link",
|
|
265
269
|
onClick: selectEntry
|
|
266
|
-
}, "Select entry"), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && _react.createElement(_f36components.TextLink, {
|
|
270
|
+
}, "Select entry"), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
267
271
|
testId: "entity-selection-link",
|
|
268
272
|
onClick: selectResourceEntry
|
|
269
|
-
}, "Select entry"), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && _react.createElement(_f36components.TextLink, {
|
|
273
|
+
}, "Select entry"), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
270
274
|
testId: "entity-selection-link",
|
|
271
275
|
onClick: selectAsset
|
|
272
|
-
}, "Select asset"))))), _react.createElement(_f36components.ModalControls, null, _react.createElement(_f36components.Button, {
|
|
276
|
+
}, "Select asset"))))), /*#__PURE__*/ _react.createElement(_f36components.ModalControls, null, /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
273
277
|
type: "button",
|
|
274
278
|
onClick: ()=>props.onClose(null),
|
|
275
279
|
variant: "secondary",
|
|
276
280
|
testId: "cancel-cta",
|
|
277
281
|
size: "small"
|
|
278
|
-
}, "Cancel"), _react.createElement(_f36components.Button, {
|
|
282
|
+
}, "Cancel"), /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
279
283
|
type: "submit",
|
|
280
284
|
variant: "positive",
|
|
281
285
|
size: "small",
|
|
@@ -311,8 +315,8 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
|
|
|
311
315
|
shouldCloseOnEscapePress: true,
|
|
312
316
|
shouldCloseOnOverlayClick: true,
|
|
313
317
|
allowHeightOverflow: true
|
|
314
|
-
}, ({ onClose
|
|
315
|
-
return _react.createElement(HyperlinkModal, {
|
|
318
|
+
}, ({ onClose })=>{
|
|
319
|
+
return /*#__PURE__*/ _react.createElement(HyperlinkModal, {
|
|
316
320
|
linkTarget: linkTarget,
|
|
317
321
|
linkText: currentLinkText,
|
|
318
322
|
linkType: linkType,
|
|
@@ -328,7 +332,7 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
|
|
|
328
332
|
logAction(isEditing ? 'cancelEditHyperlinkDialog' : 'cancelCreateHyperlinkDialog');
|
|
329
333
|
return;
|
|
330
334
|
}
|
|
331
|
-
const { linkText: text
|
|
335
|
+
const { linkText: text, linkTarget: url, linkType: type, linkEntity: target } = data;
|
|
332
336
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
333
337
|
(0, _editor.insertLink)(editor, {
|
|
334
338
|
text,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
/* eslint-disable react/no-unknown-property */ /** @jsx jsx */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
describe('normalization', ()=>{
|
|
7
7
|
it('removes empty links from the document structure', ()=>{
|
|
8
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link"), (0, _testutils.jsx)("hlink", {
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
9
9
|
uri: "https://link.com"
|
|
10
|
-
})), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "asset"), (0, _testutils.jsx)("hlink", {
|
|
10
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "asset"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
11
11
|
asset: "asset-id"
|
|
12
|
-
})), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "entry"), (0, _testutils.jsx)("hlink", {
|
|
12
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "entry"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
13
13
|
entry: "entry-id"
|
|
14
|
-
})), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "resource"), (0, _testutils.jsx)("hlink", {
|
|
14
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "resource"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
15
15
|
resource: "resource-urn"
|
|
16
|
-
})), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "explicit empty link"), (0, _testutils.jsx)("hlink", {
|
|
16
|
+
})), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "explicit empty link"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
17
17
|
uri: "https://link.com"
|
|
18
|
-
}, '')), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link with empty space"), (0, _testutils.jsx)("hlink", {
|
|
18
|
+
}, '')), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link with empty space"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
19
19
|
uri: "https://link.com"
|
|
20
20
|
}, " ")));
|
|
21
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "asset")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "entry")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "resource")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "explicit empty link")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link with empty space")));
|
|
21
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "asset")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "entry")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "resource")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "explicit empty link")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link with empty space")));
|
|
22
22
|
(0, _testutils.assertOutput)({
|
|
23
23
|
input,
|
|
24
24
|
expected
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EntityHyperlink", {
|
|
|
8
8
|
return EntityHyperlink;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
|
|
14
14
|
const _internal = require("../../../internal");
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -59,8 +61,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
61
|
function EntityHyperlink(props) {
|
|
60
62
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
61
63
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
62
|
-
const { target
|
|
63
|
-
const { onEntityFetchComplete
|
|
64
|
+
const { target } = props.element.data;
|
|
65
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
64
66
|
const tooltipContent = (0, _useEntityInfo.useEntityInfo)({
|
|
65
67
|
target,
|
|
66
68
|
sdk,
|
|
@@ -79,12 +81,12 @@ function EntityHyperlink(props) {
|
|
|
79
81
|
(0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p.path);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
|
-
return _react.createElement(_f36components.Tooltip, {
|
|
84
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
|
|
83
85
|
content: tooltipContent,
|
|
84
86
|
targetWrapperClassName: _styles.styles.hyperlinkWrapper,
|
|
85
87
|
placement: "bottom",
|
|
86
88
|
maxWidth: "auto"
|
|
87
|
-
}, _react.createElement(_f36components.TextLink, {
|
|
89
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
88
90
|
as: "a",
|
|
89
91
|
onClick: handleClick,
|
|
90
92
|
className: _styles.styles.hyperlink,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ResourceHyperlink", {
|
|
|
8
8
|
return ResourceHyperlink;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
|
|
14
14
|
const _internal = require("../../../internal");
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -59,8 +61,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
61
|
function ResourceHyperlink(props) {
|
|
60
62
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
61
63
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
62
|
-
const { target
|
|
63
|
-
const { onEntityFetchComplete
|
|
64
|
+
const { target } = props.element.data;
|
|
65
|
+
const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
|
|
64
66
|
const tooltipContent = (0, _useResourceEntityInfo.useResourceEntityInfo)({
|
|
65
67
|
target,
|
|
66
68
|
onEntityFetchComplete
|
|
@@ -78,12 +80,12 @@ function ResourceHyperlink(props) {
|
|
|
78
80
|
(0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p.path);
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
return _react.createElement(_f36components.Tooltip, {
|
|
83
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
|
|
82
84
|
content: tooltipContent,
|
|
83
85
|
targetWrapperClassName: _styles.styles.hyperlinkWrapper,
|
|
84
86
|
placement: "bottom",
|
|
85
87
|
maxWidth: "auto"
|
|
86
|
-
}, _react.createElement(_f36components.TextLink, {
|
|
88
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
87
89
|
as: "a",
|
|
88
90
|
onClick: handleClick,
|
|
89
91
|
className: _styles.styles.hyperlink,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ToolbarHyperlinkButton", {
|
|
|
8
8
|
return ToolbarHyperlinkButton;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36icons = require("@contentful/f36-icons");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
|
|
14
14
|
const _editor = require("../../../helpers/editor");
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -68,11 +70,11 @@ function ToolbarHyperlinkButton(props) {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
if (!editor) return null;
|
|
71
|
-
return _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
73
|
+
return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
|
|
72
74
|
title: "Hyperlink",
|
|
73
75
|
testId: "hyperlink-toolbar-button",
|
|
74
76
|
onClick: handleClick,
|
|
75
77
|
isActive: isActive,
|
|
76
78
|
isDisabled: props.isDisabled
|
|
77
|
-
}, _react.createElement(_f36icons.LinkIcon, null));
|
|
79
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.LinkIcon, null));
|
|
78
80
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "UrlHyperlink", {
|
|
|
8
8
|
return UrlHyperlink;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
|
|
14
14
|
const _internal = require("../../../internal");
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -57,7 +59,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
57
59
|
function UrlHyperlink(props) {
|
|
58
60
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
59
61
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
60
|
-
const { uri
|
|
62
|
+
const { uri } = props.element.data;
|
|
61
63
|
function handleClick(event) {
|
|
62
64
|
event.preventDefault();
|
|
63
65
|
event.stopPropagation();
|
|
@@ -71,13 +73,13 @@ function UrlHyperlink(props) {
|
|
|
71
73
|
});
|
|
72
74
|
(0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p?.path);
|
|
73
75
|
}
|
|
74
|
-
return _react.createElement(_f36components.Tooltip, {
|
|
76
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
|
|
75
77
|
usePortal: true,
|
|
76
78
|
content: uri,
|
|
77
79
|
targetWrapperClassName: _styles.styles.hyperlinkWrapper,
|
|
78
80
|
placement: "bottom",
|
|
79
81
|
maxWidth: "min-content"
|
|
80
|
-
}, _react.createElement(_f36components.TextLink, {
|
|
82
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
81
83
|
as: "a",
|
|
82
84
|
href: uri,
|
|
83
85
|
rel: "noopener noreferrer",
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "styles", {
|
|
|
8
8
|
return styles;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
11
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
12
12
|
const _emotion = require("emotion");
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "createHyperlinkPlugin", {
|
|
|
8
8
|
return createHyperlinkPlugin;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
13
|
-
const _ishotkey = _interop_require_default(require("is-hotkey"));
|
|
13
|
+
const _ishotkey = /*#__PURE__*/ _interop_require_default(require("is-hotkey"));
|
|
14
14
|
const _editor = require("../../helpers/editor");
|
|
15
15
|
const _transformers = require("../../helpers/transformers");
|
|
16
16
|
const _EntityHyperlink = require("./components/EntityHyperlink");
|
|
@@ -44,7 +44,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
44
|
if (cache && cache.has(obj)) {
|
|
45
45
|
return cache.get(obj);
|
|
46
46
|
}
|
|
47
|
-
var newObj = {
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
48
50
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
51
|
for(var key in obj){
|
|
50
52
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -66,7 +68,7 @@ const isAnchor = (element)=>element.nodeName === 'A' && !!element.getAttribute('
|
|
|
66
68
|
const isEntryAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Entry';
|
|
67
69
|
const isAssetAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Asset';
|
|
68
70
|
const isResourceAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-resource-link-type') === 'Contentful:Entry';
|
|
69
|
-
const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey
|
|
71
|
+
const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
|
|
70
72
|
return (event)=>{
|
|
71
73
|
if (!editor.selection) {
|
|
72
74
|
return;
|
|
@@ -119,6 +121,7 @@ const createHyperlinkPlugin = (sdk)=>{
|
|
|
119
121
|
onKeyDown: buildHyperlinkEventHandler(sdk)
|
|
120
122
|
},
|
|
121
123
|
plugins: [
|
|
124
|
+
// URL Hyperlink
|
|
122
125
|
{
|
|
123
126
|
...common,
|
|
124
127
|
key: _richtexttypes.INLINES.HYPERLINK,
|
|
@@ -136,6 +139,7 @@ const createHyperlinkPlugin = (sdk)=>{
|
|
|
136
139
|
getNode: getNodeOfType(_richtexttypes.INLINES.HYPERLINK)
|
|
137
140
|
}
|
|
138
141
|
},
|
|
142
|
+
// Entry Hyperlink
|
|
139
143
|
{
|
|
140
144
|
...common,
|
|
141
145
|
key: _richtexttypes.INLINES.ENTRY_HYPERLINK,
|
|
@@ -153,6 +157,7 @@ const createHyperlinkPlugin = (sdk)=>{
|
|
|
153
157
|
getNode: getNodeOfType(_richtexttypes.INLINES.ENTRY_HYPERLINK)
|
|
154
158
|
}
|
|
155
159
|
},
|
|
160
|
+
// Resource Hyperlink
|
|
156
161
|
{
|
|
157
162
|
...common,
|
|
158
163
|
key: _richtexttypes.INLINES.RESOURCE_HYPERLINK,
|
|
@@ -170,6 +175,7 @@ const createHyperlinkPlugin = (sdk)=>{
|
|
|
170
175
|
getNode: getNodeOfType(_richtexttypes.INLINES.RESOURCE_HYPERLINK)
|
|
171
176
|
}
|
|
172
177
|
},
|
|
178
|
+
// Asset Hyperlink
|
|
173
179
|
{
|
|
174
180
|
...common,
|
|
175
181
|
key: _richtexttypes.INLINES.ASSET_HYPERLINK,
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "useEntityInfo", {
|
|
|
11
11
|
const _react = require("react");
|
|
12
12
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
13
13
|
const _utils = require("./utils");
|
|
14
|
-
async function fetchAllData({ sdk
|
|
14
|
+
async function fetchAllData({ sdk, entityId, entityType, localeCode, defaultLocaleCode }) {
|
|
15
15
|
let contentType;
|
|
16
16
|
const getEntity = entityType === 'Entry' ? sdk.space.getEntry : sdk.space.getAsset;
|
|
17
17
|
const entity = await getEntity(entityId);
|
|
@@ -20,6 +20,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
|
|
|
20
20
|
contentType = sdk.space.getCachedContentTypes().find((ct)=>ct.sys.id === contentTypeId);
|
|
21
21
|
}
|
|
22
22
|
const entityTitle = entityType === 'Entry' ? _fieldeditorshared.entityHelpers.getEntryTitle({
|
|
23
|
+
//@ts-expect-error
|
|
23
24
|
entry: entity,
|
|
24
25
|
contentType,
|
|
25
26
|
localeCode,
|
|
@@ -32,12 +33,14 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
|
|
|
32
33
|
defaultTitle: 'Untitled'
|
|
33
34
|
});
|
|
34
35
|
const entityDescription = _fieldeditorshared.entityHelpers.getEntityDescription({
|
|
36
|
+
// @ts-expect-error
|
|
35
37
|
entity,
|
|
36
38
|
contentType,
|
|
37
39
|
localeCode,
|
|
38
40
|
defaultLocaleCode
|
|
39
41
|
});
|
|
40
42
|
const jobs = await sdk.space.getEntityScheduledActions(entityType, entityId);
|
|
43
|
+
// @ts-expect-error
|
|
41
44
|
const entityStatus = _fieldeditorshared.entityHelpers.getEntryStatus(entity.sys);
|
|
42
45
|
return {
|
|
43
46
|
jobs,
|
|
@@ -48,7 +51,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
|
|
|
48
51
|
contentTypeName: contentType ? contentType.name : ''
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
|
-
function useRequestStatus({ sdk
|
|
54
|
+
function useRequestStatus({ sdk, target, onEntityFetchComplete }) {
|
|
52
55
|
const [requestStatus, setRequestStatus] = (0, _react.useState)({
|
|
53
56
|
type: 'loading'
|
|
54
57
|
});
|
|
@@ -84,7 +87,7 @@ function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
|
|
|
84
87
|
}
|
|
85
88
|
function useEntityInfo(props) {
|
|
86
89
|
const status = useRequestStatus(props);
|
|
87
|
-
const { linkType
|
|
90
|
+
const { linkType } = props.target.sys;
|
|
88
91
|
if (status.type === 'loading') {
|
|
89
92
|
return `Loading ${linkType.toLowerCase()}...`;
|
|
90
93
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "useResourceEntityInfo", {
|
|
|
8
8
|
return useResourceEntityInfo;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
13
13
|
const _utils = require("../../plugins/shared/utils");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -32,7 +32,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
32
32
|
if (cache && cache.has(obj)) {
|
|
33
33
|
return cache.get(obj);
|
|
34
34
|
}
|
|
35
|
-
var newObj = {
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
36
38
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
39
|
for(var key in obj){
|
|
38
40
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -50,8 +52,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
52
|
}
|
|
51
53
|
return newObj;
|
|
52
54
|
}
|
|
53
|
-
function useResourceEntityInfo({ onEntityFetchComplete
|
|
54
|
-
const { data
|
|
55
|
+
function useResourceEntityInfo({ onEntityFetchComplete, target }) {
|
|
56
|
+
const { data, error, status } = (0, _fieldeditorreference.useResource)(target.sys.linkType, target.sys.urn);
|
|
55
57
|
_react.useEffect(()=>{
|
|
56
58
|
if (status === 'success') {
|
|
57
59
|
onEntityFetchComplete?.();
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
hasText: function() {
|
|
13
|
-
return hasText;
|
|
14
|
-
},
|
|
15
12
|
getEntityInfo: function() {
|
|
16
13
|
return getEntityInfo;
|
|
14
|
+
},
|
|
15
|
+
hasText: function() {
|
|
16
|
+
return hasText;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
@@ -28,7 +28,7 @@ function getEntityInfo(data) {
|
|
|
28
28
|
if (!data) {
|
|
29
29
|
return '';
|
|
30
30
|
}
|
|
31
|
-
const { entityTitle
|
|
31
|
+
const { entityTitle, contentTypeName, entityStatus, jobs } = data;
|
|
32
32
|
const title = (0, _utils.truncateTitle)(entityTitle, 60) || 'Untitled';
|
|
33
33
|
const scheduledActions = jobs.length > 0 ? (0, _fieldeditorreference.getScheduleTooltipContent)({
|
|
34
34
|
job: jobs[0],
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
/* eslint-disable react/no-unknown-property */ /** @jsx jsx */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _testutils = require("../../../test-utils");
|
|
6
6
|
describe('normalization', ()=>{
|
|
7
7
|
it('wraps orphaned list items in a list', ()=>{
|
|
8
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item")), (0, _testutils.jsx)("hp", null));
|
|
9
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
8
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
9
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
10
10
|
(0, _testutils.assertOutput)({
|
|
11
11
|
input,
|
|
12
12
|
expected
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
it('adds empty paragraph to empty list items', ()=>{
|
|
16
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null)), (0, _testutils.jsx)("hp", null));
|
|
17
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
16
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null)), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
17
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
18
18
|
(0, _testutils.assertOutput)({
|
|
19
19
|
input,
|
|
20
20
|
expected
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
it('replaces invalid list items with text', ()=>{
|
|
24
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item"), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
24
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item"), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
25
25
|
bold: true
|
|
26
|
-
}, "bold text"))), (0, _testutils.jsx)("htd", null, (0, _testutils.jsx)("hp", null, "Take a look at this ", (0, _testutils.jsx)("hlink", {
|
|
26
|
+
}, "bold text"))), /*#__PURE__*/ (0, _testutils.jsx)("htd", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Take a look at this ", /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
27
27
|
uri: "https://google.com"
|
|
28
|
-
}, "link"))))), (0, _testutils.jsx)("hp", null));
|
|
29
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item"), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
28
|
+
}, "link"))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null));
|
|
29
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
30
30
|
bold: true
|
|
31
|
-
}, "bold text")), (0, _testutils.jsx)("hp", null, "Take a look at this ", (0, _testutils.jsx)("hlink", {
|
|
31
|
+
}, "bold text")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Take a look at this ", /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
|
|
32
32
|
uri: "https://google.com"
|
|
33
|
-
}, "link"), (0, _testutils.jsx)("htext", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
33
|
+
}, "link"), /*#__PURE__*/ (0, _testutils.jsx)("htext", null)))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
34
34
|
(0, _testutils.assertOutput)({
|
|
35
35
|
input,
|
|
36
36
|
expected
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
it('replaces list items with nested lists as a first child', ()=>{
|
|
40
|
-
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 1.1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.1.1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.2"))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
41
|
-
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 1.1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.1.1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Item 2.2"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
40
|
+
const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 1.1")))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.1.1")))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.2"))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
41
|
+
const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 1.1")))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.1.1")))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Item 2.2"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
|
|
42
42
|
(0, _testutils.assertOutput)({
|
|
43
43
|
input,
|
|
44
44
|
expected
|