@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,332 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- /** @jsx jsx */
4
- import React from 'react';
5
- import { jsx } from '@emotion/react';
6
- import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from 'prosemirror-utils';
7
- import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } from '@atlaskit/editor-common/ui';
8
- import { akEditorMediaResizeHandlerPaddingWide, akEditorBreakoutPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
9
- import { embedHeaderHeight } from '@atlaskit/smart-card';
10
- import { wrapperStyle, Resizer, handleSides, imageAlignmentMap, snapTo, calcMediaPxWidth } from '@atlaskit/editor-common/ui';
11
- import { embedSpacingStyles } from '@atlaskit/editor-common/styles';
12
- export default class ResizableEmbedCard extends React.Component {
13
- constructor(...args) {
14
- super(...args);
15
- _defineProperty(this, "state", {
16
- offsetLeft: this.calcOffsetLeft()
17
- });
18
- _defineProperty(this, "calcNewSize", (newWidth, stop) => {
19
- const {
20
- layout,
21
- view: {
22
- state
23
- }
24
- } = this.props;
25
- const newPct = calcPctFromPx(newWidth, this.props.lineLength) * 100;
26
- this.setState({
27
- resizedPctWidth: newPct
28
- });
29
- let newLayout = hasParentNodeOfType(state.schema.nodes.table)(state.selection) ? layout : this.calcUnwrappedLayout(newPct, newWidth);
30
- if (newPct <= 100) {
31
- if (this.wrappedLayout && (stop ? newPct !== 100 : true)) {
32
- newLayout = layout;
33
- }
34
- return {
35
- width: newPct,
36
- layout: newLayout
37
- };
38
- } else {
39
- return {
40
- width: this.props.pctWidth || null,
41
- layout: newLayout
42
- };
43
- }
44
- });
45
- _defineProperty(this, "calcUnwrappedLayout", (pct, width) => {
46
- if (pct <= 100) {
47
- return 'center';
48
- }
49
- if (width <= this.wideLayoutWidth) {
50
- return 'wide';
51
- }
52
- return 'full-width';
53
- });
54
- _defineProperty(this, "calcColumnLeftOffset", () => {
55
- const {
56
- offsetLeft
57
- } = this.state;
58
- return this.insideInlineLike ? calcColumnsFromPx(offsetLeft, this.props.lineLength, this.props.gridSize) : 0;
59
- });
60
- _defineProperty(this, "calcPxWidth", useLayout => {
61
- const {
62
- layout,
63
- pctWidth,
64
- lineLength,
65
- containerWidth,
66
- fullWidthMode,
67
- getPos,
68
- view: {
69
- state
70
- }
71
- } = this.props;
72
- const {
73
- resizedPctWidth
74
- } = this.state;
75
- const pos = typeof getPos === 'function' ? getPos() : undefined;
76
- return calcMediaPxWidth({
77
- origWidth: DEFAULT_EMBED_CARD_WIDTH,
78
- origHeight: DEFAULT_EMBED_CARD_HEIGHT,
79
- pctWidth,
80
- state,
81
- containerWidth: {
82
- width: containerWidth,
83
- lineLength
84
- },
85
- isFullWidthModeEnabled: fullWidthMode,
86
- layout: useLayout || layout,
87
- pos: pos,
88
- resizedPctWidth
89
- });
90
- });
91
- _defineProperty(this, "highlights", (newWidth, snapPoints) => {
92
- const snapWidth = snapTo(newWidth, snapPoints);
93
- const {
94
- layoutColumn,
95
- table,
96
- expand,
97
- nestedExpand
98
- } = this.props.view.state.schema.nodes;
99
- if (this.$pos && !!findParentNodeOfTypeClosestToPos(this.$pos, [layoutColumn, table, expand, nestedExpand].filter(Boolean))) {
100
- return [];
101
- }
102
- if (snapWidth > this.wideLayoutWidth) {
103
- return ['full-width'];
104
- }
105
- const {
106
- layout,
107
- lineLength,
108
- gridSize
109
- } = this.props;
110
- const columns = calcColumnsFromPx(snapWidth, lineLength, gridSize);
111
- const columnWidth = Math.round(columns);
112
- const highlight = [];
113
- if (layout === 'wrap-left' || layout === 'align-start') {
114
- highlight.push(0, columnWidth);
115
- } else if (layout === 'wrap-right' || layout === 'align-end') {
116
- highlight.push(gridSize, gridSize - columnWidth);
117
- } else if (this.insideInlineLike) {
118
- highlight.push(Math.round(columns + this.calcColumnLeftOffset()));
119
- } else {
120
- highlight.push(Math.floor((gridSize - columnWidth) / 2), Math.ceil((gridSize + columnWidth) / 2));
121
- }
122
- return highlight;
123
- });
124
- }
125
- componentDidUpdate() {
126
- const offsetLeft = this.calcOffsetLeft();
127
- if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
128
- this.setState({
129
- offsetLeft
130
- });
131
- }
132
- }
133
- get wrappedLayout() {
134
- return wrappedLayouts.indexOf(this.props.layout) > -1;
135
- }
136
- UNSAFE_componentWillReceiveProps(nextProps) {
137
- if (this.props.layout !== nextProps.layout) {
138
- this.checkLayout(this.props.layout, nextProps.layout);
139
- }
140
- }
141
-
142
- /**
143
- * When returning to center layout from a wrapped/aligned layout, it might actually
144
- * be wide or full-width
145
- */
146
- checkLayout(oldLayout, newLayout) {
147
- const {
148
- resizedPctWidth
149
- } = this.state;
150
- if (wrappedLayouts.indexOf(oldLayout) > -1 && newLayout === 'center' && resizedPctWidth) {
151
- const layout = this.calcUnwrappedLayout(resizedPctWidth, this.calcPxWidth(newLayout));
152
- this.props.updateSize(resizedPctWidth, layout);
153
- }
154
- }
155
- get $pos() {
156
- if (typeof this.props.getPos !== 'function') {
157
- return null;
158
- }
159
- const pos = this.props.getPos();
160
- if (Number.isNaN(pos) || typeof pos !== 'number') {
161
- return null;
162
- }
163
-
164
- // need to pass view because we may not get updated props in time
165
- return this.props.view.state.doc.resolve(pos);
166
- }
167
-
168
- /**
169
- * The maxmimum number of grid columns this node can resize to.
170
- */
171
- get gridWidth() {
172
- const {
173
- gridSize
174
- } = this.props;
175
- return !(this.wrappedLayout || this.insideInlineLike) ? gridSize / 2 : gridSize;
176
- }
177
- calcOffsetLeft() {
178
- let offsetLeft = 0;
179
- if (this.wrapper && this.insideInlineLike) {
180
- const currentNode = this.wrapper;
181
- const boundingRect = currentNode.getBoundingClientRect();
182
- const pmRect = this.props.view.dom.getBoundingClientRect();
183
- offsetLeft = boundingRect.left - pmRect.left;
184
- }
185
- return offsetLeft;
186
- }
187
- get wideLayoutWidth() {
188
- const {
189
- lineLength
190
- } = this.props;
191
- if (lineLength) {
192
- return Math.ceil(lineLength * breakoutWideScaleRatio);
193
- } else {
194
- return akEditorWideLayoutWidth;
195
- }
196
- }
197
- calcSnapPoints() {
198
- const {
199
- offsetLeft
200
- } = this.state;
201
- const {
202
- containerWidth,
203
- lineLength
204
- } = this.props;
205
- const snapTargets = [];
206
- for (let i = 0; i < this.gridWidth; i++) {
207
- snapTargets.push(calcPxFromColumns(i, lineLength, this.gridWidth) - offsetLeft);
208
- }
209
- // full width
210
- snapTargets.push(lineLength - offsetLeft);
211
- const minimumWidth = calcPxFromColumns(this.wrappedLayout || this.insideInlineLike ? 1 : 2, lineLength, this.props.gridSize);
212
- let snapPoints = snapTargets.filter(width => width >= minimumWidth);
213
- const $pos = this.$pos;
214
- if (!$pos) {
215
- return snapPoints;
216
- }
217
- const isTopLevel = $pos.parent.type.name === 'doc';
218
- if (isTopLevel) {
219
- snapPoints.push(this.wideLayoutWidth);
220
- const fullWidthPoint = containerWidth - akEditorBreakoutPadding;
221
- if (fullWidthPoint > this.wideLayoutWidth) {
222
- snapPoints.push(fullWidthPoint);
223
- }
224
- }
225
- return snapPoints;
226
- }
227
- get insideInlineLike() {
228
- const $pos = this.$pos;
229
- if (!$pos) {
230
- return false;
231
- }
232
- const {
233
- listItem
234
- } = this.props.view.state.schema.nodes;
235
- return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
236
- }
237
- /**
238
- * Previously height of the box was controlled with paddingTop/paddingBottom trick inside Wrapper.
239
- * It allowed height to be defined by a given percent ratio and so absolute value was defined by actual width.
240
- * Also, it was part of styled component, which was fine because it was static through out life time of component.
241
- *
242
- * Now, two things changed:
243
- * 1. If `height` is present we take it as actual height of the box, and hence we don't need
244
- * (or even can't have, due to lack of width value) paddingTop trick.
245
- * 2. Since `height` can be changing through out life time of a component, we can't have it as part of styled component,
246
- * and hence we use `style` prop.
247
- */
248
- getHeightDefiningComponent() {
249
- const {
250
- height,
251
- aspectRatio
252
- } = this.props;
253
- let heightDefiningStyles;
254
- if (height) {
255
- heightDefiningStyles = {
256
- height: `${height}px`
257
- };
258
- } else {
259
- // paddingBottom css trick defines ratio of `iframe height (y) + header (32)` to `width (x)`,
260
- // where is `aspectRatio` defines iframe aspectRatio alone
261
- // So, visually:
262
- //
263
- // x
264
- // ┌──────────┐
265
- // │ header │ 32
266
- // ├──────────┤
267
- // │ │
268
- // │ iframe │ y
269
- // │ │
270
- // └──────────┘
271
- //
272
- // aspectRatio = x / y
273
- // paddingBottom = (y + 32) / x
274
- // which can be achieved with css calc() as (1 / (x/y)) * 100)% + 32px
275
- heightDefiningStyles = {
276
- paddingBottom: `calc(${(1 / aspectRatio * 100).toFixed(3)}% + ${embedHeaderHeight}px)`
277
- };
278
- }
279
- return jsx("span", {
280
- "data-testid": 'resizable-embed-card-height-definer',
281
- style: {
282
- display: 'block',
283
- /* Fixes extra padding problem in Firefox */
284
- fontSize: 0,
285
- lineHeight: 0,
286
- ...heightDefiningStyles
287
- }
288
- });
289
- }
290
- render() {
291
- const {
292
- layout,
293
- pctWidth,
294
- containerWidth,
295
- fullWidthMode,
296
- children
297
- } = this.props;
298
- const initialWidth = this.calcPxWidth() - akEditorMediaResizeHandlerPaddingWide;
299
- const enable = {};
300
- handleSides.forEach(side => {
301
- const oppositeSide = side === 'left' ? 'right' : 'left';
302
- enable[side] = ['full-width', 'wide', 'center'].concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
303
- if (side === 'left' && this.insideInlineLike) {
304
- enable[side] = false;
305
- }
306
- });
307
- return jsx("div", {
308
- css: embedSpacingStyles,
309
- "data-testid": "resizable-embed-card-spacing"
310
- }, jsx("div", {
311
- css: wrapperStyle({
312
- layout,
313
- isResized: !!pctWidth,
314
- containerWidth: containerWidth || DEFAULT_EMBED_CARD_WIDTH,
315
- fullWidthMode
316
- })
317
- }, jsx(Resizer, _extends({}, this.props, {
318
- width: initialWidth // Starting or initial width of embed <iframe> itself.
319
- ,
320
- enable: enable,
321
- calcNewSize: this.calcNewSize,
322
- snapPoints: this.calcSnapPoints(),
323
- scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
324
- highlights: this.highlights,
325
- innerPadding: akEditorMediaResizeHandlerPaddingWide,
326
- nodeType: "embed"
327
- }), children, this.getHeightDefiningComponent())));
328
- }
329
- }
330
- _defineProperty(ResizableEmbedCard, "defaultProps", {
331
- aspectRatio: DEFAULT_EMBED_CARD_WIDTH / DEFAULT_EMBED_CARD_HEIGHT
332
- });
@@ -1,11 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import EditIcon from '@atlaskit/icon/glyph/edit';
4
- import { editIconStyles } from '@atlaskit/editor-common/styles';
5
- export const SmallerEditIcon = () => {
6
- return jsx("div", {
7
- css: editIconStyles
8
- }, jsx(EditIcon, {
9
- label: "edit"
10
- }));
11
- };
@@ -1,46 +0,0 @@
1
- import { NodeSelection } from 'prosemirror-state';
2
- import { pluginKey } from './pm-plugins/plugin-key';
3
- export const appearanceForNodeType = spec => {
4
- if (spec.name === 'inlineCard') {
5
- return 'inline';
6
- } else if (spec.name === 'blockCard') {
7
- return 'block';
8
- } else if (spec.name === 'embedCard') {
9
- return 'embed';
10
- }
11
- return;
12
- };
13
- export const selectedCardAppearance = state => {
14
- if (state.selection instanceof NodeSelection) {
15
- return appearanceForNodeType(state.selection.node.type);
16
- }
17
- };
18
- export const titleUrlPairFromNode = node => {
19
- const {
20
- attrs
21
- } = node;
22
- return {
23
- url: attrs.url || attrs.data && attrs.data.url,
24
- title: attrs.data && attrs.data.title
25
- };
26
- };
27
-
28
- /**
29
- * Merges the title and url from attributes and CardInfo from the resolved view, preferring the CardInfo.
30
- * @param titleUrlPair title and url information from the node attributes
31
- * @param info information stored in state from the resolved UI component view
32
- */
33
- export const mergeCardInfo = (titleUrlPair, info) => {
34
- return {
35
- title: info && info.title || titleUrlPair.title,
36
- url: info && info.url || titleUrlPair.url
37
- };
38
- };
39
- export const displayInfoForCard = (node, info) => mergeCardInfo(titleUrlPairFromNode(node), info);
40
- export const findCardInfo = state => {
41
- const pluginState = pluginKey.getState(state);
42
- if (!pluginState) {
43
- return undefined;
44
- }
45
- return pluginState.cards.find(cardInfo => cardInfo.pos === state.selection.from);
46
- };
@@ -1,132 +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 React from 'react';
5
- import { inlineCard, blockCard, embedCard } from '@atlaskit/adf-schema';
6
- import { createPlugin } from './pm-plugins/main';
7
- import { floatingToolbar } from './toolbar';
8
- import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
9
- import { cardKeymap } from './pm-plugins/keymap';
10
- import { queueCardsFromChangedTr, changeSelectedCardToLink, setSelectedCardAppearance } from './pm-plugins/doc';
11
- import { hideLinkToolbar } from './pm-plugins/actions';
12
- import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
13
- import LayoutButton from './ui/LayoutButton';
14
- import { pluginKey } from './pm-plugins/plugin-key';
15
- import { mountHyperlinkPlugin } from './pm-plugins/mountHyperlink';
16
- import { showDatasourceModal } from './pm-plugins/actions';
17
- import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
18
- import { messages } from './messages';
19
- import { IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
20
- import { canRenderDatasource } from '@atlaskit/editor-common/utils';
21
- import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
22
- var cardPlugin = function cardPlugin(options, api) {
23
- var _api$dependencies, _api$dependencies$fea;
24
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
25
- return {
26
- name: 'card',
27
- getSharedState: function getSharedState(editorState) {
28
- if (!editorState) {
29
- return null;
30
- }
31
- return pluginKey.getState(editorState) || null;
32
- },
33
- nodes: function nodes() {
34
- var nodes = [{
35
- name: 'inlineCard',
36
- node: inlineCard
37
- }, {
38
- name: 'blockCard',
39
- node: blockCard
40
- }];
41
- if (options.allowEmbeds) {
42
- nodes.push({
43
- name: 'embedCard',
44
- node: embedCard
45
- });
46
- }
47
- return nodes;
48
- },
49
- pmPlugins: function pmPlugins() {
50
- var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme;
51
- var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
52
- var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
53
- var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
54
- var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
55
- var allowAlignment = (_options$allowAlignme = options.allowAlignment) !== null && _options$allowAlignme !== void 0 ? _options$allowAlignme : true;
56
- var plugins = [{
57
- name: 'card',
58
- plugin: createPlugin(_objectSpread(_objectSpread({}, options), {}, {
59
- allowBlockCards: allowBlockCards,
60
- allowResizing: allowResizing,
61
- useAlternativePreloader: useAlternativePreloader,
62
- allowWrapping: allowWrapping,
63
- allowAlignment: allowAlignment
64
- }), api)
65
- }, {
66
- name: 'cardHyperlink',
67
- plugin: function plugin() {
68
- return mountHyperlinkPlugin(api, options);
69
- }
70
- }];
71
- plugins.push({
72
- name: 'cardKeymap',
73
- plugin: function plugin(_ref) {
74
- var featureFlags = _ref.featureFlags;
75
- return cardKeymap(featureFlags);
76
- }
77
- });
78
- return plugins;
79
- },
80
- contentComponent: function contentComponent(_ref2) {
81
- var editorView = _ref2.editorView,
82
- popupsMountPoint = _ref2.popupsMountPoint,
83
- popupsScrollableElement = _ref2.popupsScrollableElement,
84
- popupsBoundariesElement = _ref2.popupsBoundariesElement;
85
- var lpAnalyticsEventsNext = featureFlags.lpAnalyticsEventsNext;
86
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorSmartCardEvents, {
87
- editorView: editorView
88
- }), lpAnalyticsEventsNext && /*#__PURE__*/React.createElement(EditorSmartCardEventsNext, {
89
- editorView: editorView
90
- }), /*#__PURE__*/React.createElement(LayoutButton, {
91
- api: api,
92
- editorView: editorView,
93
- mountPoint: popupsMountPoint,
94
- scrollableElement: popupsScrollableElement,
95
- boundariesElement: popupsBoundariesElement
96
- }), /*#__PURE__*/React.createElement(DatasourceModalWithState, {
97
- api: api,
98
- editorView: editorView
99
- }));
100
- },
101
- actions: {
102
- hideLinkToolbar: hideLinkToolbar,
103
- queueCardsFromChangedTr: queueCardsFromChangedTr,
104
- changeSelectedCardToLink: changeSelectedCardToLink,
105
- setSelectedCardAppearance: setSelectedCardAppearance
106
- },
107
- pluginsOptions: {
108
- floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api),
109
- quickInsert: function quickInsert(_ref3) {
110
- var formatMessage = _ref3.formatMessage;
111
- if (canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
112
- return [{
113
- id: 'datasource',
114
- title: formatMessage(messages.datasourceJiraIssue),
115
- description: formatMessage(messages.datasourceJiraIssueDescription),
116
- keywords: ['jira'],
117
- icon: function icon() {
118
- return /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null);
119
- },
120
- action: function action(insert) {
121
- var tr = insert(undefined);
122
- showDatasourceModal('jira')(tr);
123
- return tr;
124
- }
125
- }];
126
- }
127
- return [];
128
- }
129
- }
130
- };
131
- };
132
- export default cardPlugin;
@@ -1,13 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export var messages = defineMessages({
3
- datasourceJiraIssue: {
4
- id: 'fabric.editor.datasource.jiraIssue',
5
- defaultMessage: 'Jira Issues',
6
- description: 'Insert a jira datasource table'
7
- },
8
- datasourceJiraIssueDescription: {
9
- id: 'fabric.editor.datasource.jiraIssue.description',
10
- defaultMessage: 'Insert issues from Jira Cloud with enhanced search, filtering, and configuration',
11
- description: 'Insert a jira datasource table'
12
- }
13
- });
@@ -1,155 +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 { Card as SmartCard } from '@atlaskit/smart-card';
12
- import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
13
- import { browser } from '@atlaskit/editor-common/utils';
14
- import PropTypes from 'prop-types';
15
- import rafSchedule from 'raf-schd';
16
- import { Card } from './genericCard';
17
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
18
- import { registerCard } from '../pm-plugins/actions';
19
- import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
20
- export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
21
- _inherits(BlockCardComponent, _React$PureComponent);
22
- var _super = _createSuper(BlockCardComponent);
23
- function BlockCardComponent() {
24
- var _this;
25
- _classCallCheck(this, BlockCardComponent);
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
29
- _this = _super.call.apply(_super, [this].concat(args));
30
- _defineProperty(_assertThisInitialized(_this), "onClick", function () {});
31
- _defineProperty(_assertThisInitialized(_this), "onResolve", function (data) {
32
- var _this$props = _this.props,
33
- getPos = _this$props.getPos,
34
- view = _this$props.view;
35
- if (!getPos || typeof getPos === 'boolean') {
36
- return;
37
- }
38
- var title = data.title,
39
- url = data.url;
40
-
41
- // don't dispatch immediately since we might be in the middle of
42
- // rendering a nodeview
43
- rafSchedule(function () {
44
- var pos = getPos();
45
- if (typeof pos !== 'number') {
46
- return;
47
- }
48
- view.dispatch(registerCard({
49
- title: title,
50
- url: url,
51
- pos: pos
52
- })(view.state.tr));
53
- })();
54
- });
55
- _defineProperty(_assertThisInitialized(_this), "gapCursorSpan", function () {
56
- // Don't render in EdgeHTMl version <= 18 (Edge version 44)
57
- // as it forces the edit popup to render 24px lower than it should
58
- if (browser.ie && browser.ie_version < 79) {
59
- return;
60
- }
61
-
62
- // render an empty span afterwards to get around Webkit bug
63
- // that puts caret in next editable text element
64
- return /*#__PURE__*/React.createElement("span", {
65
- contentEditable: true
66
- });
67
- });
68
- _defineProperty(_assertThisInitialized(_this), "onError", function (_ref) {
69
- var err = _ref.err;
70
- if (err) {
71
- throw err;
72
- }
73
- });
74
- return _this;
75
- }
76
- _createClass(BlockCardComponent, [{
77
- key: "UNSAFE_componentWillMount",
78
- value: function UNSAFE_componentWillMount() {
79
- var view = this.props.view;
80
- var scrollContainer = findOverflowScrollParent(view.dom);
81
- this.scrollContainer = scrollContainer || undefined;
82
- }
83
- }, {
84
- key: "render",
85
- value: function render() {
86
- var _this$props2 = this.props,
87
- node = _this$props2.node,
88
- cardContext = _this$props2.cardContext,
89
- platform = _this$props2.platform,
90
- showServerActions = _this$props2.showServerActions;
91
- var _node$attrs = node.attrs,
92
- url = _node$attrs.url,
93
- data = _node$attrs.data;
94
- var cardInner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
95
- key: url,
96
- url: url,
97
- data: data,
98
- container: this.scrollContainer,
99
- appearance: "block",
100
- onClick: this.onClick,
101
- onResolve: this.onResolve,
102
- onError: this.onError,
103
- showActions: platform === 'web',
104
- platform: platform,
105
- showServerActions: showServerActions
106
- }), this.gapCursorSpan());
107
- // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
108
- // otherwise if we got data, we can render the card directly since it doesn't need the Provider
109
- return /*#__PURE__*/React.createElement("div", null, cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
110
- value: cardContext.value
111
- }, cardInner) : data ? cardInner : null);
112
- }
113
- }]);
114
- return BlockCardComponent;
115
- }(React.PureComponent);
116
- _defineProperty(BlockCardComponent, "contextTypes", {
117
- contextAdapter: PropTypes.object
118
- });
119
- var WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
120
- export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
121
- _inherits(BlockCard, _ReactNodeView);
122
- var _super2 = _createSuper(BlockCard);
123
- function BlockCard() {
124
- _classCallCheck(this, BlockCard);
125
- return _super2.apply(this, arguments);
126
- }
127
- _createClass(BlockCard, [{
128
- key: "createDomRef",
129
- value: function createDomRef() {
130
- var domRef = document.createElement('div');
131
- if (this.reactComponentProps.platform !== 'mobile') {
132
- // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
133
- // see also: https://github.com/ProseMirror/prosemirror/issues/884
134
- domRef.contentEditable = 'true';
135
- domRef.setAttribute('spellcheck', 'false');
136
- }
137
- return domRef;
138
- }
139
- }, {
140
- key: "render",
141
- value: function render() {
142
- var _this$reactComponentP = this.reactComponentProps,
143
- platform = _this$reactComponentP.platform,
144
- showServerActions = _this$reactComponentP.showServerActions;
145
- return /*#__PURE__*/React.createElement(WrappedBlockCard, {
146
- node: this.node,
147
- view: this.view,
148
- getPos: this.getPos,
149
- platform: platform,
150
- showServerActions: showServerActions
151
- });
152
- }
153
- }]);
154
- return BlockCard;
155
- }(ReactNodeView);