@contentful/field-editor-rich-text 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/field-editor-rich-text.cjs.development.js +17 -17
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +13 -13
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +4 -4
- package/dist/helpers/sanitizeIncomingSlateDoc.d.ts +2 -2
- package/dist/internal/hooks.d.ts +3 -0
- package/dist/internal/misc.d.ts +3 -1
- package/dist/internal/types/editor.d.ts +0 -19
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +13 -8
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +18 -7
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +16 -4
- package/dist/plugins/List/transforms/moveListItems.d.ts +2 -2
- package/dist/plugins/links-tracking.d.ts +2 -5
- package/dist/prepareDocument.d.ts +1 -1
- package/package.json +3 -3
|
@@ -2,10 +2,11 @@ import React__default, { createContext, useContext, useMemo, useState, useEffect
|
|
|
2
2
|
import { MissingEntityCard, WrappedAssetCard, useEntity, useEntityLoader, WrappedEntryCard, ScheduledIconWithTooltip, EntityProvider, getScheduleTooltipContent } from '@contentful/field-editor-reference';
|
|
3
3
|
import { entityHelpers, ModalDialogLauncher, FieldConnector } from '@contentful/field-editor-shared';
|
|
4
4
|
import { BLOCKS, INLINES, TEXT_CONTAINERS, HEADINGS, LIST_ITEM_BLOCKS, MARKS, CONTAINERS, TOP_LEVEL_BLOCKS, VOID_BLOCKS, EMPTY_DOCUMENT } from '@contentful/rich-text-types';
|
|
5
|
-
import { usePlateEditorRef, usePlateEditorState, getPlateSelectors as getPlateSelectors$1, withoutNormalizing as withoutNormalizing$1, createPlateEditor as createPlateEditor$1, blurEditor as blurEditor$1, toSlatePoint, mockPlugin as mockPlugin$1, focusEditor as focusEditor$1, selectEditor as selectEditor$1, getNodeEntries as getNodeEntries$1, isMarkActive as isMarkActive$1, getAboveNode as getAboveNode$1, getRange as getRange$1, isText as isText$1, isElement as isElement$1, getEditorString, getBlockAbove as getBlockAbove$1, getParentNode as getParentNode$1, getLastChildPath as getLastChildPath$1, someHtmlElement as someHtmlElement$1, isCollapsed, isInline as isInline$2, isEndPoint as isEndPoint$1, getPointAfter as getPointAfter$1, isFirstChild as isFirstChild$1, getNodeEntry as getNodeEntry$1, isEditor as isEditor$1, isEditorReadOnly as isEditorReadOnly$1, isRangeAcrossBlocks as isRangeAcrossBlocks$1, getPluginType as getPluginType$1, getCommonNode as getCommonNode$1, findNode as findNode$1, isBlock, match as match$1, isAncestorEmpty as isAncestorEmpty$1, isLastChild, getPointBefore as getPointBefore$1, queryNode as queryNode$1, isNode as isNode$1, getEndPoint as getEndPoint$1, getChildren as getChildren$1, findNodePath as findNodePath$1, getLastNodeByLevel as getLastNodeByLevel$1, createPathRef as createPathRef$1, getNodeTexts as getNodeTexts$1, isSelectionAtBlockStart as isSelectionAtBlockStart$1, getNodeChildren as getNodeChildren$1, isExpanded, isSelectionAtBlockEnd as isSelectionAtBlockEnd$1, someNode as someNode$1, getStartPoint as getStartPoint$1, getMarks as getMarks$1, wrapNodes as wrapNodes$1, insertNodes as insertNodes$1, unhangRange as unhangRange$1, setSelection as setSelection$1, unsetNodes as unsetNodes$1, removeMark as removeMark$1, addMark as addMark$1, removeNodes as removeNodes$1, unwrapNodes as unwrapNodes$1, liftNodes as liftNodes$1, select as select$1, toggleMark as toggleMark$1, normalizeEditor, setNodes as setNodes$1, toggleNodeType as toggleNodeType$1, deleteText as deleteText$1, deleteFragment as deleteFragment$1, splitNodes as splitNodes$1, moveSelection as moveSelection$1, insertText as insertText$1, collapseSelection as collapseSelection$1, moveChildren as moveChildren$1, moveNodes as moveNodes$1, ELEMENT_DEFAULT as ELEMENT_DEFAULT$1, isBlockAboveEmpty, KEY_DESERIALIZE_HTML, hasSingleChild, createDeserializeHtmlPlugin, createDeserializeAstPlugin, getPlateActions, Plate } from '@udecode/plate-core';
|
|
5
|
+
import { usePlateEditorRef as usePlateEditorRef$1, usePlateEditorState as usePlateEditorState$1, getPlateSelectors as getPlateSelectors$1, withoutNormalizing as withoutNormalizing$1, createPlateEditor as createPlateEditor$1, blurEditor as blurEditor$1, toSlatePoint, mockPlugin as mockPlugin$1, focusEditor as focusEditor$1, selectEditor as selectEditor$1, getNodeEntries as getNodeEntries$1, isMarkActive as isMarkActive$1, getAboveNode as getAboveNode$1, getRange as getRange$1, isText as isText$1, isElement as isElement$1, getEditorString, getBlockAbove as getBlockAbove$1, getParentNode as getParentNode$1, getLastChildPath as getLastChildPath$1, someHtmlElement as someHtmlElement$1, isCollapsed, isInline as isInline$2, isEndPoint as isEndPoint$1, getPointAfter as getPointAfter$1, isFirstChild as isFirstChild$1, getNodeEntry as getNodeEntry$1, isEditor as isEditor$1, isEditorReadOnly as isEditorReadOnly$1, isRangeAcrossBlocks as isRangeAcrossBlocks$1, getPluginType as getPluginType$1, getCommonNode as getCommonNode$1, findNode as findNode$1, isBlock, match as match$1, isAncestorEmpty as isAncestorEmpty$1, isLastChild, getPointBefore as getPointBefore$1, queryNode as queryNode$1, isNode as isNode$1, getEndPoint as getEndPoint$1, getChildren as getChildren$1, findNodePath as findNodePath$1, getLastNodeByLevel as getLastNodeByLevel$1, createPathRef as createPathRef$1, getNodeTexts as getNodeTexts$1, isSelectionAtBlockStart as isSelectionAtBlockStart$1, getNodeChildren as getNodeChildren$1, isExpanded, isSelectionAtBlockEnd as isSelectionAtBlockEnd$1, someNode as someNode$1, getStartPoint as getStartPoint$1, getMarks as getMarks$1, wrapNodes as wrapNodes$1, insertNodes as insertNodes$1, unhangRange as unhangRange$1, setSelection as setSelection$1, unsetNodes as unsetNodes$1, removeMark as removeMark$1, addMark as addMark$1, removeNodes as removeNodes$1, unwrapNodes as unwrapNodes$1, liftNodes as liftNodes$1, select as select$1, toggleMark as toggleMark$1, normalizeEditor, setNodes as setNodes$1, toggleNodeType as toggleNodeType$1, deleteText as deleteText$1, deleteFragment as deleteFragment$1, splitNodes as splitNodes$1, moveSelection as moveSelection$1, insertText as insertText$1, collapseSelection as collapseSelection$1, moveChildren as moveChildren$1, moveNodes as moveNodes$1, ELEMENT_DEFAULT as ELEMENT_DEFAULT$1, isBlockAboveEmpty, KEY_DESERIALIZE_HTML, hasSingleChild, createDeserializeHtmlPlugin, createDeserializeAstPlugin, getPlateActions, Plate } from '@udecode/plate-core';
|
|
6
6
|
import { css, cx } from 'emotion';
|
|
7
7
|
import areEqual from 'fast-deep-equal';
|
|
8
8
|
import noop from 'lodash-es/noop';
|
|
9
|
+
import { useReadOnly as useReadOnly$1, useSelected, useFocused } from 'slate-react';
|
|
9
10
|
import { createDeserializeDocxPlugin } from '@udecode/plate-serializer-docx';
|
|
10
11
|
import { createSoftBreakPlugin as createSoftBreakPlugin$1, createExitBreakPlugin as createExitBreakPlugin$1 } from '@udecode/plate-break';
|
|
11
12
|
import { createResetNodePlugin as createResetNodePlugin$1, onKeyDownResetNode, SIMULATE_BACKSPACE } from '@udecode/plate-reset-node';
|
|
@@ -19,7 +20,6 @@ import find from 'lodash-es/find';
|
|
|
19
20
|
import flow from 'lodash-es/flow';
|
|
20
21
|
import get from 'lodash-es/get';
|
|
21
22
|
import tokens from '@contentful/f36-tokens';
|
|
22
|
-
import { useSelected, useReadOnly as useReadOnly$1, useFocused } from 'slate-react';
|
|
23
23
|
import { AssetIcon, EmbeddedEntryBlockIcon, ClockIcon, EmbeddedEntryInlineIcon, ChevronDownIcon, HorizontalRuleIcon, LinkIcon, ListBulletedIcon, ListNumberedIcon, FormatBoldIcon, CodeIcon, FormatItalicIcon, SubscriptIcon, SuperscriptIcon, FormatUnderlinedIcon, QuoteIcon, TableIcon, PlusIcon, MoreHorizontalIcon } from '@contentful/f36-icons';
|
|
24
24
|
import { getListTypes, ELEMENT_LIC, getListItemEntry, isListNested, moveListItemUp, ELEMENT_LI, unwrapList as unwrapList$1, removeFirstListItem, removeListItem, deleteForwardList, deleteFragmentList, normalizeList, createListPlugin as createListPlugin$1, ELEMENT_UL, ELEMENT_OL } from '@udecode/plate-list';
|
|
25
25
|
import castArray from 'lodash-es/castArray';
|
|
@@ -241,6 +241,10 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
241
241
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
var useReadOnly = useReadOnly$1;
|
|
245
|
+
var usePlateEditorRef = usePlateEditorRef$1;
|
|
246
|
+
var usePlateEditorState = usePlateEditorState$1;
|
|
247
|
+
|
|
244
248
|
function getContentfulEditorId(sdk) {
|
|
245
249
|
var entry = sdk.entry,
|
|
246
250
|
field = sdk.field;
|
|
@@ -4830,14 +4834,14 @@ var isList = function isList(node) {
|
|
|
4830
4834
|
var hasListAsDirectParent = function hasListAsDirectParent(editor, _ref) {
|
|
4831
4835
|
var path = _ref[1];
|
|
4832
4836
|
|
|
4833
|
-
var _ref2 = getParentNode
|
|
4837
|
+
var _ref2 = getParentNode(editor, path) || [],
|
|
4834
4838
|
parentNode = _ref2[0];
|
|
4835
4839
|
|
|
4836
4840
|
return isList(parentNode);
|
|
4837
4841
|
};
|
|
4838
4842
|
|
|
4839
4843
|
var getNearestListAncestor = function getNearestListAncestor(editor, path) {
|
|
4840
|
-
return getAboveNode
|
|
4844
|
+
return getAboveNode(editor, {
|
|
4841
4845
|
at: path,
|
|
4842
4846
|
mode: 'lowest',
|
|
4843
4847
|
match: isList
|
|
@@ -4921,7 +4925,7 @@ var isListTypeActive = function isListTypeActive(editor, type) {
|
|
|
4921
4925
|
} // Lists can be nested. Here, we take the list type at the lowest level
|
|
4922
4926
|
|
|
4923
4927
|
|
|
4924
|
-
var listNode = getBlockAbove
|
|
4928
|
+
var listNode = getBlockAbove(editor, {
|
|
4925
4929
|
match: {
|
|
4926
4930
|
type: [BLOCKS.OL_LIST, BLOCKS.UL_LIST]
|
|
4927
4931
|
},
|
|
@@ -5816,7 +5820,7 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5816
5820
|
|
|
5817
5821
|
if (!rule.match) {
|
|
5818
5822
|
rule.match = {
|
|
5819
|
-
type: getPluginType
|
|
5823
|
+
type: getPluginType(editor, p.key)
|
|
5820
5824
|
};
|
|
5821
5825
|
} // Conditional transformation e.g.
|
|
5822
5826
|
// {
|
|
@@ -6333,8 +6337,6 @@ var createSelectOnBackspacePlugin = function createSelectOnBackspacePlugin() {
|
|
|
6333
6337
|
});
|
|
6334
6338
|
};
|
|
6335
6339
|
|
|
6336
|
-
var useReadOnly = useReadOnly$1;
|
|
6337
|
-
|
|
6338
6340
|
var addRow = function addRow(editor, getNextRowPath) {
|
|
6339
6341
|
if (someNode(editor, {
|
|
6340
6342
|
match: {
|
|
@@ -7553,7 +7555,7 @@ function sanitizeIncomingSlateDoc(nodes) {
|
|
|
7553
7555
|
}
|
|
7554
7556
|
|
|
7555
7557
|
return _extends({}, node, {
|
|
7556
|
-
children: sanitizeIncomingSlateDoc(node.children)
|
|
7558
|
+
children: sanitizeIncomingSlateDoc(node == null ? void 0 : node.children)
|
|
7557
7559
|
});
|
|
7558
7560
|
});
|
|
7559
7561
|
}
|
|
@@ -7731,7 +7733,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
7731
7733
|
nodeType: BLOCKS.EMBEDDED_ENTRY,
|
|
7732
7734
|
onClose: onCloseEntityDropdown
|
|
7733
7735
|
}), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
|
|
7734
|
-
isDisabled: !!isDisabled ||
|
|
7736
|
+
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
7735
7737
|
onClose: onCloseEntityDropdown
|
|
7736
7738
|
}), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
|
|
7737
7739
|
isDisabled: !!isDisabled,
|
|
@@ -8016,9 +8018,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
8016
8018
|
return;
|
|
8017
8019
|
}
|
|
8018
8020
|
|
|
8019
|
-
getPlateActions(id).value(
|
|
8020
|
-
// @ts-expect-error
|
|
8021
|
-
normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8021
|
+
getPlateActions(id).value(normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8022
8022
|
plugins: plugins,
|
|
8023
8023
|
disableCorePlugins: disableCorePlugins
|
|
8024
8024
|
}));
|