@atlaskit/editor-core 185.16.3 → 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 (358) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +8 -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/version-wrapper.js +1 -1
  36. package/dist/cjs/version.json +1 -1
  37. package/dist/es2019/i18n/cs.js +0 -35
  38. package/dist/es2019/i18n/da.js +0 -35
  39. package/dist/es2019/i18n/de.js +0 -35
  40. package/dist/es2019/i18n/en.js +0 -35
  41. package/dist/es2019/i18n/en_GB.js +0 -35
  42. package/dist/es2019/i18n/en_ZZ.js +0 -35
  43. package/dist/es2019/i18n/es.js +1 -35
  44. package/dist/es2019/i18n/fi.js +0 -35
  45. package/dist/es2019/i18n/fr.js +1 -35
  46. package/dist/es2019/i18n/hu.js +1 -35
  47. package/dist/es2019/i18n/it.js +1 -35
  48. package/dist/es2019/i18n/ja.js +1 -35
  49. package/dist/es2019/i18n/ko.js +0 -35
  50. package/dist/es2019/i18n/nb.js +1 -35
  51. package/dist/es2019/i18n/nl.js +1 -35
  52. package/dist/es2019/i18n/pl.js +1 -35
  53. package/dist/es2019/i18n/pt_BR.js +1 -35
  54. package/dist/es2019/i18n/ru.js +1 -35
  55. package/dist/es2019/i18n/sv.js +0 -35
  56. package/dist/es2019/i18n/th.js +0 -35
  57. package/dist/es2019/i18n/tr.js +1 -35
  58. package/dist/es2019/i18n/uk.js +1 -35
  59. package/dist/es2019/i18n/vi.js +0 -35
  60. package/dist/es2019/i18n/zh.js +1 -35
  61. package/dist/es2019/i18n/zh_TW.js +1 -35
  62. package/dist/es2019/labs/next/presets/mobile.js +1 -1
  63. package/dist/es2019/labs/next/presets/universal.js +1 -1
  64. package/dist/es2019/plugins/deprecated-card/doc.js +97 -0
  65. package/dist/es2019/plugins/deprecated-hyperlink/commands.js +1 -1
  66. package/dist/es2019/plugins/index.js +0 -1
  67. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -14
  68. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +13 -0
  69. package/dist/es2019/version-wrapper.js +1 -1
  70. package/dist/es2019/version.json +1 -1
  71. package/dist/esm/i18n/cs.js +0 -35
  72. package/dist/esm/i18n/da.js +0 -35
  73. package/dist/esm/i18n/de.js +0 -35
  74. package/dist/esm/i18n/en.js +0 -35
  75. package/dist/esm/i18n/en_GB.js +0 -35
  76. package/dist/esm/i18n/en_ZZ.js +0 -35
  77. package/dist/esm/i18n/es.js +1 -35
  78. package/dist/esm/i18n/fi.js +0 -35
  79. package/dist/esm/i18n/fr.js +1 -35
  80. package/dist/esm/i18n/hu.js +1 -35
  81. package/dist/esm/i18n/it.js +1 -35
  82. package/dist/esm/i18n/ja.js +1 -35
  83. package/dist/esm/i18n/ko.js +0 -35
  84. package/dist/esm/i18n/nb.js +1 -35
  85. package/dist/esm/i18n/nl.js +1 -35
  86. package/dist/esm/i18n/pl.js +1 -35
  87. package/dist/esm/i18n/pt_BR.js +1 -35
  88. package/dist/esm/i18n/ru.js +1 -35
  89. package/dist/esm/i18n/sv.js +0 -35
  90. package/dist/esm/i18n/th.js +0 -35
  91. package/dist/esm/i18n/tr.js +1 -35
  92. package/dist/esm/i18n/uk.js +1 -35
  93. package/dist/esm/i18n/vi.js +0 -35
  94. package/dist/esm/i18n/zh.js +1 -35
  95. package/dist/esm/i18n/zh_TW.js +1 -35
  96. package/dist/esm/labs/next/presets/mobile.js +1 -1
  97. package/dist/esm/labs/next/presets/universal.js +1 -1
  98. package/dist/esm/plugins/deprecated-card/doc.js +105 -0
  99. package/dist/esm/plugins/deprecated-hyperlink/commands.js +1 -1
  100. package/dist/esm/plugins/index.js +0 -1
  101. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +14 -25
  102. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  103. package/dist/esm/version-wrapper.js +1 -1
  104. package/dist/esm/version.json +1 -1
  105. package/dist/types/i18n/cs.d.ts +0 -35
  106. package/dist/types/i18n/da.d.ts +0 -35
  107. package/dist/types/i18n/de.d.ts +0 -35
  108. package/dist/types/i18n/en.d.ts +0 -35
  109. package/dist/types/i18n/en_GB.d.ts +0 -35
  110. package/dist/types/i18n/en_ZZ.d.ts +0 -35
  111. package/dist/types/i18n/es.d.ts +1 -35
  112. package/dist/types/i18n/fi.d.ts +0 -35
  113. package/dist/types/i18n/fr.d.ts +1 -35
  114. package/dist/types/i18n/hu.d.ts +1 -35
  115. package/dist/types/i18n/it.d.ts +1 -35
  116. package/dist/types/i18n/ja.d.ts +1 -35
  117. package/dist/types/i18n/ko.d.ts +0 -35
  118. package/dist/types/i18n/nb.d.ts +1 -35
  119. package/dist/types/i18n/nl.d.ts +1 -35
  120. package/dist/types/i18n/pl.d.ts +1 -35
  121. package/dist/types/i18n/pt_BR.d.ts +1 -35
  122. package/dist/types/i18n/ru.d.ts +1 -35
  123. package/dist/types/i18n/sv.d.ts +0 -35
  124. package/dist/types/i18n/th.d.ts +0 -35
  125. package/dist/types/i18n/tr.d.ts +1 -35
  126. package/dist/types/i18n/uk.d.ts +1 -35
  127. package/dist/types/i18n/vi.d.ts +0 -35
  128. package/dist/types/i18n/zh.d.ts +1 -35
  129. package/dist/types/i18n/zh_TW.d.ts +1 -35
  130. package/dist/types/plugins/deprecated-card/doc.d.ts +20 -0
  131. package/dist/types/plugins/index.d.ts +0 -1
  132. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  133. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  134. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  135. package/dist/types/plugins/paste/index.d.ts +1 -1
  136. package/dist/types-ts4.5/i18n/cs.d.ts +0 -35
  137. package/dist/types-ts4.5/i18n/da.d.ts +0 -35
  138. package/dist/types-ts4.5/i18n/de.d.ts +0 -35
  139. package/dist/types-ts4.5/i18n/en.d.ts +0 -35
  140. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -35
  141. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -35
  142. package/dist/types-ts4.5/i18n/es.d.ts +1 -35
  143. package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
  144. package/dist/types-ts4.5/i18n/fr.d.ts +1 -35
  145. package/dist/types-ts4.5/i18n/hu.d.ts +1 -35
  146. package/dist/types-ts4.5/i18n/it.d.ts +1 -35
  147. package/dist/types-ts4.5/i18n/ja.d.ts +1 -35
  148. package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
  149. package/dist/types-ts4.5/i18n/nb.d.ts +1 -35
  150. package/dist/types-ts4.5/i18n/nl.d.ts +1 -35
  151. package/dist/types-ts4.5/i18n/pl.d.ts +1 -35
  152. package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -35
  153. package/dist/types-ts4.5/i18n/ru.d.ts +1 -35
  154. package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
  155. package/dist/types-ts4.5/i18n/th.d.ts +0 -35
  156. package/dist/types-ts4.5/i18n/tr.d.ts +1 -35
  157. package/dist/types-ts4.5/i18n/uk.d.ts +1 -35
  158. package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
  159. package/dist/types-ts4.5/i18n/zh.d.ts +1 -35
  160. package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -35
  161. package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +20 -0
  162. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  163. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  164. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  165. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  166. package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
  167. package/package.json +6 -5
  168. package/tmp/api-report-tmp.d.ts +2307 -0
  169. package/dist/cjs/plugins/card/index.js +0 -139
  170. package/dist/cjs/plugins/card/messages.js +0 -20
  171. package/dist/cjs/plugins/card/nodeviews/blockCard.js +0 -163
  172. package/dist/cjs/plugins/card/nodeviews/datasource.js +0 -172
  173. package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -396
  174. package/dist/cjs/plugins/card/nodeviews/genericCard.js +0 -118
  175. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +0 -131
  176. package/dist/cjs/plugins/card/pm-plugins/actions.js +0 -122
  177. package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -48
  178. package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -353
  179. package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +0 -19
  180. package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +0 -5
  181. package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +0 -178
  182. package/dist/cjs/plugins/card/pm-plugins/doc.js +0 -478
  183. package/dist/cjs/plugins/card/pm-plugins/keymap.js +0 -64
  184. package/dist/cjs/plugins/card/pm-plugins/main.js +0 -212
  185. package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +0 -47
  186. package/dist/cjs/plugins/card/pm-plugins/plugin-key.js +0 -9
  187. package/dist/cjs/plugins/card/pm-plugins/reducers.js +0 -111
  188. package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +0 -35
  189. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +0 -58
  190. package/dist/cjs/plugins/card/pm-plugins/util/state.js +0 -49
  191. package/dist/cjs/plugins/card/toolbar.js +0 -364
  192. package/dist/cjs/plugins/card/types.js +0 -5
  193. package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -25
  194. package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +0 -60
  195. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +0 -256
  196. package/dist/cjs/plugins/card/ui/EditorSmartCardEvents.js +0 -21
  197. package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +0 -213
  198. package/dist/cjs/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -173
  199. package/dist/cjs/plugins/card/ui/LayoutButton/index.js +0 -113
  200. package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +0 -17
  201. package/dist/cjs/plugins/card/ui/LayoutButton/types.js +0 -5
  202. package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +0 -19
  203. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +0 -151
  204. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +0 -360
  205. package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +0 -20
  206. package/dist/cjs/plugins/card/utils.js +0 -60
  207. package/dist/es2019/plugins/card/index.js +0 -131
  208. package/dist/es2019/plugins/card/messages.js +0 -13
  209. package/dist/es2019/plugins/card/nodeviews/blockCard.js +0 -130
  210. package/dist/es2019/plugins/card/nodeviews/datasource.js +0 -136
  211. package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -368
  212. package/dist/es2019/plugins/card/nodeviews/genericCard.js +0 -92
  213. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +0 -112
  214. package/dist/es2019/plugins/card/pm-plugins/actions.js +0 -57
  215. package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -38
  216. package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -333
  217. package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +0 -2
  218. package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +0 -1
  219. package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +0 -160
  220. package/dist/es2019/plugins/card/pm-plugins/doc.js +0 -451
  221. package/dist/es2019/plugins/card/pm-plugins/keymap.js +0 -59
  222. package/dist/es2019/plugins/card/pm-plugins/main.js +0 -208
  223. package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +0 -37
  224. package/dist/es2019/plugins/card/pm-plugins/plugin-key.js +0 -2
  225. package/dist/es2019/plugins/card/pm-plugins/reducers.js +0 -110
  226. package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +0 -25
  227. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +0 -48
  228. package/dist/es2019/plugins/card/pm-plugins/util/state.js +0 -26
  229. package/dist/es2019/plugins/card/toolbar.js +0 -362
  230. package/dist/es2019/plugins/card/types.js +0 -1
  231. package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -19
  232. package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +0 -48
  233. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +0 -225
  234. package/dist/es2019/plugins/card/ui/EditorSmartCardEvents.js +0 -15
  235. package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +0 -198
  236. package/dist/es2019/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -86
  237. package/dist/es2019/plugins/card/ui/LayoutButton/index.js +0 -106
  238. package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +0 -10
  239. package/dist/es2019/plugins/card/ui/LayoutButton/types.js +0 -1
  240. package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +0 -15
  241. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +0 -117
  242. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +0 -332
  243. package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +0 -11
  244. package/dist/es2019/plugins/card/utils.js +0 -46
  245. package/dist/esm/plugins/card/index.js +0 -132
  246. package/dist/esm/plugins/card/messages.js +0 -13
  247. package/dist/esm/plugins/card/nodeviews/blockCard.js +0 -155
  248. package/dist/esm/plugins/card/nodeviews/datasource.js +0 -164
  249. package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -387
  250. package/dist/esm/plugins/card/nodeviews/genericCard.js +0 -111
  251. package/dist/esm/plugins/card/nodeviews/inlineCard.js +0 -123
  252. package/dist/esm/plugins/card/pm-plugins/actions.js +0 -102
  253. package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -41
  254. package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -344
  255. package/dist/esm/plugins/card/pm-plugins/analytics/index.js +0 -2
  256. package/dist/esm/plugins/card/pm-plugins/analytics/types.js +0 -1
  257. package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +0 -160
  258. package/dist/esm/plugins/card/pm-plugins/doc.js +0 -460
  259. package/dist/esm/plugins/card/pm-plugins/keymap.js +0 -58
  260. package/dist/esm/plugins/card/pm-plugins/main.js +0 -199
  261. package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +0 -39
  262. package/dist/esm/plugins/card/pm-plugins/plugin-key.js +0 -2
  263. package/dist/esm/plugins/card/pm-plugins/reducers.js +0 -103
  264. package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +0 -29
  265. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +0 -50
  266. package/dist/esm/plugins/card/pm-plugins/util/state.js +0 -40
  267. package/dist/esm/plugins/card/toolbar.js +0 -353
  268. package/dist/esm/plugins/card/types.js +0 -1
  269. package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -17
  270. package/dist/esm/plugins/card/ui/DatasourceModal/index.js +0 -49
  271. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +0 -243
  272. package/dist/esm/plugins/card/ui/EditorSmartCardEvents.js +0 -14
  273. package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +0 -202
  274. package/dist/esm/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -163
  275. package/dist/esm/plugins/card/ui/LayoutButton/index.js +0 -102
  276. package/dist/esm/plugins/card/ui/LayoutButton/styled.js +0 -10
  277. package/dist/esm/plugins/card/ui/LayoutButton/types.js +0 -1
  278. package/dist/esm/plugins/card/ui/LayoutButton/utils.js +0 -12
  279. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +0 -140
  280. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +0 -355
  281. package/dist/esm/plugins/card/ui/SmallerEditIcon.js +0 -11
  282. package/dist/esm/plugins/card/utils.js +0 -48
  283. package/dist/types/plugins/card/index.d.ts +0 -26
  284. package/dist/types/plugins/card/messages.d.ts +0 -12
  285. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +0 -26
  286. package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -42
  287. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -46
  288. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -37
  289. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  290. package/dist/types/plugins/card/pm-plugins/actions.d.ts +0 -23
  291. package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  292. package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  293. package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  294. package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  295. package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  296. package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -23
  297. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +0 -3
  298. package/dist/types/plugins/card/pm-plugins/main.d.ts +0 -6
  299. package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  300. package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  301. package/dist/types/plugins/card/pm-plugins/reducers.d.ts +0 -3
  302. package/dist/types/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  303. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  304. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -31
  305. package/dist/types/plugins/card/toolbar.d.ts +0 -12
  306. package/dist/types/plugins/card/types.d.ts +0 -165
  307. package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  308. package/dist/types/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  309. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  310. package/dist/types/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  311. package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  312. package/dist/types/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  313. package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  314. package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  315. package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  316. package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  317. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  318. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  319. package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  320. package/dist/types/plugins/card/utils.d.ts +0 -19
  321. package/dist/types-ts4.5/plugins/card/index.d.ts +0 -26
  322. package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -12
  323. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +0 -26
  324. package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -42
  325. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +0 -46
  326. package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +0 -37
  327. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  328. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +0 -23
  329. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  330. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  331. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  332. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  333. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  334. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +0 -23
  335. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +0 -3
  336. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +0 -6
  337. package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  338. package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  339. package/dist/types-ts4.5/plugins/card/pm-plugins/reducers.d.ts +0 -3
  340. package/dist/types-ts4.5/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  341. package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  342. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -31
  343. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +0 -12
  344. package/dist/types-ts4.5/plugins/card/types.d.ts +0 -165
  345. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  346. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  347. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  348. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  349. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  350. package/dist/types-ts4.5/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  351. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  352. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  353. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  354. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  355. package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  356. package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  357. package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  358. package/dist/types-ts4.5/plugins/card/utils.d.ts +0 -19
@@ -1,160 +0,0 @@
1
- import { isLinkMark } from '@atlaskit/editor-common/utils';
2
- import { appearanceForNodeType } from '../../utils';
3
- /**
4
- * Whether a node is a "link" node, ie inline card, block card, embed card
5
- * (but not a text node with a link mark)
6
- */
7
- export function isLinkNode(node) {
8
- return !!appearanceForNodeType(node.type);
9
- }
10
-
11
- /**
12
- * Analytics appearance for link object
13
- */
14
- export function appearanceForLink(link) {
15
- if (link.type === 'node') {
16
- var appearance = appearanceForNodeType(link.node.type);
17
- if (appearance) {
18
- return appearance;
19
- }
20
- }
21
- return 'url';
22
- }
23
- var nodeHasLinkMark = function nodeHasLinkMark(schema, node) {
24
- if (node.marks) {
25
- for (var i = 0; i < node.marks.length; i++) {
26
- var mark = node.marks[i];
27
- if (isLinkMark(mark, schema)) {
28
- return true;
29
- }
30
- }
31
- }
32
- return false;
33
- };
34
-
35
- /**
36
- * Determine if a node is considered to be a link
37
- */
38
- export var isLink = function isLink(schema, node) {
39
- if (isLinkNode(node)) {
40
- return true;
41
- }
42
- return nodeHasLinkMark(schema, node);
43
- };
44
-
45
- /**
46
- * Given a node, find all nodes and marks that are considered "links"
47
- * @param state EditorState
48
- * @param fragment Fragment to search
49
- * @returns Array of nodes and marks found in the fragment that are "links"
50
- */
51
- export function findLinksInNode(doc, schema, node, offset) {
52
- var links = [];
53
- node.descendants(function (node, pos) {
54
- var nodeContext = getLinkNodeContext(doc, pos);
55
-
56
- // Nodes
57
- if (isLinkNode(node)) {
58
- links.push({
59
- type: 'node',
60
- pos: pos + offset,
61
- node: node,
62
- nodeContext: nodeContext
63
- });
64
- }
65
-
66
- // Marks
67
- if (node.marks) {
68
- for (var i = 0; i < node.marks.length; i++) {
69
- var mark = node.marks[i];
70
- if (isLinkMark(mark, schema)) {
71
- links.push({
72
- type: 'mark',
73
- pos: pos + offset,
74
- mark: mark,
75
- nodeContext: nodeContext
76
- });
77
- }
78
- }
79
- }
80
- });
81
- return links;
82
- }
83
- export function getLinkUrl(link) {
84
- var _link$mark$attrs;
85
- if (link.type === 'node') {
86
- var _link$node$attrs;
87
- return (_link$node$attrs = link.node.attrs) === null || _link$node$attrs === void 0 ? void 0 : _link$node$attrs.url;
88
- }
89
- return (_link$mark$attrs = link.mark.attrs) === null || _link$mark$attrs === void 0 ? void 0 : _link$mark$attrs.href;
90
- }
91
- export var getLinkNodeContext = function getLinkNodeContext(doc, pos) {
92
- var $pos = doc.resolve(pos);
93
- var maxDepth = 3;
94
- for (var i = 0; i <= maxDepth; i++) {
95
- var node = $pos.node($pos.depth - i);
96
- if (node && node.type.name !== 'paragraph') {
97
- return node.type.name;
98
- }
99
- }
100
- return 'unknown';
101
- };
102
- export var linkObjectFromNode = function linkObjectFromNode(doc, schema, node, pos) {
103
- var nodeContext = getLinkNodeContext(doc, pos);
104
- if (isLinkNode(node)) {
105
- return {
106
- type: 'node',
107
- pos: pos,
108
- node: node,
109
- nodeContext: nodeContext
110
- };
111
- }
112
- if (node.marks) {
113
- for (var i = 0; i < node.marks.length; i++) {
114
- var mark = node.marks[i];
115
- if (isLinkMark(mark, schema)) {
116
- return {
117
- type: 'mark',
118
- pos: pos,
119
- mark: mark,
120
- nodeContext: nodeContext
121
- };
122
- }
123
- }
124
- }
125
- };
126
- export var findLinksAtPositions = function findLinksAtPositions(tr, positions) {
127
- var schema = tr.doc.type.schema;
128
- var links = [];
129
- for (var i = 0; i < positions.length; i++) {
130
- var pos = positions[i];
131
- var node = tr.doc.nodeAt(pos);
132
- if (!node) {
133
- continue;
134
- }
135
- var link = linkObjectFromNode(tr.doc, schema, node, pos);
136
- if (!link) {
137
- continue;
138
- }
139
- links.push(link);
140
- }
141
- return links;
142
- };
143
-
144
- /**
145
- * Returns whether or not two sets of links appear to likely be the same set of links
146
- * That they are in the same order and that both their hrefs and appearances match
147
- */
148
- export var areSameLinks = function areSameLinks(linksA, linksB) {
149
- if (linksA.length !== linksB.length) {
150
- return false;
151
- }
152
- for (var i = 0; i < linksA.length; i++) {
153
- var linkA = linksA[i];
154
- var linkB = linksB[i];
155
- if (getLinkUrl(linkA) !== getLinkUrl(linkB) || appearanceForLink(linkA) !== appearanceForLink(linkB)) {
156
- return false;
157
- }
158
- }
159
- return true;
160
- };
@@ -1,460 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- 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; }
4
- 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; }
5
- import isEqual from 'lodash/isEqual';
6
- import { NodeSelection, TextSelection } from 'prosemirror-state';
7
- import { closeHistory } from 'prosemirror-history';
8
- import { isSafeUrl } from '@atlaskit/adf-schema';
9
- import { addLinkMetadata } from '@atlaskit/editor-common/card';
10
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
11
- import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
12
- import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
13
- import { appearanceForNodeType, selectedCardAppearance } from '../utils';
14
- import { queueCards, resolveCard, hideDatasourceModal } from './actions';
15
- import { pluginKey } from './plugin-key';
16
- import { shouldReplaceLink } from './shouldReplaceLink';
17
- /**
18
- * Attempt to replace the link into the respective card.
19
- */
20
- function replaceLinksToCards(tr, cardAdf, schema, request) {
21
- var inlineCard = schema.nodes.inlineCard;
22
- var url = request.url;
23
- if (!isSafeUrl(url)) {
24
- return;
25
- }
26
-
27
- // replace all the outstanding links with their cards
28
- var pos = tr.mapping.map(request.pos);
29
- var $pos = tr.doc.resolve(pos);
30
- var node = tr.doc.nodeAt(pos);
31
- if (!node || !node.type.isText) {
32
- return;
33
- }
34
- var replaceLink = request.shouldReplaceLink || shouldReplaceLink(node, request.compareLinkText, url);
35
- if (!replaceLink) {
36
- return;
37
- }
38
-
39
- // ED-5638: add an extra space after inline cards to avoid re-rendering them
40
- var nodes = [cardAdf];
41
- if (cardAdf.type === inlineCard) {
42
- nodes.push(schema.text(' '));
43
- }
44
- tr.replaceWith(pos, pos + (node.text || url).length, nodes);
45
- return $pos.node($pos.depth - 1).type.name;
46
- }
47
- export var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
48
- return function (editorState, dispatch) {
49
- var state = pluginKey.getState(editorState);
50
- if (!state) {
51
- return false;
52
- }
53
-
54
- // find the requests for this URL
55
- var requests = state.requests.filter(function (req) {
56
- return req.url === url;
57
- });
58
-
59
- // try to transform response to ADF
60
- var schema = editorState.schema;
61
- var cardAdf = processRawValue(schema, cardData);
62
- var tr = editorState.tr;
63
- if (cardAdf) {
64
- // Should prevent any other node than cards? [inlineCard, blockCard].includes(cardAdf.type)
65
- var nodeContexts = requests.map(function (request) {
66
- return replaceLinksToCards(tr, cardAdf, schema, request);
67
- }).filter(function (context) {
68
- return !!context;
69
- }); // context exist
70
-
71
- // Send analytics information
72
- if (nodeContexts.length) {
73
- var nodeContext = nodeContexts.every(function (context) {
74
- return context === nodeContexts[0];
75
- }) ? nodeContexts[0] : 'mixed';
76
-
77
- /** For block links v1, default to inline links */
78
- var nodeType = 'inlineCard';
79
- var _url$split = url.split('/'),
80
- _url$split2 = _slicedToArray(_url$split, 3),
81
- domainName = _url$split2[2];
82
- if (state.smartLinkEvents) {
83
- state.smartLinkEvents.insertSmartLink(domainName, 'inline', createAnalyticsEvent);
84
- }
85
-
86
- /**
87
- * TODO:
88
- * What if each request has a different source?
89
- * Unlikely, but need to define behaviour.
90
- * Ignore analytics event? take first? provide 'mixed' as well?
91
- */
92
- var inputMethod = requests[0].source;
93
- var sourceEvent = requests[0].sourceEvent;
94
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
95
- action: analyticsAction || ACTION.INSERTED,
96
- actionSubject: ACTION_SUBJECT.DOCUMENT,
97
- actionSubjectId: ACTION_SUBJECT_ID.SMART_LINK,
98
- eventType: EVENT_TYPE.TRACK,
99
- attributes: {
100
- inputMethod: inputMethod,
101
- nodeType: nodeType,
102
- nodeContext: nodeContext,
103
- fromCurrentDomain: isFromCurrentDomain(url)
104
- },
105
- nonPrivacySafeAttributes: {
106
- domainName: domainName
107
- }
108
- })(tr);
109
- addLinkMetadata(editorState.selection, tr, {
110
- action: analyticsAction,
111
- inputMethod: inputMethod,
112
- cardAction: 'RESOLVE',
113
- sourceEvent: sourceEvent
114
- });
115
- }
116
- }
117
- if (dispatch) {
118
- dispatch(resolveCard(url)(closeHistory(tr)));
119
- }
120
- return true;
121
- };
122
- };
123
- export var handleFallbackWithAnalytics = function handleFallbackWithAnalytics(request, editorAnalyticsApi) {
124
- return function (state, dispatch) {
125
- var cardState = pluginKey.getState(state);
126
- if (!cardState) {
127
- return false;
128
- }
129
- var tr = state.tr;
130
- if (request.source !== INPUT_METHOD.FLOATING_TB) {
131
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(request.source, request.url))(tr);
132
- }
133
- addLinkMetadata(state.selection, tr, {
134
- action: request.analyticsAction,
135
- inputMethod: request.source
136
- });
137
- if (dispatch) {
138
- dispatch(resolveCard(request.url)(tr));
139
- }
140
- return true;
141
- };
142
- };
143
- export var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source, analyticsAction) {
144
- var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
145
- var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
146
- var schema = state.schema;
147
- var link = schema.marks.link;
148
- var requests = [];
149
- nodesBetweenChanged(tr, function (node, pos) {
150
- if (!node.isText) {
151
- return true;
152
- }
153
- var linkMark = node.marks.find(function (mark) {
154
- return mark.type === link;
155
- });
156
- if (linkMark) {
157
- if (!shouldReplaceLink(node, normalizeLinkText)) {
158
- return false;
159
- }
160
- requests.push({
161
- url: linkMark.attrs.href,
162
- pos: pos,
163
- appearance: 'inline',
164
- compareLinkText: normalizeLinkText,
165
- source: source,
166
- analyticsAction: analyticsAction,
167
- sourceEvent: sourceEvent
168
- });
169
- }
170
- return false;
171
- });
172
- if (analyticsAction) {
173
- addLinkMetadata(state.selection, tr, {
174
- action: analyticsAction
175
- });
176
- }
177
- return queueCards(requests)(tr);
178
- };
179
- export var queueCardFromChangedTr = function queueCardFromChangedTr(state, tr, source, analyticsAction) {
180
- var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
181
- var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
182
- var previousAppearance = arguments.length > 6 ? arguments[6] : undefined;
183
- var schema = state.schema;
184
- var link = schema.marks.link;
185
- var requests = [];
186
- nodesBetweenChanged(tr, function (node, pos) {
187
- if (!node.isText) {
188
- return true;
189
- }
190
- var linkMark = node.marks.find(function (mark) {
191
- return mark.type === link;
192
- });
193
- if (linkMark) {
194
- if (!shouldReplaceLink(node, normalizeLinkText)) {
195
- return false;
196
- }
197
- requests.push({
198
- url: linkMark.attrs.href,
199
- pos: pos,
200
- appearance: 'inline',
201
- previousAppearance: previousAppearance,
202
- compareLinkText: normalizeLinkText,
203
- source: source,
204
- analyticsAction: analyticsAction,
205
- sourceEvent: sourceEvent
206
- });
207
- }
208
- return false;
209
- });
210
- addLinkMetadata(state.selection, tr, {
211
- action: analyticsAction
212
- });
213
- return queueCards(requests)(tr);
214
- };
215
- export var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(state, source, appearance) {
216
- var normalizeLinkText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
217
- var schema = state.schema;
218
- var link = schema.marks.link;
219
- var requests = [];
220
- state.tr.doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
221
- var linkMark = node.marks.find(function (mark) {
222
- return mark.type === link;
223
- });
224
- if (linkMark) {
225
- requests.push({
226
- url: linkMark.attrs.href,
227
- pos: pos,
228
- appearance: appearance,
229
- previousAppearance: 'url',
230
- compareLinkText: normalizeLinkText,
231
- source: source,
232
- analyticsAction: ACTION.CHANGED_TYPE,
233
- shouldReplaceLink: true
234
- });
235
- }
236
- });
237
- addLinkMetadata(state.selection, state.tr, {
238
- action: ACTION.CHANGED_TYPE
239
- });
240
- return queueCards(requests)(state.tr);
241
- };
242
- export var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
243
- return function (state, dispatch) {
244
- var tr;
245
- if (node && pos) {
246
- tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
247
- } else {
248
- tr = cardToLinkWithTransaction(state, text, href);
249
- }
250
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
251
- if (sendAnalytics) {
252
- if (selectedNode) {
253
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
254
- action: ACTION.CHANGED_TYPE,
255
- actionSubject: ACTION_SUBJECT.SMART_LINK,
256
- eventType: EVENT_TYPE.TRACK,
257
- attributes: {
258
- newType: SMART_LINK_TYPE.URL,
259
- previousType: appearanceForNodeType(selectedNode.type)
260
- }
261
- })(tr);
262
- }
263
- }
264
- if (dispatch) {
265
- dispatch(tr.scrollIntoView());
266
- }
267
- return true;
268
- };
269
- };
270
- export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
271
- return function (state, dispatch) {
272
- var tr;
273
- if (node && pos) {
274
- tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
275
- } else {
276
- tr = cardToLinkWithTransaction(state, text, href);
277
- }
278
- if (sendAnalytics) {
279
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
280
- action: ACTION.ERRORED,
281
- actionSubject: ACTION_SUBJECT.SMART_LINK,
282
- eventType: EVENT_TYPE.OPERATIONAL,
283
- attributes: {
284
- error: 'Smart card falling back to link.'
285
- }
286
- })(tr);
287
- }
288
- if (dispatch) {
289
- dispatch(tr.scrollIntoView());
290
- }
291
- return true;
292
- };
293
- };
294
- export var updateCard = function updateCard(href, sourceEvent) {
295
- return function (state, dispatch) {
296
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
297
- if (!selectedNode) {
298
- return false;
299
- }
300
- var cardAppearance = selectedCardAppearance(state);
301
- var tr = cardToLinkWithTransaction(state, href, href);
302
- queueCardFromChangedTr(state, tr, INPUT_METHOD.MANUAL, ACTION.UPDATED, undefined, sourceEvent, cardAppearance);
303
- if (dispatch) {
304
- dispatch(tr.scrollIntoView());
305
- }
306
- return true;
307
- };
308
- };
309
- function cardToLinkWithTransaction(state, text, href) {
310
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
311
- if (!selectedNode) {
312
- return state.tr;
313
- }
314
- var link = state.schema.marks.link;
315
- var url = selectedNode.attrs.url || selectedNode.attrs.data.url;
316
- var tr = state.tr.replaceSelectionWith(state.schema.text(text || url, [link.create({
317
- href: href || url
318
- })]), false);
319
- return tr;
320
- }
321
- function cardNodeToLinkWithTransaction(state, text, href, node, pos) {
322
- var link = state.schema.marks.link;
323
- var url = node.attrs.url || node.attrs.data.url;
324
- return state.tr.replaceWith(pos, pos + node.nodeSize, state.schema.text(text || url, [link.create({
325
- href: href || url
326
- })]));
327
- }
328
- export var changeSelectedCardToText = function changeSelectedCardToText(text, editorAnalyticsApi) {
329
- return function (state, dispatch) {
330
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
331
- if (!selectedNode) {
332
- return false;
333
- }
334
- var tr = state.tr.replaceSelectionWith(state.schema.text(text), false);
335
- if (dispatch) {
336
- addLinkMetadata(state.selection, tr, {
337
- action: ACTION.UNLINK
338
- });
339
- tr.scrollIntoView();
340
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(unlinkPayload(ACTION_SUBJECT_ID.CARD_INLINE))(tr);
341
- dispatch(tr);
342
- }
343
- return true;
344
- };
345
- };
346
- export var setSelectedCardAppearance = function setSelectedCardAppearance(appearance, editorAnalyticsApi) {
347
- return function (state, dispatch) {
348
- var _previousNode$type;
349
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
350
- if (!selectedNode) {
351
- // When there is no selected node, we insert a new one
352
- // and replace the existing blue link
353
- var _tr = convertHyperlinkToSmartCard(state, INPUT_METHOD.FLOATING_TB, appearance);
354
- if (dispatch) {
355
- addLinkMetadata(state.selection, _tr, {
356
- action: ACTION.CHANGED_TYPE
357
- });
358
- dispatch(_tr.scrollIntoView());
359
- }
360
- return false;
361
- }
362
- if (appearanceForNodeType(selectedNode.type) === appearance) {
363
- return false;
364
- }
365
- var isEmbed = appearance === 'embed';
366
- var attrs = isEmbed ? _objectSpread(_objectSpread({}, selectedNode.attrs), {}, {
367
- layout: 'center'
368
- }) : selectedNode.attrs;
369
- var _state$selection = state.selection,
370
- from = _state$selection.from,
371
- to = _state$selection.to;
372
- var nodeType = getLinkNodeType(appearance, state.schema.nodes);
373
- var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
374
-
375
- // When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
376
- if (tr.doc.nodeSize - 2 === to) {
377
- tr.insertText(' ', to);
378
- }
379
- tr.setSelection(TextSelection.create(tr.doc, to + 1));
380
- var previousNodePos = from - 1 > 0 ? from - 1 : 0;
381
- var previousNode = tr.doc.nodeAt(previousNodePos);
382
- if ((previousNode === null || previousNode === void 0 ? void 0 : (_previousNode$type = previousNode.type) === null || _previousNode$type === void 0 ? void 0 : _previousNode$type.name) === 'paragraph') {
383
- tr.delete(previousNodePos, from);
384
- }
385
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
386
- action: ACTION.CHANGED_TYPE,
387
- actionSubject: ACTION_SUBJECT.SMART_LINK,
388
- eventType: EVENT_TYPE.TRACK,
389
- attributes: {
390
- newType: appearance,
391
- previousType: appearanceForNodeType(selectedNode.type)
392
- }
393
- })(tr);
394
- addLinkMetadata(state.selection, tr, {
395
- action: ACTION.CHANGED_TYPE
396
- });
397
- if (dispatch) {
398
- dispatch(tr.scrollIntoView());
399
- }
400
- return true;
401
- };
402
- };
403
- var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
404
- switch (appearance) {
405
- case 'inline':
406
- return linkNodes.inlineCard;
407
- case 'block':
408
- return linkNodes.blockCard;
409
- case 'embed':
410
- return linkNodes.embedCard;
411
- }
412
- };
413
-
414
- // Apply an update to a datasource (aka blockCard) node
415
- export var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view) {
416
- var tr = state.tr,
417
- from = state.selection.from,
418
- schemaNodes = state.schema.nodes;
419
-
420
- // datasource to datasource
421
- if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
422
- var _ref3, _ref6, _newViews$properties, _oldViews$properties, _newAdf$attrs, _node$attrs;
423
- var _ref = (_ref3 = newAdf.attrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
424
- _ref2 = _slicedToArray(_ref, 1),
425
- newViews = _ref2[0];
426
- var _ref4 = (_ref6 = node.attrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
427
- _ref5 = _slicedToArray(_ref4, 1),
428
- oldViews = _ref5[0];
429
- var newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(function (column) {
430
- return column.key;
431
- });
432
- var oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(function (column) {
433
- return column.key;
434
- });
435
- var isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
436
- var isUrlChange = ((_newAdf$attrs = newAdf.attrs) === null || _newAdf$attrs === void 0 ? void 0 : _newAdf$attrs.url) !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url);
437
- if (isColumnChange || isUrlChange) {
438
- tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
439
- }
440
- } else if (newAdf.type === 'inlineCard') {
441
- // datasource to inline
442
- tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
443
- }
444
- hideDatasourceModal(tr);
445
- view.dispatch(tr.scrollIntoView());
446
- };
447
- export var insertDatasource = function insertDatasource(state, adf, view) {
448
- var tr = state.tr,
449
- from = state.selection.from,
450
- schemaNodes = state.schema.nodes;
451
- var attrs = adf.attrs,
452
- type = adf.type;
453
- var schemaNode = type === 'inlineCard' ? schemaNodes.inlineCard : schemaNodes.blockCard;
454
- var newNode = schemaNode.createChecked(attrs);
455
- // in future, if we decide to do datasource insertion from the main toolbar, we should probably consider editor-plugin-content-insertion instead of tr.insert
456
- // this will allow us to deal with insertions from multiple paths in a more consistent way
457
- newNode && tr.insert(from, newNode);
458
- hideDatasourceModal(tr);
459
- view.dispatch(tr.scrollIntoView());
460
- };
@@ -1,58 +0,0 @@
1
- import { keymap } from 'prosemirror-keymap';
2
- import { NodeSelection } from 'prosemirror-state';
3
- import { bindKeymapWithCommand, moveDown, moveUp } from '@atlaskit/editor-common/keymaps';
4
- import { findChildren, flatten } from 'prosemirror-utils';
5
- import { browser } from '@atlaskit/editor-common/utils';
6
- var lookupPixel = 10;
7
- var getClosestInlineCardPos = function getClosestInlineCardPos(state, editorView, direction) {
8
- var _editorView$posAtCoor;
9
- var selection = state.selection;
10
- var parent = selection.$from.parent;
11
- var inlineCardType = state.schema.nodes.inlineCard;
12
- if (!flatten(parent, false).some(function (_ref) {
13
- var node = _ref.node;
14
- return node.type === inlineCardType;
15
- })) {
16
- return null;
17
- }
18
- var coord = editorView.coordsAtPos(selection.$anchor.pos);
19
- var nearPos = (_editorView$posAtCoor = editorView.posAtCoords({
20
- left: coord.left,
21
- top: direction === 'up' ? coord.top - lookupPixel : coord.bottom + lookupPixel
22
- })) === null || _editorView$posAtCoor === void 0 ? void 0 : _editorView$posAtCoor.pos;
23
- if (nearPos) {
24
- var newNode = state.doc.nodeAt(nearPos);
25
- if (newNode) {
26
- if (newNode.type !== inlineCardType || findChildren(parent, function (node) {
27
- return node === newNode;
28
- }, false).length === 0 || newNode === selection.node) {
29
- return null;
30
- }
31
- return nearPos;
32
- }
33
- }
34
- return null;
35
- };
36
- var selectAboveBelowInlineCard = function selectAboveBelowInlineCard(direction) {
37
- return function (state, dispatch, editorView) {
38
- if (!editorView || !dispatch) {
39
- return false;
40
- }
41
- var pos = getClosestInlineCardPos(state, editorView, direction);
42
- if (pos) {
43
- dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
44
- return true;
45
- }
46
- return false;
47
- };
48
- };
49
- export function cardKeymap(featureFlags) {
50
- var list = {};
51
-
52
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
53
- if (browser.chrome && browser.chrome_version > 90 && featureFlags.chromeCursorHandlerFixedVersion && browser.chrome_version < featureFlags.chromeCursorHandlerFixedVersion) {
54
- bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
55
- bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
56
- }
57
- return keymap(list);
58
- }