@contentful/field-editor-rich-text 3.4.21 → 3.5.0

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 (598) hide show
  1. package/dist/cjs/ContentfulEditorProvider.js +59 -0
  2. package/dist/cjs/RichTextEditor.js +170 -0
  3. package/dist/cjs/RichTextEditor.styles.js +66 -0
  4. package/dist/cjs/SdkProvider.js +69 -0
  5. package/dist/cjs/Toolbar/_tests_/toolbar.test.js +152 -0
  6. package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +87 -0
  7. package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +69 -0
  8. package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +29 -0
  9. package/dist/cjs/Toolbar/index.js +222 -0
  10. package/dist/cjs/__fixtures__/FakeSdk.js +183 -0
  11. package/dist/cjs/__fixtures__/asset/index.js +37 -0
  12. package/dist/cjs/__fixtures__/content-type/index.js +16 -0
  13. package/dist/cjs/__fixtures__/entry/index.js +33 -0
  14. package/dist/cjs/__fixtures__/fixtures.js +71 -0
  15. package/dist/cjs/__fixtures__/locale/index.js +40 -0
  16. package/dist/cjs/__fixtures__/space/index.js +16 -0
  17. package/dist/cjs/constants/Schema.js +172 -0
  18. package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +348 -0
  19. package/dist/cjs/dialogs/openRichTextDialog.js +64 -0
  20. package/dist/cjs/dialogs/renderRichTextDialog.js +63 -0
  21. package/dist/cjs/helpers/__tests__/extractNodes.test.js +299 -0
  22. package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +52 -0
  23. package/dist/cjs/helpers/__tests__/validations.test.js +49 -0
  24. package/dist/cjs/helpers/editor.js +276 -0
  25. package/dist/cjs/helpers/environment.js +20 -0
  26. package/dist/cjs/helpers/extractNodes.js +27 -0
  27. package/dist/cjs/helpers/formatDateAndTime.js +45 -0
  28. package/dist/cjs/helpers/getLinkedContentTypeIdsForNodeType.js +24 -0
  29. package/dist/cjs/helpers/newEntitySelectorConfigFromRichTextField.js +33 -0
  30. package/dist/cjs/helpers/nodeFactory.js +51 -0
  31. package/dist/cjs/helpers/removeInternalMarks.js +26 -0
  32. package/dist/cjs/helpers/sanitizeIncomingSlateDoc.js +33 -0
  33. package/dist/cjs/helpers/sdkNavigatorSlideIn.js +57 -0
  34. package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +209 -0
  35. package/dist/cjs/helpers/transformers.js +61 -0
  36. package/dist/cjs/helpers/validations.js +56 -0
  37. package/dist/cjs/index.js +66 -0
  38. package/dist/cjs/internal/constants.js +51 -0
  39. package/dist/cjs/internal/hooks.js +65 -0
  40. package/dist/cjs/internal/index.js +21 -0
  41. package/dist/cjs/internal/misc.js +103 -0
  42. package/dist/cjs/internal/queries.js +407 -0
  43. package/dist/cjs/internal/transforms.js +195 -0
  44. package/dist/cjs/internal/types/editor.js +4 -0
  45. package/dist/cjs/internal/types/index.js +19 -0
  46. package/dist/cjs/internal/types/plugins.js +4 -0
  47. package/dist/cjs/plugins/Break/createExitBreakPlugin.js +26 -0
  48. package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +36 -0
  49. package/dist/cjs/plugins/Break/createResetNodePlugin.js +32 -0
  50. package/dist/cjs/plugins/Break/createSoftBreakPlugin.js +23 -0
  51. package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +47 -0
  52. package/dist/cjs/plugins/Break/index.js +20 -0
  53. package/dist/cjs/plugins/CommandPalette/components/CommandList.js +167 -0
  54. package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +103 -0
  55. package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +69 -0
  56. package/dist/cjs/plugins/CommandPalette/constants.js +11 -0
  57. package/dist/cjs/plugins/CommandPalette/createCommandPalettePlugin.js +24 -0
  58. package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +138 -0
  59. package/dist/cjs/plugins/CommandPalette/index.js +11 -0
  60. package/dist/cjs/plugins/CommandPalette/onKeyDown.js +51 -0
  61. package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +83 -0
  62. package/dist/cjs/plugins/CommandPalette/useCommands.js +222 -0
  63. package/dist/cjs/plugins/CommandPalette/utils/createInlineEntryNode.js +30 -0
  64. package/dist/cjs/plugins/CommandPalette/utils/fetchAssets.js +31 -0
  65. package/dist/cjs/plugins/CommandPalette/utils/fetchEntries.js +39 -0
  66. package/dist/cjs/plugins/CommandPalette/utils/insertBlock.js +42 -0
  67. package/dist/cjs/plugins/CommandPalette/utils/trimLeadingSlash.js +16 -0
  68. package/dist/cjs/plugins/DragAndDrop/index.js +54 -0
  69. package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +128 -0
  70. package/dist/cjs/plugins/EmbeddedEntityBlock/ToolbarIcon.js +106 -0
  71. package/dist/cjs/plugins/EmbeddedEntityBlock/Util.js +108 -0
  72. package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +100 -0
  73. package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +158 -0
  74. package/dist/cjs/plugins/EmbeddedEntityInline/Util.js +30 -0
  75. package/dist/cjs/plugins/EmbeddedEntityInline/index.js +221 -0
  76. package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +117 -0
  77. package/dist/cjs/plugins/Heading/components/Heading.js +127 -0
  78. package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +173 -0
  79. package/dist/cjs/plugins/Heading/createHeadingPlugin.js +102 -0
  80. package/dist/cjs/plugins/Heading/index.js +19 -0
  81. package/dist/cjs/plugins/Hr/index.js +193 -0
  82. package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +282 -0
  83. package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +25 -0
  84. package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +93 -0
  85. package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +78 -0
  86. package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +86 -0
  87. package/dist/cjs/plugins/Hyperlink/components/styles.js +36 -0
  88. package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +179 -0
  89. package/dist/cjs/plugins/Hyperlink/index.js +20 -0
  90. package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +95 -0
  91. package/dist/cjs/plugins/Hyperlink/utils.js +43 -0
  92. package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +47 -0
  93. package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +77 -0
  94. package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +64 -0
  95. package/dist/cjs/plugins/List/components/List.js +108 -0
  96. package/dist/cjs/plugins/List/components/ListItem.js +73 -0
  97. package/dist/cjs/plugins/List/components/ToolbarListButton.js +86 -0
  98. package/dist/cjs/plugins/List/createListPlugin.js +76 -0
  99. package/dist/cjs/plugins/List/index.js +19 -0
  100. package/dist/cjs/plugins/List/insertListBreak.js +60 -0
  101. package/dist/cjs/plugins/List/insertListFragment.js +98 -0
  102. package/dist/cjs/plugins/List/onKeyDownList.js +46 -0
  103. package/dist/cjs/plugins/List/transforms/insertListItem.js +92 -0
  104. package/dist/cjs/plugins/List/transforms/moveListItemDown.js +47 -0
  105. package/dist/cjs/plugins/List/transforms/moveListItems.js +56 -0
  106. package/dist/cjs/plugins/List/transforms/moveListItems.test.js +72 -0
  107. package/dist/cjs/plugins/List/transforms/toggleList.js +141 -0
  108. package/dist/cjs/plugins/List/transforms/toggleList.spec.js +139 -0
  109. package/dist/cjs/plugins/List/transforms/unwrapList.js +38 -0
  110. package/dist/cjs/plugins/List/utils.js +122 -0
  111. package/dist/cjs/plugins/List/withList.js +32 -0
  112. package/dist/cjs/plugins/Marks/Bold.js +119 -0
  113. package/dist/cjs/plugins/Marks/Code.js +122 -0
  114. package/dist/cjs/plugins/Marks/Italic.js +114 -0
  115. package/dist/cjs/plugins/Marks/Subscript.js +109 -0
  116. package/dist/cjs/plugins/Marks/Superscript.js +107 -0
  117. package/dist/cjs/plugins/Marks/Underline.js +106 -0
  118. package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +105 -0
  119. package/dist/cjs/plugins/Marks/helpers.js +48 -0
  120. package/dist/cjs/plugins/Marks/index.js +27 -0
  121. package/dist/cjs/plugins/Normalizer/baseRules.js +38 -0
  122. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.js +15 -0
  123. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +117 -0
  124. package/dist/cjs/plugins/Normalizer/index.js +19 -0
  125. package/dist/cjs/plugins/Normalizer/types.js +4 -0
  126. package/dist/cjs/plugins/Normalizer/utils.js +39 -0
  127. package/dist/cjs/plugins/Normalizer/withNormalizer.js +88 -0
  128. package/dist/cjs/plugins/Paragraph/Paragraph.js +70 -0
  129. package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +125 -0
  130. package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +73 -0
  131. package/dist/cjs/plugins/Paragraph/index.js +18 -0
  132. package/dist/cjs/plugins/Paragraph/utils.js +24 -0
  133. package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +63 -0
  134. package/dist/cjs/plugins/PasteHTML/index.js +18 -0
  135. package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +54 -0
  136. package/dist/cjs/plugins/PasteHTML/utils/sanitizeAnchors.js +43 -0
  137. package/dist/cjs/plugins/PasteHTML/utils/sanitizeHTML.js +50 -0
  138. package/dist/cjs/plugins/PasteHTML/utils/sanitizeSheets.js +44 -0
  139. package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +78 -0
  140. package/dist/cjs/plugins/Quote/components/Quote.js +69 -0
  141. package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +72 -0
  142. package/dist/cjs/plugins/Quote/createQuotePlugin.js +57 -0
  143. package/dist/cjs/plugins/Quote/index.js +19 -0
  144. package/dist/cjs/plugins/Quote/shouldResetQuote.js +40 -0
  145. package/dist/cjs/plugins/Quote/toggleQuote.js +56 -0
  146. package/dist/cjs/plugins/Quote/withQuote.js +48 -0
  147. package/dist/cjs/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +21 -0
  148. package/dist/cjs/plugins/SelectOnBackspace/index.js +18 -0
  149. package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +92 -0
  150. package/dist/cjs/plugins/Table/__tests__/helpers.test.js +18 -0
  151. package/dist/cjs/plugins/Table/actions/addColumn.js +63 -0
  152. package/dist/cjs/plugins/Table/actions/addRow.js +57 -0
  153. package/dist/cjs/plugins/Table/actions/index.js +20 -0
  154. package/dist/cjs/plugins/Table/actions/setHeader.js +34 -0
  155. package/dist/cjs/plugins/Table/components/Cell.js +79 -0
  156. package/dist/cjs/plugins/Table/components/HeaderCell.js +82 -0
  157. package/dist/cjs/plugins/Table/components/Row.js +69 -0
  158. package/dist/cjs/plugins/Table/components/Table.js +76 -0
  159. package/dist/cjs/plugins/Table/components/TableActions.js +175 -0
  160. package/dist/cjs/plugins/Table/components/ToolbarButton.js +73 -0
  161. package/dist/cjs/plugins/Table/createTablePlugin.js +119 -0
  162. package/dist/cjs/plugins/Table/helpers.js +152 -0
  163. package/dist/cjs/plugins/Table/index.js +19 -0
  164. package/dist/cjs/plugins/Table/insertTableFragment.js +50 -0
  165. package/dist/cjs/plugins/Table/onKeyDownTable.js +62 -0
  166. package/dist/cjs/plugins/Table/tableTracking.js +64 -0
  167. package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +79 -0
  168. package/dist/cjs/plugins/Text/createTextPlugin.js +136 -0
  169. package/dist/cjs/plugins/Text/index.js +18 -0
  170. package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +101 -0
  171. package/dist/cjs/plugins/Tracking/index.js +18 -0
  172. package/dist/cjs/plugins/Tracking/utils.js +64 -0
  173. package/dist/cjs/plugins/TrailingParagraph/index.js +20 -0
  174. package/dist/cjs/plugins/Voids/createVoidsPlugin.js +31 -0
  175. package/dist/cjs/plugins/Voids/index.js +18 -0
  176. package/dist/cjs/plugins/Voids/transformVoid.js +29 -0
  177. package/dist/cjs/plugins/index.js +76 -0
  178. package/dist/cjs/plugins/links-tracking.js +29 -0
  179. package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +113 -0
  180. package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +116 -0
  181. package/dist/cjs/plugins/shared/ToolbarButton.js +93 -0
  182. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +107 -0
  183. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +110 -0
  184. package/dist/cjs/prepareDocument.js +86 -0
  185. package/dist/cjs/test-utils/assertOutput.js +31 -0
  186. package/dist/cjs/test-utils/createEditor.js +31 -0
  187. package/dist/cjs/test-utils/hyperscript.d.js +1 -0
  188. package/dist/cjs/test-utils/index.js +21 -0
  189. package/dist/cjs/test-utils/jsx.js +159 -0
  190. package/dist/cjs/test-utils/mockPlugin.js +16 -0
  191. package/dist/cjs/test-utils/randomId.js +13 -0
  192. package/dist/cjs/test-utils/setEmptyDataAttribute.js +21 -0
  193. package/dist/cjs/test-utils/validation.js +127 -0
  194. package/dist/cjs/useOnValueChanged.js +58 -0
  195. package/dist/esm/ContentfulEditorProvider.js +29 -0
  196. package/dist/esm/RichTextEditor.js +108 -0
  197. package/dist/esm/RichTextEditor.styles.js +51 -0
  198. package/dist/esm/SdkProvider.js +7 -0
  199. package/dist/esm/Toolbar/_tests_/toolbar.test.js +104 -0
  200. package/dist/esm/Toolbar/components/EmbedEntityWidget.js +38 -0
  201. package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +20 -0
  202. package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +14 -0
  203. package/dist/esm/Toolbar/index.js +168 -0
  204. package/dist/esm/__fixtures__/FakeSdk.js +173 -0
  205. package/dist/esm/__fixtures__/asset/index.js +6 -0
  206. package/dist/esm/__fixtures__/content-type/index.js +2 -0
  207. package/dist/esm/__fixtures__/entry/index.js +5 -0
  208. package/dist/esm/__fixtures__/fixtures.js +6 -0
  209. package/dist/esm/__fixtures__/locale/index.js +15 -0
  210. package/dist/esm/__fixtures__/space/index.js +2 -0
  211. package/dist/esm/constants/Schema.js +162 -0
  212. package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +283 -0
  213. package/dist/esm/dialogs/openRichTextDialog.js +15 -0
  214. package/dist/esm/dialogs/renderRichTextDialog.js +14 -0
  215. package/dist/esm/helpers/__tests__/extractNodes.test.js +295 -0
  216. package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +48 -0
  217. package/dist/esm/helpers/__tests__/validations.test.js +45 -0
  218. package/dist/esm/helpers/editor.js +198 -0
  219. package/dist/esm/helpers/environment.js +2 -0
  220. package/dist/esm/helpers/extractNodes.js +17 -0
  221. package/dist/esm/helpers/formatDateAndTime.js +19 -0
  222. package/dist/esm/helpers/getLinkedContentTypeIdsForNodeType.js +9 -0
  223. package/dist/esm/helpers/newEntitySelectorConfigFromRichTextField.js +18 -0
  224. package/dist/esm/helpers/nodeFactory.js +24 -0
  225. package/dist/esm/helpers/removeInternalMarks.js +16 -0
  226. package/dist/esm/helpers/sanitizeIncomingSlateDoc.js +23 -0
  227. package/dist/esm/helpers/sdkNavigatorSlideIn.js +42 -0
  228. package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +200 -0
  229. package/dist/esm/helpers/transformers.js +34 -0
  230. package/dist/esm/helpers/validations.js +24 -0
  231. package/dist/esm/index.js +4 -0
  232. package/dist/esm/internal/constants.js +2 -0
  233. package/dist/esm/internal/hooks.js +5 -0
  234. package/dist/esm/internal/index.js +4 -0
  235. package/dist/esm/internal/misc.js +28 -0
  236. package/dist/esm/internal/queries.js +182 -0
  237. package/dist/esm/internal/transforms.js +75 -0
  238. package/dist/esm/internal/types/editor.js +1 -0
  239. package/dist/esm/internal/types/index.js +2 -0
  240. package/dist/esm/internal/types/plugins.js +1 -0
  241. package/dist/esm/plugins/Break/createExitBreakPlugin.js +16 -0
  242. package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +32 -0
  243. package/dist/esm/plugins/Break/createResetNodePlugin.js +22 -0
  244. package/dist/esm/plugins/Break/createSoftBreakPlugin.js +13 -0
  245. package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +43 -0
  246. package/dist/esm/plugins/Break/index.js +3 -0
  247. package/dist/esm/plugins/CommandPalette/components/CommandList.js +113 -0
  248. package/dist/esm/plugins/CommandPalette/components/CommandList.styles.js +88 -0
  249. package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +20 -0
  250. package/dist/esm/plugins/CommandPalette/constants.js +1 -0
  251. package/dist/esm/plugins/CommandPalette/createCommandPalettePlugin.js +14 -0
  252. package/dist/esm/plugins/CommandPalette/hooks/useCommandList.js +84 -0
  253. package/dist/esm/plugins/CommandPalette/index.js +1 -0
  254. package/dist/esm/plugins/CommandPalette/onKeyDown.js +36 -0
  255. package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +40 -0
  256. package/dist/esm/plugins/CommandPalette/useCommands.js +204 -0
  257. package/dist/esm/plugins/CommandPalette/utils/createInlineEntryNode.js +20 -0
  258. package/dist/esm/plugins/CommandPalette/utils/fetchAssets.js +21 -0
  259. package/dist/esm/plugins/CommandPalette/utils/fetchEntries.js +29 -0
  260. package/dist/esm/plugins/CommandPalette/utils/insertBlock.js +32 -0
  261. package/dist/esm/plugins/CommandPalette/utils/trimLeadingSlash.js +6 -0
  262. package/dist/esm/plugins/DragAndDrop/index.js +44 -0
  263. package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +79 -0
  264. package/dist/esm/plugins/EmbeddedEntityBlock/ToolbarIcon.js +49 -0
  265. package/dist/esm/plugins/EmbeddedEntityBlock/Util.js +85 -0
  266. package/dist/esm/plugins/EmbeddedEntityBlock/index.js +74 -0
  267. package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +104 -0
  268. package/dist/esm/plugins/EmbeddedEntityInline/Util.js +20 -0
  269. package/dist/esm/plugins/EmbeddedEntityInline/index.js +159 -0
  270. package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +113 -0
  271. package/dist/esm/plugins/Heading/components/Heading.js +73 -0
  272. package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +119 -0
  273. package/dist/esm/plugins/Heading/createHeadingPlugin.js +87 -0
  274. package/dist/esm/plugins/Heading/index.js +2 -0
  275. package/dist/esm/plugins/Hr/index.js +125 -0
  276. package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +220 -0
  277. package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +21 -0
  278. package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +44 -0
  279. package/dist/esm/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +29 -0
  280. package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +37 -0
  281. package/dist/esm/plugins/Hyperlink/components/styles.js +21 -0
  282. package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +125 -0
  283. package/dist/esm/plugins/Hyperlink/index.js +2 -0
  284. package/dist/esm/plugins/Hyperlink/useEntityInfo.js +85 -0
  285. package/dist/esm/plugins/Hyperlink/utils.js +25 -0
  286. package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +43 -0
  287. package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +73 -0
  288. package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +60 -0
  289. package/dist/esm/plugins/List/components/List.js +46 -0
  290. package/dist/esm/plugins/List/components/ListItem.js +19 -0
  291. package/dist/esm/plugins/List/components/ToolbarListButton.js +37 -0
  292. package/dist/esm/plugins/List/createListPlugin.js +66 -0
  293. package/dist/esm/plugins/List/index.js +2 -0
  294. package/dist/esm/plugins/List/insertListBreak.js +50 -0
  295. package/dist/esm/plugins/List/insertListFragment.js +88 -0
  296. package/dist/esm/plugins/List/onKeyDownList.js +31 -0
  297. package/dist/esm/plugins/List/transforms/insertListItem.js +82 -0
  298. package/dist/esm/plugins/List/transforms/moveListItemDown.js +37 -0
  299. package/dist/esm/plugins/List/transforms/moveListItems.js +46 -0
  300. package/dist/esm/plugins/List/transforms/moveListItems.test.js +68 -0
  301. package/dist/esm/plugins/List/transforms/toggleList.js +132 -0
  302. package/dist/esm/plugins/List/transforms/toggleList.spec.js +135 -0
  303. package/dist/esm/plugins/List/transforms/unwrapList.js +28 -0
  304. package/dist/esm/plugins/List/utils.js +89 -0
  305. package/dist/esm/plugins/List/withList.js +22 -0
  306. package/dist/esm/plugins/Marks/Bold.js +59 -0
  307. package/dist/esm/plugins/Marks/Code.js +59 -0
  308. package/dist/esm/plugins/Marks/Italic.js +54 -0
  309. package/dist/esm/plugins/Marks/Subscript.js +46 -0
  310. package/dist/esm/plugins/Marks/Superscript.js +44 -0
  311. package/dist/esm/plugins/Marks/Underline.js +46 -0
  312. package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +51 -0
  313. package/dist/esm/plugins/Marks/helpers.js +25 -0
  314. package/dist/esm/plugins/Marks/index.js +17 -0
  315. package/dist/esm/plugins/Normalizer/baseRules.js +28 -0
  316. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.js +5 -0
  317. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +113 -0
  318. package/dist/esm/plugins/Normalizer/index.js +2 -0
  319. package/dist/esm/plugins/Normalizer/types.js +1 -0
  320. package/dist/esm/plugins/Normalizer/utils.js +18 -0
  321. package/dist/esm/plugins/Normalizer/withNormalizer.js +73 -0
  322. package/dist/esm/plugins/Paragraph/Paragraph.js +16 -0
  323. package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +121 -0
  324. package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +58 -0
  325. package/dist/esm/plugins/Paragraph/index.js +1 -0
  326. package/dist/esm/plugins/Paragraph/utils.js +6 -0
  327. package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +42 -0
  328. package/dist/esm/plugins/PasteHTML/index.js +1 -0
  329. package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +50 -0
  330. package/dist/esm/plugins/PasteHTML/utils/sanitizeAnchors.js +33 -0
  331. package/dist/esm/plugins/PasteHTML/utils/sanitizeHTML.js +40 -0
  332. package/dist/esm/plugins/PasteHTML/utils/sanitizeSheets.js +34 -0
  333. package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +74 -0
  334. package/dist/esm/plugins/Quote/components/Quote.js +15 -0
  335. package/dist/esm/plugins/Quote/components/ToolbarQuoteButton.js +23 -0
  336. package/dist/esm/plugins/Quote/createQuotePlugin.js +47 -0
  337. package/dist/esm/plugins/Quote/index.js +2 -0
  338. package/dist/esm/plugins/Quote/shouldResetQuote.js +30 -0
  339. package/dist/esm/plugins/Quote/toggleQuote.js +33 -0
  340. package/dist/esm/plugins/Quote/withQuote.js +38 -0
  341. package/dist/esm/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.js +11 -0
  342. package/dist/esm/plugins/SelectOnBackspace/index.js +1 -0
  343. package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +88 -0
  344. package/dist/esm/plugins/Table/__tests__/helpers.test.js +14 -0
  345. package/dist/esm/plugins/Table/actions/addColumn.js +45 -0
  346. package/dist/esm/plugins/Table/actions/addRow.js +39 -0
  347. package/dist/esm/plugins/Table/actions/index.js +3 -0
  348. package/dist/esm/plugins/Table/actions/setHeader.js +24 -0
  349. package/dist/esm/plugins/Table/components/Cell.js +25 -0
  350. package/dist/esm/plugins/Table/components/HeaderCell.js +28 -0
  351. package/dist/esm/plugins/Table/components/Row.js +15 -0
  352. package/dist/esm/plugins/Table/components/Table.js +22 -0
  353. package/dist/esm/plugins/Table/components/TableActions.js +118 -0
  354. package/dist/esm/plugins/Table/components/ToolbarButton.js +24 -0
  355. package/dist/esm/plugins/Table/createTablePlugin.js +109 -0
  356. package/dist/esm/plugins/Table/helpers.js +116 -0
  357. package/dist/esm/plugins/Table/index.js +2 -0
  358. package/dist/esm/plugins/Table/insertTableFragment.js +40 -0
  359. package/dist/esm/plugins/Table/onKeyDownTable.js +52 -0
  360. package/dist/esm/plugins/Table/tableTracking.js +46 -0
  361. package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +75 -0
  362. package/dist/esm/plugins/Text/createTextPlugin.js +126 -0
  363. package/dist/esm/plugins/Text/index.js +1 -0
  364. package/dist/esm/plugins/Tracking/createTrackingPlugin.js +83 -0
  365. package/dist/esm/plugins/Tracking/index.js +1 -0
  366. package/dist/esm/plugins/Tracking/utils.js +10 -0
  367. package/dist/esm/plugins/TrailingParagraph/index.js +10 -0
  368. package/dist/esm/plugins/Voids/createVoidsPlugin.js +21 -0
  369. package/dist/esm/plugins/Voids/index.js +1 -0
  370. package/dist/esm/plugins/Voids/transformVoid.js +19 -0
  371. package/dist/esm/plugins/index.js +58 -0
  372. package/dist/esm/plugins/links-tracking.js +14 -0
  373. package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +59 -0
  374. package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +62 -0
  375. package/dist/esm/plugins/shared/ToolbarButton.js +39 -0
  376. package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +59 -0
  377. package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +62 -0
  378. package/dist/esm/prepareDocument.js +57 -0
  379. package/dist/esm/test-utils/assertOutput.js +21 -0
  380. package/dist/esm/test-utils/createEditor.js +21 -0
  381. package/dist/esm/test-utils/hyperscript.d.js +0 -0
  382. package/dist/esm/test-utils/index.js +4 -0
  383. package/dist/esm/test-utils/jsx.js +149 -0
  384. package/dist/esm/test-utils/mockPlugin.js +6 -0
  385. package/dist/esm/test-utils/randomId.js +3 -0
  386. package/dist/esm/test-utils/setEmptyDataAttribute.js +11 -0
  387. package/dist/esm/test-utils/validation.js +112 -0
  388. package/dist/esm/useOnValueChanged.js +43 -0
  389. package/dist/{ContentfulEditorProvider.d.ts → types/ContentfulEditorProvider.d.ts} +9 -9
  390. package/dist/{RichTextEditor.d.ts → types/RichTextEditor.d.ts} +21 -20
  391. package/dist/{RichTextEditor.styles.d.ts → types/RichTextEditor.styles.d.ts} +7 -7
  392. package/dist/{SdkProvider.d.ts → types/SdkProvider.d.ts} +7 -7
  393. package/dist/types/Toolbar/_tests_/toolbar.test.d.ts +1 -0
  394. package/dist/{Toolbar → types/Toolbar}/components/EmbedEntityWidget.d.ts +6 -5
  395. package/dist/{Toolbar → types/Toolbar}/components/EmbeddedEntityDropdownButton.d.ts +9 -9
  396. package/dist/{Toolbar → types/Toolbar}/components/StickyToolbarWrapper.d.ts +7 -7
  397. package/dist/types/Toolbar/index.d.ts +6 -0
  398. package/dist/types/__fixtures__/FakeSdk.d.ts +8 -0
  399. package/dist/types/__fixtures__/asset/index.d.ts +6 -0
  400. package/dist/types/__fixtures__/content-type/index.d.ts +2 -0
  401. package/dist/types/__fixtures__/entry/index.d.ts +5 -0
  402. package/dist/types/__fixtures__/fixtures.d.ts +6 -0
  403. package/dist/types/__fixtures__/locale/index.d.ts +42 -0
  404. package/dist/types/__fixtures__/space/index.d.ts +2 -0
  405. package/dist/{constants → types/constants}/Schema.d.ts +111 -111
  406. package/dist/{dialogs → types/dialogs}/HypelinkDialog/HyperlinkDialog.d.ts +63 -54
  407. package/dist/{dialogs → types/dialogs}/openRichTextDialog.d.ts +2 -2
  408. package/dist/{dialogs → types/dialogs}/renderRichTextDialog.d.ts +3 -2
  409. package/dist/types/helpers/__tests__/extractNodes.test.d.ts +1 -0
  410. package/dist/types/helpers/__tests__/removeInternalMarks.test.d.ts +2 -0
  411. package/dist/types/helpers/__tests__/validations.test.d.ts +1 -0
  412. package/dist/{helpers → types/helpers}/editor.d.ts +40 -40
  413. package/dist/{helpers → types/helpers}/environment.d.ts +2 -2
  414. package/dist/{helpers → types/helpers}/extractNodes.d.ts +5 -5
  415. package/dist/{helpers → types/helpers}/formatDateAndTime.d.ts +15 -15
  416. package/dist/{helpers → types/helpers}/getLinkedContentTypeIdsForNodeType.d.ts +26 -26
  417. package/dist/{helpers → types/helpers}/newEntitySelectorConfigFromRichTextField.d.ts +14 -14
  418. package/dist/{helpers → types/helpers}/nodeFactory.d.ts +24 -24
  419. package/dist/{helpers → types/helpers}/removeInternalMarks.d.ts +1 -1
  420. package/dist/{helpers → types/helpers}/sanitizeIncomingSlateDoc.d.ts +6 -6
  421. package/dist/{helpers → types/helpers}/sdkNavigatorSlideIn.d.ts +16 -16
  422. package/dist/types/helpers/sdkNavigatorSlideIn.spec.d.ts +1 -0
  423. package/dist/{helpers → types/helpers}/transformers.d.ts +7 -7
  424. package/dist/{helpers → types/helpers}/validations.d.ts +10 -10
  425. package/dist/{index.d.ts → types/index.d.ts} +4 -4
  426. package/dist/{internal → types/internal}/constants.d.ts +1 -1
  427. package/dist/{internal → types/internal}/hooks.d.ts +4 -4
  428. package/dist/{internal → types/internal}/index.d.ts +4 -4
  429. package/dist/{internal → types/internal}/misc.d.ts +37 -37
  430. package/dist/{internal → types/internal}/queries.d.ts +78 -78
  431. package/dist/{internal → types/internal}/transforms.d.ts +33 -33
  432. package/dist/types/internal/types/editor.d.ts +51 -0
  433. package/dist/{internal → types/internal}/types/index.d.ts +2 -2
  434. package/dist/{internal → types/internal}/types/plugins.d.ts +12 -12
  435. package/dist/{plugins → types/plugins}/Break/createExitBreakPlugin.d.ts +2 -2
  436. package/dist/types/plugins/Break/createExitBreakPlugin.test.d.ts +1 -0
  437. package/dist/{plugins → types/plugins}/Break/createResetNodePlugin.d.ts +2 -2
  438. package/dist/{plugins → types/plugins}/Break/createSoftBreakPlugin.d.ts +2 -2
  439. package/dist/types/plugins/Break/createSoftBreakPlugin.test.d.ts +1 -0
  440. package/dist/{plugins → types/plugins}/Break/index.d.ts +5 -5
  441. package/dist/{plugins → types/plugins}/CommandPalette/components/CommandList.d.ts +8 -7
  442. package/dist/{plugins → types/plugins}/CommandPalette/components/CommandList.styles.d.ts +14 -14
  443. package/dist/{plugins → types/plugins}/CommandPalette/components/CommandPrompt.d.ts +5 -4
  444. package/dist/{plugins → types/plugins}/CommandPalette/constants.d.ts +1 -1
  445. package/dist/{plugins → types/plugins}/CommandPalette/createCommandPalettePlugin.d.ts +13 -13
  446. package/dist/{plugins → types/plugins}/CommandPalette/hooks/useCommandList.d.ts +4 -4
  447. package/dist/{plugins → types/plugins}/CommandPalette/index.d.ts +1 -1
  448. package/dist/{plugins → types/plugins}/CommandPalette/onKeyDown.d.ts +2 -2
  449. package/dist/types/plugins/CommandPalette/onKeyDown.spec.d.ts +1 -0
  450. package/dist/{plugins → types/plugins}/CommandPalette/useCommands.d.ts +19 -19
  451. package/dist/{plugins → types/plugins}/CommandPalette/utils/createInlineEntryNode.d.ts +16 -16
  452. package/dist/{plugins → types/plugins}/CommandPalette/utils/fetchAssets.d.ts +8 -8
  453. package/dist/{plugins → types/plugins}/CommandPalette/utils/fetchEntries.d.ts +9 -9
  454. package/dist/{plugins → types/plugins}/CommandPalette/utils/insertBlock.d.ts +1 -1
  455. package/dist/{plugins → types/plugins}/CommandPalette/utils/trimLeadingSlash.d.ts +7 -7
  456. package/dist/{plugins → types/plugins}/DragAndDrop/index.d.ts +2 -2
  457. package/dist/{plugins → types/plugins}/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +20 -19
  458. package/dist/{plugins → types/plugins}/EmbeddedEntityBlock/ToolbarIcon.d.ts +11 -10
  459. package/dist/{plugins → types/plugins}/EmbeddedEntityBlock/Util.d.ts +4 -4
  460. package/dist/{plugins → types/plugins}/EmbeddedEntityBlock/index.d.ts +5 -5
  461. package/dist/{plugins → types/plugins}/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +13 -13
  462. package/dist/{plugins → types/plugins}/EmbeddedEntityInline/Util.d.ts +16 -16
  463. package/dist/{plugins → types/plugins}/EmbeddedEntityInline/index.d.ts +10 -9
  464. package/dist/types/plugins/Heading/__tests__/createHeadingPlugin.test.d.ts +1 -0
  465. package/dist/{plugins → types/plugins}/Heading/components/Heading.d.ts +10 -10
  466. package/dist/{plugins → types/plugins}/Heading/components/ToolbarHeadingButton.d.ts +5 -4
  467. package/dist/{plugins → types/plugins}/Heading/createHeadingPlugin.d.ts +2 -2
  468. package/dist/{plugins → types/plugins}/Heading/index.d.ts +2 -2
  469. package/dist/{plugins → types/plugins}/Hr/index.d.ts +11 -11
  470. package/dist/{plugins → types/plugins}/Hyperlink/HyperlinkModal.d.ts +17 -16
  471. package/dist/types/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.d.ts +1 -0
  472. package/dist/{plugins → types/plugins}/Hyperlink/components/EntityHyperlink.d.ts +21 -20
  473. package/dist/{plugins → types/plugins}/Hyperlink/components/ToolbarHyperlinkButton.d.ts +6 -5
  474. package/dist/{plugins → types/plugins}/Hyperlink/components/UrlHyperlink.d.ts +22 -21
  475. package/dist/{plugins → types/plugins}/Hyperlink/components/styles.d.ts +4 -4
  476. package/dist/{plugins → types/plugins}/Hyperlink/createHyperlinkPlugin.d.ts +3 -3
  477. package/dist/{plugins → types/plugins}/Hyperlink/index.d.ts +2 -2
  478. package/dist/{plugins → types/plugins}/Hyperlink/useEntityInfo.d.ts +16 -16
  479. package/dist/{plugins → types/plugins}/Hyperlink/utils.d.ts +5 -5
  480. package/dist/types/plugins/List/__tests__/createListPlugin.test.d.ts +1 -0
  481. package/dist/types/plugins/List/__tests__/insertListBreak.test.d.ts +1 -0
  482. package/dist/types/plugins/List/__tests__/insertListFragment.test.d.ts +1 -0
  483. package/dist/{plugins → types/plugins}/List/components/List.d.ts +4 -3
  484. package/dist/{plugins → types/plugins}/List/components/ListItem.d.ts +3 -2
  485. package/dist/{plugins → types/plugins}/List/components/ToolbarListButton.d.ts +5 -4
  486. package/dist/{plugins → types/plugins}/List/createListPlugin.d.ts +2 -2
  487. package/dist/{plugins → types/plugins}/List/index.d.ts +2 -2
  488. package/dist/{plugins → types/plugins}/List/insertListBreak.d.ts +2 -2
  489. package/dist/{plugins → types/plugins}/List/insertListFragment.d.ts +2 -2
  490. package/dist/{plugins → types/plugins}/List/onKeyDownList.d.ts +7 -7
  491. package/dist/{plugins → types/plugins}/List/transforms/insertListItem.d.ts +5 -5
  492. package/dist/{plugins → types/plugins}/List/transforms/moveListItemDown.d.ts +6 -6
  493. package/dist/{plugins → types/plugins}/List/transforms/moveListItems.d.ts +6 -6
  494. package/dist/types/plugins/List/transforms/moveListItems.test.d.ts +1 -0
  495. package/dist/{plugins → types/plugins}/List/transforms/toggleList.d.ts +4 -4
  496. package/dist/types/plugins/List/transforms/toggleList.spec.d.ts +1 -0
  497. package/dist/{plugins → types/plugins}/List/transforms/unwrapList.d.ts +4 -4
  498. package/dist/{plugins → types/plugins}/List/utils.d.ts +14 -14
  499. package/dist/{plugins → types/plugins}/List/withList.d.ts +2 -2
  500. package/dist/{plugins → types/plugins}/Marks/Bold.d.ts +11 -10
  501. package/dist/{plugins → types/plugins}/Marks/Code.d.ts +17 -16
  502. package/dist/{plugins → types/plugins}/Marks/Italic.d.ts +11 -10
  503. package/dist/{plugins → types/plugins}/Marks/Subscript.d.ts +17 -16
  504. package/dist/{plugins → types/plugins}/Marks/Superscript.d.ts +17 -16
  505. package/dist/{plugins → types/plugins}/Marks/Underline.d.ts +11 -10
  506. package/dist/{plugins → types/plugins}/Marks/components/MarkToolbarButton.d.ts +13 -13
  507. package/dist/{plugins → types/plugins}/Marks/helpers.d.ts +4 -4
  508. package/dist/{plugins → types/plugins}/Marks/index.d.ts +2 -2
  509. package/dist/{plugins → types/plugins}/Normalizer/baseRules.d.ts +2 -2
  510. package/dist/{plugins → types/plugins}/Normalizer/createNormalizerPlugin.d.ts +2 -2
  511. package/dist/types/plugins/Normalizer/createNormalizerPlugin.test.d.ts +1 -0
  512. package/dist/{plugins → types/plugins}/Normalizer/index.d.ts +2 -2
  513. package/dist/{plugins → types/plugins}/Normalizer/types.d.ts +38 -38
  514. package/dist/{plugins → types/plugins}/Normalizer/utils.d.ts +5 -5
  515. package/dist/{plugins → types/plugins}/Normalizer/withNormalizer.d.ts +2 -2
  516. package/dist/types/plugins/Paragraph/Paragraph.d.ts +3 -0
  517. package/dist/types/plugins/Paragraph/__tests__/createParagraphPlugin.test.d.ts +1 -0
  518. package/dist/{plugins → types/plugins}/Paragraph/createParagraphPlugin.d.ts +2 -2
  519. package/dist/{plugins → types/plugins}/Paragraph/index.d.ts +1 -1
  520. package/dist/{plugins → types/plugins}/Paragraph/utils.d.ts +2 -2
  521. package/dist/{plugins → types/plugins}/PasteHTML/createPasteHTMLPlugin.d.ts +8 -8
  522. package/dist/{plugins → types/plugins}/PasteHTML/index.d.ts +1 -1
  523. package/dist/types/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.d.ts +1 -0
  524. package/dist/{plugins → types/plugins}/PasteHTML/utils/sanitizeAnchors.d.ts +19 -19
  525. package/dist/{plugins → types/plugins}/PasteHTML/utils/sanitizeHTML.d.ts +1 -1
  526. package/dist/{plugins → types/plugins}/PasteHTML/utils/sanitizeSheets.d.ts +4 -4
  527. package/dist/types/plugins/Quote/__test__/createQuotePlugin.test.d.ts +1 -0
  528. package/dist/types/plugins/Quote/components/Quote.d.ts +3 -0
  529. package/dist/{plugins → types/plugins}/Quote/components/ToolbarQuoteButton.d.ts +5 -4
  530. package/dist/{plugins → types/plugins}/Quote/createQuotePlugin.d.ts +2 -2
  531. package/dist/{plugins → types/plugins}/Quote/index.d.ts +2 -2
  532. package/dist/{plugins → types/plugins}/Quote/shouldResetQuote.d.ts +8 -8
  533. package/dist/{plugins → types/plugins}/Quote/toggleQuote.d.ts +4 -4
  534. package/dist/{plugins → types/plugins}/Quote/withQuote.d.ts +2 -2
  535. package/dist/{plugins → types/plugins}/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -2
  536. package/dist/{plugins → types/plugins}/SelectOnBackspace/index.d.ts +1 -1
  537. package/dist/types/plugins/Table/__tests__/createTablePlugin.test.d.ts +1 -0
  538. package/dist/types/plugins/Table/__tests__/helpers.test.d.ts +1 -0
  539. package/dist/{plugins → types/plugins}/Table/actions/addColumn.d.ts +7 -7
  540. package/dist/{plugins → types/plugins}/Table/actions/addRow.d.ts +3 -3
  541. package/dist/{plugins → types/plugins}/Table/actions/index.d.ts +3 -3
  542. package/dist/{plugins → types/plugins}/Table/actions/setHeader.d.ts +2 -2
  543. package/dist/types/plugins/Table/components/Cell.d.ts +3 -0
  544. package/dist/{plugins → types/plugins}/Table/components/HeaderCell.d.ts +3 -2
  545. package/dist/types/plugins/Table/components/Row.d.ts +3 -0
  546. package/dist/{plugins → types/plugins}/Table/components/Table.d.ts +3 -2
  547. package/dist/types/plugins/Table/components/TableActions.d.ts +5 -0
  548. package/dist/{plugins → types/plugins}/Table/components/ToolbarButton.d.ts +5 -4
  549. package/dist/{plugins → types/plugins}/Table/createTablePlugin.d.ts +2 -2
  550. package/dist/{plugins → types/plugins}/Table/helpers.d.ts +15 -15
  551. package/dist/{plugins → types/plugins}/Table/index.d.ts +2 -2
  552. package/dist/{plugins → types/plugins}/Table/insertTableFragment.d.ts +3 -3
  553. package/dist/{plugins → types/plugins}/Table/onKeyDownTable.d.ts +2 -2
  554. package/dist/{plugins → types/plugins}/Table/tableTracking.d.ts +4 -4
  555. package/dist/types/plugins/Text/__tests__/createTextPlugin.test.d.ts +2 -0
  556. package/dist/{plugins → types/plugins}/Text/createTextPlugin.d.ts +2 -2
  557. package/dist/{plugins → types/plugins}/Text/index.d.ts +1 -1
  558. package/dist/{plugins → types/plugins}/Tracking/createTrackingPlugin.d.ts +12 -12
  559. package/dist/{plugins → types/plugins}/Tracking/index.d.ts +1 -1
  560. package/dist/{plugins → types/plugins}/Tracking/utils.d.ts +2 -2
  561. package/dist/{plugins → types/plugins}/TrailingParagraph/index.d.ts +2 -2
  562. package/dist/{plugins → types/plugins}/Voids/createVoidsPlugin.d.ts +2 -2
  563. package/dist/{plugins → types/plugins}/Voids/index.d.ts +1 -1
  564. package/dist/{plugins → types/plugins}/Voids/transformVoid.d.ts +5 -5
  565. package/dist/{plugins → types/plugins}/index.d.ts +6 -6
  566. package/dist/{plugins → types/plugins}/links-tracking.d.ts +3 -3
  567. package/dist/{plugins → types/plugins}/shared/FetchingWrappedAssetCard.d.ts +14 -13
  568. package/dist/{plugins → types/plugins}/shared/FetchingWrappedEntryCard.d.ts +14 -13
  569. package/dist/{plugins → types/plugins}/shared/ToolbarButton.d.ts +12 -11
  570. package/dist/types/plugins/shared/__tests__/FetchingWrappedAssetCard.test.d.ts +1 -0
  571. package/dist/types/plugins/shared/__tests__/FetchingWrappedEntryCard.test.d.ts +1 -0
  572. package/dist/{prepareDocument.d.ts → types/prepareDocument.d.ts} +19 -19
  573. package/dist/{test-utils → types/test-utils}/assertOutput.d.ts +7 -7
  574. package/dist/{test-utils → types/test-utils}/createEditor.d.ts +31 -31
  575. package/dist/{test-utils → types/test-utils}/index.d.ts +4 -4
  576. package/dist/{test-utils → types/test-utils}/jsx.d.ts +28 -28
  577. package/dist/{test-utils → types/test-utils}/mockPlugin.d.ts +2 -2
  578. package/dist/{test-utils → types/test-utils}/randomId.d.ts +4 -4
  579. package/dist/{test-utils → types/test-utils}/setEmptyDataAttribute.d.ts +6 -6
  580. package/dist/{test-utils → types/test-utils}/validation.d.ts +1 -1
  581. package/dist/{useOnValueChanged.d.ts → types/useOnValueChanged.d.ts} +8 -8
  582. package/package.json +27 -21
  583. package/CHANGELOG.md +0 -946
  584. package/dist/Toolbar/index.d.ts +0 -5
  585. package/dist/field-editor-rich-text.cjs.development.js +0 -7210
  586. package/dist/field-editor-rich-text.cjs.development.js.map +0 -1
  587. package/dist/field-editor-rich-text.cjs.production.min.js +0 -163
  588. package/dist/field-editor-rich-text.cjs.production.min.js.map +0 -1
  589. package/dist/field-editor-rich-text.esm.js +0 -7200
  590. package/dist/field-editor-rich-text.esm.js.map +0 -1
  591. package/dist/index.js +0 -8
  592. package/dist/internal/types/editor.d.ts +0 -51
  593. package/dist/plugins/List/transforms/deleteBackwardList.d.ts +0 -2
  594. package/dist/plugins/Paragraph/Paragraph.d.ts +0 -2
  595. package/dist/plugins/Quote/components/Quote.d.ts +0 -2
  596. package/dist/plugins/Table/components/Cell.d.ts +0 -2
  597. package/dist/plugins/Table/components/Row.d.ts +0 -2
  598. package/dist/plugins/Table/components/TableActions.d.ts +0 -4
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ToolbarCodeButton: function() {
13
+ return ToolbarCodeButton;
14
+ },
15
+ ToolbarDropdownCodeButton: function() {
16
+ return ToolbarDropdownCodeButton;
17
+ },
18
+ Code: function() {
19
+ return Code;
20
+ },
21
+ createCodePlugin: function() {
22
+ return createCodePlugin;
23
+ }
24
+ });
25
+ const _react = _interop_require_wildcard(require("react"));
26
+ const _f36icons = require("@contentful/f36-icons");
27
+ const _richtexttypes = require("@contentful/rich-text-types");
28
+ const _platebasicmarks = require("@udecode/plate-basic-marks");
29
+ const _emotion = require("emotion");
30
+ const _MarkToolbarButton = require("./components/MarkToolbarButton");
31
+ const _helpers = require("./helpers");
32
+ function _getRequireWildcardCache(nodeInterop) {
33
+ if (typeof WeakMap !== "function") return null;
34
+ var cacheBabelInterop = new WeakMap();
35
+ var cacheNodeInterop = new WeakMap();
36
+ return (_getRequireWildcardCache = function(nodeInterop) {
37
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
38
+ })(nodeInterop);
39
+ }
40
+ function _interop_require_wildcard(obj, nodeInterop) {
41
+ if (!nodeInterop && obj && obj.__esModule) {
42
+ return obj;
43
+ }
44
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
45
+ return {
46
+ default: obj
47
+ };
48
+ }
49
+ var cache = _getRequireWildcardCache(nodeInterop);
50
+ if (cache && cache.has(obj)) {
51
+ return cache.get(obj);
52
+ }
53
+ var newObj = {};
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
71
+ const ToolbarCodeButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
72
+ title: 'Code',
73
+ mark: _richtexttypes.MARKS.CODE,
74
+ icon: _react.createElement(_f36icons.CodeIcon, null)
75
+ });
76
+ const ToolbarDropdownCodeButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
77
+ title: 'Code',
78
+ mark: _richtexttypes.MARKS.CODE
79
+ });
80
+ const styles = {
81
+ code: (0, _emotion.css)({
82
+ fontFamily: 'monospace',
83
+ fontSize: '.9em'
84
+ })
85
+ };
86
+ function Code(props) {
87
+ return _react.createElement("code", {
88
+ ...props.attributes,
89
+ className: styles.code
90
+ }, props.children);
91
+ }
92
+ const createCodePlugin = ()=>(0, _platebasicmarks.createCodePlugin)({
93
+ type: _richtexttypes.MARKS.CODE,
94
+ component: Code,
95
+ options: {
96
+ hotkey: [
97
+ 'mod+/',
98
+ 'mod+shift+7'
99
+ ]
100
+ },
101
+ handlers: {
102
+ onKeyDown: (0, _helpers.buildMarkEventHandler)(_richtexttypes.MARKS.CODE)
103
+ },
104
+ deserializeHtml: {
105
+ rules: [
106
+ {
107
+ validNodeName: [
108
+ 'CODE',
109
+ 'PRE'
110
+ ]
111
+ },
112
+ {
113
+ validStyle: {
114
+ fontFamily: [
115
+ 'Consolas',
116
+ 'monospace'
117
+ ]
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ });
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ToolbarItalicButton: function() {
13
+ return ToolbarItalicButton;
14
+ },
15
+ Italic: function() {
16
+ return Italic;
17
+ },
18
+ createItalicPlugin: function() {
19
+ return createItalicPlugin;
20
+ }
21
+ });
22
+ const _react = _interop_require_wildcard(require("react"));
23
+ const _f36icons = require("@contentful/f36-icons");
24
+ const _richtexttypes = require("@contentful/rich-text-types");
25
+ const _platebasicmarks = require("@udecode/plate-basic-marks");
26
+ const _emotion = require("emotion");
27
+ const _queries = require("../../internal/queries");
28
+ const _MarkToolbarButton = require("./components/MarkToolbarButton");
29
+ const _helpers = require("./helpers");
30
+ function _getRequireWildcardCache(nodeInterop) {
31
+ if (typeof WeakMap !== "function") return null;
32
+ var cacheBabelInterop = new WeakMap();
33
+ var cacheNodeInterop = new WeakMap();
34
+ return (_getRequireWildcardCache = function(nodeInterop) {
35
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
+ })(nodeInterop);
37
+ }
38
+ function _interop_require_wildcard(obj, nodeInterop) {
39
+ if (!nodeInterop && obj && obj.__esModule) {
40
+ return obj;
41
+ }
42
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
43
+ return {
44
+ default: obj
45
+ };
46
+ }
47
+ var cache = _getRequireWildcardCache(nodeInterop);
48
+ if (cache && cache.has(obj)) {
49
+ return cache.get(obj);
50
+ }
51
+ var newObj = {};
52
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
53
+ for(var key in obj){
54
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
55
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
56
+ if (desc && (desc.get || desc.set)) {
57
+ Object.defineProperty(newObj, key, desc);
58
+ } else {
59
+ newObj[key] = obj[key];
60
+ }
61
+ }
62
+ }
63
+ newObj.default = obj;
64
+ if (cache) {
65
+ cache.set(obj, newObj);
66
+ }
67
+ return newObj;
68
+ }
69
+ const ToolbarItalicButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
70
+ title: 'Italic',
71
+ mark: _richtexttypes.MARKS.ITALIC,
72
+ icon: _react.createElement(_f36icons.FormatItalicIcon, null)
73
+ });
74
+ const styles = {
75
+ italic: (0, _emotion.css)({
76
+ fontStyle: 'italic'
77
+ })
78
+ };
79
+ function Italic(props) {
80
+ return _react.createElement("em", {
81
+ ...props.attributes,
82
+ className: styles.italic
83
+ }, props.children);
84
+ }
85
+ const createItalicPlugin = ()=>(0, _platebasicmarks.createItalicPlugin)({
86
+ type: _richtexttypes.MARKS.ITALIC,
87
+ component: Italic,
88
+ options: {
89
+ hotkey: [
90
+ 'mod+i'
91
+ ]
92
+ },
93
+ handlers: {
94
+ onKeyDown: (0, _helpers.buildMarkEventHandler)(_richtexttypes.MARKS.ITALIC)
95
+ },
96
+ deserializeHtml: {
97
+ rules: [
98
+ {
99
+ validNodeName: [
100
+ 'I',
101
+ 'EM'
102
+ ]
103
+ },
104
+ {
105
+ validStyle: {
106
+ fontStyle: 'italic'
107
+ }
108
+ }
109
+ ],
110
+ query: (el)=>{
111
+ return !(0, _queries.someHtmlElement)(el, (node)=>node.style.fontStyle === 'normal');
112
+ }
113
+ }
114
+ });
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ToolbarSubscriptButton: function() {
13
+ return ToolbarSubscriptButton;
14
+ },
15
+ ToolbarDropdownSubscriptButton: function() {
16
+ return ToolbarDropdownSubscriptButton;
17
+ },
18
+ Subscript: function() {
19
+ return Subscript;
20
+ },
21
+ createSubscriptPlugin: function() {
22
+ return createSubscriptPlugin;
23
+ }
24
+ });
25
+ const _react = _interop_require_wildcard(require("react"));
26
+ const _f36icons = require("@contentful/f36-icons");
27
+ const _richtexttypes = require("@contentful/rich-text-types");
28
+ const _platebasicmarks = require("@udecode/plate-basic-marks");
29
+ const _emotion = require("emotion");
30
+ const _MarkToolbarButton = require("./components/MarkToolbarButton");
31
+ const _helpers = require("./helpers");
32
+ function _getRequireWildcardCache(nodeInterop) {
33
+ if (typeof WeakMap !== "function") return null;
34
+ var cacheBabelInterop = new WeakMap();
35
+ var cacheNodeInterop = new WeakMap();
36
+ return (_getRequireWildcardCache = function(nodeInterop) {
37
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
38
+ })(nodeInterop);
39
+ }
40
+ function _interop_require_wildcard(obj, nodeInterop) {
41
+ if (!nodeInterop && obj && obj.__esModule) {
42
+ return obj;
43
+ }
44
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
45
+ return {
46
+ default: obj
47
+ };
48
+ }
49
+ var cache = _getRequireWildcardCache(nodeInterop);
50
+ if (cache && cache.has(obj)) {
51
+ return cache.get(obj);
52
+ }
53
+ var newObj = {};
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
71
+ const styles = {
72
+ subscript: (0, _emotion.css)({
73
+ verticalAlign: 'sub',
74
+ fontSize: 'smaller'
75
+ })
76
+ };
77
+ const ToolbarSubscriptButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
78
+ title: 'Subscript',
79
+ mark: _richtexttypes.MARKS.SUBSCRIPT,
80
+ icon: _react.createElement(_f36icons.SubscriptIcon, {
81
+ viewBox: "0 0 23 18"
82
+ })
83
+ });
84
+ const ToolbarDropdownSubscriptButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
85
+ title: 'Subscript',
86
+ mark: _richtexttypes.MARKS.SUBSCRIPT
87
+ });
88
+ function Subscript(props) {
89
+ return _react.createElement("sub", {
90
+ ...props.attributes,
91
+ className: styles.subscript
92
+ }, props.children);
93
+ }
94
+ const createSubscriptPlugin = ()=>(0, _platebasicmarks.createSubscriptPlugin)({
95
+ type: _richtexttypes.MARKS.SUBSCRIPT,
96
+ component: Subscript,
97
+ handlers: {
98
+ onKeyDown: (0, _helpers.buildMarkEventHandler)(_richtexttypes.MARKS.SUBSCRIPT)
99
+ },
100
+ deserializeHtml: {
101
+ rules: [
102
+ {
103
+ validNodeName: [
104
+ 'SUB'
105
+ ]
106
+ }
107
+ ]
108
+ }
109
+ });
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ToolbarSuperscriptButton: function() {
13
+ return ToolbarSuperscriptButton;
14
+ },
15
+ ToolbarDropdownSuperscriptButton: function() {
16
+ return ToolbarDropdownSuperscriptButton;
17
+ },
18
+ Superscript: function() {
19
+ return Superscript;
20
+ },
21
+ createSuperscriptPlugin: function() {
22
+ return createSuperscriptPlugin;
23
+ }
24
+ });
25
+ const _react = _interop_require_wildcard(require("react"));
26
+ const _f36icons = require("@contentful/f36-icons");
27
+ const _richtexttypes = require("@contentful/rich-text-types");
28
+ const _platebasicmarks = require("@udecode/plate-basic-marks");
29
+ const _emotion = require("emotion");
30
+ const _MarkToolbarButton = require("./components/MarkToolbarButton");
31
+ const _helpers = require("./helpers");
32
+ function _getRequireWildcardCache(nodeInterop) {
33
+ if (typeof WeakMap !== "function") return null;
34
+ var cacheBabelInterop = new WeakMap();
35
+ var cacheNodeInterop = new WeakMap();
36
+ return (_getRequireWildcardCache = function(nodeInterop) {
37
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
38
+ })(nodeInterop);
39
+ }
40
+ function _interop_require_wildcard(obj, nodeInterop) {
41
+ if (!nodeInterop && obj && obj.__esModule) {
42
+ return obj;
43
+ }
44
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
45
+ return {
46
+ default: obj
47
+ };
48
+ }
49
+ var cache = _getRequireWildcardCache(nodeInterop);
50
+ if (cache && cache.has(obj)) {
51
+ return cache.get(obj);
52
+ }
53
+ var newObj = {};
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
71
+ const styles = {
72
+ superscript: (0, _emotion.css)({
73
+ verticalAlign: 'super',
74
+ fontSize: 'smaller'
75
+ })
76
+ };
77
+ const ToolbarSuperscriptButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
78
+ title: 'Superscript',
79
+ mark: _richtexttypes.MARKS.SUPERSCRIPT,
80
+ icon: _react.createElement(_f36icons.SuperscriptIcon, null)
81
+ });
82
+ const ToolbarDropdownSuperscriptButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
83
+ title: 'Superscript',
84
+ mark: _richtexttypes.MARKS.SUPERSCRIPT
85
+ });
86
+ function Superscript(props) {
87
+ return _react.createElement("sup", {
88
+ ...props.attributes,
89
+ className: styles.superscript
90
+ }, props.children);
91
+ }
92
+ const createSuperscriptPlugin = ()=>(0, _platebasicmarks.createSuperscriptPlugin)({
93
+ type: _richtexttypes.MARKS.SUPERSCRIPT,
94
+ component: Superscript,
95
+ handlers: {
96
+ onKeyDown: (0, _helpers.buildMarkEventHandler)(_richtexttypes.MARKS.SUPERSCRIPT)
97
+ },
98
+ deserializeHtml: {
99
+ rules: [
100
+ {
101
+ validNodeName: [
102
+ 'SUP'
103
+ ]
104
+ }
105
+ ]
106
+ }
107
+ });
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ToolbarUnderlineButton: function() {
13
+ return ToolbarUnderlineButton;
14
+ },
15
+ Underline: function() {
16
+ return Underline;
17
+ },
18
+ createUnderlinePlugin: function() {
19
+ return createUnderlinePlugin;
20
+ }
21
+ });
22
+ const _react = _interop_require_wildcard(require("react"));
23
+ const _f36icons = require("@contentful/f36-icons");
24
+ const _richtexttypes = require("@contentful/rich-text-types");
25
+ const _platebasicmarks = require("@udecode/plate-basic-marks");
26
+ const _queries = require("../../internal/queries");
27
+ const _MarkToolbarButton = require("./components/MarkToolbarButton");
28
+ const _helpers = require("./helpers");
29
+ function _getRequireWildcardCache(nodeInterop) {
30
+ if (typeof WeakMap !== "function") return null;
31
+ var cacheBabelInterop = new WeakMap();
32
+ var cacheNodeInterop = new WeakMap();
33
+ return (_getRequireWildcardCache = function(nodeInterop) {
34
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
35
+ })(nodeInterop);
36
+ }
37
+ function _interop_require_wildcard(obj, nodeInterop) {
38
+ if (!nodeInterop && obj && obj.__esModule) {
39
+ return obj;
40
+ }
41
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
42
+ return {
43
+ default: obj
44
+ };
45
+ }
46
+ var cache = _getRequireWildcardCache(nodeInterop);
47
+ if (cache && cache.has(obj)) {
48
+ return cache.get(obj);
49
+ }
50
+ var newObj = {};
51
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
52
+ for(var key in obj){
53
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
54
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
55
+ if (desc && (desc.get || desc.set)) {
56
+ Object.defineProperty(newObj, key, desc);
57
+ } else {
58
+ newObj[key] = obj[key];
59
+ }
60
+ }
61
+ }
62
+ newObj.default = obj;
63
+ if (cache) {
64
+ cache.set(obj, newObj);
65
+ }
66
+ return newObj;
67
+ }
68
+ const ToolbarUnderlineButton = (0, _MarkToolbarButton.createMarkToolbarButton)({
69
+ title: 'Underline',
70
+ mark: _richtexttypes.MARKS.UNDERLINE,
71
+ icon: _react.createElement(_f36icons.FormatUnderlinedIcon, null)
72
+ });
73
+ function Underline(props) {
74
+ return _react.createElement("u", props.attributes, props.children);
75
+ }
76
+ const createUnderlinePlugin = ()=>(0, _platebasicmarks.createUnderlinePlugin)({
77
+ type: _richtexttypes.MARKS.UNDERLINE,
78
+ component: Underline,
79
+ options: {
80
+ hotkey: [
81
+ 'mod+u'
82
+ ]
83
+ },
84
+ handlers: {
85
+ onKeyDown: (0, _helpers.buildMarkEventHandler)(_richtexttypes.MARKS.UNDERLINE)
86
+ },
87
+ deserializeHtml: {
88
+ rules: [
89
+ {
90
+ validNodeName: [
91
+ 'U'
92
+ ]
93
+ },
94
+ {
95
+ validStyle: {
96
+ textDecoration: [
97
+ 'underline'
98
+ ]
99
+ }
100
+ }
101
+ ],
102
+ query: (el)=>{
103
+ return !(0, _queries.someHtmlElement)(el, (node)=>node.style.textDecoration === 'none');
104
+ }
105
+ }
106
+ });
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createMarkToolbarButton", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createMarkToolbarButton;
9
+ }
10
+ });
11
+ const _react = _interop_require_wildcard(require("react"));
12
+ const _f36components = require("@contentful/f36-components");
13
+ const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
14
+ const _emotion = require("emotion");
15
+ const _ContentfulEditorProvider = require("../../../ContentfulEditorProvider");
16
+ const _editor = require("../../../helpers/editor");
17
+ const _queries = require("../../../internal/queries");
18
+ const _ToolbarButton = require("../../shared/ToolbarButton");
19
+ const _helpers = require("../helpers");
20
+ function _interop_require_default(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ function _getRequireWildcardCache(nodeInterop) {
26
+ if (typeof WeakMap !== "function") return null;
27
+ var cacheBabelInterop = new WeakMap();
28
+ var cacheNodeInterop = new WeakMap();
29
+ return (_getRequireWildcardCache = function(nodeInterop) {
30
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
+ })(nodeInterop);
32
+ }
33
+ function _interop_require_wildcard(obj, nodeInterop) {
34
+ if (!nodeInterop && obj && obj.__esModule) {
35
+ return obj;
36
+ }
37
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
38
+ return {
39
+ default: obj
40
+ };
41
+ }
42
+ var cache = _getRequireWildcardCache(nodeInterop);
43
+ if (cache && cache.has(obj)) {
44
+ return cache.get(obj);
45
+ }
46
+ var newObj = {};
47
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
+ for(var key in obj){
49
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
50
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
51
+ if (desc && (desc.get || desc.set)) {
52
+ Object.defineProperty(newObj, key, desc);
53
+ } else {
54
+ newObj[key] = obj[key];
55
+ }
56
+ }
57
+ }
58
+ newObj.default = obj;
59
+ if (cache) {
60
+ cache.set(obj, newObj);
61
+ }
62
+ return newObj;
63
+ }
64
+ const styles = {
65
+ isActive: (0, _emotion.css)({
66
+ backgroundColor: _f36tokens.default.blue100,
67
+ color: _f36tokens.default.blue600
68
+ })
69
+ };
70
+ const createMarkToolbarButton = ({ mark , title , icon })=>{
71
+ const Mark = ({ isDisabled })=>{
72
+ const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
73
+ const handleClick = _react.useCallback(()=>{
74
+ if (!editor?.selection) return;
75
+ const isActive = (0, _queries.isMarkActive)(editor, mark);
76
+ editor.tracking.onToolbarAction(isActive ? 'unmark' : 'mark', {
77
+ markType: mark
78
+ });
79
+ (0, _helpers.toggleMarkAndDeactivateConflictingMarks)(editor, mark);
80
+ (0, _editor.focus)(editor);
81
+ }, [
82
+ editor
83
+ ]);
84
+ if (!editor) return null;
85
+ if (!icon) {
86
+ return _react.createElement(_f36components.Menu.Item, {
87
+ onClick: handleClick,
88
+ disabled: isDisabled,
89
+ className: (0, _emotion.cx)({
90
+ [styles.isActive]: (0, _queries.isMarkActive)(editor, mark)
91
+ }),
92
+ testId: `${mark}-toolbar-button`
93
+ }, title);
94
+ }
95
+ return _react.createElement(_ToolbarButton.ToolbarButton, {
96
+ title: title,
97
+ testId: `${mark}-toolbar-button`,
98
+ onClick: handleClick,
99
+ isActive: (0, _queries.isMarkActive)(editor, mark),
100
+ isDisabled: isDisabled
101
+ }, icon);
102
+ };
103
+ Mark.displayName = mark;
104
+ return Mark;
105
+ };