@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.
- package/CHANGELOG.md +23 -0
- package/dist/cjs/actions/index.js +90 -98
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +4 -0
- package/dist/cjs/create-editor/ErrorBoundary.js +86 -93
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +8 -6
- package/dist/cjs/editor-next/index.js +5 -6
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +34 -37
- package/dist/cjs/editor-next/utils/trackEditorActions.js +48 -51
- package/dist/cjs/editor.js +29 -34
- package/dist/cjs/i18n/cs.js +34 -6
- package/dist/cjs/i18n/da.js +34 -6
- package/dist/cjs/i18n/de.js +34 -7
- package/dist/cjs/i18n/en.js +31 -4
- package/dist/cjs/i18n/en_GB.js +34 -7
- package/dist/cjs/i18n/en_ZZ.js +35 -8
- package/dist/cjs/i18n/es.js +33 -6
- package/dist/cjs/i18n/fi.js +33 -6
- package/dist/cjs/i18n/fr.js +34 -7
- package/dist/cjs/i18n/hu.js +33 -6
- package/dist/cjs/i18n/it.js +34 -7
- package/dist/cjs/i18n/ja.js +33 -6
- package/dist/cjs/i18n/ko.js +33 -6
- package/dist/cjs/i18n/nb.js +35 -8
- package/dist/cjs/i18n/nl.js +34 -7
- package/dist/cjs/i18n/pl.js +34 -7
- package/dist/cjs/i18n/pt_BR.js +34 -7
- package/dist/cjs/i18n/ru.js +34 -7
- package/dist/cjs/i18n/sv.js +33 -6
- package/dist/cjs/i18n/th.js +34 -7
- package/dist/cjs/i18n/tr.js +33 -6
- package/dist/cjs/i18n/uk.js +34 -7
- package/dist/cjs/i18n/vi.js +35 -8
- package/dist/cjs/i18n/zh.js +33 -4
- package/dist/cjs/i18n/zh_TW.js +33 -6
- package/dist/cjs/labs/CollapsedEditor/index.js +1 -1
- package/dist/cjs/plugins/analytics/plugin.js +1 -1
- package/dist/cjs/plugins/analytics/utils.js +2 -0
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +39 -44
- package/dist/cjs/plugins/annotation/pm-plugins/types.js +4 -4
- package/dist/cjs/plugins/annotation/types.js +4 -4
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +4 -4
- package/dist/cjs/plugins/block-type/commands/block-type.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +5 -6
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +16 -1
- package/dist/cjs/plugins/collab-edit/index.js +29 -32
- package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -4
- package/dist/cjs/plugins/custom-autoformat/doc.js +28 -31
- package/dist/cjs/plugins/custom-autoformat/index.js +20 -23
- package/dist/cjs/plugins/date/index.js +1 -1
- package/dist/cjs/plugins/date/ui/DatePicker/date-picker-input.js +7 -10
- package/dist/cjs/plugins/date/utils/internal.js +1 -1
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
- package/dist/cjs/plugins/extension/actions.js +36 -39
- package/dist/cjs/plugins/extension/context-panel.js +123 -130
- package/dist/cjs/plugins/extension/pm-plugins/main.js +82 -89
- package/dist/cjs/plugins/extension/pm-plugins/utils.js +46 -51
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +44 -48
- package/dist/cjs/plugins/feedback-dialog/index.js +52 -57
- package/dist/cjs/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +44 -47
- package/dist/cjs/plugins/find-replace/actions.js +4 -4
- package/dist/cjs/plugins/find-replace/utils/batch-decorations.js +144 -153
- package/dist/cjs/plugins/find-replace/utils/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +40 -46
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/ToolbarLoader.js +2 -1
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +86 -86
- package/dist/cjs/plugins/help-dialog/ui/HelpDialogLoader.js +2 -1
- package/dist/cjs/plugins/history/actions.js +4 -4
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +76 -82
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +16 -16
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +339 -352
- package/dist/cjs/plugins/hyperlink/utils.js +3 -0
- package/dist/cjs/plugins/image-upload/pm-plugins/main.js +24 -27
- package/dist/cjs/plugins/list/utils/node.js +4 -4
- package/dist/cjs/plugins/macro/actions.js +107 -112
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +43 -46
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +62 -66
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +544 -575
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +38 -42
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +108 -113
- package/dist/cjs/plugins/media/picker-facade.js +22 -25
- package/dist/cjs/plugins/media/pm-plugins/linking/actions.js +4 -4
- package/dist/cjs/plugins/media/pm-plugins/main.js +159 -172
- package/dist/cjs/plugins/media/pm-plugins/mediaTaskManager.js +36 -39
- package/dist/cjs/plugins/media/toolbar/index.js +3 -0
- package/dist/cjs/plugins/media/toolbar/utils.js +30 -33
- package/dist/cjs/plugins/media/ui/ImageBorder/index.js +1 -1
- package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +1 -1
- package/dist/cjs/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +71 -74
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +52 -57
- package/dist/cjs/plugins/media/utils/check-media-type.js +37 -40
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +29 -31
- package/dist/cjs/plugins/mentions/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/mobile-dimensions/actions.js +4 -4
- package/dist/cjs/plugins/paste/actions.js +4 -4
- package/dist/cjs/plugins/paste/handlers.js +23 -26
- package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -0
- package/dist/cjs/plugins/paste/md.js +3 -0
- package/dist/cjs/plugins/paste/newline-md-plugin.js +3 -0
- package/dist/cjs/plugins/paste/paragraph-md-plugin.js +3 -0
- package/dist/cjs/plugins/paste/pm-plugins/main.js +25 -27
- package/dist/cjs/plugins/quick-insert/assets/index.js +63 -39
- package/dist/cjs/plugins/quick-insert/index.js +30 -33
- package/dist/cjs/plugins/selection/actions.js +4 -4
- package/dist/cjs/plugins/selection/gap-cursor/direction.js +4 -4
- package/dist/cjs/plugins/selection/types.js +4 -4
- package/dist/cjs/plugins/status/ui/statusPicker.js +7 -8
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -10
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/commands.js +16 -6
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +12 -20
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +41 -42
- package/dist/cjs/plugins/tasks-and-decisions/utils.js +31 -2
- package/dist/cjs/plugins/text-color/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/types.js +4 -4
- package/dist/cjs/plugins/type-ahead/constants.js +4 -4
- package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +4 -4
- package/dist/cjs/plugins/undo-redo/enums.js +4 -4
- package/dist/cjs/ui/Appearance/Comment/Comment.js +3 -3
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +1 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/cjs/ui/ColorPickerButton/index.js +3 -2
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +68 -73
- package/dist/cjs/ui/ConfigPanel/ConfigPanelLoader.js +2 -1
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +54 -56
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +51 -55
- package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +24 -27
- package/dist/cjs/ui/ConfigPanel/transformers.js +344 -363
- package/dist/cjs/ui/ConfigPanel/types.js +8 -8
- package/dist/cjs/ui/Dropdown/index.js +2 -1
- package/dist/cjs/ui/DropdownMenu/index.js +2 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementBrowserLoader.js +1 -1
- package/dist/cjs/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +4 -4
- package/dist/cjs/ui/ElementBrowser/types.js +4 -4
- package/dist/cjs/ui/LinkSearch/index.js +94 -101
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +19 -2
- package/dist/cjs/ui/ToolbarFeedback/index.js +27 -31
- package/dist/cjs/utils/action.js +31 -36
- package/dist/cjs/utils/clipboard.js +82 -86
- package/dist/cjs/utils/deprecation-warnings.js +1 -1
- package/dist/cjs/utils/extensions.js +62 -67
- package/dist/cjs/utils/insert.js +4 -4
- package/dist/cjs/utils/mark.js +2 -2
- package/dist/cjs/utils/performance/simple-measure-to-entries.js +1 -2
- package/dist/cjs/utils/performance/track-transactions.js +3 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +8 -9
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +4 -0
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +5 -3
- package/dist/es2019/editor-next/index.js +5 -6
- package/dist/es2019/editor.js +29 -36
- package/dist/es2019/i18n/cs.js +34 -6
- package/dist/es2019/i18n/da.js +34 -6
- package/dist/es2019/i18n/de.js +34 -7
- package/dist/es2019/i18n/en.js +31 -4
- package/dist/es2019/i18n/en_GB.js +34 -7
- package/dist/es2019/i18n/en_ZZ.js +35 -8
- package/dist/es2019/i18n/es.js +33 -6
- package/dist/es2019/i18n/fi.js +33 -6
- package/dist/es2019/i18n/fr.js +34 -7
- package/dist/es2019/i18n/hu.js +33 -6
- package/dist/es2019/i18n/it.js +34 -7
- package/dist/es2019/i18n/ja.js +33 -6
- package/dist/es2019/i18n/ko.js +33 -6
- package/dist/es2019/i18n/nb.js +35 -8
- package/dist/es2019/i18n/nl.js +34 -7
- package/dist/es2019/i18n/pl.js +34 -7
- package/dist/es2019/i18n/pt_BR.js +34 -7
- package/dist/es2019/i18n/ru.js +34 -7
- package/dist/es2019/i18n/sv.js +33 -6
- package/dist/es2019/i18n/th.js +34 -7
- package/dist/es2019/i18n/tr.js +33 -6
- package/dist/es2019/i18n/uk.js +34 -7
- package/dist/es2019/i18n/vi.js +35 -8
- package/dist/es2019/i18n/zh.js +33 -4
- package/dist/es2019/i18n/zh_TW.js +33 -6
- package/dist/es2019/plugins/analytics/utils.js +2 -0
- package/dist/es2019/plugins/annotation/pm-plugins/types.js +3 -3
- package/dist/es2019/plugins/annotation/types.js +3 -3
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +3 -3
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +5 -7
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +3 -5
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +17 -2
- package/dist/es2019/plugins/collab-edit/plugin-state.js +1 -2
- package/dist/es2019/plugins/date/ui/DatePicker/date-picker-input.js +7 -11
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +8 -12
- package/dist/es2019/plugins/find-replace/actions.js +3 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +56 -71
- package/dist/es2019/plugins/history/actions.js +3 -3
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +6 -6
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -2
- package/dist/es2019/plugins/hyperlink/utils.js +3 -0
- package/dist/es2019/plugins/list/utils/node.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +4 -8
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/es2019/plugins/media/pm-plugins/linking/actions.js +3 -3
- package/dist/es2019/plugins/media/pm-plugins/main.js +22 -31
- package/dist/es2019/plugins/media/toolbar/index.js +3 -0
- package/dist/es2019/plugins/media/ui/ImageBorder/index.js +1 -1
- package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +1 -1
- package/dist/es2019/plugins/mobile-dimensions/actions.js +3 -3
- package/dist/es2019/plugins/paste/actions.js +3 -3
- package/dist/es2019/plugins/paste/linkify-md-plugin.js +3 -0
- package/dist/es2019/plugins/paste/md.js +3 -0
- package/dist/es2019/plugins/paste/newline-md-plugin.js +3 -0
- package/dist/es2019/plugins/paste/paragraph-md-plugin.js +3 -0
- package/dist/es2019/plugins/selection/actions.js +3 -3
- package/dist/es2019/plugins/selection/gap-cursor/direction.js +3 -3
- package/dist/es2019/plugins/selection/types.js +3 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +6 -7
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -11
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/commands.js +15 -3
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +6 -16
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
- package/dist/es2019/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +6 -5
- package/dist/es2019/plugins/tasks-and-decisions/utils.js +30 -0
- package/dist/es2019/plugins/text-color/pm-plugins/main.js +3 -3
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/types.js +3 -3
- package/dist/es2019/plugins/type-ahead/constants.js +3 -3
- package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +3 -3
- package/dist/es2019/plugins/undo-redo/enums.js +3 -3
- package/dist/es2019/ui/Appearance/Comment/Comment.js +3 -3
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +5 -3
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +3 -4
- package/dist/es2019/ui/ConfigPanel/types.js +6 -6
- package/dist/es2019/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +3 -3
- package/dist/es2019/ui/ElementBrowser/types.js +3 -3
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +18 -2
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -3
- package/dist/es2019/utils/insert.js +3 -3
- package/dist/es2019/utils/performance/simple-measure-to-entries.js +1 -1
- package/dist/es2019/utils/performance/track-transactions.js +3 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +90 -98
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +4 -0
- package/dist/esm/create-editor/ErrorBoundary.js +86 -93
- package/dist/esm/create-editor/ReactEditorViewInternal.js +6 -5
- package/dist/esm/editor-next/index.js +5 -6
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +34 -37
- package/dist/esm/editor-next/utils/trackEditorActions.js +48 -51
- package/dist/esm/editor.js +29 -34
- package/dist/esm/i18n/cs.js +34 -6
- package/dist/esm/i18n/da.js +34 -6
- package/dist/esm/i18n/de.js +34 -7
- package/dist/esm/i18n/en.js +31 -4
- package/dist/esm/i18n/en_GB.js +34 -7
- package/dist/esm/i18n/en_ZZ.js +35 -8
- package/dist/esm/i18n/es.js +33 -6
- package/dist/esm/i18n/fi.js +33 -6
- package/dist/esm/i18n/fr.js +34 -7
- package/dist/esm/i18n/hu.js +33 -6
- package/dist/esm/i18n/it.js +34 -7
- package/dist/esm/i18n/ja.js +33 -6
- package/dist/esm/i18n/ko.js +33 -6
- package/dist/esm/i18n/nb.js +35 -8
- package/dist/esm/i18n/nl.js +34 -7
- package/dist/esm/i18n/pl.js +34 -7
- package/dist/esm/i18n/pt_BR.js +34 -7
- package/dist/esm/i18n/ru.js +34 -7
- package/dist/esm/i18n/sv.js +33 -6
- package/dist/esm/i18n/th.js +34 -7
- package/dist/esm/i18n/tr.js +33 -6
- package/dist/esm/i18n/uk.js +34 -7
- package/dist/esm/i18n/vi.js +35 -8
- package/dist/esm/i18n/zh.js +33 -4
- package/dist/esm/i18n/zh_TW.js +33 -6
- package/dist/esm/plugins/analytics/plugin.js +1 -1
- package/dist/esm/plugins/analytics/utils.js +2 -0
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +39 -44
- package/dist/esm/plugins/annotation/pm-plugins/types.js +3 -3
- package/dist/esm/plugins/annotation/types.js +3 -3
- package/dist/esm/plugins/base/pm-plugins/decoration.js +3 -3
- package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +5 -6
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +17 -2
- package/dist/esm/plugins/collab-edit/index.js +29 -32
- package/dist/esm/plugins/collab-edit/plugin-state.js +2 -4
- package/dist/esm/plugins/custom-autoformat/doc.js +28 -31
- package/dist/esm/plugins/custom-autoformat/index.js +20 -23
- package/dist/esm/plugins/date/ui/DatePicker/date-picker-input.js +7 -10
- package/dist/esm/plugins/date/utils/internal.js +1 -1
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +27 -28
- package/dist/esm/plugins/extension/actions.js +36 -39
- package/dist/esm/plugins/extension/context-panel.js +123 -129
- package/dist/esm/plugins/extension/pm-plugins/main.js +82 -88
- package/dist/esm/plugins/extension/pm-plugins/utils.js +46 -51
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +44 -49
- package/dist/esm/plugins/feedback-dialog/index.js +52 -57
- package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +44 -47
- package/dist/esm/plugins/find-replace/actions.js +3 -3
- package/dist/esm/plugins/find-replace/utils/batch-decorations.js +144 -153
- package/dist/esm/plugins/find-replace/utils/index.js +2 -2
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +40 -47
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -1
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +78 -76
- package/dist/esm/plugins/history/actions.js +3 -3
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +76 -83
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +3 -0
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +14 -14
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +339 -353
- package/dist/esm/plugins/hyperlink/utils.js +3 -0
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +24 -27
- package/dist/esm/plugins/list/utils/node.js +3 -3
- package/dist/esm/plugins/macro/actions.js +107 -112
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +43 -46
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +62 -67
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +544 -575
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +38 -43
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +108 -114
- package/dist/esm/plugins/media/picker-facade.js +22 -25
- package/dist/esm/plugins/media/pm-plugins/linking/actions.js +3 -3
- package/dist/esm/plugins/media/pm-plugins/main.js +159 -173
- package/dist/esm/plugins/media/pm-plugins/mediaTaskManager.js +36 -39
- package/dist/esm/plugins/media/toolbar/index.js +3 -0
- package/dist/esm/plugins/media/toolbar/utils.js +30 -33
- package/dist/esm/plugins/media/ui/ImageBorder/index.js +1 -1
- package/dist/esm/plugins/media/ui/ImageBorder/styles.js +1 -1
- package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +71 -74
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +52 -57
- package/dist/esm/plugins/media/utils/check-media-type.js +37 -40
- package/dist/esm/plugins/mentions/nodeviews/mention.js +29 -32
- package/dist/esm/plugins/mentions/type-ahead/index.js +1 -1
- package/dist/esm/plugins/mobile-dimensions/actions.js +3 -3
- package/dist/esm/plugins/paste/actions.js +3 -3
- package/dist/esm/plugins/paste/handlers.js +23 -26
- package/dist/esm/plugins/paste/linkify-md-plugin.js +3 -0
- package/dist/esm/plugins/paste/md.js +3 -0
- package/dist/esm/plugins/paste/newline-md-plugin.js +3 -0
- package/dist/esm/plugins/paste/paragraph-md-plugin.js +3 -0
- package/dist/esm/plugins/paste/pm-plugins/main.js +25 -28
- package/dist/esm/plugins/quick-insert/index.js +30 -33
- package/dist/esm/plugins/selection/actions.js +3 -3
- package/dist/esm/plugins/selection/gap-cursor/direction.js +3 -3
- package/dist/esm/plugins/selection/types.js +3 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +6 -7
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +9 -10
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/commands.js +17 -7
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +13 -21
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
- package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +41 -43
- package/dist/esm/plugins/tasks-and-decisions/utils.js +28 -0
- package/dist/esm/plugins/text-color/pm-plugins/main.js +3 -3
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +3 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/types.js +3 -3
- package/dist/esm/plugins/type-ahead/constants.js +3 -3
- package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +3 -3
- package/dist/esm/plugins/undo-redo/enums.js +3 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +3 -3
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/esm/ui/ColorPickerButton/index.js +3 -2
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +68 -74
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +54 -57
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +51 -56
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +24 -27
- package/dist/esm/ui/ConfigPanel/transformers.js +344 -362
- package/dist/esm/ui/ConfigPanel/types.js +6 -6
- package/dist/esm/ui/Dropdown/index.js +2 -1
- package/dist/esm/ui/DropdownMenu/index.js +2 -1
- package/dist/esm/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +3 -3
- package/dist/esm/ui/ElementBrowser/types.js +3 -3
- package/dist/esm/ui/LinkSearch/index.js +94 -101
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +18 -2
- package/dist/esm/ui/ToolbarFeedback/index.js +27 -31
- package/dist/esm/utils/action.js +31 -36
- package/dist/esm/utils/clipboard.js +82 -87
- package/dist/esm/utils/deprecation-warnings.js +1 -1
- package/dist/esm/utils/extensions.js +62 -67
- package/dist/esm/utils/insert.js +3 -3
- package/dist/esm/utils/mark.js +2 -2
- package/dist/esm/utils/performance/simple-measure-to-entries.js +1 -2
- package/dist/esm/utils/performance/track-transactions.js +3 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -0
- package/dist/types/i18n/cs.d.ts +29 -2
- package/dist/types/i18n/da.d.ts +29 -2
- package/dist/types/i18n/de.d.ts +28 -2
- package/dist/types/i18n/en.d.ts +28 -2
- package/dist/types/i18n/en_GB.d.ts +31 -5
- package/dist/types/i18n/en_ZZ.d.ts +28 -2
- package/dist/types/i18n/es.d.ts +28 -2
- package/dist/types/i18n/fi.d.ts +28 -2
- package/dist/types/i18n/fr.d.ts +28 -2
- package/dist/types/i18n/hu.d.ts +28 -2
- package/dist/types/i18n/it.d.ts +28 -2
- package/dist/types/i18n/ja.d.ts +28 -2
- package/dist/types/i18n/ko.d.ts +28 -2
- package/dist/types/i18n/nb.d.ts +28 -2
- package/dist/types/i18n/nl.d.ts +28 -2
- package/dist/types/i18n/pl.d.ts +28 -2
- package/dist/types/i18n/pt_BR.d.ts +28 -2
- package/dist/types/i18n/ru.d.ts +28 -2
- package/dist/types/i18n/sv.d.ts +28 -2
- package/dist/types/i18n/th.d.ts +28 -2
- package/dist/types/i18n/tr.d.ts +28 -2
- package/dist/types/i18n/uk.d.ts +28 -2
- package/dist/types/i18n/vi.d.ts +28 -2
- package/dist/types/i18n/zh.d.ts +30 -2
- package/dist/types/i18n/zh_TW.d.ts +28 -2
- package/dist/types/plugins/tasks-and-decisions/utils.d.ts +2 -0
- package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +3 -1
- package/dist/types/utils/document.d.ts +2 -2
- package/package.json +15 -15
- 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
|
-
|
|
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
|
|
26
|
-
while (1) {
|
|
27
|
-
|
|
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 (!(
|
|
31
|
-
|
|
57
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
58
|
+
_context2.next = 3;
|
|
32
59
|
break;
|
|
33
60
|
}
|
|
34
|
-
return
|
|
61
|
+
return _context2.abrupt("return");
|
|
35
62
|
case 3:
|
|
36
|
-
|
|
37
|
-
_context.next = 6;
|
|
63
|
+
_context2.next = 5;
|
|
38
64
|
return _this.getObjectId();
|
|
39
|
-
case
|
|
40
|
-
objectId =
|
|
41
|
-
(0, _helpers.
|
|
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
|
|
73
|
+
case 7:
|
|
45
74
|
case "end":
|
|
46
|
-
return
|
|
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__*/
|
|
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
|
|
92
|
-
while (1) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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__*/
|
|
156
|
+
(0, _defineProperty2.default)(this, "updateMediaSingleFileAttrs", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
162
157
|
var newAttrs, _ref5, id;
|
|
163
|
-
return
|
|
164
|
-
while (1) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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__*/
|
|
176
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(getPos) {
|
|
184
177
|
var newAttrs;
|
|
185
|
-
return
|
|
186
|
-
while (1) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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__*/
|
|
208
|
+
(0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
218
209
|
var contextIdentifierProvider;
|
|
219
|
-
return
|
|
220
|
-
while (1) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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__*/
|
|
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
|
|
239
|
-
while (1) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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__*/
|
|
297
|
+
(0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
311
298
|
var nodeContextId, currentContextId;
|
|
312
|
-
return
|
|
313
|
-
while (1) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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__*/
|
|
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
|
|
338
|
-
while (1) {
|
|
339
|
-
|
|
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
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
|
350
|
-
case
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if (
|
|
354
|
-
|
|
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
|
|
387
|
+
return _context10.abrupt("return");
|
|
388
|
+
case 7:
|
|
389
|
+
_context10.next = 9;
|
|
390
|
+
return _this.props.mediaProvider;
|
|
358
391
|
case 9:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
_context9.next = 15;
|
|
392
|
+
mediaProvider = _context10.sent;
|
|
393
|
+
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
394
|
+
_context10.next = 12;
|
|
363
395
|
break;
|
|
364
396
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
|
376
|
-
case
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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__*/
|
|
450
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(getPos, traceContext) {
|
|
469
451
|
var attrs, copiedAttrs;
|
|
470
|
-
return
|
|
471
|
-
while (1) {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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__*/
|
|
488
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(traceContext) {
|
|
508
489
|
var attrs, view, copiedAttrs;
|
|
509
|
-
return
|
|
510
|
-
while (1) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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__*/
|
|
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
|
|
547
|
-
while (1) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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__*/
|
|
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
|
|
627
|
-
while (1) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
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__*/
|
|
713
|
-
return
|
|
714
|
-
while (1) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
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
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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
|
-
}()
|
|
750
|
-
// Copies the pasted node into the current collection
|
|
719
|
+
}()
|
|
751
720
|
}]);
|
|
752
721
|
return MediaNodeUpdater;
|
|
753
722
|
}();
|