@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,92 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
4
- import PropTypes from 'prop-types';
5
- import { isSafeUrl } from '@atlaskit/adf-schema';
6
- import { titleUrlPairFromNode } from '../utils';
7
- import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
8
- import { AnalyticsContext } from '@atlaskit/analytics-next';
9
- import { getPluginState } from '../pm-plugins/util/state';
10
- import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
11
- export function Card(SmartCardComponent, UnsupportedComponent) {
12
- var _class;
13
- return _class = class extends React.Component {
14
- constructor(...args) {
15
- super(...args);
16
- _defineProperty(this, "state", {
17
- isError: false
18
- });
19
- }
20
- render() {
21
- var _getPluginState;
22
- const {
23
- url
24
- } = titleUrlPairFromNode(this.props.node);
25
- if (url && !isSafeUrl(url)) {
26
- return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
27
- }
28
- if (this.state.isError) {
29
- if (url) {
30
- return /*#__PURE__*/React.createElement("a", {
31
- href: url,
32
- onClick: e => {
33
- e.preventDefault();
34
- }
35
- }, url);
36
- } else {
37
- return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
38
- }
39
- }
40
- const cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
41
- const editorAppearance = (_getPluginState = getPluginState(this.props.view.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance;
42
- const analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance);
43
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
44
- data: {
45
- attributes: {
46
- location: analyticsEditorAppearance
47
- },
48
- // Below is added for the future implementation of Linking Platform namespaced analytics context
49
- location: analyticsEditorAppearance
50
- }
51
- }, /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
52
- key: url,
53
- cardContext: cardContext
54
- }, this.props)));
55
- }
56
- componentDidCatch(error) {
57
- const maybeAPIError = error;
58
- // NB: errors received in this component are propagated by the `@atlaskit/smart-card` component.
59
- // Depending on the kind of error, the expectation for this component is to either:
60
- // (1) Render a blue link whilst retaining `inlineCard` in the ADF (non-fatal errs);
61
- // (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
62
-
63
- if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
64
- var _pluginInjectionApi$d;
65
- this.setState({
66
- isError: true
67
- });
68
- const {
69
- view,
70
- node,
71
- getPos,
72
- pluginInjectionApi
73
- } = this.props;
74
- const {
75
- url
76
- } = titleUrlPairFromNode(node);
77
- if (!getPos || typeof getPos === 'boolean') {
78
- return;
79
- }
80
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions)(view.state, view.dispatch);
81
- return null;
82
- } else {
83
- // Otherwise, render a blue link as fallback (above in render()).
84
- this.setState({
85
- isError: true
86
- });
87
- }
88
- }
89
- }, _defineProperty(_class, "contextTypes", {
90
- contextAdapter: PropTypes.object
91
- }), _class;
92
- }
@@ -1,112 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { Card as SmartCard } from '@atlaskit/smart-card';
5
- import { UnsupportedInline } from '@atlaskit/editor-common/ui';
6
- import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
7
- import rafSchedule from 'raf-schd';
8
- import { Card } from './genericCard';
9
- import { registerCard } from '../pm-plugins/actions';
10
- export class InlineCardComponent extends React.PureComponent {
11
- constructor(...args) {
12
- super(...args);
13
- _defineProperty(this, "onClick", () => {});
14
- _defineProperty(this, "onResolve", data => {
15
- const {
16
- getPos,
17
- view
18
- } = this.props;
19
- if (!getPos || typeof getPos === 'boolean') {
20
- return;
21
- }
22
- const {
23
- title,
24
- url
25
- } = data;
26
- // don't dispatch immediately since we might be in the middle of
27
- // rendering a nodeview
28
- rafSchedule(() => {
29
- // prosemirror-bump-fix
30
- const pos = getPos();
31
- if (typeof pos !== 'number') {
32
- return;
33
- }
34
- view.dispatch(registerCard({
35
- title,
36
- url,
37
- pos
38
- })(view.state.tr));
39
- })();
40
- });
41
- _defineProperty(this, "onError", data => {
42
- const {
43
- url,
44
- err
45
- } = data;
46
- if (err) {
47
- throw err;
48
- }
49
- this.onResolve({
50
- url
51
- });
52
- });
53
- }
54
- UNSAFE_componentWillMount() {
55
- const {
56
- view
57
- } = this.props;
58
- const scrollContainer = findOverflowScrollParent(view.dom);
59
- this.scrollContainer = scrollContainer || undefined;
60
- }
61
- render() {
62
- const {
63
- node,
64
- cardContext,
65
- showServerActions,
66
- useAlternativePreloader
67
- } = this.props;
68
- const {
69
- url,
70
- data
71
- } = node.attrs;
72
- const card = /*#__PURE__*/React.createElement("span", {
73
- className: "card"
74
- }, /*#__PURE__*/React.createElement(SmartCard, {
75
- key: url,
76
- url: url,
77
- data: data,
78
- appearance: "inline",
79
- onClick: this.onClick,
80
- container: this.scrollContainer,
81
- onResolve: this.onResolve,
82
- onError: this.onError,
83
- inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
84
- showServerActions: showServerActions
85
- }));
86
- // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
87
- // otherwise if we got data, we can render the card directly since it doesn't need the Provider
88
- return cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
89
- value: cardContext.value
90
- }, card) : data ? card : null;
91
- }
92
- }
93
- _defineProperty(InlineCardComponent, "contextTypes", {
94
- contextAdapter: PropTypes.object
95
- });
96
- const WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
97
- export function InlineCardNodeView(props) {
98
- const {
99
- useAlternativePreloader,
100
- node,
101
- view,
102
- getPos,
103
- showServerActions
104
- } = props;
105
- return /*#__PURE__*/React.createElement(WrappedInlineCard, {
106
- node: node,
107
- view: view,
108
- getPos: getPos,
109
- showServerActions: showServerActions,
110
- useAlternativePreloader: useAlternativePreloader
111
- });
112
- }
@@ -1,57 +0,0 @@
1
- import { pluginKey } from './plugin-key';
2
- export const cardAction = (tr, action) => {
3
- return tr.setMeta(pluginKey, action);
4
- };
5
- export const resolveCard = url => tr => cardAction(tr, {
6
- type: 'RESOLVE',
7
- url
8
- });
9
- export const queueCards = requests => tr => cardAction(tr, {
10
- type: 'QUEUE',
11
- requests: requests
12
- });
13
- export const registerCard = info => tr => cardAction(tr, {
14
- type: 'REGISTER',
15
- info
16
- });
17
- export const registerSmartCardEvents = smartLinkEvents => tr => cardAction(tr, {
18
- type: 'REGISTER_EVENTS',
19
- smartLinkEvents
20
- });
21
- export const registerSmartCardEventsNext = smartLinkEvents => tr => cardAction(tr, {
22
- type: 'REGISTER_EVENTS_NEXT',
23
- smartLinkEvents
24
- });
25
- export const setProvider = cardProvider => tr => cardAction(tr, {
26
- type: 'SET_PROVIDER',
27
- provider: cardProvider
28
- });
29
- export const setDatasourceTableRef = datasourceTableRef => tr => cardAction(tr, {
30
- type: 'SET_DATASOURCE_TABLE_REF',
31
- datasourceTableRef
32
- });
33
- export const setCardLayout = layout => tr => cardAction(tr, {
34
- type: 'SET_CARD_LAYOUT',
35
- layout
36
- });
37
- export const setCardLayoutAndDatasourceTableRef = ({
38
- layout,
39
- datasourceTableRef
40
- }) => tr => cardAction(tr, {
41
- type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF',
42
- layout,
43
- datasourceTableRef
44
- });
45
- export const showLinkToolbar = tr => cardAction(tr, {
46
- type: 'SHOW_LINK_TOOLBAR'
47
- });
48
- export const hideLinkToolbar = tr => cardAction(tr, {
49
- type: 'HIDE_LINK_TOOLBAR'
50
- });
51
- export const showDatasourceModal = modalType => tr => cardAction(tr, {
52
- type: 'SHOW_DATASOURCE_MODAL',
53
- modalType
54
- });
55
- export const hideDatasourceModal = tr => cardAction(tr, {
56
- type: 'HIDE_DATASOURCE_MODAL'
57
- });
@@ -1,38 +0,0 @@
1
- /**
2
- * Simple mechanism to defer analytics related callbacks
3
- */
4
- export const createAnalyticsQueue = (enabled = true) => {
5
- const queue = [];
6
- const callbacksRef = {
7
- current: null
8
- };
9
- const setCallbacks = callbacks => {
10
- callbacksRef.current = callbacks;
11
- };
12
- const push = (...events) => {
13
- const callbacks = callbacksRef.current;
14
- if (!enabled || !callbacks) {
15
- return;
16
- }
17
- queue.push(...events);
18
- };
19
- const flush = () => {
20
- const callbacks = callbacksRef.current;
21
- if (!enabled || !callbacks) {
22
- return;
23
- }
24
- while (queue.length) {
25
- const event = queue.pop();
26
- if (event) {
27
- callbacks[event.type](event.data);
28
- }
29
- }
30
- };
31
- const getSize = () => queue.length;
32
- return {
33
- push,
34
- flush,
35
- setCallbacks,
36
- getSize
37
- };
38
- };
@@ -1,333 +0,0 @@
1
- import { AddMarkStep, RemoveMarkStep } from 'prosemirror-transform';
2
- import { ACTION } from '@atlaskit/editor-common/analytics';
3
- import { isLinkMark, pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
4
- import { getLinkMetadataFromTransaction } from '@atlaskit/editor-common/card';
5
- import { LinkMetaStep } from '@atlaskit/adf-schema/steps';
6
- import { getPluginState } from '../util/state';
7
- import { pluginKey } from '../plugin-key';
8
- import { isLink, linkObjectFromNode, getLinkUrl, getLinkNodeContext, appearanceForLink, findLinksAtPositions, areSameLinks } from './utils';
9
- const findLinksInNodeRange = (doc, schema, from, to) => {
10
- const links = [];
11
- doc.nodesBetween(from, to, (node, pos) => {
12
- if (isLink(schema, node)) {
13
- const entireLinkInRange = pos >= from && pos + node.nodeSize <= to;
14
- if (entireLinkInRange) {
15
- const link = linkObjectFromNode(doc, schema, node, pos);
16
- if (link) {
17
- links.push(link);
18
- }
19
- }
20
- }
21
- });
22
- return links;
23
- };
24
- export const findChangedLinks = (tr, state) => {
25
- const schema = tr.doc.type.schema;
26
- const removed = [];
27
- const inserted = [];
28
- const updated = [];
29
- const queuedForUpgrade = isTransactionQueuedForUpgrade(tr);
30
- const isResolveReplace = isTransactionResolveReplace(tr);
31
-
32
- // History
33
- const historyMeta = tr.getMeta(pmHistoryPluginKey);
34
- const isUndo = isHistoryMeta(historyMeta) && historyMeta.redo === false;
35
- const isRedo = isHistoryMeta(historyMeta) && historyMeta.redo === true;
36
- const isUpdate = isUpdateTr(tr, isUndo || isRedo);
37
- for (let i = 0; i < tr.steps.length; i++) {
38
- var _tr$docs$i, _tr$docs;
39
- const step = tr.steps[i];
40
- const stepMap = step.getMap();
41
- const removedInStep = [];
42
- const insertedInStep = [];
43
- const before = (_tr$docs$i = tr.docs[i]) !== null && _tr$docs$i !== void 0 ? _tr$docs$i : tr.before;
44
- const after = (_tr$docs = tr.docs[i + 1]) !== null && _tr$docs !== void 0 ? _tr$docs : tr.doc;
45
-
46
- /**
47
- * AddMarkStep and RemoveMarkSteps don't produce stepMap ranges
48
- * because there are no "changed tokens" only marks added/removed
49
- * So have to check these manually
50
- */
51
- if (step instanceof AddMarkStep) {
52
- const addMarkStep = step;
53
- if (isLinkMark(addMarkStep.mark, schema)) {
54
- /**
55
- * For url text pasted on plain text
56
- */
57
- insertedInStep.push({
58
- type: 'mark',
59
- pos: addMarkStep.from,
60
- mark: addMarkStep.mark,
61
- nodeContext: getLinkNodeContext(after, addMarkStep.from)
62
- });
63
- }
64
- }
65
- if (step instanceof RemoveMarkStep) {
66
- const removeMarkStep = step;
67
- if (isLinkMark(removeMarkStep.mark, schema)) {
68
- removedInStep.push({
69
- type: 'mark',
70
- pos: removeMarkStep.from,
71
- mark: removeMarkStep.mark,
72
- nodeContext: getLinkNodeContext(before, removeMarkStep.from)
73
- });
74
- }
75
- }
76
- stepMap.forEach((oldStart, oldEnd, newStart, newEnd) => {
77
- var _tr$docs2;
78
- const before = tr.docs[i];
79
- const after = (_tr$docs2 = tr.docs[i + 1]) !== null && _tr$docs2 !== void 0 ? _tr$docs2 : tr.doc;
80
- const removedInRange = [];
81
- const insertedInRange = [];
82
-
83
- // Removed
84
- removedInRange.push(...findLinksInNodeRange(before, schema, oldStart, oldEnd));
85
- // Inserted
86
- insertedInRange.push(...findLinksInNodeRange(after, schema, newStart, newEnd));
87
- removedInStep.push(...removedInRange);
88
- insertedInStep.push(...insertedInRange);
89
- });
90
- const omitQueuedLinks = links => {
91
- if (!queuedForUpgrade) {
92
- return links;
93
- }
94
- /**
95
- * Skip/filter out links that have been queued, they will be tracked later
96
- */
97
- const queuedPositions = getQueuedPositions(tr);
98
- return links.filter(link => !queuedPositions.includes(link.pos));
99
- };
100
-
101
- /**
102
- * Skip "deletions" when the transaction is relating to
103
- * replacing links queued for upgrade to cards,
104
- * because the "deleted" link has not actually been
105
- * tracked as "created" yet
106
- */
107
- if (!isResolveReplace) {
108
- removed.push(...removedInStep);
109
- }
110
- inserted.push(...omitQueuedLinks(insertedInStep));
111
- }
112
-
113
- /**
114
- * If there are no links changed but the transaction is a "resolve" action
115
- * Then this means we have resolved a link but it has failed to upgrade
116
- * We should track all resolved links as now being created
117
- */
118
- if (inserted.length === 0 && isResolveReplace) {
119
- const positions = getResolvePositions(tr, state);
120
- inserted.push(...findLinksAtPositions(tr, positions));
121
- }
122
- if (!isUpdate) {
123
- const {
124
- inputMethod
125
- } = getLinkMetadataFromTransaction(tr);
126
- /**
127
- * If there is no identifiable input method, and the links inserted and removed appear to be the same,
128
- * then this transaction likely is not intended to be consided to be the insertion and removal of links
129
- */
130
- if (!inputMethod && areSameLinks(removed, inserted)) {
131
- return {
132
- removed: [],
133
- inserted: [],
134
- updated
135
- };
136
- }
137
- return {
138
- removed,
139
- inserted,
140
- updated
141
- };
142
- }
143
- for (let i = 0; i < inserted.length; i++) {
144
- if (isResolveReplace) {
145
- const newLink = inserted[i];
146
-
147
- // what is the 2nd argument 'assoc = -1' doing here exactly?
148
- const mappedPos = tr.mapping.map(newLink.pos, -1);
149
- const previousDisplay = getResolveLinkPrevDisplay(state, mappedPos);
150
- updated.push({
151
- inserted: inserted[i],
152
- previous: {
153
- display: previousDisplay
154
- }
155
- });
156
- continue;
157
- }
158
- if (inserted.length === removed.length) {
159
- updated.push({
160
- removed: removed[i],
161
- inserted: inserted[i]
162
- });
163
- }
164
- }
165
- return {
166
- inserted: [],
167
- removed: [],
168
- updated
169
- };
170
- };
171
-
172
- /**
173
- * List of actions to be considered link "updates"
174
- */
175
- const UPDATE_ACTIONS = [ACTION.CHANGED_TYPE, ACTION.UPDATED];
176
-
177
- /**
178
- * Returns true if the transaction has LinkMetaSteps that indicate the transaction is
179
- * intended to be perceived as an update to links, rather than insertion+deletion
180
- */
181
- const isUpdateTr = (tr, isUndoOrRedo) => {
182
- return !!tr.steps.find(step => {
183
- if (!(step instanceof LinkMetaStep)) {
184
- return false;
185
- }
186
- const {
187
- action,
188
- cardAction
189
- } = step.getMetadata();
190
-
191
- /**
192
- * Undo of a resolve step should be considered an update
193
- * because the user is choosing to update the url back to the un-upgraded display
194
- */
195
- if (cardAction === 'RESOLVE' && isUndoOrRedo) {
196
- return true;
197
- }
198
- if (!action) {
199
- return false;
200
- }
201
- return UPDATE_ACTIONS.includes(action);
202
- });
203
- };
204
- const hasType = pluginMeta => {
205
- return typeof pluginMeta === 'object' && pluginMeta !== null && 'type' in pluginMeta;
206
- };
207
- const isTransactionQueuedForUpgrade = tr => {
208
- const pluginMeta = tr.getMeta(pluginKey);
209
- return hasType(pluginMeta) && pluginMeta.type === 'QUEUE';
210
- };
211
- const isTransactionResolveReplace = tr => {
212
- const pluginMeta = tr.getMeta(pluginKey);
213
- return hasType(pluginMeta) && pluginMeta.type === 'RESOLVE';
214
- };
215
- const isHistoryMeta = meta => {
216
- return typeof meta === 'object' && meta !== null && 'redo' in meta;
217
- };
218
- const getQueuedPositions = tr => {
219
- const pluginMeta = tr.getMeta(pluginKey);
220
- if (!isTransactionQueuedForUpgrade(tr)) {
221
- return [];
222
- }
223
- return pluginMeta.requests.map(({
224
- pos
225
- }) => pos);
226
- };
227
- const getResolvePositions = (tr, state) => {
228
- const cardState = getPluginState(state);
229
- if (!cardState) {
230
- return [];
231
- }
232
- const pluginMeta = tr.getMeta(pluginKey);
233
- if (!isTransactionResolveReplace(tr)) {
234
- return [];
235
- }
236
- return cardState.requests.filter(request => request.url === pluginMeta.url).map(request => request.pos);
237
- };
238
- const getResolveLinkPrevDisplay = (state, pos) => {
239
- var _cardState$requests$f;
240
- const cardState = getPluginState(state);
241
- if (!cardState) {
242
- return undefined;
243
- }
244
- return (_cardState$requests$f = cardState.requests.find(request => request.pos === pos)) === null || _cardState$requests$f === void 0 ? void 0 : _cardState$requests$f.previousAppearance;
245
- };
246
- export function eventsFromTransaction(tr, state) {
247
- const events = [];
248
- try {
249
- /**
250
- * Skip transactions sent by collab (identified by 'isRemote' key)
251
- * Skip entire document replace steps
252
- * We are only concerned with transactions performed on the document directly by the user
253
- */
254
- const isRemote = tr.getMeta('isRemote');
255
- const isReplaceDocument = tr.getMeta('replaceDocument');
256
- if (isRemote || isReplaceDocument) {
257
- return events;
258
- }
259
- const historyMeta = tr.getMeta(pmHistoryPluginKey);
260
- const isUndo = isHistoryMeta(historyMeta) && historyMeta.redo === false;
261
- const isRedo = isHistoryMeta(historyMeta) && historyMeta.redo === true;
262
-
263
- /**
264
- * Retrieve metadata from the LinkMetaStep(s) in the transaction
265
- */
266
- const {
267
- action,
268
- inputMethod,
269
- sourceEvent
270
- } = getLinkMetadataFromTransaction(tr);
271
- const contextualData = {
272
- action,
273
- inputMethod,
274
- sourceEvent,
275
- isUndo,
276
- isRedo
277
- };
278
- const {
279
- removed,
280
- inserted,
281
- updated
282
- } = findChangedLinks(tr, state);
283
- const MAX_LINK_EVENTS = 50;
284
- if ([removed, inserted, updated].some(arr => arr.length > MAX_LINK_EVENTS)) {
285
- return [];
286
- }
287
- for (let i = 0; i < updated.length; i++) {
288
- var _update$previous$disp;
289
- const update = updated[i];
290
- const {
291
- inserted: link
292
- } = update;
293
- const url = getLinkUrl(link);
294
- const display = appearanceForLink(link);
295
- const previousDisplay = 'removed' in update ? appearanceForLink(update.removed) : (_update$previous$disp = update.previous.display) !== null && _update$previous$disp !== void 0 ? _update$previous$disp : 'unknown';
296
- if (url) {
297
- events.push({
298
- type: 'updated',
299
- data: {
300
- ...contextualData,
301
- url,
302
- display,
303
- previousDisplay,
304
- nodeContext: link.nodeContext
305
- }
306
- });
307
- }
308
- }
309
- const pushEvents = (links, type) => {
310
- for (let i = 0; i < links.length; i++) {
311
- const link = links[i];
312
- const url = getLinkUrl(link);
313
- const display = appearanceForLink(link);
314
- if (url) {
315
- events.push({
316
- type,
317
- data: {
318
- ...contextualData,
319
- url,
320
- display,
321
- nodeContext: link.nodeContext
322
- }
323
- });
324
- }
325
- }
326
- };
327
- pushEvents(removed, 'deleted');
328
- pushEvents(inserted, 'created');
329
- return events;
330
- } catch (err) {
331
- return events;
332
- }
333
- }
@@ -1,2 +0,0 @@
1
- export { createAnalyticsQueue } from './create-analytics-queue';
2
- export { eventsFromTransaction } from './events-from-tr';