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

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 (376) hide show
  1. package/dist/cjs/ContentfulEditorProvider.js +8 -8
  2. package/dist/cjs/RichTextEditor.js +20 -22
  3. package/dist/cjs/RichTextEditor.styles.js +1 -2
  4. package/dist/cjs/SdkProvider.js +5 -7
  5. package/dist/cjs/SyncEditorChanges.js +6 -15
  6. package/dist/cjs/Toolbar/_tests_/toolbar.test.js +15 -17
  7. package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +9 -13
  8. package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +8 -10
  9. package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
  10. package/dist/cjs/Toolbar/index.js +30 -33
  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 +6 -8
  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 +0 -1
  19. package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +38 -43
  20. package/dist/cjs/dialogs/openRichTextDialog.js +4 -6
  21. package/dist/cjs/dialogs/renderRichTextDialog.js +4 -6
  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 +44 -53
  26. package/dist/cjs/helpers/environment.js +3 -3
  27. package/dist/cjs/helpers/formatDateAndTime.js +4 -5
  28. package/dist/cjs/helpers/getAllowedResourcesForNodeType.js +5 -22
  29. package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +5 -29
  30. package/dist/cjs/helpers/nodeFactory.js +6 -6
  31. package/dist/cjs/helpers/sdkNavigatorSlideIn.js +6 -14
  32. package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +2 -3
  33. package/dist/cjs/helpers/toSlateValue.js +3 -14
  34. package/dist/cjs/helpers/transformers.js +5 -5
  35. package/dist/cjs/helpers/validations.js +9 -12
  36. package/dist/cjs/index.js +5 -7
  37. package/dist/cjs/internal/constants.js +2 -4
  38. package/dist/cjs/internal/hooks.js +7 -9
  39. package/dist/cjs/internal/misc.js +12 -15
  40. package/dist/cjs/internal/queries.js +108 -115
  41. package/dist/cjs/internal/transforms.js +48 -51
  42. package/dist/cjs/internal/types/editor.js +1 -3
  43. package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +3 -4
  44. package/dist/cjs/plugins/Break/createResetNodePlugin.js +0 -1
  45. package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +3 -3
  46. package/dist/cjs/plugins/CommandPalette/components/CommandList.js +33 -35
  47. package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +1 -1
  48. package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +5 -7
  49. package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -7
  50. package/dist/cjs/plugins/CommandPalette/onKeyDown.js +1 -6
  51. package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +4 -6
  52. package/dist/cjs/plugins/CommandPalette/useCommands.js +3 -3
  53. package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +0 -2
  54. package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
  55. package/dist/cjs/plugins/DragAndDrop/index.js +1 -9
  56. package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +8 -10
  57. package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
  58. package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +17 -19
  59. package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +7 -9
  60. package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +5 -5
  61. package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +11 -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 +10 -13
  65. package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +29 -23
  66. package/dist/cjs/plugins/Heading/createHeadingPlugin.js +2 -7
  67. package/dist/cjs/plugins/Hr/index.js +14 -19
  68. package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +28 -32
  69. package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
  70. package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +8 -10
  71. package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +17 -23
  72. package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +8 -10
  73. package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +4 -6
  74. package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +6 -8
  75. package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
  76. package/dist/cjs/plugins/Hyperlink/components/styles.js +1 -1
  77. package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -10
  78. package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -6
  79. package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +4 -6
  80. package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
  81. package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +13 -13
  82. package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +25 -29
  83. package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +22 -22
  84. package/dist/cjs/plugins/List/components/List.js +7 -9
  85. package/dist/cjs/plugins/List/components/ListItem.js +4 -6
  86. package/dist/cjs/plugins/List/components/ToolbarListButton.js +5 -7
  87. package/dist/cjs/plugins/List/createListPlugin.js +0 -4
  88. package/dist/cjs/plugins/List/insertListBreak.js +4 -13
  89. package/dist/cjs/plugins/List/insertListFragment.js +5 -18
  90. package/dist/cjs/plugins/List/onKeyDownList.js +6 -8
  91. package/dist/cjs/plugins/List/transforms/insertListItem.js +2 -17
  92. package/dist/cjs/plugins/List/transforms/moveListItemDown.js +2 -8
  93. package/dist/cjs/plugins/List/transforms/moveListItems.js +2 -7
  94. package/dist/cjs/plugins/List/transforms/moveListItems.test.js +14 -15
  95. package/dist/cjs/plugins/List/transforms/toggleList.js +3 -8
  96. package/dist/cjs/plugins/List/transforms/toggleList.spec.js +28 -28
  97. package/dist/cjs/plugins/List/transforms/unwrapList.js +2 -7
  98. package/dist/cjs/plugins/List/utils.js +11 -12
  99. package/dist/cjs/plugins/List/withList.js +2 -6
  100. package/dist/cjs/plugins/Marks/Bold.js +7 -9
  101. package/dist/cjs/plugins/Marks/Code.js +7 -15
  102. package/dist/cjs/plugins/Marks/Italic.js +7 -9
  103. package/dist/cjs/plugins/Marks/Subscript.js +8 -10
  104. package/dist/cjs/plugins/Marks/Superscript.js +8 -10
  105. package/dist/cjs/plugins/Marks/Underline.js +4 -6
  106. package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +7 -9
  107. package/dist/cjs/plugins/Marks/helpers.js +5 -5
  108. package/dist/cjs/plugins/Normalizer/baseRules.js +0 -2
  109. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
  110. package/dist/cjs/plugins/Normalizer/utils.js +3 -4
  111. package/dist/cjs/plugins/Normalizer/withNormalizer.js +3 -23
  112. package/dist/cjs/plugins/Paragraph/Paragraph.js +4 -6
  113. package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
  114. package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +2 -3
  115. package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +6 -9
  116. package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
  117. package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +0 -9
  118. package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
  119. package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
  120. package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
  121. package/dist/cjs/plugins/Quote/components/Quote.js +4 -6
  122. package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +4 -6
  123. package/dist/cjs/plugins/Quote/createQuotePlugin.js +0 -1
  124. package/dist/cjs/plugins/Quote/toggleQuote.js +5 -5
  125. package/dist/cjs/plugins/Quote/withQuote.js +2 -4
  126. package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
  127. package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
  128. package/dist/cjs/plugins/Table/__tests__/helpers.test.js +4 -4
  129. package/dist/cjs/plugins/Table/actions/addColumn.js +4 -5
  130. package/dist/cjs/plugins/Table/actions/addRow.js +3 -6
  131. package/dist/cjs/plugins/Table/components/Cell.js +5 -7
  132. package/dist/cjs/plugins/Table/components/HeaderCell.js +5 -7
  133. package/dist/cjs/plugins/Table/components/Row.js +4 -6
  134. package/dist/cjs/plugins/Table/components/Table.js +6 -8
  135. package/dist/cjs/plugins/Table/components/TableActions.js +16 -19
  136. package/dist/cjs/plugins/Table/components/ToolbarButton.js +4 -7
  137. package/dist/cjs/plugins/Table/createTablePlugin.js +1 -11
  138. package/dist/cjs/plugins/Table/helpers.js +12 -16
  139. package/dist/cjs/plugins/Table/insertTableFragment.js +2 -15
  140. package/dist/cjs/plugins/Table/onKeyDownTable.js +2 -11
  141. package/dist/cjs/plugins/Table/tableTracking.js +6 -6
  142. package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
  143. package/dist/cjs/plugins/Text/createTextPlugin.js +5 -22
  144. package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -5
  145. package/dist/cjs/plugins/Tracking/utils.js +3 -6
  146. package/dist/cjs/plugins/Voids/createVoidsPlugin.js +0 -5
  147. package/dist/cjs/plugins/Voids/transformVoid.js +0 -1
  148. package/dist/cjs/plugins/index.js +3 -15
  149. package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +10 -12
  150. package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +6 -16
  151. package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +8 -10
  152. package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +5 -9
  153. package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +11 -13
  154. package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +12 -14
  155. package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +11 -14
  156. package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +4 -8
  157. package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +6 -10
  158. package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -5
  159. package/dist/cjs/plugins/shared/ToolbarButton.js +6 -8
  160. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -10
  161. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +6 -11
  162. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +13 -15
  163. package/dist/cjs/plugins/shared/utils.js +1 -4
  164. package/dist/cjs/test-utils/assertOutput.js +0 -1
  165. package/dist/cjs/test-utils/hyperscript.d.js +0 -1
  166. package/dist/cjs/test-utils/randomId.js +1 -3
  167. package/dist/cjs/test-utils/validation.js +5 -8
  168. package/dist/esm/ContentfulEditorProvider.js +1 -4
  169. package/dist/esm/RichTextEditor.js +13 -13
  170. package/dist/esm/RichTextEditor.styles.js +0 -1
  171. package/dist/esm/SdkProvider.js +2 -2
  172. package/dist/esm/SyncEditorChanges.js +3 -18
  173. package/dist/esm/Toolbar/_tests_/toolbar.test.js +12 -12
  174. package/dist/esm/Toolbar/components/EmbedEntityWidget.js +7 -9
  175. package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +6 -6
  176. package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
  177. package/dist/esm/Toolbar/index.js +27 -28
  178. package/dist/esm/__fixtures__/FakeSdk.js +3 -3
  179. package/dist/esm/constants/Schema.js +0 -1
  180. package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +31 -34
  181. package/dist/esm/dialogs/openRichTextDialog.js +2 -2
  182. package/dist/esm/dialogs/renderRichTextDialog.js +2 -2
  183. package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +10 -10
  184. package/dist/esm/helpers/callbacks.js +1 -1
  185. package/dist/esm/helpers/config.js +1 -9
  186. package/dist/esm/helpers/editor.js +6 -22
  187. package/dist/esm/helpers/extractNodes.js +1 -3
  188. package/dist/esm/helpers/formatDateAndTime.js +2 -11
  189. package/dist/esm/helpers/getAllowedResourcesForNodeType.js +2 -19
  190. package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +2 -26
  191. package/dist/esm/helpers/sdkNavigatorSlideIn.js +6 -20
  192. package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +0 -1
  193. package/dist/esm/helpers/toSlateValue.js +3 -17
  194. package/dist/esm/helpers/validations.js +1 -5
  195. package/dist/esm/internal/misc.js +2 -23
  196. package/dist/esm/internal/queries.js +2 -11
  197. package/dist/esm/internal/transforms.js +3 -14
  198. package/dist/esm/internal/types/editor.js +1 -3
  199. package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +3 -4
  200. package/dist/esm/plugins/Break/createResetNodePlugin.js +0 -1
  201. package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +3 -3
  202. package/dist/esm/plugins/CommandPalette/components/CommandList.js +30 -30
  203. package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +2 -2
  204. package/dist/esm/plugins/CommandPalette/createCommandPalettePlugin.js +1 -11
  205. package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +0 -2
  206. package/dist/esm/plugins/CommandPalette/onKeyDown.js +0 -5
  207. package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
  208. package/dist/esm/plugins/CommandPalette/useCommands.js +3 -3
  209. package/dist/esm/plugins/CommandPalette/utils/fetchEntries.js +0 -2
  210. package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +1 -6
  211. package/dist/esm/plugins/DragAndDrop/index.js +1 -9
  212. package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -6
  213. package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +14 -14
  214. package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +5 -5
  215. package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +4 -4
  216. package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +9 -9
  217. package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +4 -4
  218. package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +32 -32
  219. package/dist/esm/plugins/Heading/components/Heading.js +7 -8
  220. package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +26 -18
  221. package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -6
  222. package/dist/esm/plugins/Hr/index.js +5 -8
  223. package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +23 -25
  224. package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +8 -8
  225. package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +6 -6
  226. package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +15 -19
  227. package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +6 -6
  228. package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +2 -2
  229. package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +4 -4
  230. package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -5
  231. package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -6
  232. package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
  233. package/dist/esm/plugins/Hyperlink/utils.js +1 -1
  234. package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +13 -13
  235. package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +25 -29
  236. package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +22 -22
  237. package/dist/esm/plugins/List/components/List.js +1 -1
  238. package/dist/esm/plugins/List/components/ListItem.js +1 -1
  239. package/dist/esm/plugins/List/components/ToolbarListButton.js +3 -3
  240. package/dist/esm/plugins/List/createListPlugin.js +0 -4
  241. package/dist/esm/plugins/List/insertListBreak.js +4 -13
  242. package/dist/esm/plugins/List/insertListFragment.js +5 -18
  243. package/dist/esm/plugins/List/onKeyDownList.js +5 -7
  244. package/dist/esm/plugins/List/transforms/insertListItem.js +3 -20
  245. package/dist/esm/plugins/List/transforms/moveListItemDown.js +2 -8
  246. package/dist/esm/plugins/List/transforms/moveListItems.js +2 -7
  247. package/dist/esm/plugins/List/transforms/moveListItems.test.js +14 -15
  248. package/dist/esm/plugins/List/transforms/toggleList.js +3 -8
  249. package/dist/esm/plugins/List/transforms/toggleList.spec.js +28 -28
  250. package/dist/esm/plugins/List/transforms/unwrapList.js +2 -7
  251. package/dist/esm/plugins/List/utils.js +2 -7
  252. package/dist/esm/plugins/List/withList.js +2 -6
  253. package/dist/esm/plugins/Marks/Bold.js +2 -2
  254. package/dist/esm/plugins/Marks/Code.js +2 -8
  255. package/dist/esm/plugins/Marks/Italic.js +2 -2
  256. package/dist/esm/plugins/Marks/Subscript.js +2 -2
  257. package/dist/esm/plugins/Marks/Superscript.js +2 -2
  258. package/dist/esm/plugins/Marks/Underline.js +2 -2
  259. package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +4 -4
  260. package/dist/esm/plugins/Marks/helpers.js +1 -1
  261. package/dist/esm/plugins/Normalizer/baseRules.js +0 -4
  262. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +12 -12
  263. package/dist/esm/plugins/Normalizer/utils.js +0 -1
  264. package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -22
  265. package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
  266. package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +32 -32
  267. package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +1 -2
  268. package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +3 -9
  269. package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +0 -2
  270. package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +1 -27
  271. package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +2 -17
  272. package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +1 -13
  273. package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +21 -21
  274. package/dist/esm/plugins/Quote/components/Quote.js +1 -1
  275. package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +2 -2
  276. package/dist/esm/plugins/Quote/createQuotePlugin.js +0 -1
  277. package/dist/esm/plugins/Quote/shouldResetQuote.js +1 -6
  278. package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
  279. package/dist/esm/plugins/Quote/withQuote.js +2 -4
  280. package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +0 -1
  281. package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +22 -22
  282. package/dist/esm/plugins/Table/__tests__/helpers.test.js +4 -4
  283. package/dist/esm/plugins/Table/actions/addColumn.js +1 -2
  284. package/dist/esm/plugins/Table/actions/addRow.js +0 -3
  285. package/dist/esm/plugins/Table/components/Cell.js +2 -2
  286. package/dist/esm/plugins/Table/components/HeaderCell.js +2 -2
  287. package/dist/esm/plugins/Table/components/Row.js +1 -1
  288. package/dist/esm/plugins/Table/components/Table.js +3 -3
  289. package/dist/esm/plugins/Table/components/TableActions.js +11 -12
  290. package/dist/esm/plugins/Table/components/ToolbarButton.js +2 -3
  291. package/dist/esm/plugins/Table/createTablePlugin.js +1 -11
  292. package/dist/esm/plugins/Table/helpers.js +1 -10
  293. package/dist/esm/plugins/Table/insertTableFragment.js +2 -15
  294. package/dist/esm/plugins/Table/onKeyDownTable.js +2 -11
  295. package/dist/esm/plugins/Table/tableTracking.js +6 -6
  296. package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +17 -19
  297. package/dist/esm/plugins/Text/createTextPlugin.js +5 -22
  298. package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -2
  299. package/dist/esm/plugins/Tracking/utils.js +0 -1
  300. package/dist/esm/plugins/Voids/createVoidsPlugin.js +0 -5
  301. package/dist/esm/plugins/Voids/transformVoid.js +1 -4
  302. package/dist/esm/plugins/index.js +0 -12
  303. package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +5 -5
  304. package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -15
  305. package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +5 -5
  306. package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -8
  307. package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +8 -8
  308. package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +9 -9
  309. package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +8 -9
  310. package/dist/esm/plugins/shared/LinkedBlockWrapper.js +3 -7
  311. package/dist/esm/plugins/shared/LinkedInlineWrapper.js +3 -5
  312. package/dist/esm/plugins/shared/ResourceNewBadge.js +1 -1
  313. package/dist/esm/plugins/shared/ToolbarButton.js +3 -3
  314. package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +2 -5
  315. package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +2 -5
  316. package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +8 -8
  317. package/dist/esm/plugins/shared/utils.js +1 -4
  318. package/dist/esm/test-utils/assertOutput.js +0 -1
  319. package/dist/esm/test-utils/hyperscript.d.js +0 -1
  320. package/dist/esm/test-utils/jsx.js +1 -5
  321. package/dist/esm/test-utils/randomId.js +1 -3
  322. package/dist/esm/test-utils/setEmptyDataAttribute.js +1 -4
  323. package/dist/esm/test-utils/validation.js +4 -7
  324. package/dist/types/RichTextEditor.d.ts +2 -3
  325. package/dist/types/Toolbar/components/EmbedEntityWidget.d.ts +1 -2
  326. package/dist/types/Toolbar/components/EmbeddedEntityDropdownButton.d.ts +1 -1
  327. package/dist/types/Toolbar/components/StickyToolbarWrapper.d.ts +2 -2
  328. package/dist/types/Toolbar/index.d.ts +1 -2
  329. package/dist/types/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +4 -4
  330. package/dist/types/dialogs/renderRichTextDialog.d.ts +1 -2
  331. package/dist/types/plugins/CommandPalette/components/CommandList.d.ts +1 -2
  332. package/dist/types/plugins/CommandPalette/components/CommandPrompt.d.ts +1 -2
  333. package/dist/types/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +1 -2
  334. package/dist/types/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -1
  335. package/dist/types/plugins/EmbeddedEntityInline/LinkedEntityInline.d.ts +1 -2
  336. package/dist/types/plugins/EmbeddedResourceBlock/LinkedResourceBlock.d.ts +1 -2
  337. package/dist/types/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.d.ts +1 -1
  338. package/dist/types/plugins/EmbeddedResourceInline/LinkedResourceInline.d.ts +1 -2
  339. package/dist/types/plugins/Heading/components/Heading.d.ts +6 -6
  340. package/dist/types/plugins/Heading/components/ToolbarHeadingButton.d.ts +1 -2
  341. package/dist/types/plugins/Hr/index.d.ts +2 -2
  342. package/dist/types/plugins/Hyperlink/HyperlinkModal.d.ts +1 -2
  343. package/dist/types/plugins/Hyperlink/components/EntityHyperlink.d.ts +1 -2
  344. package/dist/types/plugins/Hyperlink/components/LinkPopover.d.ts +1 -1
  345. package/dist/types/plugins/Hyperlink/components/ResourceHyperlink.d.ts +1 -2
  346. package/dist/types/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +1 -2
  347. package/dist/types/plugins/Hyperlink/components/UrlHyperlink.d.ts +1 -2
  348. package/dist/types/plugins/List/components/List.d.ts +2 -3
  349. package/dist/types/plugins/List/components/ListItem.d.ts +1 -2
  350. package/dist/types/plugins/List/components/ToolbarListButton.d.ts +1 -2
  351. package/dist/types/plugins/Marks/Bold.d.ts +2 -3
  352. package/dist/types/plugins/Marks/Code.d.ts +3 -4
  353. package/dist/types/plugins/Marks/Italic.d.ts +2 -3
  354. package/dist/types/plugins/Marks/Subscript.d.ts +3 -4
  355. package/dist/types/plugins/Marks/Superscript.d.ts +3 -4
  356. package/dist/types/plugins/Marks/Underline.d.ts +2 -3
  357. package/dist/types/plugins/Marks/components/MarkToolbarButton.d.ts +1 -1
  358. package/dist/types/plugins/Paragraph/Paragraph.d.ts +1 -2
  359. package/dist/types/plugins/Quote/components/Quote.d.ts +1 -2
  360. package/dist/types/plugins/Quote/components/ToolbarQuoteButton.d.ts +1 -2
  361. package/dist/types/plugins/Table/components/Cell.d.ts +1 -2
  362. package/dist/types/plugins/Table/components/HeaderCell.d.ts +1 -2
  363. package/dist/types/plugins/Table/components/Row.d.ts +1 -2
  364. package/dist/types/plugins/Table/components/Table.d.ts +1 -2
  365. package/dist/types/plugins/Table/components/TableActions.d.ts +1 -2
  366. package/dist/types/plugins/Table/components/ToolbarButton.d.ts +1 -2
  367. package/dist/types/plugins/shared/EmbeddedBlockToolbarIcon.d.ts +1 -2
  368. package/dist/types/plugins/shared/EmbeddedInlineToolbarIcon.d.ts +1 -2
  369. package/dist/types/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -2
  370. package/dist/types/plugins/shared/FetchingWrappedEntryCard.d.ts +1 -2
  371. package/dist/types/plugins/shared/FetchingWrappedResourceCard.d.ts +1 -2
  372. package/dist/types/plugins/shared/LinkedBlockWrapper.d.ts +1 -1
  373. package/dist/types/plugins/shared/LinkedInlineWrapper.d.ts +1 -1
  374. package/dist/types/plugins/shared/ResourceNewBadge.d.ts +1 -2
  375. package/dist/types/plugins/shared/ToolbarButton.d.ts +1 -2
  376. package/package.json +8 -5
@@ -1,9 +1,4 @@
1
- /**
2
- * Credit: Copied & modified version from Plate's list plugin to support
3
- * list items with multiple children.
4
- *
5
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
6
- */ "use strict";
1
+ "use strict";
7
2
  Object.defineProperty(exports, "__esModule", {
8
3
  value: true
9
4
  });
@@ -22,11 +17,9 @@ const listBreak = (editor)=>{
22
17
  if (!editor.selection) return false;
23
18
  const res = (0, _platelist.getListItemEntry)(editor, {});
24
19
  let moved;
25
- // If selection is in a li
26
20
  if (res) {
27
- const { list, listItem } = res;
21
+ const { list , listItem } = res;
28
22
  const childNode = listItem[0].children[0];
29
- // If selected li is empty, move it up.
30
23
  if ((0, _platecommon.isBlockAboveEmpty)(editor) && listItem[0].children.length === 1 && _richtexttypes.TEXT_CONTAINERS.includes(childNode.type)) {
31
24
  moved = (0, _platelist.moveListItemUp)(editor, {
32
25
  list,
@@ -52,16 +45,14 @@ const listBreak = (editor)=>{
52
45
  if (didReset) {
53
46
  return true;
54
47
  }
55
- /**
56
- * If selection is in li > p, insert li.
57
- */ if (!moved) {
48
+ if (!moved) {
58
49
  const inserted = (0, _insertListItem.insertListItem)(editor);
59
50
  if (inserted) return true;
60
51
  }
61
52
  return false;
62
53
  };
63
54
  const insertListBreak = (editor)=>{
64
- const { insertBreak } = editor;
55
+ const { insertBreak } = editor;
65
56
  return ()=>{
66
57
  if (listBreak(editor)) return;
67
58
  insertBreak();
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -29,26 +26,19 @@ const isListRoot = (node)=>[
29
26
  _richtexttypes.BLOCKS.UL_LIST,
30
27
  _richtexttypes.BLOCKS.OL_LIST
31
28
  ].includes(node.type);
32
- /**
33
- * Removes the "empty" leading lis. Empty in this context means lis only with other lis as children.
34
- *
35
- * @returns If argument is not a list root, returns it, otherwise returns ul[] or li[].
36
- */ const trimList = (listRoot)=>{
29
+ const trimList = (listRoot)=>{
37
30
  if (!isListRoot(listRoot)) {
38
31
  return [
39
32
  listRoot
40
33
  ];
41
34
  }
42
35
  const textEntries = Array.from((0, _queries.getNodeTexts)(listRoot));
43
- const commonAncestorEntry = textEntries.reduce((commonAncestor, textEntry)=>(0, _queries.isAncestorPath)(commonAncestor[1], textEntry[1]) ? commonAncestor : (0, _queries.getCommonNode)(listRoot, textEntry[1], commonAncestor[1]), // any list item would do, we grab the first one
44
- getFirstAncestorOfType(listRoot, textEntries[0]));
36
+ const commonAncestorEntry = textEntries.reduce((commonAncestor, textEntry)=>(0, _queries.isAncestorPath)(commonAncestor[1], textEntry[1]) ? commonAncestor : (0, _queries.getCommonNode)(listRoot, textEntry[1], commonAncestor[1]), getFirstAncestorOfType(listRoot, textEntries[0]));
45
37
  return isListRoot(commonAncestorEntry[0]) ? commonAncestorEntry[0].children : [
46
38
  commonAncestorEntry[0]
47
39
  ];
48
40
  };
49
- /**
50
- * Removes leading li when pasting a single li with a single child.
51
- */ const trimLiWrapper = (nodes)=>{
41
+ const trimLiWrapper = (nodes)=>{
52
42
  if (nodes.length !== 1) {
53
43
  return nodes;
54
44
  }
@@ -69,7 +59,7 @@ const unwrapTextContainerAtStart = (nodes)=>{
69
59
  return nodes;
70
60
  };
71
61
  const insertListFragment = (editor)=>{
72
- const { insertFragment } = editor;
62
+ const { insertFragment } = editor;
73
63
  return (fragment)=>{
74
64
  if (!editor.selection) {
75
65
  return;
@@ -88,9 +78,6 @@ const insertListFragment = (editor)=>{
88
78
  }
89
79
  const inlines = nodes.slice(0, firstBlockIndex);
90
80
  const blocks = nodes.slice(firstBlockIndex);
91
- // Two calls to insertNodes are required here. Otherwise, all blocks
92
- // after a text or inline element occurrence will be unwrapped for
93
- // some reason.
94
81
  (0, _transforms.insertNodes)(editor, inlines, {
95
82
  at: editor.selection,
96
83
  select: true
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -11,8 +8,7 @@ Object.defineProperty(exports, "onKeyDownList", {
11
8
  return onKeyDownList;
12
9
  }
13
10
  });
14
- const _ishotkey = /*#__PURE__*/ _interop_require_default(require("is-hotkey"));
15
- const _castArray = /*#__PURE__*/ _interop_require_default(require("lodash/castArray"));
11
+ const _ishotkey = _interop_require_default(require("is-hotkey"));
16
12
  const _queries = require("../../internal/queries");
17
13
  const _moveListItems = require("./transforms/moveListItems");
18
14
  const _toggleList = require("./transforms/toggleList");
@@ -21,7 +17,7 @@ function _interop_require_default(obj) {
21
17
  default: obj
22
18
  };
23
19
  }
24
- const onKeyDownList = (editor, { type, options: { hotkey } })=>(e)=>{
20
+ const onKeyDownList = (editor, { type , options: { hotkey } })=>(e)=>{
25
21
  if (e.key === 'Tab' && editor.selection) {
26
22
  const listSelected = (0, _queries.getAboveNode)(editor, {
27
23
  at: editor.selection,
@@ -38,7 +34,9 @@ const onKeyDownList = (editor, { type, options: { hotkey } })=>(e)=>{
38
34
  }
39
35
  }
40
36
  if (!hotkey) return;
41
- const hotkeys = (0, _castArray.default)(hotkey);
37
+ const hotkeys = Array.isArray(hotkey) ? hotkey : [
38
+ hotkey
39
+ ];
42
40
  for (const _hotkey of hotkeys){
43
41
  if ((0, _ishotkey.default)(_hotkey)(e)) {
44
42
  (0, _toggleList.toggleList)(editor, {
@@ -12,9 +12,7 @@ const _richtexttypes = require("@contentful/rich-text-types");
12
12
  const _internal = require("../../../internal");
13
13
  const _queries = require("../../../internal/queries");
14
14
  const _transforms = require("../../../internal/transforms");
15
- /**
16
- * Build a new list item node while preserving marks
17
- */ const emptyListItemNode = (editor, withChildren = false)=>{
15
+ const emptyListItemNode = (editor, withChildren = false)=>{
18
16
  let children = [];
19
17
  if (withChildren) {
20
18
  const marks = (0, _queries.getMarks)(editor) || {};
@@ -41,7 +39,6 @@ const insertListItem = (editor)=>{
41
39
  if (!editor.selection) {
42
40
  return false;
43
41
  }
44
- // Naming it paragraph for simplicity but can be a heading as well
45
42
  const paragraph = (0, _queries.getAboveNode)(editor, {
46
43
  match: {
47
44
  type: _richtexttypes.TEXT_CONTAINERS
@@ -59,33 +56,23 @@ const insertListItem = (editor)=>{
59
56
  if (listItemNode.type !== _richtexttypes.BLOCKS.LIST_ITEM) {
60
57
  return false;
61
58
  }
62
- // We are in a li>p (or heading)
63
59
  (0, _internal.withoutNormalizing)(editor, ()=>{
64
60
  if (!editor.selection) {
65
61
  return;
66
62
  }
67
- // Check the cursor position in the current paragraph
68
63
  const isAtStart = (0, _queries.isSelectionAtBlockStart)(editor);
69
64
  const isAtEnd = (0, _queries.isSelectionAtBlockEnd)(editor);
70
65
  const isAtStartOfListItem = isAtStart && (0, _queries.isFirstChildPath)(paragraphPath);
71
66
  const shouldSplit = !isAtStart && !isAtEnd;
72
- // Split the current paragraph content if necessary
73
67
  if (shouldSplit) {
74
68
  (0, _transforms.splitNodes)(editor);
75
69
  }
76
- // Insert the new li
77
70
  const newListItemPath = isAtStartOfListItem ? listItemPath : (0, _queries.getNextPath)(listItemPath);
78
- (0, _transforms.insertNodes)(editor, // Add an empty paragraph to the new li if We will not move some
79
- // paragraphs over there.
80
- emptyListItemNode(editor, !shouldSplit), {
71
+ (0, _transforms.insertNodes)(editor, emptyListItemNode(editor, !shouldSplit), {
81
72
  at: newListItemPath
82
73
  });
83
- // Move children *after* selection to the new li
84
74
  const fromPath = isAtStart ? paragraphPath : (0, _queries.getNextPath)(paragraphPath);
85
75
  const fromStartIndex = fromPath[fromPath.length - 1] || 0;
86
- // On split we don't add paragraph to the new li so we move
87
- // content to the very beginning. Otherwise, account for the empty
88
- // paragraph at the beginning by moving the content after
89
76
  const toPath = newListItemPath.concat([
90
77
  shouldSplit ? 0 : 1
91
78
  ]);
@@ -96,12 +83,10 @@ const insertListItem = (editor)=>{
96
83
  fromStartIndex
97
84
  });
98
85
  }
99
- // Move cursor to the start of the new li
100
86
  (0, _transforms.select)(editor, newListItemPath);
101
87
  (0, _transforms.collapseSelection)(editor, {
102
88
  edge: 'start'
103
89
  });
104
90
  });
105
- // Returning True skips processing other editor.insertBreak handlers
106
91
  return true;
107
92
  };
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -15,7 +12,7 @@ const _platelist = require("@udecode/plate-list");
15
12
  const _internal = require("../../../internal");
16
13
  const _queries = require("../../../internal/queries");
17
14
  const _transforms = require("../../../internal/transforms");
18
- const moveListItemDown = (editor, { list, listItem })=>{
15
+ const moveListItemDown = (editor, { list , listItem })=>{
19
16
  const [listNode] = list;
20
17
  const [, listItemPath] = listItem;
21
18
  let previousListItemPath;
@@ -24,7 +21,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
24
21
  } catch (e) {
25
22
  return;
26
23
  }
27
- // Previous sibling is the new parent
28
24
  const previousSiblingItem = (0, _queries.getNodeEntry)(editor, previousListItemPath);
29
25
  if (previousSiblingItem) {
30
26
  const [, previousPath] = previousSiblingItem;
@@ -34,7 +30,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
34
30
  const newPath = (0, _queries.getNextPath)((0, _queries.getLastChildPath)(subList ?? previousSiblingItem));
35
31
  (0, _internal.withoutNormalizing)(editor, ()=>{
36
32
  if (!subList) {
37
- // Create new sub-list
38
33
  (0, _transforms.wrapNodes)(editor, {
39
34
  type: listNode.type,
40
35
  children: [],
@@ -43,7 +38,6 @@ const moveListItemDown = (editor, { list, listItem })=>{
43
38
  at: listItemPath
44
39
  });
45
40
  }
46
- // Move the current item to the sub-list
47
41
  (0, _transforms.moveNodes)(editor, {
48
42
  at: listItemPath,
49
43
  to: newPath
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -15,19 +12,17 @@ const _platelist = require("@udecode/plate-list");
15
12
  const _internal = require("../../../internal");
16
13
  const _queries = require("../../../internal/queries");
17
14
  const _moveListItemDown = require("./moveListItemDown");
18
- const moveListItems = (editor, { increase = true, at = editor.selection ?? undefined } = {})=>{
15
+ const moveListItems = (editor, { increase =true , at =editor.selection ?? undefined } = {})=>{
19
16
  const _nodes = (0, _queries.getNodeEntries)(editor, {
20
17
  at,
21
18
  match: {
22
19
  type: (0, _queries.getPluginType)(editor, _platelist.ELEMENT_LIC)
23
20
  }
24
21
  });
25
- // Get the selected lic
26
22
  const lics = Array.from(_nodes);
27
23
  if (!lics.length) return;
28
24
  const highestLicPaths = [];
29
25
  const highestLicPathRefs = [];
30
- // Filter out the nested lic, we just need to move the highest ones
31
26
  lics.forEach((lic)=>{
32
27
  const licPath = lic[1];
33
28
  const liPath = (0, _queries.getParentPath)(licPath);
@@ -1,17 +1,16 @@
1
- /** @jsx jsx */ "use strict";
1
+ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _testutils = require("../../../test-utils");
6
6
  const _moveListItems = require("./moveListItems");
7
7
  describe('moving list items (up/down)', ()=>{
8
- const renderEditor = (children)=>/*#__PURE__*/ (0, _testutils.jsx)("editor", null, children, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
8
+ const renderEditor = (children)=>(0, _testutils.jsx)("editor", null, children, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
9
9
  const assertTab = (t, shift = false)=>{
10
10
  test(t.title, ()=>{
11
- const { editor } = (0, _testutils.createTestEditor)({
11
+ const { editor } = (0, _testutils.createTestEditor)({
12
12
  input: renderEditor(t.input)
13
13
  });
14
- // Equivalent of pressing (SHIFT+)TAB
15
14
  (0, _moveListItems.moveListItems)(editor, {
16
15
  increase: !shift
17
16
  });
@@ -24,37 +23,37 @@ describe('moving list items (up/down)', ()=>{
24
23
  const tests = [
25
24
  {
26
25
  title: 'single paragraph',
27
- input: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))),
28
- expected: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))))))
26
+ input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
27
+ expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null))))))
29
28
  },
30
29
  {
31
30
  title: 'multiple paragraphs',
32
- input: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p3", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))),
33
- expected: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p3", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))))))
31
+ input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hp", null, "p2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p3", (0, _testutils.jsx)("cursor", null)))),
32
+ expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hp", null, "p2"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p3", (0, _testutils.jsx)("cursor", null))))))
34
33
  },
35
34
  {
36
35
  title: 'multiple elements',
37
- input: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "a"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "b"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote"))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "c", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "d"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
36
+ input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "a"), (0, _testutils.jsx)("hp", null, "b"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote"))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "c", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hp", null, "d"), (0, _testutils.jsx)("hembed", {
38
37
  type: "Asset",
39
38
  id: "asset-id"
40
39
  }))),
41
- expected: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "a"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "b"), /*#__PURE__*/ (0, _testutils.jsx)("hquote", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "quote")), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "c", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "d"), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
40
+ expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "a"), (0, _testutils.jsx)("hp", null, "b"), (0, _testutils.jsx)("hquote", null, (0, _testutils.jsx)("hp", null, "quote")), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "c", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hp", null, "d"), (0, _testutils.jsx)("hembed", {
42
41
  type: "Asset",
43
42
  id: "asset-id"
44
43
  })))))
45
44
  },
46
45
  {
47
46
  title: 'with a sub-list',
48
- input: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "sub p1")))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))),
49
- expected: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "sub p1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))))))
47
+ input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
48
+ expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null))))))
50
49
  },
51
50
  {
52
51
  title: 'with a sub-list as non-last child',
53
- input: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "sub p1"))), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
52
+ input: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1"))), (0, _testutils.jsx)("hembed", {
54
53
  type: "Entry",
55
54
  id: "entry-id"
56
- })), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))),
57
- expected: /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "sub p1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "p2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))), /*#__PURE__*/ (0, _testutils.jsx)("hembed", {
55
+ })), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))),
56
+ expected: (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "sub p1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "p2", (0, _testutils.jsx)("cursor", null)))), (0, _testutils.jsx)("hembed", {
58
57
  type: "Entry",
59
58
  id: "entry-id"
60
59
  })))
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -22,15 +19,14 @@ const listTypes = [
22
19
  _richtexttypes.BLOCKS.UL_LIST,
23
20
  _richtexttypes.BLOCKS.OL_LIST
24
21
  ];
25
- const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor, ()=>{
22
+ const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor, ()=>{
26
23
  if (!editor.selection) {
27
24
  return;
28
25
  }
29
26
  if ((0, _queries.isRangeCollapsed)(editor.selection) || !(0, _queries.isRangeAcrossBlocks)(editor)) {
30
- // selection is collapsed
31
27
  const res = (0, _platelist.getListItemEntry)(editor);
32
28
  if (res) {
33
- const { list } = res;
29
+ const { list } = res;
34
30
  if (list[0].type !== type) {
35
31
  (0, _transforms.setNodes)(editor, {
36
32
  type
@@ -68,7 +64,6 @@ const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor,
68
64
  }
69
65
  }
70
66
  } else {
71
- // selection is a range
72
67
  const [startPoint, endPoint] = (0, _queries.getRangeEdges)(editor.selection);
73
68
  const commonEntry = (0, _queries.getCommonNode)(editor, startPoint.path, endPoint.path);
74
69
  if (listTypes.includes(commonEntry[0].type) || commonEntry[0].type === _richtexttypes.BLOCKS.LIST_ITEM) {
@@ -1,4 +1,4 @@
1
- /** @jsx jsx */ "use strict";
1
+ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
@@ -7,9 +7,9 @@ const _testutils = require("../../../test-utils");
7
7
  const _toggleList = require("./toggleList");
8
8
  describe('toggle on', ()=>{
9
9
  it('should turn a p to list', ()=>{
10
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)));
11
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
12
- const { editor } = (0, _testutils.createTestEditor)({
10
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)));
11
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
12
+ const { editor } = (0, _testutils.createTestEditor)({
13
13
  input
14
14
  });
15
15
  (0, _toggleList.toggleList)(editor, {
@@ -21,9 +21,9 @@ describe('toggle on', ()=>{
21
21
  });
22
22
  });
23
23
  it('should turn a p with a selection to list', ()=>{
24
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Planetas ", /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "mori in", /*#__PURE__*/ (0, _testutils.jsx)("focus", null), " gandavum!"));
25
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "Planetas ", /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "mori in", /*#__PURE__*/ (0, _testutils.jsx)("focus", null), " gandavum!"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
26
- const { editor } = (0, _testutils.createTestEditor)({
24
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"));
25
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
26
+ const { editor } = (0, _testutils.createTestEditor)({
27
27
  input
28
28
  });
29
29
  (0, _toggleList.toggleList)(editor, {
@@ -35,9 +35,9 @@ describe('toggle on', ()=>{
35
35
  });
36
36
  });
37
37
  it('should turn multiple p to list', ()=>{
38
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)));
39
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
40
- const { editor } = (0, _testutils.createTestEditor)({
38
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
39
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
40
+ const { editor } = (0, _testutils.createTestEditor)({
41
41
  input
42
42
  });
43
43
  (0, _toggleList.toggleList)(editor, {
@@ -51,9 +51,9 @@ describe('toggle on', ()=>{
51
51
  });
52
52
  describe('toggle off', ()=>{
53
53
  it('should split a simple list to two', ()=>{
54
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3"))));
55
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
56
- const { editor } = (0, _testutils.createTestEditor)({
54
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))));
55
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
56
+ const { editor } = (0, _testutils.createTestEditor)({
57
57
  input
58
58
  });
59
59
  (0, _toggleList.toggleList)(editor, {
@@ -65,9 +65,9 @@ describe('toggle off', ()=>{
65
65
  });
66
66
  });
67
67
  it('should split a nested list', ()=>{
68
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "12", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null))), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "13"))))));
69
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11"))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "12", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "13"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
70
- const { editor } = (0, _testutils.createTestEditor)({
68
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))))));
69
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11"))))), (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
70
+ const { editor } = (0, _testutils.createTestEditor)({
71
71
  input
72
72
  });
73
73
  (0, _toggleList.toggleList)(editor, {
@@ -79,9 +79,9 @@ describe('toggle off', ()=>{
79
79
  });
80
80
  });
81
81
  it('should turn a list to multiple p', ()=>{
82
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2")), /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)))));
83
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "2"), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "3", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)));
84
- const { editor } = (0, _testutils.createTestEditor)({
82
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))));
83
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
84
+ const { editor } = (0, _testutils.createTestEditor)({
85
85
  input
86
86
  });
87
87
  (0, _toggleList.toggleList)(editor, {
@@ -95,9 +95,9 @@ describe('toggle off', ()=>{
95
95
  });
96
96
  describe('toggle over', ()=>{
97
97
  it('should toggle different list types', ()=>{
98
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))));
99
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hol", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
100
- const { editor } = (0, _testutils.createTestEditor)({
98
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))));
99
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
100
+ const { editor } = (0, _testutils.createTestEditor)({
101
101
  input
102
102
  });
103
103
  (0, _toggleList.toggleList)(editor, {
@@ -109,9 +109,9 @@ describe('toggle over', ()=>{
109
109
  });
110
110
  });
111
111
  it('should only toggle the nested list', ()=>{
112
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))))));
113
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "1"), /*#__PURE__*/ (0, _testutils.jsx)("hol", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11", /*#__PURE__*/ (0, _testutils.jsx)("cursor", null)))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
114
- const { editor } = (0, _testutils.createTestEditor)({
112
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))));
113
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
114
+ const { editor } = (0, _testutils.createTestEditor)({
115
115
  input
116
116
  });
117
117
  (0, _toggleList.toggleList)(editor, {
@@ -123,9 +123,9 @@ describe('toggle over', ()=>{
123
123
  });
124
124
  });
125
125
  it('should only toggle everything that is selected', ()=>{
126
- const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1"), /*#__PURE__*/ (0, _testutils.jsx)("hul", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)))))));
127
- const expected = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hol", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("anchor", null), "1"), /*#__PURE__*/ (0, _testutils.jsx)("hol", null, /*#__PURE__*/ (0, _testutils.jsx)("hli", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, "11", /*#__PURE__*/ (0, _testutils.jsx)("focus", null)))))), /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
128
- const { editor } = (0, _testutils.createTestEditor)({
126
+ const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))));
127
+ const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
128
+ const { editor } = (0, _testutils.createTestEditor)({
129
129
  input
130
130
  });
131
131
  (0, _toggleList.toggleList)(editor, {
@@ -1,7 +1,4 @@
1
- /**
2
- * Credit: Modified version of Plate's list plugin
3
- * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
- */ "use strict";
1
+ "use strict";
5
2
  Object.defineProperty(exports, "__esModule", {
6
3
  value: true
7
4
  });
@@ -21,17 +18,15 @@ function hasUnliftedListItems(editor, at) {
21
18
  match: (node, path)=>(0, _queries.isElement)(node) && node.type === _richtexttypes.BLOCKS.LIST_ITEM && path.length >= 2
22
19
  }).next().done;
23
20
  }
24
- const unwrapList = (editor, { at } = {})=>{
21
+ const unwrapList = (editor, { at } = {})=>{
25
22
  (0, _internal.withoutNormalizing)(editor, ()=>{
26
23
  do {
27
- // lift list items to the root level
28
24
  (0, _transforms.liftNodes)(editor, {
29
25
  at,
30
26
  match: (node)=>(0, _queries.isElement)(node) && node.type === _richtexttypes.BLOCKS.LIST_ITEM,
31
27
  mode: 'lowest'
32
28
  });
33
29
  }while (!hasUnliftedListItems(editor, at))
34
- // finally unwrap all lifted items
35
30
  (0, _transforms.unwrapNodes)(editor, {
36
31
  at,
37
32
  match: {
@@ -9,26 +9,26 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- firstNodeIsNotList: function() {
13
- return firstNodeIsNotList;
14
- },
15
12
  hasListAsDirectParent: function() {
16
13
  return hasListAsDirectParent;
17
14
  },
18
- insertParagraphAsChild: function() {
19
- return insertParagraphAsChild;
20
- },
21
- isListTypeActive: function() {
22
- return isListTypeActive;
15
+ normalizeOrphanedListItem: function() {
16
+ return normalizeOrphanedListItem;
23
17
  },
24
18
  isNonEmptyListItem: function() {
25
19
  return isNonEmptyListItem;
26
20
  },
27
- normalizeOrphanedListItem: function() {
28
- return normalizeOrphanedListItem;
21
+ firstNodeIsNotList: function() {
22
+ return firstNodeIsNotList;
23
+ },
24
+ insertParagraphAsChild: function() {
25
+ return insertParagraphAsChild;
29
26
  },
30
27
  replaceNodeWithListItems: function() {
31
28
  return replaceNodeWithListItems;
29
+ },
30
+ isListTypeActive: function() {
31
+ return isListTypeActive;
32
32
  }
33
33
  });
34
34
  const _richtexttypes = require("@contentful/rich-text-types");
@@ -98,7 +98,7 @@ const replaceNodeWithListItems = (editor, entry)=>{
98
98
  });
99
99
  };
100
100
  const isListTypeActive = (editor, type)=>{
101
- const { selection } = editor;
101
+ const { selection } = editor;
102
102
  if (!selection) {
103
103
  return false;
104
104
  }
@@ -109,7 +109,6 @@ const isListTypeActive = (editor, type)=>{
109
109
  return true;
110
110
  }
111
111
  }
112
- // Lists can be nested. Here, we take the list type at the lowest level
113
112
  const listNode = (0, _queries.getBlockAbove)(editor, {
114
113
  match: {
115
114
  type: [