@contentful/field-editor-rich-text 3.16.8 → 3.16.11
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 +20 -22
- package/dist/cjs/RichTextEditor.styles.js +1 -2
- package/dist/cjs/SdkProvider.js +5 -7
- package/dist/cjs/SyncEditorChanges.js +6 -15
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +15 -17
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +9 -13
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +8 -10
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
- package/dist/cjs/Toolbar/index.js +30 -33
- 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 +6 -8
- package/dist/cjs/__fixtures__/locale/index.js +2 -2
- package/dist/cjs/__fixtures__/space/index.js +1 -1
- package/dist/cjs/constants/Schema.js +0 -1
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +38 -43
- package/dist/cjs/dialogs/openRichTextDialog.js +4 -6
- package/dist/cjs/dialogs/renderRichTextDialog.js +4 -6
- 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 +44 -53
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +4 -5
- package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +5 -22
- package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +5 -29
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +6 -14
- package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +2 -3
- package/dist/cjs/helpers/toSlateValue.js +3 -14
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +9 -12
- package/dist/cjs/index.js +5 -7
- package/dist/cjs/internal/constants.js +2 -4
- package/dist/cjs/internal/hooks.js +7 -9
- package/dist/cjs/internal/misc.js +12 -15
- package/dist/cjs/internal/queries.js +108 -115
- package/dist/cjs/internal/transforms.js +48 -51
- package/dist/cjs/internal/types/editor.js +1 -3
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +3 -4
- package/dist/cjs/plugins/Break/createResetNodePlugin.js +0 -1
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +33 -35
- package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +5 -7
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -7
- package/dist/cjs/plugins/CommandPalette/onKeyDown.js +1 -6
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +4 -6
- package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
- package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +0 -2
- package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
- package/dist/cjs/plugins/DragAndDrop/index.js +1 -9
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +8 -10
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +17 -19
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +7 -9
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +11 -13
- 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 +10 -13
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +29 -23
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +2 -7
- package/dist/cjs/plugins/Hr/index.js +14 -19
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +28 -32
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -10
- package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +17 -23
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -10
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +4 -6
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +6 -8
- package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
- package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -10
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -6
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +4 -6
- 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 +25 -29
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
- package/dist/cjs/plugins/List/components/List.js +7 -9
- package/dist/cjs/plugins/List/components/ListItem.js +4 -6
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +5 -7
- package/dist/cjs/plugins/List/createListPlugin.js +0 -4
- package/dist/cjs/plugins/List/insertListBreak.js +4 -13
- package/dist/cjs/plugins/List/insertListFragment.js +5 -18
- package/dist/cjs/plugins/List/onKeyDownList.js +6 -8
- package/dist/cjs/plugins/List/transforms/insertListItem.js +2 -17
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +2 -8
- package/dist/cjs/plugins/List/transforms/moveListItems.js +2 -7
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +14 -15
- package/dist/cjs/plugins/List/transforms/toggleList.js +3 -8
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/cjs/plugins/List/transforms/unwrapList.js +2 -7
- package/dist/cjs/plugins/List/utils.js +11 -12
- package/dist/cjs/plugins/List/withList.js +2 -6
- package/dist/cjs/plugins/Marks/Bold.js +7 -9
- package/dist/cjs/plugins/Marks/Code.js +7 -15
- package/dist/cjs/plugins/Marks/Italic.js +7 -9
- package/dist/cjs/plugins/Marks/Subscript.js +8 -10
- package/dist/cjs/plugins/Marks/Superscript.js +8 -10
- package/dist/cjs/plugins/Marks/Underline.js +4 -6
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +7 -9
- package/dist/cjs/plugins/Marks/helpers.js +5 -5
- package/dist/cjs/plugins/Normalizer/baseRules.js +0 -2
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/cjs/plugins/Normalizer/utils.js +3 -4
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +3 -23
- package/dist/cjs/plugins/Paragraph/Paragraph.js +4 -6
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +2 -3
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +6 -9
- package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +0 -9
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
- package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
- package/dist/cjs/plugins/Quote/components/Quote.js +4 -6
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +4 -6
- package/dist/cjs/plugins/Quote/createQuotePlugin.js +0 -1
- package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
- package/dist/cjs/plugins/Quote/withQuote.js +2 -4
- package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
- 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 +4 -5
- package/dist/cjs/plugins/Table/actions/addRow.js +3 -6
- package/dist/cjs/plugins/Table/components/Cell.js +5 -7
- package/dist/cjs/plugins/Table/components/HeaderCell.js +5 -7
- package/dist/cjs/plugins/Table/components/Row.js +4 -6
- package/dist/cjs/plugins/Table/components/Table.js +6 -8
- package/dist/cjs/plugins/Table/components/TableActions.js +16 -19
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +4 -7
- package/dist/cjs/plugins/Table/createTablePlugin.js +1 -11
- package/dist/cjs/plugins/Table/helpers.js +12 -16
- package/dist/cjs/plugins/Table/insertTableFragment.js +2 -15
- package/dist/cjs/plugins/Table/onKeyDownTable.js +2 -11
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
- package/dist/cjs/plugins/Text/createTextPlugin.js +5 -22
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -5
- package/dist/cjs/plugins/Tracking/utils.js +3 -6
- package/dist/cjs/plugins/Voids/createVoidsPlugin.js +0 -5
- package/dist/cjs/plugins/Voids/transformVoid.js +0 -1
- package/dist/cjs/plugins/index.js +3 -15
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +10 -12
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +6 -16
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +8 -10
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +5 -9
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +11 -13
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +12 -14
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +11 -14
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +4 -8
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +6 -10
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -5
- package/dist/cjs/plugins/shared/ToolbarButton.js +6 -8
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -10
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +6 -11
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +13 -15
- package/dist/cjs/plugins/shared/utils.js +1 -4
- package/dist/cjs/test-utils/assertOutput.js +0 -1
- package/dist/cjs/test-utils/hyperscript.d.js +0 -1
- package/dist/cjs/test-utils/randomId.js +1 -3
- package/dist/cjs/test-utils/validation.js +5 -8
- package/dist/esm/ContentfulEditorProvider.js +1 -4
- package/dist/esm/RichTextEditor.js +13 -13
- package/dist/esm/RichTextEditor.styles.js +0 -1
- package/dist/esm/SdkProvider.js +2 -2
- package/dist/esm/SyncEditorChanges.js +3 -18
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +7 -9
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +27 -28
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/constants/Schema.js +0 -1
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +31 -34
- 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 +1 -9
- package/dist/esm/helpers/editor.js +6 -22
- package/dist/esm/helpers/extractNodes.js +1 -3
- package/dist/esm/helpers/formatDateAndTime.js +2 -11
- package/dist/esm/helpers/getAllowedResourcesForNodeType.js +2 -19
- package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +2 -26
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +6 -20
- package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +0 -1
- package/dist/esm/helpers/toSlateValue.js +3 -17
- package/dist/esm/helpers/validations.js +1 -5
- package/dist/esm/internal/misc.js +2 -23
- package/dist/esm/internal/queries.js +2 -11
- package/dist/esm/internal/transforms.js +3 -14
- package/dist/esm/internal/types/editor.js +1 -3
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +3 -4
- package/dist/esm/plugins/Break/createResetNodePlugin.js +0 -1
- 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 +1 -11
- package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +0 -2
- package/dist/esm/plugins/CommandPalette/onKeyDown.js +0 -5
- 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 +0 -2
- package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
- package/dist/esm/plugins/DragAndDrop/index.js +1 -9
- 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 +7 -8
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +26 -18
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -6
- package/dist/esm/plugins/Hr/index.js +5 -8
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +23 -25
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +6 -6
- package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +15 -19
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +6 -6
- package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +4 -4
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -5
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -6
- 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 +25 -29
- 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 +0 -4
- package/dist/esm/plugins/List/insertListBreak.js +4 -13
- package/dist/esm/plugins/List/insertListFragment.js +5 -18
- package/dist/esm/plugins/List/onKeyDownList.js +5 -7
- package/dist/esm/plugins/List/transforms/insertListItem.js +3 -20
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +2 -8
- package/dist/esm/plugins/List/transforms/moveListItems.js +2 -7
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +14 -15
- package/dist/esm/plugins/List/transforms/toggleList.js +3 -8
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
- package/dist/esm/plugins/List/transforms/unwrapList.js +2 -7
- package/dist/esm/plugins/List/utils.js +2 -7
- package/dist/esm/plugins/List/withList.js +2 -6
- package/dist/esm/plugins/Marks/Bold.js +2 -2
- package/dist/esm/plugins/Marks/Code.js +2 -8
- 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 +0 -4
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
- package/dist/esm/plugins/Normalizer/utils.js +0 -1
- package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -22
- 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 +1 -2
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +3 -9
- package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
- package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +1 -27
- package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
- package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
- 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 +0 -1
- package/dist/esm/plugins/Quote/shouldResetQuote.js +1 -6
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +2 -4
- package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
- 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 +1 -2
- package/dist/esm/plugins/Table/actions/addRow.js +0 -3
- 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 +11 -12
- package/dist/esm/plugins/Table/components/ToolbarButton.js +2 -3
- package/dist/esm/plugins/Table/createTablePlugin.js +1 -11
- package/dist/esm/plugins/Table/helpers.js +1 -10
- package/dist/esm/plugins/Table/insertTableFragment.js +2 -15
- package/dist/esm/plugins/Table/onKeyDownTable.js +2 -11
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
- package/dist/esm/plugins/Text/createTextPlugin.js +5 -22
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -2
- package/dist/esm/plugins/Tracking/utils.js +0 -1
- package/dist/esm/plugins/Voids/createVoidsPlugin.js +0 -5
- package/dist/esm/plugins/Voids/transformVoid.js +1 -4
- package/dist/esm/plugins/index.js +0 -12
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -15
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -8
- 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 +8 -9
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +3 -7
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +3 -5
- 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 +2 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +2 -5
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
- package/dist/esm/plugins/shared/utils.js +1 -4
- package/dist/esm/test-utils/assertOutput.js +0 -1
- package/dist/esm/test-utils/hyperscript.d.js +0 -1
- package/dist/esm/test-utils/jsx.js +1 -5
- package/dist/esm/test-utils/randomId.js +1 -3
- package/dist/esm/test-utils/setEmptyDataAttribute.js +1 -4
- package/dist/esm/test-utils/validation.js +4 -7
- package/dist/types/RichTextEditor.d.ts +2 -3
- package/dist/types/Toolbar/components/EmbedEntityWidget.d.ts +1 -2
- package/dist/types/Toolbar/components/EmbeddedEntityDropdownButton.d.ts +1 -1
- package/dist/types/Toolbar/components/StickyToolbarWrapper.d.ts +2 -2
- package/dist/types/Toolbar/index.d.ts +1 -2
- package/dist/types/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +4 -4
- package/dist/types/dialogs/renderRichTextDialog.d.ts +1 -2
- package/dist/types/plugins/CommandPalette/components/CommandList.d.ts +1 -2
- package/dist/types/plugins/CommandPalette/components/CommandPrompt.d.ts +1 -2
- package/dist/types/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +1 -2
- package/dist/types/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -1
- package/dist/types/plugins/EmbeddedEntityInline/LinkedEntityInline.d.ts +1 -2
- package/dist/types/plugins/EmbeddedResourceBlock/LinkedResourceBlock.d.ts +1 -2
- package/dist/types/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.d.ts +1 -1
- package/dist/types/plugins/EmbeddedResourceInline/LinkedResourceInline.d.ts +1 -2
- package/dist/types/plugins/Heading/components/Heading.d.ts +6 -6
- package/dist/types/plugins/Heading/components/ToolbarHeadingButton.d.ts +1 -2
- package/dist/types/plugins/Hr/index.d.ts +2 -2
- package/dist/types/plugins/Hyperlink/HyperlinkModal.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/EntityHyperlink.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/LinkPopover.d.ts +1 -1
- package/dist/types/plugins/Hyperlink/components/ResourceHyperlink.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +1 -2
- package/dist/types/plugins/Hyperlink/components/UrlHyperlink.d.ts +1 -2
- package/dist/types/plugins/List/components/List.d.ts +2 -3
- package/dist/types/plugins/List/components/ListItem.d.ts +1 -2
- package/dist/types/plugins/List/components/ToolbarListButton.d.ts +1 -2
- package/dist/types/plugins/Marks/Bold.d.ts +2 -3
- package/dist/types/plugins/Marks/Code.d.ts +3 -4
- package/dist/types/plugins/Marks/Italic.d.ts +2 -3
- package/dist/types/plugins/Marks/Subscript.d.ts +3 -4
- package/dist/types/plugins/Marks/Superscript.d.ts +3 -4
- package/dist/types/plugins/Marks/Underline.d.ts +2 -3
- package/dist/types/plugins/Marks/components/MarkToolbarButton.d.ts +1 -1
- package/dist/types/plugins/Paragraph/Paragraph.d.ts +1 -2
- package/dist/types/plugins/Quote/components/Quote.d.ts +1 -2
- package/dist/types/plugins/Quote/components/ToolbarQuoteButton.d.ts +1 -2
- package/dist/types/plugins/Table/components/Cell.d.ts +1 -2
- package/dist/types/plugins/Table/components/HeaderCell.d.ts +1 -2
- package/dist/types/plugins/Table/components/Row.d.ts +1 -2
- package/dist/types/plugins/Table/components/Table.d.ts +1 -2
- package/dist/types/plugins/Table/components/TableActions.d.ts +1 -2
- package/dist/types/plugins/Table/components/ToolbarButton.d.ts +1 -2
- package/dist/types/plugins/shared/EmbeddedBlockToolbarIcon.d.ts +1 -2
- package/dist/types/plugins/shared/EmbeddedInlineToolbarIcon.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedEntryCard.d.ts +1 -2
- package/dist/types/plugins/shared/FetchingWrappedResourceCard.d.ts +1 -2
- package/dist/types/plugins/shared/LinkedBlockWrapper.d.ts +1 -1
- package/dist/types/plugins/shared/LinkedInlineWrapper.d.ts +1 -1
- package/dist/types/plugins/shared/ResourceNewBadge.d.ts +1 -2
- package/dist/types/plugins/shared/ToolbarButton.d.ts +1 -2
- package/package.json +8 -5
|
@@ -9,21 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
getContentfulEditorId: function() {
|
|
13
|
+
return getContentfulEditorId;
|
|
14
14
|
},
|
|
15
15
|
editorContext: function() {
|
|
16
16
|
return editorContext;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
useContentfulEditor: function() {
|
|
22
|
-
return useContentfulEditor;
|
|
18
|
+
ContentfulEditorIdProvider: function() {
|
|
19
|
+
return ContentfulEditorIdProvider;
|
|
23
20
|
},
|
|
24
21
|
useContentfulEditorId: function() {
|
|
25
22
|
return useContentfulEditorId;
|
|
26
23
|
},
|
|
24
|
+
useContentfulEditor: function() {
|
|
25
|
+
return useContentfulEditor;
|
|
26
|
+
},
|
|
27
27
|
useContentfulEditorRef: function() {
|
|
28
28
|
return useContentfulEditorRef;
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ _export(exports, {
|
|
|
31
31
|
const _react = require("react");
|
|
32
32
|
const _hooks = require("./internal/hooks");
|
|
33
33
|
function getContentfulEditorId(sdk) {
|
|
34
|
-
const { entry, field
|
|
34
|
+
const { entry , field } = sdk;
|
|
35
35
|
const sys = entry.getSys();
|
|
36
36
|
return `rich-text-editor-${sys.id}-${field.id}-${field.locale}`;
|
|
37
37
|
}
|
|
@@ -16,14 +16,14 @@ _export(exports, {
|
|
|
16
16
|
return _default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react =
|
|
19
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
20
20
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
21
21
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
22
|
-
const _richtexttypes =
|
|
22
|
+
const _richtexttypes = _interop_require_wildcard(require("@contentful/rich-text-types"));
|
|
23
23
|
const _platecommon = require("@udecode/plate-common");
|
|
24
24
|
const _emotion = require("emotion");
|
|
25
|
-
const _fastdeepequal =
|
|
26
|
-
const _noop =
|
|
25
|
+
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
26
|
+
const _noop = _interop_require_default(require("lodash/noop"));
|
|
27
27
|
const _ContentfulEditorProvider = require("./ContentfulEditorProvider");
|
|
28
28
|
const _toSlateValue = require("./helpers/toSlateValue");
|
|
29
29
|
const _misc = require("./internal/misc");
|
|
@@ -31,8 +31,8 @@ const _plugins = require("./plugins");
|
|
|
31
31
|
const _RichTextEditorstyles = require("./RichTextEditor.styles");
|
|
32
32
|
const _SdkProvider = require("./SdkProvider");
|
|
33
33
|
const _SyncEditorChanges = require("./SyncEditorChanges");
|
|
34
|
-
const _Toolbar =
|
|
35
|
-
const _StickyToolbarWrapper =
|
|
34
|
+
const _Toolbar = _interop_require_default(require("./Toolbar"));
|
|
35
|
+
const _StickyToolbarWrapper = _interop_require_default(require("./Toolbar/components/StickyToolbarWrapper"));
|
|
36
36
|
function _interop_require_default(obj) {
|
|
37
37
|
return obj && obj.__esModule ? obj : {
|
|
38
38
|
default: obj
|
|
@@ -59,9 +59,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
if (cache && cache.has(obj)) {
|
|
60
60
|
return cache.get(obj);
|
|
61
61
|
}
|
|
62
|
-
var newObj = {
|
|
63
|
-
__proto__: null
|
|
64
|
-
};
|
|
62
|
+
var newObj = {};
|
|
65
63
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
64
|
for(var key in obj){
|
|
67
65
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -80,7 +78,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
80
78
|
return newObj;
|
|
81
79
|
}
|
|
82
80
|
const ConnectedRichTextEditor = (props)=>{
|
|
83
|
-
const { sdk, onAction, restrictedMarks
|
|
81
|
+
const { sdk , onAction , restrictedMarks } = props;
|
|
84
82
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
85
83
|
const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks), [
|
|
86
84
|
sdk,
|
|
@@ -101,26 +99,26 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
101
99
|
}) : undefined, props.maxHeight !== undefined ? (0, _emotion.css)({
|
|
102
100
|
maxHeight: props.maxHeight
|
|
103
101
|
}) : undefined, props.isDisabled ? _RichTextEditorstyles.styles.disabled : _RichTextEditorstyles.styles.enabled, props.isToolbarHidden && _RichTextEditorstyles.styles.hiddenToolbar);
|
|
104
|
-
return
|
|
102
|
+
return _react.createElement(_SdkProvider.SdkProvider, {
|
|
105
103
|
sdk: sdk
|
|
106
|
-
},
|
|
104
|
+
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
107
105
|
value: id
|
|
108
|
-
},
|
|
106
|
+
}, _react.createElement("div", {
|
|
109
107
|
className: _RichTextEditorstyles.styles.root,
|
|
110
108
|
"data-test-id": "rich-text-editor"
|
|
111
|
-
},
|
|
109
|
+
}, _react.createElement(_platecommon.PlateProvider, {
|
|
112
110
|
id: id,
|
|
113
111
|
initialValue: initialValue,
|
|
114
112
|
plugins: plugins,
|
|
115
113
|
disableCorePlugins: _plugins.disableCorePlugins
|
|
116
|
-
}, !props.isToolbarHidden &&
|
|
114
|
+
}, !props.isToolbarHidden && _react.createElement(_StickyToolbarWrapper.default, {
|
|
117
115
|
isDisabled: props.isDisabled
|
|
118
|
-
},
|
|
116
|
+
}, _react.createElement(_Toolbar.default, {
|
|
119
117
|
isDisabled: props.isDisabled
|
|
120
|
-
})),
|
|
118
|
+
})), _react.createElement(_SyncEditorChanges.SyncEditorChanges, {
|
|
121
119
|
incomingValue: initialValue,
|
|
122
120
|
onChange: props.onChange
|
|
123
|
-
}),
|
|
121
|
+
}), _react.createElement(_platecommon.Plate, {
|
|
124
122
|
id: id,
|
|
125
123
|
editableProps: {
|
|
126
124
|
className: classNames,
|
|
@@ -129,18 +127,18 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
129
127
|
})))));
|
|
130
128
|
};
|
|
131
129
|
const RichTextEditor = (props)=>{
|
|
132
|
-
const { sdk, isInitiallyDisabled, onAction, restrictedMarks, ...otherProps } = props;
|
|
130
|
+
const { sdk , isInitiallyDisabled , onAction , restrictedMarks , ...otherProps } = props;
|
|
133
131
|
const isEmptyValue = _react.useCallback((value)=>!value || (0, _fastdeepequal.default)(value, _richtexttypes.EMPTY_DOCUMENT), []);
|
|
134
132
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(props.sdk);
|
|
135
|
-
return
|
|
133
|
+
return _react.createElement(_fieldeditorreference.EntityProvider, {
|
|
136
134
|
sdk: sdk
|
|
137
|
-
},
|
|
135
|
+
}, _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
138
136
|
debounce: 0,
|
|
139
137
|
field: sdk.field,
|
|
140
138
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
141
139
|
isEmptyValue: isEmptyValue,
|
|
142
140
|
isEqualValues: _fastdeepequal.default
|
|
143
|
-
}, ({ lastRemoteValue, disabled, setValue
|
|
141
|
+
}, ({ lastRemoteValue , disabled , setValue })=>_react.createElement(ConnectedRichTextEditor, {
|
|
144
142
|
...otherProps,
|
|
145
143
|
key: `rich-text-editor-${id}`,
|
|
146
144
|
value: lastRemoteValue,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "styles", {
|
|
|
8
8
|
return styles;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _f36tokens =
|
|
11
|
+
const _f36tokens = _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 : {
|
|
@@ -42,7 +42,6 @@ const styles = {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
// We need to reset LIC style due to conflicts between PARAGRAPH styles
|
|
46
45
|
'ul > li > div': {
|
|
47
46
|
margin: 0
|
|
48
47
|
}
|
package/dist/cjs/SdkProvider.js
CHANGED
|
@@ -16,8 +16,8 @@ _export(exports, {
|
|
|
16
16
|
return useSdkContext;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react =
|
|
20
|
-
const _constate =
|
|
19
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
20
|
+
const _constate = _interop_require_default(require("constate"));
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
23
23
|
default: obj
|
|
@@ -44,9 +44,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
44
|
if (cache && cache.has(obj)) {
|
|
45
45
|
return cache.get(obj);
|
|
46
46
|
}
|
|
47
|
-
var newObj = {
|
|
48
|
-
__proto__: null
|
|
49
|
-
};
|
|
47
|
+
var newObj = {};
|
|
50
48
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
49
|
for(var key in obj){
|
|
52
50
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -64,8 +62,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
64
62
|
}
|
|
65
63
|
return newObj;
|
|
66
64
|
}
|
|
67
|
-
function useSdk({ sdk
|
|
68
|
-
const sdkMemo = _react.useMemo(()=>sdk, []);
|
|
65
|
+
function useSdk({ sdk }) {
|
|
66
|
+
const sdkMemo = _react.useMemo(()=>sdk, []);
|
|
69
67
|
return sdkMemo;
|
|
70
68
|
}
|
|
71
69
|
const [SdkProvider, useSdkContext] = (0, _constate.default)(useSdk);
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "SyncEditorChanges", {
|
|
|
8
8
|
return SyncEditorChanges;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _platecommon = require("@udecode/plate-common");
|
|
13
|
-
const _fastdeepequal =
|
|
13
|
+
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
14
14
|
const _callbacks = require("./helpers/callbacks");
|
|
15
15
|
const _hooks = require("./internal/hooks");
|
|
16
16
|
const _transforms = require("./internal/transforms");
|
|
@@ -40,9 +40,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
40
40
|
if (cache && cache.has(obj)) {
|
|
41
41
|
return cache.get(obj);
|
|
42
42
|
}
|
|
43
|
-
var newObj = {
|
|
44
|
-
__proto__: null
|
|
45
|
-
};
|
|
43
|
+
var newObj = {};
|
|
46
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
47
45
|
for(var key in obj){
|
|
48
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -60,12 +58,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
58
|
}
|
|
61
59
|
return newObj;
|
|
62
60
|
}
|
|
63
|
-
|
|
64
|
-
* A hook responsible for keeping the editor state in sync with incoming
|
|
65
|
-
* changes (aka. external updates
|
|
66
|
-
*/ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
61
|
+
const useAcceptIncomingChanges = (incomingValue)=>{
|
|
67
62
|
const editor = (0, _hooks.usePlateSelectors)().editor();
|
|
68
|
-
// Cache latest editor value to avoid unnecessary updates
|
|
69
63
|
const lastIncomingValue = _react.useRef(incomingValue);
|
|
70
64
|
_react.useEffect(()=>{
|
|
71
65
|
if ((0, _fastdeepequal.default)(lastIncomingValue.current, incomingValue)) {
|
|
@@ -78,16 +72,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
72
|
incomingValue
|
|
79
73
|
]);
|
|
80
74
|
};
|
|
81
|
-
|
|
82
|
-
* Attaches a custom onChange callback that
|
|
83
|
-
*/ const useOnValueChanged = (onChange)=>{
|
|
75
|
+
const useOnValueChanged = (onChange)=>{
|
|
84
76
|
const editor = (0, _hooks.usePlateSelectors)().editor();
|
|
85
77
|
const setEditorOnChange = (0, _platecommon.usePlateActions)().onChange();
|
|
86
78
|
_react.useEffect(()=>{
|
|
87
79
|
const cb = (0, _callbacks.createOnChangeCallback)(onChange);
|
|
88
80
|
setEditorOnChange({
|
|
89
81
|
fn: (document)=>{
|
|
90
|
-
// Skip irrelevant events e.g. mouse selection
|
|
91
82
|
const operations = editor?.operations.filter((op)=>{
|
|
92
83
|
return op.type !== 'set_selection';
|
|
93
84
|
});
|
|
@@ -103,7 +94,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
103
94
|
setEditorOnChange
|
|
104
95
|
]);
|
|
105
96
|
};
|
|
106
|
-
const SyncEditorChanges = ({ incomingValue, onChange
|
|
97
|
+
const SyncEditorChanges = ({ incomingValue , onChange })=>{
|
|
107
98
|
useAcceptIncomingChanges(incomingValue);
|
|
108
99
|
useOnValueChanged(onChange);
|
|
109
100
|
return null;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const _react =
|
|
5
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
6
6
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
8
|
const _platecommon = require("@udecode/plate-common");
|
|
9
9
|
require("@testing-library/jest-dom/extend-expect");
|
|
10
10
|
const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
|
|
11
11
|
const _SdkProvider = require("../../SdkProvider");
|
|
12
|
-
const _index =
|
|
12
|
+
const _index = _interop_require_default(require("../index"));
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
15
15
|
default: obj
|
|
@@ -36,9 +36,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
40
|
-
__proto__: null
|
|
41
|
-
};
|
|
39
|
+
var newObj = {};
|
|
42
40
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
41
|
for(var key in obj){
|
|
44
42
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -87,13 +85,13 @@ describe('Toolbar', ()=>{
|
|
|
87
85
|
test('everything on the toolbar should be disabled', async ()=>{
|
|
88
86
|
const sdk = mockSdk();
|
|
89
87
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
90
|
-
const { getByTestId
|
|
88
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
91
89
|
id: id
|
|
92
|
-
},
|
|
90
|
+
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
93
91
|
sdk: sdk
|
|
94
|
-
},
|
|
92
|
+
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
95
93
|
value: id
|
|
96
|
-
},
|
|
94
|
+
}, _react.createElement(_index.default, {
|
|
97
95
|
isDisabled: true
|
|
98
96
|
})))));
|
|
99
97
|
await (0, _react1.waitFor)(()=>{
|
|
@@ -121,13 +119,13 @@ describe('Toolbar', ()=>{
|
|
|
121
119
|
_richtexttypes.MARKS.SUPERSCRIPT
|
|
122
120
|
]);
|
|
123
121
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
124
|
-
const { queryByTestId
|
|
122
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
125
123
|
id: id
|
|
126
|
-
},
|
|
124
|
+
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
127
125
|
sdk: sdk
|
|
128
|
-
},
|
|
126
|
+
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
129
127
|
value: id
|
|
130
|
-
},
|
|
128
|
+
}, _react.createElement(_index.default, {
|
|
131
129
|
isDisabled: true
|
|
132
130
|
})))));
|
|
133
131
|
expect(queryByTestId('dropdown-toolbar-button')).toBeVisible();
|
|
@@ -139,13 +137,13 @@ describe('Toolbar', ()=>{
|
|
|
139
137
|
_richtexttypes.MARKS.CODE
|
|
140
138
|
]);
|
|
141
139
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
142
|
-
const { queryByTestId
|
|
140
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
143
141
|
id: id
|
|
144
|
-
},
|
|
142
|
+
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
145
143
|
sdk: sdk
|
|
146
|
-
},
|
|
144
|
+
}, _react.createElement(_ContentfulEditorProvider.ContentfulEditorIdProvider, {
|
|
147
145
|
value: id
|
|
148
|
-
},
|
|
146
|
+
}, _react.createElement(_index.default, {
|
|
149
147
|
isDisabled: true
|
|
150
148
|
})))));
|
|
151
149
|
expect(queryByTestId('dropdown-toolbar-button')).not.toBeInTheDocument();
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EmbedEntityWidget", {
|
|
|
8
8
|
return EmbedEntityWidget;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
13
13
|
const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
|
|
14
14
|
const _editor = require("../../helpers/editor");
|
|
@@ -38,9 +38,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
42
|
-
__proto__: null
|
|
43
|
-
};
|
|
41
|
+
var newObj = {};
|
|
44
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
43
|
for(var key in obj){
|
|
46
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,7 +56,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
56
|
}
|
|
59
57
|
return newObj;
|
|
60
58
|
}
|
|
61
|
-
const EmbedEntityWidget = ({ isDisabled, canInsertBlocks
|
|
59
|
+
const EmbedEntityWidget = ({ isDisabled , canInsertBlocks })=>{
|
|
62
60
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
63
61
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
64
62
|
const [isEmbedDropdownOpen, setEmbedDropdownOpen] = (0, _react.useState)(false);
|
|
@@ -68,32 +66,30 @@ const EmbedEntityWidget = ({ isDisabled, canInsertBlocks })=>{
|
|
|
68
66
|
const inlineResourceEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.INLINES.EMBEDDED_RESOURCE);
|
|
69
67
|
const blockEntryEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_ENTRY) && canInsertBlocks;
|
|
70
68
|
const blockResourceEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_RESOURCE) && canInsertBlocks;
|
|
71
|
-
// Removed access check following https://contentful.atlassian.net/browse/DANTE-486
|
|
72
|
-
// TODO: refine permissions check in order to account for tags in rules and then readd access.can('read', 'Asset')
|
|
73
69
|
const blockAssetEmbedEnabled = (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
|
|
74
|
-
const actions =
|
|
70
|
+
const actions = _react.default.createElement(_react.default.Fragment, null, blockEntryEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
75
71
|
isDisabled: !!isDisabled,
|
|
76
72
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_ENTRY,
|
|
77
73
|
onClose: onCloseEntityDropdown
|
|
78
|
-
}), blockResourceEmbedEnabled &&
|
|
74
|
+
}), blockResourceEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
79
75
|
isDisabled: !!isDisabled,
|
|
80
76
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_RESOURCE,
|
|
81
77
|
onClose: onCloseEntityDropdown
|
|
82
|
-
}), inlineEntryEmbedEnabled &&
|
|
78
|
+
}), inlineEntryEmbedEnabled && _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
83
79
|
nodeType: _richtexttypes.INLINES.EMBEDDED_ENTRY,
|
|
84
80
|
isDisabled: !!isDisabled || (0, _editor.isLinkActive)(editor),
|
|
85
81
|
onClose: onCloseEntityDropdown
|
|
86
|
-
}), inlineResourceEmbedEnabled &&
|
|
82
|
+
}), inlineResourceEmbedEnabled && _react.default.createElement(_EmbeddedInlineToolbarIcon.EmbeddedInlineToolbarIcon, {
|
|
87
83
|
nodeType: _richtexttypes.INLINES.EMBEDDED_RESOURCE,
|
|
88
84
|
isDisabled: !!isDisabled || (0, _editor.isLinkActive)(editor),
|
|
89
85
|
onClose: onCloseEntityDropdown
|
|
90
|
-
}), blockAssetEmbedEnabled &&
|
|
86
|
+
}), blockAssetEmbedEnabled && _react.default.createElement(_EmbeddedBlockToolbarIcon.EmbeddedBlockToolbarIcon, {
|
|
91
87
|
isDisabled: !!isDisabled,
|
|
92
88
|
nodeType: _richtexttypes.BLOCKS.EMBEDDED_ASSET,
|
|
93
89
|
onClose: onCloseEntityDropdown
|
|
94
90
|
}));
|
|
95
91
|
const showEmbedButton = blockEntryEmbedEnabled || blockResourceEmbedEnabled || inlineEntryEmbedEnabled || inlineResourceEmbedEnabled || blockAssetEmbedEnabled;
|
|
96
|
-
return showEmbedButton ?
|
|
92
|
+
return showEmbedButton ? _react.default.createElement(_EmbeddedEntityDropdownButton.EmbeddedEntityDropdownButton, {
|
|
97
93
|
isDisabled: isDisabled,
|
|
98
94
|
onClose: onCloseEntityDropdown,
|
|
99
95
|
onToggle: onToggleEntityDropdown,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EmbeddedEntityDropdownButton", {
|
|
|
8
8
|
return EmbeddedEntityDropdownButton;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -32,9 +32,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
32
32
|
if (cache && cache.has(obj)) {
|
|
33
33
|
return cache.get(obj);
|
|
34
34
|
}
|
|
35
|
-
var newObj = {
|
|
36
|
-
__proto__: null
|
|
37
|
-
};
|
|
35
|
+
var newObj = {};
|
|
38
36
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
37
|
for(var key in obj){
|
|
40
38
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -52,20 +50,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
50
|
}
|
|
53
51
|
return newObj;
|
|
54
52
|
}
|
|
55
|
-
function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle
|
|
56
|
-
return
|
|
53
|
+
function EmbeddedEntityDropdownButton({ children , isDisabled , isOpen , onClose , onToggle }) {
|
|
54
|
+
return _react.createElement(_f36components.Menu, {
|
|
57
55
|
placement: "bottom-end",
|
|
58
56
|
isOpen: isOpen,
|
|
59
57
|
onClose: onClose,
|
|
60
58
|
onOpen: onToggle
|
|
61
|
-
},
|
|
62
|
-
endIcon:
|
|
59
|
+
}, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement(_f36components.Button, {
|
|
60
|
+
endIcon: _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
63
61
|
testId: "toolbar-entity-dropdown-toggle",
|
|
64
62
|
variant: "secondary",
|
|
65
63
|
size: "small",
|
|
66
|
-
startIcon:
|
|
64
|
+
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
67
65
|
isDisabled: isDisabled
|
|
68
|
-
}, "Embed")),
|
|
66
|
+
}, "Embed")), _react.createElement(_f36components.Menu.List, {
|
|
69
67
|
className: "toolbar-entity-dropdown-list"
|
|
70
68
|
}, children));
|
|
71
69
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_default(require("react"));
|
|
12
12
|
const _emotion = require("emotion");
|
|
13
13
|
function _interop_require_default(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
@@ -23,7 +23,7 @@ const styles = {
|
|
|
23
23
|
z-index: 2;
|
|
24
24
|
`
|
|
25
25
|
};
|
|
26
|
-
const StickyToolbarWrapper = ({ isDisabled, children
|
|
26
|
+
const StickyToolbarWrapper = ({ isDisabled , children })=>_react.default.createElement("div", {
|
|
27
27
|
className: isDisabled ? '' : styles.nativeSticky
|
|
28
28
|
}, children);
|
|
29
29
|
const _default = StickyToolbarWrapper;
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
|
-
const _f36tokens =
|
|
14
|
+
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
15
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
16
16
|
const _emotion = require("emotion");
|
|
17
17
|
const _ContentfulEditorProvider = require("../ContentfulEditorProvider");
|
|
@@ -58,9 +58,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
58
|
if (cache && cache.has(obj)) {
|
|
59
59
|
return cache.get(obj);
|
|
60
60
|
}
|
|
61
|
-
var newObj = {
|
|
62
|
-
__proto__: null
|
|
63
|
-
};
|
|
61
|
+
var newObj = {};
|
|
64
62
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
63
|
for(var key in obj){
|
|
66
64
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -123,26 +121,26 @@ const styles = {
|
|
|
123
121
|
marginRight: '20px'
|
|
124
122
|
})
|
|
125
123
|
};
|
|
126
|
-
const Dropdown = ({ sdk, isDisabled
|
|
124
|
+
const Dropdown = ({ sdk , isDisabled })=>{
|
|
127
125
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
128
126
|
const isActive = editor && ((0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.SUBSCRIPT) || (0, _queries.isMarkActive)(editor, _richtexttypes.MARKS.CODE));
|
|
129
|
-
return
|
|
127
|
+
return _react.createElement(_f36components.Menu, null, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement("span", null, _react.createElement(_f36components.IconButton, {
|
|
130
128
|
size: "small",
|
|
131
129
|
className: styles.toolbarBtn,
|
|
132
130
|
variant: isActive ? 'secondary' : 'transparent',
|
|
133
|
-
icon:
|
|
131
|
+
icon: _react.createElement(_f36icons.MoreHorizontalIcon, null),
|
|
134
132
|
"aria-label": "toggle menu",
|
|
135
133
|
isDisabled: isDisabled,
|
|
136
134
|
testId: "dropdown-toolbar-button"
|
|
137
|
-
}))),
|
|
135
|
+
}))), _react.createElement(_f36components.Menu.List, null, (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && _react.createElement(_Superscript.ToolbarDropdownSuperscriptButton, {
|
|
138
136
|
isDisabled: isDisabled
|
|
139
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) &&
|
|
137
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && _react.createElement(_Subscript.ToolbarDropdownSubscriptButton, {
|
|
140
138
|
isDisabled: isDisabled
|
|
141
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) &&
|
|
139
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && _react.createElement(_Code.ToolbarDropdownCodeButton, {
|
|
142
140
|
isDisabled: isDisabled
|
|
143
141
|
})));
|
|
144
142
|
};
|
|
145
|
-
const Toolbar = ({ isDisabled
|
|
143
|
+
const Toolbar = ({ isDisabled })=>{
|
|
146
144
|
const sdk = (0, _SdkProvider.useSdkContext)();
|
|
147
145
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
148
146
|
const canInsertBlocks = !(0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.TABLE);
|
|
@@ -152,52 +150,51 @@ const Toolbar = ({ isDisabled })=>{
|
|
|
152
150
|
const isListSelected = (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.UL_LIST) || (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.OL_LIST);
|
|
153
151
|
const isBlockquoteSelected = (0, _editor.isNodeTypeSelected)(editor, _richtexttypes.BLOCKS.QUOTE);
|
|
154
152
|
const shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
|
|
155
|
-
// We only show the dropdown when: whenever at least bold , italic and underline are available; If nothing that would go inside the dropdown is available, we hide it
|
|
156
153
|
const boldItalicUnderlineAvailable = (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE);
|
|
157
154
|
const dropdownItemsAvailable = (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE);
|
|
158
155
|
const shouldShowDropdown = boldItalicUnderlineAvailable && dropdownItemsAvailable;
|
|
159
|
-
return
|
|
156
|
+
return _react.createElement(_f36components.Flex, {
|
|
160
157
|
testId: "toolbar",
|
|
161
158
|
className: styles.toolbar,
|
|
162
159
|
alignItems: "center"
|
|
163
|
-
},
|
|
160
|
+
}, _react.createElement("div", {
|
|
164
161
|
className: styles.formattingOptionsWrapper
|
|
165
|
-
},
|
|
162
|
+
}, _react.createElement(_Heading.ToolbarHeadingButton, {
|
|
166
163
|
isDisabled: isDisabled || !canInsertBlocks
|
|
167
|
-
}), validationInfo.isAnyMarkEnabled &&
|
|
164
|
+
}), validationInfo.isAnyMarkEnabled && _react.createElement("span", {
|
|
168
165
|
className: styles.divider
|
|
169
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) &&
|
|
166
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) && _react.createElement(_Bold.ToolbarBoldButton, {
|
|
170
167
|
isDisabled: isDisabled
|
|
171
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) &&
|
|
168
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.ITALIC) && _react.createElement(_Italic.ToolbarItalicButton, {
|
|
172
169
|
isDisabled: isDisabled
|
|
173
|
-
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE) &&
|
|
170
|
+
}), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.UNDERLINE) && _react.createElement(_Underline.ToolbarUnderlineButton, {
|
|
174
171
|
isDisabled: isDisabled
|
|
175
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) &&
|
|
172
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) && _react.createElement(_Superscript.ToolbarSuperscriptButton, {
|
|
176
173
|
isDisabled: isDisabled
|
|
177
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) &&
|
|
174
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) && _react.createElement(_Subscript.ToolbarSubscriptButton, {
|
|
178
175
|
isDisabled: isDisabled
|
|
179
|
-
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) &&
|
|
176
|
+
}), !boldItalicUnderlineAvailable && (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE) && _react.createElement(_Code.ToolbarCodeButton, {
|
|
180
177
|
isDisabled: isDisabled
|
|
181
|
-
}), shouldShowDropdown &&
|
|
178
|
+
}), shouldShowDropdown && _react.createElement(Dropdown, {
|
|
182
179
|
sdk: sdk,
|
|
183
180
|
isDisabled: isDisabled
|
|
184
|
-
}), validationInfo.isAnyHyperlinkEnabled &&
|
|
181
|
+
}), validationInfo.isAnyHyperlinkEnabled && _react.createElement(_react.Fragment, null, _react.createElement("span", {
|
|
185
182
|
className: styles.divider
|
|
186
|
-
}),
|
|
183
|
+
}), _react.createElement(_Hyperlink.ToolbarHyperlinkButton, {
|
|
187
184
|
isDisabled: isDisabled
|
|
188
|
-
})), validationInfo.isAnyBlockFormattingEnabled &&
|
|
185
|
+
})), validationInfo.isAnyBlockFormattingEnabled && _react.createElement("span", {
|
|
189
186
|
className: styles.divider
|
|
190
|
-
}),
|
|
187
|
+
}), _react.createElement(_List.ToolbarListButton, {
|
|
191
188
|
isDisabled: isDisabled || !canInsertBlocks
|
|
192
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.QUOTE) &&
|
|
189
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.QUOTE) && _react.createElement(_Quote.ToolbarQuoteButton, {
|
|
193
190
|
isDisabled: isDisabled || !canInsertBlocks
|
|
194
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.HR) &&
|
|
191
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.HR) && _react.createElement(_Hr.ToolbarHrButton, {
|
|
195
192
|
isDisabled: isDisabled || !canInsertBlocks
|
|
196
|
-
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.TABLE) &&
|
|
193
|
+
}), (0, _validations.isNodeTypeEnabled)(sdk.field, _richtexttypes.BLOCKS.TABLE) && _react.createElement(_Table.ToolbarTableButton, {
|
|
197
194
|
isDisabled: shouldDisableTables
|
|
198
|
-
})),
|
|
195
|
+
})), _react.createElement("div", {
|
|
199
196
|
className: styles.embedActionsWrapper
|
|
200
|
-
},
|
|
197
|
+
}, _react.createElement(_EmbedEntityWidget.EmbedEntityWidget, {
|
|
201
198
|
isDisabled: isDisabled,
|
|
202
199
|
canInsertBlocks: canInsertBlocks
|
|
203
200
|
})));
|
|
@@ -59,7 +59,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
59
59
|
locales,
|
|
60
60
|
cmaAdapter: (0, _fieldeditortestutils.createFakeCMAAdapter)({
|
|
61
61
|
Entry: {
|
|
62
|
-
get: async ({ entryId
|
|
62
|
+
get: async ({ entryId })=>{
|
|
63
63
|
if (props?.fetchDelay) {
|
|
64
64
|
await delay(props.fetchDelay);
|
|
65
65
|
}
|
|
@@ -76,7 +76,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
Asset: {
|
|
79
|
-
get: async ({ assetId
|
|
79
|
+
get: async ({ assetId })=>{
|
|
80
80
|
if (props?.fetchDelay) {
|
|
81
81
|
await delay(props.fetchDelay);
|
|
82
82
|
}
|
|
@@ -101,7 +101,7 @@ function newReferenceEditorFakeSdk(props) {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
ContentType: {
|
|
104
|
-
get: async ({ contentTypeId
|
|
104
|
+
get: async ({ contentTypeId })=>{
|
|
105
105
|
if (contentTypeId === _fixtures.contentTypes.published.sys.id) {
|
|
106
106
|
return _fixtures.contentTypes.published;
|
|
107
107
|
}
|