@contentful/field-editor-rich-text 3.4.19 → 3.4.21
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 +12 -0
- 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 -1
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ 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 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, getLastNodeByLevel as getLastNodeByLevel$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, 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,
|
|
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, getLastNodeByLevel as getLastNodeByLevel$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, 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, select as select$1, liftNodes as liftNodes$1, toggleMark as toggleMark$1, normalizeEditor, setNodes as setNodes$1, toggleNodeType as toggleNodeType$1, deleteText as deleteText$1, moveSelection as moveSelection$1, deleteFragment as deleteFragment$1, splitNodes as splitNodes$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';
|
|
@@ -1765,6 +1765,9 @@ async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
|
|
|
1765
1765
|
const config = { ...baseConfig,
|
|
1766
1766
|
withCreate: true
|
|
1767
1767
|
};
|
|
1768
|
+
const {
|
|
1769
|
+
selection
|
|
1770
|
+
} = editor;
|
|
1768
1771
|
const rteSlide = watchCurrentSlide(sdk.navigator);
|
|
1769
1772
|
const entity = await selectEntity(config);
|
|
1770
1773
|
|
|
@@ -1773,6 +1776,9 @@ async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
|
|
|
1773
1776
|
nodeType
|
|
1774
1777
|
});
|
|
1775
1778
|
} else {
|
|
1779
|
+
// Selection prevents incorrect position of inserted ref when RTE doesn't have focus
|
|
1780
|
+
// (i.e. when using hotkeys and slide-in)
|
|
1781
|
+
select(editor, selection);
|
|
1776
1782
|
insertBlock$1(editor, nodeType, entity);
|
|
1777
1783
|
ensureFollowingParagraph(editor);
|
|
1778
1784
|
logAction('insert', {
|
|
@@ -2156,6 +2162,9 @@ async function selectEntityAndInsert$1(editor, sdk, logAction) {
|
|
|
2156
2162
|
const config = { ...newEntitySelectorConfigFromRichTextField(sdk.field, INLINES.EMBEDDED_ENTRY),
|
|
2157
2163
|
withCreate: true
|
|
2158
2164
|
};
|
|
2165
|
+
const {
|
|
2166
|
+
selection
|
|
2167
|
+
} = editor;
|
|
2159
2168
|
const rteSlide = watchCurrentSlide(sdk.navigator);
|
|
2160
2169
|
const entry = await sdk.dialogs.selectSingleEntry(config);
|
|
2161
2170
|
|
|
@@ -2164,6 +2173,9 @@ async function selectEntityAndInsert$1(editor, sdk, logAction) {
|
|
|
2164
2173
|
nodeType: INLINES.EMBEDDED_ENTRY
|
|
2165
2174
|
});
|
|
2166
2175
|
} else {
|
|
2176
|
+
// Selection prevents incorrect position of inserted ref when RTE doesn't have focus
|
|
2177
|
+
// (i.e. when using hotkeys and slide-in)
|
|
2178
|
+
select(editor, selection);
|
|
2167
2179
|
insertNodes(editor, createInlineEntryNode$1(entry.sys.id));
|
|
2168
2180
|
logAction('insert', {
|
|
2169
2181
|
nodeType: INLINES.EMBEDDED_ENTRY
|