@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,622 @@
1
+ import _get from "@babel/runtime/helpers/get";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
+ import _createClass from "@babel/runtime/helpers/createClass";
6
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
8
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ 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); }; }
15
+ 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; } }
16
+ /** @jsx jsx */
17
+
18
+ import React, { Component } from 'react';
19
+ import { jsx } from '@emotion/react';
20
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
21
+ import { calcMediaSinglePixelWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNode, MEDIA_SINGLE_GUTTER_SIZE } from '@atlaskit/editor-common/media-single';
22
+ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
23
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
24
+ import { MediaSingle } from '@atlaskit/editor-common/ui';
25
+ import { browser, isNodeSelectedOrInRange, setNodeSelection, setTextSelection } from '@atlaskit/editor-common/utils';
26
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
27
+ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
28
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
29
+ import { getAttrsFromUrl } from '@atlaskit/media-client';
30
+ import { getMediaFeatureFlag } from '@atlaskit/media-common';
31
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
32
+ import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
33
+ import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
34
+ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
35
+ import ResizableMediaSingle from '../ui/ResizableMediaSingle';
36
+ import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
37
+ import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
38
+ import { MediaNodeUpdater } from './mediaNodeUpdater';
39
+ import { figureWrapper, MediaSingleNodeSelector } from './styles';
40
+ // eslint-disable-next-line @repo/internal/react/no-class-components
41
+ var MediaSingleNode = /*#__PURE__*/function (_Component) {
42
+ _inherits(MediaSingleNode, _Component);
43
+ var _super = _createSuper(MediaSingleNode);
44
+ function MediaSingleNode() {
45
+ var _this;
46
+ _classCallCheck(this, MediaSingleNode);
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
49
+ }
50
+ _this = _super.call.apply(_super, [this].concat(args));
51
+ _defineProperty(_assertThisInitialized(_this), "state", {
52
+ width: undefined,
53
+ height: undefined,
54
+ viewMediaClientConfig: undefined,
55
+ isCopying: false
56
+ });
57
+ _defineProperty(_assertThisInitialized(_this), "mediaSingleWrapperRef", /*#__PURE__*/React.createRef());
58
+ _defineProperty(_assertThisInitialized(_this), "captionPlaceHolderRef", /*#__PURE__*/React.createRef());
59
+ _defineProperty(_assertThisInitialized(_this), "createMediaNodeUpdater", function (props) {
60
+ var node = _this.props.node.firstChild;
61
+ return new MediaNodeUpdater(_objectSpread(_objectSpread({}, props), {}, {
62
+ isMediaSingle: true,
63
+ node: node ? node : _this.props.node,
64
+ dispatchAnalyticsEvent: _this.props.dispatchAnalyticsEvent
65
+ }));
66
+ });
67
+ _defineProperty(_assertThisInitialized(_this), "setViewMediaClientConfig", /*#__PURE__*/function () {
68
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
69
+ var mediaProvider, viewMediaClientConfig;
70
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
71
+ while (1) switch (_context.prev = _context.next) {
72
+ case 0:
73
+ _context.next = 2;
74
+ return props.mediaProvider;
75
+ case 2:
76
+ mediaProvider = _context.sent;
77
+ if (mediaProvider) {
78
+ viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
79
+ _this.setState({
80
+ viewMediaClientConfig: viewMediaClientConfig
81
+ });
82
+ }
83
+ case 4:
84
+ case "end":
85
+ return _context.stop();
86
+ }
87
+ }, _callee);
88
+ }));
89
+ return function (_x) {
90
+ return _ref.apply(this, arguments);
91
+ };
92
+ }());
93
+ _defineProperty(_assertThisInitialized(_this), "updateMediaNodeAttributes", /*#__PURE__*/function () {
94
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
95
+ var mediaNodeUpdater, addPendingTask, node, updatedDimensions, updatingNode, contextId, hasDifferentContextId, copyNode;
96
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
97
+ while (1) switch (_context2.prev = _context2.next) {
98
+ case 0:
99
+ mediaNodeUpdater = _this.createMediaNodeUpdater(props);
100
+ addPendingTask = _this.props.mediaPluginState.addPendingTask; // we want the first child of MediaSingle (type "media")
101
+ node = _this.props.node.firstChild;
102
+ if (node) {
103
+ _context2.next = 5;
104
+ break;
105
+ }
106
+ return _context2.abrupt("return");
107
+ case 5:
108
+ _context2.next = 7;
109
+ return mediaNodeUpdater.getRemoteDimensions();
110
+ case 7:
111
+ updatedDimensions = _context2.sent;
112
+ if (updatedDimensions) {
113
+ mediaNodeUpdater.updateDimensions(updatedDimensions);
114
+ }
115
+ if (!(node.attrs.type === 'external' && node.attrs.__external)) {
116
+ _context2.next = 15;
117
+ break;
118
+ }
119
+ updatingNode = mediaNodeUpdater.handleExternalMedia(_this.props.getPos);
120
+ addPendingTask(updatingNode);
121
+ _context2.next = 14;
122
+ return updatingNode;
123
+ case 14:
124
+ return _context2.abrupt("return");
125
+ case 15:
126
+ contextId = mediaNodeUpdater.getNodeContextId();
127
+ if (contextId) {
128
+ _context2.next = 19;
129
+ break;
130
+ }
131
+ _context2.next = 19;
132
+ return mediaNodeUpdater.updateContextId();
133
+ case 19:
134
+ _context2.next = 21;
135
+ return mediaNodeUpdater.hasDifferentContextId();
136
+ case 21:
137
+ hasDifferentContextId = _context2.sent;
138
+ if (!hasDifferentContextId) {
139
+ _context2.next = 34;
140
+ break;
141
+ }
142
+ _this.setState({
143
+ isCopying: true
144
+ });
145
+ _context2.prev = 24;
146
+ copyNode = mediaNodeUpdater.copyNode({
147
+ traceId: node.attrs.__mediaTraceId
148
+ });
149
+ addPendingTask(copyNode);
150
+ _context2.next = 29;
151
+ return copyNode;
152
+ case 29:
153
+ _context2.next = 34;
154
+ break;
155
+ case 31:
156
+ _context2.prev = 31;
157
+ _context2.t0 = _context2["catch"](24);
158
+ // if copyNode fails, let's set isCopying false so we can show the eventual error
159
+ _this.setState({
160
+ isCopying: false
161
+ });
162
+ case 34:
163
+ case "end":
164
+ return _context2.stop();
165
+ }
166
+ }, _callee2, null, [[24, 31]]);
167
+ }));
168
+ return function (_x2) {
169
+ return _ref2.apply(this, arguments);
170
+ };
171
+ }());
172
+ _defineProperty(_assertThisInitialized(_this), "selectMediaSingle", function (_ref3) {
173
+ var event = _ref3.event;
174
+ var propPos = _this.props.getPos();
175
+ if (typeof propPos !== 'number') {
176
+ return;
177
+ }
178
+
179
+ // We need to call "stopPropagation" here in order to prevent the browser from navigating to
180
+ // another URL if the media node is wrapped in a link mark.
181
+ event.stopPropagation();
182
+ var state = _this.props.view.state;
183
+ if (event.shiftKey) {
184
+ // don't select text if there is current selection in a table (as this would override selected cells)
185
+ if (state.selection instanceof CellSelection) {
186
+ return;
187
+ }
188
+ setTextSelection(_this.props.view, state.selection.from < propPos ? state.selection.from : propPos,
189
+ // + 3 needed for offset of the media inside mediaSingle and cursor to make whole mediaSingle selected
190
+ state.selection.to > propPos ? state.selection.to : propPos + 3);
191
+ } else {
192
+ setNodeSelection(_this.props.view, propPos);
193
+ }
194
+ });
195
+ _defineProperty(_assertThisInitialized(_this), "updateSize", function (width, layout) {
196
+ var _this$props$view = _this.props.view,
197
+ state = _this$props$view.state,
198
+ dispatch = _this$props$view.dispatch;
199
+ var pos = _this.props.getPos();
200
+ if (typeof pos === 'undefined') {
201
+ return;
202
+ }
203
+ var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, _this.props.node.attrs), {}, {
204
+ layout: layout,
205
+ width: width,
206
+ widthType: 'pixel'
207
+ }));
208
+ tr.setMeta('scrollIntoView', false);
209
+ /**
210
+ * Any changes to attributes of a node count the node as "recreated" in Prosemirror[1]
211
+ * This makes it so Prosemirror resets the selection to the child i.e. "media" instead of "media-single"
212
+ * The recommended fix is to reset the selection.[2]
213
+ *
214
+ * [1] https://discuss.prosemirror.net/t/setnodemarkup-loses-current-nodeselection/976
215
+ * [2] https://discuss.prosemirror.net/t/setnodemarkup-and-deselect/3673
216
+ */
217
+ tr.setSelection(NodeSelection.create(tr.doc, pos));
218
+ return dispatch(tr);
219
+ });
220
+ // Workaround for iOS 16 Caption selection issue
221
+ // @see https://product-fabric.atlassian.net/browse/MEX-2012
222
+ _defineProperty(_assertThisInitialized(_this), "onMediaSingleClicked", function (event) {
223
+ var _this$captionPlaceHol;
224
+ if (!browser.ios) {
225
+ return;
226
+ }
227
+ if (_this.mediaSingleWrapperRef.current !== event.target) {
228
+ return;
229
+ }
230
+ (_this$captionPlaceHol = _this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 || _this$captionPlaceHol.click();
231
+ });
232
+ _defineProperty(_assertThisInitialized(_this), "clickPlaceholder", function () {
233
+ var _pluginInjectionApi$a;
234
+ var _this$props = _this.props,
235
+ view = _this$props.view,
236
+ getPos = _this$props.getPos,
237
+ node = _this$props.node,
238
+ pluginInjectionApi = _this$props.pluginInjectionApi;
239
+ if (typeof getPos === 'boolean') {
240
+ return;
241
+ }
242
+ insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(getPos(), node)(view.state, view.dispatch);
243
+ });
244
+ return _this;
245
+ }
246
+ _createClass(MediaSingleNode, [{
247
+ key: "UNSAFE_componentWillReceiveProps",
248
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
249
+ if (nextProps.mediaProvider !== this.props.mediaProvider) {
250
+ this.setViewMediaClientConfig(nextProps);
251
+ }
252
+
253
+ // Forced updates not required on mobile
254
+ if (nextProps.isCopyPasteEnabled === false) {
255
+ return;
256
+ }
257
+
258
+ // We need to call this method on any prop change since attrs can get removed with collab editing
259
+ // the method internally checks if we already have all attrs
260
+ this.createMediaNodeUpdater(nextProps).updateMediaSingleFileAttrs();
261
+ }
262
+ }, {
263
+ key: "componentDidMount",
264
+ value: function () {
265
+ var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
266
+ var contextIdentifierProvider;
267
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
268
+ while (1) switch (_context3.prev = _context3.next) {
269
+ case 0:
270
+ contextIdentifierProvider = this.props.contextIdentifierProvider;
271
+ _context3.next = 3;
272
+ return Promise.all([this.setViewMediaClientConfig(this.props), this.updateMediaNodeAttributes(this.props)]);
273
+ case 3:
274
+ _context3.t0 = this;
275
+ _context3.next = 6;
276
+ return contextIdentifierProvider;
277
+ case 6:
278
+ _context3.t1 = _context3.sent;
279
+ _context3.t2 = {
280
+ contextIdentifierProvider: _context3.t1
281
+ };
282
+ _context3.t0.setState.call(_context3.t0, _context3.t2);
283
+ case 9:
284
+ case "end":
285
+ return _context3.stop();
286
+ }
287
+ }, _callee3, this);
288
+ }));
289
+ function componentDidMount() {
290
+ return _componentDidMount.apply(this, arguments);
291
+ }
292
+ return componentDidMount;
293
+ }()
294
+ }, {
295
+ key: "render",
296
+ value: function render() {
297
+ var _pluginInjectionApi$m;
298
+ var _this$props2 = this.props,
299
+ selected = _this$props2.selected,
300
+ getPos = _this$props2.getPos,
301
+ node = _this$props2.node,
302
+ mediaOptions = _this$props2.mediaOptions,
303
+ fullWidthMode = _this$props2.fullWidthMode,
304
+ state = _this$props2.view.state,
305
+ view = _this$props2.view,
306
+ pluginInjectionApi = _this$props2.pluginInjectionApi,
307
+ containerWidth = _this$props2.width,
308
+ lineLength = _this$props2.lineLength,
309
+ dispatchAnalyticsEvent = _this$props2.dispatchAnalyticsEvent;
310
+ var _ref4 = node.attrs,
311
+ layout = _ref4.layout,
312
+ widthType = _ref4.widthType,
313
+ mediaSingleWidthAttribute = _ref4.width;
314
+ var childNode = node.firstChild;
315
+ var attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
316
+
317
+ // original width and height of child media node (scaled)
318
+ var width = attrs.width,
319
+ height = attrs.height;
320
+ if (attrs.type === 'external') {
321
+ if (isMediaBlobUrlFromAttrs(attrs)) {
322
+ var urlAttrs = getAttrsFromUrl(attrs.url);
323
+ if (urlAttrs) {
324
+ var urlWidth = urlAttrs.width,
325
+ urlHeight = urlAttrs.height;
326
+ width = width || urlWidth;
327
+ height = height || urlHeight;
328
+ }
329
+ }
330
+ var _this$state = this.state,
331
+ stateWidth = _this$state.width,
332
+ stateHeight = _this$state.height;
333
+ if (width === null) {
334
+ width = stateWidth || DEFAULT_IMAGE_WIDTH;
335
+ }
336
+ if (height === null) {
337
+ height = stateHeight || DEFAULT_IMAGE_HEIGHT;
338
+ }
339
+ }
340
+ if (!width || !height) {
341
+ width = DEFAULT_IMAGE_WIDTH;
342
+ height = DEFAULT_IMAGE_HEIGHT;
343
+ }
344
+ var isSelected = selected();
345
+ var currentMaxWidth = isSelected ? pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.media.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.currentMaxWidth : undefined;
346
+ var contentWidthForLegacyExperience = getMaxWidthForNestedNode(view, getPos()) || lineLength;
347
+ var contentWidth = currentMaxWidth || lineLength;
348
+ var mediaSingleProps = {
349
+ layout: layout,
350
+ width: width,
351
+ height: height,
352
+ containerWidth: containerWidth,
353
+ lineLength: contentWidth,
354
+ fullWidthMode: fullWidthMode,
355
+ hasFallbackContainer: false,
356
+ mediaSingleWidth: calcMediaSinglePixelWidth({
357
+ width: mediaSingleWidthAttribute,
358
+ widthType: widthType,
359
+ origWidth: width,
360
+ layout: layout,
361
+ // This will only be used when calculating legacy media single width
362
+ // thus we use the legacy value (exclude table as container node)
363
+ contentWidth: contentWidthForLegacyExperience,
364
+ containerWidth: containerWidth,
365
+ gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
366
+ }),
367
+ allowCaptions: mediaOptions.allowCaptions
368
+ };
369
+ var resizableMediaSingleProps = _objectSpread({
370
+ view: view,
371
+ getPos: getPos,
372
+ updateSize: this.updateSize,
373
+ gridSize: 12,
374
+ viewMediaClientConfig: this.state.viewMediaClientConfig,
375
+ allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
376
+ selected: isSelected,
377
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
378
+ pluginInjectionApi: pluginInjectionApi
379
+ }, mediaSingleProps);
380
+ var canResize = !!this.props.mediaOptions.allowResizing;
381
+ if (!this.props.mediaOptions.allowResizingInTables) {
382
+ // If resizing not allowed in tables, check parents for tables
383
+ var pos = getPos();
384
+ if (pos) {
385
+ var $pos = state.doc.resolve(pos);
386
+ var table = state.schema.nodes.table;
387
+ var disabledNode = !!findParentNodeOfTypeClosestToPos($pos, [table]);
388
+ canResize = canResize && !disabledNode;
389
+ }
390
+ }
391
+ var shouldShowPlaceholder = (mediaOptions.allowCaptions || getMediaFeatureFlag('captions', mediaOptions.featureFlags)) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
392
+ var MediaChildren = jsx("figure", {
393
+ ref: this.mediaSingleWrapperRef,
394
+ css: [figureWrapper],
395
+ className: MediaSingleNodeSelector,
396
+ onClick: this.onMediaSingleClicked
397
+ }, jsx("div", {
398
+ ref: this.props.forwardRef
399
+ }), shouldShowPlaceholder && jsx(CaptionPlaceholder, {
400
+ ref: this.captionPlaceHolderRef,
401
+ onClick: this.clickPlaceholder
402
+ }));
403
+ return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, _extends({}, resizableMediaSingleProps, {
404
+ showLegacyNotification: widthType !== 'pixel'
405
+ }), MediaChildren) : jsx(ResizableMediaSingle, _extends({}, resizableMediaSingleProps, {
406
+ lineLength: contentWidthForLegacyExperience,
407
+ pctWidth: mediaSingleWidthAttribute
408
+ }), MediaChildren) : jsx(MediaSingle, _extends({}, mediaSingleProps, {
409
+ pctWidth: mediaSingleWidthAttribute
410
+ }), MediaChildren);
411
+ }
412
+ }]);
413
+ return MediaSingleNode;
414
+ }(Component);
415
+ _defineProperty(MediaSingleNode, "defaultProps", {
416
+ mediaOptions: {}
417
+ });
418
+ _defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
419
+ export { MediaSingleNode as default };
420
+ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref5) {
421
+ var pluginInjectionApi = _ref5.pluginInjectionApi,
422
+ mediaProvider = _ref5.mediaProvider,
423
+ contextIdentifierProvider = _ref5.contextIdentifierProvider,
424
+ node = _ref5.node,
425
+ getPos = _ref5.getPos,
426
+ mediaOptions = _ref5.mediaOptions,
427
+ view = _ref5.view,
428
+ fullWidthMode = _ref5.fullWidthMode,
429
+ selected = _ref5.selected,
430
+ eventDispatcher = _ref5.eventDispatcher,
431
+ dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent,
432
+ forwardRef = _ref5.forwardRef;
433
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media']),
434
+ widthState = _useSharedPluginState.widthState,
435
+ mediaState = _useSharedPluginState.mediaState;
436
+ return jsx(MediaSingleNode, {
437
+ width: widthState.width,
438
+ lineLength: widthState.lineLength,
439
+ node: node,
440
+ getPos: getPos,
441
+ mediaProvider: mediaProvider,
442
+ contextIdentifierProvider: contextIdentifierProvider,
443
+ mediaOptions: mediaOptions,
444
+ view: view,
445
+ fullWidthMode: fullWidthMode,
446
+ selected: selected,
447
+ eventDispatcher: eventDispatcher,
448
+ mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
449
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
450
+ forwardRef: forwardRef,
451
+ pluginInjectionApi: pluginInjectionApi
452
+ });
453
+ };
454
+ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
455
+ _inherits(MediaSingleNodeView, _ReactNodeView);
456
+ var _super2 = _createSuper(MediaSingleNodeView);
457
+ function MediaSingleNodeView() {
458
+ var _this2;
459
+ _classCallCheck(this, MediaSingleNodeView);
460
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
461
+ args[_key2] = arguments[_key2];
462
+ }
463
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
464
+ _defineProperty(_assertThisInitialized(_this2), "lastOffsetLeft", 0);
465
+ _defineProperty(_assertThisInitialized(_this2), "forceViewUpdate", false);
466
+ _defineProperty(_assertThisInitialized(_this2), "selectionType", null);
467
+ _defineProperty(_assertThisInitialized(_this2), "checkAndUpdateSelectionType", function () {
468
+ var getPos = _this2.getPos;
469
+ var selection = _this2.view.state.selection;
470
+
471
+ /**
472
+ * ED-19831
473
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
474
+ * directly to confluence since this bug is now in production.
475
+ */
476
+ var pos;
477
+ try {
478
+ pos = getPos ? getPos() : undefined;
479
+ } catch (e) {
480
+ pos = undefined;
481
+ }
482
+ var isNodeSelected = isNodeSelectedOrInRange(selection.$anchor.pos, selection.$head.pos, pos, _this2.node.nodeSize);
483
+ _this2.selectionType = isNodeSelected;
484
+ return isNodeSelected;
485
+ });
486
+ _defineProperty(_assertThisInitialized(_this2), "isNodeSelected", function () {
487
+ _this2.checkAndUpdateSelectionType();
488
+ return _this2.selectionType !== null;
489
+ });
490
+ return _this2;
491
+ }
492
+ _createClass(MediaSingleNodeView, [{
493
+ key: "createDomRef",
494
+ value: function createDomRef() {
495
+ var domRef = document.createElement('div');
496
+ if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
497
+ // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
498
+ // see also: https://github.com/ProseMirror/prosemirror/issues/884
499
+ domRef.contentEditable = 'true';
500
+ }
501
+ if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
502
+ domRef.classList.add('media-extended-resize-experience');
503
+ }
504
+ return domRef;
505
+ }
506
+ }, {
507
+ key: "getContentDOM",
508
+ value: function getContentDOM() {
509
+ var dom = document.createElement('div');
510
+ dom.classList.add(MEDIA_CONTENT_WRAP_CLASS_NAME);
511
+ return {
512
+ dom: dom
513
+ };
514
+ }
515
+ }, {
516
+ key: "viewShouldUpdate",
517
+ value: function viewShouldUpdate(nextNode) {
518
+ if (this.forceViewUpdate) {
519
+ this.forceViewUpdate = false;
520
+ return true;
521
+ }
522
+ if (this.node.attrs !== nextNode.attrs) {
523
+ return true;
524
+ }
525
+ if (this.selectionType !== this.checkAndUpdateSelectionType()) {
526
+ return true;
527
+ }
528
+ if (this.node.childCount !== nextNode.childCount) {
529
+ return true;
530
+ }
531
+ return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
532
+ }
533
+ }, {
534
+ key: "getNodeMediaId",
535
+ value: function getNodeMediaId(node) {
536
+ if (node.firstChild) {
537
+ return node.firstChild.attrs.id;
538
+ }
539
+ return undefined;
540
+ }
541
+ }, {
542
+ key: "update",
543
+ value: function update(node, decorations, _innerDecorations, isValidUpdate) {
544
+ var _this3 = this;
545
+ if (!isValidUpdate) {
546
+ isValidUpdate = function isValidUpdate(currentNode, newNode) {
547
+ return _this3.getNodeMediaId(currentNode) === _this3.getNodeMediaId(newNode);
548
+ };
549
+ }
550
+ return _get(_getPrototypeOf(MediaSingleNodeView.prototype), "update", this).call(this, node, decorations, _innerDecorations, isValidUpdate);
551
+ }
552
+ }, {
553
+ key: "render",
554
+ value: function render(props, forwardRef) {
555
+ var _this4 = this;
556
+ var _this$reactComponentP = this.reactComponentProps,
557
+ eventDispatcher = _this$reactComponentP.eventDispatcher,
558
+ fullWidthMode = _this$reactComponentP.fullWidthMode,
559
+ providerFactory = _this$reactComponentP.providerFactory,
560
+ mediaOptions = _this$reactComponentP.mediaOptions,
561
+ dispatchAnalyticsEvent = _this$reactComponentP.dispatchAnalyticsEvent,
562
+ pluginInjectionApi = _this$reactComponentP.pluginInjectionApi;
563
+
564
+ // getPos is a boolean for marks, since this is a node we know it must be a function
565
+ var getPos = this.getPos;
566
+ return jsx(WithProviders, {
567
+ providers: ['mediaProvider', 'contextIdentifierProvider'],
568
+ providerFactory: providerFactory,
569
+ renderNode: function renderNode(_ref6) {
570
+ var mediaProvider = _ref6.mediaProvider,
571
+ contextIdentifierProvider = _ref6.contextIdentifierProvider;
572
+ return jsx(MediaSingleNodeWrapper, {
573
+ pluginInjectionApi: pluginInjectionApi,
574
+ mediaProvider: mediaProvider,
575
+ contextIdentifierProvider: contextIdentifierProvider,
576
+ node: _this4.node,
577
+ getPos: getPos,
578
+ mediaOptions: mediaOptions,
579
+ view: _this4.view,
580
+ fullWidthMode: fullWidthMode,
581
+ selected: _this4.isNodeSelected,
582
+ eventDispatcher: eventDispatcher,
583
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
584
+ forwardRef: forwardRef
585
+ });
586
+ }
587
+ });
588
+ }
589
+ }, {
590
+ key: "ignoreMutation",
591
+ value: function ignoreMutation() {
592
+ // DOM has changed; recalculate if we need to re-render
593
+ if (this.dom) {
594
+ var offsetLeft = this.dom.offsetLeft;
595
+ if (offsetLeft !== this.lastOffsetLeft) {
596
+ this.lastOffsetLeft = offsetLeft;
597
+ this.forceViewUpdate = true;
598
+ this.update(this.node, [], undefined, function () {
599
+ return true;
600
+ });
601
+ }
602
+ }
603
+ return true;
604
+ }
605
+ }]);
606
+ return MediaSingleNodeView;
607
+ }(ReactNodeView);
608
+ export var ReactMediaSingleNode = function ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) {
609
+ var mediaOptions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
610
+ return function (node, view, getPos) {
611
+ var hasIntlContext = true;
612
+ return new MediaSingleNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
613
+ eventDispatcher: eventDispatcher,
614
+ fullWidthMode: mediaOptions.fullWidthEnabled,
615
+ providerFactory: providerFactory,
616
+ mediaOptions: mediaOptions,
617
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
618
+ isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
619
+ pluginInjectionApi: pluginInjectionApi
620
+ }, undefined, undefined, undefined, hasIntlContext).init();
621
+ };
622
+ };
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ mediaGroupDeleteLabel: {
4
+ id: 'fabric.editor.mediaGroupDeleteLabel',
5
+ defaultMessage: 'delete',
6
+ description: 'a label for an icon that deletes media'
7
+ }
8
+ });
@@ -0,0 +1,39 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ /** @jsx jsx */
4
+ import React from 'react';
5
+ import { css, jsx } from '@emotion/react';
6
+ import { MediaBorderGapFiller } from '@atlaskit/editor-common/ui';
7
+ export var MediaInlineNodeSelector = 'media-inline-node';
8
+ export var MediaSingleNodeSelector = 'media-single-node';
9
+ export var figureWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0;\n"])));
10
+ var absoluteDiv = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: 100%;\n height: 100%;\n"])));
11
+ var forcedDimensions = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n position: relative;\n"])));
12
+ export var MediaCardWrapper = function MediaCardWrapper(_ref) {
13
+ var dimensions = _ref.dimensions,
14
+ children = _ref.children,
15
+ selected = _ref.selected,
16
+ _ref$borderWidth = _ref.borderWidth,
17
+ borderWidth = _ref$borderWidth === void 0 ? 0 : _ref$borderWidth,
18
+ onContextMenu = _ref.onContextMenu;
19
+ var calculatedBorderWidth = selected && borderWidth > 0 ? borderWidth + 1 : borderWidth;
20
+ return jsx("div", {
21
+ "data-testid": "media-card-wrapper",
22
+ style: {
23
+ borderColor: "var(--custom-palette-color)",
24
+ borderWidth: "".concat(calculatedBorderWidth, "px"),
25
+ borderStyle: 'solid',
26
+ borderRadius: "".concat(calculatedBorderWidth * 2, "px")
27
+ }
28
+ }, jsx("div", {
29
+ css: forcedDimensions,
30
+ style: {
31
+ paddingBottom: "".concat(dimensions.height / dimensions.width * 100, "%")
32
+ },
33
+ onContextMenuCapture: onContextMenu
34
+ }, borderWidth > 0 && jsx(MediaBorderGapFiller, {
35
+ borderColor: "var(--custom-palette-color)"
36
+ }), jsx("div", {
37
+ css: absoluteDiv
38
+ }, children)));
39
+ };
@@ -0,0 +1 @@
1
+ export {};