@atlaskit/editor-plugin-media 0.2.0 → 0.3.1

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 (328) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/commands/captions.js +59 -0
  3. package/dist/cjs/commands/helpers.js +127 -0
  4. package/dist/cjs/commands/index.js +24 -0
  5. package/dist/cjs/commands/linking.js +181 -0
  6. package/dist/cjs/index.js +8 -1
  7. package/dist/cjs/media-plugin-options.js +5 -0
  8. package/dist/cjs/next-plugin-type.js +5 -0
  9. package/dist/cjs/nodeviews/mediaGroup.js +376 -0
  10. package/dist/cjs/nodeviews/mediaInline.js +288 -0
  11. package/dist/cjs/nodeviews/mediaNodeUpdater.js +739 -0
  12. package/dist/cjs/nodeviews/mediaNodeView/index.js +177 -0
  13. package/dist/cjs/nodeviews/mediaNodeView/media.js +242 -0
  14. package/dist/cjs/nodeviews/mediaSingle.js +629 -0
  15. package/dist/cjs/nodeviews/messages.js +14 -0
  16. package/dist/cjs/nodeviews/styles.js +46 -0
  17. package/dist/cjs/nodeviews/types.js +5 -0
  18. package/dist/cjs/picker-facade.js +192 -0
  19. package/dist/cjs/plugin.js +293 -0
  20. package/dist/cjs/pm-plugins/alt-text/actions.js +5 -0
  21. package/dist/cjs/pm-plugins/alt-text/commands.js +59 -0
  22. package/dist/cjs/pm-plugins/alt-text/index.js +36 -0
  23. package/dist/cjs/pm-plugins/alt-text/keymap.js +15 -0
  24. package/dist/cjs/pm-plugins/alt-text/messages.js +44 -0
  25. package/dist/cjs/pm-plugins/alt-text/reducer.js +32 -0
  26. package/dist/cjs/pm-plugins/alt-text/types.js +5 -0
  27. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +209 -0
  28. package/dist/cjs/pm-plugins/keymap-media-single.js +163 -0
  29. package/dist/cjs/pm-plugins/keymap.js +88 -0
  30. package/dist/cjs/pm-plugins/linking/actions.js +13 -0
  31. package/dist/cjs/pm-plugins/linking/index.js +65 -0
  32. package/dist/cjs/pm-plugins/linking/keymap.js +14 -0
  33. package/dist/cjs/pm-plugins/linking/reducer.js +43 -0
  34. package/dist/cjs/pm-plugins/linking/types.js +5 -0
  35. package/dist/cjs/pm-plugins/main.js +813 -0
  36. package/dist/cjs/pm-plugins/media-editor-plugin-factory.js +8 -0
  37. package/dist/cjs/pm-plugins/mediaTaskManager.js +101 -0
  38. package/dist/cjs/pm-plugins/plugin-key.js +8 -0
  39. package/dist/cjs/pm-plugins/types.js +5 -0
  40. package/dist/cjs/toolbar/alt-text.js +80 -0
  41. package/dist/cjs/toolbar/commands.js +236 -0
  42. package/dist/cjs/toolbar/filePreviewItem.js +66 -0
  43. package/dist/cjs/toolbar/imageBorder.js +20 -0
  44. package/dist/cjs/toolbar/index.js +523 -0
  45. package/dist/cjs/toolbar/linking-toolbar-appearance.js +100 -0
  46. package/dist/cjs/toolbar/linking.js +96 -0
  47. package/dist/cjs/toolbar/utils.js +110 -0
  48. package/dist/cjs/ui/CaptionPlaceholder/index.js +27 -0
  49. package/dist/cjs/ui/CaptionPlaceholder/messages.js +14 -0
  50. package/dist/cjs/ui/ImageBorder/index.js +226 -0
  51. package/dist/cjs/ui/ImageBorder/messages.js +49 -0
  52. package/dist/cjs/ui/ImageBorder/styles.js +52 -0
  53. package/dist/cjs/ui/Media/DropPlaceholder.js +38 -0
  54. package/dist/cjs/ui/Media/drop-placeholder-messages.js +14 -0
  55. package/dist/cjs/ui/MediaLinkingToolbar.js +196 -0
  56. package/dist/cjs/ui/MediaPicker/BrowserWrapper.js +40 -0
  57. package/dist/cjs/ui/MediaPicker/ClipboardWrapper.js +39 -0
  58. package/dist/cjs/ui/MediaPicker/DropzoneWrapper.js +51 -0
  59. package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +151 -0
  60. package/dist/cjs/ui/MediaPicker/index.js +103 -0
  61. package/dist/cjs/ui/PixelEntry/constants.js +7 -0
  62. package/dist/cjs/ui/PixelEntry/index.js +185 -0
  63. package/dist/cjs/ui/PixelEntry/messages.js +54 -0
  64. package/dist/cjs/ui/PixelEntry/styles.js +19 -0
  65. package/dist/cjs/ui/PixelEntry/types.js +5 -0
  66. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +16 -0
  67. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +541 -0
  68. package/dist/cjs/ui/ResizableMediaSingle/index.js +422 -0
  69. package/dist/cjs/ui/ResizableMediaSingle/styled.js +14 -0
  70. package/dist/cjs/ui/ResizableMediaSingle/styles.js +17 -0
  71. package/dist/cjs/ui/ResizableMediaSingle/types.js +5 -0
  72. package/dist/cjs/ui/ToolbarMedia/index.js +42 -0
  73. package/dist/cjs/ui/ToolbarMedia/toolbar-media-messages.js +14 -0
  74. package/dist/cjs/ui/media-linking-toolbar-messages.js +14 -0
  75. package/dist/cjs/utils/analytics.js +53 -0
  76. package/dist/cjs/utils/check-media-type.js +56 -0
  77. package/dist/cjs/utils/current-media-node.js +41 -0
  78. package/dist/cjs/utils/is-image.js +9 -0
  79. package/dist/cjs/utils/media-common.js +181 -0
  80. package/dist/cjs/utils/media-files.js +297 -0
  81. package/dist/cjs/utils/media-single.js +181 -0
  82. package/dist/es2019/commands/captions.js +47 -0
  83. package/dist/es2019/commands/helpers.js +113 -0
  84. package/dist/es2019/commands/index.js +1 -0
  85. package/dist/es2019/commands/linking.js +169 -0
  86. package/dist/es2019/index.js +1 -1
  87. package/dist/es2019/media-plugin-options.js +1 -0
  88. package/dist/es2019/next-plugin-type.js +1 -0
  89. package/dist/es2019/nodeviews/mediaGroup.js +314 -0
  90. package/dist/es2019/nodeviews/mediaInline.js +201 -0
  91. package/dist/es2019/nodeviews/mediaNodeUpdater.js +384 -0
  92. package/dist/es2019/nodeviews/mediaNodeView/index.js +149 -0
  93. package/dist/es2019/nodeviews/mediaNodeView/media.js +182 -0
  94. package/dist/es2019/nodeviews/mediaSingle.js +511 -0
  95. package/dist/es2019/nodeviews/messages.js +8 -0
  96. package/dist/es2019/nodeviews/styles.js +46 -0
  97. package/dist/es2019/nodeviews/types.js +1 -0
  98. package/dist/es2019/picker-facade.js +146 -0
  99. package/dist/es2019/plugin.js +284 -0
  100. package/dist/es2019/pm-plugins/alt-text/actions.js +1 -0
  101. package/dist/es2019/pm-plugins/alt-text/commands.js +42 -0
  102. package/dist/es2019/pm-plugins/alt-text/index.js +33 -0
  103. package/dist/es2019/pm-plugins/alt-text/keymap.js +9 -0
  104. package/dist/es2019/pm-plugins/alt-text/messages.js +38 -0
  105. package/dist/es2019/pm-plugins/alt-text/reducer.js +26 -0
  106. package/dist/es2019/pm-plugins/alt-text/types.js +1 -0
  107. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +228 -0
  108. package/dist/es2019/pm-plugins/keymap-media-single.js +172 -0
  109. package/dist/es2019/pm-plugins/keymap.js +84 -0
  110. package/dist/es2019/pm-plugins/linking/actions.js +7 -0
  111. package/dist/es2019/pm-plugins/linking/index.js +56 -0
  112. package/dist/es2019/pm-plugins/linking/keymap.js +8 -0
  113. package/dist/es2019/pm-plugins/linking/reducer.js +37 -0
  114. package/dist/es2019/pm-plugins/linking/types.js +1 -0
  115. package/dist/es2019/pm-plugins/main.js +695 -0
  116. package/dist/es2019/pm-plugins/media-editor-plugin-factory.js +2 -0
  117. package/dist/es2019/pm-plugins/mediaTaskManager.js +64 -0
  118. package/dist/es2019/pm-plugins/plugin-key.js +2 -0
  119. package/dist/es2019/pm-plugins/types.js +1 -0
  120. package/dist/es2019/toolbar/alt-text.js +72 -0
  121. package/dist/es2019/toolbar/commands.js +212 -0
  122. package/dist/es2019/toolbar/filePreviewItem.js +54 -0
  123. package/dist/es2019/toolbar/imageBorder.js +15 -0
  124. package/dist/es2019/toolbar/index.js +538 -0
  125. package/dist/es2019/toolbar/linking-toolbar-appearance.js +90 -0
  126. package/dist/es2019/toolbar/linking.js +98 -0
  127. package/dist/es2019/toolbar/utils.js +86 -0
  128. package/dist/es2019/ui/CaptionPlaceholder/index.js +25 -0
  129. package/dist/es2019/ui/CaptionPlaceholder/messages.js +8 -0
  130. package/dist/es2019/ui/ImageBorder/index.js +213 -0
  131. package/dist/es2019/ui/ImageBorder/messages.js +43 -0
  132. package/dist/es2019/ui/ImageBorder/styles.js +126 -0
  133. package/dist/es2019/ui/Media/DropPlaceholder.js +47 -0
  134. package/dist/es2019/ui/Media/drop-placeholder-messages.js +8 -0
  135. package/dist/es2019/ui/MediaLinkingToolbar.js +190 -0
  136. package/dist/es2019/ui/MediaPicker/BrowserWrapper.js +31 -0
  137. package/dist/es2019/ui/MediaPicker/ClipboardWrapper.js +32 -0
  138. package/dist/es2019/ui/MediaPicker/DropzoneWrapper.js +42 -0
  139. package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +85 -0
  140. package/dist/es2019/ui/MediaPicker/index.js +82 -0
  141. package/dist/es2019/ui/PixelEntry/constants.js +1 -0
  142. package/dist/es2019/ui/PixelEntry/index.js +170 -0
  143. package/dist/es2019/ui/PixelEntry/messages.js +48 -0
  144. package/dist/es2019/ui/PixelEntry/styles.js +51 -0
  145. package/dist/es2019/ui/PixelEntry/types.js +1 -0
  146. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +9 -0
  147. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +454 -0
  148. package/dist/es2019/ui/ResizableMediaSingle/index.js +344 -0
  149. package/dist/es2019/ui/ResizableMediaSingle/styled.js +9 -0
  150. package/dist/es2019/ui/ResizableMediaSingle/styles.js +14 -0
  151. package/dist/es2019/ui/ResizableMediaSingle/types.js +1 -0
  152. package/dist/es2019/ui/ToolbarMedia/index.js +37 -0
  153. package/dist/es2019/ui/ToolbarMedia/toolbar-media-messages.js +8 -0
  154. package/dist/es2019/ui/media-linking-toolbar-messages.js +8 -0
  155. package/dist/es2019/utils/analytics.js +51 -0
  156. package/dist/es2019/utils/check-media-type.js +19 -0
  157. package/dist/es2019/utils/current-media-node.js +35 -0
  158. package/dist/es2019/utils/is-image.js +3 -0
  159. package/dist/es2019/utils/media-common.js +189 -0
  160. package/dist/es2019/utils/media-files.js +321 -0
  161. package/dist/es2019/utils/media-single.js +176 -0
  162. package/dist/esm/commands/captions.js +53 -0
  163. package/dist/esm/commands/helpers.js +120 -0
  164. package/dist/esm/commands/index.js +1 -0
  165. package/dist/esm/commands/linking.js +174 -0
  166. package/dist/esm/index.js +1 -1
  167. package/dist/esm/media-plugin-options.js +1 -0
  168. package/dist/esm/next-plugin-type.js +1 -0
  169. package/dist/esm/nodeviews/mediaGroup.js +369 -0
  170. package/dist/esm/nodeviews/mediaInline.js +278 -0
  171. package/dist/esm/nodeviews/mediaNodeUpdater.js +732 -0
  172. package/dist/esm/nodeviews/mediaNodeView/index.js +170 -0
  173. package/dist/esm/nodeviews/mediaNodeView/media.js +233 -0
  174. package/dist/esm/nodeviews/mediaSingle.js +622 -0
  175. package/dist/esm/nodeviews/messages.js +8 -0
  176. package/dist/esm/nodeviews/styles.js +39 -0
  177. package/dist/esm/nodeviews/types.js +1 -0
  178. package/dist/esm/picker-facade.js +186 -0
  179. package/dist/esm/plugin.js +282 -0
  180. package/dist/esm/pm-plugins/alt-text/actions.js +1 -0
  181. package/dist/esm/pm-plugins/alt-text/commands.js +52 -0
  182. package/dist/esm/pm-plugins/alt-text/index.js +31 -0
  183. package/dist/esm/pm-plugins/alt-text/keymap.js +9 -0
  184. package/dist/esm/pm-plugins/alt-text/messages.js +38 -0
  185. package/dist/esm/pm-plugins/alt-text/reducer.js +25 -0
  186. package/dist/esm/pm-plugins/alt-text/types.js +1 -0
  187. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +206 -0
  188. package/dist/esm/pm-plugins/keymap-media-single.js +158 -0
  189. package/dist/esm/pm-plugins/keymap.js +81 -0
  190. package/dist/esm/pm-plugins/linking/actions.js +7 -0
  191. package/dist/esm/pm-plugins/linking/index.js +59 -0
  192. package/dist/esm/pm-plugins/linking/keymap.js +8 -0
  193. package/dist/esm/pm-plugins/linking/reducer.js +36 -0
  194. package/dist/esm/pm-plugins/linking/types.js +1 -0
  195. package/dist/esm/pm-plugins/main.js +798 -0
  196. package/dist/esm/pm-plugins/media-editor-plugin-factory.js +2 -0
  197. package/dist/esm/pm-plugins/mediaTaskManager.js +94 -0
  198. package/dist/esm/pm-plugins/plugin-key.js +2 -0
  199. package/dist/esm/pm-plugins/types.js +1 -0
  200. package/dist/esm/toolbar/alt-text.js +70 -0
  201. package/dist/esm/toolbar/commands.js +229 -0
  202. package/dist/esm/toolbar/filePreviewItem.js +56 -0
  203. package/dist/esm/toolbar/imageBorder.js +14 -0
  204. package/dist/esm/toolbar/index.js +513 -0
  205. package/dist/esm/toolbar/linking-toolbar-appearance.js +91 -0
  206. package/dist/esm/toolbar/linking.js +88 -0
  207. package/dist/esm/toolbar/utils.js +103 -0
  208. package/dist/esm/ui/CaptionPlaceholder/index.js +20 -0
  209. package/dist/esm/ui/CaptionPlaceholder/messages.js +8 -0
  210. package/dist/esm/ui/ImageBorder/index.js +218 -0
  211. package/dist/esm/ui/ImageBorder/messages.js +43 -0
  212. package/dist/esm/ui/ImageBorder/styles.js +42 -0
  213. package/dist/esm/ui/Media/DropPlaceholder.js +31 -0
  214. package/dist/esm/ui/Media/drop-placeholder-messages.js +8 -0
  215. package/dist/esm/ui/MediaLinkingToolbar.js +188 -0
  216. package/dist/esm/ui/MediaPicker/BrowserWrapper.js +33 -0
  217. package/dist/esm/ui/MediaPicker/ClipboardWrapper.js +32 -0
  218. package/dist/esm/ui/MediaPicker/DropzoneWrapper.js +44 -0
  219. package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +145 -0
  220. package/dist/esm/ui/MediaPicker/index.js +96 -0
  221. package/dist/esm/ui/PixelEntry/constants.js +1 -0
  222. package/dist/esm/ui/PixelEntry/index.js +174 -0
  223. package/dist/esm/ui/PixelEntry/messages.js +48 -0
  224. package/dist/esm/ui/PixelEntry/styles.js +12 -0
  225. package/dist/esm/ui/PixelEntry/types.js +1 -0
  226. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +9 -0
  227. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +535 -0
  228. package/dist/esm/ui/ResizableMediaSingle/index.js +417 -0
  229. package/dist/esm/ui/ResizableMediaSingle/styled.js +7 -0
  230. package/dist/esm/ui/ResizableMediaSingle/styles.js +7 -0
  231. package/dist/esm/ui/ResizableMediaSingle/types.js +1 -0
  232. package/dist/esm/ui/ToolbarMedia/index.js +35 -0
  233. package/dist/esm/ui/ToolbarMedia/toolbar-media-messages.js +8 -0
  234. package/dist/esm/ui/media-linking-toolbar-messages.js +8 -0
  235. package/dist/esm/utils/analytics.js +47 -0
  236. package/dist/esm/utils/check-media-type.js +49 -0
  237. package/dist/esm/utils/current-media-node.js +35 -0
  238. package/dist/esm/utils/is-image.js +3 -0
  239. package/dist/esm/utils/media-common.js +175 -0
  240. package/dist/esm/utils/media-files.js +291 -0
  241. package/dist/esm/utils/media-single.js +172 -0
  242. package/dist/types/commands/captions.d.ts +5 -0
  243. package/dist/types/commands/helpers.d.ts +15 -0
  244. package/dist/types/commands/index.d.ts +1 -0
  245. package/dist/types/commands/linking.d.ts +9 -0
  246. package/dist/types/index.d.ts +2 -1
  247. package/dist/types/media-plugin-options.d.ts +17 -0
  248. package/dist/types/next-plugin-type.d.ts +33 -0
  249. package/dist/types/nodeviews/__mocks__/mediaNodeUpdater.d.ts +24 -0
  250. package/dist/types/nodeviews/mediaGroup.d.ts +33 -0
  251. package/dist/types/nodeviews/mediaInline.d.ts +50 -0
  252. package/dist/types/nodeviews/mediaNodeUpdater.d.ts +45 -0
  253. package/dist/types/nodeviews/mediaNodeView/index.d.ts +28 -0
  254. package/dist/types/nodeviews/mediaNodeView/media.d.ts +44 -0
  255. package/dist/types/nodeviews/mediaSingle.d.ts +62 -0
  256. package/dist/types/nodeviews/messages.d.ts +7 -0
  257. package/dist/types/nodeviews/styles.d.ts +16 -0
  258. package/dist/types/nodeviews/types.d.ts +42 -0
  259. package/dist/types/picker-facade.d.ts +44 -0
  260. package/dist/types/plugin.d.ts +7 -0
  261. package/dist/types/pm-plugins/alt-text/actions.d.ts +10 -0
  262. package/dist/types/pm-plugins/alt-text/commands.d.ts +4 -0
  263. package/dist/types/pm-plugins/alt-text/index.d.ts +7 -0
  264. package/dist/types/pm-plugins/alt-text/keymap.d.ts +4 -0
  265. package/dist/types/pm-plugins/alt-text/messages.d.ts +37 -0
  266. package/dist/types/pm-plugins/alt-text/reducer.d.ts +4 -0
  267. package/dist/types/pm-plugins/alt-text/types.d.ts +3 -0
  268. package/dist/types/pm-plugins/alt-text/ui/AltTextEdit.d.ts +41 -0
  269. package/dist/types/pm-plugins/keymap-media-single.d.ts +3 -0
  270. package/dist/types/pm-plugins/keymap.d.ts +6 -0
  271. package/dist/types/pm-plugins/linking/actions.d.ts +20 -0
  272. package/dist/types/pm-plugins/linking/index.d.ts +10 -0
  273. package/dist/types/pm-plugins/linking/keymap.d.ts +3 -0
  274. package/dist/types/pm-plugins/linking/reducer.d.ts +4 -0
  275. package/dist/types/pm-plugins/linking/types.d.ts +12 -0
  276. package/dist/types/pm-plugins/main.d.ts +120 -0
  277. package/dist/types/pm-plugins/media-editor-plugin-factory.d.ts +3 -0
  278. package/dist/types/pm-plugins/mediaTaskManager.d.ts +9 -0
  279. package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
  280. package/dist/types/pm-plugins/types.d.ts +65 -0
  281. package/dist/types/toolbar/alt-text.d.ts +13 -0
  282. package/dist/types/toolbar/commands.d.ts +12 -0
  283. package/dist/types/toolbar/filePreviewItem.d.ts +9 -0
  284. package/dist/types/toolbar/imageBorder.d.ts +2 -0
  285. package/dist/types/toolbar/index.d.ts +6 -0
  286. package/dist/types/toolbar/linking-toolbar-appearance.d.ts +14 -0
  287. package/dist/types/toolbar/linking.d.ts +10 -0
  288. package/dist/types/toolbar/utils.d.ts +11 -0
  289. package/dist/types/types.d.ts +2 -1
  290. package/dist/types/ui/CaptionPlaceholder/index.d.ts +6 -0
  291. package/dist/types/ui/CaptionPlaceholder/messages.d.ts +7 -0
  292. package/dist/types/ui/ImageBorder/index.d.ts +11 -0
  293. package/dist/types/ui/ImageBorder/messages.d.ts +42 -0
  294. package/dist/types/ui/ImageBorder/styles.d.ts +15 -0
  295. package/dist/types/ui/Media/DropPlaceholder.d.ts +8 -0
  296. package/dist/types/ui/Media/drop-placeholder-messages.d.ts +7 -0
  297. package/dist/types/ui/MediaLinkingToolbar.d.ts +35 -0
  298. package/dist/types/ui/MediaPicker/BrowserWrapper.d.ts +11 -0
  299. package/dist/types/ui/MediaPicker/ClipboardWrapper.d.ts +10 -0
  300. package/dist/types/ui/MediaPicker/DropzoneWrapper.d.ts +13 -0
  301. package/dist/types/ui/MediaPicker/PickerFacadeProvider.d.ts +28 -0
  302. package/dist/types/ui/MediaPicker/index.d.ts +23 -0
  303. package/dist/types/ui/PixelEntry/constants.d.ts +1 -0
  304. package/dist/types/ui/PixelEntry/index.d.ts +8 -0
  305. package/dist/types/ui/PixelEntry/messages.d.ts +47 -0
  306. package/dist/types/ui/PixelEntry/styles.d.ts +8 -0
  307. package/dist/types/ui/PixelEntry/types.d.ts +58 -0
  308. package/dist/types/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +3 -0
  309. package/dist/types/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +59 -0
  310. package/dist/types/ui/ResizableMediaSingle/index.d.ts +45 -0
  311. package/dist/types/ui/ResizableMediaSingle/styled.d.ts +2 -0
  312. package/dist/types/ui/ResizableMediaSingle/styles.d.ts +1 -0
  313. package/dist/types/ui/ResizableMediaSingle/types.d.ts +27 -0
  314. package/dist/types/ui/ToolbarMedia/index.d.ts +13 -0
  315. package/dist/types/ui/ToolbarMedia/toolbar-media-messages.d.ts +7 -0
  316. package/dist/types/ui/media-linking-toolbar-messages.d.ts +7 -0
  317. package/dist/types/utils/analytics.d.ts +3 -0
  318. package/dist/types/utils/check-media-type.d.ts +4 -0
  319. package/dist/types/utils/current-media-node.d.ts +9 -0
  320. package/dist/types/utils/is-image.d.ts +1 -0
  321. package/dist/types/utils/media-common.d.ts +20 -0
  322. package/dist/types/utils/media-files.d.ts +30 -0
  323. package/dist/types/utils/media-single.d.ts +20 -0
  324. package/package.json +32 -20
  325. package/report.api.md +430 -0
  326. package/dist/types-ts4.5/index.d.ts +0 -1
  327. package/dist/types-ts4.5/types.d.ts +0 -118
  328. package/tmp/api-report-tmp.d.ts +0 -9
@@ -0,0 +1,417 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/createClass";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
+ 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); }; }
12
+ 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; } }
13
+ /** @jsx jsx */
14
+ import React from 'react';
15
+ import { jsx } from '@emotion/react';
16
+ import { calculateOffsetLeft } from '@atlaskit/editor-common/media-single';
17
+ import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts } from '@atlaskit/editor-common/ui';
18
+ import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
19
+ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
20
+ import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
21
+ import { checkMediaType } from '../../utils/check-media-type';
22
+ import { wrapperStyle } from './styled';
23
+ // eslint-disable-next-line @repo/internal/react/no-class-components
24
+ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
25
+ _inherits(ResizableMediaSingle, _React$Component);
26
+ var _super = _createSuper(ResizableMediaSingle);
27
+ function ResizableMediaSingle() {
28
+ var _this;
29
+ _classCallCheck(this, ResizableMediaSingle);
30
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
+ args[_key] = arguments[_key];
32
+ }
33
+ _this = _super.call.apply(_super, [this].concat(args));
34
+ _defineProperty(_assertThisInitialized(_this), "state", {
35
+ offsetLeft: calculateOffsetLeft(_this.insideInlineLike, _this.insideLayout, _this.props.view.dom, undefined),
36
+ // We default to true until we resolve the file type
37
+ isVideoFile: true
38
+ });
39
+ _defineProperty(_assertThisInitialized(_this), "displayGrid", function (visible, gridType, highlight) {
40
+ var _pluginInjectionApi$g;
41
+ var _this$props = _this.props,
42
+ pluginInjectionApi = _this$props.pluginInjectionApi,
43
+ view = _this$props.view;
44
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.grid) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 || _pluginInjectionApi$g.displayGrid(view)({
45
+ visible: visible,
46
+ gridType: gridType,
47
+ highlight: highlight
48
+ });
49
+ });
50
+ _defineProperty(_assertThisInitialized(_this), "calcNewSize", function (newWidth, stop) {
51
+ var _this$props2 = _this.props,
52
+ layout = _this$props2.layout,
53
+ state = _this$props2.view.state;
54
+ var newPct = calcPctFromPx(newWidth, _this.props.lineLength) * 100;
55
+ _this.setState({
56
+ resizedPctWidth: newPct
57
+ });
58
+ var newLayout = hasParentNodeOfType(state.schema.nodes.table)(state.selection) ? layout : _this.calcUnwrappedLayout(newPct, newWidth);
59
+ if (newPct <= 100) {
60
+ if (_this.wrappedLayout && (stop ? newPct !== 100 : true)) {
61
+ newLayout = layout;
62
+ }
63
+ return {
64
+ width: newPct,
65
+ layout: newLayout
66
+ };
67
+ } else {
68
+ return {
69
+ width: _this.props.pctWidth || null,
70
+ layout: newLayout
71
+ };
72
+ }
73
+ });
74
+ _defineProperty(_assertThisInitialized(_this), "calcUnwrappedLayout", function (pct, width) {
75
+ if (pct <= 100) {
76
+ return 'center';
77
+ }
78
+ if (width <= akEditorWideLayoutWidth) {
79
+ return 'wide';
80
+ }
81
+ return 'full-width';
82
+ });
83
+ _defineProperty(_assertThisInitialized(_this), "calcColumnLeftOffset", function () {
84
+ var offsetLeft = _this.state.offsetLeft;
85
+ return _this.insideInlineLike ? calcColumnsFromPx(offsetLeft, _this.props.lineLength, _this.props.gridSize) : 0;
86
+ });
87
+ _defineProperty(_assertThisInitialized(_this), "calcPxWidth", function (useLayout) {
88
+ var _this$props3 = _this.props,
89
+ _this$props3$width = _this$props3.width,
90
+ origWidth = _this$props3$width === void 0 ? 0 : _this$props3$width,
91
+ origHeight = _this$props3.height,
92
+ layout = _this$props3.layout,
93
+ pctWidth = _this$props3.pctWidth,
94
+ lineLength = _this$props3.lineLength,
95
+ containerWidth = _this$props3.containerWidth,
96
+ fullWidthMode = _this$props3.fullWidthMode,
97
+ getPos = _this$props3.getPos,
98
+ state = _this$props3.view.state;
99
+ var resizedPctWidth = _this.state.resizedPctWidth;
100
+ var pos = typeof getPos === 'function' ? getPos() : undefined;
101
+ return calcMediaPxWidth({
102
+ origWidth: origWidth,
103
+ origHeight: origHeight,
104
+ pctWidth: pctWidth,
105
+ state: state,
106
+ containerWidth: {
107
+ width: containerWidth,
108
+ lineLength: lineLength
109
+ },
110
+ isFullWidthModeEnabled: fullWidthMode,
111
+ layout: useLayout || layout,
112
+ pos: pos,
113
+ resizedPctWidth: resizedPctWidth
114
+ });
115
+ });
116
+ _defineProperty(_assertThisInitialized(_this), "highlights", function (newWidth, snapPoints) {
117
+ var snapWidth = snapTo(newWidth, snapPoints);
118
+ var _this$props$view$stat = _this.props.view.state.schema.nodes,
119
+ layoutColumn = _this$props$view$stat.layoutColumn,
120
+ table = _this$props$view$stat.table,
121
+ expand = _this$props$view$stat.expand,
122
+ nestedExpand = _this$props$view$stat.nestedExpand;
123
+ if (_this.$pos && !!findParentNodeOfTypeClosestToPos(_this.$pos, [layoutColumn, table, expand, nestedExpand].filter(Boolean))) {
124
+ return [];
125
+ }
126
+ if (snapWidth > akEditorWideLayoutWidth) {
127
+ return ['full-width'];
128
+ }
129
+ var _this$props4 = _this.props,
130
+ layout = _this$props4.layout,
131
+ lineLength = _this$props4.lineLength,
132
+ gridSize = _this$props4.gridSize;
133
+ var columns = calcColumnsFromPx(snapWidth, lineLength, gridSize);
134
+ var columnWidth = Math.round(columns);
135
+ var highlight = [];
136
+ if (layout === 'wrap-left' || layout === 'align-start') {
137
+ highlight.push(0, columnWidth);
138
+ } else if (layout === 'wrap-right' || layout === 'align-end') {
139
+ highlight.push(gridSize, gridSize - columnWidth);
140
+ } else if (_this.insideInlineLike) {
141
+ highlight.push(Math.round(columns + _this.calcColumnLeftOffset()));
142
+ } else {
143
+ highlight.push(Math.floor((gridSize - columnWidth) / 2), Math.ceil((gridSize + columnWidth) / 2));
144
+ }
145
+ return highlight;
146
+ });
147
+ _defineProperty(_assertThisInitialized(_this), "saveWrapper", function (wrapper) {
148
+ return _this.wrapper = wrapper;
149
+ });
150
+ return _this;
151
+ }
152
+ _createClass(ResizableMediaSingle, [{
153
+ key: "componentDidUpdate",
154
+ value: function componentDidUpdate(prevProps) {
155
+ var offsetLeft = calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
156
+ if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
157
+ this.setState({
158
+ offsetLeft: offsetLeft
159
+ });
160
+ }
161
+
162
+ // Handle undo, when the actual pctWidth changed,
163
+ // we sync up with the internal state.
164
+ if (prevProps.pctWidth !== this.props.pctWidth) {
165
+ this.setState({
166
+ resizedPctWidth: this.props.pctWidth
167
+ });
168
+ }
169
+ return true;
170
+ }
171
+ }, {
172
+ key: "wrappedLayout",
173
+ get: function get() {
174
+ return wrappedLayouts.indexOf(this.props.layout) > -1;
175
+ }
176
+
177
+ // check if is inside of a table
178
+ }, {
179
+ key: "isNestedInTable",
180
+ value: function isNestedInTable() {
181
+ var table = this.props.view.state.schema.nodes.table;
182
+ if (!this.$pos) {
183
+ return false;
184
+ }
185
+ return !!findParentNodeOfTypeClosestToPos(this.$pos, table);
186
+ }
187
+ }, {
188
+ key: "componentDidMount",
189
+ value: function () {
190
+ var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
191
+ var viewMediaClientConfig;
192
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
193
+ while (1) switch (_context.prev = _context.next) {
194
+ case 0:
195
+ viewMediaClientConfig = this.props.viewMediaClientConfig;
196
+ if (!viewMediaClientConfig) {
197
+ _context.next = 4;
198
+ break;
199
+ }
200
+ _context.next = 4;
201
+ return this.checkVideoFile(viewMediaClientConfig);
202
+ case 4:
203
+ case "end":
204
+ return _context.stop();
205
+ }
206
+ }, _callee, this);
207
+ }));
208
+ function componentDidMount() {
209
+ return _componentDidMount.apply(this, arguments);
210
+ }
211
+ return componentDidMount;
212
+ }()
213
+ }, {
214
+ key: "UNSAFE_componentWillReceiveProps",
215
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
216
+ if (this.props.viewMediaClientConfig !== nextProps.viewMediaClientConfig) {
217
+ this.checkVideoFile(nextProps.viewMediaClientConfig);
218
+ }
219
+ if (this.props.layout !== nextProps.layout) {
220
+ this.checkLayout(this.props.layout, nextProps.layout);
221
+ }
222
+ }
223
+ }, {
224
+ key: "checkVideoFile",
225
+ value: function () {
226
+ var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
227
+ var $pos, mediaNode, mediaType, isVideoFile;
228
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
229
+ while (1) switch (_context2.prev = _context2.next) {
230
+ case 0:
231
+ $pos = this.$pos;
232
+ if (!(!$pos || !viewMediaClientConfig)) {
233
+ _context2.next = 3;
234
+ break;
235
+ }
236
+ return _context2.abrupt("return");
237
+ case 3:
238
+ mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
239
+ if (!mediaNode) {
240
+ _context2.next = 10;
241
+ break;
242
+ }
243
+ _context2.next = 7;
244
+ return checkMediaType(mediaNode, viewMediaClientConfig);
245
+ case 7:
246
+ _context2.t0 = _context2.sent;
247
+ _context2.next = 11;
248
+ break;
249
+ case 10:
250
+ _context2.t0 = undefined;
251
+ case 11:
252
+ mediaType = _context2.t0;
253
+ isVideoFile = mediaType !== 'external' && mediaType !== 'image';
254
+ if (this.state.isVideoFile !== isVideoFile) {
255
+ this.setState({
256
+ isVideoFile: isVideoFile
257
+ });
258
+ }
259
+ case 14:
260
+ case "end":
261
+ return _context2.stop();
262
+ }
263
+ }, _callee2, this);
264
+ }));
265
+ function checkVideoFile(_x) {
266
+ return _checkVideoFile.apply(this, arguments);
267
+ }
268
+ return checkVideoFile;
269
+ }()
270
+ /**
271
+ * When returning to center layout from a wrapped/aligned layout, it might actually
272
+ * be wide or full-width
273
+ */
274
+ }, {
275
+ key: "checkLayout",
276
+ value: function checkLayout(oldLayout, newLayout) {
277
+ var resizedPctWidth = this.state.resizedPctWidth;
278
+ if (wrappedLayouts.indexOf(oldLayout) > -1 && newLayout === 'center' && resizedPctWidth) {
279
+ var layout = this.calcUnwrappedLayout(resizedPctWidth, this.calcPxWidth(newLayout));
280
+ this.props.updateSize(resizedPctWidth, layout);
281
+ }
282
+ }
283
+ }, {
284
+ key: "$pos",
285
+ get: function get() {
286
+ if (typeof this.props.getPos !== 'function') {
287
+ return null;
288
+ }
289
+ var pos = this.props.getPos();
290
+ if (Number.isNaN(pos) || typeof pos !== 'number') {
291
+ return null;
292
+ }
293
+
294
+ // need to pass view because we may not get updated props in time
295
+ return this.props.view.state.doc.resolve(pos);
296
+ }
297
+
298
+ /**
299
+ * The maxmimum number of grid columns this node can resize to.
300
+ */
301
+ }, {
302
+ key: "gridWidth",
303
+ get: function get() {
304
+ var gridSize = this.props.gridSize;
305
+ return !(this.wrappedLayout || this.insideInlineLike) ? gridSize / 2 : gridSize;
306
+ }
307
+ }, {
308
+ key: "insideInlineLike",
309
+ get: function get() {
310
+ var $pos = this.$pos;
311
+ if (!$pos) {
312
+ return false;
313
+ }
314
+ var listItem = this.props.view.state.schema.nodes.listItem;
315
+ return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
316
+ }
317
+ }, {
318
+ key: "insideLayout",
319
+ get: function get() {
320
+ var $pos = this.$pos;
321
+ if (!$pos) {
322
+ return false;
323
+ }
324
+ var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
325
+ return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
326
+ }
327
+ }, {
328
+ key: "render",
329
+ value: function render() {
330
+ var _this2 = this;
331
+ var _this$props5 = this.props,
332
+ origWidth = _this$props5.width,
333
+ origHeight = _this$props5.height,
334
+ layout = _this$props5.layout,
335
+ pctWidth = _this$props5.pctWidth,
336
+ containerWidth = _this$props5.containerWidth,
337
+ fullWidthMode = _this$props5.fullWidthMode,
338
+ selected = _this$props5.selected,
339
+ children = _this$props5.children;
340
+ var initialWidth = this.calcPxWidth(); // width with padding
341
+ var ratio;
342
+ if (origWidth) {
343
+ ratio = (origHeight / origWidth * 100).toFixed(3);
344
+ }
345
+ var enable = {};
346
+ handleSides.forEach(function (side) {
347
+ var oppositeSide = side === 'left' ? 'right' : 'left';
348
+ enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
349
+ if (side === 'left' && _this2.insideInlineLike) {
350
+ enable[side] = false;
351
+ }
352
+ });
353
+ var snapPointsProps = {
354
+ $pos: this.$pos,
355
+ akEditorWideLayoutWidth: akEditorWideLayoutWidth,
356
+ allowBreakoutSnapPoints: this.props.allowBreakoutSnapPoints,
357
+ containerWidth: this.props.containerWidth,
358
+ gridSize: this.props.gridSize,
359
+ gridWidth: this.gridWidth,
360
+ insideInlineLike: this.insideInlineLike,
361
+ insideLayout: this.insideLayout,
362
+ isVideoFile: this.state.isVideoFile,
363
+ lineLength: this.props.lineLength,
364
+ offsetLeft: this.state.offsetLeft,
365
+ wrappedLayout: this.wrappedLayout
366
+ };
367
+ var nestedInTableHandleStyles = function nestedInTableHandleStyles(isNestedInTable) {
368
+ if (!isNestedInTable) {
369
+ return;
370
+ }
371
+ return {
372
+ left: {
373
+ left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
374
+ paddingLeft: '0px'
375
+ },
376
+ right: {
377
+ right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
378
+ paddingRight: '0px'
379
+ }
380
+ };
381
+ };
382
+ return jsx("div", {
383
+ ref: this.saveWrapper,
384
+ css: wrapperStyle({
385
+ layout: layout,
386
+ isResized: !!pctWidth,
387
+ containerWidth: containerWidth || origWidth,
388
+ fullWidthMode: fullWidthMode
389
+ })
390
+ }, jsx(Resizer, _extends({}, this.props, {
391
+ displayGrid: this.displayGrid,
392
+ ratio: ratio,
393
+ width: initialWidth,
394
+ selected: selected,
395
+ enable: enable,
396
+ calcNewSize: this.calcNewSize,
397
+ snapPoints: calculateSnapPoints(snapPointsProps),
398
+ scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
399
+ highlights: this.highlights,
400
+ nodeType: "media",
401
+ dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent
402
+ // when cursor is located below a media with caption,
403
+ // press “Up“ key will result cursor focus on an invalid position, (on the resize handler)
404
+ // This workaround adds an empty div inside the resize handler to prevent the issue.
405
+ ,
406
+ handleComponentFunc: function handleComponentFunc() {
407
+ return jsx("div", {
408
+ contentEditable: false
409
+ });
410
+ },
411
+ handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
412
+ }), children));
413
+ }
414
+ }]);
415
+ return ResizableMediaSingle;
416
+ }(React.Component);
417
+ export { ResizableMediaSingle as default };
@@ -0,0 +1,7 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { css } from '@emotion/react';
4
+ import { MediaSingleDimensionHelper } from '@atlaskit/editor-common/ui';
5
+ export var wrapperStyle = function wrapperStyle(props) {
6
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > div {\n ", ";\n position: relative;\n clear: both;\n }\n"])), MediaSingleDimensionHelper(props));
7
+ };
@@ -0,0 +1,7 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { css } from '@emotion/react';
4
+ import * as colors from '@atlaskit/theme/colors';
5
+ var NOTIFICATION_SIZE = 8;
6
+ var SPACE_FROM_EDGE = "var(--ds-space-100, 8px)";
7
+ export var resizableMediaMigrationNotificationStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: ", ";\n right: calc(", " + ", ");\n background-color: ", ";\n border-radius: ", ";\n width: ", "px;\n height: ", "px;\n pointer-events: none;\n"])), SPACE_FROM_EDGE, "var(--ds-space-150, 12px)", SPACE_FROM_EDGE, "var(--ds-background-warning-bold, ".concat(colors.Y300, ")"), "var(--ds-border-radius-circle, 50%)", NOTIFICATION_SIZE, NOTIFICATION_SIZE);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { injectIntl } from 'react-intl-next';
3
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
+ import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
5
+ import AttachmentIcon from '@atlaskit/icon/glyph/editor/attachment';
6
+ import { toolbarMediaMessages } from './toolbar-media-messages';
7
+ var onClickMediaButton = function onClickMediaButton(pluginState) {
8
+ return function () {
9
+ pluginState.showMediaPicker();
10
+ return true;
11
+ };
12
+ };
13
+ var ToolbarMedia = function ToolbarMedia(_ref) {
14
+ var isDisabled = _ref.isDisabled,
15
+ isReducedSpacing = _ref.isReducedSpacing,
16
+ intl = _ref.intl,
17
+ api = _ref.api;
18
+ var _useSharedPluginState = useSharedPluginState(api, ['media']),
19
+ mediaState = _useSharedPluginState.mediaState;
20
+ if (!(mediaState !== null && mediaState !== void 0 && mediaState.allowsUploads)) {
21
+ return null;
22
+ }
23
+ var toolbarMediaTitle = toolbarMediaMessages.toolbarMediaTitle;
24
+ return /*#__PURE__*/React.createElement(ToolbarButton, {
25
+ buttonId: TOOLBAR_BUTTON.MEDIA,
26
+ onClick: onClickMediaButton(mediaState),
27
+ disabled: isDisabled,
28
+ title: intl.formatMessage(toolbarMediaTitle),
29
+ spacing: isReducedSpacing ? 'none' : 'default',
30
+ iconBefore: /*#__PURE__*/React.createElement(AttachmentIcon, {
31
+ label: intl.formatMessage(toolbarMediaTitle)
32
+ })
33
+ });
34
+ };
35
+ export default injectIntl(ToolbarMedia);
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var toolbarMediaMessages = defineMessages({
3
+ toolbarMediaTitle: {
4
+ id: 'fabric.editor.toolbarMediaTitle',
5
+ defaultMessage: 'Add image, video, or file',
6
+ description: 'a label for an icon that describes files, videos and images'
7
+ }
8
+ });
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var mediaLinkToolbarMessages = defineMessages({
3
+ backLink: {
4
+ id: 'fabric.editor.backLink',
5
+ defaultMessage: 'Go back',
6
+ description: 'Go back from media linking toolbar to main toolbar'
7
+ }
8
+ });
@@ -0,0 +1,47 @@
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ export var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(type, attributes) {
3
+ if (!attributes) {
4
+ return;
5
+ }
6
+ var width = attributes.width,
7
+ widthType = attributes.widthType,
8
+ layout = attributes.layout,
9
+ snapType = attributes.snapType,
10
+ parentNode = attributes.parentNode;
11
+ var actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
12
+ return {
13
+ action: ACTION.EDITED,
14
+ actionSubject: actionSubject,
15
+ actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
16
+ attributes: {
17
+ width: width,
18
+ layout: layout,
19
+ widthType: widthType,
20
+ snapType: snapType,
21
+ parentNode: parentNode
22
+ },
23
+ eventType: EVENT_TYPE.UI
24
+ };
25
+ };
26
+ export var getMediaInputResizeAnalyticsEvent = function getMediaInputResizeAnalyticsEvent(type, attributes) {
27
+ if (!attributes) {
28
+ return;
29
+ }
30
+ var width = attributes.width,
31
+ layout = attributes.layout,
32
+ validation = attributes.validation,
33
+ parentNode = attributes.parentNode;
34
+ var actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
35
+ return {
36
+ action: ACTION.EDITED,
37
+ actionSubject: actionSubject,
38
+ actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
39
+ attributes: {
40
+ width: width,
41
+ layout: layout,
42
+ validation: validation,
43
+ parentNode: parentNode
44
+ },
45
+ eventType: EVENT_TYPE.UI
46
+ };
47
+ };
@@ -0,0 +1,49 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { getMediaClient } from '@atlaskit/media-client';
4
+ export var checkMediaType = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaNode, mediaClientConfig) {
6
+ var fileState;
7
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
8
+ while (1) switch (_context.prev = _context.next) {
9
+ case 0:
10
+ if (!(mediaNode.attrs.type === 'external')) {
11
+ _context.next = 2;
12
+ break;
13
+ }
14
+ return _context.abrupt("return", 'external');
15
+ case 2:
16
+ if (mediaNode.attrs.id) {
17
+ _context.next = 4;
18
+ break;
19
+ }
20
+ return _context.abrupt("return");
21
+ case 4:
22
+ _context.prev = 4;
23
+ _context.next = 7;
24
+ return getMediaClient(mediaClientConfig).file.getCurrentState(mediaNode.attrs.id, {
25
+ collectionName: mediaNode.attrs.collection
26
+ });
27
+ case 7:
28
+ fileState = _context.sent;
29
+ if (!(fileState && fileState.status !== 'error')) {
30
+ _context.next = 10;
31
+ break;
32
+ }
33
+ return _context.abrupt("return", fileState.mediaType);
34
+ case 10:
35
+ _context.next = 14;
36
+ break;
37
+ case 12:
38
+ _context.prev = 12;
39
+ _context.t0 = _context["catch"](4);
40
+ case 14:
41
+ case "end":
42
+ return _context.stop();
43
+ }
44
+ }, _callee, null, [[4, 12]]);
45
+ }));
46
+ return function checkMediaType(_x, _x2) {
47
+ return _ref.apply(this, arguments);
48
+ };
49
+ }();
@@ -0,0 +1,35 @@
1
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
+ export var currentMediaNodeWithPos = function currentMediaNodeWithPos(editorState) {
3
+ var doc = editorState.doc,
4
+ selection = editorState.selection,
5
+ schema = editorState.schema;
6
+ if (!doc || !selection || !(selection instanceof NodeSelection) || selection.node.type !== schema.nodes.mediaSingle) {
7
+ return;
8
+ }
9
+ var pos = selection.$anchor.pos + 1;
10
+ var node = doc.nodeAt(pos);
11
+ if (!node || node.type !== schema.nodes.media) {
12
+ return;
13
+ }
14
+ return {
15
+ node: node,
16
+ pos: pos
17
+ };
18
+ };
19
+ export var currentMediaNode = function currentMediaNode(editorState) {
20
+ var _currentMediaNodeWith;
21
+ return (_currentMediaNodeWith = currentMediaNodeWithPos(editorState)) === null || _currentMediaNodeWith === void 0 ? void 0 : _currentMediaNodeWith.node;
22
+ };
23
+ export var currentMediaNodeBorderMark = function currentMediaNodeBorderMark(editorState) {
24
+ var node = currentMediaNode(editorState);
25
+ if (!node) {
26
+ return;
27
+ }
28
+ var borderMark = node.marks.find(function (m) {
29
+ return m.type.name === 'border';
30
+ });
31
+ if (!borderMark) {
32
+ return;
33
+ }
34
+ return borderMark.attrs;
35
+ };
@@ -0,0 +1,3 @@
1
+ export var isImage = function isImage(fileType) {
2
+ return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
3
+ };