@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,14 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { registerSmartCardEvents } from '../pm-plugins/actions';
3
- import { useSmartLinkEvents } from '@atlaskit/smart-card';
4
- export var EditorSmartCardEvents = function EditorSmartCardEvents(_ref) {
5
- var editorView = _ref.editorView;
6
- var events = useSmartLinkEvents();
7
- useEffect(function () {
8
- if (!events) {
9
- return;
10
- }
11
- editorView.dispatch(registerSmartCardEvents(events)(editorView.state.tr));
12
- }, [events, editorView]);
13
- return null;
14
- };
@@ -1,202 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
- 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); }; }
8
- 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; } }
9
- import React from 'react';
10
- import { useEffect, useMemo } from 'react';
11
- import PropTypes from 'prop-types';
12
- import { useSmartLinkLifecycleAnalytics } from '@atlaskit/link-analytics';
13
- import { INPUT_METHOD, ACTION } from '@atlaskit/editor-common/analytics';
14
- import { AnalyticsContext, UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
- import { registerSmartCardEventsNext } from '../pm-plugins/actions';
16
- import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
17
- import { getPluginState } from '../pm-plugins/util/state';
18
- /**
19
- * If the metadata is for a history event,
20
- * returns undo/redo instead of instead of what fn(metadata) would have otherwise
21
- * returned
22
- */
23
- var withHistoryMethod = function withHistoryMethod(fn) {
24
- return function (metadata) {
25
- var isUndo = metadata.isUndo,
26
- isRedo = metadata.isRedo;
27
- if (isUndo) {
28
- return 'undo';
29
- }
30
- if (isRedo) {
31
- return 'redo';
32
- }
33
- return fn(metadata);
34
- };
35
- };
36
- var getMethod = withHistoryMethod(function (_ref) {
37
- var inputMethod = _ref.inputMethod;
38
- switch (inputMethod) {
39
- case INPUT_METHOD.CLIPBOARD:
40
- return 'editor_paste';
41
- case INPUT_METHOD.FLOATING_TB:
42
- return 'editor_floatingToolbar';
43
- case INPUT_METHOD.AUTO_DETECT:
44
- case INPUT_METHOD.FORMATTING:
45
- return 'editor_type';
46
- default:
47
- return 'unknown';
48
- }
49
- });
50
- var getUpdateType = withHistoryMethod(function (_ref2) {
51
- var action = _ref2.action;
52
- switch (action) {
53
- case ACTION.CHANGED_TYPE:
54
- return 'display_update';
55
- case ACTION.UPDATED:
56
- return 'link_update';
57
- default:
58
- return 'unknown';
59
- }
60
- });
61
- var getDeleteType = withHistoryMethod(function (_ref3) {
62
- var action = _ref3.action;
63
- if (action === ACTION.UNLINK) {
64
- return 'unlink';
65
- }
66
- return 'delete';
67
- });
68
- var getSourceEventFromMetadata = function getSourceEventFromMetadata(metadata) {
69
- return metadata.sourceEvent instanceof UIAnalyticsEvent ? metadata.sourceEvent : null;
70
- };
71
-
72
- /**
73
- * Set display category as `link` if not displaying the link as a smart card
74
- */
75
- var displayCategoryFromDisplay = function displayCategoryFromDisplay(display) {
76
- if (display === 'url') {
77
- return 'link';
78
- }
79
- };
80
-
81
- /**
82
- * Binds the @atlaskit/link-analytics callbacks
83
- * to the editor card plugin state events callbacks interfaces
84
- */
85
- export var EventsBinding = function EventsBinding(_ref4) {
86
- var editorView = _ref4.editorView;
87
- /**
88
- * These callbacks internally use window.requestIdleCallback/requestAnimationFrame
89
- * to defer any heavy operations involving network
90
- *
91
- * The callbacks themselves should not be deferred, they should be called syncronously the moment
92
- * the events take place.
93
- */
94
- var _useSmartLinkLifecycl = useSmartLinkLifecycleAnalytics(),
95
- linkCreated = _useSmartLinkLifecycl.linkCreated,
96
- linkUpdated = _useSmartLinkLifecycl.linkUpdated,
97
- linkDeleted = _useSmartLinkLifecycl.linkDeleted;
98
- var events = useMemo(function () {
99
- return {
100
- created: function created(metadata) {
101
- var url = metadata.url,
102
- display = metadata.display,
103
- nodeContext = metadata.nodeContext;
104
- var displayCategory = displayCategoryFromDisplay(display);
105
- var sourceEvent = getSourceEventFromMetadata(metadata);
106
- var creationMethod = getMethod(metadata);
107
- linkCreated({
108
- url: url,
109
- displayCategory: displayCategory
110
- }, sourceEvent, {
111
- display: display,
112
- nodeContext: nodeContext,
113
- creationMethod: creationMethod
114
- });
115
- },
116
- updated: function updated(metadata) {
117
- var url = metadata.url,
118
- display = metadata.display,
119
- previousDisplay = metadata.previousDisplay,
120
- nodeContext = metadata.nodeContext;
121
- var displayCategory = displayCategoryFromDisplay(display);
122
- var sourceEvent = getSourceEventFromMetadata(metadata);
123
- var updateMethod = getMethod(metadata);
124
- var updateType = getUpdateType(metadata);
125
- linkUpdated({
126
- url: url,
127
- displayCategory: displayCategory
128
- }, sourceEvent, {
129
- display: display,
130
- previousDisplay: previousDisplay,
131
- nodeContext: nodeContext,
132
- updateMethod: updateMethod,
133
- updateType: updateType
134
- });
135
- },
136
- deleted: function deleted(metadata) {
137
- var url = metadata.url,
138
- display = metadata.display,
139
- nodeContext = metadata.nodeContext;
140
- var displayCategory = displayCategoryFromDisplay(display);
141
- var sourceEvent = getSourceEventFromMetadata(metadata);
142
- var deleteMethod = getMethod(metadata);
143
- var deleteType = getDeleteType(metadata);
144
- linkDeleted({
145
- url: url,
146
- displayCategory: displayCategory
147
- }, sourceEvent, {
148
- display: display,
149
- nodeContext: nodeContext,
150
- deleteMethod: deleteMethod,
151
- deleteType: deleteType
152
- });
153
- }
154
- };
155
- }, [linkCreated, linkUpdated, linkDeleted]);
156
- useEffect(function () {
157
- editorView.dispatch(registerSmartCardEventsNext(events)(editorView.state.tr));
158
- }, [events, editorView]);
159
- return null;
160
- };
161
- export var EditorSmartCardEventsNext = /*#__PURE__*/function (_React$PureComponent) {
162
- _inherits(EditorSmartCardEventsNext, _React$PureComponent);
163
- var _super = _createSuper(EditorSmartCardEventsNext);
164
- function EditorSmartCardEventsNext() {
165
- _classCallCheck(this, EditorSmartCardEventsNext);
166
- return _super.apply(this, arguments);
167
- }
168
- _createClass(EditorSmartCardEventsNext, [{
169
- key: "render",
170
- value: function render() {
171
- var _getPluginState;
172
- var cardContext = this.context.contextAdapter.card;
173
-
174
- /**
175
- * The analytics hook needs to be able to communicate with the card context
176
- * If we can't access it, don't mount the event bindings
177
- * This effectively entirely disables all tracking behaviour
178
- */
179
- if (!cardContext) {
180
- return null;
181
- }
182
- var editorAppearance = (_getPluginState = getPluginState(this.props.editorView.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance;
183
- var analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance);
184
- var analyticsData = {
185
- attributes: {
186
- location: analyticsEditorAppearance
187
- },
188
- // Below is added for the future implementation of Linking Platform namespaced analytic context
189
- location: analyticsEditorAppearance
190
- };
191
- return /*#__PURE__*/React.createElement(cardContext.Provider, {
192
- value: cardContext.value
193
- }, /*#__PURE__*/React.createElement(AnalyticsContext, {
194
- data: analyticsData
195
- }, /*#__PURE__*/React.createElement(EventsBinding, this.props)));
196
- }
197
- }]);
198
- return EditorSmartCardEventsNext;
199
- }(React.PureComponent);
200
- _defineProperty(EditorSmartCardEventsNext, "contextTypes", {
201
- contextAdapter: PropTypes.object
202
- });
@@ -1,163 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
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 _regeneratorRuntime from "@babel/runtime/regenerator";
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
- import React from 'react';
13
- import { Component } from 'react';
14
- import { LinkToolbarAppearance } from './LinkToolbarAppearance';
15
- export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
16
- _inherits(HyperlinkToolbarAppearance, _Component);
17
- var _super = _createSuper(HyperlinkToolbarAppearance);
18
- function HyperlinkToolbarAppearance() {
19
- var _this;
20
- _classCallCheck(this, HyperlinkToolbarAppearance);
21
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
- args[_key] = arguments[_key];
23
- }
24
- _this = _super.call.apply(_super, [this].concat(args));
25
- _defineProperty(_assertThisInitialized(_this), "state", {
26
- supportedUrlsMap: new Map()
27
- });
28
- _defineProperty(_assertThisInitialized(_this), "getProvider", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
29
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
30
- while (1) switch (_context2.prev = _context2.next) {
31
- case 0:
32
- if (!_this.cardProvider) {
33
- _context2.next = 2;
34
- break;
35
- }
36
- return _context2.abrupt("return", _this.cardProvider);
37
- case 2:
38
- return _context2.abrupt("return", new Promise(function (resolve) {
39
- var providerFactory = _this.props.providerFactory;
40
- providerFactory.subscribe('cardProvider', /*#__PURE__*/function () {
41
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_, cardProvider) {
42
- return _regeneratorRuntime.wrap(function _callee$(_context) {
43
- while (1) switch (_context.prev = _context.next) {
44
- case 0:
45
- if (cardProvider) {
46
- _context.next = 2;
47
- break;
48
- }
49
- return _context.abrupt("return");
50
- case 2:
51
- _context.next = 4;
52
- return cardProvider;
53
- case 4:
54
- _this.cardProvider = _context.sent;
55
- resolve(_this.cardProvider);
56
- case 6:
57
- case "end":
58
- return _context.stop();
59
- }
60
- }, _callee);
61
- }));
62
- return function (_x, _x2) {
63
- return _ref2.apply(this, arguments);
64
- };
65
- }());
66
- }));
67
- case 3:
68
- case "end":
69
- return _context2.stop();
70
- }
71
- }, _callee2);
72
- })));
73
- _defineProperty(_assertThisInitialized(_this), "resolveUrl", /*#__PURE__*/function () {
74
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url) {
75
- var supportedUrlsMap, isUrlSupported, provider;
76
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
77
- while (1) switch (_context3.prev = _context3.next) {
78
- case 0:
79
- supportedUrlsMap = _this.state.supportedUrlsMap;
80
- if (!supportedUrlsMap.has(url)) {
81
- _context3.next = 3;
82
- break;
83
- }
84
- return _context3.abrupt("return");
85
- case 3:
86
- isUrlSupported = false;
87
- _context3.prev = 4;
88
- _context3.next = 7;
89
- return _this.getProvider();
90
- case 7:
91
- provider = _context3.sent;
92
- _context3.next = 10;
93
- return provider.findPattern(url);
94
- case 10:
95
- isUrlSupported = _context3.sent;
96
- _context3.next = 16;
97
- break;
98
- case 13:
99
- _context3.prev = 13;
100
- _context3.t0 = _context3["catch"](4);
101
- isUrlSupported = false;
102
- case 16:
103
- supportedUrlsMap.set(url, isUrlSupported);
104
- _this.setState({
105
- supportedUrlsMap: supportedUrlsMap
106
- });
107
- case 18:
108
- case "end":
109
- return _context3.stop();
110
- }
111
- }, _callee3, null, [[4, 13]]);
112
- }));
113
- return function (_x3) {
114
- return _ref3.apply(this, arguments);
115
- };
116
- }());
117
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
118
- return _this.resolveUrl(_this.props.url);
119
- });
120
- return _this;
121
- }
122
- _createClass(HyperlinkToolbarAppearance, [{
123
- key: "UNSAFE_componentWillReceiveProps",
124
- value:
125
- // needed so we display the right state on the Toolbar while the same Toolbar
126
- // instance is visible and we click other link
127
- function UNSAFE_componentWillReceiveProps(nextProps) {
128
- if (nextProps.url !== this.props.url) {
129
- this.resolveUrl(nextProps.url);
130
- }
131
- }
132
- }, {
133
- key: "render",
134
- value: function render() {
135
- var _this$props = this.props,
136
- url = _this$props.url,
137
- intl = _this$props.intl,
138
- editorView = _this$props.editorView,
139
- editorState = _this$props.editorState,
140
- cardOptions = _this$props.cardOptions,
141
- platform = _this$props.platform,
142
- editorAnalyticsApi = _this$props.editorAnalyticsApi,
143
- cardActions = _this$props.cardActions;
144
- var supportedUrlsMap = this.state.supportedUrlsMap;
145
- if (!supportedUrlsMap.get(url)) {
146
- return null;
147
- }
148
- return /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
149
- key: "link-appearance",
150
- url: url,
151
- intl: intl,
152
- editorView: editorView,
153
- editorState: editorState,
154
- allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
155
- allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
156
- platform: platform,
157
- editorAnalyticsApi: editorAnalyticsApi,
158
- cardActions: cardActions
159
- });
160
- }
161
- }]);
162
- return HyperlinkToolbarAppearance;
163
- }(Component);
@@ -1,102 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
3
- 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; }
4
- /** @jsx jsx */
5
- import React, { useCallback, useMemo } from 'react';
6
- import { jsx } from '@emotion/react';
7
- import { Popup } from '@atlaskit/editor-common/ui';
8
- import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
9
- import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
10
- import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
11
- import { injectIntl } from 'react-intl-next';
12
- import { toolbarButtonWrapper } from './styled';
13
- import { getDatasource } from './utils';
14
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
15
- import { setCardLayout } from '../../pm-plugins/actions';
16
- import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
17
- export var LayoutButton = function LayoutButton(_ref) {
18
- var onLayoutChange = _ref.onLayoutChange,
19
- _ref$layout = _ref.layout,
20
- layout = _ref$layout === void 0 ? 'center' : _ref$layout,
21
- formatMessage = _ref.intl.formatMessage,
22
- mountPoint = _ref.mountPoint,
23
- boundariesElement = _ref.boundariesElement,
24
- scrollableElement = _ref.scrollableElement,
25
- targetElement = _ref.targetElement,
26
- _ref$testId = _ref.testId,
27
- testId = _ref$testId === void 0 ? 'datasource-table-layout-button' : _ref$testId;
28
- var handleClick = useCallback(function () {
29
- onLayoutChange && onLayoutChange(getNextBreakoutMode(layout));
30
- }, [layout, onLayoutChange]);
31
- var title = useMemo(function () {
32
- return formatMessage(getTitle(layout));
33
- }, [formatMessage, layout]);
34
- if (!targetElement) {
35
- return null;
36
- }
37
- return jsx(Popup, {
38
- mountTo: mountPoint,
39
- boundariesElement: boundariesElement,
40
- scrollableElement: scrollableElement,
41
- target: targetElement,
42
- alignY: "start",
43
- alignX: "end",
44
- forcePlacement: true,
45
- stick: true,
46
- ariaLabel: title
47
- }, jsx(ToolbarButton, {
48
- testId: testId,
49
- css: toolbarButtonWrapper,
50
- title: title,
51
- onClick: handleClick,
52
- iconBefore: layout === 'full-width' ? jsx(CollapseIcon, {
53
- label: title
54
- }) : jsx(ExpandIcon, {
55
- label: title
56
- })
57
- }));
58
- };
59
- var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
60
- var _node$attrs, _node$attrs2;
61
- var editorView = _ref2.editorView,
62
- mountPoint = _ref2.mountPoint,
63
- scrollableElement = _ref2.scrollableElement,
64
- boundariesElement = _ref2.boundariesElement,
65
- intl = _ref2.intl,
66
- api = _ref2.api;
67
- var _useSharedPluginState = useSharedPluginState(api, ['card']),
68
- cardState = _useSharedPluginState.cardState;
69
- var _getDatasource = getDatasource(editorView),
70
- node = _getDatasource.node,
71
- pos = _getDatasource.pos;
72
- var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
73
- datasourceTableRef = _ref3.datasourceTableRef,
74
- _ref3$layout = _ref3.layout,
75
- layout = _ref3$layout === void 0 ? (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || 'center' : _ref3$layout;
76
- var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
77
- var onLayoutChange = function onLayoutChange(layout) {
78
- if (pos === undefined) {
79
- return;
80
- }
81
- var state = editorView.state,
82
- dispatch = editorView.dispatch;
83
- var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
84
- layout: layout
85
- }));
86
- tr.setMeta('scrollIntoView', false);
87
- dispatch(setCardLayout(layout)(tr));
88
- };
89
- if (!isDatasource) {
90
- return null;
91
- }
92
- return jsx(LayoutButton, {
93
- mountPoint: mountPoint,
94
- scrollableElement: scrollableElement,
95
- boundariesElement: boundariesElement,
96
- targetElement: datasourceTableRef,
97
- layout: layout,
98
- onLayoutChange: onLayoutChange,
99
- intl: intl
100
- });
101
- };
102
- export default injectIntl(LayoutButtonWrapper);
@@ -1,10 +0,0 @@
1
- import { css } from '@emotion/react';
2
- import { B300, N300, N20A } from '@atlaskit/theme/colors';
3
- export var toolbarButtonWrapper = css({
4
- background: "".concat("var(--ds-background-neutral, ".concat(N20A, ")")),
5
- color: "".concat("var(--ds-icon, ".concat(N300, ")")),
6
- ':hover': {
7
- background: "".concat("var(--ds-background-neutral-hovered, ".concat(B300, ")")),
8
- color: "var(--ds-icon, white)".concat(" !important")
9
- }
10
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { findSelectedNodeOfType } from 'prosemirror-utils';
2
- export var getDatasource = function getDatasource(editorView) {
3
- var _findSelectedNodeOfTy;
4
- var _editorView$state = editorView.state,
5
- selection = _editorView$state.selection,
6
- schema = _editorView$state.schema;
7
- var blockCard = schema.nodes.blockCard;
8
- return (_findSelectedNodeOfTy = findSelectedNodeOfType([blockCard])(selection)) !== null && _findSelectedNodeOfTy !== void 0 ? _findSelectedNodeOfTy : {
9
- node: undefined,
10
- pos: undefined
11
- };
12
- };
@@ -1,140 +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
- import React from 'react';
13
- import PropTypes from 'prop-types';
14
- import { Fragment } from 'prosemirror-model';
15
- import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
16
- import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/messages';
17
- import { isSupportedInParent } from '@atlaskit/editor-common/utils';
18
- import { getButtonGroupOption, LinkToolbarButtonGroup, commandWithMetadata } from '@atlaskit/editor-common/card';
19
- export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
20
- _inherits(LinkToolbarAppearance, _React$Component);
21
- var _super = _createSuper(LinkToolbarAppearance);
22
- function LinkToolbarAppearance() {
23
- var _this;
24
- _classCallCheck(this, LinkToolbarAppearance);
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
- _this = _super.call.apply(_super, [this].concat(args));
29
- _defineProperty(_assertThisInitialized(_this), "renderDropdown", function (view, cardContext) {
30
- var _cardActions$setSelec, _cardActions$setSelec2, _cardActions$changeSe, _cardActions$setSelec3;
31
- var _this$props = _this.props,
32
- url = _this$props.url,
33
- intl = _this$props.intl,
34
- currentAppearance = _this$props.currentAppearance,
35
- editorState = _this$props.editorState,
36
- allowEmbeds = _this$props.allowEmbeds,
37
- _this$props$allowBloc = _this$props.allowBlockCards,
38
- allowBlockCards = _this$props$allowBloc === void 0 ? true : _this$props$allowBloc,
39
- platform = _this$props.platform,
40
- editorAnalyticsApi = _this$props.editorAnalyticsApi,
41
- cardActions = _this$props.cardActions;
42
- var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
43
- var defaultCommand = function defaultCommand() {
44
- return false;
45
- };
46
- if (url) {
47
- var _cardContext$store, _urlState$error;
48
- var urlState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
49
- if ((urlState === null || urlState === void 0 ? void 0 : (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
50
- return null;
51
- }
52
- }
53
- var isBlockCardLinkSupportedInParent = allowBlockCards ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance) : false;
54
- var isEmbedCardLinkSupportedInParent = allowEmbeds ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance) : false;
55
- var embedOption = allowEmbeds && preview && {
56
- appearance: 'embed',
57
- title: intl.formatMessage(messages.embed),
58
- onClick: (_cardActions$setSelec = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('embed', editorAnalyticsApi)) !== null && _cardActions$setSelec !== void 0 ? _cardActions$setSelec : defaultCommand,
59
- selected: currentAppearance === 'embed',
60
- hidden: false,
61
- testId: 'embed-appearance',
62
- disabled: !isEmbedCardLinkSupportedInParent,
63
- tooltip: isEmbedCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
64
- };
65
- var blockCardOption = allowBlockCards && {
66
- appearance: 'block',
67
- title: intl.formatMessage(messages.block),
68
- onClick: (_cardActions$setSelec2 = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('block', editorAnalyticsApi)) !== null && _cardActions$setSelec2 !== void 0 ? _cardActions$setSelec2 : defaultCommand,
69
- selected: currentAppearance === 'block',
70
- testId: 'block-appearance',
71
- disabled: !isBlockCardLinkSupportedInParent,
72
- tooltip: isBlockCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
73
- };
74
- var options = [{
75
- title: intl.formatMessage(messages.url),
76
- onClick: commandWithMetadata((_cardActions$changeSe = cardActions === null || cardActions === void 0 ? void 0 : cardActions.changeSelectedCardToLink(url, url, true, undefined, undefined, editorAnalyticsApi)) !== null && _cardActions$changeSe !== void 0 ? _cardActions$changeSe : defaultCommand, {
77
- action: ACTION.CHANGED_TYPE
78
- }),
79
- selected: !currentAppearance,
80
- testId: 'url-appearance'
81
- }, {
82
- appearance: 'inline',
83
- title: intl.formatMessage(messages.inline),
84
- onClick: (_cardActions$setSelec3 = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('inline', editorAnalyticsApi)) !== null && _cardActions$setSelec3 !== void 0 ? _cardActions$setSelec3 : defaultCommand,
85
- selected: currentAppearance === 'inline',
86
- testId: 'inline-appearance'
87
- }];
88
- var dispatchCommand = function dispatchCommand(fn) {
89
- fn && fn(editorState, view && view.dispatch);
90
- // Refocus the view to ensure the editor has focus
91
- if (view && !view.hasFocus()) {
92
- view.focus();
93
- }
94
- };
95
- if (blockCardOption) {
96
- options.push(blockCardOption);
97
- }
98
- if (embedOption) {
99
- options.push(embedOption);
100
- }
101
- return /*#__PURE__*/React.createElement(LinkToolbarButtonGroup, {
102
- key: "link-toolbar-button-group",
103
- options: options.map(function (option) {
104
- return getButtonGroupOption(intl, dispatchCommand, _objectSpread(_objectSpread({}, option), {}, {
105
- onClick: commandWithMetadata(option.onClick, {
106
- inputMethod: INPUT_METHOD.FLOATING_TB
107
- })
108
- }));
109
- })
110
- });
111
- });
112
- return _this;
113
- }
114
- _createClass(LinkToolbarAppearance, [{
115
- key: "render",
116
- value: function render() {
117
- var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
118
- var editorView = this.props.editorView;
119
- return this.renderDropdown(editorView, cardContext && cardContext.value);
120
- }
121
- }]);
122
- return LinkToolbarAppearance;
123
- }(React.Component);
124
- _defineProperty(LinkToolbarAppearance, "contextTypes", {
125
- contextAdapter: PropTypes.object
126
- });
127
- var getUnavailableMessage = function getUnavailableMessage(state, intl) {
128
- try {
129
- var parentNode = state.selection.$from.node(1);
130
- var parentName = intl.formatMessage(nodeNames[parentNode.type.name]);
131
- var tooltip = intl.formatMessage(messages.displayOptionUnavailableInParentNode, {
132
- node: parentName
133
- });
134
- return tooltip;
135
- } catch (e) {
136
- return intl.formatMessage(messages.displayOptionUnavailableInParentNode, {
137
- node: intl.formatMessage(nodeNames.defaultBlockNode)
138
- });
139
- }
140
- };