@atlaskit/renderer 105.1.1 → 106.0.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 (421) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/actions/index.js +19 -71
  3. package/dist/cjs/actions/matches-utils.js +10 -11
  4. package/dist/cjs/actions.js +0 -2
  5. package/dist/cjs/analytics/analyticsContext.js +0 -4
  6. package/dist/cjs/analytics/events.js +0 -5
  7. package/dist/cjs/analytics/unsupported-content.js +14 -27
  8. package/dist/cjs/i18n/cs.js +0 -1
  9. package/dist/cjs/i18n/da.js +0 -1
  10. package/dist/cjs/i18n/de.js +0 -1
  11. package/dist/cjs/i18n/en.js +0 -1
  12. package/dist/cjs/i18n/en_GB.js +0 -1
  13. package/dist/cjs/i18n/en_ZZ.js +0 -1
  14. package/dist/cjs/i18n/es.js +0 -1
  15. package/dist/cjs/i18n/et.js +0 -1
  16. package/dist/cjs/i18n/fi.js +0 -1
  17. package/dist/cjs/i18n/fr.js +0 -1
  18. package/dist/cjs/i18n/hu.js +0 -1
  19. package/dist/cjs/i18n/index.js +0 -26
  20. package/dist/cjs/i18n/it.js +0 -1
  21. package/dist/cjs/i18n/ja.js +0 -1
  22. package/dist/cjs/i18n/ko.js +0 -1
  23. package/dist/cjs/i18n/nb.js +0 -1
  24. package/dist/cjs/i18n/nl.js +0 -1
  25. package/dist/cjs/i18n/pl.js +0 -1
  26. package/dist/cjs/i18n/pt_BR.js +0 -1
  27. package/dist/cjs/i18n/pt_PT.js +0 -1
  28. package/dist/cjs/i18n/ru.js +0 -1
  29. package/dist/cjs/i18n/sk.js +0 -1
  30. package/dist/cjs/i18n/sv.js +0 -1
  31. package/dist/cjs/i18n/th.js +0 -1
  32. package/dist/cjs/i18n/tr.js +0 -1
  33. package/dist/cjs/i18n/uk.js +0 -1
  34. package/dist/cjs/i18n/vi.js +0 -1
  35. package/dist/cjs/i18n/zh.js +0 -1
  36. package/dist/cjs/i18n/zh_TW.js +0 -1
  37. package/dist/cjs/index.js +0 -6
  38. package/dist/cjs/messages.js +0 -2
  39. package/dist/cjs/react/hooks/use-bidi-warnings.js +2 -12
  40. package/dist/cjs/react/hooks/use-in-viewport.js +4 -17
  41. package/dist/cjs/react/hooks/use-observed-width.js +20 -35
  42. package/dist/cjs/react/index.js +27 -114
  43. package/dist/cjs/react/marks/alignment.js +0 -9
  44. package/dist/cjs/react/marks/annotation.js +6 -21
  45. package/dist/cjs/react/marks/breakout.js +0 -9
  46. package/dist/cjs/react/marks/code.js +0 -11
  47. package/dist/cjs/react/marks/confluence-inline-comment.js +2 -19
  48. package/dist/cjs/react/marks/data-consumer.js +0 -4
  49. package/dist/cjs/react/marks/em.js +0 -3
  50. package/dist/cjs/react/marks/fragment.js +0 -4
  51. package/dist/cjs/react/marks/indentation.js +0 -3
  52. package/dist/cjs/react/marks/index.js +1 -24
  53. package/dist/cjs/react/marks/link.js +5 -25
  54. package/dist/cjs/react/marks/strike.js +0 -4
  55. package/dist/cjs/react/marks/strong.js +0 -3
  56. package/dist/cjs/react/marks/subsup.js +0 -5
  57. package/dist/cjs/react/marks/textColor.js +0 -9
  58. package/dist/cjs/react/marks/underline.js +0 -3
  59. package/dist/cjs/react/marks/unsupportedMark.js +0 -3
  60. package/dist/cjs/react/marks/unsupportedNodeAttribute.js +0 -3
  61. package/dist/cjs/react/nodes/blockCard.js +4 -16
  62. package/dist/cjs/react/nodes/blockquote.js +0 -3
  63. package/dist/cjs/react/nodes/bodiedExtension.js +6 -17
  64. package/dist/cjs/react/nodes/bulletList.js +0 -5
  65. package/dist/cjs/react/nodes/caption.js +1 -6
  66. package/dist/cjs/react/nodes/codeBlock/codeBlock.js +5 -14
  67. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -16
  68. package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -23
  69. package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +9 -32
  70. package/dist/cjs/react/nodes/codeBlockCopyButton.js +7 -31
  71. package/dist/cjs/react/nodes/date.js +5 -33
  72. package/dist/cjs/react/nodes/decisionItem.js +1 -5
  73. package/dist/cjs/react/nodes/decisionList.js +0 -20
  74. package/dist/cjs/react/nodes/doc.js +0 -6
  75. package/dist/cjs/react/nodes/embedCard.js +25 -54
  76. package/dist/cjs/react/nodes/emoji.js +6 -24
  77. package/dist/cjs/react/nodes/extension.js +12 -26
  78. package/dist/cjs/react/nodes/fallback.js +2 -24
  79. package/dist/cjs/react/nodes/hardBreak.js +1 -7
  80. package/dist/cjs/react/nodes/heading-anchor.js +1 -46
  81. package/dist/cjs/react/nodes/heading.js +4 -17
  82. package/dist/cjs/react/nodes/index.js +7 -62
  83. package/dist/cjs/react/nodes/inline.js +0 -6
  84. package/dist/cjs/react/nodes/inlineCard.js +6 -23
  85. package/dist/cjs/react/nodes/inlineExtension.js +2 -10
  86. package/dist/cjs/react/nodes/layoutColumn.js +0 -8
  87. package/dist/cjs/react/nodes/layoutSection.js +0 -3
  88. package/dist/cjs/react/nodes/listItem.js +0 -3
  89. package/dist/cjs/react/nodes/media.js +10 -49
  90. package/dist/cjs/react/nodes/mediaGroup.js +6 -47
  91. package/dist/cjs/react/nodes/mediaInline.js +7 -37
  92. package/dist/cjs/react/nodes/mediaSingle/index.js +38 -85
  93. package/dist/cjs/react/nodes/mediaSingle/styles.js +0 -5
  94. package/dist/cjs/react/nodes/mention.js +5 -23
  95. package/dist/cjs/react/nodes/orderedList.js +0 -14
  96. package/dist/cjs/react/nodes/panel.js +10 -38
  97. package/dist/cjs/react/nodes/paragraph.js +1 -5
  98. package/dist/cjs/react/nodes/placeholder.js +0 -4
  99. package/dist/cjs/react/nodes/rule.js +0 -3
  100. package/dist/cjs/react/nodes/status.js +3 -22
  101. package/dist/cjs/react/nodes/table/colgroup.js +12 -26
  102. package/dist/cjs/react/nodes/table/sticky.js +17 -47
  103. package/dist/cjs/react/nodes/table/table.js +5 -10
  104. package/dist/cjs/react/nodes/table.js +19 -102
  105. package/dist/cjs/react/nodes/tableCell.js +26 -79
  106. package/dist/cjs/react/nodes/tableRow.js +4 -33
  107. package/dist/cjs/react/nodes/task-item-with-providers.js +4 -40
  108. package/dist/cjs/react/nodes/taskItem.js +8 -36
  109. package/dist/cjs/react/nodes/taskList.js +2 -22
  110. package/dist/cjs/react/nodes/text-wrapper.js +1 -8
  111. package/dist/cjs/react/nodes/unknownBlock.js +0 -3
  112. package/dist/cjs/react/renderer-node.js +0 -6
  113. package/dist/cjs/react/utils/clipboard.js +0 -3
  114. package/dist/cjs/react/utils/element-selection.js +0 -13
  115. package/dist/cjs/react/utils/getCardClickHandler.js +0 -3
  116. package/dist/cjs/react/utils/inject-props.js +4 -9
  117. package/dist/cjs/react/utils/links.js +2 -6
  118. package/dist/cjs/react/utils/lists.js +0 -1
  119. package/dist/cjs/react/utils/performance/RenderTracking.js +2 -10
  120. package/dist/cjs/react/utils/use-select-all-trap.js +1 -23
  121. package/dist/cjs/render-document.js +42 -83
  122. package/dist/cjs/renderer-context.js +0 -5
  123. package/dist/cjs/steps/index.js +7 -39
  124. package/dist/cjs/text/index.js +0 -9
  125. package/dist/cjs/text/nodes/blockquote.js +0 -3
  126. package/dist/cjs/text/nodes/bulletList.js +0 -3
  127. package/dist/cjs/text/nodes/date.js +0 -4
  128. package/dist/cjs/text/nodes/decisionItem.js +0 -5
  129. package/dist/cjs/text/nodes/hardBreak.js +0 -2
  130. package/dist/cjs/text/nodes/heading.js +0 -3
  131. package/dist/cjs/text/nodes/index.js +0 -21
  132. package/dist/cjs/text/nodes/inlineCard.js +0 -4
  133. package/dist/cjs/text/nodes/listItem.js +0 -3
  134. package/dist/cjs/text/nodes/mediaGroup.js +0 -4
  135. package/dist/cjs/text/nodes/mention.js +0 -3
  136. package/dist/cjs/text/nodes/orderedList.js +0 -4
  137. package/dist/cjs/text/nodes/panel.js +0 -3
  138. package/dist/cjs/text/nodes/paragraph.js +0 -5
  139. package/dist/cjs/text/nodes/rule.js +0 -2
  140. package/dist/cjs/text/nodes/status.js +0 -3
  141. package/dist/cjs/text/nodes/table.js +0 -5
  142. package/dist/cjs/text/nodes/taskItem.js +0 -5
  143. package/dist/cjs/text/nodes/unknown.js +0 -6
  144. package/dist/cjs/text-serializer.js +0 -2
  145. package/dist/cjs/ui/Expand.js +15 -59
  146. package/dist/cjs/ui/ExtensionRenderer.js +10 -43
  147. package/dist/cjs/ui/MediaCard.js +40 -116
  148. package/dist/cjs/ui/Renderer/ErrorBoundary.js +0 -26
  149. package/dist/cjs/ui/Renderer/breakout-ssr.js +6 -32
  150. package/dist/cjs/ui/Renderer/click-to-edit.js +0 -6
  151. package/dist/cjs/ui/Renderer/index.js +47 -149
  152. package/dist/cjs/ui/Renderer/style.js +1 -39
  153. package/dist/cjs/ui/Renderer/truncated-wrapper.js +12 -30
  154. package/dist/cjs/ui/RendererActionsContext/WithRendererActions.js +0 -4
  155. package/dist/cjs/ui/RendererActionsContext/index.js +1 -11
  156. package/dist/cjs/ui/SmartCardStorage.js +0 -20
  157. package/dist/cjs/ui/SortingIcon.js +10 -40
  158. package/dist/cjs/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -11
  159. package/dist/cjs/ui/TaskItemsFormatContext/index.js +0 -1
  160. package/dist/cjs/ui/active-header-id-provider.js +6 -19
  161. package/dist/cjs/ui/annotations/context.js +0 -24
  162. package/dist/cjs/ui/annotations/draft/component.js +5 -42
  163. package/dist/cjs/ui/annotations/draft/dom.js +3 -17
  164. package/dist/cjs/ui/annotations/draft/index.js +0 -2
  165. package/dist/cjs/ui/annotations/draft/position.js +1 -12
  166. package/dist/cjs/ui/annotations/draft/text.js +2 -8
  167. package/dist/cjs/ui/annotations/element/index.js +4 -16
  168. package/dist/cjs/ui/annotations/element/mark.js +8 -26
  169. package/dist/cjs/ui/annotations/hooks/index.js +0 -3
  170. package/dist/cjs/ui/annotations/hooks/use-events.js +13 -45
  171. package/dist/cjs/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -6
  172. package/dist/cjs/ui/annotations/hooks/use-inline-comments-filter.js +1 -8
  173. package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -19
  174. package/dist/cjs/ui/annotations/hooks/user-selection.js +3 -18
  175. package/dist/cjs/ui/annotations/hooks/utils.js +0 -2
  176. package/dist/cjs/ui/annotations/index.js +4 -20
  177. package/dist/cjs/ui/annotations/selection/index.js +0 -1
  178. package/dist/cjs/ui/annotations/selection/mounter.js +13 -42
  179. package/dist/cjs/ui/annotations/selection/range-validator.js +9 -23
  180. package/dist/cjs/ui/annotations/selection/wrapper.js +3 -13
  181. package/dist/cjs/ui/annotations/types.js +0 -1
  182. package/dist/cjs/ui/annotations/view/index.js +1 -12
  183. package/dist/cjs/ui/index.js +0 -2
  184. package/dist/cjs/use-feature-flags.js +0 -4
  185. package/dist/cjs/utils.js +1 -19
  186. package/dist/cjs/version.json +1 -1
  187. package/dist/es2019/actions/index.js +6 -50
  188. package/dist/es2019/actions/matches-utils.js +10 -9
  189. package/dist/es2019/actions.js +2 -1
  190. package/dist/es2019/analytics/events.js +0 -5
  191. package/dist/es2019/analytics/unsupported-content.js +8 -14
  192. package/dist/es2019/react/hooks/use-bidi-warnings.js +0 -2
  193. package/dist/es2019/react/hooks/use-in-viewport.js +0 -1
  194. package/dist/es2019/react/hooks/use-observed-width.js +0 -2
  195. package/dist/es2019/react/index.js +44 -119
  196. package/dist/es2019/react/marks/alignment.js +0 -3
  197. package/dist/es2019/react/marks/annotation.js +2 -5
  198. package/dist/es2019/react/marks/confluence-inline-comment.js +0 -1
  199. package/dist/es2019/react/marks/index.js +2 -1
  200. package/dist/es2019/react/marks/link.js +0 -6
  201. package/dist/es2019/react/marks/subsup.js +0 -3
  202. package/dist/es2019/react/nodes/bodiedExtension.js +2 -5
  203. package/dist/es2019/react/nodes/caption.js +0 -2
  204. package/dist/es2019/react/nodes/codeBlock/codeBlock.js +0 -2
  205. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +1 -3
  206. package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +1 -6
  207. package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -4
  208. package/dist/es2019/react/nodes/date.js +0 -7
  209. package/dist/es2019/react/nodes/decisionList.js +0 -3
  210. package/dist/es2019/react/nodes/embedCard.js +8 -16
  211. package/dist/es2019/react/nodes/emoji.js +0 -1
  212. package/dist/es2019/react/nodes/extension.js +4 -6
  213. package/dist/es2019/react/nodes/fallback.js +0 -8
  214. package/dist/es2019/react/nodes/hardBreak.js +0 -3
  215. package/dist/es2019/react/nodes/heading-anchor.js +0 -15
  216. package/dist/es2019/react/nodes/heading.js +0 -6
  217. package/dist/es2019/react/nodes/index.js +28 -61
  218. package/dist/es2019/react/nodes/inline.js +0 -2
  219. package/dist/es2019/react/nodes/inlineCard.js +0 -5
  220. package/dist/es2019/react/nodes/inlineExtension.js +2 -5
  221. package/dist/es2019/react/nodes/media.js +0 -10
  222. package/dist/es2019/react/nodes/mediaGroup.js +2 -22
  223. package/dist/es2019/react/nodes/mediaInline.js +1 -8
  224. package/dist/es2019/react/nodes/mediaSingle/index.js +8 -29
  225. package/dist/es2019/react/nodes/mention.js +0 -1
  226. package/dist/es2019/react/nodes/orderedList.js +0 -5
  227. package/dist/es2019/react/nodes/panel.js +4 -17
  228. package/dist/es2019/react/nodes/placeholder.js +0 -1
  229. package/dist/es2019/react/nodes/status.js +0 -1
  230. package/dist/es2019/react/nodes/table/colgroup.js +9 -18
  231. package/dist/es2019/react/nodes/table/sticky.js +3 -16
  232. package/dist/es2019/react/nodes/table.js +9 -75
  233. package/dist/es2019/react/nodes/tableCell.js +4 -31
  234. package/dist/es2019/react/nodes/tableRow.js +0 -10
  235. package/dist/es2019/react/nodes/task-item-with-providers.js +0 -6
  236. package/dist/es2019/react/nodes/taskItem.js +0 -7
  237. package/dist/es2019/react/nodes/taskList.js +0 -3
  238. package/dist/es2019/react/nodes/text-wrapper.js +0 -4
  239. package/dist/es2019/react/utils/clipboard.js +0 -1
  240. package/dist/es2019/react/utils/element-selection.js +0 -12
  241. package/dist/es2019/react/utils/inject-props.js +5 -7
  242. package/dist/es2019/react/utils/links.js +2 -4
  243. package/dist/es2019/react/utils/performance/RenderTracking.js +0 -1
  244. package/dist/es2019/react/utils/use-select-all-trap.js +0 -7
  245. package/dist/es2019/render-document.js +16 -33
  246. package/dist/es2019/steps/index.js +4 -33
  247. package/dist/es2019/text/index.js +0 -3
  248. package/dist/es2019/text/nodes/blockquote.js +0 -2
  249. package/dist/es2019/text/nodes/bulletList.js +0 -2
  250. package/dist/es2019/text/nodes/date.js +0 -2
  251. package/dist/es2019/text/nodes/decisionItem.js +0 -4
  252. package/dist/es2019/text/nodes/hardBreak.js +0 -1
  253. package/dist/es2019/text/nodes/heading.js +0 -2
  254. package/dist/es2019/text/nodes/inlineCard.js +0 -3
  255. package/dist/es2019/text/nodes/listItem.js +0 -2
  256. package/dist/es2019/text/nodes/mediaGroup.js +0 -3
  257. package/dist/es2019/text/nodes/mention.js +0 -2
  258. package/dist/es2019/text/nodes/orderedList.js +0 -2
  259. package/dist/es2019/text/nodes/panel.js +0 -2
  260. package/dist/es2019/text/nodes/paragraph.js +0 -4
  261. package/dist/es2019/text/nodes/rule.js +0 -1
  262. package/dist/es2019/text/nodes/status.js +0 -2
  263. package/dist/es2019/text/nodes/table.js +0 -4
  264. package/dist/es2019/text/nodes/taskItem.js +0 -4
  265. package/dist/es2019/text/nodes/unknown.js +0 -4
  266. package/dist/es2019/ui/Expand.js +2 -17
  267. package/dist/es2019/ui/ExtensionRenderer.js +0 -19
  268. package/dist/es2019/ui/MediaCard.js +9 -40
  269. package/dist/es2019/ui/Renderer/ErrorBoundary.js +0 -10
  270. package/dist/es2019/ui/Renderer/breakout-ssr.js +6 -26
  271. package/dist/es2019/ui/Renderer/click-to-edit.js +1 -4
  272. package/dist/es2019/ui/Renderer/index.js +17 -66
  273. package/dist/es2019/ui/Renderer/style.js +0 -14
  274. package/dist/es2019/ui/Renderer/truncated-wrapper.js +2 -6
  275. package/dist/es2019/ui/SmartCardStorage.js +0 -1
  276. package/dist/es2019/ui/SortingIcon.js +3 -20
  277. package/dist/es2019/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
  278. package/dist/es2019/ui/active-header-id-provider.js +0 -3
  279. package/dist/es2019/ui/annotations/context.js +0 -6
  280. package/dist/es2019/ui/annotations/draft/component.js +0 -13
  281. package/dist/es2019/ui/annotations/draft/dom.js +0 -6
  282. package/dist/es2019/ui/annotations/draft/position.js +0 -8
  283. package/dist/es2019/ui/annotations/draft/text.js +0 -1
  284. package/dist/es2019/ui/annotations/element/index.js +0 -3
  285. package/dist/es2019/ui/annotations/element/mark.js +4 -6
  286. package/dist/es2019/ui/annotations/hooks/use-events.js +4 -13
  287. package/dist/es2019/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
  288. package/dist/es2019/ui/annotations/hooks/use-inline-comments-filter.js +0 -1
  289. package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +4 -8
  290. package/dist/es2019/ui/annotations/hooks/user-selection.js +0 -6
  291. package/dist/es2019/ui/annotations/selection/mounter.js +0 -13
  292. package/dist/es2019/ui/annotations/selection/range-validator.js +0 -2
  293. package/dist/es2019/ui/annotations/selection/wrapper.js +0 -2
  294. package/dist/es2019/ui/annotations/types.js +0 -1
  295. package/dist/es2019/ui/annotations/view/index.js +0 -4
  296. package/dist/es2019/use-feature-flags.js +0 -1
  297. package/dist/es2019/utils.js +1 -8
  298. package/dist/es2019/version.json +1 -1
  299. package/dist/esm/actions/index.js +19 -63
  300. package/dist/esm/actions/matches-utils.js +10 -9
  301. package/dist/esm/actions.js +2 -1
  302. package/dist/esm/analytics/events.js +0 -5
  303. package/dist/esm/analytics/unsupported-content.js +14 -21
  304. package/dist/esm/react/hooks/use-bidi-warnings.js +2 -4
  305. package/dist/esm/react/hooks/use-in-viewport.js +4 -13
  306. package/dist/esm/react/hooks/use-observed-width.js +20 -29
  307. package/dist/esm/react/index.js +27 -111
  308. package/dist/esm/react/marks/alignment.js +0 -4
  309. package/dist/esm/react/marks/annotation.js +6 -14
  310. package/dist/esm/react/marks/breakout.js +0 -2
  311. package/dist/esm/react/marks/confluence-inline-comment.js +2 -12
  312. package/dist/esm/react/marks/index.js +2 -1
  313. package/dist/esm/react/marks/link.js +5 -12
  314. package/dist/esm/react/marks/subsup.js +0 -3
  315. package/dist/esm/react/nodes/blockCard.js +4 -4
  316. package/dist/esm/react/nodes/bodiedExtension.js +6 -10
  317. package/dist/esm/react/nodes/caption.js +1 -3
  318. package/dist/esm/react/nodes/codeBlock/codeBlock.js +4 -6
  319. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +4 -8
  320. package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -10
  321. package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +10 -21
  322. package/dist/esm/react/nodes/codeBlockCopyButton.js +7 -15
  323. package/dist/esm/react/nodes/date.js +5 -20
  324. package/dist/esm/react/nodes/decisionItem.js +1 -1
  325. package/dist/esm/react/nodes/decisionList.js +0 -12
  326. package/dist/esm/react/nodes/embedCard.js +25 -39
  327. package/dist/esm/react/nodes/emoji.js +6 -16
  328. package/dist/esm/react/nodes/extension.js +12 -16
  329. package/dist/esm/react/nodes/fallback.js +2 -18
  330. package/dist/esm/react/nodes/hardBreak.js +1 -5
  331. package/dist/esm/react/nodes/heading-anchor.js +1 -32
  332. package/dist/esm/react/nodes/heading.js +4 -10
  333. package/dist/esm/react/nodes/index.js +26 -64
  334. package/dist/esm/react/nodes/inline.js +0 -2
  335. package/dist/esm/react/nodes/inlineCard.js +6 -12
  336. package/dist/esm/react/nodes/inlineExtension.js +2 -6
  337. package/dist/esm/react/nodes/layoutColumn.js +0 -2
  338. package/dist/esm/react/nodes/media.js +10 -34
  339. package/dist/esm/react/nodes/mediaGroup.js +6 -37
  340. package/dist/esm/react/nodes/mediaInline.js +7 -20
  341. package/dist/esm/react/nodes/mediaSingle/index.js +37 -66
  342. package/dist/esm/react/nodes/mediaSingle/styles.js +0 -2
  343. package/dist/esm/react/nodes/mention.js +5 -15
  344. package/dist/esm/react/nodes/orderedList.js +0 -5
  345. package/dist/esm/react/nodes/panel.js +12 -28
  346. package/dist/esm/react/nodes/paragraph.js +1 -1
  347. package/dist/esm/react/nodes/placeholder.js +0 -1
  348. package/dist/esm/react/nodes/status.js +3 -13
  349. package/dist/esm/react/nodes/table/colgroup.js +12 -21
  350. package/dist/esm/react/nodes/table/sticky.js +17 -32
  351. package/dist/esm/react/nodes/table/table.js +5 -5
  352. package/dist/esm/react/nodes/table.js +19 -95
  353. package/dist/esm/react/nodes/tableCell.js +26 -66
  354. package/dist/esm/react/nodes/tableRow.js +4 -25
  355. package/dist/esm/react/nodes/task-item-with-providers.js +4 -27
  356. package/dist/esm/react/nodes/taskItem.js +8 -24
  357. package/dist/esm/react/nodes/taskList.js +2 -14
  358. package/dist/esm/react/nodes/text-wrapper.js +1 -5
  359. package/dist/esm/react/utils/clipboard.js +0 -1
  360. package/dist/esm/react/utils/element-selection.js +0 -10
  361. package/dist/esm/react/utils/inject-props.js +5 -7
  362. package/dist/esm/react/utils/links.js +2 -4
  363. package/dist/esm/react/utils/performance/RenderTracking.js +2 -4
  364. package/dist/esm/react/utils/use-select-all-trap.js +1 -9
  365. package/dist/esm/render-document.js +42 -70
  366. package/dist/esm/steps/index.js +7 -36
  367. package/dist/esm/text/index.js +0 -6
  368. package/dist/esm/text/nodes/blockquote.js +0 -2
  369. package/dist/esm/text/nodes/bulletList.js +0 -2
  370. package/dist/esm/text/nodes/date.js +0 -2
  371. package/dist/esm/text/nodes/decisionItem.js +0 -4
  372. package/dist/esm/text/nodes/hardBreak.js +0 -1
  373. package/dist/esm/text/nodes/heading.js +0 -2
  374. package/dist/esm/text/nodes/inlineCard.js +0 -3
  375. package/dist/esm/text/nodes/listItem.js +0 -2
  376. package/dist/esm/text/nodes/mediaGroup.js +0 -3
  377. package/dist/esm/text/nodes/mention.js +0 -2
  378. package/dist/esm/text/nodes/orderedList.js +0 -2
  379. package/dist/esm/text/nodes/panel.js +0 -2
  380. package/dist/esm/text/nodes/paragraph.js +0 -4
  381. package/dist/esm/text/nodes/rule.js +0 -1
  382. package/dist/esm/text/nodes/status.js +0 -2
  383. package/dist/esm/text/nodes/table.js +0 -4
  384. package/dist/esm/text/nodes/taskItem.js +0 -4
  385. package/dist/esm/text/nodes/unknown.js +0 -4
  386. package/dist/esm/ui/Expand.js +15 -36
  387. package/dist/esm/ui/ExtensionRenderer.js +10 -39
  388. package/dist/esm/ui/MediaCard.js +42 -99
  389. package/dist/esm/ui/Renderer/ErrorBoundary.js +0 -16
  390. package/dist/esm/ui/Renderer/breakout-ssr.js +7 -27
  391. package/dist/esm/ui/Renderer/click-to-edit.js +1 -4
  392. package/dist/esm/ui/Renderer/index.js +47 -110
  393. package/dist/esm/ui/Renderer/style.js +1 -21
  394. package/dist/esm/ui/Renderer/truncated-wrapper.js +12 -23
  395. package/dist/esm/ui/RendererActionsContext/index.js +1 -1
  396. package/dist/esm/ui/SmartCardStorage.js +0 -9
  397. package/dist/esm/ui/SortingIcon.js +10 -29
  398. package/dist/esm/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
  399. package/dist/esm/ui/active-header-id-provider.js +6 -12
  400. package/dist/esm/ui/annotations/context.js +0 -15
  401. package/dist/esm/ui/annotations/draft/component.js +5 -19
  402. package/dist/esm/ui/annotations/draft/dom.js +3 -11
  403. package/dist/esm/ui/annotations/draft/position.js +1 -9
  404. package/dist/esm/ui/annotations/draft/text.js +2 -4
  405. package/dist/esm/ui/annotations/element/index.js +4 -7
  406. package/dist/esm/ui/annotations/element/mark.js +8 -14
  407. package/dist/esm/ui/annotations/hooks/use-events.js +13 -32
  408. package/dist/esm/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
  409. package/dist/esm/ui/annotations/hooks/use-inline-comments-filter.js +1 -2
  410. package/dist/esm/ui/annotations/hooks/use-load-annotations.js +4 -12
  411. package/dist/esm/ui/annotations/hooks/user-selection.js +3 -11
  412. package/dist/esm/ui/annotations/index.js +4 -6
  413. package/dist/esm/ui/annotations/selection/mounter.js +13 -29
  414. package/dist/esm/ui/annotations/selection/range-validator.js +9 -12
  415. package/dist/esm/ui/annotations/selection/wrapper.js +3 -5
  416. package/dist/esm/ui/annotations/types.js +0 -1
  417. package/dist/esm/ui/annotations/view/index.js +1 -5
  418. package/dist/esm/use-feature-flags.js +0 -1
  419. package/dist/esm/utils.js +1 -8
  420. package/dist/esm/version.json +1 -1
  421. package/package.json +7 -7
@@ -1,5 +1,4 @@
1
1
  import { reduce } from './';
2
-
3
2
  const table = (node, schema) => {
4
3
  const result = [];
5
4
  node.forEach(n => {
@@ -7,7 +6,6 @@ const table = (node, schema) => {
7
6
  });
8
7
  return result.join('\n');
9
8
  };
10
-
11
9
  const tableRow = (node, schema) => {
12
10
  const result = [];
13
11
  let separator = '|';
@@ -16,7 +14,6 @@ const tableRow = (node, schema) => {
16
14
  });
17
15
  return `${separator}${result.join(`${separator}`)}${separator}`;
18
16
  };
19
-
20
17
  const tableCell = (node, schema) => {
21
18
  const result = [];
22
19
  node.forEach(n => {
@@ -24,5 +21,4 @@ const tableCell = (node, schema) => {
24
21
  });
25
22
  return result.join('\n');
26
23
  };
27
-
28
24
  export default table;
@@ -1,21 +1,17 @@
1
1
  import { reduce } from './';
2
-
3
2
  const taskItem = (node, schema) => {
4
3
  const result = [];
5
4
  let previousNodeType = '';
6
5
  const state = node.attrs.state === 'DONE' ? '[x]' : '[]';
7
6
  node.forEach(n => {
8
7
  const text = reduce(n, schema);
9
-
10
8
  if (previousNodeType === 'mention' && !text.startsWith(' ')) {
11
9
  result.push(` ${text}`);
12
10
  } else {
13
11
  result.push(text);
14
12
  }
15
-
16
13
  previousNodeType = n.type.name;
17
14
  });
18
15
  return `${state} ${result.join('').trim()}`;
19
16
  };
20
-
21
17
  export default taskItem;
@@ -1,17 +1,13 @@
1
1
  import { getText } from '../../utils';
2
2
  import { reduce } from './';
3
-
4
3
  const unknown = (node, schema) => {
5
4
  const result = [];
6
5
  node.forEach(n => {
7
6
  result.push(reduce(n, schema));
8
7
  });
9
-
10
8
  if (result.length > 0) {
11
9
  return result.join('');
12
10
  }
13
-
14
11
  return getText(node);
15
12
  };
16
-
17
13
  export default unknown;
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import React, { useRef, useCallback, useMemo } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -26,11 +25,9 @@ const titleStyles = css`
26
25
  padding: 0 0 0 ${gridSize() / 2}px;
27
26
  text-align: left;
28
27
  `;
29
-
30
28
  const Container = props => {
31
29
  const paddingBottom = `${props.expanded ? gridSize() : 0}px`;
32
30
  const sharedContainerStyles = sharedExpandStyles.containerStyles(props);
33
-
34
31
  const styles = themeProps => css`
35
32
  ${sharedContainerStyles({
36
33
  theme: themeProps
@@ -38,15 +35,12 @@ const Container = props => {
38
35
  padding: 0;
39
36
  padding-bottom: ${paddingBottom};
40
37
  `;
41
-
42
38
  return jsx("div", _extends({
43
39
  css: styles
44
40
  }, props), props.children);
45
41
  };
46
-
47
42
  const TitleContainer = props => {
48
43
  const paddingBottom = `${!props.expanded ? gridSize() : 0}px`;
49
-
50
44
  const styles = themeProps => css`
51
45
  ${sharedExpandStyles.titleContainerStyles({
52
46
  theme: themeProps
@@ -54,18 +48,14 @@ const TitleContainer = props => {
54
48
  padding: ${gridSize()}px;
55
49
  padding-bottom: ${paddingBottom};
56
50
  `;
57
-
58
51
  return jsx("button", _extends({
59
52
  css: styles
60
53
  }, props), props.children);
61
54
  };
62
-
63
55
  TitleContainer.displayName = 'TitleContainerButton';
64
-
65
56
  const ContentContainer = props => {
66
57
  const sharedContentStyles = sharedExpandStyles.contentStyles(props);
67
58
  const visibility = props.expanded ? 'visible' : 'hidden';
68
-
69
59
  const styles = themeProps => css`
70
60
  ${sharedContentStyles({
71
61
  theme: themeProps
@@ -74,17 +64,14 @@ const ContentContainer = props => {
74
64
  padding-left: ${gridSize() * 5 - gridSize() / 2}px;
75
65
  visibility: ${visibility};
76
66
  `;
77
-
78
67
  return jsx("div", _extends({
79
68
  css: styles
80
69
  }, props), props.children);
81
70
  };
82
-
83
71
  function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
84
72
  if (!fireAnalyticsEvent) {
85
73
  return;
86
74
  }
87
-
88
75
  fireAnalyticsEvent({
89
76
  action: ACTION.TOGGLE_EXPAND,
90
77
  actionSubject: nodeType === 'expand' ? ACTION_SUBJECT.EXPAND : ACTION_SUBJECT.NESTED_EXPAND,
@@ -96,7 +83,6 @@ function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
96
83
  eventType: EVENT_TYPE.TRACK
97
84
  });
98
85
  }
99
-
100
86
  function Expand({
101
87
  title,
102
88
  children,
@@ -129,8 +115,8 @@ function Expand({
129
115
  e.stopPropagation();
130
116
  fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
131
117
  setExpanded(!expanded);
132
- e.persist(); // @ts-ignore detail doesn't exist on type
133
-
118
+ e.persist();
119
+ // @ts-ignore detail doesn't exist on type
134
120
  e.detail ? handleBlur() : handleFocus();
135
121
  },
136
122
  onFocus: handleFocus,
@@ -163,5 +149,4 @@ function Expand({
163
149
  css: clearNextSiblingMarginTopStyle
164
150
  }), children))));
165
151
  }
166
-
167
152
  export default injectIntl(Expand);
@@ -7,13 +7,10 @@ import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
7
7
  export default class ExtensionRenderer extends React.Component {
8
8
  constructor(...args) {
9
9
  super(...args);
10
-
11
10
  _defineProperty(this, "state", {
12
11
  extensionProvider: null
13
12
  });
14
-
15
13
  _defineProperty(this, "mounted", false);
16
-
17
14
  _defineProperty(this, "handleProvider", (name, providerPromise) => {
18
15
  providerPromise && providerPromise.then(provider => {
19
16
  if (this.mounted) {
@@ -23,12 +20,9 @@ export default class ExtensionRenderer extends React.Component {
23
20
  }
24
21
  });
25
22
  });
26
-
27
23
  _defineProperty(this, "getNodeRenderer", memoizeOne(getNodeRenderer));
28
-
29
24
  _defineProperty(this, "renderExtensionNode", extensionProvider => {
30
25
  var _marks$find, _marks$find$attrs;
31
-
32
26
  const {
33
27
  extensionHandlers,
34
28
  rendererContext,
@@ -52,13 +46,11 @@ export default class ExtensionRenderer extends React.Component {
52
46
  fragmentLocalId
53
47
  };
54
48
  let result = null;
55
-
56
49
  try {
57
50
  if (extensionHandlers && extensionHandlers[extensionType]) {
58
51
  const render = getExtensionRenderer(extensionHandlers[extensionType]);
59
52
  result = render(node, rendererContext.adDoc);
60
53
  }
61
-
62
54
  if (!result && extensionProvider) {
63
55
  const NodeRenderer = this.getNodeRenderer(extensionProvider, extensionType, extensionKey);
64
56
  result = /*#__PURE__*/React.createElement(NodeRenderer, {
@@ -67,50 +59,39 @@ export default class ExtensionRenderer extends React.Component {
67
59
  }
68
60
  } catch (e) {
69
61
  /** We don't want this error to block renderer */
70
-
71
62
  /** We keep rendering the default content */
72
63
  }
73
-
74
64
  return this.props.children({
75
65
  result
76
66
  });
77
67
  });
78
-
79
68
  _defineProperty(this, "setupAndRenderExtensionNode", providers => {
80
69
  const {
81
70
  extensionProvider
82
71
  } = this.state;
83
-
84
72
  if (!extensionProvider && providers.extensionProvider) {
85
73
  this.handleProvider('extensionProvider', providers.extensionProvider);
86
74
  }
87
-
88
75
  return this.renderExtensionNode(extensionProvider);
89
76
  });
90
77
  }
91
-
92
78
  UNSAFE_componentWillMount() {
93
79
  this.mounted = true;
94
80
  }
95
-
96
81
  componentWillUnmount() {
97
82
  this.mounted = false;
98
83
  }
99
-
100
84
  render() {
101
85
  const {
102
86
  providers
103
87
  } = this.props;
104
-
105
88
  if (!providers) {
106
89
  return this.setupAndRenderExtensionNode({});
107
90
  }
108
-
109
91
  return /*#__PURE__*/React.createElement(WithProviders, {
110
92
  providers: ['extensionProvider'],
111
93
  providerFactory: providers,
112
94
  renderNode: this.setupAndRenderExtensionNode
113
95
  });
114
96
  }
115
-
116
97
  }
@@ -9,7 +9,6 @@ export const getListOfIdentifiersFromDoc = doc => {
9
9
  if (!doc) {
10
10
  return [];
11
11
  }
12
-
13
12
  return filter(doc, node => node.type === 'media').reduce((identifierList, mediaNode) => {
14
13
  if (mediaNode.attrs) {
15
14
  const {
@@ -17,7 +16,6 @@ export const getListOfIdentifiersFromDoc = doc => {
17
16
  url: dataURI,
18
17
  id
19
18
  } = mediaNode.attrs;
20
-
21
19
  if (type === 'file' && id) {
22
20
  identifierList.push({
23
21
  mediaItemType: 'file',
@@ -31,16 +29,13 @@ export const getListOfIdentifiersFromDoc = doc => {
31
29
  });
32
30
  }
33
31
  }
34
-
35
32
  return identifierList;
36
33
  }, []);
37
34
  };
38
35
  export class MediaCardInternal extends Component {
39
36
  constructor(...args) {
40
37
  super(...args);
41
-
42
38
  _defineProperty(this, "state", {});
43
-
44
39
  _defineProperty(this, "saveFileState", async (id, mediaClientConfig) => {
45
40
  const {
46
41
  collection: collectionName,
@@ -50,16 +45,15 @@ export class MediaCardInternal extends Component {
50
45
  const options = {
51
46
  collectionName
52
47
  };
53
-
54
48
  try {
55
49
  const fileState = await mediaClient.file.getCurrentState(id, options);
56
50
  this.setState({
57
51
  fileState
58
52
  });
59
- } catch (error) {// do not set state on error
53
+ } catch (error) {
54
+ // do not set state on error
60
55
  }
61
56
  });
62
-
63
57
  _defineProperty(this, "renderLoadingCard", () => {
64
58
  const {
65
59
  cardDimensions
@@ -68,27 +62,22 @@ export class MediaCardInternal extends Component {
68
62
  dimensions: cardDimensions
69
63
  });
70
64
  });
71
-
72
65
  _defineProperty(this, "getOnCardClickCallback", isInlinePlayer => {
73
66
  const {
74
67
  eventHandlers
75
68
  } = this.props;
76
-
77
69
  if (eventHandlers && eventHandlers.media && eventHandlers.media.onClick) {
78
70
  return (result, analyticsEvent) => {
79
71
  const isVideo = result.mediaItemDetails && result.mediaItemDetails.mediaType === 'video';
80
72
  const isVideoWithInlinePlayer = isInlinePlayer && isVideo;
81
-
82
73
  if (!isVideoWithInlinePlayer && eventHandlers && eventHandlers.media && eventHandlers.media.onClick) {
83
74
  eventHandlers.media.onClick(result, analyticsEvent);
84
75
  }
85
76
  };
86
77
  }
87
-
88
78
  return undefined;
89
79
  });
90
80
  }
91
-
92
81
  async componentDidMount() {
93
82
  const {
94
83
  rendererContext,
@@ -98,25 +87,22 @@ export class MediaCardInternal extends Component {
98
87
  url,
99
88
  collection: collectionName
100
89
  } = this.props;
101
-
102
90
  if (!mediaProvider) {
103
91
  return;
104
92
  }
105
-
106
93
  if (contextIdentifierProvider) {
107
94
  this.setState({
108
95
  contextIdentifierProvider: await contextIdentifierProvider
109
96
  });
110
97
  }
111
-
112
98
  const mediaProviderObject = await mediaProvider;
113
99
  const mediaClientConfig = mediaProviderObject.viewMediaClientConfig;
114
100
  const nodeIsInCache = id && mediaIdentifierMap.has(id) || url && mediaIdentifierMap.has(url);
115
-
116
101
  if (rendererContext && rendererContext.adDoc && !nodeIsInCache) {
117
102
  getListOfIdentifiersFromDoc(rendererContext.adDoc).forEach(identifier => {
118
103
  if (identifier.mediaItemType === 'file' && identifier.id === id) {
119
- mediaIdentifierMap.set(identifier.id, { ...identifier,
104
+ mediaIdentifierMap.set(identifier.id, {
105
+ ...identifier,
120
106
  collectionName
121
107
  });
122
108
  } else if (identifier.mediaItemType === 'external-image') {
@@ -124,16 +110,13 @@ export class MediaCardInternal extends Component {
124
110
  }
125
111
  });
126
112
  }
127
-
128
113
  this.setState({
129
114
  mediaClientConfig: mediaClientConfig
130
115
  });
131
-
132
116
  if (id) {
133
117
  this.saveFileState(id, mediaClientConfig);
134
118
  }
135
119
  }
136
-
137
120
  UNSAFE_componentWillReceiveProps(newProps) {
138
121
  const {
139
122
  mediaClientConfig
@@ -141,25 +124,21 @@ export class MediaCardInternal extends Component {
141
124
  const {
142
125
  id: newId
143
126
  } = newProps;
144
-
145
127
  if (mediaClientConfig && newId && newId !== this.props.id) {
146
128
  this.saveFileState(newId, mediaClientConfig);
147
129
  }
148
130
  }
149
-
150
131
  componentWillUnmount() {
151
132
  const {
152
133
  id,
153
134
  url: dataURI
154
135
  } = this.props;
155
-
156
136
  if (id) {
157
137
  mediaIdentifierMap.delete(id);
158
138
  } else if (dataURI) {
159
139
  mediaIdentifierMap.delete(dataURI);
160
140
  }
161
141
  }
162
-
163
142
  renderExternal(shouldOpenMediaViewer) {
164
143
  const {
165
144
  mediaClientConfig
@@ -175,17 +154,16 @@ export class MediaCardInternal extends Component {
175
154
  featureFlags,
176
155
  ssr
177
156
  } = this.props;
178
-
179
157
  if (imageStatus === 'loading' || !url) {
180
158
  return this.renderLoadingCard();
181
159
  }
182
-
183
160
  const identifier = {
184
161
  dataURI: url,
185
162
  name: url,
186
163
  mediaItemType: 'external-image'
187
164
  };
188
- return /*#__PURE__*/React.createElement(Card // TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
165
+ return /*#__PURE__*/React.createElement(Card
166
+ // TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
189
167
  // context is not really used when the type is external and we want to render the component asap
190
168
  , {
191
169
  mediaClientConfig: mediaClientConfig,
@@ -203,6 +181,7 @@ export class MediaCardInternal extends Component {
203
181
  ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
204
182
  });
205
183
  }
184
+
206
185
  /**
207
186
  * We want to call provided `eventHandlers.media.onClick` when it's provided,
208
187
  * but we also don't want to call it when it's a video and inline video player is enabled.
@@ -210,7 +189,6 @@ export class MediaCardInternal extends Component {
210
189
  * we don't want that to happened described above text.
211
190
  */
212
191
 
213
-
214
192
  render() {
215
193
  const {
216
194
  contextIdentifierProvider,
@@ -239,27 +217,21 @@ export class MediaCardInternal extends Component {
239
217
  const isInlinePlayer = isMobile ? false : shouldPlayInline;
240
218
  const onCardClick = this.getOnCardClickCallback(isInlinePlayer);
241
219
  const shouldOpenMediaViewer = typeof forceOpenMediaViewer === 'boolean' ? forceOpenMediaViewer : !isMobile && !onCardClick;
242
-
243
220
  if (type === 'external') {
244
221
  return this.renderExternal(shouldOpenMediaViewer);
245
222
  }
246
-
247
223
  if (type === 'link') {
248
224
  return null;
249
225
  }
250
-
251
226
  const mediaClientConfig = !!ssr ? ssr.config : mediaClientConfigInState;
252
-
253
227
  if (!mediaClientConfig || !id) {
254
228
  return this.renderLoadingCard();
255
229
  }
256
-
257
230
  if (!id || type !== 'file') {
258
231
  return /*#__PURE__*/React.createElement(CardError, {
259
232
  dimensions: cardDimensions
260
233
  });
261
234
  }
262
-
263
235
  const contextId = contextIdentifierProvider && contextIdentifierProvider.objectId;
264
236
  const identifier = {
265
237
  id,
@@ -295,9 +267,9 @@ export class MediaCardInternal extends Component {
295
267
  ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
296
268
  }));
297
269
  }
270
+ }
298
271
 
299
- } // Needed for copy & paste
300
-
272
+ // Needed for copy & paste
301
273
  export const getClipboardAttrs = ({
302
274
  id,
303
275
  alt,
@@ -310,16 +282,13 @@ export const getClipboardAttrs = ({
310
282
  const width = originalDimensions && originalDimensions.width;
311
283
  const height = originalDimensions && originalDimensions.height;
312
284
  let fileName = 'file'; // default name is needed for Confluence
313
-
314
285
  let fileSize = 1;
315
286
  let fileMimeType = '';
316
-
317
287
  if (fileState && fileState.status !== 'error') {
318
288
  fileSize = fileState.size;
319
289
  fileName = fileState.name;
320
290
  fileMimeType = fileState.mimeType;
321
291
  }
322
-
323
292
  return {
324
293
  'data-context-id': contextId,
325
294
  'data-type': 'file',
@@ -6,31 +6,25 @@ import { FabricChannel } from '@atlaskit/analytics-listeners';
6
6
  export class ErrorBoundary extends React.Component {
7
7
  constructor(...args) {
8
8
  super(...args);
9
-
10
9
  _defineProperty(this, "state", {
11
10
  errorCaptured: false
12
11
  });
13
12
  }
14
-
15
13
  fireAnalyticsEvent(event) {
16
14
  const {
17
15
  createAnalyticsEvent
18
16
  } = this.props;
19
-
20
17
  if (createAnalyticsEvent) {
21
18
  const channel = FabricChannel.editor;
22
19
  createAnalyticsEvent(event).fire(channel);
23
20
  }
24
21
  }
25
-
26
22
  hasFallback() {
27
23
  return typeof this.props.fallbackComponent !== 'undefined';
28
24
  }
29
-
30
25
  shouldRecover() {
31
26
  return this.hasFallback() && this.state.errorCaptured;
32
27
  }
33
-
34
28
  componentDidCatch(error, errorInfo) {
35
29
  this.fireAnalyticsEvent({
36
30
  action: ACTION.CRASHED,
@@ -45,7 +39,6 @@ export class ErrorBoundary extends React.Component {
45
39
  errorRethrown: Boolean(this.props.rethrowError)
46
40
  }
47
41
  });
48
-
49
42
  if (this.hasFallback()) {
50
43
  this.setState({
51
44
  errorCaptured: true
@@ -56,13 +49,10 @@ export class ErrorBoundary extends React.Component {
56
49
  });
57
50
  }
58
51
  }
59
-
60
52
  render() {
61
53
  if (this.shouldRecover()) {
62
54
  return this.props.fallbackComponent;
63
55
  }
64
-
65
56
  return this.props.children;
66
57
  }
67
-
68
58
  }
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { breakoutConsts } from '@atlaskit/editor-common/utils';
3
+
3
4
  /**
4
5
  * Inline Script that updates breakout node width on client side,
5
6
  * before main JavaScript bundle is ready.
6
7
  *
7
8
  * More info: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1216218119/Renderer+SSR+for+Breakout+Nodes
8
9
  */
9
-
10
10
  export function BreakoutSSRInlineScript() {
11
11
  /**
12
12
  * Should only inline this script while SSR,
@@ -15,7 +15,6 @@ export function BreakoutSSRInlineScript() {
15
15
  if (typeof window !== 'undefined' && !window.navigator.userAgent.includes('jsdom')) {
16
16
  return null;
17
17
  }
18
-
19
18
  const id = Math.floor(Math.random() * (9999999999 - 9999 + 1)) + 9999;
20
19
  const context = createBreakoutInlineScript(id);
21
20
  return /*#__PURE__*/React.createElement("script", {
@@ -41,64 +40,51 @@ export const breakoutInlineScriptContext = `
41
40
  breakoutConsts.calcLineLength = ${breakoutConsts.calcLineLength.toString()};
42
41
  breakoutConsts.calcWideWidth = ${breakoutConsts.calcWideWidth.toString()};
43
42
  `;
44
-
45
43
  function applyBreakoutAfterSSR(id, breakoutConsts) {
46
44
  const MEDIA_NODE_TYPE = 'mediaSingle';
47
45
  const WIDE_LAYOUT_MODES = ['full-width', 'wide'];
48
-
49
46
  function findUp(element, condition) {
50
47
  if (!element) {
51
48
  return;
52
49
  }
53
-
54
50
  while (element.parentElement) {
55
51
  if (condition(element)) {
56
52
  return element.parentElement;
57
53
  }
58
-
59
54
  element = element.parentElement;
60
55
  }
61
56
  }
62
-
63
57
  const renderer = findUp(document.querySelector('[data-breakout-script-id="' + id + '"]'), elem => {
64
58
  var _elem$parentElement;
65
-
66
59
  return !!((_elem$parentElement = elem.parentElement) !== null && _elem$parentElement !== void 0 && _elem$parentElement.classList.contains('ak-renderer-wrapper'));
67
60
  });
68
-
69
61
  if (!renderer) {
70
62
  return;
71
63
  }
72
-
73
64
  const observer = new MutationObserver(mutationsList => {
74
65
  mutationsList.forEach(item => {
75
66
  if (item.target.nodeType !== Node.ELEMENT_NODE) {
76
67
  return;
77
68
  }
78
-
79
69
  if (item.target.classList.contains('ak-renderer-document')) {
80
70
  item.addedNodes.forEach(maybeNode => {
81
71
  const node = maybeNode;
82
72
  const mode = node.dataset.mode || node.dataset.layout || '';
83
-
84
73
  if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
85
74
  return;
86
75
  }
87
-
88
76
  const width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
89
-
90
77
  if (node.style.width === width) {
91
78
  return;
92
79
  }
80
+ node.style.width = width;
93
81
 
94
- node.style.width = width; // Tables require some special logic, as they are not using common css transform approach,
82
+ // Tables require some special logic, as they are not using common css transform approach,
95
83
  // because it breaks with sticky headers. This logic is copied from a table node:
96
84
  // https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
97
-
98
85
  if (node.classList.contains('pm-table-container')) {
99
86
  const lineLength = breakoutConsts.calcLineLength();
100
87
  const left = lineLength / 2 - parseInt(width) / 2;
101
-
102
88
  if (left < 0) {
103
89
  node.style.left = left + 'px';
104
90
  }
@@ -117,34 +103,31 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
117
103
  }
118
104
  });
119
105
  });
120
-
121
106
  const applyMediaBreakout = card => {
122
107
  // width was already set by another breakout script
123
108
  if (card.style.width) {
124
109
  return;
125
110
  }
111
+ const tableParent = findUp(card, elem => elem instanceof HTMLTableCellElement);
126
112
 
127
- const tableParent = findUp(card, elem => elem instanceof HTMLTableCellElement); // only apply the breakout to media elements not nested inside table
113
+ // only apply the breakout to media elements not nested inside table
128
114
  // table sizing is not based on percentage width
129
-
130
115
  if (tableParent) {
131
116
  return;
132
117
  }
133
-
134
118
  const mode = card.dataset.mode || card.dataset.layout || '';
135
119
  const width = card.dataset.width;
136
-
137
120
  if (WIDE_LAYOUT_MODES.includes(mode)) {
138
121
  card.style.width = '100%';
139
122
  } else if (width) {
140
123
  card.style.width = `${width}%`;
141
124
  }
142
125
  };
143
-
144
126
  observer.observe(renderer, {
145
127
  childList: true,
146
128
  subtree: true
147
129
  });
130
+
148
131
  /**
149
132
  * Using window load event to unsubscribe from mutation observer, as at this stage document is fully rendered.
150
133
  * Experiment with DOMContentLoaded showed that some of the blocks were not processed at all.
@@ -155,13 +138,10 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
155
138
  * – https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
156
139
  * – https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event
157
140
  */
158
-
159
141
  const disconnect = () => {
160
142
  observer.disconnect();
161
143
  window.removeEventListener('load', disconnect);
162
144
  };
163
-
164
145
  window.addEventListener('load', disconnect);
165
146
  }
166
-
167
147
  export const calcLineLength = breakoutConsts.calcLineLength;