@atlaskit/editor-core 185.16.1 → 185.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +14 -0
  3. package/dist/cjs/i18n/cs.js +0 -35
  4. package/dist/cjs/i18n/da.js +0 -35
  5. package/dist/cjs/i18n/de.js +0 -35
  6. package/dist/cjs/i18n/en.js +0 -35
  7. package/dist/cjs/i18n/en_GB.js +0 -35
  8. package/dist/cjs/i18n/en_ZZ.js +0 -35
  9. package/dist/cjs/i18n/es.js +1 -35
  10. package/dist/cjs/i18n/fi.js +0 -35
  11. package/dist/cjs/i18n/fr.js +1 -35
  12. package/dist/cjs/i18n/hu.js +1 -35
  13. package/dist/cjs/i18n/it.js +1 -35
  14. package/dist/cjs/i18n/ja.js +1 -35
  15. package/dist/cjs/i18n/ko.js +0 -35
  16. package/dist/cjs/i18n/nb.js +1 -35
  17. package/dist/cjs/i18n/nl.js +1 -35
  18. package/dist/cjs/i18n/pl.js +1 -35
  19. package/dist/cjs/i18n/pt_BR.js +1 -35
  20. package/dist/cjs/i18n/ru.js +1 -35
  21. package/dist/cjs/i18n/sv.js +0 -35
  22. package/dist/cjs/i18n/th.js +0 -35
  23. package/dist/cjs/i18n/tr.js +1 -35
  24. package/dist/cjs/i18n/uk.js +1 -35
  25. package/dist/cjs/i18n/vi.js +0 -35
  26. package/dist/cjs/i18n/zh.js +1 -35
  27. package/dist/cjs/i18n/zh_TW.js +1 -35
  28. package/dist/cjs/labs/next/presets/mobile.js +1 -1
  29. package/dist/cjs/labs/next/presets/universal.js +2 -2
  30. package/dist/cjs/plugins/deprecated-card/doc.js +111 -0
  31. package/dist/cjs/plugins/deprecated-hyperlink/commands.js +1 -1
  32. package/dist/cjs/plugins/index.js +0 -7
  33. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +14 -25
  34. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  35. package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +5 -6
  36. package/dist/cjs/plugins/text-formatting/index.js +6 -2
  37. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  38. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +6 -3
  39. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  40. package/dist/cjs/version-wrapper.js +1 -1
  41. package/dist/cjs/version.json +1 -1
  42. package/dist/es2019/i18n/cs.js +0 -35
  43. package/dist/es2019/i18n/da.js +0 -35
  44. package/dist/es2019/i18n/de.js +0 -35
  45. package/dist/es2019/i18n/en.js +0 -35
  46. package/dist/es2019/i18n/en_GB.js +0 -35
  47. package/dist/es2019/i18n/en_ZZ.js +0 -35
  48. package/dist/es2019/i18n/es.js +1 -35
  49. package/dist/es2019/i18n/fi.js +0 -35
  50. package/dist/es2019/i18n/fr.js +1 -35
  51. package/dist/es2019/i18n/hu.js +1 -35
  52. package/dist/es2019/i18n/it.js +1 -35
  53. package/dist/es2019/i18n/ja.js +1 -35
  54. package/dist/es2019/i18n/ko.js +0 -35
  55. package/dist/es2019/i18n/nb.js +1 -35
  56. package/dist/es2019/i18n/nl.js +1 -35
  57. package/dist/es2019/i18n/pl.js +1 -35
  58. package/dist/es2019/i18n/pt_BR.js +1 -35
  59. package/dist/es2019/i18n/ru.js +1 -35
  60. package/dist/es2019/i18n/sv.js +0 -35
  61. package/dist/es2019/i18n/th.js +0 -35
  62. package/dist/es2019/i18n/tr.js +1 -35
  63. package/dist/es2019/i18n/uk.js +1 -35
  64. package/dist/es2019/i18n/vi.js +0 -35
  65. package/dist/es2019/i18n/zh.js +1 -35
  66. package/dist/es2019/i18n/zh_TW.js +1 -35
  67. package/dist/es2019/labs/next/presets/mobile.js +1 -1
  68. package/dist/es2019/labs/next/presets/universal.js +1 -1
  69. package/dist/es2019/plugins/deprecated-card/doc.js +97 -0
  70. package/dist/es2019/plugins/deprecated-hyperlink/commands.js +1 -1
  71. package/dist/es2019/plugins/index.js +0 -1
  72. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -14
  73. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +13 -0
  74. package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +5 -6
  75. package/dist/es2019/plugins/text-formatting/index.js +8 -3
  76. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  77. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +5 -4
  78. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  79. package/dist/es2019/version-wrapper.js +1 -1
  80. package/dist/es2019/version.json +1 -1
  81. package/dist/esm/i18n/cs.js +0 -35
  82. package/dist/esm/i18n/da.js +0 -35
  83. package/dist/esm/i18n/de.js +0 -35
  84. package/dist/esm/i18n/en.js +0 -35
  85. package/dist/esm/i18n/en_GB.js +0 -35
  86. package/dist/esm/i18n/en_ZZ.js +0 -35
  87. package/dist/esm/i18n/es.js +1 -35
  88. package/dist/esm/i18n/fi.js +0 -35
  89. package/dist/esm/i18n/fr.js +1 -35
  90. package/dist/esm/i18n/hu.js +1 -35
  91. package/dist/esm/i18n/it.js +1 -35
  92. package/dist/esm/i18n/ja.js +1 -35
  93. package/dist/esm/i18n/ko.js +0 -35
  94. package/dist/esm/i18n/nb.js +1 -35
  95. package/dist/esm/i18n/nl.js +1 -35
  96. package/dist/esm/i18n/pl.js +1 -35
  97. package/dist/esm/i18n/pt_BR.js +1 -35
  98. package/dist/esm/i18n/ru.js +1 -35
  99. package/dist/esm/i18n/sv.js +0 -35
  100. package/dist/esm/i18n/th.js +0 -35
  101. package/dist/esm/i18n/tr.js +1 -35
  102. package/dist/esm/i18n/uk.js +1 -35
  103. package/dist/esm/i18n/vi.js +0 -35
  104. package/dist/esm/i18n/zh.js +1 -35
  105. package/dist/esm/i18n/zh_TW.js +1 -35
  106. package/dist/esm/labs/next/presets/mobile.js +1 -1
  107. package/dist/esm/labs/next/presets/universal.js +1 -1
  108. package/dist/esm/plugins/deprecated-card/doc.js +105 -0
  109. package/dist/esm/plugins/deprecated-hyperlink/commands.js +1 -1
  110. package/dist/esm/plugins/index.js +0 -1
  111. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +14 -25
  112. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
  113. package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +5 -6
  114. package/dist/esm/plugins/text-formatting/index.js +6 -2
  115. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +2 -2
  116. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +7 -4
  117. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +8 -4
  118. package/dist/esm/version-wrapper.js +1 -1
  119. package/dist/esm/version.json +1 -1
  120. package/dist/types/i18n/cs.d.ts +0 -35
  121. package/dist/types/i18n/da.d.ts +0 -35
  122. package/dist/types/i18n/de.d.ts +0 -35
  123. package/dist/types/i18n/en.d.ts +0 -35
  124. package/dist/types/i18n/en_GB.d.ts +0 -35
  125. package/dist/types/i18n/en_ZZ.d.ts +0 -35
  126. package/dist/types/i18n/es.d.ts +1 -35
  127. package/dist/types/i18n/fi.d.ts +0 -35
  128. package/dist/types/i18n/fr.d.ts +1 -35
  129. package/dist/types/i18n/hu.d.ts +1 -35
  130. package/dist/types/i18n/it.d.ts +1 -35
  131. package/dist/types/i18n/ja.d.ts +1 -35
  132. package/dist/types/i18n/ko.d.ts +0 -35
  133. package/dist/types/i18n/nb.d.ts +1 -35
  134. package/dist/types/i18n/nl.d.ts +1 -35
  135. package/dist/types/i18n/pl.d.ts +1 -35
  136. package/dist/types/i18n/pt_BR.d.ts +1 -35
  137. package/dist/types/i18n/ru.d.ts +1 -35
  138. package/dist/types/i18n/sv.d.ts +0 -35
  139. package/dist/types/i18n/th.d.ts +0 -35
  140. package/dist/types/i18n/tr.d.ts +1 -35
  141. package/dist/types/i18n/uk.d.ts +1 -35
  142. package/dist/types/i18n/vi.d.ts +0 -35
  143. package/dist/types/i18n/zh.d.ts +1 -35
  144. package/dist/types/i18n/zh_TW.d.ts +1 -35
  145. package/dist/types/labs/next/presets/cxhtml.d.ts +58 -0
  146. package/dist/types/labs/next/presets/default.d.ts +116 -0
  147. package/dist/types/labs/next/presets/mobile.d.ts +58 -0
  148. package/dist/types/plugins/deprecated-card/doc.d.ts +20 -0
  149. package/dist/types/plugins/index.d.ts +0 -1
  150. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  151. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  152. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  153. package/dist/types/plugins/paste/index.d.ts +1 -1
  154. package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +3 -3
  155. package/dist/types/plugins/text-formatting/index.d.ts +3 -1
  156. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +2 -1
  157. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +6 -1
  158. package/dist/types/plugins/text-formatting/ui/Toolbar/index.d.ts +2 -0
  159. package/dist/types-ts4.5/i18n/cs.d.ts +0 -35
  160. package/dist/types-ts4.5/i18n/da.d.ts +0 -35
  161. package/dist/types-ts4.5/i18n/de.d.ts +0 -35
  162. package/dist/types-ts4.5/i18n/en.d.ts +0 -35
  163. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -35
  164. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -35
  165. package/dist/types-ts4.5/i18n/es.d.ts +1 -35
  166. package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
  167. package/dist/types-ts4.5/i18n/fr.d.ts +1 -35
  168. package/dist/types-ts4.5/i18n/hu.d.ts +1 -35
  169. package/dist/types-ts4.5/i18n/it.d.ts +1 -35
  170. package/dist/types-ts4.5/i18n/ja.d.ts +1 -35
  171. package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
  172. package/dist/types-ts4.5/i18n/nb.d.ts +1 -35
  173. package/dist/types-ts4.5/i18n/nl.d.ts +1 -35
  174. package/dist/types-ts4.5/i18n/pl.d.ts +1 -35
  175. package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -35
  176. package/dist/types-ts4.5/i18n/ru.d.ts +1 -35
  177. package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
  178. package/dist/types-ts4.5/i18n/th.d.ts +0 -35
  179. package/dist/types-ts4.5/i18n/tr.d.ts +1 -35
  180. package/dist/types-ts4.5/i18n/uk.d.ts +1 -35
  181. package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
  182. package/dist/types-ts4.5/i18n/zh.d.ts +1 -35
  183. package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -35
  184. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +70 -0
  185. package/dist/types-ts4.5/labs/next/presets/default.d.ts +140 -0
  186. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +70 -0
  187. package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +20 -0
  188. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  189. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
  190. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
  191. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
  192. package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
  193. package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +3 -3
  194. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +5 -1
  195. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +2 -1
  196. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +6 -1
  197. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/index.d.ts +2 -0
  198. package/package.json +6 -5
  199. package/tmp/api-report-tmp.d.ts +2307 -0
  200. package/dist/cjs/plugins/card/index.js +0 -139
  201. package/dist/cjs/plugins/card/messages.js +0 -20
  202. package/dist/cjs/plugins/card/nodeviews/blockCard.js +0 -163
  203. package/dist/cjs/plugins/card/nodeviews/datasource.js +0 -172
  204. package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -396
  205. package/dist/cjs/plugins/card/nodeviews/genericCard.js +0 -118
  206. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +0 -131
  207. package/dist/cjs/plugins/card/pm-plugins/actions.js +0 -122
  208. package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -48
  209. package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -353
  210. package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +0 -19
  211. package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +0 -5
  212. package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +0 -178
  213. package/dist/cjs/plugins/card/pm-plugins/doc.js +0 -478
  214. package/dist/cjs/plugins/card/pm-plugins/keymap.js +0 -64
  215. package/dist/cjs/plugins/card/pm-plugins/main.js +0 -212
  216. package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +0 -47
  217. package/dist/cjs/plugins/card/pm-plugins/plugin-key.js +0 -9
  218. package/dist/cjs/plugins/card/pm-plugins/reducers.js +0 -111
  219. package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +0 -35
  220. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +0 -58
  221. package/dist/cjs/plugins/card/pm-plugins/util/state.js +0 -49
  222. package/dist/cjs/plugins/card/toolbar.js +0 -364
  223. package/dist/cjs/plugins/card/types.js +0 -5
  224. package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -25
  225. package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +0 -60
  226. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +0 -256
  227. package/dist/cjs/plugins/card/ui/EditorSmartCardEvents.js +0 -21
  228. package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +0 -213
  229. package/dist/cjs/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -173
  230. package/dist/cjs/plugins/card/ui/LayoutButton/index.js +0 -113
  231. package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +0 -17
  232. package/dist/cjs/plugins/card/ui/LayoutButton/types.js +0 -5
  233. package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +0 -19
  234. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +0 -151
  235. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +0 -360
  236. package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +0 -20
  237. package/dist/cjs/plugins/card/utils.js +0 -60
  238. package/dist/es2019/plugins/card/index.js +0 -131
  239. package/dist/es2019/plugins/card/messages.js +0 -13
  240. package/dist/es2019/plugins/card/nodeviews/blockCard.js +0 -130
  241. package/dist/es2019/plugins/card/nodeviews/datasource.js +0 -136
  242. package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -368
  243. package/dist/es2019/plugins/card/nodeviews/genericCard.js +0 -92
  244. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +0 -112
  245. package/dist/es2019/plugins/card/pm-plugins/actions.js +0 -57
  246. package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -38
  247. package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -333
  248. package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +0 -2
  249. package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +0 -1
  250. package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +0 -160
  251. package/dist/es2019/plugins/card/pm-plugins/doc.js +0 -451
  252. package/dist/es2019/plugins/card/pm-plugins/keymap.js +0 -59
  253. package/dist/es2019/plugins/card/pm-plugins/main.js +0 -208
  254. package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +0 -37
  255. package/dist/es2019/plugins/card/pm-plugins/plugin-key.js +0 -2
  256. package/dist/es2019/plugins/card/pm-plugins/reducers.js +0 -110
  257. package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +0 -25
  258. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +0 -48
  259. package/dist/es2019/plugins/card/pm-plugins/util/state.js +0 -26
  260. package/dist/es2019/plugins/card/toolbar.js +0 -362
  261. package/dist/es2019/plugins/card/types.js +0 -1
  262. package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -19
  263. package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +0 -48
  264. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +0 -225
  265. package/dist/es2019/plugins/card/ui/EditorSmartCardEvents.js +0 -15
  266. package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +0 -198
  267. package/dist/es2019/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -86
  268. package/dist/es2019/plugins/card/ui/LayoutButton/index.js +0 -106
  269. package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +0 -10
  270. package/dist/es2019/plugins/card/ui/LayoutButton/types.js +0 -1
  271. package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +0 -15
  272. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +0 -117
  273. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +0 -332
  274. package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +0 -11
  275. package/dist/es2019/plugins/card/utils.js +0 -46
  276. package/dist/esm/plugins/card/index.js +0 -132
  277. package/dist/esm/plugins/card/messages.js +0 -13
  278. package/dist/esm/plugins/card/nodeviews/blockCard.js +0 -155
  279. package/dist/esm/plugins/card/nodeviews/datasource.js +0 -164
  280. package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -387
  281. package/dist/esm/plugins/card/nodeviews/genericCard.js +0 -111
  282. package/dist/esm/plugins/card/nodeviews/inlineCard.js +0 -123
  283. package/dist/esm/plugins/card/pm-plugins/actions.js +0 -102
  284. package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -41
  285. package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -344
  286. package/dist/esm/plugins/card/pm-plugins/analytics/index.js +0 -2
  287. package/dist/esm/plugins/card/pm-plugins/analytics/types.js +0 -1
  288. package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +0 -160
  289. package/dist/esm/plugins/card/pm-plugins/doc.js +0 -460
  290. package/dist/esm/plugins/card/pm-plugins/keymap.js +0 -58
  291. package/dist/esm/plugins/card/pm-plugins/main.js +0 -199
  292. package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +0 -39
  293. package/dist/esm/plugins/card/pm-plugins/plugin-key.js +0 -2
  294. package/dist/esm/plugins/card/pm-plugins/reducers.js +0 -103
  295. package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +0 -29
  296. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +0 -50
  297. package/dist/esm/plugins/card/pm-plugins/util/state.js +0 -40
  298. package/dist/esm/plugins/card/toolbar.js +0 -353
  299. package/dist/esm/plugins/card/types.js +0 -1
  300. package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -17
  301. package/dist/esm/plugins/card/ui/DatasourceModal/index.js +0 -49
  302. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +0 -243
  303. package/dist/esm/plugins/card/ui/EditorSmartCardEvents.js +0 -14
  304. package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +0 -202
  305. package/dist/esm/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -163
  306. package/dist/esm/plugins/card/ui/LayoutButton/index.js +0 -102
  307. package/dist/esm/plugins/card/ui/LayoutButton/styled.js +0 -10
  308. package/dist/esm/plugins/card/ui/LayoutButton/types.js +0 -1
  309. package/dist/esm/plugins/card/ui/LayoutButton/utils.js +0 -12
  310. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +0 -140
  311. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +0 -355
  312. package/dist/esm/plugins/card/ui/SmallerEditIcon.js +0 -11
  313. package/dist/esm/plugins/card/utils.js +0 -48
  314. package/dist/types/plugins/card/index.d.ts +0 -26
  315. package/dist/types/plugins/card/messages.d.ts +0 -12
  316. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +0 -26
  317. package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -42
  318. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -46
  319. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -37
  320. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  321. package/dist/types/plugins/card/pm-plugins/actions.d.ts +0 -23
  322. package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  323. package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  324. package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  325. package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  326. package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  327. package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -23
  328. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +0 -3
  329. package/dist/types/plugins/card/pm-plugins/main.d.ts +0 -6
  330. package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  331. package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  332. package/dist/types/plugins/card/pm-plugins/reducers.d.ts +0 -3
  333. package/dist/types/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  334. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  335. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -31
  336. package/dist/types/plugins/card/toolbar.d.ts +0 -12
  337. package/dist/types/plugins/card/types.d.ts +0 -165
  338. package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  339. package/dist/types/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  340. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  341. package/dist/types/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  342. package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  343. package/dist/types/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  344. package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  345. package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  346. package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  347. package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  348. package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  349. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  350. package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  351. package/dist/types/plugins/card/utils.d.ts +0 -19
  352. package/dist/types-ts4.5/plugins/card/index.d.ts +0 -26
  353. package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -12
  354. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +0 -26
  355. package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -42
  356. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +0 -46
  357. package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +0 -37
  358. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +0 -23
  359. package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +0 -23
  360. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
  361. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
  362. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
  363. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
  364. package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
  365. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +0 -23
  366. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +0 -3
  367. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +0 -6
  368. package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
  369. package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
  370. package/dist/types-ts4.5/plugins/card/pm-plugins/reducers.d.ts +0 -3
  371. package/dist/types-ts4.5/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
  372. package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
  373. package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -31
  374. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +0 -12
  375. package/dist/types-ts4.5/plugins/card/types.d.ts +0 -165
  376. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
  377. package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
  378. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
  379. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
  380. package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
  381. package/dist/types-ts4.5/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
  382. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +0 -9
  383. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
  384. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +0 -19
  385. package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
  386. package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
  387. package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
  388. package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
  389. package/dist/types-ts4.5/plugins/card/utils.d.ts +0 -19
@@ -1,123 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
- import React from 'react';
11
- import PropTypes from 'prop-types';
12
- import { Card as SmartCard } from '@atlaskit/smart-card';
13
- import { UnsupportedInline } from '@atlaskit/editor-common/ui';
14
- import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
15
- import rafSchedule from 'raf-schd';
16
- import { Card } from './genericCard';
17
- import { registerCard } from '../pm-plugins/actions';
18
- export var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
19
- _inherits(InlineCardComponent, _React$PureComponent);
20
- var _super = _createSuper(InlineCardComponent);
21
- function InlineCardComponent() {
22
- var _this;
23
- _classCallCheck(this, InlineCardComponent);
24
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25
- args[_key] = arguments[_key];
26
- }
27
- _this = _super.call.apply(_super, [this].concat(args));
28
- _defineProperty(_assertThisInitialized(_this), "onClick", function () {});
29
- _defineProperty(_assertThisInitialized(_this), "onResolve", function (data) {
30
- var _this$props = _this.props,
31
- getPos = _this$props.getPos,
32
- view = _this$props.view;
33
- if (!getPos || typeof getPos === 'boolean') {
34
- return;
35
- }
36
- var title = data.title,
37
- url = data.url;
38
- // don't dispatch immediately since we might be in the middle of
39
- // rendering a nodeview
40
- rafSchedule(function () {
41
- // prosemirror-bump-fix
42
- var pos = getPos();
43
- if (typeof pos !== 'number') {
44
- return;
45
- }
46
- view.dispatch(registerCard({
47
- title: title,
48
- url: url,
49
- pos: pos
50
- })(view.state.tr));
51
- })();
52
- });
53
- _defineProperty(_assertThisInitialized(_this), "onError", function (data) {
54
- var url = data.url,
55
- err = data.err;
56
- if (err) {
57
- throw err;
58
- }
59
- _this.onResolve({
60
- url: url
61
- });
62
- });
63
- return _this;
64
- }
65
- _createClass(InlineCardComponent, [{
66
- key: "UNSAFE_componentWillMount",
67
- value: function UNSAFE_componentWillMount() {
68
- var view = this.props.view;
69
- var scrollContainer = findOverflowScrollParent(view.dom);
70
- this.scrollContainer = scrollContainer || undefined;
71
- }
72
- }, {
73
- key: "render",
74
- value: function render() {
75
- var _this$props2 = this.props,
76
- node = _this$props2.node,
77
- cardContext = _this$props2.cardContext,
78
- showServerActions = _this$props2.showServerActions,
79
- useAlternativePreloader = _this$props2.useAlternativePreloader;
80
- var _node$attrs = node.attrs,
81
- url = _node$attrs.url,
82
- data = _node$attrs.data;
83
- var card = /*#__PURE__*/React.createElement("span", {
84
- className: "card"
85
- }, /*#__PURE__*/React.createElement(SmartCard, {
86
- key: url,
87
- url: url,
88
- data: data,
89
- appearance: "inline",
90
- onClick: this.onClick,
91
- container: this.scrollContainer,
92
- onResolve: this.onResolve,
93
- onError: this.onError,
94
- inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
95
- showServerActions: showServerActions
96
- }));
97
- // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
98
- // otherwise if we got data, we can render the card directly since it doesn't need the Provider
99
- return cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
100
- value: cardContext.value
101
- }, card) : data ? card : null;
102
- }
103
- }]);
104
- return InlineCardComponent;
105
- }(React.PureComponent);
106
- _defineProperty(InlineCardComponent, "contextTypes", {
107
- contextAdapter: PropTypes.object
108
- });
109
- var WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
110
- export function InlineCardNodeView(props) {
111
- var useAlternativePreloader = props.useAlternativePreloader,
112
- node = props.node,
113
- view = props.view,
114
- getPos = props.getPos,
115
- showServerActions = props.showServerActions;
116
- return /*#__PURE__*/React.createElement(WrappedInlineCard, {
117
- node: node,
118
- view: view,
119
- getPos: getPos,
120
- showServerActions: showServerActions,
121
- useAlternativePreloader: useAlternativePreloader
122
- });
123
- }
@@ -1,102 +0,0 @@
1
- import { pluginKey } from './plugin-key';
2
- export var cardAction = function cardAction(tr, action) {
3
- return tr.setMeta(pluginKey, action);
4
- };
5
- export var resolveCard = function resolveCard(url) {
6
- return function (tr) {
7
- return cardAction(tr, {
8
- type: 'RESOLVE',
9
- url: url
10
- });
11
- };
12
- };
13
- export var queueCards = function queueCards(requests) {
14
- return function (tr) {
15
- return cardAction(tr, {
16
- type: 'QUEUE',
17
- requests: requests
18
- });
19
- };
20
- };
21
- export var registerCard = function registerCard(info) {
22
- return function (tr) {
23
- return cardAction(tr, {
24
- type: 'REGISTER',
25
- info: info
26
- });
27
- };
28
- };
29
- export var registerSmartCardEvents = function registerSmartCardEvents(smartLinkEvents) {
30
- return function (tr) {
31
- return cardAction(tr, {
32
- type: 'REGISTER_EVENTS',
33
- smartLinkEvents: smartLinkEvents
34
- });
35
- };
36
- };
37
- export var registerSmartCardEventsNext = function registerSmartCardEventsNext(smartLinkEvents) {
38
- return function (tr) {
39
- return cardAction(tr, {
40
- type: 'REGISTER_EVENTS_NEXT',
41
- smartLinkEvents: smartLinkEvents
42
- });
43
- };
44
- };
45
- export var setProvider = function setProvider(cardProvider) {
46
- return function (tr) {
47
- return cardAction(tr, {
48
- type: 'SET_PROVIDER',
49
- provider: cardProvider
50
- });
51
- };
52
- };
53
- export var setDatasourceTableRef = function setDatasourceTableRef(datasourceTableRef) {
54
- return function (tr) {
55
- return cardAction(tr, {
56
- type: 'SET_DATASOURCE_TABLE_REF',
57
- datasourceTableRef: datasourceTableRef
58
- });
59
- };
60
- };
61
- export var setCardLayout = function setCardLayout(layout) {
62
- return function (tr) {
63
- return cardAction(tr, {
64
- type: 'SET_CARD_LAYOUT',
65
- layout: layout
66
- });
67
- };
68
- };
69
- export var setCardLayoutAndDatasourceTableRef = function setCardLayoutAndDatasourceTableRef(_ref) {
70
- var layout = _ref.layout,
71
- datasourceTableRef = _ref.datasourceTableRef;
72
- return function (tr) {
73
- return cardAction(tr, {
74
- type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF',
75
- layout: layout,
76
- datasourceTableRef: datasourceTableRef
77
- });
78
- };
79
- };
80
- export var showLinkToolbar = function showLinkToolbar(tr) {
81
- return cardAction(tr, {
82
- type: 'SHOW_LINK_TOOLBAR'
83
- });
84
- };
85
- export var hideLinkToolbar = function hideLinkToolbar(tr) {
86
- return cardAction(tr, {
87
- type: 'HIDE_LINK_TOOLBAR'
88
- });
89
- };
90
- export var showDatasourceModal = function showDatasourceModal(modalType) {
91
- return function (tr) {
92
- return cardAction(tr, {
93
- type: 'SHOW_DATASOURCE_MODAL',
94
- modalType: modalType
95
- });
96
- };
97
- };
98
- export var hideDatasourceModal = function hideDatasourceModal(tr) {
99
- return cardAction(tr, {
100
- type: 'HIDE_DATASOURCE_MODAL'
101
- });
102
- };
@@ -1,41 +0,0 @@
1
- /**
2
- * Simple mechanism to defer analytics related callbacks
3
- */
4
- export var createAnalyticsQueue = function createAnalyticsQueue() {
5
- var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
6
- var queue = [];
7
- var callbacksRef = {
8
- current: null
9
- };
10
- var setCallbacks = function setCallbacks(callbacks) {
11
- callbacksRef.current = callbacks;
12
- };
13
- var push = function push() {
14
- var callbacks = callbacksRef.current;
15
- if (!enabled || !callbacks) {
16
- return;
17
- }
18
- queue.push.apply(queue, arguments);
19
- };
20
- var flush = function flush() {
21
- var callbacks = callbacksRef.current;
22
- if (!enabled || !callbacks) {
23
- return;
24
- }
25
- while (queue.length) {
26
- var event = queue.pop();
27
- if (event) {
28
- callbacks[event.type](event.data);
29
- }
30
- }
31
- };
32
- var getSize = function getSize() {
33
- return queue.length;
34
- };
35
- return {
36
- push: push,
37
- flush: flush,
38
- setCallbacks: setCallbacks,
39
- getSize: getSize
40
- };
41
- };
@@ -1,344 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _typeof from "@babel/runtime/helpers/typeof";
3
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
- 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; }
5
- 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; }
6
- import { AddMarkStep, RemoveMarkStep } from 'prosemirror-transform';
7
- import { ACTION } from '@atlaskit/editor-common/analytics';
8
- import { isLinkMark, pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
9
- import { getLinkMetadataFromTransaction } from '@atlaskit/editor-common/card';
10
- import { LinkMetaStep } from '@atlaskit/adf-schema/steps';
11
- import { getPluginState } from '../util/state';
12
- import { pluginKey } from '../plugin-key';
13
- import { isLink, linkObjectFromNode, getLinkUrl, getLinkNodeContext, appearanceForLink, findLinksAtPositions, areSameLinks } from './utils';
14
- var findLinksInNodeRange = function findLinksInNodeRange(doc, schema, from, to) {
15
- var links = [];
16
- doc.nodesBetween(from, to, function (node, pos) {
17
- if (isLink(schema, node)) {
18
- var entireLinkInRange = pos >= from && pos + node.nodeSize <= to;
19
- if (entireLinkInRange) {
20
- var link = linkObjectFromNode(doc, schema, node, pos);
21
- if (link) {
22
- links.push(link);
23
- }
24
- }
25
- }
26
- });
27
- return links;
28
- };
29
- export var findChangedLinks = function findChangedLinks(tr, state) {
30
- var schema = tr.doc.type.schema;
31
- var removed = [];
32
- var inserted = [];
33
- var updated = [];
34
- var queuedForUpgrade = isTransactionQueuedForUpgrade(tr);
35
- var isResolveReplace = isTransactionResolveReplace(tr);
36
-
37
- // History
38
- var historyMeta = tr.getMeta(pmHistoryPluginKey);
39
- var isUndo = isHistoryMeta(historyMeta) && historyMeta.redo === false;
40
- var isRedo = isHistoryMeta(historyMeta) && historyMeta.redo === true;
41
- var isUpdate = isUpdateTr(tr, isUndo || isRedo);
42
- var _loop = function _loop(i) {
43
- var _tr$docs$i, _tr$docs;
44
- var step = tr.steps[i];
45
- var stepMap = step.getMap();
46
- var removedInStep = [];
47
- var insertedInStep = [];
48
- var before = (_tr$docs$i = tr.docs[i]) !== null && _tr$docs$i !== void 0 ? _tr$docs$i : tr.before;
49
- var after = (_tr$docs = tr.docs[i + 1]) !== null && _tr$docs !== void 0 ? _tr$docs : tr.doc;
50
-
51
- /**
52
- * AddMarkStep and RemoveMarkSteps don't produce stepMap ranges
53
- * because there are no "changed tokens" only marks added/removed
54
- * So have to check these manually
55
- */
56
- if (step instanceof AddMarkStep) {
57
- var addMarkStep = step;
58
- if (isLinkMark(addMarkStep.mark, schema)) {
59
- /**
60
- * For url text pasted on plain text
61
- */
62
- insertedInStep.push({
63
- type: 'mark',
64
- pos: addMarkStep.from,
65
- mark: addMarkStep.mark,
66
- nodeContext: getLinkNodeContext(after, addMarkStep.from)
67
- });
68
- }
69
- }
70
- if (step instanceof RemoveMarkStep) {
71
- var removeMarkStep = step;
72
- if (isLinkMark(removeMarkStep.mark, schema)) {
73
- removedInStep.push({
74
- type: 'mark',
75
- pos: removeMarkStep.from,
76
- mark: removeMarkStep.mark,
77
- nodeContext: getLinkNodeContext(before, removeMarkStep.from)
78
- });
79
- }
80
- }
81
- stepMap.forEach(function (oldStart, oldEnd, newStart, newEnd) {
82
- var _tr$docs2;
83
- var before = tr.docs[i];
84
- var after = (_tr$docs2 = tr.docs[i + 1]) !== null && _tr$docs2 !== void 0 ? _tr$docs2 : tr.doc;
85
- var removedInRange = [];
86
- var insertedInRange = [];
87
-
88
- // Removed
89
- removedInRange.push.apply(removedInRange, _toConsumableArray(findLinksInNodeRange(before, schema, oldStart, oldEnd)));
90
- // Inserted
91
- insertedInRange.push.apply(insertedInRange, _toConsumableArray(findLinksInNodeRange(after, schema, newStart, newEnd)));
92
- removedInStep.push.apply(removedInStep, removedInRange);
93
- insertedInStep.push.apply(insertedInStep, insertedInRange);
94
- });
95
- var omitQueuedLinks = function omitQueuedLinks(links) {
96
- if (!queuedForUpgrade) {
97
- return links;
98
- }
99
- /**
100
- * Skip/filter out links that have been queued, they will be tracked later
101
- */
102
- var queuedPositions = getQueuedPositions(tr);
103
- return links.filter(function (link) {
104
- return !queuedPositions.includes(link.pos);
105
- });
106
- };
107
-
108
- /**
109
- * Skip "deletions" when the transaction is relating to
110
- * replacing links queued for upgrade to cards,
111
- * because the "deleted" link has not actually been
112
- * tracked as "created" yet
113
- */
114
- if (!isResolveReplace) {
115
- removed.push.apply(removed, removedInStep);
116
- }
117
- inserted.push.apply(inserted, _toConsumableArray(omitQueuedLinks(insertedInStep)));
118
- };
119
- for (var i = 0; i < tr.steps.length; i++) {
120
- _loop(i);
121
- }
122
-
123
- /**
124
- * If there are no links changed but the transaction is a "resolve" action
125
- * Then this means we have resolved a link but it has failed to upgrade
126
- * We should track all resolved links as now being created
127
- */
128
- if (inserted.length === 0 && isResolveReplace) {
129
- var positions = getResolvePositions(tr, state);
130
- inserted.push.apply(inserted, _toConsumableArray(findLinksAtPositions(tr, positions)));
131
- }
132
- if (!isUpdate) {
133
- var _getLinkMetadataFromT = getLinkMetadataFromTransaction(tr),
134
- inputMethod = _getLinkMetadataFromT.inputMethod;
135
- /**
136
- * If there is no identifiable input method, and the links inserted and removed appear to be the same,
137
- * then this transaction likely is not intended to be consided to be the insertion and removal of links
138
- */
139
- if (!inputMethod && areSameLinks(removed, inserted)) {
140
- return {
141
- removed: [],
142
- inserted: [],
143
- updated: updated
144
- };
145
- }
146
- return {
147
- removed: removed,
148
- inserted: inserted,
149
- updated: updated
150
- };
151
- }
152
- for (var _i = 0; _i < inserted.length; _i++) {
153
- if (isResolveReplace) {
154
- var newLink = inserted[_i];
155
-
156
- // what is the 2nd argument 'assoc = -1' doing here exactly?
157
- var mappedPos = tr.mapping.map(newLink.pos, -1);
158
- var previousDisplay = getResolveLinkPrevDisplay(state, mappedPos);
159
- updated.push({
160
- inserted: inserted[_i],
161
- previous: {
162
- display: previousDisplay
163
- }
164
- });
165
- continue;
166
- }
167
- if (inserted.length === removed.length) {
168
- updated.push({
169
- removed: removed[_i],
170
- inserted: inserted[_i]
171
- });
172
- }
173
- }
174
- return {
175
- inserted: [],
176
- removed: [],
177
- updated: updated
178
- };
179
- };
180
-
181
- /**
182
- * List of actions to be considered link "updates"
183
- */
184
- var UPDATE_ACTIONS = [ACTION.CHANGED_TYPE, ACTION.UPDATED];
185
-
186
- /**
187
- * Returns true if the transaction has LinkMetaSteps that indicate the transaction is
188
- * intended to be perceived as an update to links, rather than insertion+deletion
189
- */
190
- var isUpdateTr = function isUpdateTr(tr, isUndoOrRedo) {
191
- return !!tr.steps.find(function (step) {
192
- if (!(step instanceof LinkMetaStep)) {
193
- return false;
194
- }
195
- var _step$getMetadata = step.getMetadata(),
196
- action = _step$getMetadata.action,
197
- cardAction = _step$getMetadata.cardAction;
198
-
199
- /**
200
- * Undo of a resolve step should be considered an update
201
- * because the user is choosing to update the url back to the un-upgraded display
202
- */
203
- if (cardAction === 'RESOLVE' && isUndoOrRedo) {
204
- return true;
205
- }
206
- if (!action) {
207
- return false;
208
- }
209
- return UPDATE_ACTIONS.includes(action);
210
- });
211
- };
212
- var hasType = function hasType(pluginMeta) {
213
- return _typeof(pluginMeta) === 'object' && pluginMeta !== null && 'type' in pluginMeta;
214
- };
215
- var isTransactionQueuedForUpgrade = function isTransactionQueuedForUpgrade(tr) {
216
- var pluginMeta = tr.getMeta(pluginKey);
217
- return hasType(pluginMeta) && pluginMeta.type === 'QUEUE';
218
- };
219
- var isTransactionResolveReplace = function isTransactionResolveReplace(tr) {
220
- var pluginMeta = tr.getMeta(pluginKey);
221
- return hasType(pluginMeta) && pluginMeta.type === 'RESOLVE';
222
- };
223
- var isHistoryMeta = function isHistoryMeta(meta) {
224
- return _typeof(meta) === 'object' && meta !== null && 'redo' in meta;
225
- };
226
- var getQueuedPositions = function getQueuedPositions(tr) {
227
- var pluginMeta = tr.getMeta(pluginKey);
228
- if (!isTransactionQueuedForUpgrade(tr)) {
229
- return [];
230
- }
231
- return pluginMeta.requests.map(function (_ref) {
232
- var pos = _ref.pos;
233
- return pos;
234
- });
235
- };
236
- var getResolvePositions = function getResolvePositions(tr, state) {
237
- var cardState = getPluginState(state);
238
- if (!cardState) {
239
- return [];
240
- }
241
- var pluginMeta = tr.getMeta(pluginKey);
242
- if (!isTransactionResolveReplace(tr)) {
243
- return [];
244
- }
245
- return cardState.requests.filter(function (request) {
246
- return request.url === pluginMeta.url;
247
- }).map(function (request) {
248
- return request.pos;
249
- });
250
- };
251
- var getResolveLinkPrevDisplay = function getResolveLinkPrevDisplay(state, pos) {
252
- var _cardState$requests$f;
253
- var cardState = getPluginState(state);
254
- if (!cardState) {
255
- return undefined;
256
- }
257
- return (_cardState$requests$f = cardState.requests.find(function (request) {
258
- return request.pos === pos;
259
- })) === null || _cardState$requests$f === void 0 ? void 0 : _cardState$requests$f.previousAppearance;
260
- };
261
- export function eventsFromTransaction(tr, state) {
262
- var events = [];
263
- try {
264
- /**
265
- * Skip transactions sent by collab (identified by 'isRemote' key)
266
- * Skip entire document replace steps
267
- * We are only concerned with transactions performed on the document directly by the user
268
- */
269
- var isRemote = tr.getMeta('isRemote');
270
- var isReplaceDocument = tr.getMeta('replaceDocument');
271
- if (isRemote || isReplaceDocument) {
272
- return events;
273
- }
274
- var historyMeta = tr.getMeta(pmHistoryPluginKey);
275
- var isUndo = isHistoryMeta(historyMeta) && historyMeta.redo === false;
276
- var isRedo = isHistoryMeta(historyMeta) && historyMeta.redo === true;
277
-
278
- /**
279
- * Retrieve metadata from the LinkMetaStep(s) in the transaction
280
- */
281
- var _getLinkMetadataFromT2 = getLinkMetadataFromTransaction(tr),
282
- action = _getLinkMetadataFromT2.action,
283
- inputMethod = _getLinkMetadataFromT2.inputMethod,
284
- sourceEvent = _getLinkMetadataFromT2.sourceEvent;
285
- var contextualData = {
286
- action: action,
287
- inputMethod: inputMethod,
288
- sourceEvent: sourceEvent,
289
- isUndo: isUndo,
290
- isRedo: isRedo
291
- };
292
- var _findChangedLinks = findChangedLinks(tr, state),
293
- removed = _findChangedLinks.removed,
294
- inserted = _findChangedLinks.inserted,
295
- updated = _findChangedLinks.updated;
296
- var MAX_LINK_EVENTS = 50;
297
- if ([removed, inserted, updated].some(function (arr) {
298
- return arr.length > MAX_LINK_EVENTS;
299
- })) {
300
- return [];
301
- }
302
- for (var i = 0; i < updated.length; i++) {
303
- var _update$previous$disp;
304
- var update = updated[i];
305
- var link = update.inserted;
306
- var url = getLinkUrl(link);
307
- var display = appearanceForLink(link);
308
- var previousDisplay = 'removed' in update ? appearanceForLink(update.removed) : (_update$previous$disp = update.previous.display) !== null && _update$previous$disp !== void 0 ? _update$previous$disp : 'unknown';
309
- if (url) {
310
- events.push({
311
- type: 'updated',
312
- data: _objectSpread(_objectSpread({}, contextualData), {}, {
313
- url: url,
314
- display: display,
315
- previousDisplay: previousDisplay,
316
- nodeContext: link.nodeContext
317
- })
318
- });
319
- }
320
- }
321
- var pushEvents = function pushEvents(links, type) {
322
- for (var _i2 = 0; _i2 < links.length; _i2++) {
323
- var _link = links[_i2];
324
- var _url = getLinkUrl(_link);
325
- var _display = appearanceForLink(_link);
326
- if (_url) {
327
- events.push({
328
- type: type,
329
- data: _objectSpread(_objectSpread({}, contextualData), {}, {
330
- url: _url,
331
- display: _display,
332
- nodeContext: _link.nodeContext
333
- })
334
- });
335
- }
336
- }
337
- };
338
- pushEvents(removed, 'deleted');
339
- pushEvents(inserted, 'created');
340
- return events;
341
- } catch (err) {
342
- return events;
343
- }
344
- }
@@ -1,2 +0,0 @@
1
- export { createAnalyticsQueue } from './create-analytics-queue';
2
- export { eventsFromTransaction } from './events-from-tr';
@@ -1 +0,0 @@
1
- export {};