@contentful/field-editor-rich-text 3.16.11 → 3.16.12

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.
Files changed (208) hide show
  1. package/dist/cjs/ContentfulEditorProvider.js +8 -8
  2. package/dist/cjs/RichTextEditor.js +6 -4
  3. package/dist/cjs/SdkProvider.js +4 -2
  4. package/dist/cjs/SyncEditorChanges.js +4 -2
  5. package/dist/cjs/Toolbar/_tests_/toolbar.test.js +6 -4
  6. package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +4 -2
  7. package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +4 -2
  8. package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +1 -1
  9. package/dist/cjs/Toolbar/index.js +5 -3
  10. package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
  11. package/dist/cjs/__fixtures__/asset/index.js +5 -5
  12. package/dist/cjs/__fixtures__/entry/index.js +3 -3
  13. package/dist/cjs/__fixtures__/fixtures.js +3 -1
  14. package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +17 -15
  15. package/dist/cjs/dialogs/openRichTextDialog.js +4 -2
  16. package/dist/cjs/dialogs/renderRichTextDialog.js +3 -1
  17. package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +1 -1
  18. package/dist/cjs/helpers/editor.js +42 -42
  19. package/dist/cjs/helpers/environment.js +3 -3
  20. package/dist/cjs/helpers/formatDateAndTime.js +3 -3
  21. package/dist/cjs/helpers/nodeFactory.js +6 -6
  22. package/dist/cjs/helpers/sdkNavigatorSlideIn.js +1 -1
  23. package/dist/cjs/helpers/transformers.js +5 -5
  24. package/dist/cjs/helpers/validations.js +5 -5
  25. package/dist/cjs/index.js +6 -4
  26. package/dist/cjs/internal/constants.js +3 -1
  27. package/dist/cjs/internal/hooks.js +7 -5
  28. package/dist/cjs/internal/misc.js +12 -10
  29. package/dist/cjs/internal/queries.js +107 -105
  30. package/dist/cjs/internal/transforms.js +49 -47
  31. package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +1 -1
  32. package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +1 -1
  33. package/dist/cjs/plugins/CommandPalette/components/CommandList.js +9 -7
  34. package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +3 -1
  35. package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -1
  36. package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +5 -3
  37. package/dist/cjs/plugins/CommandPalette/useCommands.js +2 -2
  38. package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -4
  39. package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
  40. package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +7 -5
  41. package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +6 -4
  42. package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
  43. package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +7 -5
  44. package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
  45. package/dist/cjs/plugins/Heading/components/Heading.js +3 -1
  46. package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +3 -1
  47. package/dist/cjs/plugins/Heading/createHeadingPlugin.js +1 -1
  48. package/dist/cjs/plugins/Hr/index.js +8 -6
  49. package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +7 -5
  50. package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +6 -4
  51. package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +4 -2
  52. package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +6 -4
  53. package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +3 -1
  54. package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +4 -2
  55. package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
  56. package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -2
  57. package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -3
  58. package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +5 -3
  59. package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
  60. package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +1 -1
  61. package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +1 -1
  62. package/dist/cjs/plugins/List/components/List.js +6 -4
  63. package/dist/cjs/plugins/List/components/ListItem.js +3 -1
  64. package/dist/cjs/plugins/List/components/ToolbarListButton.js +3 -1
  65. package/dist/cjs/plugins/List/insertListBreak.js +2 -2
  66. package/dist/cjs/plugins/List/insertListFragment.js +1 -1
  67. package/dist/cjs/plugins/List/onKeyDownList.js +1 -1
  68. package/dist/cjs/plugins/List/transforms/moveListItemDown.js +1 -1
  69. package/dist/cjs/plugins/List/transforms/moveListItems.js +1 -1
  70. package/dist/cjs/plugins/List/transforms/moveListItems.test.js +1 -1
  71. package/dist/cjs/plugins/List/transforms/toggleList.js +3 -3
  72. package/dist/cjs/plugins/List/transforms/toggleList.spec.js +9 -9
  73. package/dist/cjs/plugins/List/transforms/unwrapList.js +1 -1
  74. package/dist/cjs/plugins/List/utils.js +11 -11
  75. package/dist/cjs/plugins/List/withList.js +1 -1
  76. package/dist/cjs/plugins/Marks/Bold.js +6 -4
  77. package/dist/cjs/plugins/Marks/Code.js +6 -4
  78. package/dist/cjs/plugins/Marks/Italic.js +6 -4
  79. package/dist/cjs/plugins/Marks/Subscript.js +7 -5
  80. package/dist/cjs/plugins/Marks/Superscript.js +7 -5
  81. package/dist/cjs/plugins/Marks/Underline.js +3 -1
  82. package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +5 -3
  83. package/dist/cjs/plugins/Marks/helpers.js +4 -4
  84. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
  85. package/dist/cjs/plugins/Normalizer/utils.js +3 -3
  86. package/dist/cjs/plugins/Normalizer/withNormalizer.js +2 -2
  87. package/dist/cjs/plugins/Paragraph/Paragraph.js +3 -1
  88. package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +1 -1
  89. package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +5 -5
  90. package/dist/cjs/plugins/Quote/components/Quote.js +3 -1
  91. package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +3 -1
  92. package/dist/cjs/plugins/Quote/toggleQuote.js +4 -4
  93. package/dist/cjs/plugins/Quote/withQuote.js +2 -2
  94. package/dist/cjs/plugins/Table/__tests__/helpers.test.js +1 -1
  95. package/dist/cjs/plugins/Table/actions/addColumn.js +4 -4
  96. package/dist/cjs/plugins/Table/actions/addRow.js +3 -3
  97. package/dist/cjs/plugins/Table/components/Cell.js +3 -1
  98. package/dist/cjs/plugins/Table/components/HeaderCell.js +3 -1
  99. package/dist/cjs/plugins/Table/components/Row.js +3 -1
  100. package/dist/cjs/plugins/Table/components/Table.js +3 -1
  101. package/dist/cjs/plugins/Table/components/TableActions.js +6 -4
  102. package/dist/cjs/plugins/Table/components/ToolbarButton.js +3 -1
  103. package/dist/cjs/plugins/Table/createTablePlugin.js +1 -1
  104. package/dist/cjs/plugins/Table/helpers.js +12 -12
  105. package/dist/cjs/plugins/Table/insertTableFragment.js +1 -1
  106. package/dist/cjs/plugins/Table/onKeyDownTable.js +2 -2
  107. package/dist/cjs/plugins/Table/tableTracking.js +6 -6
  108. package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
  109. package/dist/cjs/plugins/Text/createTextPlugin.js +3 -3
  110. package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -4
  111. package/dist/cjs/plugins/Tracking/utils.js +3 -1
  112. package/dist/cjs/plugins/index.js +3 -3
  113. package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +7 -5
  114. package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +5 -5
  115. package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -2
  116. package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +4 -4
  117. package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +6 -4
  118. package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +7 -5
  119. package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +6 -4
  120. package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +1 -1
  121. package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +4 -2
  122. package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -1
  123. package/dist/cjs/plugins/shared/ToolbarButton.js +4 -2
  124. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +4 -2
  125. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +4 -2
  126. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +9 -7
  127. package/dist/cjs/test-utils/validation.js +3 -3
  128. package/dist/esm/ContentfulEditorProvider.js +1 -1
  129. package/dist/esm/RichTextEditor.js +3 -3
  130. package/dist/esm/SdkProvider.js +1 -1
  131. package/dist/esm/SyncEditorChanges.js +1 -1
  132. package/dist/esm/Toolbar/_tests_/toolbar.test.js +3 -3
  133. package/dist/esm/Toolbar/components/EmbedEntityWidget.js +1 -1
  134. package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +1 -1
  135. package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
  136. package/dist/esm/Toolbar/index.js +2 -2
  137. package/dist/esm/__fixtures__/FakeSdk.js +3 -3
  138. package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +11 -11
  139. package/dist/esm/dialogs/openRichTextDialog.js +1 -1
  140. package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +1 -1
  141. package/dist/esm/helpers/editor.js +3 -3
  142. package/dist/esm/helpers/sdkNavigatorSlideIn.js +1 -1
  143. package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +1 -1
  144. package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +1 -1
  145. package/dist/esm/plugins/CommandPalette/components/CommandList.js +6 -6
  146. package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
  147. package/dist/esm/plugins/CommandPalette/useCommands.js +2 -2
  148. package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +3 -3
  149. package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +4 -4
  150. package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +3 -3
  151. package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
  152. package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +4 -4
  153. package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
  154. package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -1
  155. package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +4 -4
  156. package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +3 -3
  157. package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +1 -1
  158. package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +3 -3
  159. package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +1 -1
  160. package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -1
  161. package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -3
  162. package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
  163. package/dist/esm/plugins/Hyperlink/utils.js +1 -1
  164. package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +1 -1
  165. package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +1 -1
  166. package/dist/esm/plugins/List/insertListBreak.js +2 -2
  167. package/dist/esm/plugins/List/insertListFragment.js +1 -1
  168. package/dist/esm/plugins/List/onKeyDownList.js +1 -1
  169. package/dist/esm/plugins/List/transforms/moveListItemDown.js +1 -1
  170. package/dist/esm/plugins/List/transforms/moveListItems.js +1 -1
  171. package/dist/esm/plugins/List/transforms/moveListItems.test.js +1 -1
  172. package/dist/esm/plugins/List/transforms/toggleList.js +3 -3
  173. package/dist/esm/plugins/List/transforms/toggleList.spec.js +9 -9
  174. package/dist/esm/plugins/List/transforms/unwrapList.js +1 -1
  175. package/dist/esm/plugins/List/utils.js +1 -1
  176. package/dist/esm/plugins/List/withList.js +1 -1
  177. package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +2 -2
  178. package/dist/esm/plugins/Marks/helpers.js +1 -1
  179. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
  180. package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -2
  181. package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +1 -1
  182. package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +1 -1
  183. package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
  184. package/dist/esm/plugins/Quote/withQuote.js +2 -2
  185. package/dist/esm/plugins/Table/__tests__/helpers.test.js +1 -1
  186. package/dist/esm/plugins/Table/actions/addColumn.js +1 -1
  187. package/dist/esm/plugins/Table/createTablePlugin.js +1 -1
  188. package/dist/esm/plugins/Table/insertTableFragment.js +1 -1
  189. package/dist/esm/plugins/Table/onKeyDownTable.js +2 -2
  190. package/dist/esm/plugins/Table/tableTracking.js +6 -6
  191. package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
  192. package/dist/esm/plugins/Text/createTextPlugin.js +3 -3
  193. package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -1
  194. package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +1 -1
  195. package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -5
  196. package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +1 -1
  197. package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -4
  198. package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +3 -3
  199. package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +4 -4
  200. package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +3 -3
  201. package/dist/esm/plugins/shared/LinkedBlockWrapper.js +1 -1
  202. package/dist/esm/plugins/shared/LinkedInlineWrapper.js +1 -1
  203. package/dist/esm/plugins/shared/ToolbarButton.js +1 -1
  204. package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +1 -1
  205. package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +1 -1
  206. package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +6 -6
  207. package/dist/esm/test-utils/validation.js +3 -3
  208. package/package.json +3 -3
@@ -2,22 +2,22 @@ import { BLOCKS } from '@contentful/rich-text-types';
2
2
  import { isElement } from '../../internal/queries';
3
3
  import { getPastingSource } from '../../plugins/Tracking';
4
4
  function hasTables(nodes) {
5
- return nodes.some(({ type })=>{
5
+ return nodes.some(({ type })=>{
6
6
  return type === BLOCKS.TABLE;
7
7
  });
8
8
  }
9
- const isTableHeaderCell = ({ type })=>type === BLOCKS.TABLE_HEADER_CELL;
9
+ const isTableHeaderCell = ({ type })=>type === BLOCKS.TABLE_HEADER_CELL;
10
10
  function hasHeadersOutsideFirstRow(nodes) {
11
- return nodes.filter(({ type })=>type === BLOCKS.TABLE).flatMap(({ children })=>children.slice(1)).some(({ children })=>children.some(isTableHeaderCell));
11
+ return nodes.filter(({ type })=>type === BLOCKS.TABLE).flatMap(({ children })=>children.slice(1)).some(({ children })=>children.some(isTableHeaderCell));
12
12
  }
13
13
  export function addTableTrackingEvents(editor) {
14
- const { insertData } = editor;
14
+ const { insertData } = editor;
15
15
  editor.insertData = (data)=>{
16
16
  const html = data.getData('text/html');
17
17
  if (html) {
18
- const { children: markupBefore } = editor;
18
+ const { children: markupBefore } = editor;
19
19
  insertData(data);
20
- const { children: markupAfter } = editor;
20
+ const { children: markupAfter } = editor;
21
21
  setTimeout(()=>{
22
22
  if (hasTables(markupBefore)) return;
23
23
  if (hasTables(markupAfter)) {
@@ -15,7 +15,7 @@ describe('delete backward', ()=>{
15
15
  const render = (children)=>jsx("editor", null, children, jsx("hp", null, jsx("htext", null)));
16
16
  for (const t of tests){
17
17
  test(t.title, ()=>{
18
- const { editor } = createTestEditor({
18
+ const { editor } = createTestEditor({
19
19
  input: render(t.input)
20
20
  });
21
21
  editor.deleteBackward('character');
@@ -52,7 +52,7 @@ describe('delete forward', ()=>{
52
52
  const render = (children)=>jsx("editor", null, children, jsx("hp", null, jsx("htext", null)));
53
53
  for (const t of tests){
54
54
  test(t.title, ()=>{
55
- const { editor } = createTestEditor({
55
+ const { editor } = createTestEditor({
56
56
  input: render(t.input)
57
57
  });
58
58
  editor.deleteForward('character');
@@ -13,9 +13,9 @@ export function createTextPlugin(restrictedMarks = []) {
13
13
  }
14
14
  },
15
15
  withOverrides: (editor)=>{
16
- const { insertText } = editor;
16
+ const { insertText } = editor;
17
17
  editor.insertText = (text)=>{
18
- const { selection } = editor;
18
+ const { selection } = editor;
19
19
  if (selection && isRangeCollapsed(selection)) {
20
20
  const inlinePath = getAboveNode(editor, {
21
21
  match: (n)=>isInline(editor, n),
@@ -31,7 +31,7 @@ export function createTextPlugin(restrictedMarks = []) {
31
31
  }
32
32
  return insertText(text);
33
33
  };
34
- const { deleteForward , deleteBackward } = editor;
34
+ const { deleteForward, deleteBackward } = editor;
35
35
  editor.deleteBackward = (unit)=>{
36
36
  deleteEmptyParagraph(unit, editor, deleteBackward);
37
37
  };
@@ -58,7 +58,7 @@ export const createTrackingPlugin = (onAction)=>{
58
58
  return {
59
59
  key: 'TrackingPlugin',
60
60
  withOverrides: (editor)=>{
61
- const { insertData } = editor;
61
+ const { insertData } = editor;
62
62
  editor.tracking = trackingActions;
63
63
  editor.insertData = (data)=>{
64
64
  const isCopyAndPaste = data.types.length !== 0;
@@ -12,7 +12,7 @@ export const styles = {
12
12
  marginRight: '10px'
13
13
  })
14
14
  };
15
- export function EmbeddedBlockToolbarIcon({ isDisabled , nodeType , onClose }) {
15
+ export function EmbeddedBlockToolbarIcon({ isDisabled, nodeType, onClose }) {
16
16
  const editor = useContentfulEditor();
17
17
  const sdk = useSdkContext();
18
18
  const handleClick = async (event)=>{
@@ -5,7 +5,7 @@ import { focus, getNodeEntryFromSelection, insertEmptyParagraph, moveToTheNextCh
5
5
  import { watchCurrentSlide } from '../../helpers/sdkNavigatorSlideIn';
6
6
  import { getText, getAboveNode, getLastNodeByLevel, insertNodes, setNodes, select, removeNodes } from '../../internal';
7
7
  export function getWithEmbeddedBlockEvents(nodeType, sdk) {
8
- return (editor, { options: { hotkey } })=>(event)=>{
8
+ return (editor, { options: { hotkey } })=>(event)=>{
9
9
  const [, pathToSelectedElement] = getNodeEntryFromSelection(editor, nodeType);
10
10
  if (pathToSelectedElement) {
11
11
  const isDelete = event.key === 'Delete';
@@ -31,14 +31,14 @@ export async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
31
31
  logAction('openCreateEmbedDialog', {
32
32
  nodeType
33
33
  });
34
- const { field , dialogs } = sdk;
34
+ const { field, dialogs } = sdk;
35
35
  const baseConfig = newEntitySelectorConfigFromRichTextField(field, nodeType);
36
36
  const selectEntity = baseConfig.entityType === 'Asset' ? dialogs.selectSingleAsset : dialogs.selectSingleEntry;
37
37
  const config = {
38
38
  ...baseConfig,
39
39
  withCreate: true
40
40
  };
41
- const { selection } = editor;
41
+ const { selection } = editor;
42
42
  const rteSlide = watchCurrentSlide(sdk.navigator);
43
43
  const entity = await selectEntity(config);
44
44
  if (!entity) {
@@ -65,9 +65,9 @@ export async function selectResourceEntityAndInsert(sdk, editor, logAction) {
65
65
  logAction('openCreateEmbedDialog', {
66
66
  nodeType: BLOCKS.EMBEDDED_RESOURCE
67
67
  });
68
- const { field , dialogs } = sdk;
68
+ const { field, dialogs } = sdk;
69
69
  const config = newResourceEntitySelectorConfigFromRichTextField(field, BLOCKS.EMBEDDED_RESOURCE);
70
- const { selection } = editor;
70
+ const { selection } = editor;
71
71
  const entity = await dialogs.selectSingleResourceEntry(config);
72
72
  if (!entity) {
73
73
  logAction('cancelCreateEmbedDialog', {
@@ -22,7 +22,7 @@ const styles = {
22
22
  }
23
23
  })
24
24
  };
25
- export function EmbeddedInlineToolbarIcon({ onClose , nodeType , isDisabled }) {
25
+ export function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled }) {
26
26
  const editor = useContentfulEditor();
27
27
  const sdk = useSdkContext();
28
28
  async function handleClick(event) {
@@ -5,7 +5,7 @@ import { focus } from '../../helpers/editor';
5
5
  import { watchCurrentSlide } from '../../helpers/sdkNavigatorSlideIn';
6
6
  import { insertNodes, select } from '../../internal/transforms';
7
7
  export function getWithEmbeddedEntryInlineEvents(nodeType, sdk) {
8
- return function withEmbeddedEntryInlineEvents(editor, { options: { hotkey } }) {
8
+ return function withEmbeddedEntryInlineEvents(editor, { options: { hotkey } }) {
9
9
  return function handleEvent(event) {
10
10
  if (!editor) return;
11
11
  if (hotkey && isHotkey(hotkey, event)) {
@@ -56,7 +56,7 @@ export async function selectEntityAndInsert(editor, sdk, logAction) {
56
56
  ...newEntitySelectorConfigFromRichTextField(sdk.field, nodeType),
57
57
  withCreate: true
58
58
  };
59
- const { selection } = editor;
59
+ const { selection } = editor;
60
60
  const rteSlide = watchCurrentSlide(sdk.navigator);
61
61
  const entry = await sdk.dialogs.selectSingleEntry(config);
62
62
  if (!entry) {
@@ -80,12 +80,12 @@ export async function selectResourceEntityAndInsert(editor, sdk, logAction) {
80
80
  logAction('openCreateEmbedDialog', {
81
81
  nodeType
82
82
  });
83
- const { dialogs , field } = sdk;
83
+ const { dialogs, field } = sdk;
84
84
  const config = {
85
85
  ...newResourceEntitySelectorConfigFromRichTextField(field, nodeType),
86
86
  withCreate: true
87
87
  };
88
- const { selection } = editor;
88
+ const { selection } = editor;
89
89
  const entry = await dialogs.selectSingleResourceEntry(config);
90
90
  if (!entry) {
91
91
  logAction('cancelCreateEmbedDialog', {
@@ -31,9 +31,9 @@ const InternalAssetCard = React.memo((props)=>{
31
31
  }, areEqual);
32
32
  InternalAssetCard.displayName = 'InternalAssetCard';
33
33
  export function FetchingWrappedAssetCard(props) {
34
- const { onEntityFetchComplete } = props;
35
- const { data: asset , status } = useEntity('Asset', props.assetId);
36
- const { getEntityScheduledActions } = useEntityLoader();
34
+ const { onEntityFetchComplete } = props;
35
+ const { data: asset, status } = useEntity('Asset', props.assetId);
36
+ const { getEntityScheduledActions } = useEntityLoader();
37
37
  const loadEntityScheduledActions = React.useCallback(()=>getEntityScheduledActions('Asset', props.assetId), [
38
38
  getEntityScheduledActions,
39
39
  props.assetId
@@ -3,7 +3,7 @@ import { EntryCard } from '@contentful/f36-components';
3
3
  import { useEntity, MissingEntityCard, WrappedEntryCard, useEntityLoader } from '@contentful/field-editor-reference';
4
4
  import areEqual from 'fast-deep-equal';
5
5
  const InternalEntryCard = React.memo((props)=>{
6
- const { entry , sdk , loadEntityScheduledActions } = props;
6
+ const { entry, sdk, loadEntityScheduledActions } = props;
7
7
  if (entry === undefined) {
8
8
  return React.createElement(EntryCard, {
9
9
  isLoading: true
@@ -34,9 +34,9 @@ const InternalEntryCard = React.memo((props)=>{
34
34
  }, areEqual);
35
35
  InternalEntryCard.displayName = 'ReferenceCard';
36
36
  export const FetchingWrappedEntryCard = (props)=>{
37
- const { entryId , onEntityFetchComplete } = props;
38
- const { data: entry , status } = useEntity('Entry', entryId);
39
- const { getEntityScheduledActions } = useEntityLoader();
37
+ const { entryId, onEntityFetchComplete } = props;
38
+ const { data: entry, status } = useEntity('Entry', entryId);
39
+ const { getEntityScheduledActions } = useEntityLoader();
40
40
  const loadEntityScheduledActions = React.useCallback(()=>getEntityScheduledActions('Entry', entryId), [
41
41
  getEntityScheduledActions,
42
42
  entryId
@@ -8,7 +8,7 @@ const InternalEntryCard = React.memo((props)=>{
8
8
  isLoading: true
9
9
  });
10
10
  }
11
- const { contentType , resource: entry , space } = props.data;
11
+ const { contentType, resource: entry, space } = props.data;
12
12
  return React.createElement(WrappedEntryCard, {
13
13
  size: "default",
14
14
  getAsset: ()=>Promise.resolve(),
@@ -27,8 +27,8 @@ const InternalEntryCard = React.memo((props)=>{
27
27
  }, areEqual);
28
28
  InternalEntryCard.displayName = 'ReferenceCard';
29
29
  export const FetchingWrappedResourceCard = (props)=>{
30
- const { link , onEntityFetchComplete } = props;
31
- const { data , status , error } = useResource(link.linkType, link.urn);
30
+ const { link, onEntityFetchComplete } = props;
31
+ const { data, status, error } = useResource(link.linkType, link.urn);
32
32
  React.useEffect(()=>{
33
33
  if (status === 'success') {
34
34
  onEntityFetchComplete?.();
@@ -13,7 +13,7 @@ const styles = {
13
13
  width: '100%'
14
14
  })
15
15
  };
16
- export function LinkedBlockWrapper({ attributes , card , children , link }) {
16
+ export function LinkedBlockWrapper({ attributes, card, children, link }) {
17
17
  return React.createElement("div", {
18
18
  ...attributes,
19
19
  className: styles.root,
@@ -16,7 +16,7 @@ const styles = {
16
16
  }
17
17
  })
18
18
  };
19
- export function LinkedInlineWrapper({ attributes , card , children , link }) {
19
+ export function LinkedInlineWrapper({ attributes, card, children, link }) {
20
20
  return React.createElement("span", {
21
21
  ...attributes,
22
22
  className: styles.root,
@@ -14,7 +14,7 @@ const styles = {
14
14
  })
15
15
  };
16
16
  export function ToolbarButton(props) {
17
- const { title , testId , isActive , children , className , isDisabled =false } = props;
17
+ const { title, testId, isActive, children, className, isDisabled = false } = props;
18
18
  const handleClick = (event)=>{
19
19
  event.preventDefault();
20
20
  props.onClick();
@@ -38,7 +38,7 @@ beforeEach(()=>{
38
38
  };
39
39
  });
40
40
  test('some dropdown actions should be disabled', async ()=>{
41
- const { getByTestId , queryByTestId } = render(React.createElement(EntityProvider, {
41
+ const { getByTestId, queryByTestId } = render(React.createElement(EntityProvider, {
42
42
  sdk: sdk
43
43
  }, React.createElement(FetchingWrappedAssetCard, {
44
44
  sdk: sdk,
@@ -42,7 +42,7 @@ beforeEach(()=>{
42
42
  };
43
43
  });
44
44
  test('some dropdown actions should be disabled/removed', async ()=>{
45
- const { getByTestId , queryByTestId } = render(React.createElement(EntityProvider, {
45
+ const { getByTestId, queryByTestId } = render(React.createElement(EntityProvider, {
46
46
  sdk: sdk
47
47
  }, React.createElement(FetchingWrappedEntryCard, {
48
48
  sdk: sdk,
@@ -23,7 +23,7 @@ beforeEach(()=>{
23
23
  get: jest.fn().mockReturnValue(publishedCT)
24
24
  },
25
25
  Entry: {
26
- get: jest.fn().mockImplementation(({ entryId })=>{
26
+ get: jest.fn().mockImplementation(({ entryId })=>{
27
27
  if (entryId === 'linked-entry-urn') {
28
28
  return Promise.resolve(publishedEntry);
29
29
  }
@@ -60,7 +60,7 @@ beforeEach(()=>{
60
60
  }
61
61
  };
62
62
  });
63
- function renderResourceCard({ linkType ='Contentful:Entry' , entryUrn =resolvableEntryUrn } = {}) {
63
+ function renderResourceCard({ linkType = 'Contentful:Entry', entryUrn = resolvableEntryUrn } = {}) {
64
64
  return render(React.createElement(EntityProvider, {
65
65
  sdk: sdk
66
66
  }, React.createElement(FetchingWrappedResourceCard, {
@@ -75,23 +75,23 @@ function renderResourceCard({ linkType ='Contentful:Entry' , entryUrn =resolvabl
75
75
  })));
76
76
  }
77
77
  test('renders entry card', async ()=>{
78
- const { getByTestId , getByText } = renderResourceCard();
78
+ const { getByTestId, getByText } = renderResourceCard();
79
79
  await waitFor(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
80
80
  expect(getByText(publishedEntry.fields.exField.en)).toBeDefined();
81
81
  expect(getByText(space.name)).toBeDefined();
82
82
  });
83
83
  test('renders skeleton when no data is provided', ()=>{
84
- const { getByTestId } = renderResourceCard();
84
+ const { getByTestId } = renderResourceCard();
85
85
  expect(getByTestId('cf-ui-skeleton-form')).toBeDefined();
86
86
  });
87
87
  test('renders unsupported entity card when unsupported link is passed', async ()=>{
88
- const { getByText } = renderResourceCard({
88
+ const { getByText } = renderResourceCard({
89
89
  linkType: 'Contentful:UnsupportedLink'
90
90
  });
91
91
  await waitFor(()=>expect(getByText('Resource type Contentful:UnsupportedLink is currently not supported')).toBeDefined());
92
92
  });
93
93
  test('renders missing entity card when unknown error is returned', async ()=>{
94
- const { getByTestId } = renderResourceCard({
94
+ const { getByTestId } = renderResourceCard({
95
95
  entryUrn: unknownEntryUrn
96
96
  });
97
97
  await waitFor(()=>expect(getByTestId('cf-ui-missing-entry-card')).toBeDefined());
@@ -60,7 +60,7 @@ function buildSchemaErrors(validateSchema, _, errors) {
60
60
  errors.push(...schemaErrors);
61
61
  }
62
62
  function resetChildNodes(node) {
63
- const { content } = node;
63
+ const { content } = node;
64
64
  if (isLeafNode(node)) {
65
65
  return node;
66
66
  }
@@ -69,7 +69,7 @@ function resetChildNodes(node) {
69
69
  });
70
70
  }
71
71
  function resetNode(node) {
72
- const { nodeType } = node;
72
+ const { nodeType } = node;
73
73
  if (helpers.isText(node)) {
74
74
  return {
75
75
  nodeType,
@@ -85,7 +85,7 @@ function resetNode(node) {
85
85
  };
86
86
  }
87
87
  function removeGrandChildNodes(node) {
88
- const { content } = node;
88
+ const { content } = node;
89
89
  if (isLeafNode(node)) {
90
90
  return node;
91
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "3.16.11",
3
+ "version": "3.16.12",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,7 +44,7 @@
44
44
  "@contentful/f36-icons": "^4.1.1",
45
45
  "@contentful/f36-tokens": "^4.0.0",
46
46
  "@contentful/f36-utils": "^4.19.0",
47
- "@contentful/field-editor-reference": "^5.21.4",
47
+ "@contentful/field-editor-reference": "^5.21.5",
48
48
  "@contentful/field-editor-shared": "^1.4.4",
49
49
  "@contentful/rich-text-plain-text-renderer": "^16.0.4",
50
50
  "@contentful/rich-text-types": "16.3.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "registry": "https://npm.pkg.github.com/"
88
88
  },
89
- "gitHead": "b1f62d6b934520b6d4dc328921dd500381d1e22c"
89
+ "gitHead": "89b14d123bc36f18214825404a33a6c2f7bc26b3"
90
90
  }