@contentful/field-editor-rich-text 3.4.2 → 3.4.4
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 +10 -0
- package/dist/field-editor-rich-text.cjs.development.js +19 -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 +15 -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 +2 -2
|
@@ -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,
|
|
5
|
+
import { usePlateEditorRef as usePlateEditorRef$1, usePlateEditorState as usePlateEditorState$1, getPlateSelectors as getPlateSelectors$1, focusEditor as focusEditor$1, withoutNormalizing as withoutNormalizing$1, createPlateEditor as createPlateEditor$1, blurEditor as blurEditor$1, toSlatePoint, mockPlugin as mockPlugin$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;
|
|
@@ -2345,8 +2349,10 @@ var createOnKeyDown = function createOnKeyDown() {
|
|
|
2345
2349
|
}
|
|
2346
2350
|
|
|
2347
2351
|
if (isHotkey('escape', event)) {
|
|
2352
|
+
event.stopPropagation();
|
|
2348
2353
|
removeMark(editor, COMMAND_PROMPT, range);
|
|
2349
2354
|
editor.tracking.onCommandPaletteAction('cancelRichTextCommandPalette');
|
|
2355
|
+
focusEditor(editor);
|
|
2350
2356
|
}
|
|
2351
2357
|
};
|
|
2352
2358
|
};
|
|
@@ -4830,14 +4836,14 @@ var isList = function isList(node) {
|
|
|
4830
4836
|
var hasListAsDirectParent = function hasListAsDirectParent(editor, _ref) {
|
|
4831
4837
|
var path = _ref[1];
|
|
4832
4838
|
|
|
4833
|
-
var _ref2 = getParentNode
|
|
4839
|
+
var _ref2 = getParentNode(editor, path) || [],
|
|
4834
4840
|
parentNode = _ref2[0];
|
|
4835
4841
|
|
|
4836
4842
|
return isList(parentNode);
|
|
4837
4843
|
};
|
|
4838
4844
|
|
|
4839
4845
|
var getNearestListAncestor = function getNearestListAncestor(editor, path) {
|
|
4840
|
-
return getAboveNode
|
|
4846
|
+
return getAboveNode(editor, {
|
|
4841
4847
|
at: path,
|
|
4842
4848
|
mode: 'lowest',
|
|
4843
4849
|
match: isList
|
|
@@ -4921,7 +4927,7 @@ var isListTypeActive = function isListTypeActive(editor, type) {
|
|
|
4921
4927
|
} // Lists can be nested. Here, we take the list type at the lowest level
|
|
4922
4928
|
|
|
4923
4929
|
|
|
4924
|
-
var listNode = getBlockAbove
|
|
4930
|
+
var listNode = getBlockAbove(editor, {
|
|
4925
4931
|
match: {
|
|
4926
4932
|
type: [BLOCKS.OL_LIST, BLOCKS.UL_LIST]
|
|
4927
4933
|
},
|
|
@@ -5816,7 +5822,7 @@ var withNormalizer = function withNormalizer(editor) {
|
|
|
5816
5822
|
|
|
5817
5823
|
if (!rule.match) {
|
|
5818
5824
|
rule.match = {
|
|
5819
|
-
type: getPluginType
|
|
5825
|
+
type: getPluginType(editor, p.key)
|
|
5820
5826
|
};
|
|
5821
5827
|
} // Conditional transformation e.g.
|
|
5822
5828
|
// {
|
|
@@ -6333,8 +6339,6 @@ var createSelectOnBackspacePlugin = function createSelectOnBackspacePlugin() {
|
|
|
6333
6339
|
});
|
|
6334
6340
|
};
|
|
6335
6341
|
|
|
6336
|
-
var useReadOnly = useReadOnly$1;
|
|
6337
|
-
|
|
6338
6342
|
var addRow = function addRow(editor, getNextRowPath) {
|
|
6339
6343
|
if (someNode(editor, {
|
|
6340
6344
|
match: {
|
|
@@ -7553,7 +7557,7 @@ function sanitizeIncomingSlateDoc(nodes) {
|
|
|
7553
7557
|
}
|
|
7554
7558
|
|
|
7555
7559
|
return _extends({}, node, {
|
|
7556
|
-
children: sanitizeIncomingSlateDoc(node.children)
|
|
7560
|
+
children: sanitizeIncomingSlateDoc(node == null ? void 0 : node.children)
|
|
7557
7561
|
});
|
|
7558
7562
|
});
|
|
7559
7563
|
}
|
|
@@ -7731,7 +7735,7 @@ var EmbedEntityWidget = function EmbedEntityWidget(_ref) {
|
|
|
7731
7735
|
nodeType: BLOCKS.EMBEDDED_ENTRY,
|
|
7732
7736
|
onClose: onCloseEntityDropdown
|
|
7733
7737
|
}), inlineEntryEmbedEnabled && /*#__PURE__*/React__default.createElement(ToolbarEmbeddedEntityInlineButton, {
|
|
7734
|
-
isDisabled: !!isDisabled ||
|
|
7738
|
+
isDisabled: !!isDisabled || isLinkActive(editor),
|
|
7735
7739
|
onClose: onCloseEntityDropdown
|
|
7736
7740
|
}), blockAssetEmbedEnabled && /*#__PURE__*/React__default.createElement(EmbeddedEntityBlockToolbarIcon, {
|
|
7737
7741
|
isDisabled: !!isDisabled,
|
|
@@ -8016,9 +8020,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
|
|
|
8016
8020
|
return;
|
|
8017
8021
|
}
|
|
8018
8022
|
|
|
8019
|
-
getPlateActions(id).value(
|
|
8020
|
-
// @ts-expect-error
|
|
8021
|
-
normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8023
|
+
getPlateActions(id).value(normalizeEditorValue(documentToEditorValue(props.value), {
|
|
8022
8024
|
plugins: plugins,
|
|
8023
8025
|
disableCorePlugins: disableCorePlugins
|
|
8024
8026
|
}));
|