@atlaskit/editor-core 182.1.1 → 182.2.0

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 (417) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/actions/index.js +90 -98
  3. package/dist/cjs/analytics-api/attach-payload-into-transaction.js +4 -0
  4. package/dist/cjs/create-editor/ErrorBoundary.js +86 -93
  5. package/dist/cjs/create-editor/ReactEditorViewInternal.js +8 -6
  6. package/dist/cjs/editor-next/index.js +5 -6
  7. package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +34 -37
  8. package/dist/cjs/editor-next/utils/trackEditorActions.js +48 -51
  9. package/dist/cjs/editor.js +29 -34
  10. package/dist/cjs/i18n/cs.js +34 -6
  11. package/dist/cjs/i18n/da.js +34 -6
  12. package/dist/cjs/i18n/de.js +34 -7
  13. package/dist/cjs/i18n/en.js +31 -4
  14. package/dist/cjs/i18n/en_GB.js +34 -7
  15. package/dist/cjs/i18n/en_ZZ.js +35 -8
  16. package/dist/cjs/i18n/es.js +33 -6
  17. package/dist/cjs/i18n/fi.js +33 -6
  18. package/dist/cjs/i18n/fr.js +34 -7
  19. package/dist/cjs/i18n/hu.js +33 -6
  20. package/dist/cjs/i18n/it.js +34 -7
  21. package/dist/cjs/i18n/ja.js +33 -6
  22. package/dist/cjs/i18n/ko.js +33 -6
  23. package/dist/cjs/i18n/nb.js +35 -8
  24. package/dist/cjs/i18n/nl.js +34 -7
  25. package/dist/cjs/i18n/pl.js +34 -7
  26. package/dist/cjs/i18n/pt_BR.js +34 -7
  27. package/dist/cjs/i18n/ru.js +34 -7
  28. package/dist/cjs/i18n/sv.js +33 -6
  29. package/dist/cjs/i18n/th.js +34 -7
  30. package/dist/cjs/i18n/tr.js +33 -6
  31. package/dist/cjs/i18n/uk.js +34 -7
  32. package/dist/cjs/i18n/vi.js +35 -8
  33. package/dist/cjs/i18n/zh.js +33 -4
  34. package/dist/cjs/i18n/zh_TW.js +33 -6
  35. package/dist/cjs/labs/CollapsedEditor/index.js +1 -1
  36. package/dist/cjs/plugins/analytics/plugin.js +1 -1
  37. package/dist/cjs/plugins/analytics/utils.js +2 -0
  38. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +39 -44
  39. package/dist/cjs/plugins/annotation/pm-plugins/types.js +4 -4
  40. package/dist/cjs/plugins/annotation/types.js +4 -4
  41. package/dist/cjs/plugins/base/pm-plugins/decoration.js +4 -4
  42. package/dist/cjs/plugins/block-type/commands/block-type.js +1 -1
  43. package/dist/cjs/plugins/card/nodeviews/embedCard.js +5 -6
  44. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +3 -4
  45. package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +16 -1
  46. package/dist/cjs/plugins/collab-edit/index.js +29 -32
  47. package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -4
  48. package/dist/cjs/plugins/custom-autoformat/doc.js +28 -31
  49. package/dist/cjs/plugins/custom-autoformat/index.js +20 -23
  50. package/dist/cjs/plugins/date/index.js +1 -1
  51. package/dist/cjs/plugins/date/ui/DatePicker/date-picker-input.js +7 -10
  52. package/dist/cjs/plugins/date/utils/internal.js +1 -1
  53. package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
  54. package/dist/cjs/plugins/extension/actions.js +36 -39
  55. package/dist/cjs/plugins/extension/context-panel.js +123 -130
  56. package/dist/cjs/plugins/extension/pm-plugins/main.js +82 -89
  57. package/dist/cjs/plugins/extension/pm-plugins/utils.js +46 -51
  58. package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +44 -48
  59. package/dist/cjs/plugins/feedback-dialog/index.js +52 -57
  60. package/dist/cjs/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +44 -47
  61. package/dist/cjs/plugins/find-replace/actions.js +4 -4
  62. package/dist/cjs/plugins/find-replace/utils/batch-decorations.js +144 -153
  63. package/dist/cjs/plugins/find-replace/utils/index.js +2 -2
  64. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +40 -46
  65. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  66. package/dist/cjs/plugins/floating-toolbar/ui/ToolbarLoader.js +2 -1
  67. package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +86 -86
  68. package/dist/cjs/plugins/help-dialog/ui/HelpDialogLoader.js +2 -1
  69. package/dist/cjs/plugins/history/actions.js +4 -4
  70. package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +76 -82
  71. package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
  72. package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +16 -16
  73. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +339 -352
  74. package/dist/cjs/plugins/hyperlink/utils.js +3 -0
  75. package/dist/cjs/plugins/image-upload/pm-plugins/main.js +24 -27
  76. package/dist/cjs/plugins/list/utils/node.js +4 -4
  77. package/dist/cjs/plugins/macro/actions.js +107 -112
  78. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +43 -46
  79. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +62 -66
  80. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +544 -575
  81. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +38 -42
  82. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +108 -113
  83. package/dist/cjs/plugins/media/picker-facade.js +22 -25
  84. package/dist/cjs/plugins/media/pm-plugins/linking/actions.js +4 -4
  85. package/dist/cjs/plugins/media/pm-plugins/main.js +159 -172
  86. package/dist/cjs/plugins/media/pm-plugins/mediaTaskManager.js +36 -39
  87. package/dist/cjs/plugins/media/toolbar/index.js +3 -0
  88. package/dist/cjs/plugins/media/toolbar/utils.js +30 -33
  89. package/dist/cjs/plugins/media/ui/ImageBorder/index.js +1 -1
  90. package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +1 -1
  91. package/dist/cjs/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +71 -74
  92. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +52 -57
  93. package/dist/cjs/plugins/media/utils/check-media-type.js +37 -40
  94. package/dist/cjs/plugins/mentions/nodeviews/mention.js +29 -31
  95. package/dist/cjs/plugins/mentions/type-ahead/index.js +1 -1
  96. package/dist/cjs/plugins/mobile-dimensions/actions.js +4 -4
  97. package/dist/cjs/plugins/paste/actions.js +4 -4
  98. package/dist/cjs/plugins/paste/handlers.js +23 -26
  99. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -0
  100. package/dist/cjs/plugins/paste/md.js +3 -0
  101. package/dist/cjs/plugins/paste/newline-md-plugin.js +3 -0
  102. package/dist/cjs/plugins/paste/paragraph-md-plugin.js +3 -0
  103. package/dist/cjs/plugins/paste/pm-plugins/main.js +25 -27
  104. package/dist/cjs/plugins/quick-insert/assets/index.js +63 -39
  105. package/dist/cjs/plugins/quick-insert/index.js +30 -33
  106. package/dist/cjs/plugins/selection/actions.js +4 -4
  107. package/dist/cjs/plugins/selection/gap-cursor/direction.js +4 -4
  108. package/dist/cjs/plugins/selection/types.js +4 -4
  109. package/dist/cjs/plugins/status/ui/statusPicker.js +7 -8
  110. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -10
  111. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/commands.js +16 -6
  112. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +12 -20
  113. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  114. package/dist/cjs/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +41 -42
  115. package/dist/cjs/plugins/tasks-and-decisions/utils.js +31 -2
  116. package/dist/cjs/plugins/text-color/pm-plugins/main.js +4 -4
  117. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
  118. package/dist/cjs/plugins/text-formatting/ui/Toolbar/types.js +4 -4
  119. package/dist/cjs/plugins/type-ahead/constants.js +4 -4
  120. package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +4 -4
  121. package/dist/cjs/plugins/undo-redo/enums.js +4 -4
  122. package/dist/cjs/ui/Appearance/Comment/Comment.js +3 -3
  123. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +1 -2
  124. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
  125. package/dist/cjs/ui/ColorPickerButton/index.js +3 -2
  126. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +68 -73
  127. package/dist/cjs/ui/ConfigPanel/ConfigPanelLoader.js +2 -1
  128. package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +54 -56
  129. package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +51 -55
  130. package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +24 -27
  131. package/dist/cjs/ui/ConfigPanel/transformers.js +344 -363
  132. package/dist/cjs/ui/ConfigPanel/types.js +8 -8
  133. package/dist/cjs/ui/Dropdown/index.js +2 -1
  134. package/dist/cjs/ui/DropdownMenu/index.js +2 -1
  135. package/dist/cjs/ui/ElementBrowser/components/ElementBrowserLoader.js +1 -1
  136. package/dist/cjs/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +4 -4
  137. package/dist/cjs/ui/ElementBrowser/types.js +4 -4
  138. package/dist/cjs/ui/LinkSearch/index.js +94 -101
  139. package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +19 -2
  140. package/dist/cjs/ui/ToolbarFeedback/index.js +27 -31
  141. package/dist/cjs/utils/action.js +31 -36
  142. package/dist/cjs/utils/clipboard.js +82 -86
  143. package/dist/cjs/utils/deprecation-warnings.js +1 -1
  144. package/dist/cjs/utils/extensions.js +62 -67
  145. package/dist/cjs/utils/insert.js +4 -4
  146. package/dist/cjs/utils/mark.js +2 -2
  147. package/dist/cjs/utils/performance/simple-measure-to-entries.js +1 -2
  148. package/dist/cjs/utils/performance/track-transactions.js +3 -2
  149. package/dist/cjs/version-wrapper.js +1 -1
  150. package/dist/cjs/version.json +1 -1
  151. package/dist/es2019/actions/index.js +8 -9
  152. package/dist/es2019/analytics-api/attach-payload-into-transaction.js +4 -0
  153. package/dist/es2019/create-editor/ReactEditorViewInternal.js +5 -3
  154. package/dist/es2019/editor-next/index.js +5 -6
  155. package/dist/es2019/editor.js +29 -36
  156. package/dist/es2019/i18n/cs.js +34 -6
  157. package/dist/es2019/i18n/da.js +34 -6
  158. package/dist/es2019/i18n/de.js +34 -7
  159. package/dist/es2019/i18n/en.js +31 -4
  160. package/dist/es2019/i18n/en_GB.js +34 -7
  161. package/dist/es2019/i18n/en_ZZ.js +35 -8
  162. package/dist/es2019/i18n/es.js +33 -6
  163. package/dist/es2019/i18n/fi.js +33 -6
  164. package/dist/es2019/i18n/fr.js +34 -7
  165. package/dist/es2019/i18n/hu.js +33 -6
  166. package/dist/es2019/i18n/it.js +34 -7
  167. package/dist/es2019/i18n/ja.js +33 -6
  168. package/dist/es2019/i18n/ko.js +33 -6
  169. package/dist/es2019/i18n/nb.js +35 -8
  170. package/dist/es2019/i18n/nl.js +34 -7
  171. package/dist/es2019/i18n/pl.js +34 -7
  172. package/dist/es2019/i18n/pt_BR.js +34 -7
  173. package/dist/es2019/i18n/ru.js +34 -7
  174. package/dist/es2019/i18n/sv.js +33 -6
  175. package/dist/es2019/i18n/th.js +34 -7
  176. package/dist/es2019/i18n/tr.js +33 -6
  177. package/dist/es2019/i18n/uk.js +34 -7
  178. package/dist/es2019/i18n/vi.js +35 -8
  179. package/dist/es2019/i18n/zh.js +33 -4
  180. package/dist/es2019/i18n/zh_TW.js +33 -6
  181. package/dist/es2019/plugins/analytics/utils.js +2 -0
  182. package/dist/es2019/plugins/annotation/pm-plugins/types.js +3 -3
  183. package/dist/es2019/plugins/annotation/types.js +3 -3
  184. package/dist/es2019/plugins/base/pm-plugins/decoration.js +3 -3
  185. package/dist/es2019/plugins/card/nodeviews/embedCard.js +5 -7
  186. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +3 -5
  187. package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +17 -2
  188. package/dist/es2019/plugins/collab-edit/plugin-state.js +1 -2
  189. package/dist/es2019/plugins/date/ui/DatePicker/date-picker-input.js +7 -11
  190. package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
  191. package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +8 -12
  192. package/dist/es2019/plugins/find-replace/actions.js +3 -3
  193. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  194. package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +56 -71
  195. package/dist/es2019/plugins/history/actions.js +3 -3
  196. package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
  197. package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +6 -6
  198. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -2
  199. package/dist/es2019/plugins/hyperlink/utils.js +3 -0
  200. package/dist/es2019/plugins/list/utils/node.js +3 -3
  201. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +4 -8
  202. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -3
  203. package/dist/es2019/plugins/media/pm-plugins/linking/actions.js +3 -3
  204. package/dist/es2019/plugins/media/pm-plugins/main.js +22 -31
  205. package/dist/es2019/plugins/media/toolbar/index.js +3 -0
  206. package/dist/es2019/plugins/media/ui/ImageBorder/index.js +1 -1
  207. package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +1 -1
  208. package/dist/es2019/plugins/mobile-dimensions/actions.js +3 -3
  209. package/dist/es2019/plugins/paste/actions.js +3 -3
  210. package/dist/es2019/plugins/paste/linkify-md-plugin.js +3 -0
  211. package/dist/es2019/plugins/paste/md.js +3 -0
  212. package/dist/es2019/plugins/paste/newline-md-plugin.js +3 -0
  213. package/dist/es2019/plugins/paste/paragraph-md-plugin.js +3 -0
  214. package/dist/es2019/plugins/selection/actions.js +3 -3
  215. package/dist/es2019/plugins/selection/gap-cursor/direction.js +3 -3
  216. package/dist/es2019/plugins/selection/types.js +3 -3
  217. package/dist/es2019/plugins/status/ui/statusPicker.js +6 -7
  218. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -11
  219. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/commands.js +15 -3
  220. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +6 -16
  221. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  222. package/dist/es2019/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +6 -5
  223. package/dist/es2019/plugins/tasks-and-decisions/utils.js +30 -0
  224. package/dist/es2019/plugins/text-color/pm-plugins/main.js +3 -3
  225. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
  226. package/dist/es2019/plugins/text-formatting/ui/Toolbar/types.js +3 -3
  227. package/dist/es2019/plugins/type-ahead/constants.js +3 -3
  228. package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +3 -3
  229. package/dist/es2019/plugins/undo-redo/enums.js +3 -3
  230. package/dist/es2019/ui/Appearance/Comment/Comment.js +3 -3
  231. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -2
  232. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
  233. package/dist/es2019/ui/ColorPickerButton/index.js +5 -3
  234. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +3 -4
  235. package/dist/es2019/ui/ConfigPanel/types.js +6 -6
  236. package/dist/es2019/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +3 -3
  237. package/dist/es2019/ui/ElementBrowser/types.js +3 -3
  238. package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +18 -2
  239. package/dist/es2019/ui/ToolbarFeedback/index.js +1 -3
  240. package/dist/es2019/utils/insert.js +3 -3
  241. package/dist/es2019/utils/performance/simple-measure-to-entries.js +1 -1
  242. package/dist/es2019/utils/performance/track-transactions.js +3 -2
  243. package/dist/es2019/version-wrapper.js +1 -1
  244. package/dist/es2019/version.json +1 -1
  245. package/dist/esm/actions/index.js +90 -98
  246. package/dist/esm/analytics-api/attach-payload-into-transaction.js +4 -0
  247. package/dist/esm/create-editor/ErrorBoundary.js +86 -93
  248. package/dist/esm/create-editor/ReactEditorViewInternal.js +6 -5
  249. package/dist/esm/editor-next/index.js +5 -6
  250. package/dist/esm/editor-next/utils/sendDurationAnalytics.js +34 -37
  251. package/dist/esm/editor-next/utils/trackEditorActions.js +48 -51
  252. package/dist/esm/editor.js +29 -34
  253. package/dist/esm/i18n/cs.js +34 -6
  254. package/dist/esm/i18n/da.js +34 -6
  255. package/dist/esm/i18n/de.js +34 -7
  256. package/dist/esm/i18n/en.js +31 -4
  257. package/dist/esm/i18n/en_GB.js +34 -7
  258. package/dist/esm/i18n/en_ZZ.js +35 -8
  259. package/dist/esm/i18n/es.js +33 -6
  260. package/dist/esm/i18n/fi.js +33 -6
  261. package/dist/esm/i18n/fr.js +34 -7
  262. package/dist/esm/i18n/hu.js +33 -6
  263. package/dist/esm/i18n/it.js +34 -7
  264. package/dist/esm/i18n/ja.js +33 -6
  265. package/dist/esm/i18n/ko.js +33 -6
  266. package/dist/esm/i18n/nb.js +35 -8
  267. package/dist/esm/i18n/nl.js +34 -7
  268. package/dist/esm/i18n/pl.js +34 -7
  269. package/dist/esm/i18n/pt_BR.js +34 -7
  270. package/dist/esm/i18n/ru.js +34 -7
  271. package/dist/esm/i18n/sv.js +33 -6
  272. package/dist/esm/i18n/th.js +34 -7
  273. package/dist/esm/i18n/tr.js +33 -6
  274. package/dist/esm/i18n/uk.js +34 -7
  275. package/dist/esm/i18n/vi.js +35 -8
  276. package/dist/esm/i18n/zh.js +33 -4
  277. package/dist/esm/i18n/zh_TW.js +33 -6
  278. package/dist/esm/plugins/analytics/plugin.js +1 -1
  279. package/dist/esm/plugins/analytics/utils.js +2 -0
  280. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +39 -44
  281. package/dist/esm/plugins/annotation/pm-plugins/types.js +3 -3
  282. package/dist/esm/plugins/annotation/types.js +3 -3
  283. package/dist/esm/plugins/base/pm-plugins/decoration.js +3 -3
  284. package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
  285. package/dist/esm/plugins/card/nodeviews/embedCard.js +5 -6
  286. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +3 -4
  287. package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +17 -2
  288. package/dist/esm/plugins/collab-edit/index.js +29 -32
  289. package/dist/esm/plugins/collab-edit/plugin-state.js +2 -4
  290. package/dist/esm/plugins/custom-autoformat/doc.js +28 -31
  291. package/dist/esm/plugins/custom-autoformat/index.js +20 -23
  292. package/dist/esm/plugins/date/ui/DatePicker/date-picker-input.js +7 -10
  293. package/dist/esm/plugins/date/utils/internal.js +1 -1
  294. package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
  295. package/dist/esm/plugins/extension/actions.js +36 -39
  296. package/dist/esm/plugins/extension/context-panel.js +123 -129
  297. package/dist/esm/plugins/extension/pm-plugins/main.js +82 -88
  298. package/dist/esm/plugins/extension/pm-plugins/utils.js +46 -51
  299. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +44 -49
  300. package/dist/esm/plugins/feedback-dialog/index.js +52 -57
  301. package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +44 -47
  302. package/dist/esm/plugins/find-replace/actions.js +3 -3
  303. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +144 -153
  304. package/dist/esm/plugins/find-replace/utils/index.js +2 -2
  305. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +40 -47
  306. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  307. package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +78 -76
  308. package/dist/esm/plugins/history/actions.js +3 -3
  309. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +76 -83
  310. package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
  311. package/dist/esm/plugins/hyperlink/pm-plugins/main.js +14 -14
  312. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +339 -353
  313. package/dist/esm/plugins/hyperlink/utils.js +3 -0
  314. package/dist/esm/plugins/image-upload/pm-plugins/main.js +24 -27
  315. package/dist/esm/plugins/list/utils/node.js +3 -3
  316. package/dist/esm/plugins/macro/actions.js +107 -112
  317. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +43 -46
  318. package/dist/esm/plugins/media/nodeviews/mediaInline.js +62 -67
  319. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +544 -575
  320. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +38 -43
  321. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +108 -114
  322. package/dist/esm/plugins/media/picker-facade.js +22 -25
  323. package/dist/esm/plugins/media/pm-plugins/linking/actions.js +3 -3
  324. package/dist/esm/plugins/media/pm-plugins/main.js +159 -173
  325. package/dist/esm/plugins/media/pm-plugins/mediaTaskManager.js +36 -39
  326. package/dist/esm/plugins/media/toolbar/index.js +3 -0
  327. package/dist/esm/plugins/media/toolbar/utils.js +30 -33
  328. package/dist/esm/plugins/media/ui/ImageBorder/index.js +1 -1
  329. package/dist/esm/plugins/media/ui/ImageBorder/styles.js +1 -1
  330. package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +71 -74
  331. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +52 -57
  332. package/dist/esm/plugins/media/utils/check-media-type.js +37 -40
  333. package/dist/esm/plugins/mentions/nodeviews/mention.js +29 -32
  334. package/dist/esm/plugins/mentions/type-ahead/index.js +1 -1
  335. package/dist/esm/plugins/mobile-dimensions/actions.js +3 -3
  336. package/dist/esm/plugins/paste/actions.js +3 -3
  337. package/dist/esm/plugins/paste/handlers.js +23 -26
  338. package/dist/esm/plugins/paste/linkify-md-plugin.js +3 -0
  339. package/dist/esm/plugins/paste/md.js +3 -0
  340. package/dist/esm/plugins/paste/newline-md-plugin.js +3 -0
  341. package/dist/esm/plugins/paste/paragraph-md-plugin.js +3 -0
  342. package/dist/esm/plugins/paste/pm-plugins/main.js +25 -28
  343. package/dist/esm/plugins/quick-insert/index.js +30 -33
  344. package/dist/esm/plugins/selection/actions.js +3 -3
  345. package/dist/esm/plugins/selection/gap-cursor/direction.js +3 -3
  346. package/dist/esm/plugins/selection/types.js +3 -3
  347. package/dist/esm/plugins/status/ui/statusPicker.js +6 -7
  348. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -10
  349. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/commands.js +17 -7
  350. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +13 -21
  351. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  352. package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +41 -43
  353. package/dist/esm/plugins/tasks-and-decisions/utils.js +28 -0
  354. package/dist/esm/plugins/text-color/pm-plugins/main.js +3 -3
  355. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
  356. package/dist/esm/plugins/text-formatting/ui/Toolbar/types.js +3 -3
  357. package/dist/esm/plugins/type-ahead/constants.js +3 -3
  358. package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +3 -3
  359. package/dist/esm/plugins/undo-redo/enums.js +3 -3
  360. package/dist/esm/ui/Appearance/Comment/Comment.js +3 -3
  361. package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -2
  362. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
  363. package/dist/esm/ui/ColorPickerButton/index.js +3 -2
  364. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +68 -74
  365. package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +54 -57
  366. package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +51 -56
  367. package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +24 -27
  368. package/dist/esm/ui/ConfigPanel/transformers.js +344 -362
  369. package/dist/esm/ui/ConfigPanel/types.js +6 -6
  370. package/dist/esm/ui/Dropdown/index.js +2 -1
  371. package/dist/esm/ui/DropdownMenu/index.js +2 -1
  372. package/dist/esm/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +3 -3
  373. package/dist/esm/ui/ElementBrowser/types.js +3 -3
  374. package/dist/esm/ui/LinkSearch/index.js +94 -101
  375. package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +18 -2
  376. package/dist/esm/ui/ToolbarFeedback/index.js +27 -31
  377. package/dist/esm/utils/action.js +31 -36
  378. package/dist/esm/utils/clipboard.js +82 -87
  379. package/dist/esm/utils/deprecation-warnings.js +1 -1
  380. package/dist/esm/utils/extensions.js +62 -67
  381. package/dist/esm/utils/insert.js +3 -3
  382. package/dist/esm/utils/mark.js +2 -2
  383. package/dist/esm/utils/performance/simple-measure-to-entries.js +1 -2
  384. package/dist/esm/utils/performance/track-transactions.js +3 -2
  385. package/dist/esm/version-wrapper.js +1 -1
  386. package/dist/esm/version.json +1 -1
  387. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -0
  388. package/dist/types/i18n/cs.d.ts +29 -2
  389. package/dist/types/i18n/da.d.ts +29 -2
  390. package/dist/types/i18n/de.d.ts +28 -2
  391. package/dist/types/i18n/en.d.ts +28 -2
  392. package/dist/types/i18n/en_GB.d.ts +31 -5
  393. package/dist/types/i18n/en_ZZ.d.ts +28 -2
  394. package/dist/types/i18n/es.d.ts +28 -2
  395. package/dist/types/i18n/fi.d.ts +28 -2
  396. package/dist/types/i18n/fr.d.ts +28 -2
  397. package/dist/types/i18n/hu.d.ts +28 -2
  398. package/dist/types/i18n/it.d.ts +28 -2
  399. package/dist/types/i18n/ja.d.ts +28 -2
  400. package/dist/types/i18n/ko.d.ts +28 -2
  401. package/dist/types/i18n/nb.d.ts +28 -2
  402. package/dist/types/i18n/nl.d.ts +28 -2
  403. package/dist/types/i18n/pl.d.ts +28 -2
  404. package/dist/types/i18n/pt_BR.d.ts +28 -2
  405. package/dist/types/i18n/ru.d.ts +28 -2
  406. package/dist/types/i18n/sv.d.ts +28 -2
  407. package/dist/types/i18n/th.d.ts +28 -2
  408. package/dist/types/i18n/tr.d.ts +28 -2
  409. package/dist/types/i18n/uk.d.ts +28 -2
  410. package/dist/types/i18n/vi.d.ts +28 -2
  411. package/dist/types/i18n/zh.d.ts +30 -2
  412. package/dist/types/i18n/zh_TW.d.ts +28 -2
  413. package/dist/types/plugins/tasks-and-decisions/utils.d.ts +2 -0
  414. package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +3 -1
  415. package/dist/types/utils/document.d.ts +2 -2
  416. package/package.json +15 -15
  417. package/report.api.md +1 -1
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.MediaNodeUpdater = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -15,67 +15,64 @@ var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _mediaClient = require("@atlaskit/media-client");
16
16
  var _analytics = require("../../analytics");
17
17
  var _helpers = require("../commands/helpers");
18
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
19
18
  var MediaNodeUpdater = /*#__PURE__*/function () {
20
19
  function MediaNodeUpdater(props) {
21
20
  var _this = this;
22
21
  (0, _classCallCheck2.default)(this, MediaNodeUpdater);
23
- (0, _defineProperty2.default)(this, "updateContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
22
+ // Updates the node with contextId if it doesn't have one already
23
+ // TODO [MS-2258]: remove updateContextId in order to only use updateMediaSingleFileAttrs
24
+ (0, _defineProperty2.default)(this, "updateContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
24
25
  var attrs, id, objectId;
25
- return _regeneratorRuntime().wrap(function _callee$(_context) {
26
- while (1) {
27
- switch (_context.prev = _context.next) {
26
+ return _regenerator.default.wrap(function _callee$(_context) {
27
+ while (1) switch (_context.prev = _context.next) {
28
+ case 0:
29
+ attrs = _this.getAttrs();
30
+ if (!(!attrs || attrs.type !== 'file')) {
31
+ _context.next = 3;
32
+ break;
33
+ }
34
+ return _context.abrupt("return");
35
+ case 3:
36
+ id = attrs.id;
37
+ _context.next = 6;
38
+ return _this.getObjectId();
39
+ case 6:
40
+ objectId = _context.sent;
41
+ (0, _helpers.updateAllMediaSingleNodesAttrs)(id, {
42
+ __contextId: objectId
43
+ })(_this.props.view.state, _this.props.view.dispatch);
44
+ case 8:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ })));
50
+ (0, _defineProperty2.default)(this, "updateNodeContextId", /*#__PURE__*/function () {
51
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(getPos) {
52
+ var attrs, objectId;
53
+ return _regenerator.default.wrap(function _callee2$(_context2) {
54
+ while (1) switch (_context2.prev = _context2.next) {
28
55
  case 0:
29
56
  attrs = _this.getAttrs();
30
- if (!(!attrs || attrs.type !== 'file')) {
31
- _context.next = 3;
57
+ if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
58
+ _context2.next = 3;
32
59
  break;
33
60
  }
34
- return _context.abrupt("return");
61
+ return _context2.abrupt("return");
35
62
  case 3:
36
- id = attrs.id;
37
- _context.next = 6;
63
+ _context2.next = 5;
38
64
  return _this.getObjectId();
39
- case 6:
40
- objectId = _context.sent;
41
- (0, _helpers.updateAllMediaSingleNodesAttrs)(id, {
65
+ case 5:
66
+ objectId = _context2.sent;
67
+ (0, _helpers.updateCurrentMediaNodeAttrs)({
42
68
  __contextId: objectId
69
+ }, {
70
+ node: _this.props.node,
71
+ getPos: getPos
43
72
  })(_this.props.view.state, _this.props.view.dispatch);
44
- case 8:
73
+ case 7:
45
74
  case "end":
46
- return _context.stop();
47
- }
48
- }
49
- }, _callee);
50
- })));
51
- (0, _defineProperty2.default)(this, "updateNodeContextId", /*#__PURE__*/function () {
52
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(getPos) {
53
- var attrs, objectId;
54
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
55
- while (1) {
56
- switch (_context2.prev = _context2.next) {
57
- case 0:
58
- attrs = _this.getAttrs();
59
- if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
60
- _context2.next = 3;
61
- break;
62
- }
63
- return _context2.abrupt("return");
64
- case 3:
65
- _context2.next = 5;
66
- return _this.getObjectId();
67
- case 5:
68
- objectId = _context2.sent;
69
- (0, _helpers.updateCurrentMediaNodeAttrs)({
70
- __contextId: objectId
71
- }, {
72
- node: _this.props.node,
73
- getPos: getPos
74
- })(_this.props.view.state, _this.props.view.dispatch);
75
- case 7:
76
- case "end":
77
- return _context2.stop();
78
- }
75
+ return _context2.stop();
79
76
  }
80
77
  }, _callee2);
81
78
  }));
@@ -86,120 +83,114 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
86
83
  (0, _defineProperty2.default)(this, "hasFileAttributesDefined", function (attrs) {
87
84
  return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
88
85
  });
89
- (0, _defineProperty2.default)(this, "getNewFileAttrsForNode", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
86
+ (0, _defineProperty2.default)(this, "getNewFileAttrsForNode", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
90
87
  var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
91
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
92
- while (1) {
93
- switch (_context3.prev = _context3.next) {
94
- case 0:
95
- attrs = _this.getAttrs();
96
- _context3.next = 3;
97
- return _this.props.mediaProvider;
98
- case 3:
99
- mediaProvider = _context3.sent;
100
- if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined(attrs))) {
101
- _context3.next = 6;
102
- break;
103
- }
104
- return _context3.abrupt("return");
105
- case 6:
106
- mediaClientConfig = mediaProvider.viewMediaClientConfig;
107
- mediaClient = (0, _mediaClient.getMediaClient)(mediaClientConfig);
108
- id = attrs.id, collectionName = attrs.collection;
109
- _context3.prev = 9;
110
- _context3.next = 12;
111
- return mediaClient.file.getCurrentState(id, {
112
- collectionName: collectionName
113
- });
114
- case 12:
115
- fileState = _context3.sent;
116
- if (!(fileState.status === 'error')) {
117
- _context3.next = 15;
118
- break;
119
- }
120
- return _context3.abrupt("return");
121
- case 15:
122
- _context3.next = 20;
88
+ return _regenerator.default.wrap(function _callee3$(_context3) {
89
+ while (1) switch (_context3.prev = _context3.next) {
90
+ case 0:
91
+ attrs = _this.getAttrs();
92
+ _context3.next = 3;
93
+ return _this.props.mediaProvider;
94
+ case 3:
95
+ mediaProvider = _context3.sent;
96
+ if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined(attrs))) {
97
+ _context3.next = 6;
123
98
  break;
124
- case 17:
125
- _context3.prev = 17;
126
- _context3.t0 = _context3["catch"](9);
127
- return _context3.abrupt("return");
128
- case 20:
129
- _context3.t1 = _this.getNodeContextId();
130
- if (_context3.t1) {
131
- _context3.next = 25;
132
- break;
133
- }
134
- _context3.next = 24;
135
- return _this.getObjectId();
136
- case 24:
137
- _context3.t1 = _context3.sent;
138
- case 25:
139
- contextId = _context3.t1;
140
- _fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
141
- newAttrs = {
142
- __fileName: name,
143
- __fileMimeType: mimeType,
144
- __fileSize: size,
145
- __contextId: contextId
146
- };
147
- if (hasPrivateAttrsChanged(attrs, newAttrs)) {
148
- _context3.next = 30;
149
- break;
150
- }
151
- return _context3.abrupt("return");
152
- case 30:
153
- return _context3.abrupt("return", newAttrs);
154
- case 31:
155
- case "end":
156
- return _context3.stop();
157
- }
99
+ }
100
+ return _context3.abrupt("return");
101
+ case 6:
102
+ mediaClientConfig = mediaProvider.viewMediaClientConfig;
103
+ mediaClient = (0, _mediaClient.getMediaClient)(mediaClientConfig);
104
+ id = attrs.id, collectionName = attrs.collection;
105
+ _context3.prev = 9;
106
+ _context3.next = 12;
107
+ return mediaClient.file.getCurrentState(id, {
108
+ collectionName: collectionName
109
+ });
110
+ case 12:
111
+ fileState = _context3.sent;
112
+ if (!(fileState.status === 'error')) {
113
+ _context3.next = 15;
114
+ break;
115
+ }
116
+ return _context3.abrupt("return");
117
+ case 15:
118
+ _context3.next = 20;
119
+ break;
120
+ case 17:
121
+ _context3.prev = 17;
122
+ _context3.t0 = _context3["catch"](9);
123
+ return _context3.abrupt("return");
124
+ case 20:
125
+ _context3.t1 = _this.getNodeContextId();
126
+ if (_context3.t1) {
127
+ _context3.next = 25;
128
+ break;
129
+ }
130
+ _context3.next = 24;
131
+ return _this.getObjectId();
132
+ case 24:
133
+ _context3.t1 = _context3.sent;
134
+ case 25:
135
+ contextId = _context3.t1;
136
+ _fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
137
+ newAttrs = {
138
+ __fileName: name,
139
+ __fileMimeType: mimeType,
140
+ __fileSize: size,
141
+ __contextId: contextId
142
+ };
143
+ if (hasPrivateAttrsChanged(attrs, newAttrs)) {
144
+ _context3.next = 30;
145
+ break;
146
+ }
147
+ return _context3.abrupt("return");
148
+ case 30:
149
+ return _context3.abrupt("return", newAttrs);
150
+ case 31:
151
+ case "end":
152
+ return _context3.stop();
158
153
  }
159
154
  }, _callee3, null, [[9, 17]]);
160
155
  })));
161
- (0, _defineProperty2.default)(this, "updateMediaSingleFileAttrs", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
156
+ (0, _defineProperty2.default)(this, "updateMediaSingleFileAttrs", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
162
157
  var newAttrs, _ref5, id;
163
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
164
- while (1) {
165
- switch (_context4.prev = _context4.next) {
166
- case 0:
167
- _context4.next = 2;
168
- return _this.getNewFileAttrsForNode();
169
- case 2:
170
- newAttrs = _context4.sent;
171
- _ref5 = _this.getAttrs(), id = _ref5.id;
172
- if (id && newAttrs) {
173
- (0, _helpers.updateAllMediaSingleNodesAttrs)(id, newAttrs)(_this.props.view.state, _this.props.view.dispatch);
174
- }
175
- case 5:
176
- case "end":
177
- return _context4.stop();
178
- }
158
+ return _regenerator.default.wrap(function _callee4$(_context4) {
159
+ while (1) switch (_context4.prev = _context4.next) {
160
+ case 0:
161
+ _context4.next = 2;
162
+ return _this.getNewFileAttrsForNode();
163
+ case 2:
164
+ newAttrs = _context4.sent;
165
+ _ref5 = _this.getAttrs(), id = _ref5.id;
166
+ if (id && newAttrs) {
167
+ (0, _helpers.updateAllMediaSingleNodesAttrs)(id, newAttrs)(_this.props.view.state, _this.props.view.dispatch);
168
+ }
169
+ case 5:
170
+ case "end":
171
+ return _context4.stop();
179
172
  }
180
173
  }, _callee4);
181
174
  })));
182
175
  (0, _defineProperty2.default)(this, "updateNodeAttrs", /*#__PURE__*/function () {
183
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(getPos) {
176
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(getPos) {
184
177
  var newAttrs;
185
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
186
- while (1) {
187
- switch (_context5.prev = _context5.next) {
188
- case 0:
189
- _context5.next = 2;
190
- return _this.getNewFileAttrsForNode();
191
- case 2:
192
- newAttrs = _context5.sent;
193
- if (newAttrs) {
194
- (0, _helpers.updateCurrentMediaNodeAttrs)(newAttrs, {
195
- node: _this.props.node,
196
- getPos: getPos
197
- })(_this.props.view.state, _this.props.view.dispatch);
198
- }
199
- case 4:
200
- case "end":
201
- return _context5.stop();
202
- }
178
+ return _regenerator.default.wrap(function _callee5$(_context5) {
179
+ while (1) switch (_context5.prev = _context5.next) {
180
+ case 0:
181
+ _context5.next = 2;
182
+ return _this.getNewFileAttrsForNode();
183
+ case 2:
184
+ newAttrs = _context5.sent;
185
+ if (newAttrs) {
186
+ (0, _helpers.updateCurrentMediaNodeAttrs)(newAttrs, {
187
+ node: _this.props.node,
188
+ getPos: getPos
189
+ })(_this.props.view.state, _this.props.view.dispatch);
190
+ }
191
+ case 4:
192
+ case "end":
193
+ return _context5.stop();
203
194
  }
204
195
  }, _callee5);
205
196
  }));
@@ -214,79 +205,75 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
214
205
  }
215
206
  return undefined;
216
207
  });
217
- (0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
208
+ (0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
218
209
  var contextIdentifierProvider;
219
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
220
- while (1) {
221
- switch (_context6.prev = _context6.next) {
222
- case 0:
223
- _context6.next = 2;
224
- return _this.props.contextIdentifierProvider;
225
- case 2:
226
- contextIdentifierProvider = _context6.sent;
227
- return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
228
- case 4:
229
- case "end":
230
- return _context6.stop();
231
- }
210
+ return _regenerator.default.wrap(function _callee6$(_context6) {
211
+ while (1) switch (_context6.prev = _context6.next) {
212
+ case 0:
213
+ _context6.next = 2;
214
+ return _this.props.contextIdentifierProvider;
215
+ case 2:
216
+ contextIdentifierProvider = _context6.sent;
217
+ return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
218
+ case 4:
219
+ case "end":
220
+ return _context6.stop();
232
221
  }
233
222
  }, _callee6);
234
223
  })));
235
224
  (0, _defineProperty2.default)(this, "uploadExternalMedia", /*#__PURE__*/function () {
236
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(getPos) {
225
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(getPos) {
237
226
  var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions;
238
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
239
- while (1) {
240
- switch (_context7.prev = _context7.next) {
241
- case 0:
242
- node = _this.props.node;
243
- _context7.next = 3;
244
- return _this.props.mediaProvider;
245
- case 3:
246
- mediaProvider = _context7.sent;
247
- if (!(node && mediaProvider)) {
248
- _context7.next = 21;
249
- break;
250
- }
251
- uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
252
- if (!(!uploadMediaClientConfig || !node.attrs.url)) {
253
- _context7.next = 8;
254
- break;
255
- }
256
- return _context7.abrupt("return");
257
- case 8:
258
- mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
259
- collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
260
- _context7.prev = 10;
261
- _context7.next = 13;
262
- return mediaClient.file.uploadExternal(node.attrs.url, collection);
263
- case 13:
264
- uploader = _context7.sent;
265
- uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
266
- (0, _helpers.replaceExternalMedia)(getPos() + 1, {
267
- id: uploadableFileUpfrontIds.id,
268
- collection: collection,
269
- height: dimensions.height,
270
- width: dimensions.width,
271
- occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
272
- })(_this.props.view.state, _this.props.view.dispatch);
227
+ return _regenerator.default.wrap(function _callee7$(_context7) {
228
+ while (1) switch (_context7.prev = _context7.next) {
229
+ case 0:
230
+ node = _this.props.node;
231
+ _context7.next = 3;
232
+ return _this.props.mediaProvider;
233
+ case 3:
234
+ mediaProvider = _context7.sent;
235
+ if (!(node && mediaProvider)) {
273
236
  _context7.next = 21;
274
237
  break;
275
- case 18:
276
- _context7.prev = 18;
277
- _context7.t0 = _context7["catch"](10);
278
- //keep it as external media
279
- if (_this.props.dispatchAnalyticsEvent) {
280
- _this.props.dispatchAnalyticsEvent({
281
- action: _analytics.ACTION.UPLOAD_EXTERNAL_FAIL,
282
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
283
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
284
- });
285
- }
286
- case 21:
287
- case "end":
288
- return _context7.stop();
289
- }
238
+ }
239
+ uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
240
+ if (!(!uploadMediaClientConfig || !node.attrs.url)) {
241
+ _context7.next = 8;
242
+ break;
243
+ }
244
+ return _context7.abrupt("return");
245
+ case 8:
246
+ mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
247
+ collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
248
+ _context7.prev = 10;
249
+ _context7.next = 13;
250
+ return mediaClient.file.uploadExternal(node.attrs.url, collection);
251
+ case 13:
252
+ uploader = _context7.sent;
253
+ uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
254
+ (0, _helpers.replaceExternalMedia)(getPos() + 1, {
255
+ id: uploadableFileUpfrontIds.id,
256
+ collection: collection,
257
+ height: dimensions.height,
258
+ width: dimensions.width,
259
+ occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
260
+ })(_this.props.view.state, _this.props.view.dispatch);
261
+ _context7.next = 21;
262
+ break;
263
+ case 18:
264
+ _context7.prev = 18;
265
+ _context7.t0 = _context7["catch"](10);
266
+ //keep it as external media
267
+ if (_this.props.dispatchAnalyticsEvent) {
268
+ _this.props.dispatchAnalyticsEvent({
269
+ action: _analytics.ACTION.UPLOAD_EXTERNAL_FAIL,
270
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
271
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
272
+ });
273
+ }
274
+ case 21:
275
+ case "end":
276
+ return _context7.stop();
290
277
  }
291
278
  }, _callee7, null, [[10, 18]]);
292
279
  }));
@@ -307,156 +294,150 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
307
294
  width: dimensions.width
308
295
  })(_this.props.view.state, _this.props.view.dispatch);
309
296
  });
310
- (0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
297
+ (0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
311
298
  var nodeContextId, currentContextId;
312
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
313
- while (1) {
314
- switch (_context8.prev = _context8.next) {
315
- case 0:
316
- nodeContextId = _this.getNodeContextId();
317
- _context8.next = 3;
318
- return _this.getObjectId();
319
- case 3:
320
- currentContextId = _context8.sent;
321
- if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
322
- _context8.next = 6;
323
- break;
324
- }
325
- return _context8.abrupt("return", true);
326
- case 6:
327
- return _context8.abrupt("return", false);
328
- case 7:
329
- case "end":
330
- return _context8.stop();
331
- }
299
+ return _regenerator.default.wrap(function _callee8$(_context8) {
300
+ while (1) switch (_context8.prev = _context8.next) {
301
+ case 0:
302
+ nodeContextId = _this.getNodeContextId();
303
+ _context8.next = 3;
304
+ return _this.getObjectId();
305
+ case 3:
306
+ currentContextId = _context8.sent;
307
+ if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
308
+ _context8.next = 6;
309
+ break;
310
+ }
311
+ return _context8.abrupt("return", true);
312
+ case 6:
313
+ return _context8.abrupt("return", false);
314
+ case 7:
315
+ case "end":
316
+ return _context8.stop();
332
317
  }
333
318
  }, _callee8);
334
319
  })));
335
- (0, _defineProperty2.default)(this, "isNodeFromDifferentCollection", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
320
+ (0, _defineProperty2.default)(this, "isNodeFromDifferentCollection", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
336
321
  var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
337
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
338
- while (1) {
339
- switch (_context9.prev = _context9.next) {
322
+ return _regenerator.default.wrap(function _callee9$(_context9) {
323
+ while (1) switch (_context9.prev = _context9.next) {
324
+ case 0:
325
+ _context9.next = 2;
326
+ return _this.props.mediaProvider;
327
+ case 2:
328
+ mediaProvider = _context9.sent;
329
+ if (!(!mediaProvider || !mediaProvider.uploadParams)) {
330
+ _context9.next = 5;
331
+ break;
332
+ }
333
+ return _context9.abrupt("return", false);
334
+ case 5:
335
+ currentCollectionName = mediaProvider.uploadParams.collection;
336
+ attrs = _this.getAttrs();
337
+ if (!(!attrs || attrs.type !== 'file')) {
338
+ _context9.next = 9;
339
+ break;
340
+ }
341
+ return _context9.abrupt("return", false);
342
+ case 9:
343
+ nodeCollection = attrs.collection, __contextId = attrs.__contextId;
344
+ _context9.t0 = __contextId;
345
+ if (_context9.t0) {
346
+ _context9.next = 15;
347
+ break;
348
+ }
349
+ _context9.next = 14;
350
+ return _this.getObjectId();
351
+ case 14:
352
+ _context9.t0 = _context9.sent;
353
+ case 15:
354
+ contextId = _context9.t0;
355
+ if (!(contextId && currentCollectionName !== nodeCollection)) {
356
+ _context9.next = 18;
357
+ break;
358
+ }
359
+ return _context9.abrupt("return", true);
360
+ case 18:
361
+ return _context9.abrupt("return", false);
362
+ case 19:
363
+ case "end":
364
+ return _context9.stop();
365
+ }
366
+ }, _callee9);
367
+ })));
368
+ (0, _defineProperty2.default)(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
369
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(getPos) {
370
+ var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, auth, source, destination, mediaFile;
371
+ return _regenerator.default.wrap(function _callee10$(_context10) {
372
+ while (1) switch (_context10.prev = _context10.next) {
340
373
  case 0:
341
- _context9.next = 2;
342
- return _this.props.mediaProvider;
343
- case 2:
344
- mediaProvider = _context9.sent;
345
- if (!(!mediaProvider || !mediaProvider.uploadParams)) {
346
- _context9.next = 5;
374
+ attrs = _this.getAttrs();
375
+ if (!(!attrs || attrs.type !== 'external')) {
376
+ _context10.next = 3;
347
377
  break;
348
378
  }
349
- return _context9.abrupt("return", false);
350
- case 5:
351
- currentCollectionName = mediaProvider.uploadParams.collection;
352
- attrs = _this.getAttrs();
353
- if (!(!attrs || attrs.type !== 'file')) {
354
- _context9.next = 9;
379
+ return _context10.abrupt("return");
380
+ case 3:
381
+ url = attrs.url;
382
+ mediaAttrs = (0, _mediaClient.getAttrsFromUrl)(url);
383
+ if (mediaAttrs) {
384
+ _context10.next = 7;
355
385
  break;
356
386
  }
357
- return _context9.abrupt("return", false);
387
+ return _context10.abrupt("return");
388
+ case 7:
389
+ _context10.next = 9;
390
+ return _this.props.mediaProvider;
358
391
  case 9:
359
- nodeCollection = attrs.collection, __contextId = attrs.__contextId;
360
- _context9.t0 = __contextId;
361
- if (_context9.t0) {
362
- _context9.next = 15;
392
+ mediaProvider = _context10.sent;
393
+ if (!(!mediaProvider || !mediaProvider.uploadParams)) {
394
+ _context10.next = 12;
363
395
  break;
364
396
  }
365
- _context9.next = 14;
366
- return _this.getObjectId();
367
- case 14:
368
- _context9.t0 = _context9.sent;
369
- case 15:
370
- contextId = _context9.t0;
371
- if (!(contextId && currentCollectionName !== nodeCollection)) {
372
- _context9.next = 18;
397
+ return _context10.abrupt("return");
398
+ case 12:
399
+ currentCollectionName = mediaProvider.uploadParams.collection;
400
+ contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
401
+ uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
402
+ if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
403
+ _context10.next = 17;
373
404
  break;
374
405
  }
375
- return _context9.abrupt("return", true);
376
- case 18:
377
- return _context9.abrupt("return", false);
378
- case 19:
379
- case "end":
380
- return _context9.stop();
381
- }
382
- }
383
- }, _callee9);
384
- })));
385
- (0, _defineProperty2.default)(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
386
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(getPos) {
387
- var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, auth, source, destination, mediaFile;
388
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
389
- while (1) {
390
- switch (_context10.prev = _context10.next) {
391
- case 0:
392
- attrs = _this.getAttrs();
393
- if (!(!attrs || attrs.type !== 'external')) {
394
- _context10.next = 3;
395
- break;
396
- }
397
- return _context10.abrupt("return");
398
- case 3:
399
- url = attrs.url;
400
- mediaAttrs = (0, _mediaClient.getAttrsFromUrl)(url);
401
- if (mediaAttrs) {
402
- _context10.next = 7;
403
- break;
404
- }
405
- return _context10.abrupt("return");
406
- case 7:
407
- _context10.next = 9;
408
- return _this.props.mediaProvider;
409
- case 9:
410
- mediaProvider = _context10.sent;
411
- if (!(!mediaProvider || !mediaProvider.uploadParams)) {
412
- _context10.next = 12;
413
- break;
414
- }
415
- return _context10.abrupt("return");
416
- case 12:
417
- currentCollectionName = mediaProvider.uploadParams.collection;
418
- contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
419
- uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
420
- if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
421
- _context10.next = 17;
422
- break;
406
+ return _context10.abrupt("return");
407
+ case 17:
408
+ mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
409
+ _context10.next = 20;
410
+ return uploadMediaClientConfig.getAuthFromContext(contextId);
411
+ case 20:
412
+ auth = _context10.sent;
413
+ source = {
414
+ id: id,
415
+ collection: collection,
416
+ authProvider: function authProvider() {
417
+ return Promise.resolve(auth);
423
418
  }
424
- return _context10.abrupt("return");
425
- case 17:
426
- mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
427
- _context10.next = 20;
428
- return uploadMediaClientConfig.getAuthFromContext(contextId);
429
- case 20:
430
- auth = _context10.sent;
431
- source = {
432
- id: id,
433
- collection: collection,
434
- authProvider: function authProvider() {
435
- return Promise.resolve(auth);
436
- }
437
- };
438
- destination = {
439
- collection: currentCollectionName,
440
- authProvider: uploadMediaClientConfig.authProvider,
441
- occurrenceKey: (0, _v.default)()
442
- };
443
- _context10.next = 25;
444
- return mediaClient.file.copyFile(source, destination);
445
- case 25:
446
- mediaFile = _context10.sent;
447
- (0, _helpers.replaceExternalMedia)(getPos() + 1, {
448
- id: mediaFile.id,
449
- collection: currentCollectionName,
450
- height: height,
451
- width: width,
452
- __fileName: name,
453
- __fileMimeType: mimeType,
454
- __fileSize: size
455
- })(_this.props.view.state, _this.props.view.dispatch);
456
- case 27:
457
- case "end":
458
- return _context10.stop();
459
- }
419
+ };
420
+ destination = {
421
+ collection: currentCollectionName,
422
+ authProvider: uploadMediaClientConfig.authProvider,
423
+ occurrenceKey: (0, _v.default)()
424
+ };
425
+ _context10.next = 25;
426
+ return mediaClient.file.copyFile(source, destination);
427
+ case 25:
428
+ mediaFile = _context10.sent;
429
+ (0, _helpers.replaceExternalMedia)(getPos() + 1, {
430
+ id: mediaFile.id,
431
+ collection: currentCollectionName,
432
+ height: height,
433
+ width: width,
434
+ __fileName: name,
435
+ __fileMimeType: mimeType,
436
+ __fileSize: size
437
+ })(_this.props.view.state, _this.props.view.dispatch);
438
+ case 27:
439
+ case "end":
440
+ return _context10.stop();
460
441
  }
461
442
  }, _callee10);
462
443
  }));
@@ -464,38 +445,37 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
464
445
  return _ref11.apply(this, arguments);
465
446
  };
466
447
  }());
448
+ // Copies the pasted node into the current collection using a getPos handler
467
449
  (0, _defineProperty2.default)(this, "copyNodeFromPos", /*#__PURE__*/function () {
468
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(getPos, traceContext) {
450
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(getPos, traceContext) {
469
451
  var attrs, copiedAttrs;
470
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
471
- while (1) {
472
- switch (_context11.prev = _context11.next) {
473
- case 0:
474
- attrs = _this.getAttrs();
475
- if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
476
- _context11.next = 3;
477
- break;
478
- }
479
- return _context11.abrupt("return");
480
- case 3:
481
- _context11.next = 5;
482
- return _this.copyFile(attrs.id, attrs.collection, traceContext);
483
- case 5:
484
- copiedAttrs = _context11.sent;
485
- if (copiedAttrs) {
486
- _context11.next = 8;
487
- break;
488
- }
489
- return _context11.abrupt("return");
490
- case 8:
491
- (0, _helpers.updateCurrentMediaNodeAttrs)(copiedAttrs, {
492
- node: _this.props.node,
493
- getPos: getPos
494
- })(_this.props.view.state, _this.props.view.dispatch);
495
- case 9:
496
- case "end":
497
- return _context11.stop();
498
- }
452
+ return _regenerator.default.wrap(function _callee11$(_context11) {
453
+ while (1) switch (_context11.prev = _context11.next) {
454
+ case 0:
455
+ attrs = _this.getAttrs();
456
+ if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
457
+ _context11.next = 3;
458
+ break;
459
+ }
460
+ return _context11.abrupt("return");
461
+ case 3:
462
+ _context11.next = 5;
463
+ return _this.copyFile(attrs.id, attrs.collection, traceContext);
464
+ case 5:
465
+ copiedAttrs = _context11.sent;
466
+ if (copiedAttrs) {
467
+ _context11.next = 8;
468
+ break;
469
+ }
470
+ return _context11.abrupt("return");
471
+ case 8:
472
+ (0, _helpers.updateCurrentMediaNodeAttrs)(copiedAttrs, {
473
+ node: _this.props.node,
474
+ getPos: getPos
475
+ })(_this.props.view.state, _this.props.view.dispatch);
476
+ case 9:
477
+ case "end":
478
+ return _context11.stop();
499
479
  }
500
480
  }, _callee11);
501
481
  }));
@@ -503,36 +483,35 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
503
483
  return _ref12.apply(this, arguments);
504
484
  };
505
485
  }());
486
+ // Copies the pasted node into the current collection
506
487
  (0, _defineProperty2.default)(this, "copyNode", /*#__PURE__*/function () {
507
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(traceContext) {
488
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(traceContext) {
508
489
  var attrs, view, copiedAttrs;
509
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
510
- while (1) {
511
- switch (_context12.prev = _context12.next) {
512
- case 0:
513
- attrs = _this.getAttrs();
514
- view = _this.props.view;
515
- if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
516
- _context12.next = 4;
517
- break;
518
- }
519
- return _context12.abrupt("return");
520
- case 4:
521
- _context12.next = 6;
522
- return _this.copyFile(attrs.id, attrs.collection, traceContext);
523
- case 6:
524
- copiedAttrs = _context12.sent;
525
- if (copiedAttrs) {
526
- _context12.next = 9;
527
- break;
528
- }
529
- return _context12.abrupt("return");
530
- case 9:
531
- (0, _helpers.updateMediaSingleNodeAttrs)(attrs.id, copiedAttrs)(view.state, view.dispatch);
532
- case 10:
533
- case "end":
534
- return _context12.stop();
535
- }
490
+ return _regenerator.default.wrap(function _callee12$(_context12) {
491
+ while (1) switch (_context12.prev = _context12.next) {
492
+ case 0:
493
+ attrs = _this.getAttrs();
494
+ view = _this.props.view;
495
+ if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
496
+ _context12.next = 4;
497
+ break;
498
+ }
499
+ return _context12.abrupt("return");
500
+ case 4:
501
+ _context12.next = 6;
502
+ return _this.copyFile(attrs.id, attrs.collection, traceContext);
503
+ case 6:
504
+ copiedAttrs = _context12.sent;
505
+ if (copiedAttrs) {
506
+ _context12.next = 9;
507
+ break;
508
+ }
509
+ return _context12.abrupt("return");
510
+ case 9:
511
+ (0, _helpers.updateMediaSingleNodeAttrs)(attrs.id, copiedAttrs)(view.state, view.dispatch);
512
+ case 10:
513
+ case "end":
514
+ return _context12.stop();
536
515
  }
537
516
  }, _callee12);
538
517
  }));
@@ -541,65 +520,63 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
541
520
  };
542
521
  }());
543
522
  (0, _defineProperty2.default)(this, "copyFile", /*#__PURE__*/function () {
544
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(id, collection, traceContext) {
523
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, collection, traceContext) {
545
524
  var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, auth, objectId, source, currentCollectionName, destination, mediaFile;
546
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
547
- while (1) {
548
- switch (_context13.prev = _context13.next) {
549
- case 0:
550
- _context13.next = 2;
551
- return _this.props.mediaProvider;
552
- case 2:
553
- mediaProvider = _context13.sent;
554
- if (!(!id || !collection || !(mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams))) {
555
- _context13.next = 5;
556
- break;
557
- }
558
- return _context13.abrupt("return");
559
- case 5:
560
- nodeContextId = _this.getNodeContextId();
561
- uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
562
- if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
563
- _context13.next = 9;
564
- break;
525
+ return _regenerator.default.wrap(function _callee13$(_context13) {
526
+ while (1) switch (_context13.prev = _context13.next) {
527
+ case 0:
528
+ _context13.next = 2;
529
+ return _this.props.mediaProvider;
530
+ case 2:
531
+ mediaProvider = _context13.sent;
532
+ if (!(!id || !collection || !(mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams))) {
533
+ _context13.next = 5;
534
+ break;
535
+ }
536
+ return _context13.abrupt("return");
537
+ case 5:
538
+ nodeContextId = _this.getNodeContextId();
539
+ uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
540
+ if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
541
+ _context13.next = 9;
542
+ break;
543
+ }
544
+ return _context13.abrupt("return");
545
+ case 9:
546
+ mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
547
+ _context13.next = 12;
548
+ return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
549
+ case 12:
550
+ auth = _context13.sent;
551
+ _context13.next = 15;
552
+ return _this.getObjectId();
553
+ case 15:
554
+ objectId = _context13.sent;
555
+ source = {
556
+ id: id,
557
+ collection: collection,
558
+ authProvider: function authProvider() {
559
+ return Promise.resolve(auth);
565
560
  }
566
- return _context13.abrupt("return");
567
- case 9:
568
- mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
569
- _context13.next = 12;
570
- return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
571
- case 12:
572
- auth = _context13.sent;
573
- _context13.next = 15;
574
- return _this.getObjectId();
575
- case 15:
576
- objectId = _context13.sent;
577
- source = {
578
- id: id,
579
- collection: collection,
580
- authProvider: function authProvider() {
581
- return Promise.resolve(auth);
582
- }
583
- };
584
- currentCollectionName = mediaProvider.uploadParams.collection;
585
- destination = {
586
- collection: currentCollectionName,
587
- authProvider: uploadMediaClientConfig.authProvider,
588
- occurrenceKey: (0, _v.default)()
589
- };
590
- _context13.next = 21;
591
- return mediaClient.file.copyFile(source, destination, undefined, traceContext);
592
- case 21:
593
- mediaFile = _context13.sent;
594
- return _context13.abrupt("return", {
595
- id: mediaFile.id,
596
- collection: currentCollectionName,
597
- __contextId: objectId
598
- });
599
- case 23:
600
- case "end":
601
- return _context13.stop();
602
- }
561
+ };
562
+ currentCollectionName = mediaProvider.uploadParams.collection;
563
+ destination = {
564
+ collection: currentCollectionName,
565
+ authProvider: uploadMediaClientConfig.authProvider,
566
+ occurrenceKey: (0, _v.default)()
567
+ };
568
+ _context13.next = 21;
569
+ return mediaClient.file.copyFile(source, destination, undefined, traceContext);
570
+ case 21:
571
+ mediaFile = _context13.sent;
572
+ return _context13.abrupt("return", {
573
+ id: mediaFile.id,
574
+ collection: currentCollectionName,
575
+ __contextId: objectId
576
+ });
577
+ case 23:
578
+ case "end":
579
+ return _context13.stop();
603
580
  }
604
581
  }, _callee13);
605
582
  }));
@@ -615,89 +592,84 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
615
592
  var attrs = this.getAttrs();
616
593
  return !!(attrs && attrs.type === 'external' && (0, _mediaClient.isMediaBlobUrl)(attrs.url));
617
594
  }
618
-
619
- // Updates the node with contextId if it doesn't have one already
620
- // TODO [MS-2258]: remove updateContextId in order to only use updateMediaSingleFileAttrs
621
595
  }, {
622
596
  key: "getRemoteDimensions",
623
597
  value: function () {
624
- var _getRemoteDimensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
598
+ var _getRemoteDimensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
625
599
  var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
626
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
627
- while (1) {
628
- switch (_context14.prev = _context14.next) {
629
- case 0:
630
- _context14.next = 2;
631
- return this.props.mediaProvider;
632
- case 2:
633
- mediaProvider = _context14.sent;
634
- mediaOptions = this.props.mediaOptions;
635
- attrs = this.getAttrs();
636
- if (!(!mediaProvider || !attrs)) {
637
- _context14.next = 7;
638
- break;
639
- }
640
- return _context14.abrupt("return", false);
641
- case 7:
642
- height = attrs.height, width = attrs.width;
643
- if (!(attrs.type === 'external' || !attrs.id)) {
644
- _context14.next = 10;
645
- break;
646
- }
647
- return _context14.abrupt("return", false);
648
- case 10:
649
- id = attrs.id, collection = attrs.collection;
650
- if (!(height && width)) {
651
- _context14.next = 13;
652
- break;
653
- }
654
- return _context14.abrupt("return", false);
655
- case 13:
656
- if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
657
- _context14.next = 15;
658
- break;
659
- }
660
- return _context14.abrupt("return", {
661
- id: id,
662
- height: _ui.DEFAULT_IMAGE_HEIGHT,
663
- width: _ui.DEFAULT_IMAGE_WIDTH
664
- });
665
- case 15:
666
- viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
667
- mediaClient = (0, _mediaClient.getMediaClient)(viewMediaClientConfig);
668
- _context14.next = 19;
669
- return mediaClient.file.getCurrentState(id, {
670
- collectionName: collection
671
- });
672
- case 19:
673
- currentState = _context14.sent;
674
- if ((0, _mediaClient.isImageRepresentationReady)(currentState)) {
675
- _context14.next = 22;
676
- break;
677
- }
678
- return _context14.abrupt("return", false);
679
- case 22:
680
- _context14.next = 24;
681
- return mediaClient.getImageMetadata(id, {
682
- collection: collection
683
- });
684
- case 24:
685
- imageMetadata = _context14.sent;
686
- if (!(!imageMetadata || !imageMetadata.original)) {
687
- _context14.next = 27;
688
- break;
689
- }
690
- return _context14.abrupt("return", false);
691
- case 27:
692
- return _context14.abrupt("return", {
693
- id: id,
694
- height: imageMetadata.original.height || _ui.DEFAULT_IMAGE_HEIGHT,
695
- width: imageMetadata.original.width || _ui.DEFAULT_IMAGE_WIDTH
696
- });
697
- case 28:
698
- case "end":
699
- return _context14.stop();
700
- }
600
+ return _regenerator.default.wrap(function _callee14$(_context14) {
601
+ while (1) switch (_context14.prev = _context14.next) {
602
+ case 0:
603
+ _context14.next = 2;
604
+ return this.props.mediaProvider;
605
+ case 2:
606
+ mediaProvider = _context14.sent;
607
+ mediaOptions = this.props.mediaOptions;
608
+ attrs = this.getAttrs();
609
+ if (!(!mediaProvider || !attrs)) {
610
+ _context14.next = 7;
611
+ break;
612
+ }
613
+ return _context14.abrupt("return", false);
614
+ case 7:
615
+ height = attrs.height, width = attrs.width;
616
+ if (!(attrs.type === 'external' || !attrs.id)) {
617
+ _context14.next = 10;
618
+ break;
619
+ }
620
+ return _context14.abrupt("return", false);
621
+ case 10:
622
+ id = attrs.id, collection = attrs.collection;
623
+ if (!(height && width)) {
624
+ _context14.next = 13;
625
+ break;
626
+ }
627
+ return _context14.abrupt("return", false);
628
+ case 13:
629
+ if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
630
+ _context14.next = 15;
631
+ break;
632
+ }
633
+ return _context14.abrupt("return", {
634
+ id: id,
635
+ height: _ui.DEFAULT_IMAGE_HEIGHT,
636
+ width: _ui.DEFAULT_IMAGE_WIDTH
637
+ });
638
+ case 15:
639
+ viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
640
+ mediaClient = (0, _mediaClient.getMediaClient)(viewMediaClientConfig);
641
+ _context14.next = 19;
642
+ return mediaClient.file.getCurrentState(id, {
643
+ collectionName: collection
644
+ });
645
+ case 19:
646
+ currentState = _context14.sent;
647
+ if ((0, _mediaClient.isImageRepresentationReady)(currentState)) {
648
+ _context14.next = 22;
649
+ break;
650
+ }
651
+ return _context14.abrupt("return", false);
652
+ case 22:
653
+ _context14.next = 24;
654
+ return mediaClient.getImageMetadata(id, {
655
+ collection: collection
656
+ });
657
+ case 24:
658
+ imageMetadata = _context14.sent;
659
+ if (!(!imageMetadata || !imageMetadata.original)) {
660
+ _context14.next = 27;
661
+ break;
662
+ }
663
+ return _context14.abrupt("return", false);
664
+ case 27:
665
+ return _context14.abrupt("return", {
666
+ id: id,
667
+ height: imageMetadata.original.height || _ui.DEFAULT_IMAGE_HEIGHT,
668
+ width: imageMetadata.original.width || _ui.DEFAULT_IMAGE_WIDTH
669
+ });
670
+ case 28:
671
+ case "end":
672
+ return _context14.stop();
701
673
  }
702
674
  }, _callee14, this);
703
675
  }));
@@ -709,36 +681,34 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
709
681
  }, {
710
682
  key: "handleExternalMedia",
711
683
  value: function () {
712
- var _handleExternalMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(getPos) {
713
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
714
- while (1) {
715
- switch (_context15.prev = _context15.next) {
716
- case 0:
717
- if (!this.isMediaBlobUrl()) {
718
- _context15.next = 12;
719
- break;
720
- }
721
- _context15.prev = 1;
722
- _context15.next = 4;
723
- return this.copyNodeFromBlobUrl(getPos);
724
- case 4:
725
- _context15.next = 10;
726
- break;
727
- case 6:
728
- _context15.prev = 6;
729
- _context15.t0 = _context15["catch"](1);
730
- _context15.next = 10;
731
- return this.uploadExternalMedia(getPos);
732
- case 10:
733
- _context15.next = 14;
684
+ var _handleExternalMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(getPos) {
685
+ return _regenerator.default.wrap(function _callee15$(_context15) {
686
+ while (1) switch (_context15.prev = _context15.next) {
687
+ case 0:
688
+ if (!this.isMediaBlobUrl()) {
689
+ _context15.next = 12;
734
690
  break;
735
- case 12:
736
- _context15.next = 14;
737
- return this.uploadExternalMedia(getPos);
738
- case 14:
739
- case "end":
740
- return _context15.stop();
741
- }
691
+ }
692
+ _context15.prev = 1;
693
+ _context15.next = 4;
694
+ return this.copyNodeFromBlobUrl(getPos);
695
+ case 4:
696
+ _context15.next = 10;
697
+ break;
698
+ case 6:
699
+ _context15.prev = 6;
700
+ _context15.t0 = _context15["catch"](1);
701
+ _context15.next = 10;
702
+ return this.uploadExternalMedia(getPos);
703
+ case 10:
704
+ _context15.next = 14;
705
+ break;
706
+ case 12:
707
+ _context15.next = 14;
708
+ return this.uploadExternalMedia(getPos);
709
+ case 14:
710
+ case "end":
711
+ return _context15.stop();
742
712
  }
743
713
  }, _callee15, this, [[1, 6]]);
744
714
  }));
@@ -746,8 +716,7 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
746
716
  return _handleExternalMedia.apply(this, arguments);
747
717
  }
748
718
  return handleExternalMedia;
749
- }() // Copies the pasted node into the current collection using a getPos handler
750
- // Copies the pasted node into the current collection
719
+ }()
751
720
  }]);
752
721
  return MediaNodeUpdater;
753
722
  }();