@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,199 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { NodeSelection } from 'prosemirror-state';
4
- import rafSchedule from 'raf-schd';
5
- import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
6
- import { BlockCard } from '../nodeviews/blockCard';
7
- import { EmbedCard } from '../nodeviews/embedCard';
8
- import { InlineCardNodeView } from '../nodeviews/inlineCard';
9
- import { pluginKey } from './plugin-key';
10
- import reducer from './reducers';
11
- import { handleProvider, resolveWithProvider } from './util/resolve';
12
- import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
13
- import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
14
- import { Datasource } from '../nodeviews/datasource';
15
- import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
16
- import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
17
- import { findDomRefAtPos } from 'prosemirror-utils';
18
- export { pluginKey } from './plugin-key';
19
- import { canRenderDatasource } from '@atlaskit/editor-common/utils';
20
- export var createPlugin = function createPlugin(options, pluginInjectionApi) {
21
- return function (pmPluginFactoryParams) {
22
- var lpAnalyticsEventsNext = pmPluginFactoryParams.featureFlags.lpAnalyticsEventsNext;
23
- var analyticsQueue = createAnalyticsQueue(!!lpAnalyticsEventsNext);
24
- var editorAppearance = options.editorAppearance,
25
- platform = options.platform,
26
- allowResizing = options.allowResizing,
27
- useAlternativePreloader = options.useAlternativePreloader,
28
- fullWidthMode = options.fullWidthMode,
29
- showServerActions = options.showServerActions;
30
- var inlineCardViewProducer = getInlineNodeViewProducer({
31
- pmPluginFactoryParams: pmPluginFactoryParams,
32
- Component: InlineCardNodeView,
33
- extraComponentProps: {
34
- useAlternativePreloader: useAlternativePreloader,
35
- showServerActions: showServerActions
36
- }
37
- });
38
- return new SafePlugin({
39
- state: {
40
- init: function init() {
41
- return {
42
- requests: [],
43
- provider: null,
44
- cards: [],
45
- showLinkingToolbar: false,
46
- smartLinkEvents: undefined,
47
- smartLinkEventsNext: undefined,
48
- editorAppearance: editorAppearance,
49
- showDatasourceModal: false,
50
- datasourceModalType: undefined,
51
- datasourceTableRef: undefined,
52
- layout: undefined
53
- };
54
- },
55
- apply: function apply(tr, pluginState, prevEditorState) {
56
- // Update all the positions of outstanding requests and
57
- // cards in the plugin state.
58
- var pluginStateWithUpdatedPos = getPluginStateWithUpdatedPos(pluginState, tr);
59
-
60
- // apply any actions
61
- var meta = tr.getMeta(pluginKey);
62
- var events = eventsFromTransaction(tr, prevEditorState);
63
- analyticsQueue.push.apply(analyticsQueue, _toConsumableArray(events));
64
- if (meta) {
65
- var nextState = reducer(pluginStateWithUpdatedPos, meta);
66
- if (!pluginState.smartLinkEventsNext && nextState.smartLinkEventsNext) {
67
- analyticsQueue.setCallbacks(nextState.smartLinkEventsNext);
68
- }
69
- return nextState;
70
- }
71
- return pluginStateWithUpdatedPos;
72
- }
73
- },
74
- view: function view(_view) {
75
- var subscriptionHandler = function subscriptionHandler(name, provider) {
76
- return handleProvider(name, provider, _view);
77
- };
78
- var domAtPos = _view.domAtPos.bind(_view);
79
- var rafCancellationCallbacks = [];
80
- pmPluginFactoryParams.providerFactory.subscribe('cardProvider', subscriptionHandler);
81
- return {
82
- update: function update(view, prevState) {
83
- var _selection$node;
84
- var currentState = getPluginState(view.state);
85
- var oldState = getPluginState(prevState);
86
- var state = view.state,
87
- dispatch = view.dispatch;
88
- var selection = state.selection,
89
- tr = state.tr,
90
- schema = state.schema;
91
- var isBlockCardSelected = selection instanceof NodeSelection && ((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type) === schema.nodes.blockCard;
92
- if (isBlockCardSelected) {
93
- var _findDomRefAtPos, _node$attrs;
94
- var datasourceTableRef = (_findDomRefAtPos = findDomRefAtPos(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(DATASOURCE_INNER_CONTAINER_CLASSNAME));
95
- var node = selection.node;
96
- var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource);
97
- var shouldUpdateTableRef = datasourceTableRef && (currentState === null || currentState === void 0 ? void 0 : currentState.datasourceTableRef) !== datasourceTableRef;
98
- if (isDatasource && shouldUpdateTableRef) {
99
- var _node$attrs2;
100
- // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
101
- var layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
102
-
103
- // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
104
- dispatch(setCardLayoutAndDatasourceTableRef({
105
- datasourceTableRef: datasourceTableRef,
106
- layout: layout
107
- })(tr));
108
- }
109
- } else {
110
- if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
111
- dispatch(setDatasourceTableRef(undefined)(tr));
112
- }
113
- }
114
- if (currentState && currentState.provider) {
115
- // Find requests in this state that weren't in the old one.
116
- var newRequests = getNewRequests(oldState, currentState);
117
- // Ask the CardProvider to resolve all new requests.
118
- var provider = currentState.provider;
119
- newRequests.forEach(function (request) {
120
- /**
121
- * Queue each asynchronous resolve request on separate frames.
122
- * ---
123
- * NB: The promise for each request is queued to take place on separate animation frames. This avoids
124
- * the scenario debugged and discovered in EDM-668, wherein the queuing of too many promises in quick succession
125
- * leads to the browser's macrotask queue being overwhelmed, locking interactivity of the browser tab.
126
- * By using this approach, the browser is free to schedule the resolution of the promises below in between rendering/network/
127
- * other tasks as per common implementations of the JavaScript event loop in browsers.
128
- */
129
- var invoke = rafSchedule(function () {
130
- var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
131
- return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.sharedState.currentState()) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.createAnalyticsEvent) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : undefined);
132
- });
133
- rafCancellationCallbacks.push(invoke.cancel);
134
- invoke();
135
- });
136
- }
137
- analyticsQueue.flush();
138
- },
139
- destroy: function destroy() {
140
- // Cancel any outstanding raf callbacks.
141
- rafCancellationCallbacks.forEach(function (cancellationCallback) {
142
- return cancellationCallback();
143
- });
144
- pmPluginFactoryParams.providerFactory.unsubscribe('cardProvider', subscriptionHandler);
145
- }
146
- };
147
- },
148
- props: {
149
- nodeViews: {
150
- inlineCard: inlineCardViewProducer,
151
- blockCard: function blockCard(node, view, getPos, decorations) {
152
- var _node$attrs3;
153
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
154
- eventDispatcher = pmPluginFactoryParams.eventDispatcher;
155
- var reactComponentProps = {
156
- platform: platform,
157
- showServerActions: showServerActions
158
- };
159
- var hasIntlContext = true;
160
- var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
161
- if (isDatasource) {
162
- var _node$attrs4, _node$attrs4$datasour;
163
- if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
164
- return new Datasource({
165
- node: node,
166
- view: view,
167
- getPos: getPos,
168
- portalProviderAPI: portalProviderAPI,
169
- eventDispatcher: eventDispatcher,
170
- hasIntlContext: hasIntlContext,
171
- pluginInjectionApi: pluginInjectionApi
172
- }).init();
173
- } else {
174
- return inlineCardViewProducer(node, view, getPos, decorations);
175
- }
176
- }
177
- return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
178
- },
179
- embedCard: function embedCard(node, view, getPos) {
180
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
181
- eventDispatcher = pmPluginFactoryParams.eventDispatcher,
182
- dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
183
- var reactComponentProps = {
184
- eventDispatcher: eventDispatcher,
185
- allowResizing: allowResizing,
186
- platform: platform,
187
- fullWidthMode: fullWidthMode,
188
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
189
- pluginInjectionApi: pluginInjectionApi
190
- };
191
- var hasIntlContext = true;
192
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
193
- }
194
- }
195
- },
196
- key: pluginKey
197
- });
198
- };
199
- };
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
4
- export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
5
- return new SafePlugin({
6
- view: function view(editorView) {
7
- requestAnimationFrame(function () {
8
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
9
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.hyperlink) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.prependToolbarButtons({
10
- items: function items(state, intl, providerFactory, link) {
11
- return [{
12
- type: 'custom',
13
- fallback: [],
14
- render: function render(editorView) {
15
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
16
- return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
17
- key: "link-appearance",
18
- url: link,
19
- intl: intl,
20
- editorView: editorView,
21
- editorState: state,
22
- cardOptions: options,
23
- providerFactory: providerFactory,
24
- platform: options === null || options === void 0 ? void 0 : options.platform,
25
- editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions,
26
- cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions
27
- });
28
- }
29
- }];
30
- },
31
- onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions.hideLinkToolbar,
32
- onInsertLinkCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions.queueCardsFromChangedTr,
33
- view: editorView
34
- });
35
- });
36
- return {};
37
- }
38
- });
39
- };
@@ -1,2 +0,0 @@
1
- import { PluginKey } from 'prosemirror-state';
2
- export var pluginKey = new PluginKey('cardPlugin');
@@ -1,103 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- var queue = function queue(state, action) {
5
- return _objectSpread(_objectSpread({}, state), {}, {
6
- requests: state.requests.concat(action.requests)
7
- });
8
- };
9
- var resolve = function resolve(state, action) {
10
- var requests = state.requests.reduce(function (requests, request) {
11
- if (request.url !== action.url) {
12
- requests.push(request);
13
- }
14
- return requests;
15
- }, []);
16
- return _objectSpread(_objectSpread({}, state), {}, {
17
- requests: requests
18
- });
19
- };
20
- var register = function register(state, action) {
21
- return _objectSpread(_objectSpread({}, state), {}, {
22
- cards: state.cards.filter(function (card) {
23
- return card.pos !== action.info.pos;
24
- }).concat(action.info)
25
- });
26
- };
27
- var setProvider = function setProvider(state, action) {
28
- return _objectSpread(_objectSpread({}, state), {}, {
29
- provider: action.provider
30
- });
31
- };
32
- var setCardLayout = function setCardLayout(state, action) {
33
- return _objectSpread(_objectSpread({}, state), {}, {
34
- layout: action.layout
35
- });
36
- };
37
- var setDatasourceTableRef = function setDatasourceTableRef(state, action) {
38
- return _objectSpread(_objectSpread({}, state), {}, {
39
- datasourceTableRef: action.datasourceTableRef
40
- });
41
- };
42
- var setCardLayoutDatasourceTableRef = function setCardLayoutDatasourceTableRef(state, action) {
43
- return _objectSpread(_objectSpread({}, state), {}, {
44
- datasourceTableRef: action.datasourceTableRef,
45
- layout: action.layout
46
- });
47
- };
48
- var registerEvents = function registerEvents(state, action) {
49
- return _objectSpread(_objectSpread({}, state), {}, {
50
- smartLinkEvents: action.smartLinkEvents
51
- });
52
- };
53
- var registerEventsNext = function registerEventsNext(state, action) {
54
- return _objectSpread(_objectSpread({}, state), {}, {
55
- smartLinkEventsNext: action.smartLinkEvents
56
- });
57
- };
58
- var setLinkToolbar = function setLinkToolbar(state, action) {
59
- return _objectSpread(_objectSpread({}, state), {}, {
60
- showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
61
- });
62
- };
63
- var showDatasourceModal = function showDatasourceModal(state, action) {
64
- return _objectSpread(_objectSpread({}, state), {}, {
65
- showDatasourceModal: true,
66
- datasourceModalType: action.type === 'SHOW_DATASOURCE_MODAL' ? action.modalType : undefined
67
- });
68
- };
69
- var hideDatasourceModal = function hideDatasourceModal(state) {
70
- return _objectSpread(_objectSpread({}, state), {}, {
71
- showDatasourceModal: false,
72
- datasourceModalType: undefined
73
- });
74
- };
75
- export default (function (state, action) {
76
- switch (action.type) {
77
- case 'QUEUE':
78
- return queue(state, action);
79
- case 'SET_PROVIDER':
80
- return setProvider(state, action);
81
- case 'RESOLVE':
82
- return resolve(state, action);
83
- case 'REGISTER':
84
- return register(state, action);
85
- case 'REGISTER_EVENTS':
86
- return registerEvents(state, action);
87
- case 'REGISTER_EVENTS_NEXT':
88
- return registerEventsNext(state, action);
89
- case 'SET_DATASOURCE_TABLE_REF':
90
- return setDatasourceTableRef(state, action);
91
- case 'SET_CARD_LAYOUT':
92
- return setCardLayout(state, action);
93
- case 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF':
94
- return setCardLayoutDatasourceTableRef(state, action);
95
- case 'SHOW_LINK_TOOLBAR':
96
- case 'HIDE_LINK_TOOLBAR':
97
- return setLinkToolbar(state, action);
98
- case 'SHOW_DATASOURCE_MODAL':
99
- return showDatasourceModal(state, action);
100
- case 'HIDE_DATASOURCE_MODAL':
101
- return hideDatasourceModal(state);
102
- }
103
- });
@@ -1,29 +0,0 @@
1
- import { normalizeUrl } from '@atlaskit/adf-schema';
2
- import { md } from '@atlaskit/editor-common/paste';
3
- export function shouldReplaceLink(node) {
4
- var compareLinkText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5
- var compareToUrl = arguments.length > 2 ? arguments[2] : undefined;
6
- var linkMark = node.marks.find(function (mark) {
7
- return mark.type.name === 'link';
8
- });
9
- if (!linkMark) {
10
- // not a link anymore
11
- return false;
12
- }
13
-
14
- // ED-6041: compare normalised link text after linkfy from Markdown transformer
15
- // instead, since it always decodes URL ('%20' -> ' ') on the link text
16
-
17
- var normalisedHref = normalizeUrl(md.normalizeLinkText(linkMark.attrs.href));
18
- var normalizedLinkText = normalizeUrl(md.normalizeLinkText(node.text || ''));
19
- if (compareLinkText && normalisedHref !== normalizedLinkText) {
20
- return false;
21
- }
22
- if (compareToUrl) {
23
- var normalizedUrl = normalizeUrl(md.normalizeLinkText(compareToUrl));
24
- if (normalizedUrl !== normalisedHref) {
25
- return false;
26
- }
27
- }
28
- return true;
29
- }
@@ -1,50 +0,0 @@
1
- import { setProvider } from '../actions';
2
- import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
3
- // ============================================================================ //
4
- // ============================== PROVIDER UTILS ============================== //
5
- // ============================================================================ //
6
- // Used for all interactions with the EditorCardProvider.
7
- // ============================================================================ //
8
- export var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
9
- // When user manually changes appearance from blue link to smart link, we should respect that,
10
- var shouldForceAppearance =
11
- // This flag is set to true only in one place atm:
12
- // packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
13
- // Which is used when user switching from URL to smart link appearance.
14
- !!request.shouldReplaceLink;
15
- var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
16
- return handleResolve;
17
- };
18
- var updateCardType = function updateCardType(resolvedCard, options) {
19
- if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
20
- // clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
21
- if (resolvedCard.type === 'embedCard') {
22
- delete resolvedCard.attrs.layout;
23
- }
24
- resolvedCard.type = 'inlineCard';
25
- }
26
- };
27
- var handleResolved = function handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options) {
28
- return function (resolvedCard) {
29
- updateCardType(resolvedCard, options);
30
- replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
31
- return resolvedCard;
32
- };
33
- };
34
- var handleRejected = function handleRejected(view, request, editorAnalyticsApi) {
35
- return function () {
36
- handleFallbackWithAnalytics(request, editorAnalyticsApi)(view.state, view.dispatch);
37
- };
38
- };
39
-
40
- // listen for card provider changes
41
- export var handleProvider = function handleProvider(_, provider, view) {
42
- if (!provider) {
43
- return;
44
- }
45
- provider.then(function (cardProvider) {
46
- var state = view.state,
47
- dispatch = view.dispatch;
48
- dispatch(setProvider(cardProvider)(state.tr));
49
- });
50
- };
@@ -1,40 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- import { pluginKey } from '../plugin-key';
5
-
6
- // ============================================================================ //
7
- // ============================== PLUGIN STATE ================================ //
8
- // ============================================================================ //
9
- // Used for interactions with the Card Plugin's state.
10
- // ============================================================================ //
11
- export var getPluginState = function getPluginState(editorState) {
12
- return pluginKey.getState(editorState);
13
- };
14
- export var getPluginStateWithUpdatedPos = function getPluginStateWithUpdatedPos(pluginState, tr) {
15
- return _objectSpread(_objectSpread({}, pluginState), {}, {
16
- requests: pluginState.requests.map(function (request) {
17
- return _objectSpread(_objectSpread({}, request), {}, {
18
- pos: tr.mapping.map(request.pos)
19
- });
20
- }),
21
- cards: pluginState.cards.map(function (card) {
22
- return _objectSpread(_objectSpread({}, card), {}, {
23
- pos: tr.mapping.map(card.pos)
24
- });
25
- })
26
- });
27
- };
28
- export var getNewRequests = function getNewRequests(oldState, currentState) {
29
- if (oldState) {
30
- return currentState.requests.filter(function (req) {
31
- return !oldState.requests.find(function (oldReq) {
32
- return isSameRequest(oldReq, req);
33
- });
34
- });
35
- }
36
- return currentState.requests;
37
- };
38
- var isSameRequest = function isSameRequest(requestA, requestB) {
39
- return requestA.url === requestB.url && requestA.pos === requestB.pos;
40
- };