@atlaskit/editor-core 185.16.3 → 185.16.6

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 (366) 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/expand/commands.js +15 -12
  33. package/dist/cjs/plugins/expand/nodeviews/index.js +4 -1
  34. package/dist/cjs/plugins/index.js +0 -7
  35. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +14 -25
  36. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  37. package/dist/cjs/version-wrapper.js +1 -1
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/i18n/cs.js +0 -35
  40. package/dist/es2019/i18n/da.js +0 -35
  41. package/dist/es2019/i18n/de.js +0 -35
  42. package/dist/es2019/i18n/en.js +0 -35
  43. package/dist/es2019/i18n/en_GB.js +0 -35
  44. package/dist/es2019/i18n/en_ZZ.js +0 -35
  45. package/dist/es2019/i18n/es.js +1 -35
  46. package/dist/es2019/i18n/fi.js +0 -35
  47. package/dist/es2019/i18n/fr.js +1 -35
  48. package/dist/es2019/i18n/hu.js +1 -35
  49. package/dist/es2019/i18n/it.js +1 -35
  50. package/dist/es2019/i18n/ja.js +1 -35
  51. package/dist/es2019/i18n/ko.js +0 -35
  52. package/dist/es2019/i18n/nb.js +1 -35
  53. package/dist/es2019/i18n/nl.js +1 -35
  54. package/dist/es2019/i18n/pl.js +1 -35
  55. package/dist/es2019/i18n/pt_BR.js +1 -35
  56. package/dist/es2019/i18n/ru.js +1 -35
  57. package/dist/es2019/i18n/sv.js +0 -35
  58. package/dist/es2019/i18n/th.js +0 -35
  59. package/dist/es2019/i18n/tr.js +1 -35
  60. package/dist/es2019/i18n/uk.js +1 -35
  61. package/dist/es2019/i18n/vi.js +0 -35
  62. package/dist/es2019/i18n/zh.js +1 -35
  63. package/dist/es2019/i18n/zh_TW.js +1 -35
  64. package/dist/es2019/labs/next/presets/mobile.js +1 -1
  65. package/dist/es2019/labs/next/presets/universal.js +1 -1
  66. package/dist/es2019/plugins/deprecated-card/doc.js +97 -0
  67. package/dist/es2019/plugins/deprecated-hyperlink/commands.js +1 -1
  68. package/dist/es2019/plugins/expand/commands.js +13 -14
  69. package/dist/es2019/plugins/expand/nodeviews/index.js +4 -1
  70. package/dist/es2019/plugins/index.js +0 -1
  71. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -14
  72. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +13 -0
  73. package/dist/es2019/version-wrapper.js +1 -1
  74. package/dist/es2019/version.json +1 -1
  75. package/dist/esm/i18n/cs.js +0 -35
  76. package/dist/esm/i18n/da.js +0 -35
  77. package/dist/esm/i18n/de.js +0 -35
  78. package/dist/esm/i18n/en.js +0 -35
  79. package/dist/esm/i18n/en_GB.js +0 -35
  80. package/dist/esm/i18n/en_ZZ.js +0 -35
  81. package/dist/esm/i18n/es.js +1 -35
  82. package/dist/esm/i18n/fi.js +0 -35
  83. package/dist/esm/i18n/fr.js +1 -35
  84. package/dist/esm/i18n/hu.js +1 -35
  85. package/dist/esm/i18n/it.js +1 -35
  86. package/dist/esm/i18n/ja.js +1 -35
  87. package/dist/esm/i18n/ko.js +0 -35
  88. package/dist/esm/i18n/nb.js +1 -35
  89. package/dist/esm/i18n/nl.js +1 -35
  90. package/dist/esm/i18n/pl.js +1 -35
  91. package/dist/esm/i18n/pt_BR.js +1 -35
  92. package/dist/esm/i18n/ru.js +1 -35
  93. package/dist/esm/i18n/sv.js +0 -35
  94. package/dist/esm/i18n/th.js +0 -35
  95. package/dist/esm/i18n/tr.js +1 -35
  96. package/dist/esm/i18n/uk.js +1 -35
  97. package/dist/esm/i18n/vi.js +0 -35
  98. package/dist/esm/i18n/zh.js +1 -35
  99. package/dist/esm/i18n/zh_TW.js +1 -35
  100. package/dist/esm/labs/next/presets/mobile.js +1 -1
  101. package/dist/esm/labs/next/presets/universal.js +1 -1
  102. package/dist/esm/plugins/deprecated-card/doc.js +105 -0
  103. package/dist/esm/plugins/deprecated-hyperlink/commands.js +1 -1
  104. package/dist/esm/plugins/expand/commands.js +16 -13
  105. package/dist/esm/plugins/expand/nodeviews/index.js +4 -1
  106. package/dist/esm/plugins/index.js +0 -1
  107. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +14 -25
  108. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  109. package/dist/esm/version-wrapper.js +1 -1
  110. package/dist/esm/version.json +1 -1
  111. package/dist/types/i18n/cs.d.ts +0 -35
  112. package/dist/types/i18n/da.d.ts +0 -35
  113. package/dist/types/i18n/de.d.ts +0 -35
  114. package/dist/types/i18n/en.d.ts +0 -35
  115. package/dist/types/i18n/en_GB.d.ts +0 -35
  116. package/dist/types/i18n/en_ZZ.d.ts +0 -35
  117. package/dist/types/i18n/es.d.ts +1 -35
  118. package/dist/types/i18n/fi.d.ts +0 -35
  119. package/dist/types/i18n/fr.d.ts +1 -35
  120. package/dist/types/i18n/hu.d.ts +1 -35
  121. package/dist/types/i18n/it.d.ts +1 -35
  122. package/dist/types/i18n/ja.d.ts +1 -35
  123. package/dist/types/i18n/ko.d.ts +0 -35
  124. package/dist/types/i18n/nb.d.ts +1 -35
  125. package/dist/types/i18n/nl.d.ts +1 -35
  126. package/dist/types/i18n/pl.d.ts +1 -35
  127. package/dist/types/i18n/pt_BR.d.ts +1 -35
  128. package/dist/types/i18n/ru.d.ts +1 -35
  129. package/dist/types/i18n/sv.d.ts +0 -35
  130. package/dist/types/i18n/th.d.ts +0 -35
  131. package/dist/types/i18n/tr.d.ts +1 -35
  132. package/dist/types/i18n/uk.d.ts +1 -35
  133. package/dist/types/i18n/vi.d.ts +0 -35
  134. package/dist/types/i18n/zh.d.ts +1 -35
  135. package/dist/types/i18n/zh_TW.d.ts +1 -35
  136. package/dist/types/plugins/deprecated-card/doc.d.ts +20 -0
  137. package/dist/types/plugins/expand/commands.d.ts +1 -1
  138. package/dist/types/plugins/index.d.ts +0 -1
  139. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  140. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  141. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  142. package/dist/types/plugins/paste/index.d.ts +1 -1
  143. package/dist/types-ts4.5/i18n/cs.d.ts +0 -35
  144. package/dist/types-ts4.5/i18n/da.d.ts +0 -35
  145. package/dist/types-ts4.5/i18n/de.d.ts +0 -35
  146. package/dist/types-ts4.5/i18n/en.d.ts +0 -35
  147. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -35
  148. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -35
  149. package/dist/types-ts4.5/i18n/es.d.ts +1 -35
  150. package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
  151. package/dist/types-ts4.5/i18n/fr.d.ts +1 -35
  152. package/dist/types-ts4.5/i18n/hu.d.ts +1 -35
  153. package/dist/types-ts4.5/i18n/it.d.ts +1 -35
  154. package/dist/types-ts4.5/i18n/ja.d.ts +1 -35
  155. package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
  156. package/dist/types-ts4.5/i18n/nb.d.ts +1 -35
  157. package/dist/types-ts4.5/i18n/nl.d.ts +1 -35
  158. package/dist/types-ts4.5/i18n/pl.d.ts +1 -35
  159. package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -35
  160. package/dist/types-ts4.5/i18n/ru.d.ts +1 -35
  161. package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
  162. package/dist/types-ts4.5/i18n/th.d.ts +0 -35
  163. package/dist/types-ts4.5/i18n/tr.d.ts +1 -35
  164. package/dist/types-ts4.5/i18n/uk.d.ts +1 -35
  165. package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
  166. package/dist/types-ts4.5/i18n/zh.d.ts +1 -35
  167. package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -35
  168. package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +20 -0
  169. package/dist/types-ts4.5/plugins/expand/commands.d.ts +1 -1
  170. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  171. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  172. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  173. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  174. package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
  175. package/package.json +6 -5
  176. package/tmp/api-report-tmp.d.ts +2307 -0
  177. package/dist/cjs/plugins/card/index.js +0 -139
  178. package/dist/cjs/plugins/card/messages.js +0 -20
  179. package/dist/cjs/plugins/card/nodeviews/blockCard.js +0 -163
  180. package/dist/cjs/plugins/card/nodeviews/datasource.js +0 -172
  181. package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -396
  182. package/dist/cjs/plugins/card/nodeviews/genericCard.js +0 -118
  183. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +0 -131
  184. package/dist/cjs/plugins/card/pm-plugins/actions.js +0 -122
  185. package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -48
  186. package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -353
  187. package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +0 -19
  188. package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +0 -5
  189. package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +0 -178
  190. package/dist/cjs/plugins/card/pm-plugins/doc.js +0 -478
  191. package/dist/cjs/plugins/card/pm-plugins/keymap.js +0 -64
  192. package/dist/cjs/plugins/card/pm-plugins/main.js +0 -212
  193. package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +0 -47
  194. package/dist/cjs/plugins/card/pm-plugins/plugin-key.js +0 -9
  195. package/dist/cjs/plugins/card/pm-plugins/reducers.js +0 -111
  196. package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +0 -35
  197. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +0 -58
  198. package/dist/cjs/plugins/card/pm-plugins/util/state.js +0 -49
  199. package/dist/cjs/plugins/card/toolbar.js +0 -364
  200. package/dist/cjs/plugins/card/types.js +0 -5
  201. package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -25
  202. package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +0 -60
  203. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +0 -256
  204. package/dist/cjs/plugins/card/ui/EditorSmartCardEvents.js +0 -21
  205. package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +0 -213
  206. package/dist/cjs/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -173
  207. package/dist/cjs/plugins/card/ui/LayoutButton/index.js +0 -113
  208. package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +0 -17
  209. package/dist/cjs/plugins/card/ui/LayoutButton/types.js +0 -5
  210. package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +0 -19
  211. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +0 -151
  212. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +0 -360
  213. package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +0 -20
  214. package/dist/cjs/plugins/card/utils.js +0 -60
  215. package/dist/es2019/plugins/card/index.js +0 -131
  216. package/dist/es2019/plugins/card/messages.js +0 -13
  217. package/dist/es2019/plugins/card/nodeviews/blockCard.js +0 -130
  218. package/dist/es2019/plugins/card/nodeviews/datasource.js +0 -136
  219. package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -368
  220. package/dist/es2019/plugins/card/nodeviews/genericCard.js +0 -92
  221. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +0 -112
  222. package/dist/es2019/plugins/card/pm-plugins/actions.js +0 -57
  223. package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -38
  224. package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -333
  225. package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +0 -2
  226. package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +0 -1
  227. package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +0 -160
  228. package/dist/es2019/plugins/card/pm-plugins/doc.js +0 -451
  229. package/dist/es2019/plugins/card/pm-plugins/keymap.js +0 -59
  230. package/dist/es2019/plugins/card/pm-plugins/main.js +0 -208
  231. package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +0 -37
  232. package/dist/es2019/plugins/card/pm-plugins/plugin-key.js +0 -2
  233. package/dist/es2019/plugins/card/pm-plugins/reducers.js +0 -110
  234. package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +0 -25
  235. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +0 -48
  236. package/dist/es2019/plugins/card/pm-plugins/util/state.js +0 -26
  237. package/dist/es2019/plugins/card/toolbar.js +0 -362
  238. package/dist/es2019/plugins/card/types.js +0 -1
  239. package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -19
  240. package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +0 -48
  241. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +0 -225
  242. package/dist/es2019/plugins/card/ui/EditorSmartCardEvents.js +0 -15
  243. package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +0 -198
  244. package/dist/es2019/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -86
  245. package/dist/es2019/plugins/card/ui/LayoutButton/index.js +0 -106
  246. package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +0 -10
  247. package/dist/es2019/plugins/card/ui/LayoutButton/types.js +0 -1
  248. package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +0 -15
  249. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +0 -117
  250. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +0 -332
  251. package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +0 -11
  252. package/dist/es2019/plugins/card/utils.js +0 -46
  253. package/dist/esm/plugins/card/index.js +0 -132
  254. package/dist/esm/plugins/card/messages.js +0 -13
  255. package/dist/esm/plugins/card/nodeviews/blockCard.js +0 -155
  256. package/dist/esm/plugins/card/nodeviews/datasource.js +0 -164
  257. package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -387
  258. package/dist/esm/plugins/card/nodeviews/genericCard.js +0 -111
  259. package/dist/esm/plugins/card/nodeviews/inlineCard.js +0 -123
  260. package/dist/esm/plugins/card/pm-plugins/actions.js +0 -102
  261. package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -41
  262. package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -344
  263. package/dist/esm/plugins/card/pm-plugins/analytics/index.js +0 -2
  264. package/dist/esm/plugins/card/pm-plugins/analytics/types.js +0 -1
  265. package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +0 -160
  266. package/dist/esm/plugins/card/pm-plugins/doc.js +0 -460
  267. package/dist/esm/plugins/card/pm-plugins/keymap.js +0 -58
  268. package/dist/esm/plugins/card/pm-plugins/main.js +0 -199
  269. package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +0 -39
  270. package/dist/esm/plugins/card/pm-plugins/plugin-key.js +0 -2
  271. package/dist/esm/plugins/card/pm-plugins/reducers.js +0 -103
  272. package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +0 -29
  273. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +0 -50
  274. package/dist/esm/plugins/card/pm-plugins/util/state.js +0 -40
  275. package/dist/esm/plugins/card/toolbar.js +0 -353
  276. package/dist/esm/plugins/card/types.js +0 -1
  277. package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -17
  278. package/dist/esm/plugins/card/ui/DatasourceModal/index.js +0 -49
  279. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +0 -243
  280. package/dist/esm/plugins/card/ui/EditorSmartCardEvents.js +0 -14
  281. package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +0 -202
  282. package/dist/esm/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -163
  283. package/dist/esm/plugins/card/ui/LayoutButton/index.js +0 -102
  284. package/dist/esm/plugins/card/ui/LayoutButton/styled.js +0 -10
  285. package/dist/esm/plugins/card/ui/LayoutButton/types.js +0 -1
  286. package/dist/esm/plugins/card/ui/LayoutButton/utils.js +0 -12
  287. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +0 -140
  288. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +0 -355
  289. package/dist/esm/plugins/card/ui/SmallerEditIcon.js +0 -11
  290. package/dist/esm/plugins/card/utils.js +0 -48
  291. package/dist/types/plugins/card/index.d.ts +0 -26
  292. package/dist/types/plugins/card/messages.d.ts +0 -12
  293. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +0 -26
  294. package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -42
  295. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -46
  296. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -37
  297. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  298. package/dist/types/plugins/card/pm-plugins/actions.d.ts +0 -23
  299. package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  300. package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  301. package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  302. package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  303. package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  304. package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -23
  305. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +0 -3
  306. package/dist/types/plugins/card/pm-plugins/main.d.ts +0 -6
  307. package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  308. package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  309. package/dist/types/plugins/card/pm-plugins/reducers.d.ts +0 -3
  310. package/dist/types/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  311. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  312. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -31
  313. package/dist/types/plugins/card/toolbar.d.ts +0 -12
  314. package/dist/types/plugins/card/types.d.ts +0 -165
  315. package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  316. package/dist/types/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  317. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  318. package/dist/types/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  319. package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  320. package/dist/types/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  321. package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  322. package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  323. package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  324. package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  325. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  326. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  327. package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  328. package/dist/types/plugins/card/utils.d.ts +0 -19
  329. package/dist/types-ts4.5/plugins/card/index.d.ts +0 -26
  330. package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -12
  331. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +0 -26
  332. package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -42
  333. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +0 -46
  334. package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +0 -37
  335. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  336. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +0 -23
  337. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  338. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  339. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  340. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  341. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  342. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +0 -23
  343. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +0 -3
  344. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +0 -6
  345. package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  346. package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  347. package/dist/types-ts4.5/plugins/card/pm-plugins/reducers.d.ts +0 -3
  348. package/dist/types-ts4.5/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  349. package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  350. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -31
  351. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +0 -12
  352. package/dist/types-ts4.5/plugins/card/types.d.ts +0 -165
  353. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  354. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  355. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  356. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  357. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  358. package/dist/types-ts4.5/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  359. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  360. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  361. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  362. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  363. package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  364. package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  365. package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  366. package/dist/types-ts4.5/plugins/card/utils.d.ts +0 -19
@@ -1,362 +0,0 @@
1
- import React from 'react';
2
- import { NodeSelection } from 'prosemirror-state';
3
- import { removeSelectedNode, findDomRefAtPos } from 'prosemirror-utils';
4
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
5
- import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
6
- import CogIcon from '@atlaskit/icon/glyph/editor/settings';
7
- import OpenIcon from '@atlaskit/icon/glyph/shortcut';
8
- import { buildLayoutButtons } from '@atlaskit/editor-common/card';
9
- import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
10
- import { changeSelectedCardToText } from './pm-plugins/doc';
11
- import { commandWithMetadata } from '@atlaskit/editor-common/card';
12
- import { pluginKey } from './pm-plugins/main';
13
- import { richMediaClassName } from '@atlaskit/editor-common/styles';
14
- import { editDatasource, buildEditLinkToolbar, editLink, editLinkToolbarConfig } from './ui/EditLinkToolbar';
15
- import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNodeType } from './utils';
16
- import { isSafeUrl } from '@atlaskit/adf-schema';
17
- import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
18
- import { cardMessages as messages } from '@atlaskit/editor-common/messages';
19
- import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from '@atlaskit/editor-common/styles';
20
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
21
- import { SmallerEditIcon } from './ui/SmallerEditIcon';
22
- import { canRenderDatasource } from '@atlaskit/editor-common/utils';
23
- export const removeCard = editorAnalyticsApi => commandWithMetadata((state, dispatch) => {
24
- if (!(state.selection instanceof NodeSelection)) {
25
- return false;
26
- }
27
- const type = state.selection.node.type.name;
28
- const payload = {
29
- action: ACTION.DELETED,
30
- actionSubject: ACTION_SUBJECT.SMART_LINK,
31
- actionSubjectId: type,
32
- attributes: {
33
- inputMethod: INPUT_METHOD.TOOLBAR,
34
- displayMode: type
35
- },
36
- eventType: EVENT_TYPE.TRACK
37
- };
38
- if (dispatch) {
39
- const {
40
- tr
41
- } = state;
42
- removeSelectedNode(tr);
43
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
44
- dispatch(tr);
45
- }
46
- return true;
47
- }, {
48
- action: ACTION.DELETED
49
- });
50
- export const visitCardLink = editorAnalyticsApi => (state, dispatch) => {
51
- if (!(state.selection instanceof NodeSelection)) {
52
- return false;
53
- }
54
- const {
55
- type
56
- } = state.selection.node;
57
- const {
58
- url
59
- } = titleUrlPairFromNode(state.selection.node);
60
-
61
- // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
62
- // We are in edit mode here, open the smart card URL in a new window.
63
- window.open(url);
64
- if (dispatch) {
65
- const {
66
- tr
67
- } = state;
68
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildVisitedLinkPayload(type.name))(tr);
69
- dispatch(tr);
70
- }
71
- return true;
72
- };
73
- export const openLinkSettings = editorAnalyticsApi => (state, dispatch) => {
74
- if (!(state.selection instanceof NodeSelection)) {
75
- return false;
76
- }
77
- window.open('https://id.atlassian.com/manage-profile/link-preferences');
78
- if (dispatch) {
79
- const {
80
- tr,
81
- selection: {
82
- node: {
83
- type
84
- }
85
- }
86
- } = state;
87
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildOpenedSettingsPayload(type.name))(tr);
88
- dispatch(tr);
89
- }
90
- return true;
91
- };
92
- export const floatingToolbar = (cardOptions, featureFlags, platform, linkPickerOptions, pluginInjectionApi) => {
93
- return (state, intl, providerFactory) => {
94
- const {
95
- inlineCard,
96
- blockCard,
97
- embedCard
98
- } = state.schema.nodes;
99
- const nodeType = [inlineCard, blockCard, embedCard];
100
- const pluginState = pluginKey.getState(state);
101
- if (!(state.selection instanceof NodeSelection)) {
102
- return;
103
- }
104
- const selectedNode = state.selection.node;
105
- if (!selectedNode) {
106
- return;
107
- }
108
- const isEmbedCard = appearanceForNodeType(selectedNode.type) === 'embed';
109
-
110
- /* add an offset to embeds due to extra padding */
111
- const toolbarOffset = isEmbedCard ? {
112
- offset: [0, 24]
113
- } : {};
114
-
115
- // Applies padding override for when link picker is currently displayed
116
- const className = pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar ? FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
117
-
118
- /**
119
- * Enable focus trap only if feature flag is enabled AND for the new version of the picker
120
- */
121
- const {
122
- lpLinkPicker,
123
- lpLinkPickerFocusTrap,
124
- preventPopupOverflow
125
- } = featureFlags;
126
- const shouldEnableFocusTrap = lpLinkPicker && lpLinkPickerFocusTrap;
127
- const isLinkPickerEnabled = !!lpLinkPicker;
128
- return {
129
- title: intl.formatMessage(messages.card),
130
- className,
131
- nodeType,
132
- preventPopupOverflow,
133
- ...toolbarOffset,
134
- getDomRef: view => {
135
- const element = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
136
- if (!element) {
137
- return undefined;
138
- }
139
- if (isEmbedCard) {
140
- return element.querySelector(`.${richMediaClassName}`);
141
- }
142
- return element;
143
- },
144
- items: generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPickerOptions, pluginInjectionApi),
145
- scrollable: pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar ? false : true,
146
- focusTrap: shouldEnableFocusTrap && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar),
147
- ...editLinkToolbarConfig(Boolean(pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar), isLinkPickerEnabled)
148
- };
149
- };
150
- };
151
- const unlinkCard = (node, state, editorAnalyticsApi) => {
152
- const displayInfo = displayInfoForCard(node, findCardInfo(state));
153
- const text = displayInfo.title || displayInfo.url;
154
- if (text) {
155
- return commandWithMetadata(changeSelectedCardToText(text, editorAnalyticsApi), {
156
- action: ACTION.UNLINK
157
- });
158
- }
159
- return () => false;
160
- };
161
- const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) => {
162
- return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
163
- };
164
- const withToolbarMetadata = command => commandWithMetadata(command, {
165
- inputMethod: INPUT_METHOD.FLOATING_TB
166
- });
167
- const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) => node => {
168
- var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2, _node$attrs2$datasour;
169
- const {
170
- url
171
- } = titleUrlPairFromNode(node);
172
- const {
173
- actions: editorAnalyticsApi
174
- } = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.analytics) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
175
- let metadata = {};
176
- if (url && !isSafeUrl(url)) {
177
- return [];
178
- } else {
179
- const {
180
- title
181
- } = displayInfoForCard(node, findCardInfo(state));
182
- metadata = {
183
- url: url,
184
- title: title
185
- };
186
- }
187
- const pluginState = pluginKey.getState(state);
188
- const currentAppearance = appearanceForNodeType(node.type);
189
- const {
190
- hoverDecoration
191
- } = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {};
192
- const isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
193
- const shouldRenderDatasourceToolbar = isDatasource &&
194
- // not showing toolbar in mobile for now since not sure what our plans are for it
195
- platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
196
-
197
- /* mobile builds toolbar natively using toolbarItems */
198
- if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
199
- return [buildEditLinkToolbar({
200
- providerFactory,
201
- linkPicker,
202
- node,
203
- featureFlags,
204
- pluginInjectionApi
205
- })];
206
- } else if (shouldRenderDatasourceToolbar) {
207
- return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
208
- } else {
209
- const {
210
- inlineCard
211
- } = state.schema.nodes;
212
- const toolbarItems = [{
213
- id: 'editor.link.edit',
214
- type: 'button',
215
- selected: false,
216
- metadata: metadata,
217
- title: intl.formatMessage(linkToolbarMessages.editLink),
218
- showTitle: true,
219
- testId: 'link-toolbar-edit-link-button',
220
- onClick: editLink(editorAnalyticsApi)
221
- }, {
222
- type: 'separator'
223
- }, {
224
- id: 'editor.link.openLink',
225
- type: 'button',
226
- icon: OpenIcon,
227
- metadata: metadata,
228
- className: 'hyperlink-open-link',
229
- title: intl.formatMessage(linkMessages.openLink),
230
- onClick: visitCardLink(editorAnalyticsApi)
231
- }, {
232
- type: 'separator'
233
- }, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
234
- type: 'copy-button',
235
- items: [{
236
- state,
237
- formatMessage: intl.formatMessage,
238
- nodeType: node.type
239
- }, {
240
- type: 'separator'
241
- }]
242
- }, ...getSettingsButtonGroup(state, featureFlags, intl, editorAnalyticsApi), {
243
- id: 'editor.link.delete',
244
- focusEditoronEnter: true,
245
- type: 'button',
246
- appearance: 'danger',
247
- icon: RemoveIcon,
248
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
249
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
250
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
251
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
252
- title: intl.formatMessage(commonMessages.remove),
253
- onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
254
- }];
255
- if (currentAppearance === 'embed') {
256
- var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
257
- const alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.analytics) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions, cardOptions);
258
- if (alignmentOptions.length) {
259
- alignmentOptions.push({
260
- type: 'separator'
261
- });
262
- }
263
- toolbarItems.unshift(...alignmentOptions);
264
- }
265
- const {
266
- allowBlockCards,
267
- allowEmbeds
268
- } = cardOptions;
269
-
270
- // This code will be executed only for appearances such as "inline", "block" & "embed"
271
- // For url appearance, please see HyperlinkToolbarAppearanceProps
272
- if (currentAppearance) {
273
- toolbarItems.unshift({
274
- type: 'custom',
275
- fallback: [],
276
- render: editorView => /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
277
- key: "link-appearance",
278
- url: url,
279
- intl: intl,
280
- currentAppearance: currentAppearance,
281
- editorView: editorView,
282
- editorState: state,
283
- allowEmbeds: allowEmbeds,
284
- allowBlockCards: allowBlockCards,
285
- platform: platform,
286
- editorAnalyticsApi: editorAnalyticsApi,
287
- cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions
288
- })
289
- }, {
290
- type: 'separator'
291
- });
292
- }
293
- return toolbarItems;
294
- }
295
- };
296
- const getUnlinkButtonGroup = (state, intl, node, inlineCard, editorAnalyticsApi) => {
297
- return node.type === inlineCard ? [{
298
- id: 'editor.link.unlink',
299
- focusEditoronEnter: true,
300
- type: 'button',
301
- title: intl.formatMessage(linkToolbarMessages.unlink),
302
- icon: UnlinkIcon,
303
- onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
304
- }, {
305
- type: 'separator'
306
- }] : [];
307
- };
308
- const getSettingsButtonGroup = (state, featureFlags, intl, editorAnalyticsApi) => {
309
- const {
310
- floatingToolbarLinkSettingsButton
311
- } = featureFlags;
312
- return floatingToolbarLinkSettingsButton === 'true' ? [{
313
- id: 'editor.link.settings',
314
- type: 'button',
315
- icon: CogIcon,
316
- title: intl.formatMessage(linkToolbarMessages.settingsLink),
317
- onClick: openLinkSettings(editorAnalyticsApi)
318
- }, {
319
- type: 'separator'
320
- }] : [];
321
- };
322
- const getDatasourceButtonGroup = (state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) => {
323
- var _node$attrs3;
324
- const toolbarItems = [{
325
- id: 'editor.edit.datasource',
326
- type: 'button',
327
- icon: SmallerEditIcon,
328
- metadata: metadata,
329
- className: 'datasource-edit',
330
- title: intl.formatMessage(linkToolbarMessages.editDatasource),
331
- onClick: editDatasource(node, editorAnalyticsApi)
332
- }];
333
- if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
334
- toolbarItems.push({
335
- type: 'separator'
336
- }, {
337
- id: 'editor.link.openLink',
338
- type: 'button',
339
- icon: OpenIcon,
340
- metadata: metadata,
341
- className: 'hyperlink-open-link',
342
- title: intl.formatMessage(linkMessages.openLink),
343
- onClick: visitCardLink(editorAnalyticsApi)
344
- });
345
- }
346
- toolbarItems.push({
347
- type: 'separator'
348
- }, {
349
- id: 'editor.link.delete',
350
- focusEditoronEnter: true,
351
- type: 'button',
352
- appearance: 'danger',
353
- icon: RemoveIcon,
354
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
355
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
356
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
357
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
358
- title: intl.formatMessage(commonMessages.remove),
359
- onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
360
- });
361
- return toolbarItems;
362
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
- import { DatasourceModal } from './index';
4
- const ModalWithState = ({
5
- api,
6
- editorView
7
- }) => {
8
- const {
9
- cardState
10
- } = useSharedPluginState(api, ['card']);
11
- if (!(cardState !== null && cardState !== void 0 && cardState.showDatasourceModal)) {
12
- return null;
13
- }
14
- return /*#__PURE__*/React.createElement(DatasourceModal, {
15
- view: editorView,
16
- modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
17
- });
18
- };
19
- export default ModalWithState;
@@ -1,48 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import { JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
3
- import { hideDatasourceModal } from '../../pm-plugins/actions';
4
- import { updateExistingDatasource, insertDatasource } from '../../pm-plugins/doc';
5
- import { NodeSelection } from 'prosemirror-state';
6
- export const DatasourceModal = ({
7
- view,
8
- modalType
9
- }) => {
10
- const {
11
- dispatch,
12
- state
13
- } = view;
14
- const {
15
- selection
16
- } = state;
17
- const existingNode = selection instanceof NodeSelection ? selection.node : undefined;
18
- const onClose = useCallback(() => {
19
- dispatch(hideDatasourceModal(state.tr));
20
- }, [dispatch, state.tr]);
21
- const onInsert = useCallback(newAdf => {
22
- if (existingNode) {
23
- updateExistingDatasource(state, existingNode, newAdf, view);
24
- } else {
25
- insertDatasource(state, newAdf, view);
26
- }
27
- }, [existingNode, state, view]);
28
- if (modalType === 'jira') {
29
- var _existingNode$attrs, _tableView$properties;
30
- const {
31
- id: datasourceId = JIRA_LIST_OF_LINKS_DATASOURCE_ID,
32
- parameters,
33
- views = []
34
- } = (existingNode === null || existingNode === void 0 ? void 0 : (_existingNode$attrs = existingNode.attrs) === null || _existingNode$attrs === void 0 ? void 0 : _existingNode$attrs.datasource) || {};
35
- const [tableView] = views;
36
- const visibleColumnKeys = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(column => column.key);
37
- return /*#__PURE__*/React.createElement("div", {
38
- "data-testid": "jira-config-modal"
39
- }, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
40
- datasourceId: datasourceId,
41
- visibleColumnKeys: visibleColumnKeys,
42
- parameters: parameters,
43
- onCancel: onClose,
44
- onInsert: onInsert
45
- }));
46
- }
47
- return null; // null for now until we have modal component that handles other datasources
48
- };
@@ -1,225 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
3
- import { withOuterListeners } from '@atlaskit/editor-common/ui';
4
- import { commandWithMetadata } from '@atlaskit/editor-common/card';
5
- import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
6
- import { showLinkToolbar, hideLinkToolbar, showDatasourceModal } from '../pm-plugins/actions';
7
- import { INPUT_METHOD, ACTION, buildEditLinkPayload } from '@atlaskit/editor-common/analytics';
8
- import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
9
- import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
10
- import { findCardInfo, displayInfoForCard } from '../utils';
11
- import { NodeSelection } from 'prosemirror-state';
12
- import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
13
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
14
- import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
15
- const HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkAddToolbarWithState);
16
- export function HyperlinkAddToolbarWithState({
17
- linkPickerOptions = {},
18
- onSubmit,
19
- displayText,
20
- displayUrl,
21
- providerFactory,
22
- view,
23
- onCancel,
24
- invokeMethod,
25
- featureFlags,
26
- onClose,
27
- onEscapeCallback,
28
- onClickAwayCallback,
29
- pluginInjectionApi
30
- }) {
31
- const {
32
- hyperlinkState
33
- } = useSharedPluginState(pluginInjectionApi, ['hyperlink']);
34
- return /*#__PURE__*/React.createElement(HyperlinkToolbar, {
35
- linkPickerOptions: linkPickerOptions,
36
- onSubmit: onSubmit,
37
- displayText: displayText,
38
- displayUrl: displayUrl,
39
- providerFactory: providerFactory,
40
- view: view,
41
- onCancel: onCancel,
42
- invokeMethod: invokeMethod,
43
- featureFlags: featureFlags,
44
- onClose: onClose,
45
- onEscapeCallback: onEscapeCallback,
46
- onClickAwayCallback: onClickAwayCallback,
47
- hyperlinkPluginState: hyperlinkState
48
- });
49
- }
50
- export class EditLinkToolbar extends React.Component {
51
- constructor(...args) {
52
- super(...args);
53
- /** Focus should move to the 'Edit link' button when the toolbar closes
54
- * and not close the floating toolbar.
55
- */
56
- _defineProperty(this, "handleEsc", e => {
57
- var _this$props$forceFocu, _this$props;
58
- (_this$props$forceFocu = (_this$props = this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, `[aria-label="${linkToolbarMessages.editLink.defaultMessage}"]`, this.props.view);
59
- });
60
- }
61
- componentDidUpdate(prevProps) {
62
- if (prevProps.node !== this.props.node) {
63
- this.hideLinkToolbar();
64
- }
65
- }
66
- componentWillUnmount() {
67
- this.hideLinkToolbar();
68
- }
69
- hideLinkToolbar() {
70
- const {
71
- view
72
- } = this.props;
73
- view.dispatch(hideLinkToolbar(view.state.tr));
74
- }
75
- render() {
76
- const {
77
- linkPickerOptions,
78
- providerFactory,
79
- url,
80
- text,
81
- view,
82
- featureFlags,
83
- onSubmit,
84
- pluginInjectionApi
85
- } = this.props;
86
- return /*#__PURE__*/React.createElement(HyperLinkToolbarWithListeners, {
87
- pluginInjectionApi: pluginInjectionApi,
88
- view: view,
89
- linkPickerOptions: linkPickerOptions,
90
- providerFactory: providerFactory,
91
- displayUrl: url,
92
- displayText: text,
93
- handleEscapeKeydown: this.handleEsc
94
- // Assumes that the smart card link picker can only ever be invoked by clicking "edit"
95
- // via the floating toolbar
96
- ,
97
- invokeMethod: INPUT_METHOD.FLOATING_TB,
98
- featureFlags: featureFlags,
99
- onSubmit: (href, title, displayText, inputMethod, analytic) => {
100
- this.hideLinkToolbar();
101
- if (onSubmit) {
102
- onSubmit(href, displayText || title, inputMethod, analytic);
103
- }
104
- },
105
- onEscapeCallback: (state, dispatch) => {
106
- const {
107
- tr
108
- } = state;
109
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.hyperlink.actions.hideLinkToolbar(tr);
110
- hideLinkToolbar(tr);
111
- if (dispatch) {
112
- dispatch(tr);
113
- return true;
114
- }
115
- return false;
116
- },
117
- onClickAwayCallback: (state, dispatch) => {
118
- const {
119
- tr
120
- } = state;
121
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.hyperlink.actions.hideLinkToolbar(tr);
122
- if (dispatch) {
123
- dispatch(tr);
124
- return true;
125
- }
126
- return false;
127
- }
128
- });
129
- }
130
- }
131
- export const editLink = editorAnalyticsApi => (state, dispatch) => {
132
- let type = 'hyperlink';
133
- if (state.selection instanceof NodeSelection) {
134
- type = state.selection.node.type.name;
135
- }
136
- if (dispatch) {
137
- const {
138
- tr
139
- } = state;
140
- showLinkToolbar(tr);
141
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildEditLinkPayload(type))(tr);
142
- dispatch(tr);
143
- return true;
144
- }
145
- return false;
146
- };
147
- export const buildEditLinkToolbar = ({
148
- providerFactory,
149
- node,
150
- linkPicker,
151
- featureFlags,
152
- pluginInjectionApi
153
- }) => {
154
- return {
155
- type: 'custom',
156
- disableArrowNavigation: true,
157
- fallback: [],
158
- render: (view, idx) => {
159
- var _pluginInjectionApi$d;
160
- if (!view || !providerFactory) {
161
- return null;
162
- }
163
- const displayInfo = displayInfoForCard(node, findCardInfo(view.state));
164
- return /*#__PURE__*/React.createElement(EditLinkToolbar, {
165
- pluginInjectionApi: pluginInjectionApi,
166
- key: idx,
167
- view: view,
168
- linkPickerOptions: linkPicker,
169
- providerFactory: providerFactory,
170
- url: displayInfo.url,
171
- text: displayInfo.title || '',
172
- node: node,
173
- featureFlags: featureFlags,
174
- forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector,
175
- onSubmit: (newHref, newText, inputMethod, analytic) => {
176
- const urlChanged = newHref !== displayInfo.url;
177
- const titleChanged = newText !== displayInfo.title;
178
-
179
- // If the title is changed in a smartlink, convert to standard blue hyperlink
180
- // (even if the url was also changed) - we don't want to lose the custom title.
181
- if (titleChanged) {
182
- var _pluginInjectionApi$d2;
183
- return commandWithMetadata(changeSelectedCardToLink(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions), {
184
- action: ACTION.UPDATED,
185
- inputMethod,
186
- sourceEvent: analytic
187
- })(view.state, view.dispatch);
188
- }
189
- if (urlChanged) {
190
- // If *only* the url is changed in a smart link, reresolve
191
- return updateCard(newHref, analytic)(view.state, view.dispatch);
192
- }
193
- }
194
- });
195
- }
196
- };
197
- };
198
- export const editLinkToolbarConfig = (showLinkingToolbar, lpLinkPicker) => {
199
- return showLinkingToolbar ? {
200
- height: lpLinkPicker ? LINKPICKER_HEIGHT_IN_PX : RECENT_SEARCH_HEIGHT_IN_PX,
201
- width: RECENT_SEARCH_WIDTH_IN_PX,
202
- forcePlacement: true
203
- } : {};
204
- };
205
- export const editDatasource = (node, editorAnalyticsApi) => (state, dispatch) => {
206
- var _node$attrs;
207
- const modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
208
- if (dispatch && modalType) {
209
- const {
210
- tr
211
- } = state;
212
- showDatasourceModal(modalType)(tr);
213
- // editorAnalyticsApi?.attachAnalyticsEvent(
214
- // buildEditLinkPayload(
215
- // type as
216
- // | ACTION_SUBJECT_ID.CARD_INLINE
217
- // | ACTION_SUBJECT_ID.CARD_BLOCK
218
- // | ACTION_SUBJECT_ID.EMBEDS,
219
- // ),
220
- // )(tr);
221
- dispatch(tr);
222
- return true;
223
- }
224
- return false;
225
- };
@@ -1,15 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { registerSmartCardEvents } from '../pm-plugins/actions';
3
- import { useSmartLinkEvents } from '@atlaskit/smart-card';
4
- export const EditorSmartCardEvents = ({
5
- editorView
6
- }) => {
7
- const events = useSmartLinkEvents();
8
- useEffect(() => {
9
- if (!events) {
10
- return;
11
- }
12
- editorView.dispatch(registerSmartCardEvents(events)(editorView.state.tr));
13
- }, [events, editorView]);
14
- return null;
15
- };