@atlaskit/editor-core 185.16.1 → 185.16.5

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 (389) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +14 -0
  3. package/dist/cjs/i18n/cs.js +0 -35
  4. package/dist/cjs/i18n/da.js +0 -35
  5. package/dist/cjs/i18n/de.js +0 -35
  6. package/dist/cjs/i18n/en.js +0 -35
  7. package/dist/cjs/i18n/en_GB.js +0 -35
  8. package/dist/cjs/i18n/en_ZZ.js +0 -35
  9. package/dist/cjs/i18n/es.js +1 -35
  10. package/dist/cjs/i18n/fi.js +0 -35
  11. package/dist/cjs/i18n/fr.js +1 -35
  12. package/dist/cjs/i18n/hu.js +1 -35
  13. package/dist/cjs/i18n/it.js +1 -35
  14. package/dist/cjs/i18n/ja.js +1 -35
  15. package/dist/cjs/i18n/ko.js +0 -35
  16. package/dist/cjs/i18n/nb.js +1 -35
  17. package/dist/cjs/i18n/nl.js +1 -35
  18. package/dist/cjs/i18n/pl.js +1 -35
  19. package/dist/cjs/i18n/pt_BR.js +1 -35
  20. package/dist/cjs/i18n/ru.js +1 -35
  21. package/dist/cjs/i18n/sv.js +0 -35
  22. package/dist/cjs/i18n/th.js +0 -35
  23. package/dist/cjs/i18n/tr.js +1 -35
  24. package/dist/cjs/i18n/uk.js +1 -35
  25. package/dist/cjs/i18n/vi.js +0 -35
  26. package/dist/cjs/i18n/zh.js +1 -35
  27. package/dist/cjs/i18n/zh_TW.js +1 -35
  28. package/dist/cjs/labs/next/presets/mobile.js +1 -1
  29. package/dist/cjs/labs/next/presets/universal.js +2 -2
  30. package/dist/cjs/plugins/deprecated-card/doc.js +111 -0
  31. package/dist/cjs/plugins/deprecated-hyperlink/commands.js +1 -1
  32. package/dist/cjs/plugins/index.js +0 -7
  33. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +14 -25
  34. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  35. package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +5 -6
  36. package/dist/cjs/plugins/text-formatting/index.js +6 -2
  37. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  38. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +6 -3
  39. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  40. package/dist/cjs/version-wrapper.js +1 -1
  41. package/dist/cjs/version.json +1 -1
  42. package/dist/es2019/i18n/cs.js +0 -35
  43. package/dist/es2019/i18n/da.js +0 -35
  44. package/dist/es2019/i18n/de.js +0 -35
  45. package/dist/es2019/i18n/en.js +0 -35
  46. package/dist/es2019/i18n/en_GB.js +0 -35
  47. package/dist/es2019/i18n/en_ZZ.js +0 -35
  48. package/dist/es2019/i18n/es.js +1 -35
  49. package/dist/es2019/i18n/fi.js +0 -35
  50. package/dist/es2019/i18n/fr.js +1 -35
  51. package/dist/es2019/i18n/hu.js +1 -35
  52. package/dist/es2019/i18n/it.js +1 -35
  53. package/dist/es2019/i18n/ja.js +1 -35
  54. package/dist/es2019/i18n/ko.js +0 -35
  55. package/dist/es2019/i18n/nb.js +1 -35
  56. package/dist/es2019/i18n/nl.js +1 -35
  57. package/dist/es2019/i18n/pl.js +1 -35
  58. package/dist/es2019/i18n/pt_BR.js +1 -35
  59. package/dist/es2019/i18n/ru.js +1 -35
  60. package/dist/es2019/i18n/sv.js +0 -35
  61. package/dist/es2019/i18n/th.js +0 -35
  62. package/dist/es2019/i18n/tr.js +1 -35
  63. package/dist/es2019/i18n/uk.js +1 -35
  64. package/dist/es2019/i18n/vi.js +0 -35
  65. package/dist/es2019/i18n/zh.js +1 -35
  66. package/dist/es2019/i18n/zh_TW.js +1 -35
  67. package/dist/es2019/labs/next/presets/mobile.js +1 -1
  68. package/dist/es2019/labs/next/presets/universal.js +1 -1
  69. package/dist/es2019/plugins/deprecated-card/doc.js +97 -0
  70. package/dist/es2019/plugins/deprecated-hyperlink/commands.js +1 -1
  71. package/dist/es2019/plugins/index.js +0 -1
  72. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -14
  73. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +13 -0
  74. package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +5 -6
  75. package/dist/es2019/plugins/text-formatting/index.js +8 -3
  76. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  77. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +5 -4
  78. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  79. package/dist/es2019/version-wrapper.js +1 -1
  80. package/dist/es2019/version.json +1 -1
  81. package/dist/esm/i18n/cs.js +0 -35
  82. package/dist/esm/i18n/da.js +0 -35
  83. package/dist/esm/i18n/de.js +0 -35
  84. package/dist/esm/i18n/en.js +0 -35
  85. package/dist/esm/i18n/en_GB.js +0 -35
  86. package/dist/esm/i18n/en_ZZ.js +0 -35
  87. package/dist/esm/i18n/es.js +1 -35
  88. package/dist/esm/i18n/fi.js +0 -35
  89. package/dist/esm/i18n/fr.js +1 -35
  90. package/dist/esm/i18n/hu.js +1 -35
  91. package/dist/esm/i18n/it.js +1 -35
  92. package/dist/esm/i18n/ja.js +1 -35
  93. package/dist/esm/i18n/ko.js +0 -35
  94. package/dist/esm/i18n/nb.js +1 -35
  95. package/dist/esm/i18n/nl.js +1 -35
  96. package/dist/esm/i18n/pl.js +1 -35
  97. package/dist/esm/i18n/pt_BR.js +1 -35
  98. package/dist/esm/i18n/ru.js +1 -35
  99. package/dist/esm/i18n/sv.js +0 -35
  100. package/dist/esm/i18n/th.js +0 -35
  101. package/dist/esm/i18n/tr.js +1 -35
  102. package/dist/esm/i18n/uk.js +1 -35
  103. package/dist/esm/i18n/vi.js +0 -35
  104. package/dist/esm/i18n/zh.js +1 -35
  105. package/dist/esm/i18n/zh_TW.js +1 -35
  106. package/dist/esm/labs/next/presets/mobile.js +1 -1
  107. package/dist/esm/labs/next/presets/universal.js +1 -1
  108. package/dist/esm/plugins/deprecated-card/doc.js +105 -0
  109. package/dist/esm/plugins/deprecated-hyperlink/commands.js +1 -1
  110. package/dist/esm/plugins/index.js +0 -1
  111. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +14 -25
  112. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  113. package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +5 -6
  114. package/dist/esm/plugins/text-formatting/index.js +6 -2
  115. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  116. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +7 -4
  117. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  118. package/dist/esm/version-wrapper.js +1 -1
  119. package/dist/esm/version.json +1 -1
  120. package/dist/types/i18n/cs.d.ts +0 -35
  121. package/dist/types/i18n/da.d.ts +0 -35
  122. package/dist/types/i18n/de.d.ts +0 -35
  123. package/dist/types/i18n/en.d.ts +0 -35
  124. package/dist/types/i18n/en_GB.d.ts +0 -35
  125. package/dist/types/i18n/en_ZZ.d.ts +0 -35
  126. package/dist/types/i18n/es.d.ts +1 -35
  127. package/dist/types/i18n/fi.d.ts +0 -35
  128. package/dist/types/i18n/fr.d.ts +1 -35
  129. package/dist/types/i18n/hu.d.ts +1 -35
  130. package/dist/types/i18n/it.d.ts +1 -35
  131. package/dist/types/i18n/ja.d.ts +1 -35
  132. package/dist/types/i18n/ko.d.ts +0 -35
  133. package/dist/types/i18n/nb.d.ts +1 -35
  134. package/dist/types/i18n/nl.d.ts +1 -35
  135. package/dist/types/i18n/pl.d.ts +1 -35
  136. package/dist/types/i18n/pt_BR.d.ts +1 -35
  137. package/dist/types/i18n/ru.d.ts +1 -35
  138. package/dist/types/i18n/sv.d.ts +0 -35
  139. package/dist/types/i18n/th.d.ts +0 -35
  140. package/dist/types/i18n/tr.d.ts +1 -35
  141. package/dist/types/i18n/uk.d.ts +1 -35
  142. package/dist/types/i18n/vi.d.ts +0 -35
  143. package/dist/types/i18n/zh.d.ts +1 -35
  144. package/dist/types/i18n/zh_TW.d.ts +1 -35
  145. package/dist/types/labs/next/presets/cxhtml.d.ts +58 -0
  146. package/dist/types/labs/next/presets/default.d.ts +116 -0
  147. package/dist/types/labs/next/presets/mobile.d.ts +58 -0
  148. package/dist/types/plugins/deprecated-card/doc.d.ts +20 -0
  149. package/dist/types/plugins/index.d.ts +0 -1
  150. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  151. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  152. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  153. package/dist/types/plugins/paste/index.d.ts +1 -1
  154. package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +3 -3
  155. package/dist/types/plugins/text-formatting/index.d.ts +3 -1
  156. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +2 -1
  157. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +6 -1
  158. package/dist/types/plugins/text-formatting/ui/Toolbar/index.d.ts +2 -0
  159. package/dist/types-ts4.5/i18n/cs.d.ts +0 -35
  160. package/dist/types-ts4.5/i18n/da.d.ts +0 -35
  161. package/dist/types-ts4.5/i18n/de.d.ts +0 -35
  162. package/dist/types-ts4.5/i18n/en.d.ts +0 -35
  163. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -35
  164. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -35
  165. package/dist/types-ts4.5/i18n/es.d.ts +1 -35
  166. package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
  167. package/dist/types-ts4.5/i18n/fr.d.ts +1 -35
  168. package/dist/types-ts4.5/i18n/hu.d.ts +1 -35
  169. package/dist/types-ts4.5/i18n/it.d.ts +1 -35
  170. package/dist/types-ts4.5/i18n/ja.d.ts +1 -35
  171. package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
  172. package/dist/types-ts4.5/i18n/nb.d.ts +1 -35
  173. package/dist/types-ts4.5/i18n/nl.d.ts +1 -35
  174. package/dist/types-ts4.5/i18n/pl.d.ts +1 -35
  175. package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -35
  176. package/dist/types-ts4.5/i18n/ru.d.ts +1 -35
  177. package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
  178. package/dist/types-ts4.5/i18n/th.d.ts +0 -35
  179. package/dist/types-ts4.5/i18n/tr.d.ts +1 -35
  180. package/dist/types-ts4.5/i18n/uk.d.ts +1 -35
  181. package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
  182. package/dist/types-ts4.5/i18n/zh.d.ts +1 -35
  183. package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -35
  184. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +70 -0
  185. package/dist/types-ts4.5/labs/next/presets/default.d.ts +140 -0
  186. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +70 -0
  187. package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +20 -0
  188. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  189. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  190. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  191. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  192. package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
  193. package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +3 -3
  194. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +5 -1
  195. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +2 -1
  196. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +6 -1
  197. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/index.d.ts +2 -0
  198. package/package.json +6 -5
  199. package/tmp/api-report-tmp.d.ts +2307 -0
  200. package/dist/cjs/plugins/card/index.js +0 -139
  201. package/dist/cjs/plugins/card/messages.js +0 -20
  202. package/dist/cjs/plugins/card/nodeviews/blockCard.js +0 -163
  203. package/dist/cjs/plugins/card/nodeviews/datasource.js +0 -172
  204. package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -396
  205. package/dist/cjs/plugins/card/nodeviews/genericCard.js +0 -118
  206. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +0 -131
  207. package/dist/cjs/plugins/card/pm-plugins/actions.js +0 -122
  208. package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -48
  209. package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -353
  210. package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +0 -19
  211. package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +0 -5
  212. package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +0 -178
  213. package/dist/cjs/plugins/card/pm-plugins/doc.js +0 -478
  214. package/dist/cjs/plugins/card/pm-plugins/keymap.js +0 -64
  215. package/dist/cjs/plugins/card/pm-plugins/main.js +0 -212
  216. package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +0 -47
  217. package/dist/cjs/plugins/card/pm-plugins/plugin-key.js +0 -9
  218. package/dist/cjs/plugins/card/pm-plugins/reducers.js +0 -111
  219. package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +0 -35
  220. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +0 -58
  221. package/dist/cjs/plugins/card/pm-plugins/util/state.js +0 -49
  222. package/dist/cjs/plugins/card/toolbar.js +0 -364
  223. package/dist/cjs/plugins/card/types.js +0 -5
  224. package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -25
  225. package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +0 -60
  226. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +0 -256
  227. package/dist/cjs/plugins/card/ui/EditorSmartCardEvents.js +0 -21
  228. package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +0 -213
  229. package/dist/cjs/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -173
  230. package/dist/cjs/plugins/card/ui/LayoutButton/index.js +0 -113
  231. package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +0 -17
  232. package/dist/cjs/plugins/card/ui/LayoutButton/types.js +0 -5
  233. package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +0 -19
  234. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +0 -151
  235. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +0 -360
  236. package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +0 -20
  237. package/dist/cjs/plugins/card/utils.js +0 -60
  238. package/dist/es2019/plugins/card/index.js +0 -131
  239. package/dist/es2019/plugins/card/messages.js +0 -13
  240. package/dist/es2019/plugins/card/nodeviews/blockCard.js +0 -130
  241. package/dist/es2019/plugins/card/nodeviews/datasource.js +0 -136
  242. package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -368
  243. package/dist/es2019/plugins/card/nodeviews/genericCard.js +0 -92
  244. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +0 -112
  245. package/dist/es2019/plugins/card/pm-plugins/actions.js +0 -57
  246. package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -38
  247. package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -333
  248. package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +0 -2
  249. package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +0 -1
  250. package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +0 -160
  251. package/dist/es2019/plugins/card/pm-plugins/doc.js +0 -451
  252. package/dist/es2019/plugins/card/pm-plugins/keymap.js +0 -59
  253. package/dist/es2019/plugins/card/pm-plugins/main.js +0 -208
  254. package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +0 -37
  255. package/dist/es2019/plugins/card/pm-plugins/plugin-key.js +0 -2
  256. package/dist/es2019/plugins/card/pm-plugins/reducers.js +0 -110
  257. package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +0 -25
  258. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +0 -48
  259. package/dist/es2019/plugins/card/pm-plugins/util/state.js +0 -26
  260. package/dist/es2019/plugins/card/toolbar.js +0 -362
  261. package/dist/es2019/plugins/card/types.js +0 -1
  262. package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -19
  263. package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +0 -48
  264. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +0 -225
  265. package/dist/es2019/plugins/card/ui/EditorSmartCardEvents.js +0 -15
  266. package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +0 -198
  267. package/dist/es2019/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -86
  268. package/dist/es2019/plugins/card/ui/LayoutButton/index.js +0 -106
  269. package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +0 -10
  270. package/dist/es2019/plugins/card/ui/LayoutButton/types.js +0 -1
  271. package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +0 -15
  272. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +0 -117
  273. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +0 -332
  274. package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +0 -11
  275. package/dist/es2019/plugins/card/utils.js +0 -46
  276. package/dist/esm/plugins/card/index.js +0 -132
  277. package/dist/esm/plugins/card/messages.js +0 -13
  278. package/dist/esm/plugins/card/nodeviews/blockCard.js +0 -155
  279. package/dist/esm/plugins/card/nodeviews/datasource.js +0 -164
  280. package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -387
  281. package/dist/esm/plugins/card/nodeviews/genericCard.js +0 -111
  282. package/dist/esm/plugins/card/nodeviews/inlineCard.js +0 -123
  283. package/dist/esm/plugins/card/pm-plugins/actions.js +0 -102
  284. package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -41
  285. package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -344
  286. package/dist/esm/plugins/card/pm-plugins/analytics/index.js +0 -2
  287. package/dist/esm/plugins/card/pm-plugins/analytics/types.js +0 -1
  288. package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +0 -160
  289. package/dist/esm/plugins/card/pm-plugins/doc.js +0 -460
  290. package/dist/esm/plugins/card/pm-plugins/keymap.js +0 -58
  291. package/dist/esm/plugins/card/pm-plugins/main.js +0 -199
  292. package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +0 -39
  293. package/dist/esm/plugins/card/pm-plugins/plugin-key.js +0 -2
  294. package/dist/esm/plugins/card/pm-plugins/reducers.js +0 -103
  295. package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +0 -29
  296. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +0 -50
  297. package/dist/esm/plugins/card/pm-plugins/util/state.js +0 -40
  298. package/dist/esm/plugins/card/toolbar.js +0 -353
  299. package/dist/esm/plugins/card/types.js +0 -1
  300. package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -17
  301. package/dist/esm/plugins/card/ui/DatasourceModal/index.js +0 -49
  302. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +0 -243
  303. package/dist/esm/plugins/card/ui/EditorSmartCardEvents.js +0 -14
  304. package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +0 -202
  305. package/dist/esm/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -163
  306. package/dist/esm/plugins/card/ui/LayoutButton/index.js +0 -102
  307. package/dist/esm/plugins/card/ui/LayoutButton/styled.js +0 -10
  308. package/dist/esm/plugins/card/ui/LayoutButton/types.js +0 -1
  309. package/dist/esm/plugins/card/ui/LayoutButton/utils.js +0 -12
  310. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +0 -140
  311. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +0 -355
  312. package/dist/esm/plugins/card/ui/SmallerEditIcon.js +0 -11
  313. package/dist/esm/plugins/card/utils.js +0 -48
  314. package/dist/types/plugins/card/index.d.ts +0 -26
  315. package/dist/types/plugins/card/messages.d.ts +0 -12
  316. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +0 -26
  317. package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -42
  318. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -46
  319. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -37
  320. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  321. package/dist/types/plugins/card/pm-plugins/actions.d.ts +0 -23
  322. package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  323. package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  324. package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  325. package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  326. package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  327. package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -23
  328. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +0 -3
  329. package/dist/types/plugins/card/pm-plugins/main.d.ts +0 -6
  330. package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  331. package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  332. package/dist/types/plugins/card/pm-plugins/reducers.d.ts +0 -3
  333. package/dist/types/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  334. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  335. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -31
  336. package/dist/types/plugins/card/toolbar.d.ts +0 -12
  337. package/dist/types/plugins/card/types.d.ts +0 -165
  338. package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  339. package/dist/types/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  340. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  341. package/dist/types/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  342. package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  343. package/dist/types/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  344. package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  345. package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  346. package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  347. package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  348. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  349. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  350. package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  351. package/dist/types/plugins/card/utils.d.ts +0 -19
  352. package/dist/types-ts4.5/plugins/card/index.d.ts +0 -26
  353. package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -12
  354. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +0 -26
  355. package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -42
  356. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +0 -46
  357. package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +0 -37
  358. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  359. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +0 -23
  360. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  361. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  362. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  363. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  364. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  365. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +0 -23
  366. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +0 -3
  367. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +0 -6
  368. package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  369. package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  370. package/dist/types-ts4.5/plugins/card/pm-plugins/reducers.d.ts +0 -3
  371. package/dist/types-ts4.5/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  372. package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  373. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -31
  374. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +0 -12
  375. package/dist/types-ts4.5/plugins/card/types.d.ts +0 -165
  376. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  377. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  378. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  379. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  380. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  381. package/dist/types-ts4.5/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  382. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  383. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  384. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  385. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  386. package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  387. package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  388. package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  389. package/dist/types-ts4.5/plugins/card/utils.d.ts +0 -19
@@ -1,164 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
- /** @jsx jsx */
13
- import React from 'react';
14
- import PropTypes from 'prop-types';
15
- import { css, jsx } from '@emotion/react';
16
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
17
- import { DatasourceTableView } from '@atlaskit/link-datasource';
18
- import { SmartCardSharedCssClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
19
- import { calcBreakoutWidthPx } from '@atlaskit/editor-common/utils';
20
- var containerStyles = css({
21
- height: '500px',
22
- overflow: 'auto'
23
- });
24
- export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
25
- _inherits(DatasourceComponent, _React$PureComponent);
26
- var _super = _createSuper(DatasourceComponent);
27
- function DatasourceComponent(props) {
28
- var _this;
29
- _classCallCheck(this, DatasourceComponent);
30
- _this = _super.call(this, props);
31
- _defineProperty(_assertThisInitialized(_this), "getPosSafely", function () {
32
- var getPos = _this.props.getPos;
33
- if (!getPos || typeof getPos === 'boolean') {
34
- return;
35
- }
36
- try {
37
- return getPos();
38
- } catch (e) {
39
- // Can blow up in rare cases, when node has been removed.
40
- }
41
- });
42
- _defineProperty(_assertThisInitialized(_this), "getDatasource", function () {
43
- return _this.props.node.attrs.datasource;
44
- });
45
- _defineProperty(_assertThisInitialized(_this), "getTableView", function (datasource) {
46
- var views = (datasource || _this.getDatasource()).views;
47
- return views.find(function (view) {
48
- return view.type === 'table';
49
- }) || undefined;
50
- });
51
- _defineProperty(_assertThisInitialized(_this), "handleColumnChange", function (columnKeys) {
52
- var _this$props$view = _this.props.view,
53
- state = _this$props$view.state,
54
- dispatch = _this$props$view.dispatch;
55
- var pos = _this.getPosSafely();
56
- if (pos === undefined) {
57
- return;
58
- }
59
- var attrs = _this.props.node.attrs;
60
- var views = [{
61
- type: 'table',
62
- properties: {
63
- columns: columnKeys.map(function (key) {
64
- return {
65
- key: key
66
- };
67
- })
68
- }
69
- }];
70
- var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, attrs), {}, {
71
- datasource: _objectSpread(_objectSpread({}, attrs.datasource), {}, {
72
- views: views
73
- })
74
- }));
75
- tr.setMeta('scrollIntoView', false);
76
- dispatch(tr);
77
- });
78
- return _this;
79
- }
80
- _createClass(DatasourceComponent, [{
81
- key: "render",
82
- value: function render() {
83
- var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
84
- var datasource = this.getDatasource();
85
- var tableView = this.getTableView();
86
- if (tableView) {
87
- var _tableView$properties;
88
- var visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (_ref) {
89
- var key = _ref.key;
90
- return key;
91
- });
92
-
93
- // [WS-2307]: we only render card wrapped into a Provider when the value is ready
94
- if (cardContext && cardContext.value) {
95
- return jsx(cardContext.Provider, {
96
- value: cardContext.value
97
- }, jsx(DatasourceTableView, {
98
- datasourceId: datasource.id,
99
- parameters: datasource.parameters,
100
- visibleColumnKeys: visibleColumnKeys,
101
- onVisibleColumnKeysChange: this.handleColumnChange
102
- }));
103
- }
104
- }
105
- return null;
106
- }
107
- }]);
108
- return DatasourceComponent;
109
- }(React.PureComponent);
110
- _defineProperty(DatasourceComponent, "contextTypes", {
111
- contextAdapter: PropTypes.object
112
- });
113
- export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
114
- _inherits(Datasource, _ReactNodeView);
115
- var _super2 = _createSuper(Datasource);
116
- function Datasource(props) {
117
- var _props$pluginInjectio, _props$pluginInjectio2, _props$pluginInjectio3, _sharedState$currentS;
118
- var _this2;
119
- _classCallCheck(this, Datasource);
120
- _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
121
- _defineProperty(_assertThisInitialized(_this2), "calcTableWidth", function (layout, containerWidth) {
122
- if (layout === 'center') {
123
- return 'inherit';
124
- }
125
- return calcBreakoutWidthPx(layout, containerWidth);
126
- });
127
- var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.dependencies) === null || _props$pluginInjectio2 === void 0 ? void 0 : (_props$pluginInjectio3 = _props$pluginInjectio2.width) === null || _props$pluginInjectio3 === void 0 ? void 0 : _props$pluginInjectio3.sharedState;
128
- _this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
129
- sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref2) {
130
- var nextSharedState = _ref2.nextSharedState;
131
- if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
132
- _this2.tableWidth = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width;
133
- _this2.update(_this2.node, []); // required to update the width when page is resized.
134
- }
135
- });
136
- return _this2;
137
- }
138
- _createClass(Datasource, [{
139
- key: "createDomRef",
140
- value: function createDomRef() {
141
- var domRef = document.createElement('div');
142
- domRef.classList.add(SmartCardSharedCssClassName.DATASOURCE_CONTAINER);
143
- return domRef;
144
- }
145
- }, {
146
- key: "render",
147
- value: function render() {
148
- var attrs = this.node.attrs;
149
- var calculatedWidth = this.calcTableWidth(attrs.layout, this.tableWidth);
150
- return jsx("div", {
151
- className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
152
- css: containerStyles,
153
- style: {
154
- minWidth: calculatedWidth
155
- }
156
- }, jsx(DatasourceComponent, {
157
- node: this.node,
158
- view: this.view,
159
- getPos: this.getPos
160
- }));
161
- }
162
- }]);
163
- return Datasource;
164
- }(ReactNodeView);
@@ -1,387 +0,0 @@
1
- import _get from "@babel/runtime/helpers/get";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _extends from "@babel/runtime/helpers/extends";
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
- import React from 'react';
15
- import { Card as SmartCard, EmbedResizeMessageListener } from '@atlaskit/smart-card';
16
- import PropTypes from 'prop-types';
17
- import rafSchedule from 'raf-schd';
18
- import { Card } from './genericCard';
19
- import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
20
- import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
21
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
22
- import { registerCard } from '../pm-plugins/actions';
23
- import ResizableEmbedCard from '../ui/ResizableEmbedCard';
24
- import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
25
- import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
26
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
27
- var CardInner = function CardInner(_ref) {
28
- var pluginInjectionApi = _ref.pluginInjectionApi,
29
- getPosSafely = _ref.getPosSafely,
30
- getLineLength = _ref.getLineLength,
31
- view = _ref.view,
32
- smartCard = _ref.smartCard,
33
- eventDispatcher = _ref.eventDispatcher,
34
- updateSize = _ref.updateSize,
35
- getPos = _ref.getPos,
36
- aspectRatio = _ref.aspectRatio,
37
- allowResizing = _ref.allowResizing,
38
- hasPreview = _ref.hasPreview,
39
- heightAlone = _ref.heightAlone,
40
- cardProps = _ref.cardProps,
41
- dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
42
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width']),
43
- widthState = _useSharedPluginState.widthState;
44
- var widthStateLineLength = (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0;
45
- var widthStateWidth = (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0;
46
- var pos = getPosSafely();
47
- if (pos === undefined) {
48
- return null;
49
- }
50
- var lineLength = getLineLength(view, pos, widthStateLineLength);
51
- var containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
52
- if (!allowResizing || !hasPreview) {
53
- // There are two ways `width` and `height` can be defined here:
54
- // 1) Either as `heightAlone` as height value and no width
55
- // 2) or as `1` for height and aspectRation (defined or a default one) as a width
56
- // See above for how aspectRation is calculated.
57
- var defaultAspectRatio = DEFAULT_EMBED_CARD_WIDTH / DEFAULT_EMBED_CARD_HEIGHT;
58
- var richMediaWrapperHeight = 1;
59
- var richMediaWrapperWidth = aspectRatio || defaultAspectRatio;
60
- if (heightAlone) {
61
- richMediaWrapperHeight = heightAlone;
62
- richMediaWrapperWidth = undefined;
63
- }
64
- return /*#__PURE__*/React.createElement(RichMediaWrapper, _extends({}, cardProps, {
65
- height: richMediaWrapperHeight,
66
- width: richMediaWrapperWidth,
67
- nodeType: "embedCard",
68
- hasFallbackContainer: hasPreview,
69
- lineLength: lineLength,
70
- containerWidth: containerWidth
71
- }), smartCard);
72
- }
73
- var displayGrid = function displayGrid(visible, gridType, highlight) {
74
- var _pluginInjectionApi$d;
75
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.grid.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.displayGrid(view)({
76
- visible: visible,
77
- gridType: gridType,
78
- highlight: highlight
79
- });
80
- };
81
- return /*#__PURE__*/React.createElement(ResizableEmbedCard, _extends({}, cardProps, {
82
- height: heightAlone,
83
- aspectRatio: aspectRatio,
84
- view: view,
85
- getPos: getPos,
86
- lineLength: lineLength,
87
- gridSize: 12,
88
- containerWidth: containerWidth,
89
- displayGrid: displayGrid,
90
- updateSize: updateSize,
91
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
92
- }), smartCard);
93
- };
94
- export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
95
- _inherits(EmbedCardComponent, _React$PureComponent);
96
- var _super = _createSuper(EmbedCardComponent);
97
- function EmbedCardComponent() {
98
- var _this;
99
- _classCallCheck(this, EmbedCardComponent);
100
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
101
- args[_key] = arguments[_key];
102
- }
103
- _this = _super.call.apply(_super, [this].concat(args));
104
- _defineProperty(_assertThisInitialized(_this), "embedIframeRef", /*#__PURE__*/React.createRef());
105
- _defineProperty(_assertThisInitialized(_this), "onClick", function () {});
106
- _defineProperty(_assertThisInitialized(_this), "state", {
107
- hasPreview: true
108
- });
109
- _defineProperty(_assertThisInitialized(_this), "getPosSafely", function () {
110
- var getPos = _this.props.getPos;
111
- if (!getPos || typeof getPos === 'boolean') {
112
- return;
113
- }
114
- try {
115
- return getPos();
116
- } catch (e) {
117
- // Can blow up in rare cases, when node has been removed.
118
- }
119
- });
120
- _defineProperty(_assertThisInitialized(_this), "onResolve", function (data) {
121
- var view = _this.props.view;
122
- var title = data.title,
123
- url = data.url,
124
- aspectRatio = data.aspectRatio;
125
- var _this$props$node$attr = _this.props.node.attrs,
126
- originalHeight = _this$props$node$attr.originalHeight,
127
- originalWidth = _this$props$node$attr.originalWidth;
128
- if (aspectRatio && !originalHeight && !originalWidth) {
129
- // Assumption here is if ADF already have both height and width set,
130
- // we will going to use that later on in this class as aspectRatio
131
- // Most likely we dealing with an embed that received aspectRatio via onResolve previously
132
- // and now this information already stored in ADF.
133
- _this.setState({
134
- initialAspectRatio: aspectRatio
135
- });
136
- _this.saveOriginalDimensionsAttributes(DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_HEIGHT * aspectRatio);
137
- }
138
-
139
- // don't dispatch immediately since we might be in the middle of
140
- // rendering a nodeview
141
- rafSchedule(function () {
142
- var pos = _this.getPosSafely();
143
- if (pos === undefined) {
144
- return;
145
- }
146
- return view.dispatch(registerCard({
147
- title: title,
148
- url: url,
149
- pos: pos
150
- })(view.state.tr));
151
- })();
152
- try {
153
- var cardContext = _this.context.contextAdapter ? _this.context.contextAdapter.card : undefined;
154
- var hasPreview = cardContext && cardContext.value.extractors.getPreview(url, _this.props.platform);
155
- if (!hasPreview) {
156
- _this.setState({
157
- hasPreview: false
158
- });
159
- }
160
- } catch (e) {}
161
- });
162
- _defineProperty(_assertThisInitialized(_this), "updateSize", function (pctWidth, layout) {
163
- var _this$props$view = _this.props.view,
164
- state = _this$props$view.state,
165
- dispatch = _this$props$view.dispatch;
166
- var pos = _this.getPosSafely();
167
- if (pos === undefined) {
168
- return;
169
- }
170
- var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, _this.props.node.attrs), {}, {
171
- width: pctWidth,
172
- layout: layout
173
- }));
174
- tr.setMeta('scrollIntoView', false);
175
- dispatch(tr);
176
- return true;
177
- });
178
- _defineProperty(_assertThisInitialized(_this), "getLineLength", function (view, pos, originalLineLength) {
179
- if (typeof pos === 'number' && isRichMediaInsideOfBlockNode(view, pos)) {
180
- var $pos = view.state.doc.resolve(pos);
181
- var domNode = view.nodeDOM($pos.pos);
182
- if ($pos.nodeAfter && floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
183
- return domNode.parentElement.offsetWidth;
184
- }
185
- if (domNode instanceof HTMLElement) {
186
- return domNode.offsetWidth;
187
- }
188
- }
189
- return originalLineLength;
190
- });
191
- /**
192
- * Even though render is capable of listening and reacting to iframely wrapper iframe sent `resize` events
193
- * it's good idea to store latest actual height in ADF, so that when renderer (well, editor as well) is loading
194
- * we will show embed window of appropriate size and avoid unnecessary content jumping.
195
- */
196
- _defineProperty(_assertThisInitialized(_this), "saveOriginalDimensionsAttributes", function (height, width) {
197
- var view = _this.props.view;
198
-
199
- // TODO: ED-15663
200
- // Please, do not copy or use this kind of code below
201
- // @ts-ignore
202
- var fakeTableResizePluginKey = {
203
- key: 'tableFlexiColumnResizing$',
204
- getState: function getState(state) {
205
- return state['tableFlexiColumnResizing$'];
206
- }
207
- };
208
- var fakeTableResizeState = fakeTableResizePluginKey.getState(view.state);
209
-
210
- // We are not updating ADF when this function fired while table is resizing.
211
- // Changing ADF in the middle of resize will break table resize plugin logic
212
- // (tables will be considered different at the end of the drag and cell size won't be stored)
213
- // But this is not a big problem, editor user will be seeing latest height anyway (via updated state)
214
- // And even if page to be saved with slightly outdated height, renderer is capable of reading latest height value
215
- // when embed loads, and so it won't be a problem.
216
- if (fakeTableResizeState !== null && fakeTableResizeState !== void 0 && fakeTableResizeState.dragging) {
217
- return;
218
- }
219
- rafSchedule(function () {
220
- var pos = _this.getPosSafely();
221
- if (pos === undefined) {
222
- return;
223
- }
224
- view.dispatch(view.state.tr.step(new SetAttrsStep(pos, {
225
- originalHeight: height,
226
- originalWidth: width
227
- })).setMeta('addToHistory', false));
228
- })();
229
- });
230
- _defineProperty(_assertThisInitialized(_this), "onHeightUpdate", function (height) {
231
- _this.setState({
232
- liveHeight: height
233
- });
234
- _this.saveOriginalDimensionsAttributes(height, undefined);
235
- });
236
- _defineProperty(_assertThisInitialized(_this), "onError", function (_ref2) {
237
- var err = _ref2.err;
238
- if (err) {
239
- throw err;
240
- }
241
- });
242
- return _this;
243
- }
244
- _createClass(EmbedCardComponent, [{
245
- key: "UNSAFE_componentWillMount",
246
- value: function UNSAFE_componentWillMount() {
247
- var view = this.props.view;
248
- var scrollContainer = findOverflowScrollParent(view.dom);
249
- this.scrollContainer = scrollContainer || undefined;
250
- }
251
- }, {
252
- key: "render",
253
- value: function render() {
254
- var _this$props = this.props,
255
- node = _this$props.node,
256
- cardContext = _this$props.cardContext,
257
- platform = _this$props.platform,
258
- allowResizing = _this$props.allowResizing,
259
- fullWidthMode = _this$props.fullWidthMode,
260
- view = _this$props.view,
261
- dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
262
- getPos = _this$props.getPos,
263
- pluginInjectionApi = _this$props.pluginInjectionApi;
264
- var _node$attrs = node.attrs,
265
- url = _node$attrs.url,
266
- pctWidth = _node$attrs.width,
267
- layout = _node$attrs.layout,
268
- originalHeight = _node$attrs.originalHeight,
269
- originalWidth = _node$attrs.originalWidth;
270
- var _this$state = this.state,
271
- hasPreview = _this$state.hasPreview,
272
- liveHeight = _this$state.liveHeight,
273
- initialAspectRatio = _this$state.initialAspectRatio;
274
-
275
- // We don't want to use `originalHeight` when `originalWidth` also present,
276
- // since `heightAlone` is defined only when just height is available.
277
- var heightAlone = liveHeight !== null && liveHeight !== void 0 ? liveHeight : !originalWidth && originalHeight || undefined;
278
- var aspectRatio = !heightAlone && (
279
- // No need getting aspectRatio if heightAlone defined already
280
- initialAspectRatio ||
281
- // If we have initialAspectRatio (coming from iframely) we should go with that
282
- originalHeight && originalWidth && originalWidth / originalHeight) ||
283
- // If ADF contains both width and height we get ratio from that
284
- undefined;
285
- var cardProps = {
286
- layout: layout,
287
- pctWidth: pctWidth,
288
- fullWidthMode: fullWidthMode
289
- };
290
- var smartCard = /*#__PURE__*/React.createElement(SmartCard, {
291
- key: url,
292
- url: url,
293
- appearance: "embed",
294
- onClick: this.onClick,
295
- onResolve: this.onResolve,
296
- onError: this.onError,
297
- showActions: platform === 'web',
298
- isFrameVisible: true,
299
- inheritDimensions: true,
300
- platform: platform,
301
- container: this.scrollContainer,
302
- embedIframeRef: this.embedIframeRef
303
- });
304
- var cardInner = /*#__PURE__*/React.createElement(EmbedResizeMessageListener, {
305
- embedIframeRef: this.embedIframeRef,
306
- onHeightUpdate: this.onHeightUpdate
307
- }, /*#__PURE__*/React.createElement(CardInner, {
308
- pluginInjectionApi: pluginInjectionApi,
309
- smartCard: smartCard,
310
- hasPreview: hasPreview,
311
- getPosSafely: this.getPosSafely,
312
- view: view,
313
- getLineLength: this.getLineLength,
314
- eventDispatcher: this.props.eventDispatcher,
315
- updateSize: this.updateSize,
316
- getPos: getPos,
317
- aspectRatio: aspectRatio,
318
- allowResizing: allowResizing,
319
- heightAlone: heightAlone,
320
- cardProps: cardProps,
321
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
322
- }));
323
-
324
- // [WS-2307]: we only render card wrapped into a Provider when the value is ready
325
- return /*#__PURE__*/React.createElement(React.Fragment, null, cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
326
- value: cardContext.value
327
- }, cardInner) : null);
328
- }
329
- }]);
330
- return EmbedCardComponent;
331
- }(React.PureComponent);
332
- _defineProperty(EmbedCardComponent, "contextTypes", {
333
- contextAdapter: PropTypes.object
334
- });
335
- var WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
336
- export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
337
- _inherits(EmbedCard, _ReactNodeView);
338
- var _super2 = _createSuper(EmbedCard);
339
- function EmbedCard() {
340
- _classCallCheck(this, EmbedCard);
341
- return _super2.apply(this, arguments);
342
- }
343
- _createClass(EmbedCard, [{
344
- key: "viewShouldUpdate",
345
- value: function viewShouldUpdate(nextNode) {
346
- if (this.node.attrs !== nextNode.attrs) {
347
- return true;
348
- }
349
- return _get(_getPrototypeOf(EmbedCard.prototype), "viewShouldUpdate", this).call(this, nextNode);
350
- }
351
- }, {
352
- key: "createDomRef",
353
- value: function createDomRef() {
354
- var domRef = document.createElement('div');
355
- if (this.reactComponentProps.platform !== 'mobile') {
356
- // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
357
- // see also: https://github.com/ProseMirror/prosemirror/issues/884
358
- domRef.contentEditable = 'true';
359
- domRef.setAttribute('spellcheck', 'false');
360
- }
361
- return domRef;
362
- }
363
- }, {
364
- key: "render",
365
- value: function render() {
366
- var _this$reactComponentP = this.reactComponentProps,
367
- eventDispatcher = _this$reactComponentP.eventDispatcher,
368
- allowResizing = _this$reactComponentP.allowResizing,
369
- platform = _this$reactComponentP.platform,
370
- fullWidthMode = _this$reactComponentP.fullWidthMode,
371
- dispatchAnalyticsEvent = _this$reactComponentP.dispatchAnalyticsEvent,
372
- pluginInjectionApi = _this$reactComponentP.pluginInjectionApi;
373
- return /*#__PURE__*/React.createElement(WrappedBlockCard, {
374
- node: this.node,
375
- view: this.view,
376
- eventDispatcher: eventDispatcher,
377
- getPos: this.getPos,
378
- allowResizing: allowResizing,
379
- platform: platform,
380
- fullWidthMode: fullWidthMode,
381
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
382
- pluginInjectionApi: pluginInjectionApi
383
- });
384
- }
385
- }]);
386
- return EmbedCard;
387
- }(ReactNodeView);
@@ -1,111 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
- import React from 'react';
12
- import PropTypes from 'prop-types';
13
- import { isSafeUrl } from '@atlaskit/adf-schema';
14
- import { titleUrlPairFromNode } from '../utils';
15
- import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
16
- import { AnalyticsContext } from '@atlaskit/analytics-next';
17
- import { getPluginState } from '../pm-plugins/util/state';
18
- import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
19
- export function Card(SmartCardComponent, UnsupportedComponent) {
20
- var _class;
21
- return _class = /*#__PURE__*/function (_React$Component) {
22
- _inherits(_class, _React$Component);
23
- var _super = _createSuper(_class);
24
- function _class() {
25
- var _this;
26
- _classCallCheck(this, _class);
27
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
- args[_key] = arguments[_key];
29
- }
30
- _this = _super.call.apply(_super, [this].concat(args));
31
- _defineProperty(_assertThisInitialized(_this), "state", {
32
- isError: false
33
- });
34
- return _this;
35
- }
36
- _createClass(_class, [{
37
- key: "render",
38
- value: function render() {
39
- var _getPluginState;
40
- var _titleUrlPairFromNode = titleUrlPairFromNode(this.props.node),
41
- url = _titleUrlPairFromNode.url;
42
- if (url && !isSafeUrl(url)) {
43
- return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
44
- }
45
- if (this.state.isError) {
46
- if (url) {
47
- return /*#__PURE__*/React.createElement("a", {
48
- href: url,
49
- onClick: function onClick(e) {
50
- e.preventDefault();
51
- }
52
- }, url);
53
- } else {
54
- return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
55
- }
56
- }
57
- var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
58
- var editorAppearance = (_getPluginState = getPluginState(this.props.view.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance;
59
- var analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance);
60
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
61
- data: {
62
- attributes: {
63
- location: analyticsEditorAppearance
64
- },
65
- // Below is added for the future implementation of Linking Platform namespaced analytics context
66
- location: analyticsEditorAppearance
67
- }
68
- }, /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
69
- key: url,
70
- cardContext: cardContext
71
- }, this.props)));
72
- }
73
- }, {
74
- key: "componentDidCatch",
75
- value: function componentDidCatch(error) {
76
- var maybeAPIError = error;
77
- // NB: errors received in this component are propagated by the `@atlaskit/smart-card` component.
78
- // Depending on the kind of error, the expectation for this component is to either:
79
- // (1) Render a blue link whilst retaining `inlineCard` in the ADF (non-fatal errs);
80
- // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
81
-
82
- if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
83
- var _pluginInjectionApi$d;
84
- this.setState({
85
- isError: true
86
- });
87
- var _this$props = this.props,
88
- view = _this$props.view,
89
- node = _this$props.node,
90
- getPos = _this$props.getPos,
91
- pluginInjectionApi = _this$props.pluginInjectionApi;
92
- var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
93
- url = _titleUrlPairFromNode2.url;
94
- if (!getPos || typeof getPos === 'boolean') {
95
- return;
96
- }
97
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions)(view.state, view.dispatch);
98
- return null;
99
- } else {
100
- // Otherwise, render a blue link as fallback (above in render()).
101
- this.setState({
102
- isError: true
103
- });
104
- }
105
- }
106
- }]);
107
- return _class;
108
- }(React.Component), _defineProperty(_class, "contextTypes", {
109
- contextAdapter: PropTypes.object
110
- }), _class;
111
- }