@contentful/field-editor-rich-text 3.14.3 → 3.15.1

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 (323) hide show
  1. package/dist/cjs/ContentfulEditorProvider.js +8 -8
  2. package/dist/cjs/RichTextEditor.js +22 -20
  3. package/dist/cjs/RichTextEditor.styles.js +2 -1
  4. package/dist/cjs/SdkProvider.js +7 -5
  5. package/dist/cjs/SyncEditorChanges.js +15 -6
  6. package/dist/cjs/Toolbar/_tests_/toolbar.test.js +17 -15
  7. package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +14 -10
  8. package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +10 -8
  9. package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
  10. package/dist/cjs/Toolbar/index.js +33 -30
  11. package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
  12. package/dist/cjs/__fixtures__/asset/index.js +10 -10
  13. package/dist/cjs/__fixtures__/content-type/index.js +1 -1
  14. package/dist/cjs/__fixtures__/entry/index.js +7 -7
  15. package/dist/cjs/__fixtures__/fixtures.js +8 -6
  16. package/dist/cjs/__fixtures__/locale/index.js +2 -2
  17. package/dist/cjs/__fixtures__/space/index.js +1 -1
  18. package/dist/cjs/constants/Schema.js +1 -0
  19. package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +43 -38
  20. package/dist/cjs/dialogs/openRichTextDialog.js +6 -4
  21. package/dist/cjs/dialogs/renderRichTextDialog.js +6 -4
  22. package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +10 -10
  23. package/dist/cjs/helpers/callbacks.js +3 -3
  24. package/dist/cjs/helpers/config.js +2 -2
  25. package/dist/cjs/helpers/editor.js +53 -44
  26. package/dist/cjs/helpers/environment.js +3 -3
  27. package/dist/cjs/helpers/formatDateAndTime.js +5 -4
  28. package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +22 -5
  29. package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +29 -5
  30. package/dist/cjs/helpers/nodeFactory.js +6 -6
  31. package/dist/cjs/helpers/sdkNavigatorSlideIn.js +14 -6
  32. package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +3 -2
  33. package/dist/cjs/helpers/toSlateValue.js +14 -3
  34. package/dist/cjs/helpers/transformers.js +5 -5
  35. package/dist/cjs/helpers/validations.js +12 -9
  36. package/dist/cjs/index.js +7 -5
  37. package/dist/cjs/internal/constants.js +4 -2
  38. package/dist/cjs/internal/hooks.js +8 -6
  39. package/dist/cjs/internal/misc.js +15 -12
  40. package/dist/cjs/internal/queries.js +115 -108
  41. package/dist/cjs/internal/transforms.js +51 -48
  42. package/dist/cjs/internal/types/editor.js +3 -1
  43. package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +4 -3
  44. package/dist/cjs/plugins/Break/createResetNodePlugin.js +1 -0
  45. package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
  46. package/dist/cjs/plugins/CommandPalette/components/CommandList.js +35 -33
  47. package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
  48. package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +7 -5
  49. package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +7 -3
  50. package/dist/cjs/plugins/CommandPalette/onKeyDown.js +6 -1
  51. package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +6 -4
  52. package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
  53. package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +2 -0
  54. package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
  55. package/dist/cjs/plugins/DragAndDrop/index.js +9 -1
  56. package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +10 -8
  57. package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
  58. package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +19 -17
  59. package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +9 -7
  60. package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
  61. package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +17 -13
  62. package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +5 -5
  63. package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
  64. package/dist/cjs/plugins/Heading/components/Heading.js +13 -10
  65. package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +19 -11
  66. package/dist/cjs/plugins/Heading/createHeadingPlugin.js +7 -2
  67. package/dist/cjs/plugins/Hr/index.js +19 -14
  68. package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +32 -28
  69. package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
  70. package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -6
  71. package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -6
  72. package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +6 -4
  73. package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +7 -5
  74. package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
  75. package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +10 -4
  76. package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +6 -3
  77. package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +7 -5
  78. package/dist/cjs/plugins/Hyperlink/utils.js +6 -14
  79. package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +13 -13
  80. package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +29 -25
  81. package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
  82. package/dist/cjs/plugins/List/components/List.js +9 -7
  83. package/dist/cjs/plugins/List/components/ListItem.js +6 -4
  84. package/dist/cjs/plugins/List/components/ToolbarListButton.js +7 -5
  85. package/dist/cjs/plugins/List/createListPlugin.js +4 -0
  86. package/dist/cjs/plugins/List/insertListBreak.js +13 -4
  87. package/dist/cjs/plugins/List/insertListFragment.js +18 -5
  88. package/dist/cjs/plugins/List/onKeyDownList.js +7 -4
  89. package/dist/cjs/plugins/List/transforms/insertListItem.js +17 -2
  90. package/dist/cjs/plugins/List/transforms/moveListItemDown.js +8 -2
  91. package/dist/cjs/plugins/List/transforms/moveListItems.js +7 -2
  92. package/dist/cjs/plugins/List/transforms/moveListItems.test.js +15 -14
  93. package/dist/cjs/plugins/List/transforms/toggleList.js +8 -3
  94. package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
  95. package/dist/cjs/plugins/List/transforms/unwrapList.js +7 -2
  96. package/dist/cjs/plugins/List/utils.js +12 -11
  97. package/dist/cjs/plugins/List/withList.js +6 -2
  98. package/dist/cjs/plugins/Marks/Bold.js +9 -7
  99. package/dist/cjs/plugins/Marks/Code.js +15 -7
  100. package/dist/cjs/plugins/Marks/Italic.js +9 -7
  101. package/dist/cjs/plugins/Marks/Subscript.js +10 -8
  102. package/dist/cjs/plugins/Marks/Superscript.js +10 -8
  103. package/dist/cjs/plugins/Marks/Underline.js +6 -4
  104. package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +9 -7
  105. package/dist/cjs/plugins/Marks/helpers.js +5 -5
  106. package/dist/cjs/plugins/Normalizer/baseRules.js +2 -0
  107. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
  108. package/dist/cjs/plugins/Normalizer/utils.js +4 -3
  109. package/dist/cjs/plugins/Normalizer/withNormalizer.js +23 -3
  110. package/dist/cjs/plugins/Paragraph/Paragraph.js +6 -4
  111. package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
  112. package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +3 -2
  113. package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -6
  114. package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
  115. package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +9 -0
  116. package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
  117. package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
  118. package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
  119. package/dist/cjs/plugins/Quote/components/Quote.js +6 -4
  120. package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +6 -4
  121. package/dist/cjs/plugins/Quote/createQuotePlugin.js +1 -0
  122. package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
  123. package/dist/cjs/plugins/Quote/withQuote.js +4 -2
  124. package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
  125. package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
  126. package/dist/cjs/plugins/Table/__tests__/helpers.test.js +4 -4
  127. package/dist/cjs/plugins/Table/actions/addColumn.js +5 -4
  128. package/dist/cjs/plugins/Table/actions/addRow.js +6 -3
  129. package/dist/cjs/plugins/Table/components/Cell.js +7 -5
  130. package/dist/cjs/plugins/Table/components/HeaderCell.js +7 -5
  131. package/dist/cjs/plugins/Table/components/Row.js +6 -4
  132. package/dist/cjs/plugins/Table/components/Table.js +8 -6
  133. package/dist/cjs/plugins/Table/components/TableActions.js +19 -16
  134. package/dist/cjs/plugins/Table/components/ToolbarButton.js +7 -4
  135. package/dist/cjs/plugins/Table/createTablePlugin.js +11 -1
  136. package/dist/cjs/plugins/Table/helpers.js +16 -12
  137. package/dist/cjs/plugins/Table/insertTableFragment.js +15 -2
  138. package/dist/cjs/plugins/Table/onKeyDownTable.js +10 -2
  139. package/dist/cjs/plugins/Table/tableTracking.js +6 -6
  140. package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
  141. package/dist/cjs/plugins/Text/createTextPlugin.js +22 -5
  142. package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +5 -4
  143. package/dist/cjs/plugins/Tracking/utils.js +6 -3
  144. package/dist/cjs/plugins/Voids/createVoidsPlugin.js +5 -0
  145. package/dist/cjs/plugins/Voids/transformVoid.js +1 -0
  146. package/dist/cjs/plugins/index.js +15 -3
  147. package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +12 -10
  148. package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +16 -6
  149. package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +10 -8
  150. package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +9 -5
  151. package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +13 -11
  152. package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +14 -12
  153. package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +14 -11
  154. package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +8 -4
  155. package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +10 -6
  156. package/dist/cjs/plugins/shared/ResourceNewBadge.js +5 -3
  157. package/dist/cjs/plugins/shared/ToolbarButton.js +8 -6
  158. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +10 -5
  159. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +11 -6
  160. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +15 -13
  161. package/dist/cjs/plugins/shared/utils.js +20 -3
  162. package/dist/cjs/test-utils/assertOutput.js +1 -0
  163. package/dist/cjs/test-utils/hyperscript.d.js +1 -0
  164. package/dist/cjs/test-utils/randomId.js +3 -1
  165. package/dist/cjs/test-utils/validation.js +8 -5
  166. package/dist/esm/ContentfulEditorProvider.js +4 -1
  167. package/dist/esm/RichTextEditor.js +13 -13
  168. package/dist/esm/RichTextEditor.styles.js +1 -0
  169. package/dist/esm/SdkProvider.js +2 -2
  170. package/dist/esm/SyncEditorChanges.js +18 -3
  171. package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
  172. package/dist/esm/Toolbar/components/EmbedEntityWidget.js +10 -8
  173. package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
  174. package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
  175. package/dist/esm/Toolbar/index.js +28 -27
  176. package/dist/esm/__fixtures__/FakeSdk.js +3 -3
  177. package/dist/esm/constants/Schema.js +1 -0
  178. package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +34 -31
  179. package/dist/esm/dialogs/openRichTextDialog.js +2 -2
  180. package/dist/esm/dialogs/renderRichTextDialog.js +2 -2
  181. package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +10 -10
  182. package/dist/esm/helpers/callbacks.js +1 -1
  183. package/dist/esm/helpers/config.js +9 -1
  184. package/dist/esm/helpers/editor.js +22 -6
  185. package/dist/esm/helpers/extractNodes.js +3 -1
  186. package/dist/esm/helpers/formatDateAndTime.js +11 -2
  187. package/dist/esm/helpers/getAllowedResourcesForNodeType.js +19 -2
  188. package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +26 -2
  189. package/dist/esm/helpers/sdkNavigatorSlideIn.js +20 -6
  190. package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +1 -0
  191. package/dist/esm/helpers/toSlateValue.js +17 -3
  192. package/dist/esm/helpers/validations.js +5 -1
  193. package/dist/esm/internal/misc.js +23 -2
  194. package/dist/esm/internal/queries.js +11 -2
  195. package/dist/esm/internal/transforms.js +14 -3
  196. package/dist/esm/internal/types/editor.js +3 -1
  197. package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +4 -3
  198. package/dist/esm/plugins/Break/createResetNodePlugin.js +1 -0
  199. package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +3 -3
  200. package/dist/esm/plugins/CommandPalette/components/CommandList.js +30 -30
  201. package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +2 -2
  202. package/dist/esm/plugins/CommandPalette/createCommandPalettePlugin.js +11 -1
  203. package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +2 -0
  204. package/dist/esm/plugins/CommandPalette/onKeyDown.js +5 -0
  205. package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
  206. package/dist/esm/plugins/CommandPalette/useCommands.js +3 -3
  207. package/dist/esm/plugins/CommandPalette/utils/fetchEntries.js +2 -0
  208. package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -1
  209. package/dist/esm/plugins/DragAndDrop/index.js +9 -1
  210. package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -6
  211. package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +14 -14
  212. package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +5 -5
  213. package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +4 -4
  214. package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +13 -11
  215. package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +4 -4
  216. package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
  217. package/dist/esm/plugins/Heading/components/Heading.js +8 -7
  218. package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +14 -8
  219. package/dist/esm/plugins/Heading/createHeadingPlugin.js +6 -1
  220. package/dist/esm/plugins/Hr/index.js +8 -5
  221. package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +25 -23
  222. package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
  223. package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +4 -4
  224. package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +4 -4
  225. package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
  226. package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +3 -3
  227. package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +5 -1
  228. package/dist/esm/plugins/Hyperlink/useEntityInfo.js +6 -3
  229. package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +3 -3
  230. package/dist/esm/plugins/Hyperlink/utils.js +2 -7
  231. package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +13 -13
  232. package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +29 -25
  233. package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +22 -22
  234. package/dist/esm/plugins/List/components/List.js +1 -1
  235. package/dist/esm/plugins/List/components/ListItem.js +1 -1
  236. package/dist/esm/plugins/List/components/ToolbarListButton.js +3 -3
  237. package/dist/esm/plugins/List/createListPlugin.js +4 -0
  238. package/dist/esm/plugins/List/insertListBreak.js +13 -4
  239. package/dist/esm/plugins/List/insertListFragment.js +18 -5
  240. package/dist/esm/plugins/List/onKeyDownList.js +5 -2
  241. package/dist/esm/plugins/List/transforms/insertListItem.js +20 -3
  242. package/dist/esm/plugins/List/transforms/moveListItemDown.js +8 -2
  243. package/dist/esm/plugins/List/transforms/moveListItems.js +7 -2
  244. package/dist/esm/plugins/List/transforms/moveListItems.test.js +15 -14
  245. package/dist/esm/plugins/List/transforms/toggleList.js +8 -3
  246. package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
  247. package/dist/esm/plugins/List/transforms/unwrapList.js +7 -2
  248. package/dist/esm/plugins/List/utils.js +7 -2
  249. package/dist/esm/plugins/List/withList.js +6 -2
  250. package/dist/esm/plugins/Marks/Bold.js +2 -2
  251. package/dist/esm/plugins/Marks/Code.js +8 -2
  252. package/dist/esm/plugins/Marks/Italic.js +2 -2
  253. package/dist/esm/plugins/Marks/Subscript.js +2 -2
  254. package/dist/esm/plugins/Marks/Superscript.js +2 -2
  255. package/dist/esm/plugins/Marks/Underline.js +2 -2
  256. package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +4 -4
  257. package/dist/esm/plugins/Marks/helpers.js +1 -1
  258. package/dist/esm/plugins/Normalizer/baseRules.js +4 -0
  259. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
  260. package/dist/esm/plugins/Normalizer/utils.js +1 -0
  261. package/dist/esm/plugins/Normalizer/withNormalizer.js +22 -2
  262. package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
  263. package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
  264. package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +2 -1
  265. package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +9 -3
  266. package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +2 -0
  267. package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +27 -1
  268. package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +17 -2
  269. package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +13 -1
  270. package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
  271. package/dist/esm/plugins/Quote/components/Quote.js +1 -1
  272. package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
  273. package/dist/esm/plugins/Quote/createQuotePlugin.js +1 -0
  274. package/dist/esm/plugins/Quote/shouldResetQuote.js +6 -1
  275. package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
  276. package/dist/esm/plugins/Quote/withQuote.js +4 -2
  277. package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +1 -0
  278. package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
  279. package/dist/esm/plugins/Table/__tests__/helpers.test.js +4 -4
  280. package/dist/esm/plugins/Table/actions/addColumn.js +2 -1
  281. package/dist/esm/plugins/Table/actions/addRow.js +3 -0
  282. package/dist/esm/plugins/Table/components/Cell.js +2 -2
  283. package/dist/esm/plugins/Table/components/HeaderCell.js +2 -2
  284. package/dist/esm/plugins/Table/components/Row.js +1 -1
  285. package/dist/esm/plugins/Table/components/Table.js +3 -3
  286. package/dist/esm/plugins/Table/components/TableActions.js +12 -11
  287. package/dist/esm/plugins/Table/components/ToolbarButton.js +3 -2
  288. package/dist/esm/plugins/Table/createTablePlugin.js +11 -1
  289. package/dist/esm/plugins/Table/helpers.js +10 -1
  290. package/dist/esm/plugins/Table/insertTableFragment.js +15 -2
  291. package/dist/esm/plugins/Table/onKeyDownTable.js +10 -2
  292. package/dist/esm/plugins/Table/tableTracking.js +6 -6
  293. package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +19 -17
  294. package/dist/esm/plugins/Text/createTextPlugin.js +22 -5
  295. package/dist/esm/plugins/Tracking/createTrackingPlugin.js +2 -1
  296. package/dist/esm/plugins/Tracking/utils.js +1 -0
  297. package/dist/esm/plugins/Voids/createVoidsPlugin.js +5 -0
  298. package/dist/esm/plugins/Voids/transformVoid.js +4 -1
  299. package/dist/esm/plugins/index.js +12 -0
  300. package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
  301. package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +15 -5
  302. package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
  303. package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +8 -4
  304. package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +8 -8
  305. package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +9 -9
  306. package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +9 -8
  307. package/dist/esm/plugins/shared/LinkedBlockWrapper.js +7 -3
  308. package/dist/esm/plugins/shared/LinkedInlineWrapper.js +5 -3
  309. package/dist/esm/plugins/shared/ResourceNewBadge.js +1 -1
  310. package/dist/esm/plugins/shared/ToolbarButton.js +3 -3
  311. package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -2
  312. package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +5 -2
  313. package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
  314. package/dist/esm/plugins/shared/utils.js +9 -0
  315. package/dist/esm/test-utils/assertOutput.js +1 -0
  316. package/dist/esm/test-utils/hyperscript.d.js +1 -0
  317. package/dist/esm/test-utils/jsx.js +5 -1
  318. package/dist/esm/test-utils/randomId.js +3 -1
  319. package/dist/esm/test-utils/setEmptyDataAttribute.js +4 -1
  320. package/dist/esm/test-utils/validation.js +7 -4
  321. package/dist/types/plugins/Hyperlink/utils.d.ts +0 -1
  322. package/dist/types/plugins/shared/utils.d.ts +1 -0
  323. package/package.json +2 -2
@@ -16,16 +16,16 @@ _export(exports, {
16
16
  return addOrEditLink;
17
17
  }
18
18
  });
19
- const _react = _interop_require_wildcard(require("react"));
19
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
20
20
  const _f36components = require("@contentful/f36-components");
21
- const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
21
+ const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
22
22
  const _fieldeditorreference = require("@contentful/field-editor-reference");
23
23
  const _fieldeditorshared = require("@contentful/field-editor-shared");
24
24
  const _richtexttypes = require("@contentful/rich-text-types");
25
25
  const _emotion = require("emotion");
26
26
  const _editor = require("../../helpers/editor");
27
- const _getAllowedResourcesForNodeType = _interop_require_default(require("../../helpers/getAllowedResourcesForNodeType"));
28
- const _getLinkedContentTypeIdsForNodeType = _interop_require_default(require("../../helpers/getLinkedContentTypeIdsForNodeType"));
27
+ const _getAllowedResourcesForNodeType = /*#__PURE__*/ _interop_require_default(require("../../helpers/getAllowedResourcesForNodeType"));
28
+ const _getLinkedContentTypeIdsForNodeType = /*#__PURE__*/ _interop_require_default(require("../../helpers/getLinkedContentTypeIdsForNodeType"));
29
29
  const _validations = require("../../helpers/validations");
30
30
  const _internal = require("../../internal");
31
31
  const _queries = require("../../internal/queries");
@@ -59,7 +59,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
59
59
  if (cache && cache.has(obj)) {
60
60
  return cache.get(obj);
61
61
  }
62
- var newObj = {};
62
+ var newObj = {
63
+ __proto__: null
64
+ };
63
65
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
64
66
  for(var key in obj){
65
67
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -140,7 +142,7 @@ function HyperlinkModal(props) {
140
142
  });
141
143
  }
142
144
  function entityToLink(entity) {
143
- const { id , type } = entity.sys;
145
+ const { id, type } = entity.sys;
144
146
  return {
145
147
  sys: {
146
148
  id,
@@ -150,7 +152,8 @@ function HyperlinkModal(props) {
150
152
  };
151
153
  }
152
154
  function entityToResourceLink(entity) {
153
- const { urn } = entity.sys;
155
+ const { urn } = entity.sys;
156
+ // @ts-expect-error wait for update of app-sdk version
154
157
  return {
155
158
  sys: {
156
159
  urn,
@@ -183,6 +186,7 @@ function HyperlinkModal(props) {
183
186
  const options = {
184
187
  allowedResources: (0, _getAllowedResourcesForNodeType.default)(props.sdk.field, _richtexttypes.INLINES.RESOURCE_HYPERLINK)
185
188
  };
189
+ // @ts-expect-error wait for update of app-sdk version
186
190
  const entry = await props.sdk.dialogs.selectSingleResourceEntry(options);
187
191
  if (entry) {
188
192
  setLinkTarget('');
@@ -203,30 +207,30 @@ function HyperlinkModal(props) {
203
207
  event.preventDefault();
204
208
  setLinkEntity(null);
205
209
  }
206
- return _react.createElement(_fieldeditorreference.EntityProvider, {
210
+ return /*#__PURE__*/ _react.createElement(_fieldeditorreference.EntityProvider, {
207
211
  sdk: props.sdk
208
- }, _react.createElement(_react.Fragment, null, _react.createElement(_f36components.ModalContent, null, _react.createElement(_f36components.Form, null, !props.linkType && _react.createElement(_f36components.FormControl, {
212
+ }, /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_f36components.ModalContent, null, /*#__PURE__*/ _react.createElement(_f36components.Form, null, !props.linkType && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
209
213
  id: "link-text",
210
214
  isRequired: true
211
- }, _react.createElement(_f36components.FormControl.Label, null, "Link text"), _react.createElement(_f36components.TextInput, {
215
+ }, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link text"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
212
216
  testId: "link-text-input",
213
217
  name: "link-text",
214
218
  value: linkText,
215
219
  onChange: (event)=>setLinkText(event.target.value)
216
- })), enabledLinkTypes.length > 1 && _react.createElement(_f36components.FormControl, {
220
+ })), enabledLinkTypes.length > 1 && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
217
221
  id: "link-type"
218
- }, _react.createElement(_f36components.FormControl.Label, null, "Link type"), _react.createElement(_f36components.Select, {
222
+ }, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link type"), /*#__PURE__*/ _react.createElement(_f36components.Select, {
219
223
  value: linkType,
220
224
  onChange: (event)=>setLinkType(event.target.value),
221
225
  testId: "link-type-input",
222
226
  isDisabled: props.readonly
223
- }, enabledLinkTypes.map((nodeType)=>_react.createElement(_f36components.Select.Option, {
227
+ }, enabledLinkTypes.map((nodeType)=>/*#__PURE__*/ _react.createElement(_f36components.Select.Option, {
224
228
  key: nodeType,
225
229
  value: nodeType
226
- }, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === _richtexttypes.INLINES.HYPERLINK && _react.createElement(_f36components.FormControl, {
230
+ }, LINK_TYPE_SELECTION_VALUES[nodeType])))), linkType === _richtexttypes.INLINES.HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.FormControl, {
227
231
  id: "linkTarget",
228
232
  isRequired: true
229
- }, _react.createElement(_f36components.FormControl.Label, null, "Link target"), _react.createElement(_f36components.TextInput, {
233
+ }, /*#__PURE__*/ _react.createElement(_f36components.FormControl.Label, null, "Link target"), /*#__PURE__*/ _react.createElement(_f36components.TextInput, {
230
234
  ref: linkTargetInputRef,
231
235
  name: "linkTarget",
232
236
  value: linkTarget,
@@ -236,46 +240,46 @@ function HyperlinkModal(props) {
236
240
  },
237
241
  testId: "link-target-input",
238
242
  isDisabled: props.readonly
239
- }), _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== _richtexttypes.INLINES.HYPERLINK && _react.createElement("div", null, _react.createElement(_f36components.FormLabel, {
243
+ }), /*#__PURE__*/ _react.createElement(_f36components.FormControl.HelpText, null, "A protocol may be required, e.g. https://")), linkType !== _richtexttypes.INLINES.HYPERLINK && /*#__PURE__*/ _react.createElement("div", null, /*#__PURE__*/ _react.createElement(_f36components.FormLabel, {
240
244
  isRequired: true,
241
245
  htmlFor: ""
242
- }, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? _react.createElement(_react.Fragment, null, !props.readonly && _react.createElement(_f36components.TextLink, {
246
+ }, "Link target", ' '), linkEntity && linkEntity.sys.linkType === SYS_LINK_TYPES[linkType] ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, !props.readonly && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
243
247
  testId: "entity-selection-link",
244
248
  onClick: resetLinkEntity,
245
249
  className: styles.removeSelectionLabel
246
- }, "Remove selection"), _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
250
+ }, "Remove selection"), /*#__PURE__*/ _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && isEntryLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
247
251
  sdk: props.sdk,
248
252
  locale: props.sdk.field.locale,
249
253
  entryId: linkEntity.sys.id,
250
254
  isDisabled: true,
251
255
  isSelected: false
252
- }), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && _react.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
256
+ }), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && isResourceLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedResourceCard.FetchingWrappedResourceCard, {
253
257
  sdk: props.sdk,
254
258
  link: linkEntity.sys,
255
259
  isDisabled: true,
256
260
  isSelected: false
257
- }), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
261
+ }), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && isAssetLink(linkEntity) && /*#__PURE__*/ _react.createElement(_FetchingWrappedAssetCard.FetchingWrappedAssetCard, {
258
262
  sdk: props.sdk,
259
263
  locale: props.sdk.field.locale,
260
264
  assetId: linkEntity.sys.id,
261
265
  isDisabled: true,
262
266
  isSelected: false
263
- }))) : _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && _react.createElement(_f36components.TextLink, {
267
+ }))) : /*#__PURE__*/ _react.createElement("div", null, linkType === _richtexttypes.INLINES.ENTRY_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
264
268
  testId: "entity-selection-link",
265
269
  onClick: selectEntry
266
- }, "Select entry"), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && _react.createElement(_f36components.TextLink, {
270
+ }, "Select entry"), linkType === _richtexttypes.INLINES.RESOURCE_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
267
271
  testId: "entity-selection-link",
268
272
  onClick: selectResourceEntry
269
- }, "Select entry"), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && _react.createElement(_f36components.TextLink, {
273
+ }, "Select entry"), linkType === _richtexttypes.INLINES.ASSET_HYPERLINK && /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
270
274
  testId: "entity-selection-link",
271
275
  onClick: selectAsset
272
- }, "Select asset"))))), _react.createElement(_f36components.ModalControls, null, _react.createElement(_f36components.Button, {
276
+ }, "Select asset"))))), /*#__PURE__*/ _react.createElement(_f36components.ModalControls, null, /*#__PURE__*/ _react.createElement(_f36components.Button, {
273
277
  type: "button",
274
278
  onClick: ()=>props.onClose(null),
275
279
  variant: "secondary",
276
280
  testId: "cancel-cta",
277
281
  size: "small"
278
- }, "Cancel"), _react.createElement(_f36components.Button, {
282
+ }, "Cancel"), /*#__PURE__*/ _react.createElement(_f36components.Button, {
279
283
  type: "submit",
280
284
  variant: "positive",
281
285
  size: "small",
@@ -311,8 +315,8 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
311
315
  shouldCloseOnEscapePress: true,
312
316
  shouldCloseOnOverlayClick: true,
313
317
  allowHeightOverflow: true
314
- }, ({ onClose })=>{
315
- return _react.createElement(HyperlinkModal, {
318
+ }, ({ onClose })=>{
319
+ return /*#__PURE__*/ _react.createElement(HyperlinkModal, {
316
320
  linkTarget: linkTarget,
317
321
  linkText: currentLinkText,
318
322
  linkType: linkType,
@@ -328,7 +332,7 @@ async function addOrEditLink(editor, sdk, logAction, targetPath) {
328
332
  logAction(isEditing ? 'cancelEditHyperlinkDialog' : 'cancelCreateHyperlinkDialog');
329
333
  return;
330
334
  }
331
- const { linkText: text , linkTarget: url , linkType: type , linkEntity: target } = data;
335
+ const { linkText: text, linkTarget: url, linkType: type, linkEntity: target } = data;
332
336
  (0, _internal.withoutNormalizing)(editor, ()=>{
333
337
  (0, _editor.insertLink)(editor, {
334
338
  text,
@@ -1,24 +1,24 @@
1
- "use strict";
1
+ /* eslint-disable react/no-unknown-property */ /** @jsx jsx */ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _testutils = require("../../../test-utils");
6
6
  describe('normalization', ()=>{
7
7
  it('removes empty links from the document structure', ()=>{
8
- const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link"), (0, _testutils.jsx)("hlink", {
8
+ const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
9
9
  uri: "https://link.com"
10
- })), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "asset"), (0, _testutils.jsx)("hlink", {
10
+ })), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "asset"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
11
11
  asset: "asset-id"
12
- })), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "entry"), (0, _testutils.jsx)("hlink", {
12
+ })), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "entry"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
13
13
  entry: "entry-id"
14
- })), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "resource"), (0, _testutils.jsx)("hlink", {
14
+ })), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "resource"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
15
15
  resource: "resource-urn"
16
- })), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "explicit empty link"), (0, _testutils.jsx)("hlink", {
16
+ })), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "explicit empty link"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
17
17
  uri: "https://link.com"
18
- }, '')), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link with empty space"), (0, _testutils.jsx)("hlink", {
18
+ }, '')), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link with empty space"), /*#__PURE__*/ (0, _testutils.jsx)("hlink", {
19
19
  uri: "https://link.com"
20
20
  }, " ")));
21
- const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "asset")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "entry")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "resource")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "explicit empty link")), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null, "link with empty space")));
21
+ const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "asset")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "entry")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "resource")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "explicit empty link")), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null, "link with empty space")));
22
22
  (0, _testutils.assertOutput)({
23
23
  input,
24
24
  expected
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "EntityHyperlink", {
8
8
  return EntityHyperlink;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _f36components = require("@contentful/f36-components");
13
13
  const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
14
14
  const _internal = require("../../../internal");
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
38
38
  if (cache && cache.has(obj)) {
39
39
  return cache.get(obj);
40
40
  }
41
- var newObj = {};
41
+ var newObj = {
42
+ __proto__: null
43
+ };
42
44
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
45
  for(var key in obj){
44
46
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -59,8 +61,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
59
61
  function EntityHyperlink(props) {
60
62
  const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
61
63
  const sdk = (0, _SdkProvider.useSdkContext)();
62
- const { target } = props.element.data;
63
- const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
64
+ const { target } = props.element.data;
65
+ const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
64
66
  const tooltipContent = (0, _useEntityInfo.useEntityInfo)({
65
67
  target,
66
68
  sdk,
@@ -79,12 +81,12 @@ function EntityHyperlink(props) {
79
81
  (0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p.path);
80
82
  }
81
83
  }
82
- return _react.createElement(_f36components.Tooltip, {
84
+ return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
83
85
  content: tooltipContent,
84
86
  targetWrapperClassName: _styles.styles.hyperlinkWrapper,
85
87
  placement: "bottom",
86
88
  maxWidth: "auto"
87
- }, _react.createElement(_f36components.TextLink, {
89
+ }, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
88
90
  as: "a",
89
91
  onClick: handleClick,
90
92
  className: _styles.styles.hyperlink,
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ResourceHyperlink", {
8
8
  return ResourceHyperlink;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _f36components = require("@contentful/f36-components");
13
13
  const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
14
14
  const _internal = require("../../../internal");
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
38
38
  if (cache && cache.has(obj)) {
39
39
  return cache.get(obj);
40
40
  }
41
- var newObj = {};
41
+ var newObj = {
42
+ __proto__: null
43
+ };
42
44
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
45
  for(var key in obj){
44
46
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -59,8 +61,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
59
61
  function ResourceHyperlink(props) {
60
62
  const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
61
63
  const sdk = (0, _SdkProvider.useSdkContext)();
62
- const { target } = props.element.data;
63
- const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
64
+ const { target } = props.element.data;
65
+ const { onEntityFetchComplete } = (0, _linkstracking.useLinkTracking)();
64
66
  const tooltipContent = (0, _useResourceEntityInfo.useResourceEntityInfo)({
65
67
  target,
66
68
  onEntityFetchComplete
@@ -78,12 +80,12 @@ function ResourceHyperlink(props) {
78
80
  (0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p.path);
79
81
  }
80
82
  }
81
- return _react.createElement(_f36components.Tooltip, {
83
+ return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
82
84
  content: tooltipContent,
83
85
  targetWrapperClassName: _styles.styles.hyperlinkWrapper,
84
86
  placement: "bottom",
85
87
  maxWidth: "auto"
86
- }, _react.createElement(_f36components.TextLink, {
88
+ }, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
87
89
  as: "a",
88
90
  onClick: handleClick,
89
91
  className: _styles.styles.hyperlink,
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ToolbarHyperlinkButton", {
8
8
  return ToolbarHyperlinkButton;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _f36icons = require("@contentful/f36-icons");
13
13
  const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
14
14
  const _editor = require("../../../helpers/editor");
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
36
36
  if (cache && cache.has(obj)) {
37
37
  return cache.get(obj);
38
38
  }
39
- var newObj = {};
39
+ var newObj = {
40
+ __proto__: null
41
+ };
40
42
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
43
  for(var key in obj){
42
44
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -68,11 +70,11 @@ function ToolbarHyperlinkButton(props) {
68
70
  }
69
71
  }
70
72
  if (!editor) return null;
71
- return _react.createElement(_ToolbarButton.ToolbarButton, {
73
+ return /*#__PURE__*/ _react.createElement(_ToolbarButton.ToolbarButton, {
72
74
  title: "Hyperlink",
73
75
  testId: "hyperlink-toolbar-button",
74
76
  onClick: handleClick,
75
77
  isActive: isActive,
76
78
  isDisabled: props.isDisabled
77
- }, _react.createElement(_f36icons.LinkIcon, null));
79
+ }, /*#__PURE__*/ _react.createElement(_f36icons.LinkIcon, null));
78
80
  }
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "UrlHyperlink", {
8
8
  return UrlHyperlink;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _f36components = require("@contentful/f36-components");
13
13
  const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
14
14
  const _internal = require("../../../internal");
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
36
36
  if (cache && cache.has(obj)) {
37
37
  return cache.get(obj);
38
38
  }
39
- var newObj = {};
39
+ var newObj = {
40
+ __proto__: null
41
+ };
40
42
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
43
  for(var key in obj){
42
44
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,7 +59,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
57
59
  function UrlHyperlink(props) {
58
60
  const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
59
61
  const sdk = (0, _SdkProvider.useSdkContext)();
60
- const { uri } = props.element.data;
62
+ const { uri } = props.element.data;
61
63
  function handleClick(event) {
62
64
  event.preventDefault();
63
65
  event.stopPropagation();
@@ -71,13 +73,13 @@ function UrlHyperlink(props) {
71
73
  });
72
74
  (0, _HyperlinkModal.addOrEditLink)(editor, sdk, editor.tracking.onViewportAction, p?.path);
73
75
  }
74
- return _react.createElement(_f36components.Tooltip, {
76
+ return /*#__PURE__*/ _react.createElement(_f36components.Tooltip, {
75
77
  usePortal: true,
76
78
  content: uri,
77
79
  targetWrapperClassName: _styles.styles.hyperlinkWrapper,
78
80
  placement: "bottom",
79
81
  maxWidth: "min-content"
80
- }, _react.createElement(_f36components.TextLink, {
82
+ }, /*#__PURE__*/ _react.createElement(_f36components.TextLink, {
81
83
  as: "a",
82
84
  href: uri,
83
85
  rel: "noopener noreferrer",
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "styles", {
8
8
  return styles;
9
9
  }
10
10
  });
11
- const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
11
+ const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
12
12
  const _emotion = require("emotion");
13
13
  function _interop_require_default(obj) {
14
14
  return obj && obj.__esModule ? obj : {
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "createHyperlinkPlugin", {
8
8
  return createHyperlinkPlugin;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _richtexttypes = require("@contentful/rich-text-types");
13
- const _ishotkey = _interop_require_default(require("is-hotkey"));
13
+ const _ishotkey = /*#__PURE__*/ _interop_require_default(require("is-hotkey"));
14
14
  const _editor = require("../../helpers/editor");
15
15
  const _transformers = require("../../helpers/transformers");
16
16
  const _EntityHyperlink = require("./components/EntityHyperlink");
@@ -44,7 +44,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
44
44
  if (cache && cache.has(obj)) {
45
45
  return cache.get(obj);
46
46
  }
47
- var newObj = {};
47
+ var newObj = {
48
+ __proto__: null
49
+ };
48
50
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
49
51
  for(var key in obj){
50
52
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -66,7 +68,7 @@ const isAnchor = (element)=>element.nodeName === 'A' && !!element.getAttribute('
66
68
  const isEntryAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Entry';
67
69
  const isAssetAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-link-type') === 'Asset';
68
70
  const isResourceAnchor = (element)=>element.nodeName === 'A' && element.getAttribute('data-resource-link-type') === 'Contentful:Entry';
69
- const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
71
+ const buildHyperlinkEventHandler = (sdk)=>(editor, { options: { hotkey } })=>{
70
72
  return (event)=>{
71
73
  if (!editor.selection) {
72
74
  return;
@@ -119,6 +121,7 @@ const createHyperlinkPlugin = (sdk)=>{
119
121
  onKeyDown: buildHyperlinkEventHandler(sdk)
120
122
  },
121
123
  plugins: [
124
+ // URL Hyperlink
122
125
  {
123
126
  ...common,
124
127
  key: _richtexttypes.INLINES.HYPERLINK,
@@ -136,6 +139,7 @@ const createHyperlinkPlugin = (sdk)=>{
136
139
  getNode: getNodeOfType(_richtexttypes.INLINES.HYPERLINK)
137
140
  }
138
141
  },
142
+ // Entry Hyperlink
139
143
  {
140
144
  ...common,
141
145
  key: _richtexttypes.INLINES.ENTRY_HYPERLINK,
@@ -153,6 +157,7 @@ const createHyperlinkPlugin = (sdk)=>{
153
157
  getNode: getNodeOfType(_richtexttypes.INLINES.ENTRY_HYPERLINK)
154
158
  }
155
159
  },
160
+ // Resource Hyperlink
156
161
  {
157
162
  ...common,
158
163
  key: _richtexttypes.INLINES.RESOURCE_HYPERLINK,
@@ -170,6 +175,7 @@ const createHyperlinkPlugin = (sdk)=>{
170
175
  getNode: getNodeOfType(_richtexttypes.INLINES.RESOURCE_HYPERLINK)
171
176
  }
172
177
  },
178
+ // Asset Hyperlink
173
179
  {
174
180
  ...common,
175
181
  key: _richtexttypes.INLINES.ASSET_HYPERLINK,
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "useEntityInfo", {
11
11
  const _react = require("react");
12
12
  const _fieldeditorshared = require("@contentful/field-editor-shared");
13
13
  const _utils = require("./utils");
14
- async function fetchAllData({ sdk , entityId , entityType , localeCode , defaultLocaleCode }) {
14
+ async function fetchAllData({ sdk, entityId, entityType, localeCode, defaultLocaleCode }) {
15
15
  let contentType;
16
16
  const getEntity = entityType === 'Entry' ? sdk.space.getEntry : sdk.space.getAsset;
17
17
  const entity = await getEntity(entityId);
@@ -20,6 +20,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
20
20
  contentType = sdk.space.getCachedContentTypes().find((ct)=>ct.sys.id === contentTypeId);
21
21
  }
22
22
  const entityTitle = entityType === 'Entry' ? _fieldeditorshared.entityHelpers.getEntryTitle({
23
+ //@ts-expect-error
23
24
  entry: entity,
24
25
  contentType,
25
26
  localeCode,
@@ -32,12 +33,14 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
32
33
  defaultTitle: 'Untitled'
33
34
  });
34
35
  const entityDescription = _fieldeditorshared.entityHelpers.getEntityDescription({
36
+ // @ts-expect-error
35
37
  entity,
36
38
  contentType,
37
39
  localeCode,
38
40
  defaultLocaleCode
39
41
  });
40
42
  const jobs = await sdk.space.getEntityScheduledActions(entityType, entityId);
43
+ // @ts-expect-error
41
44
  const entityStatus = _fieldeditorshared.entityHelpers.getEntryStatus(entity.sys);
42
45
  return {
43
46
  jobs,
@@ -48,7 +51,7 @@ async function fetchAllData({ sdk , entityId , entityType , localeCode , default
48
51
  contentTypeName: contentType ? contentType.name : ''
49
52
  };
50
53
  }
51
- function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
54
+ function useRequestStatus({ sdk, target, onEntityFetchComplete }) {
52
55
  const [requestStatus, setRequestStatus] = (0, _react.useState)({
53
56
  type: 'loading'
54
57
  });
@@ -84,7 +87,7 @@ function useRequestStatus({ sdk , target , onEntityFetchComplete }) {
84
87
  }
85
88
  function useEntityInfo(props) {
86
89
  const status = useRequestStatus(props);
87
- const { linkType } = props.target.sys;
90
+ const { linkType } = props.target.sys;
88
91
  if (status.type === 'loading') {
89
92
  return `Loading ${linkType.toLowerCase()}...`;
90
93
  }
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "useResourceEntityInfo", {
8
8
  return useResourceEntityInfo;
9
9
  }
10
10
  });
11
- const _react = _interop_require_wildcard(require("react"));
11
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
12
  const _fieldeditorreference = require("@contentful/field-editor-reference");
13
- const _utils = require("./utils");
13
+ const _utils = require("../../plugins/shared/utils");
14
14
  function _getRequireWildcardCache(nodeInterop) {
15
15
  if (typeof WeakMap !== "function") return null;
16
16
  var cacheBabelInterop = new WeakMap();
@@ -32,7 +32,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
32
32
  if (cache && cache.has(obj)) {
33
33
  return cache.get(obj);
34
34
  }
35
- var newObj = {};
35
+ var newObj = {
36
+ __proto__: null
37
+ };
36
38
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
39
  for(var key in obj){
38
40
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -50,8 +52,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
50
52
  }
51
53
  return newObj;
52
54
  }
53
- function useResourceEntityInfo({ onEntityFetchComplete , target }) {
54
- const { data , error , status } = (0, _fieldeditorreference.useResource)(target.sys.linkType, target.sys.urn);
55
+ function useResourceEntityInfo({ onEntityFetchComplete, target }) {
56
+ const { data, error, status } = (0, _fieldeditorreference.useResource)(target.sys.linkType, target.sys.urn);
55
57
  _react.useEffect(()=>{
56
58
  if (status === 'success') {
57
59
  onEntityFetchComplete?.();
@@ -9,35 +9,27 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- hasText: function() {
13
- return hasText;
14
- },
15
- truncateTitle: function() {
16
- return truncateTitle;
17
- },
18
12
  getEntityInfo: function() {
19
13
  return getEntityInfo;
14
+ },
15
+ hasText: function() {
16
+ return hasText;
20
17
  }
21
18
  });
22
19
  const _fieldeditorreference = require("@contentful/field-editor-reference");
23
20
  const _platecommon = require("@udecode/plate-common");
24
21
  const _queries = require("../../internal/queries");
22
+ const _utils = require("../../plugins/shared/utils");
25
23
  const hasText = (editor, entry)=>{
26
24
  const [node, path] = entry;
27
25
  return !(0, _platecommon.isAncestorEmpty)(editor, node) && (0, _queries.getText)(editor, path).trim() !== '';
28
26
  };
29
- function truncateTitle(str, length) {
30
- if (typeof str === 'string' && str.length > length) {
31
- return str && str.substr(0, length + 1).replace(/(\s+\S(?=\S)|\s*)\.?.$/, '…');
32
- }
33
- return str;
34
- }
35
27
  function getEntityInfo(data) {
36
28
  if (!data) {
37
29
  return '';
38
30
  }
39
- const { entityTitle , contentTypeName , entityStatus , jobs } = data;
40
- const title = truncateTitle(entityTitle, 60) || 'Untitled';
31
+ const { entityTitle, contentTypeName, entityStatus, jobs } = data;
32
+ const title = (0, _utils.truncateTitle)(entityTitle, 60) || 'Untitled';
41
33
  const scheduledActions = jobs.length > 0 ? (0, _fieldeditorreference.getScheduleTooltipContent)({
42
34
  job: jobs[0],
43
35
  jobsCount: jobs.length