@contentful/field-editor-rich-text 3.16.10 → 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 +5 -5
@@ -7,8 +7,8 @@ import { useLinkTracking } from '../links-tracking';
7
7
  import { FetchingWrappedResourceCard } from '../shared/FetchingWrappedResourceCard';
8
8
  import { LinkedBlockWrapper } from '../shared/LinkedBlockWrapper';
9
9
  export function LinkedResourceBlock(props) {
10
- const { attributes , children , element } = props;
11
- const { onEntityFetchComplete } = useLinkTracking();
10
+ const { attributes, children, element } = props;
11
+ const { onEntityFetchComplete } = useLinkTracking();
12
12
  const isSelected = useSelected();
13
13
  const editor = useContentfulEditor();
14
14
  const sdk = useSdkContext();
@@ -4,10 +4,10 @@ import { useResource } from '@contentful/field-editor-reference';
4
4
  import { entityHelpers } from '@contentful/field-editor-shared';
5
5
  import { INLINES } from '@contentful/rich-text-types';
6
6
  import { truncateTitle } from '../../plugins/shared/utils';
7
- const { getEntryTitle , getEntryStatus } = entityHelpers;
7
+ const { getEntryTitle, getEntryStatus } = entityHelpers;
8
8
  export function FetchingWrappedResourceInlineCard(props) {
9
- const { link , onEntityFetchComplete } = props;
10
- const { data , status: requestStatus } = useResource(link.linkType, link.urn);
9
+ const { link, onEntityFetchComplete } = props;
10
+ const { data, status: requestStatus } = useResource(link.linkType, link.urn);
11
11
  React.useEffect(()=>{
12
12
  if (requestStatus === 'success') {
13
13
  onEntityFetchComplete?.();
@@ -28,7 +28,7 @@ export function FetchingWrappedResourceInlineCard(props) {
28
28
  isLoading: true
29
29
  });
30
30
  }
31
- const { resource: entry , contentType , defaultLocaleCode , space } = data;
31
+ const { resource: entry, contentType, defaultLocaleCode, space } = data;
32
32
  const title = getEntryTitle({
33
33
  entry,
34
34
  contentType,
@@ -7,8 +7,8 @@ import { useLinkTracking } from '../links-tracking';
7
7
  import { LinkedInlineWrapper } from '../shared/LinkedInlineWrapper';
8
8
  import { FetchingWrappedResourceInlineCard } from './FetchingWrappedResourceInlineCard';
9
9
  export function LinkedResourceInline(props) {
10
- const { attributes , children , element } = props;
11
- const { onEntityFetchComplete } = useLinkTracking();
10
+ const { attributes, children, element } = props;
11
+ const { onEntityFetchComplete } = useLinkTracking();
12
12
  const isSelected = useSelected();
13
13
  const editor = useContentfulEditor();
14
14
  const sdk = useSdkContext();
@@ -5,7 +5,7 @@ import { transformLift, transformUnwrap } from '../../helpers/transformers';
5
5
  import { isMarkActive, getAboveNode } from '../../internal/queries';
6
6
  import { COMMAND_PROMPT } from '../CommandPalette/constants';
7
7
  import { HeadingComponents } from './components/Heading';
8
- const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
8
+ const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
9
9
  if (editor.selection && hotkey && isHotkey(hotkey, event)) {
10
10
  const isActive = isBlockSelected(editor, type);
11
11
  editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
@@ -78,7 +78,7 @@ export function HyperlinkModal(props) {
78
78
  });
79
79
  }
80
80
  function entityToLink(entity) {
81
- const { id , type } = entity.sys;
81
+ const { id, type } = entity.sys;
82
82
  return {
83
83
  sys: {
84
84
  id,
@@ -88,7 +88,7 @@ export function HyperlinkModal(props) {
88
88
  };
89
89
  }
90
90
  function entityToResourceLink(entity) {
91
- const { urn } = entity.sys;
91
+ const { urn } = entity.sys;
92
92
  return {
93
93
  sys: {
94
94
  urn,
@@ -249,7 +249,7 @@ export async function addOrEditLink(editor, sdk, logAction, targetPath) {
249
249
  shouldCloseOnEscapePress: true,
250
250
  shouldCloseOnOverlayClick: true,
251
251
  allowHeightOverflow: true
252
- }, ({ onClose })=>{
252
+ }, ({ onClose })=>{
253
253
  return React.createElement(HyperlinkModal, {
254
254
  linkTarget: linkTarget,
255
255
  linkText: currentLinkText,
@@ -266,7 +266,7 @@ export async function addOrEditLink(editor, sdk, logAction, targetPath) {
266
266
  logAction(isEditing ? 'cancelEditHyperlinkDialog' : 'cancelCreateHyperlinkDialog');
267
267
  return;
268
268
  }
269
- const { linkText: text , linkTarget: url , linkType: type , linkEntity: target } = data;
269
+ const { linkText: text, linkTarget: url, linkType: type, linkEntity: target } = data;
270
270
  withoutNormalizing(editor, ()=>{
271
271
  insertLink(editor, {
272
272
  text,
@@ -7,9 +7,9 @@ import { LinkPopover } from './LinkPopover';
7
7
  import { styles } from './styles';
8
8
  import { useHyperlinkCommon } from './useHyperlinkCommon';
9
9
  export function EntityHyperlink(props) {
10
- const { editor , sdk , isLinkFocused , pathToElement } = useHyperlinkCommon(props.element);
11
- const { onEntityFetchComplete } = useLinkTracking();
12
- const { target } = props.element.data;
10
+ const { editor, sdk, isLinkFocused, pathToElement } = useHyperlinkCommon(props.element);
11
+ const { onEntityFetchComplete } = useLinkTracking();
12
+ const { target } = props.element.data;
13
13
  const tooltipContent = useEntityInfo({
14
14
  target,
15
15
  sdk,
@@ -3,7 +3,7 @@ import { Popover, IconButton, Tooltip, Flex } from '@contentful/f36-components';
3
3
  import { EditIcon, CopyIcon } from '@contentful/f36-icons';
4
4
  import { useFocused } from '../../../internal/hooks';
5
5
  import { styles } from './styles';
6
- export const LinkPopover = ({ isLinkFocused , popoverText , handleEditLink , handleRemoveLink , children , handleCopyLink })=>{
6
+ export const LinkPopover = ({ isLinkFocused, popoverText, handleEditLink, handleRemoveLink, children, handleCopyLink })=>{
7
7
  const isEditorFocused = useFocused();
8
8
  const popoverContent = React.useRef(null);
9
9
  const [isPopoverContentClicked, setIsPopoverContentClicked] = React.useState(false);
@@ -7,9 +7,9 @@ import { LinkPopover } from './LinkPopover';
7
7
  import { styles } from './styles';
8
8
  import { useHyperlinkCommon } from './useHyperlinkCommon';
9
9
  export function ResourceHyperlink(props) {
10
- const { editor , sdk , isLinkFocused , pathToElement } = useHyperlinkCommon(props.element);
11
- const { onEntityFetchComplete } = useLinkTracking();
12
- const { target } = props.element.data;
10
+ const { editor, sdk, isLinkFocused, pathToElement } = useHyperlinkCommon(props.element);
11
+ const { onEntityFetchComplete } = useLinkTracking();
12
+ const { target } = props.element.data;
13
13
  const tooltipContent = useResourceEntityInfo({
14
14
  target,
15
15
  onEntityFetchComplete
@@ -5,7 +5,7 @@ import { LinkPopover } from './LinkPopover';
5
5
  import { styles } from './styles';
6
6
  import { useHyperlinkCommon } from './useHyperlinkCommon';
7
7
  export function UrlHyperlink(props) {
8
- const { editor , sdk , isLinkFocused , pathToElement } = useHyperlinkCommon(props.element);
8
+ const { editor, sdk, isLinkFocused, pathToElement } = useHyperlinkCommon(props.element);
9
9
  const uri = props.element.data?.uri;
10
10
  const popoverText = React.createElement(TextLink, {
11
11
  className: styles.openLink,
@@ -12,7 +12,7 @@ const isAnchor = (element)=>element.nodeName === 'A' && !!element.getAttribute('
12
12
  const isEntryAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Entry';
13
13
  const isAssetAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Asset';
14
14
  const isResourceAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-resource-link-type') === 'Contentful:Entry';
15
- const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
15
+ const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
16
16
  return (event)=>{
17
17
  if (!editor.selection) {
18
18
  return;
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { entityHelpers } from '@contentful/field-editor-shared';
3
3
  import { getEntityInfo } from './utils';
4
- async function fetchAllData({ sdk , entityId , entityType , localeCode , defaultLocaleCode }) {
4
+ async function fetchAllData({ sdk, entityId, entityType, localeCode, defaultLocaleCode }) {
5
5
  let contentType;
6
6
  const getEntity = entityType === 'Entry' ? sdk.space.getEntry : sdk.space.getAsset;
7
7
  const entity = await getEntity(entityId);
@@ -38,7 +38,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
38
38
  contentTypeName: contentType ? contentType.name : ''
39
39
  };
40
40
  }
41
- function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
41
+ function useRequestStatus({ sdk, target, onEntityFetchComplete }) {
42
42
  const [requestStatus, setRequestStatus] = useState({
43
43
  type: 'loading'
44
44
  });
@@ -74,7 +74,7 @@ function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
74
74
  }
75
75
  export function useEntityInfo(props) {
76
76
  const status = useRequestStatus(props);
77
- const { linkType } = props.target.sys;
77
+ const { linkType } = props.target.sys;
78
78
  if (status.type === 'loading') {
79
79
  return `Loading ${linkType.toLowerCase()}...`;
80
80
  }
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { useResource } from '@contentful/field-editor-reference';
3
3
  import { truncateTitle } from '../../plugins/shared/utils';
4
- export function useResourceEntityInfo({ onEntityFetchComplete , target }) {
5
- const { data , error , status } = useResource(target.sys.linkType, target.sys.urn);
4
+ export function useResourceEntityInfo({ onEntityFetchComplete, target }) {
5
+ const { data, error, status } = useResource(target.sys.linkType, target.sys.urn);
6
6
  React.useEffect(()=>{
7
7
  if (status === 'success') {
8
8
  onEntityFetchComplete?.();
@@ -10,7 +10,7 @@ export function getEntityInfo(data) {
10
10
  if (!data) {
11
11
  return '';
12
12
  }
13
- const { entityTitle , contentTypeName , entityStatus , jobs } = data;
13
+ const { entityTitle, contentTypeName, entityStatus, jobs } = data;
14
14
  const title = truncateTitle(entityTitle, 60) || 'Untitled';
15
15
  const scheduledActions = jobs.length > 0 ? getScheduleTooltipContent({
16
16
  job: jobs[0],
@@ -60,7 +60,7 @@ describe('insert line break', ()=>{
60
60
  const render = (children)=>jsx("editor", null, children, jsx("hp", null, jsx("htext", null)));
61
61
  for (const t of tests){
62
62
  test(t.title, ()=>{
63
- const { editor } = createTestEditor({
63
+ const { editor } = createTestEditor({
64
64
  input: render(t.input)
65
65
  });
66
66
  editor.insertBreak();
@@ -47,7 +47,7 @@ describe('insert fragment', ()=>{
47
47
  const render = (children)=>jsx("editor", null, children, jsx("hp", null, jsx("htext", null)));
48
48
  for (const t of tests){
49
49
  test(t.title, ()=>{
50
- const { editor } = createTestEditor({
50
+ const { editor } = createTestEditor({
51
51
  input: render(t.input)
52
52
  });
53
53
  editor.insertFragment(t.fragment);
@@ -8,7 +8,7 @@ const listBreak = (editor)=>{
8
8
  const res = getListItemEntry(editor, {});
9
9
  let moved;
10
10
  if (res) {
11
- const { list , listItem } = res;
11
+ const { list, listItem } = res;
12
12
  const childNode = listItem[0].children[0];
13
13
  if (isBlockAboveEmpty(editor) && listItem[0].children.length === 1 && TEXT_CONTAINERS.includes(childNode.type)) {
14
14
  moved = moveListItemUp(editor, {
@@ -42,7 +42,7 @@ const listBreak = (editor)=>{
42
42
  return false;
43
43
  };
44
44
  export const insertListBreak = (editor)=>{
45
- const { insertBreak } = editor;
45
+ const { insertBreak } = editor;
46
46
  return ()=>{
47
47
  if (listBreak(editor)) return;
48
48
  insertBreak();
@@ -49,7 +49,7 @@ const unwrapTextContainerAtStart = (nodes)=>{
49
49
  return nodes;
50
50
  };
51
51
  export const insertListFragment = (editor)=>{
52
- const { insertFragment } = editor;
52
+ const { insertFragment } = editor;
53
53
  return (fragment)=>{
54
54
  if (!editor.selection) {
55
55
  return;
@@ -2,7 +2,7 @@ import isHotkey from 'is-hotkey';
2
2
  import { getAboveNode } from '../../internal/queries';
3
3
  import { moveListItems } from './transforms/moveListItems';
4
4
  import { toggleList } from './transforms/toggleList';
5
- export const onKeyDownList = (editor, { type , options: { hotkey } })=>(e)=>{
5
+ export const onKeyDownList = (editor, { type, options: { hotkey } })=>(e)=>{
6
6
  if (e.key === 'Tab' && editor.selection) {
7
7
  const listSelected = getAboveNode(editor, {
8
8
  at: editor.selection,
@@ -2,7 +2,7 @@ import { getListTypes } from '@udecode/plate-list';
2
2
  import { withoutNormalizing } from '../../../internal';
3
3
  import { getNodeEntry, getNodeChildren, getNextPath, getPreviousPath, getLastChildPath, match } from '../../../internal/queries';
4
4
  import { wrapNodes, moveNodes } from '../../../internal/transforms';
5
- export const moveListItemDown = (editor, { list , listItem })=>{
5
+ export const moveListItemDown = (editor, { list, listItem })=>{
6
6
  const [listNode] = list;
7
7
  const [, listItemPath] = listItem;
8
8
  let previousListItemPath;
@@ -2,7 +2,7 @@ import { isListNested, ELEMENT_LIC, getListItemEntry, moveListItemUp } from '@ud
2
2
  import { withoutNormalizing } from '../../../internal';
3
3
  import { getNodeEntries, getPluginType, createPathRef, getParentPath, isAncestorPath } from '../../../internal/queries';
4
4
  import { moveListItemDown } from './moveListItemDown';
5
- export const moveListItems = (editor, { increase =true , at =editor.selection ?? undefined } = {})=>{
5
+ export const moveListItems = (editor, { increase = true, at = editor.selection ?? undefined } = {})=>{
6
6
  const _nodes = getNodeEntries(editor, {
7
7
  at,
8
8
  match: {
@@ -4,7 +4,7 @@ describe('moving list items (up/down)', ()=>{
4
4
  const renderEditor = (children)=>jsx("editor", null, children, jsx("hp", null, jsx("htext", null)));
5
5
  const assertTab = (t, shift = false)=>{
6
6
  test(t.title, ()=>{
7
- const { editor } = createTestEditor({
7
+ const { editor } = createTestEditor({
8
8
  input: renderEditor(t.input)
9
9
  });
10
10
  moveListItems(editor, {
@@ -10,14 +10,14 @@ const listTypes = [
10
10
  BLOCKS.UL_LIST,
11
11
  BLOCKS.OL_LIST
12
12
  ];
13
- export const toggleList = (editor, { type })=>withoutNormalizing(editor, ()=>{
13
+ export const toggleList = (editor, { type })=>withoutNormalizing(editor, ()=>{
14
14
  if (!editor.selection) {
15
15
  return;
16
16
  }
17
17
  if (isRangeCollapsed(editor.selection) || !isRangeAcrossBlocks(editor)) {
18
18
  const res = getListItemEntry(editor);
19
19
  if (res) {
20
- const { list } = res;
20
+ const { list } = res;
21
21
  if (list[0].type !== type) {
22
22
  setNodes(editor, {
23
23
  type
@@ -60,7 +60,7 @@ export const toggleList = (editor, { type })=>withoutNormalizing(editor, ()=>{
60
60
  if (listTypes.includes(commonEntry[0].type) || commonEntry[0].type === BLOCKS.LIST_ITEM) {
61
61
  let listType = commonEntry[0].type;
62
62
  if (commonEntry[0].type === BLOCKS.LIST_ITEM) {
63
- listType = (getParentNode(editor, commonEntry[1])?.[0])?.type;
63
+ listType = getParentNode(editor, commonEntry[1])?.[0]?.type;
64
64
  }
65
65
  if (listType !== type) {
66
66
  const startList = findNode(editor, {
@@ -5,7 +5,7 @@ describe('toggle on', ()=>{
5
5
  it('should turn a p to list', ()=>{
6
6
  const input = jsx("editor", null, jsx("hp", null, "1", jsx("cursor", null)));
7
7
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1", jsx("cursor", null)))), jsx("hp", null, jsx("htext", null)));
8
- const { editor } = createTestEditor({
8
+ const { editor } = createTestEditor({
9
9
  input
10
10
  });
11
11
  toggleList(editor, {
@@ -19,7 +19,7 @@ describe('toggle on', ()=>{
19
19
  it('should turn a p with a selection to list', ()=>{
20
20
  const input = jsx("editor", null, jsx("hp", null, "Planetas ", jsx("anchor", null), "mori in", jsx("focus", null), " gandavum!"));
21
21
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "Planetas ", jsx("anchor", null), "mori in", jsx("focus", null), " gandavum!"))), jsx("hp", null, jsx("htext", null)));
22
- const { editor } = createTestEditor({
22
+ const { editor } = createTestEditor({
23
23
  input
24
24
  });
25
25
  toggleList(editor, {
@@ -33,7 +33,7 @@ describe('toggle on', ()=>{
33
33
  it('should turn multiple p to list', ()=>{
34
34
  const input = jsx("editor", null, jsx("hp", null, jsx("anchor", null), "1"), jsx("hp", null, "2"), jsx("hp", null, "3", jsx("focus", null)));
35
35
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, jsx("anchor", null), "1")), jsx("hli", null, jsx("hp", null, "2")), jsx("hli", null, jsx("hp", null, "3", jsx("focus", null)))), jsx("hp", null, jsx("htext", null)));
36
- const { editor } = createTestEditor({
36
+ const { editor } = createTestEditor({
37
37
  input
38
38
  });
39
39
  toggleList(editor, {
@@ -49,7 +49,7 @@ describe('toggle off', ()=>{
49
49
  it('should split a simple list to two', ()=>{
50
50
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1")), jsx("hli", null, jsx("hp", null, "2", jsx("cursor", null))), jsx("hli", null, jsx("hp", null, "3"))));
51
51
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1"))), jsx("hp", null, "2", jsx("cursor", null)), jsx("hul", null, jsx("hli", null, jsx("hp", null, "3"))), jsx("hp", null, jsx("htext", null)));
52
- const { editor } = createTestEditor({
52
+ const { editor } = createTestEditor({
53
53
  input
54
54
  });
55
55
  toggleList(editor, {
@@ -63,7 +63,7 @@ describe('toggle off', ()=>{
63
63
  it('should split a nested list', ()=>{
64
64
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "11")), jsx("hli", null, jsx("hp", null, "12", jsx("cursor", null))), jsx("hli", null, jsx("hp", null, "13"))))));
65
65
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "11"))))), jsx("hp", null, "12", jsx("cursor", null)), jsx("hul", null, jsx("hli", null, jsx("hp", null, "13"))), jsx("hp", null, jsx("htext", null)));
66
- const { editor } = createTestEditor({
66
+ const { editor } = createTestEditor({
67
67
  input
68
68
  });
69
69
  toggleList(editor, {
@@ -77,7 +77,7 @@ describe('toggle off', ()=>{
77
77
  it('should turn a list to multiple p', ()=>{
78
78
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, jsx("anchor", null), "1")), jsx("hli", null, jsx("hp", null, "2")), jsx("hli", null, jsx("hp", null, "3", jsx("focus", null)))));
79
79
  const expected = jsx("editor", null, jsx("hp", null, jsx("anchor", null), "1"), jsx("hp", null, "2"), jsx("hp", null, "3", jsx("focus", null)));
80
- const { editor } = createTestEditor({
80
+ const { editor } = createTestEditor({
81
81
  input
82
82
  });
83
83
  toggleList(editor, {
@@ -93,7 +93,7 @@ describe('toggle over', ()=>{
93
93
  it('should toggle different list types', ()=>{
94
94
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1", jsx("cursor", null)))));
95
95
  const expected = jsx("editor", null, jsx("hol", null, jsx("hli", null, jsx("hp", null, "1"))), jsx("hp", null, jsx("htext", null)));
96
- const { editor } = createTestEditor({
96
+ const { editor } = createTestEditor({
97
97
  input
98
98
  });
99
99
  toggleList(editor, {
@@ -107,7 +107,7 @@ describe('toggle over', ()=>{
107
107
  it('should only toggle the nested list', ()=>{
108
108
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "11", jsx("cursor", null)))))));
109
109
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "1"), jsx("hol", null, jsx("hli", null, jsx("hp", null, "11", jsx("cursor", null)))))), jsx("hp", null, jsx("htext", null)));
110
- const { editor } = createTestEditor({
110
+ const { editor } = createTestEditor({
111
111
  input
112
112
  });
113
113
  toggleList(editor, {
@@ -121,7 +121,7 @@ describe('toggle over', ()=>{
121
121
  it('should only toggle everything that is selected', ()=>{
122
122
  const input = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, jsx("anchor", null), "1"), jsx("hul", null, jsx("hli", null, jsx("hp", null, "11", jsx("focus", null)))))));
123
123
  const expected = jsx("editor", null, jsx("hol", null, jsx("hli", null, jsx("hp", null, jsx("anchor", null), "1"), jsx("hol", null, jsx("hli", null, jsx("hp", null, "11", jsx("focus", null)))))), jsx("hp", null, jsx("htext", null)));
124
- const { editor } = createTestEditor({
124
+ const { editor } = createTestEditor({
125
125
  input
126
126
  });
127
127
  toggleList(editor, {
@@ -8,7 +8,7 @@ function hasUnliftedListItems(editor, at) {
8
8
  match: (node, path)=>isElement(node) && node.type === BLOCKS.LIST_ITEM && path.length >= 2
9
9
  }).next().done;
10
10
  }
11
- export const unwrapList = (editor, { at } = {})=>{
11
+ export const unwrapList = (editor, { at } = {})=>{
12
12
  withoutNormalizing(editor, ()=>{
13
13
  do {
14
14
  liftNodes(editor, {
@@ -65,7 +65,7 @@ export const replaceNodeWithListItems = (editor, entry)=>{
65
65
  });
66
66
  };
67
67
  export const isListTypeActive = (editor, type)=>{
68
- const { selection } = editor;
68
+ const { selection } = editor;
69
69
  if (!selection) {
70
70
  return false;
71
71
  }
@@ -4,7 +4,7 @@ import { insertListBreak } from './insertListBreak';
4
4
  import { insertListFragment } from './insertListFragment';
5
5
  const validLiChildrenTypes = LIST_ITEM_BLOCKS;
6
6
  export const withList = (editor)=>{
7
- const { deleteForward , deleteFragment } = editor;
7
+ const { deleteForward, deleteFragment } = editor;
8
8
  editor.deleteForward = (unit)=>{
9
9
  if (deleteForwardList(editor)) return;
10
10
  deleteForward(unit);
@@ -13,8 +13,8 @@ const styles = {
13
13
  color: tokens.blue600
14
14
  })
15
15
  };
16
- export const createMarkToolbarButton = ({ mark , title , icon })=>{
17
- const Mark = ({ isDisabled })=>{
16
+ export const createMarkToolbarButton = ({ mark, title, icon })=>{
17
+ const Mark = ({ isDisabled })=>{
18
18
  const editor = useContentfulEditor();
19
19
  const handleClick = React.useCallback(()=>{
20
20
  if (!editor?.selection) return;
@@ -13,7 +13,7 @@ export const toggleMarkAndDeactivateConflictingMarks = (editor, mark)=>{
13
13
  clear
14
14
  });
15
15
  };
16
- export const buildMarkEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
16
+ export const buildMarkEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
17
17
  if (editor.selection && hotkey && isHotkey(hotkey, event)) {
18
18
  event.preventDefault();
19
19
  const isActive = isMarkActive(editor, type);
@@ -20,7 +20,7 @@ describe('Normalizer', ()=>{
20
20
  const expected = jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hp", null, "List item"))));
21
21
  describe('rule.match', ()=>{
22
22
  it('matches elements of type "plugin.type" by default', ()=>{
23
- const { editor } = createTestEditor({
23
+ const { editor } = createTestEditor({
24
24
  input,
25
25
  plugins: [
26
26
  mockPlugin({
@@ -50,7 +50,7 @@ describe('Normalizer', ()=>{
50
50
  });
51
51
  describe('rule.transform', ()=>{
52
52
  it('works with conditional transformation', ()=>{
53
- const { editor } = createTestEditor({
53
+ const { editor } = createTestEditor({
54
54
  input: jsx("editor", null, jsx("hul", null, jsx("hli", null, jsx("hembed", {
55
55
  type: "Entry",
56
56
  id: "embedded-entry"
@@ -87,7 +87,7 @@ describe('Normalizer', ()=>{
87
87
  });
88
88
  describe('rule.validChildren', ()=>{
89
89
  it('supports custom functions', ()=>{
90
- const { editor } = createTestEditor({
90
+ const { editor } = createTestEditor({
91
91
  input,
92
92
  plugins: [
93
93
  mockPlugin({
@@ -7,7 +7,7 @@ import { NormalizerError, createValidatorFromTypes, createTransformerFromObject
7
7
  export const withNormalizer = (editor)=>{
8
8
  const rules = baseRules;
9
9
  for (const p of editor.plugins){
10
- const { normalizer: _rules } = p;
10
+ const { normalizer: _rules } = p;
11
11
  if (!_rules) {
12
12
  continue;
13
13
  }
@@ -46,7 +46,7 @@ export const withNormalizer = (editor)=>{
46
46
  tr(editor, entry);
47
47
  });
48
48
  };
49
- const { normalizeNode } = editor;
49
+ const { normalizeNode } = editor;
50
50
  editor.normalizeNode = (entry)=>{
51
51
  const [node, path] = entry;
52
52
  const children = getChildren(entry);
@@ -5,7 +5,7 @@ import { isInlineOrText, toggleElement } from '../../helpers/editor';
5
5
  import { transformUnwrap, transformLift } from '../../helpers/transformers';
6
6
  import { Paragraph } from './Paragraph';
7
7
  import { isEmbedElement, isEmptyElement } from './utils';
8
- const buildParagraphKeyDownHandler = (editor, { options: { hotkey } })=>(event)=>{
8
+ const buildParagraphKeyDownHandler = (editor, { options: { hotkey } })=>(event)=>{
9
9
  if (editor.selection && hotkey && isHotkey(hotkey, event)) {
10
10
  toggleElement(editor, {
11
11
  activeType: BLOCKS.PARAGRAPH,
@@ -23,7 +23,7 @@ export const ensureXSlateFragment = (dataTransfer)=>{
23
23
  export const createPasteHTMLPlugin = ()=>({
24
24
  key: 'PasteHTMLPlugin',
25
25
  withOverrides: (editor)=>{
26
- const { insertData } = editor;
26
+ const { insertData } = editor;
27
27
  editor.insertData = (data)=>insertData(ensureXSlateFragment(data));
28
28
  return editor;
29
29
  },
@@ -25,7 +25,7 @@ export function toggleQuote(editor, logAction) {
25
25
  });
26
26
  }
27
27
  export const onKeyDownToggleQuote = (editor, plugin)=>(event)=>{
28
- const { hotkey } = plugin.options;
28
+ const { hotkey } = plugin.options;
29
29
  if (hotkey && isHotkey(hotkey, event)) {
30
30
  event.preventDefault();
31
31
  toggleQuote(editor, editor.tracking.onShortcutAction);
@@ -3,7 +3,7 @@ import { Element, Point } from 'slate';
3
3
  import { getAboveNode, getText } from '../../internal/queries';
4
4
  import { deleteText, insertNodes } from '../../internal/transforms';
5
5
  export const withQuote = (editor)=>{
6
- const { insertFragment } = editor;
6
+ const { insertFragment } = editor;
7
7
  editor.insertFragment = (fragment)=>{
8
8
  const startingNode = fragment.length && fragment[0];
9
9
  const startsWithBlockquote = Element.isElement(startingNode) && startingNode.type === BLOCKS.QUOTE;
@@ -14,7 +14,7 @@ export const withQuote = (editor)=>{
14
14
  });
15
15
  const containerIsNotEmpty = containerEntry && getText(editor, containerEntry[1]) !== '';
16
16
  if (startsWithBlockquote && containerIsNotEmpty) {
17
- const { selection } = editor;
17
+ const { selection } = editor;
18
18
  const isContentSelected = (selection)=>!!selection && Point.compare(selection.anchor, selection.focus) !== 0;
19
19
  if (isContentSelected(selection)) {
20
20
  deleteText(editor, {
@@ -2,7 +2,7 @@ import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
2
  import { insertTableAndFocusFirstCell } from '../helpers';
3
3
  test('insertTableAndFocusFirstCell', ()=>{
4
4
  const input = jsx("editor", null, jsx("hp", null, jsx("htext", null), jsx("cursor", null)), jsx("hp", null));
5
- const { editor } = createTestEditor({
5
+ const { editor } = createTestEditor({
6
6
  input
7
7
  });
8
8
  insertTableAndFocusFirstCell(editor);
@@ -2,7 +2,7 @@ import { BLOCKS } from '@contentful/rich-text-types';
2
2
  import { getEmptyCellNode } from '@udecode/plate-table';
3
3
  import { getAboveNode, getNextPath, someNode } from '../../../internal/queries';
4
4
  import { insertNodes } from '../../../internal/transforms';
5
- const addColumn = (editor, { header }, getNextCellPath)=>{
5
+ const addColumn = (editor, { header }, getNextCellPath)=>{
6
6
  if (someNode(editor, {
7
7
  match: {
8
8
  type: BLOCKS.TABLE
@@ -18,7 +18,7 @@ export const createTablePlugin = ()=>createDefaultTablePlugin({
18
18
  onKeyDown: onKeyDownTable
19
19
  },
20
20
  withOverrides: (editor, plugin)=>{
21
- const { normalizeNode } = editor;
21
+ const { normalizeNode } = editor;
22
22
  withTable(editor, plugin);
23
23
  editor.normalizeNode = normalizeNode;
24
24
  addTableTrackingEvents(editor);
@@ -23,7 +23,7 @@ const trimUnnecessaryTableWrapper = (node)=>{
23
23
  return cell.children;
24
24
  };
25
25
  export const insertTableFragment = (editor)=>{
26
- const { insertFragment } = editor;
26
+ const { insertFragment } = editor;
27
27
  return (fragments)=>{
28
28
  if (!editor.selection) {
29
29
  return;
@@ -33,7 +33,7 @@ export const onKeyDownTable = (editor, plugin)=>{
33
33
  if (event.key === 'Backspace') {
34
34
  const entry = getTableEntries(editor, {});
35
35
  if (entry) {
36
- const { table , row , cell } = entry;
36
+ const { table, row, cell } = entry;
37
37
  const cellText = getText(editor, cell[1]);
38
38
  const isFirstCell = isFirstChild(row[1]);
39
39
  const isFirstRow = isFirstChild(table[1]);
@@ -48,7 +48,7 @@ export const onKeyDownTable = (editor, plugin)=>{
48
48
  event.preventDefault();
49
49
  const entry = getTableEntries(editor, {});
50
50
  if (entry) {
51
- const { table , row , cell } = entry;
51
+ const { table, row, cell } = entry;
52
52
  const isLastCell = isLastChildPath(row, cell[1]);
53
53
  const isLastRow = isLastChildPath(table, row[1]);
54
54
  if (isLastRow && isLastCell) {