@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
|
@@ -12,24 +12,24 @@ _export(exports, {
|
|
|
12
12
|
changed: function() {
|
|
13
13
|
return _changed_assetjson.default;
|
|
14
14
|
},
|
|
15
|
+
created: function() {
|
|
16
|
+
return _created_assetjson.default;
|
|
17
|
+
},
|
|
15
18
|
empty: function() {
|
|
16
19
|
return _empty_assetjson.default;
|
|
17
20
|
},
|
|
18
|
-
published: function() {
|
|
19
|
-
return _published_assetjson.default;
|
|
20
|
-
},
|
|
21
21
|
invalid: function() {
|
|
22
22
|
return _invalid_assetjson.default;
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
published: function() {
|
|
25
|
+
return _published_assetjson.default;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const _changed_assetjson = _interop_require_default(require("./changed_asset.json"));
|
|
29
|
-
const _created_assetjson = _interop_require_default(require("./created_asset.json"));
|
|
30
|
-
const _empty_assetjson = _interop_require_default(require("./empty_asset.json"));
|
|
31
|
-
const _invalid_assetjson = _interop_require_default(require("./invalid_asset.json"));
|
|
32
|
-
const _published_assetjson = _interop_require_default(require("./published_asset.json"));
|
|
28
|
+
const _changed_assetjson = /*#__PURE__*/ _interop_require_default(require("./changed_asset.json"));
|
|
29
|
+
const _created_assetjson = /*#__PURE__*/ _interop_require_default(require("./created_asset.json"));
|
|
30
|
+
const _empty_assetjson = /*#__PURE__*/ _interop_require_default(require("./empty_asset.json"));
|
|
31
|
+
const _invalid_assetjson = /*#__PURE__*/ _interop_require_default(require("./invalid_asset.json"));
|
|
32
|
+
const _published_assetjson = /*#__PURE__*/ _interop_require_default(require("./published_asset.json"));
|
|
33
33
|
function _interop_require_default(obj) {
|
|
34
34
|
return obj && obj.__esModule ? obj : {
|
|
35
35
|
default: obj
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "published", {
|
|
|
8
8
|
return _published_content_typejson.default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _published_content_typejson = _interop_require_default(require("./published_content_type.json"));
|
|
11
|
+
const _published_content_typejson = /*#__PURE__*/ _interop_require_default(require("./published_content_type.json"));
|
|
12
12
|
function _interop_require_default(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
|
@@ -15,17 +15,17 @@ _export(exports, {
|
|
|
15
15
|
empty: function() {
|
|
16
16
|
return _empty_entryjson.default;
|
|
17
17
|
},
|
|
18
|
-
published: function() {
|
|
19
|
-
return _published_entryjson.default;
|
|
20
|
-
},
|
|
21
18
|
invalid: function() {
|
|
22
19
|
return _invalid_entryjson.default;
|
|
20
|
+
},
|
|
21
|
+
published: function() {
|
|
22
|
+
return _published_entryjson.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
const _changed_entryjson = _interop_require_default(require("./changed_entry.json"));
|
|
26
|
-
const _empty_entryjson = _interop_require_default(require("./empty_entry.json"));
|
|
27
|
-
const _invalid_entryjson = _interop_require_default(require("./invalid_entry.json"));
|
|
28
|
-
const _published_entryjson = _interop_require_default(require("./published_entry.json"));
|
|
25
|
+
const _changed_entryjson = /*#__PURE__*/ _interop_require_default(require("./changed_entry.json"));
|
|
26
|
+
const _empty_entryjson = /*#__PURE__*/ _interop_require_default(require("./empty_entry.json"));
|
|
27
|
+
const _invalid_entryjson = /*#__PURE__*/ _interop_require_default(require("./invalid_entry.json"));
|
|
28
|
+
const _published_entryjson = /*#__PURE__*/ _interop_require_default(require("./published_entry.json"));
|
|
29
29
|
function _interop_require_default(obj) {
|
|
30
30
|
return obj && obj.__esModule ? obj : {
|
|
31
31
|
default: obj
|
|
@@ -25,11 +25,11 @@ _export(exports, {
|
|
|
25
25
|
return _space;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const _asset = _interop_require_wildcard(require("./asset"));
|
|
29
|
-
const _contenttype = _interop_require_wildcard(require("./content-type"));
|
|
30
|
-
const _entry = _interop_require_wildcard(require("./entry"));
|
|
31
|
-
const _locale = _interop_require_wildcard(require("./locale"));
|
|
32
|
-
const _space = _interop_require_wildcard(require("./space"));
|
|
28
|
+
const _asset = /*#__PURE__*/ _interop_require_wildcard(require("./asset"));
|
|
29
|
+
const _contenttype = /*#__PURE__*/ _interop_require_wildcard(require("./content-type"));
|
|
30
|
+
const _entry = /*#__PURE__*/ _interop_require_wildcard(require("./entry"));
|
|
31
|
+
const _locale = /*#__PURE__*/ _interop_require_wildcard(require("./locale"));
|
|
32
|
+
const _space = /*#__PURE__*/ _interop_require_wildcard(require("./space"));
|
|
33
33
|
function _getRequireWildcardCache(nodeInterop) {
|
|
34
34
|
if (typeof WeakMap !== "function") return null;
|
|
35
35
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,7 +51,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
if (cache && cache.has(obj)) {
|
|
52
52
|
return cache.get(obj);
|
|
53
53
|
}
|
|
54
|
-
var newObj = {
|
|
54
|
+
var newObj = {
|
|
55
|
+
__proto__: null
|
|
56
|
+
};
|
|
55
57
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
56
58
|
for(var key in obj){
|
|
57
59
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -19,8 +19,8 @@ _export(exports, {
|
|
|
19
19
|
return list;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _english_default_localejson = _interop_require_default(require("./english_default_locale.json"));
|
|
23
|
-
const _german_localejson = _interop_require_default(require("./german_locale.json"));
|
|
22
|
+
const _english_default_localejson = /*#__PURE__*/ _interop_require_default(require("./english_default_locale.json"));
|
|
23
|
+
const _german_localejson = /*#__PURE__*/ _interop_require_default(require("./german_locale.json"));
|
|
24
24
|
function _interop_require_default(obj) {
|
|
25
25
|
return obj && obj.__esModule ? obj : {
|
|
26
26
|
default: obj
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "indifferent", {
|
|
|
8
8
|
return _indifferent_spacejson.default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _indifferent_spacejson = _interop_require_default(require("./indifferent_space.json"));
|
|
11
|
+
const _indifferent_spacejson = /*#__PURE__*/ _interop_require_default(require("./indifferent_space.json"));
|
|
12
12
|
function _interop_require_default(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
|
@@ -9,22 +9,22 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
LINK_TYPES: function() {
|
|
13
|
-
return LINK_TYPES;
|
|
14
|
-
},
|
|
15
12
|
HyperlinkDialog: function() {
|
|
16
13
|
return HyperlinkDialog;
|
|
17
14
|
},
|
|
15
|
+
LINK_TYPES: function() {
|
|
16
|
+
return LINK_TYPES;
|
|
17
|
+
},
|
|
18
18
|
openHyperlinkDialog: function() {
|
|
19
19
|
return openHyperlinkDialog;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
22
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
23
|
const _f36components = require("@contentful/f36-components");
|
|
24
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
24
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
25
25
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
26
26
|
const _emotion = require("emotion");
|
|
27
|
-
const _proptypes = _interop_require_default(require("prop-types"));
|
|
27
|
+
const _proptypes = /*#__PURE__*/ _interop_require_default(require("prop-types"));
|
|
28
28
|
const _FetchingWrappedAssetCard = require("../../plugins/shared/FetchingWrappedAssetCard");
|
|
29
29
|
const _FetchingWrappedEntryCard = require("../../plugins/shared/FetchingWrappedEntryCard");
|
|
30
30
|
function _define_property(obj, key, value) {
|
|
@@ -66,7 +66,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
66
66
|
if (cache && cache.has(obj)) {
|
|
67
67
|
return cache.get(obj);
|
|
68
68
|
}
|
|
69
|
-
var newObj = {
|
|
69
|
+
var newObj = {
|
|
70
|
+
__proto__: null
|
|
71
|
+
};
|
|
70
72
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
71
73
|
for(var key in obj){
|
|
72
74
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -93,7 +95,7 @@ function isFeaturingEntitySelector(entitySelectorConfigs = {}) {
|
|
|
93
95
|
return !!entitySelectorConfigs.Entry || !!entitySelectorConfigs.Asset;
|
|
94
96
|
}
|
|
95
97
|
function entityToLink(entity) {
|
|
96
|
-
const { id
|
|
98
|
+
const { id, type } = entity.sys;
|
|
97
99
|
return {
|
|
98
100
|
sys: {
|
|
99
101
|
id,
|
|
@@ -113,7 +115,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
113
115
|
}));
|
|
114
116
|
}
|
|
115
117
|
getValue() {
|
|
116
|
-
const { text
|
|
118
|
+
const { text, type, uri } = this.state;
|
|
117
119
|
const value = {
|
|
118
120
|
type
|
|
119
121
|
};
|
|
@@ -128,7 +130,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
128
130
|
return value;
|
|
129
131
|
}
|
|
130
132
|
isLinkComplete() {
|
|
131
|
-
const { text
|
|
133
|
+
const { text, type, uri, target } = this.getValue();
|
|
132
134
|
const requiresText = !this.props.hideText;
|
|
133
135
|
if (requiresText && !text) {
|
|
134
136
|
return false;
|
|
@@ -136,16 +138,16 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
136
138
|
return type === LINK_TYPES.URI && uri || target;
|
|
137
139
|
}
|
|
138
140
|
render() {
|
|
139
|
-
const { labels
|
|
140
|
-
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
141
|
+
const { labels } = this.props;
|
|
142
|
+
return /*#__PURE__*/ _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
141
143
|
sdk: this.props.sdk
|
|
142
|
-
}, _react.createElement(_react.Fragment, null, _react.createElement(_f36components.ModalContent, null, this.renderFields()), _react.createElement(_f36components.ModalControls, null, _react.createElement(_f36components.Button, {
|
|
144
|
+
}, /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_f36components.ModalContent, null, this.renderFields()), /*#__PURE__*/ _react.createElement(_f36components.ModalControls, null, /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
143
145
|
type: "button",
|
|
144
146
|
onClick: ()=>this.props.onClose(null),
|
|
145
147
|
variant: "secondary",
|
|
146
148
|
testId: "cancel-cta",
|
|
147
149
|
size: "small"
|
|
148
|
-
}, "Cancel"), _react.createElement(_f36components.Button, {
|
|
150
|
+
}, "Cancel"), /*#__PURE__*/ _react.createElement(_f36components.Button, {
|
|
149
151
|
type: "submit",
|
|
150
152
|
variant: "positive",
|
|
151
153
|
onClick: this.handleSubmit,
|
|
@@ -155,39 +157,40 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
155
157
|
}, labels.confirm))));
|
|
156
158
|
}
|
|
157
159
|
renderFields() {
|
|
158
|
-
const { hideText
|
|
159
|
-
const { uri
|
|
160
|
+
const { hideText, allowedHyperlinkTypes, entitySelectorConfigs } = this.props;
|
|
161
|
+
const { uri, text, type } = this.state;
|
|
160
162
|
const isUriInputAutoFocused = type === LINK_TYPES.URI && (hideText || !!text);
|
|
161
|
-
return _react.createElement(_f36components.Form, null, hideText ? null : _react.createElement(_f36components.FormControl, {
|
|
163
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Form, null, hideText ? null : /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
162
164
|
id: "link-text",
|
|
163
165
|
isRequired: true
|
|
164
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link text"), _react.createElement(_f36components.TextInput, {
|
|
166
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link text"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
|
|
165
167
|
testId: "link-text-input",
|
|
166
168
|
name: "link-text",
|
|
167
169
|
value: text || '',
|
|
168
170
|
onChange: (e)=>this.setState({
|
|
169
171
|
text: e.target.value
|
|
170
172
|
}),
|
|
173
|
+
// eslint-disable-next-line -- TODO: describe this disable jsx-a11y/no-autofocus
|
|
171
174
|
autoFocus: !isUriInputAutoFocused
|
|
172
|
-
})), isFeaturingEntitySelector(entitySelectorConfigs) && _react.createElement(_f36components.FormControl, {
|
|
175
|
+
})), isFeaturingEntitySelector(entitySelectorConfigs) && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
173
176
|
id: "link-type",
|
|
174
177
|
name: "link-type"
|
|
175
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link type"), _react.createElement(_f36components.Select, {
|
|
178
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link type"), /*#__PURE__*/ _react.createElement(_f36components.Select, {
|
|
176
179
|
value: type,
|
|
177
180
|
onChange: (e)=>this.setState({
|
|
178
181
|
type: e.target.value
|
|
179
182
|
}),
|
|
180
183
|
testId: "link-type-select"
|
|
181
|
-
}, allowedHyperlinkTypes.includes(LINK_TYPES.URI) || type === LINK_TYPES.URI ? _react.createElement(_f36components.Select.Option, {
|
|
184
|
+
}, allowedHyperlinkTypes.includes(LINK_TYPES.URI) || type === LINK_TYPES.URI ? /*#__PURE__*/ _react.createElement(_f36components.Select.Option, {
|
|
182
185
|
value: LINK_TYPES.URI
|
|
183
|
-
}, "URL") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ENTRY) || type === LINK_TYPES.ENTRY ? _react.createElement(_f36components.Select.Option, {
|
|
186
|
+
}, "URL") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ENTRY) || type === LINK_TYPES.ENTRY ? /*#__PURE__*/ _react.createElement(_f36components.Select.Option, {
|
|
184
187
|
value: LINK_TYPES.ENTRY
|
|
185
|
-
}, "Entry") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ASSET) || type === LINK_TYPES.ASSET ? _react.createElement(_f36components.Select.Option, {
|
|
188
|
+
}, "Entry") : null, allowedHyperlinkTypes.includes(LINK_TYPES.ASSET) || type === LINK_TYPES.ASSET ? /*#__PURE__*/ _react.createElement(_f36components.Select.Option, {
|
|
186
189
|
value: LINK_TYPES.ASSET
|
|
187
|
-
}, "Asset") : null)), type === LINK_TYPES.URI ? _react.createElement(_f36components.FormControl, {
|
|
190
|
+
}, "Asset") : null)), type === LINK_TYPES.URI ? /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
|
|
188
191
|
id: "link-uri",
|
|
189
192
|
isRequired: true
|
|
190
|
-
}, _react.createElement(_f36components.FormControl.Label, null, "Link target"), _react.createElement(_f36components.TextInput, {
|
|
193
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link target"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
|
|
191
194
|
testId: "link-target-input",
|
|
192
195
|
name: "link-uri",
|
|
193
196
|
value: uri || '',
|
|
@@ -195,30 +198,31 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
195
198
|
onChange: (e)=>this.setState({
|
|
196
199
|
uri: e.target.value
|
|
197
200
|
}),
|
|
201
|
+
// eslint-disable-next-line -- TODO: describe this disable jsx-a11y/no-autofocus
|
|
198
202
|
autoFocus: isUriInputAutoFocused
|
|
199
|
-
}), _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")) : this.renderEntityField());
|
|
203
|
+
}), /*#__PURE__*/ _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")) : this.renderEntityField());
|
|
200
204
|
}
|
|
201
205
|
renderEntityField() {
|
|
202
|
-
const { type
|
|
206
|
+
const { type, entityLinks } = this.state;
|
|
203
207
|
const resetEntity = ()=>this.setTargetEntity(type, null);
|
|
204
208
|
const entityLink = entityLinks[type];
|
|
205
209
|
const isEntitySelectorVisible = !entityLink;
|
|
206
|
-
return _react.createElement("div", null, _react.createElement(_f36components.FormLabel, {
|
|
210
|
+
return /*#__PURE__*/ _react.createElement("div", null, /*#__PURE__*/ _react.createElement(_f36components.FormLabel, {
|
|
207
211
|
required: true,
|
|
208
212
|
htmlFor: ""
|
|
209
|
-
}, "Link target"), !isEntitySelectorVisible && _react.createElement(_f36components.TextLink, {
|
|
213
|
+
}, "Link target"), !isEntitySelectorVisible && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
210
214
|
as: "button",
|
|
211
215
|
className: (0, _emotion.css)({
|
|
212
216
|
marginLeft: _f36tokens.default.spacingS
|
|
213
217
|
}),
|
|
214
218
|
onClick: resetEntity
|
|
215
|
-
}, "Remove selection"), entityLink && _react.createElement("div", null, type === LINK_TYPES.ENTRY && _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
219
|
+
}, "Remove selection"), entityLink && /*#__PURE__*/ _react.createElement("div", null, type === LINK_TYPES.ENTRY && /*#__PURE__*/ _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
216
220
|
sdk: this.props.sdk,
|
|
217
221
|
locale: this.props.entitySelectorConfigs.Entry.locale,
|
|
218
222
|
entryId: entityLink.sys.id,
|
|
219
223
|
isDisabled: true,
|
|
220
224
|
isSelected: false
|
|
221
|
-
}), type == LINK_TYPES.ASSET && _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
225
|
+
}), type == LINK_TYPES.ASSET && /*#__PURE__*/ _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
|
|
222
226
|
sdk: this.props.sdk,
|
|
223
227
|
locale: this.props.entitySelectorConfigs.Asset.locale,
|
|
224
228
|
assetId: entityLink.sys.id,
|
|
@@ -227,14 +231,14 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
227
231
|
})), isEntitySelectorVisible && this.renderEntitySelector(type, isEntitySelectorVisible));
|
|
228
232
|
}
|
|
229
233
|
renderEntitySelector(type) {
|
|
230
|
-
return _react.createElement("div", {
|
|
234
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
231
235
|
className: (0, _emotion.css)({
|
|
232
236
|
marginTop: _f36tokens.default.spacingS
|
|
233
237
|
})
|
|
234
|
-
}, type === LINK_TYPES.ENTRY && _react.createElement(_f36components.TextLink, {
|
|
238
|
+
}, type === LINK_TYPES.ENTRY && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
235
239
|
as: "button",
|
|
236
240
|
onClick: this.selectEntry
|
|
237
|
-
}, "Select entry"), type === LINK_TYPES.ASSET && _react.createElement(_f36components.TextLink, {
|
|
241
|
+
}, "Select entry"), type === LINK_TYPES.ASSET && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
|
|
238
242
|
as: "button",
|
|
239
243
|
onClick: this.selectAsset
|
|
240
244
|
}, "Select asset"));
|
|
@@ -246,7 +250,7 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
246
250
|
this.props.onClose(this.getValue());
|
|
247
251
|
});
|
|
248
252
|
_define_property(this, "selectEntry", async ()=>{
|
|
249
|
-
const { locale
|
|
253
|
+
const { locale, contentTypes } = this.props.entitySelectorConfigs.Entry;
|
|
250
254
|
const entry = await this.props.sdk.dialogs.selectSingleEntry({
|
|
251
255
|
locale,
|
|
252
256
|
contentTypes
|
|
@@ -254,13 +258,13 @@ class HyperlinkDialog extends (_React_Component = _react.Component) {
|
|
|
254
258
|
this.setTargetEntity(LINK_TYPES.ENTRY, entry);
|
|
255
259
|
});
|
|
256
260
|
_define_property(this, "selectAsset", async ()=>{
|
|
257
|
-
const { locale
|
|
261
|
+
const { locale } = this.props.entitySelectorConfigs.Asset;
|
|
258
262
|
const asset = await this.props.sdk.dialogs.selectSingleAsset({
|
|
259
263
|
locale
|
|
260
264
|
});
|
|
261
265
|
this.setTargetEntity(LINK_TYPES.ASSET, asset);
|
|
262
266
|
});
|
|
263
|
-
const { text
|
|
267
|
+
const { text, type, uri, target } = props.value;
|
|
264
268
|
const isEntityLink = Boolean(target);
|
|
265
269
|
const entityLinks = {
|
|
266
270
|
[LINK_TYPES.ENTRY]: null,
|
|
@@ -293,6 +297,7 @@ _define_property(HyperlinkDialog, "propTypes", {
|
|
|
293
297
|
text: _proptypes.default.string,
|
|
294
298
|
uri: _proptypes.default.string,
|
|
295
299
|
target: _proptypes.default.object,
|
|
300
|
+
// Will be overwritten accordingly if `uri` or `target.sys.linkType` are set.
|
|
296
301
|
type: _proptypes.default.oneOf([
|
|
297
302
|
'uri',
|
|
298
303
|
'Entry',
|
|
@@ -322,7 +327,7 @@ _define_property(HyperlinkDialog, "defaultProps", {
|
|
|
322
327
|
LINK_TYPES.URI
|
|
323
328
|
]
|
|
324
329
|
});
|
|
325
|
-
const openHyperlinkDialog = (dialogs, { value
|
|
330
|
+
const openHyperlinkDialog = (dialogs, { value, showTextInput, allowedHyperlinkTypes, entitySelectorConfigs })=>{
|
|
326
331
|
const isNew = !(value.uri || value.target);
|
|
327
332
|
const props = {
|
|
328
333
|
labels: {
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "openRichTextDialog", {
|
|
|
8
8
|
return openRichTextDialog;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
13
13
|
const _HyperlinkDialog = require("./HypelinkDialog/HyperlinkDialog");
|
|
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)) {
|
|
@@ -52,8 +54,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
54
|
}
|
|
53
55
|
const openRichTextDialog = (sdk)=>(options)=>{
|
|
54
56
|
if (options.parameters?.type === 'rich-text-hyperlink-dialog') {
|
|
55
|
-
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose
|
|
56
|
-
return _react.createElement(_HyperlinkDialog.HyperlinkDialog, {
|
|
57
|
+
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
58
|
+
return /*#__PURE__*/ _react.createElement(_HyperlinkDialog.HyperlinkDialog, {
|
|
57
59
|
...options.parameters,
|
|
58
60
|
onClose: onClose,
|
|
59
61
|
sdk: sdk
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "renderRichTextDialog", {
|
|
|
8
8
|
return renderRichTextDialog;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _HyperlinkDialog = require("./HypelinkDialog/HyperlinkDialog");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -31,7 +31,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
31
31
|
if (cache && cache.has(obj)) {
|
|
32
32
|
return cache.get(obj);
|
|
33
33
|
}
|
|
34
|
-
var newObj = {
|
|
34
|
+
var newObj = {
|
|
35
|
+
__proto__: null
|
|
36
|
+
};
|
|
35
37
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
38
|
for(var key in obj){
|
|
37
39
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -53,11 +55,11 @@ const renderRichTextDialog = (sdk)=>{
|
|
|
53
55
|
const parameters = sdk.parameters.invocation;
|
|
54
56
|
if (parameters?.type === 'rich-text-hyperlink-dialog') {
|
|
55
57
|
sdk.window.startAutoResizer();
|
|
56
|
-
return _react.createElement(_HyperlinkDialog.HyperlinkDialog, {
|
|
58
|
+
return /*#__PURE__*/ _react.createElement(_HyperlinkDialog.HyperlinkDialog, {
|
|
57
59
|
...parameters,
|
|
58
60
|
onClose: sdk.close,
|
|
59
61
|
sdk: sdk
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
|
-
return _react.createElement("div", null);
|
|
64
|
+
return /*#__PURE__*/ _react.createElement("div", null);
|
|
63
65
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
});
|
|
@@ -12,54 +12,54 @@ describe('internal mark', ()=>{
|
|
|
12
12
|
{
|
|
13
13
|
title: 'Paragraph mark is removed',
|
|
14
14
|
input: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
15
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
15
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
16
16
|
[_constants.COMMAND_PROMPT]: true
|
|
17
17
|
}))).children
|
|
18
18
|
}),
|
|
19
19
|
expected: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
20
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null))).children
|
|
20
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null))).children
|
|
21
21
|
})
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
title: 'Heading mark is removed',
|
|
25
25
|
input: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
26
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("htext", {
|
|
26
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
27
27
|
[_constants.COMMAND_PROMPT]: true
|
|
28
28
|
}))).children
|
|
29
29
|
}),
|
|
30
30
|
expected: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
31
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hh1", null, (0, _testutils.jsx)("htext", null))).children
|
|
31
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hh1", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null))).children
|
|
32
32
|
})
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
title: 'Block quote mark is removed',
|
|
36
36
|
input: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
37
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
37
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
38
38
|
[_constants.COMMAND_PROMPT]: true
|
|
39
39
|
})))).children
|
|
40
40
|
}),
|
|
41
41
|
expected: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
42
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)))).children
|
|
42
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)))).children
|
|
43
43
|
})
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
title: 'Other marks are not removed',
|
|
47
47
|
input: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
48
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
48
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
49
49
|
bold: true,
|
|
50
50
|
underline: true,
|
|
51
51
|
[_constants.COMMAND_PROMPT]: true
|
|
52
52
|
})))).children
|
|
53
53
|
}),
|
|
54
54
|
expected: (0, _contentfulslatejsadapter.toContentfulDocument)({
|
|
55
|
-
document: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", {
|
|
55
|
+
document: /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", {
|
|
56
56
|
bold: true,
|
|
57
57
|
underline: true
|
|
58
58
|
})))).children
|
|
59
59
|
})
|
|
60
60
|
}
|
|
61
61
|
];
|
|
62
|
-
for (const { input
|
|
62
|
+
for (const { input, expected, title } of data){
|
|
63
63
|
it(`${title}`, ()=>{
|
|
64
64
|
expect((0, _removeInternalMarks.removeInternalMarks)(input)).toEqual(expected);
|
|
65
65
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */ "use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "createOnChangeCallback", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _contentfulslatejsadapter = require("@contentful/contentful-slatejs-adapter");
|
|
12
|
-
const _debounce = _interop_require_default(require("lodash/debounce"));
|
|
13
|
-
const _Schema = _interop_require_default(require("../constants/Schema"));
|
|
12
|
+
const _debounce = /*#__PURE__*/ _interop_require_default(require("lodash/debounce"));
|
|
13
|
+
const _Schema = /*#__PURE__*/ _interop_require_default(require("../constants/Schema"));
|
|
14
14
|
const _removeInternalMarks = require("./removeInternalMarks");
|
|
15
15
|
function _interop_require_default(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
@@ -16,8 +16,8 @@ _export(exports, {
|
|
|
16
16
|
return newResourceEntitySelectorConfigFromRichTextField;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _getAllowedResourcesForNodeType = _interop_require_default(require("./getAllowedResourcesForNodeType"));
|
|
20
|
-
const _getLinkedContentTypeIdsForNodeType = _interop_require_default(require("./getLinkedContentTypeIdsForNodeType"));
|
|
19
|
+
const _getAllowedResourcesForNodeType = /*#__PURE__*/ _interop_require_default(require("./getAllowedResourcesForNodeType"));
|
|
20
|
+
const _getLinkedContentTypeIdsForNodeType = /*#__PURE__*/ _interop_require_default(require("./getLinkedContentTypeIdsForNodeType"));
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
23
23
|
default: obj
|