@atlaskit/editor-core 179.1.2 → 180.1.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 +80 -0
- package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
- package/dist/cjs/actions/index.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +12 -762
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +35 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
- package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
- package/dist/cjs/editor-next/index.js +139 -0
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
- package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
- package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
- package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
- package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
- package/dist/cjs/editor.js +130 -443
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
- package/dist/cjs/labs/next/presets/preset.js +0 -5
- package/dist/cjs/labs/next/presets/universal.js +11 -2
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/cjs/plugins/analytics/index.js +2 -3
- package/dist/cjs/plugins/analytics/plugin.js +5 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
- package/dist/cjs/plugins/hyperlink/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/cjs/plugins/media/commands/helpers.js +12 -40
- package/dist/cjs/plugins/media/commands/index.js +4 -4
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/cjs/plugins/panel/utils.js +4 -1
- package/dist/cjs/plugins/paste/handlers.js +128 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/cjs/plugins/text-formatting/utils.js +1 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/types/get-editor-props.js +5 -0
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ContextPanel/context.js +13 -12
- package/dist/cjs/ui/Dropdown/index.js +7 -2
- package/dist/cjs/ui/DropdownMenu/index.js +7 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +32 -0
- package/dist/cjs/utils/linking-utils.js +1 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
- package/dist/cjs/utils/performance/safer-transactions.js +1 -1
- package/dist/cjs/utils/prepare-extension-provider.js +25 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -2
- package/dist/es2019/create-editor/ReactEditorView.js +6 -708
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -0
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +10 -0
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
- package/dist/es2019/editor-next/index.js +90 -0
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
- package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
- package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
- package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
- package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
- package/dist/es2019/editor.js +111 -396
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
- package/dist/es2019/labs/next/presets/preset.js +0 -3
- package/dist/es2019/labs/next/presets/universal.js +13 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
- package/dist/es2019/plugins/analytics/index.js +3 -4
- package/dist/es2019/plugins/analytics/plugin.js +1 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
- package/dist/es2019/plugins/hyperlink/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
- package/dist/es2019/plugins/media/commands/helpers.js +9 -35
- package/dist/es2019/plugins/media/commands/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/es2019/plugins/text-formatting/utils.js +0 -8
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/types/get-editor-props.js +1 -0
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ContextPanel/context.js +5 -4
- package/dist/es2019/ui/Dropdown/index.js +5 -2
- package/dist/es2019/ui/DropdownMenu/index.js +5 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +25 -0
- package/dist/es2019/utils/linking-utils.js +1 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
- package/dist/es2019/utils/performance/safer-transactions.js +1 -1
- package/dist/es2019/utils/prepare-extension-provider.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -2
- package/dist/esm/create-editor/ReactEditorView.js +12 -763
- package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -0
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +28 -0
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
- package/dist/esm/editor-next/index.js +134 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
- package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
- package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/esm/editor-next/utils/handleProviders.js +50 -0
- package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
- package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
- package/dist/esm/editor.js +130 -440
- package/dist/esm/index.js +2 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
- package/dist/esm/labs/next/presets/preset.js +0 -5
- package/dist/esm/labs/next/presets/universal.js +11 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/esm/plugins/analytics/index.js +3 -4
- package/dist/esm/plugins/analytics/plugin.js +1 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/hyperlink/analytics.js +1 -1
- package/dist/esm/plugins/hyperlink/index.js +1 -1
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/esm/plugins/media/commands/helpers.js +9 -35
- package/dist/esm/plugins/media/commands/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/esm/plugins/text-formatting/utils.js +0 -8
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/types/get-editor-props.js +1 -0
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPickerButton/index.js +69 -7
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ContextPanel/context.js +8 -8
- package/dist/esm/ui/Dropdown/index.js +7 -2
- package/dist/esm/ui/DropdownMenu/index.js +7 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +25 -0
- package/dist/esm/utils/linking-utils.js +1 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
- package/dist/esm/utils/performance/safer-transactions.js +1 -1
- package/dist/esm/utils/prepare-extension-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
- package/dist/types/editor-next/editor-internal.d.ts +44 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
- package/dist/types/editor-next/index.d.ts +34 -0
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
- package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
- package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
- package/dist/types/editor.d.ts +47 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
- package/dist/types/labs/next/presets/preset.d.ts +6 -6
- package/dist/types/labs/next/presets/universal.d.ts +1 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
- package/dist/types/plugins/analytics/index.d.ts +3 -6
- package/dist/types/plugins/analytics/plugin.d.ts +3 -1
- package/dist/types/plugins/analytics/utils.d.ts +2 -3
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -1
- package/dist/types/plugins/base/index.d.ts +3 -1
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
- package/dist/types/plugins/block-type/index.d.ts +3 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/breakout/index.d.ts +3 -1
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/context-panel/index.d.ts +1 -1
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +3 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
- package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/hyperlink/types.d.ts +3 -1
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types/plugins/layout/index.d.ts +3 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/max-content-size/index.d.ts +3 -1
- package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
- package/dist/types/plugins/media/commands/index.d.ts +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
- package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +3 -1
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
- package/dist/types/plugins/placeholder/index.d.ts +3 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/plugins/quick-insert/index.d.ts +3 -1
- package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
- package/dist/types/plugins/selection/index.d.ts +3 -1
- package/dist/types/plugins/status/index.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
- package/dist/types/plugins/submit-editor/index.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/index.d.ts +3 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/types/get-editor-props.d.ts +12 -0
- package/dist/types/types/performance-tracking.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/utils/document.d.ts +4 -3
- package/dist/types/utils/get-editor-plugins.d.ts +10 -0
- package/dist/types/utils/linking-utils.d.ts +1 -1
- package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
- package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
- package/docs/0-intro.tsx +0 -1
- package/package.json +27 -26
- package/report.api.md +193 -139
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
- package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
|
@@ -7,7 +7,7 @@ import uuidV4 from 'uuid/v4';
|
|
|
7
7
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
10
|
-
import { replaceExternalMedia,
|
|
10
|
+
import { replaceExternalMedia, updateAllMediaSingleNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaSingleNodeAttrs } from '../commands/helpers';
|
|
11
11
|
export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
12
12
|
function MediaNodeUpdater(props) {
|
|
13
13
|
var _this = this;
|
|
@@ -30,9 +30,9 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
30
30
|
return _this.getObjectId();
|
|
31
31
|
case 6:
|
|
32
32
|
objectId = _context.sent;
|
|
33
|
-
|
|
33
|
+
updateAllMediaSingleNodesAttrs(id, {
|
|
34
34
|
__contextId: objectId
|
|
35
|
-
}
|
|
35
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
36
36
|
case 8:
|
|
37
37
|
case "end":
|
|
38
38
|
return _context.stop();
|
|
@@ -40,60 +40,95 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
40
40
|
}
|
|
41
41
|
}, _callee);
|
|
42
42
|
})));
|
|
43
|
+
_defineProperty(this, "updateNodeContextId", /*#__PURE__*/function () {
|
|
44
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(getPos) {
|
|
45
|
+
var attrs, objectId;
|
|
46
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context2.prev = _context2.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
attrs = _this.getAttrs();
|
|
51
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
52
|
+
_context2.next = 3;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return _context2.abrupt("return");
|
|
56
|
+
case 3:
|
|
57
|
+
_context2.next = 5;
|
|
58
|
+
return _this.getObjectId();
|
|
59
|
+
case 5:
|
|
60
|
+
objectId = _context2.sent;
|
|
61
|
+
updateCurrentMediaNodeAttrs({
|
|
62
|
+
__contextId: objectId
|
|
63
|
+
}, {
|
|
64
|
+
node: _this.props.node,
|
|
65
|
+
getPos: getPos
|
|
66
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
67
|
+
case 7:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context2.stop();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, _callee2);
|
|
73
|
+
}));
|
|
74
|
+
return function (_x) {
|
|
75
|
+
return _ref2.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}());
|
|
43
78
|
_defineProperty(this, "hasFileAttributesDefined", function (attrs) {
|
|
44
79
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
45
80
|
});
|
|
46
|
-
_defineProperty(this, "getNewFileAttrsForNode", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
81
|
+
_defineProperty(this, "getNewFileAttrsForNode", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
47
82
|
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
|
|
48
|
-
return _regeneratorRuntime.wrap(function
|
|
83
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
49
84
|
while (1) {
|
|
50
|
-
switch (
|
|
85
|
+
switch (_context3.prev = _context3.next) {
|
|
51
86
|
case 0:
|
|
52
87
|
attrs = _this.getAttrs();
|
|
53
|
-
|
|
88
|
+
_context3.next = 3;
|
|
54
89
|
return _this.props.mediaProvider;
|
|
55
90
|
case 3:
|
|
56
|
-
mediaProvider =
|
|
91
|
+
mediaProvider = _context3.sent;
|
|
57
92
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined(attrs))) {
|
|
58
|
-
|
|
93
|
+
_context3.next = 6;
|
|
59
94
|
break;
|
|
60
95
|
}
|
|
61
|
-
return
|
|
96
|
+
return _context3.abrupt("return");
|
|
62
97
|
case 6:
|
|
63
98
|
mediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
64
99
|
mediaClient = getMediaClient(mediaClientConfig);
|
|
65
100
|
id = attrs.id, collectionName = attrs.collection;
|
|
66
|
-
|
|
67
|
-
|
|
101
|
+
_context3.prev = 9;
|
|
102
|
+
_context3.next = 12;
|
|
68
103
|
return mediaClient.file.getCurrentState(id, {
|
|
69
104
|
collectionName: collectionName
|
|
70
105
|
});
|
|
71
106
|
case 12:
|
|
72
|
-
fileState =
|
|
107
|
+
fileState = _context3.sent;
|
|
73
108
|
if (!(fileState.status === 'error')) {
|
|
74
|
-
|
|
109
|
+
_context3.next = 15;
|
|
75
110
|
break;
|
|
76
111
|
}
|
|
77
|
-
return
|
|
112
|
+
return _context3.abrupt("return");
|
|
78
113
|
case 15:
|
|
79
|
-
|
|
114
|
+
_context3.next = 20;
|
|
80
115
|
break;
|
|
81
116
|
case 17:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
117
|
+
_context3.prev = 17;
|
|
118
|
+
_context3.t0 = _context3["catch"](9);
|
|
119
|
+
return _context3.abrupt("return");
|
|
85
120
|
case 20:
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
121
|
+
_context3.t1 = _this.getNodeContextId();
|
|
122
|
+
if (_context3.t1) {
|
|
123
|
+
_context3.next = 25;
|
|
89
124
|
break;
|
|
90
125
|
}
|
|
91
|
-
|
|
126
|
+
_context3.next = 24;
|
|
92
127
|
return _this.getObjectId();
|
|
93
128
|
case 24:
|
|
94
|
-
|
|
129
|
+
_context3.t1 = _context3.sent;
|
|
95
130
|
case 25:
|
|
96
|
-
contextId =
|
|
131
|
+
contextId = _context3.t1;
|
|
97
132
|
_fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
|
|
98
133
|
newAttrs = {
|
|
99
134
|
__fileName: name,
|
|
@@ -102,56 +137,51 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
102
137
|
__contextId: contextId
|
|
103
138
|
};
|
|
104
139
|
if (hasPrivateAttrsChanged(attrs, newAttrs)) {
|
|
105
|
-
|
|
140
|
+
_context3.next = 30;
|
|
106
141
|
break;
|
|
107
142
|
}
|
|
108
|
-
return
|
|
143
|
+
return _context3.abrupt("return");
|
|
109
144
|
case 30:
|
|
110
|
-
return
|
|
145
|
+
return _context3.abrupt("return", newAttrs);
|
|
111
146
|
case 31:
|
|
112
147
|
case "end":
|
|
113
|
-
return
|
|
148
|
+
return _context3.stop();
|
|
114
149
|
}
|
|
115
150
|
}
|
|
116
|
-
},
|
|
151
|
+
}, _callee3, null, [[9, 17]]);
|
|
117
152
|
})));
|
|
118
|
-
_defineProperty(this, "
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
_ref4,
|
|
122
|
-
id,
|
|
123
|
-
_args3 = arguments;
|
|
124
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
153
|
+
_defineProperty(this, "updateMediaSingleFileAttrs", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
154
|
+
var newAttrs, _ref5, id;
|
|
155
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
125
156
|
while (1) {
|
|
126
|
-
switch (
|
|
157
|
+
switch (_context4.prev = _context4.next) {
|
|
127
158
|
case 0:
|
|
128
|
-
|
|
129
|
-
_context3.next = 3;
|
|
159
|
+
_context4.next = 2;
|
|
130
160
|
return _this.getNewFileAttrsForNode();
|
|
131
|
-
case
|
|
132
|
-
newAttrs =
|
|
133
|
-
|
|
161
|
+
case 2:
|
|
162
|
+
newAttrs = _context4.sent;
|
|
163
|
+
_ref5 = _this.getAttrs(), id = _ref5.id;
|
|
134
164
|
if (id && newAttrs) {
|
|
135
|
-
|
|
165
|
+
updateAllMediaSingleNodesAttrs(id, newAttrs)(_this.props.view.state, _this.props.view.dispatch);
|
|
136
166
|
}
|
|
137
|
-
case
|
|
167
|
+
case 5:
|
|
138
168
|
case "end":
|
|
139
|
-
return
|
|
169
|
+
return _context4.stop();
|
|
140
170
|
}
|
|
141
171
|
}
|
|
142
|
-
},
|
|
172
|
+
}, _callee4);
|
|
143
173
|
})));
|
|
144
174
|
_defineProperty(this, "updateNodeAttrs", /*#__PURE__*/function () {
|
|
145
|
-
var
|
|
175
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(getPos) {
|
|
146
176
|
var newAttrs;
|
|
147
|
-
return _regeneratorRuntime.wrap(function
|
|
177
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
148
178
|
while (1) {
|
|
149
|
-
switch (
|
|
179
|
+
switch (_context5.prev = _context5.next) {
|
|
150
180
|
case 0:
|
|
151
|
-
|
|
181
|
+
_context5.next = 2;
|
|
152
182
|
return _this.getNewFileAttrsForNode();
|
|
153
183
|
case 2:
|
|
154
|
-
newAttrs =
|
|
184
|
+
newAttrs = _context5.sent;
|
|
155
185
|
if (newAttrs) {
|
|
156
186
|
updateCurrentMediaNodeAttrs(newAttrs, {
|
|
157
187
|
node: _this.props.node,
|
|
@@ -160,13 +190,13 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
160
190
|
}
|
|
161
191
|
case 4:
|
|
162
192
|
case "end":
|
|
163
|
-
return
|
|
193
|
+
return _context5.stop();
|
|
164
194
|
}
|
|
165
195
|
}
|
|
166
|
-
},
|
|
196
|
+
}, _callee5);
|
|
167
197
|
}));
|
|
168
|
-
return function (
|
|
169
|
-
return
|
|
198
|
+
return function (_x2) {
|
|
199
|
+
return _ref6.apply(this, arguments);
|
|
170
200
|
};
|
|
171
201
|
}());
|
|
172
202
|
_defineProperty(this, "getAttrs", function () {
|
|
@@ -176,54 +206,54 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
176
206
|
}
|
|
177
207
|
return undefined;
|
|
178
208
|
});
|
|
179
|
-
_defineProperty(this, "getObjectId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
209
|
+
_defineProperty(this, "getObjectId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
180
210
|
var contextIdentifierProvider;
|
|
181
|
-
return _regeneratorRuntime.wrap(function
|
|
211
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
182
212
|
while (1) {
|
|
183
|
-
switch (
|
|
213
|
+
switch (_context6.prev = _context6.next) {
|
|
184
214
|
case 0:
|
|
185
|
-
|
|
215
|
+
_context6.next = 2;
|
|
186
216
|
return _this.props.contextIdentifierProvider;
|
|
187
217
|
case 2:
|
|
188
|
-
contextIdentifierProvider =
|
|
189
|
-
return
|
|
218
|
+
contextIdentifierProvider = _context6.sent;
|
|
219
|
+
return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
190
220
|
case 4:
|
|
191
221
|
case "end":
|
|
192
|
-
return
|
|
222
|
+
return _context6.stop();
|
|
193
223
|
}
|
|
194
224
|
}
|
|
195
|
-
},
|
|
225
|
+
}, _callee6);
|
|
196
226
|
})));
|
|
197
227
|
_defineProperty(this, "uploadExternalMedia", /*#__PURE__*/function () {
|
|
198
|
-
var
|
|
228
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(getPos) {
|
|
199
229
|
var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions;
|
|
200
|
-
return _regeneratorRuntime.wrap(function
|
|
230
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
201
231
|
while (1) {
|
|
202
|
-
switch (
|
|
232
|
+
switch (_context7.prev = _context7.next) {
|
|
203
233
|
case 0:
|
|
204
234
|
node = _this.props.node;
|
|
205
|
-
|
|
235
|
+
_context7.next = 3;
|
|
206
236
|
return _this.props.mediaProvider;
|
|
207
237
|
case 3:
|
|
208
|
-
mediaProvider =
|
|
238
|
+
mediaProvider = _context7.sent;
|
|
209
239
|
if (!(node && mediaProvider)) {
|
|
210
|
-
|
|
240
|
+
_context7.next = 21;
|
|
211
241
|
break;
|
|
212
242
|
}
|
|
213
243
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
214
244
|
if (!(!uploadMediaClientConfig || !node.attrs.url)) {
|
|
215
|
-
|
|
245
|
+
_context7.next = 8;
|
|
216
246
|
break;
|
|
217
247
|
}
|
|
218
|
-
return
|
|
248
|
+
return _context7.abrupt("return");
|
|
219
249
|
case 8:
|
|
220
250
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
221
251
|
collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
|
|
222
|
-
|
|
223
|
-
|
|
252
|
+
_context7.prev = 10;
|
|
253
|
+
_context7.next = 13;
|
|
224
254
|
return mediaClient.file.uploadExternal(node.attrs.url, collection);
|
|
225
255
|
case 13:
|
|
226
|
-
uploader =
|
|
256
|
+
uploader = _context7.sent;
|
|
227
257
|
uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
|
|
228
258
|
replaceExternalMedia(getPos() + 1, {
|
|
229
259
|
id: uploadableFileUpfrontIds.id,
|
|
@@ -232,11 +262,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
232
262
|
width: dimensions.width,
|
|
233
263
|
occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
|
|
234
264
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
235
|
-
|
|
265
|
+
_context7.next = 21;
|
|
236
266
|
break;
|
|
237
267
|
case 18:
|
|
238
|
-
|
|
239
|
-
|
|
268
|
+
_context7.prev = 18;
|
|
269
|
+
_context7.t0 = _context7["catch"](10);
|
|
240
270
|
//keep it as external media
|
|
241
271
|
if (_this.props.dispatchAnalyticsEvent) {
|
|
242
272
|
_this.props.dispatchAnalyticsEvent({
|
|
@@ -247,13 +277,13 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
247
277
|
}
|
|
248
278
|
case 21:
|
|
249
279
|
case "end":
|
|
250
|
-
return
|
|
280
|
+
return _context7.stop();
|
|
251
281
|
}
|
|
252
282
|
}
|
|
253
|
-
},
|
|
283
|
+
}, _callee7, null, [[10, 18]]);
|
|
254
284
|
}));
|
|
255
|
-
return function (
|
|
256
|
-
return
|
|
285
|
+
return function (_x3) {
|
|
286
|
+
return _ref8.apply(this, arguments);
|
|
257
287
|
};
|
|
258
288
|
}());
|
|
259
289
|
_defineProperty(this, "getNodeContextId", function () {
|
|
@@ -264,132 +294,132 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
264
294
|
return attrs.__contextId || null;
|
|
265
295
|
});
|
|
266
296
|
_defineProperty(this, "updateDimensions", function (dimensions) {
|
|
267
|
-
|
|
297
|
+
updateAllMediaSingleNodesAttrs(dimensions.id, {
|
|
268
298
|
height: dimensions.height,
|
|
269
299
|
width: dimensions.width
|
|
270
|
-
}
|
|
300
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
271
301
|
});
|
|
272
|
-
_defineProperty(this, "hasDifferentContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
302
|
+
_defineProperty(this, "hasDifferentContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
273
303
|
var nodeContextId, currentContextId;
|
|
274
|
-
return _regeneratorRuntime.wrap(function
|
|
304
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
275
305
|
while (1) {
|
|
276
|
-
switch (
|
|
306
|
+
switch (_context8.prev = _context8.next) {
|
|
277
307
|
case 0:
|
|
278
308
|
nodeContextId = _this.getNodeContextId();
|
|
279
|
-
|
|
309
|
+
_context8.next = 3;
|
|
280
310
|
return _this.getObjectId();
|
|
281
311
|
case 3:
|
|
282
|
-
currentContextId =
|
|
312
|
+
currentContextId = _context8.sent;
|
|
283
313
|
if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
|
|
284
|
-
|
|
314
|
+
_context8.next = 6;
|
|
285
315
|
break;
|
|
286
316
|
}
|
|
287
|
-
return
|
|
317
|
+
return _context8.abrupt("return", true);
|
|
288
318
|
case 6:
|
|
289
|
-
return
|
|
319
|
+
return _context8.abrupt("return", false);
|
|
290
320
|
case 7:
|
|
291
321
|
case "end":
|
|
292
|
-
return
|
|
322
|
+
return _context8.stop();
|
|
293
323
|
}
|
|
294
324
|
}
|
|
295
|
-
},
|
|
325
|
+
}, _callee8);
|
|
296
326
|
})));
|
|
297
|
-
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
327
|
+
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
298
328
|
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
299
|
-
return _regeneratorRuntime.wrap(function
|
|
329
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
300
330
|
while (1) {
|
|
301
|
-
switch (
|
|
331
|
+
switch (_context9.prev = _context9.next) {
|
|
302
332
|
case 0:
|
|
303
|
-
|
|
333
|
+
_context9.next = 2;
|
|
304
334
|
return _this.props.mediaProvider;
|
|
305
335
|
case 2:
|
|
306
|
-
mediaProvider =
|
|
336
|
+
mediaProvider = _context9.sent;
|
|
307
337
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
308
|
-
|
|
338
|
+
_context9.next = 5;
|
|
309
339
|
break;
|
|
310
340
|
}
|
|
311
|
-
return
|
|
341
|
+
return _context9.abrupt("return", false);
|
|
312
342
|
case 5:
|
|
313
343
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
314
344
|
attrs = _this.getAttrs();
|
|
315
345
|
if (!(!attrs || attrs.type !== 'file')) {
|
|
316
|
-
|
|
346
|
+
_context9.next = 9;
|
|
317
347
|
break;
|
|
318
348
|
}
|
|
319
|
-
return
|
|
349
|
+
return _context9.abrupt("return", false);
|
|
320
350
|
case 9:
|
|
321
351
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
|
|
352
|
+
_context9.t0 = __contextId;
|
|
353
|
+
if (_context9.t0) {
|
|
354
|
+
_context9.next = 15;
|
|
325
355
|
break;
|
|
326
356
|
}
|
|
327
|
-
|
|
357
|
+
_context9.next = 14;
|
|
328
358
|
return _this.getObjectId();
|
|
329
359
|
case 14:
|
|
330
|
-
|
|
360
|
+
_context9.t0 = _context9.sent;
|
|
331
361
|
case 15:
|
|
332
|
-
contextId =
|
|
362
|
+
contextId = _context9.t0;
|
|
333
363
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
334
|
-
|
|
364
|
+
_context9.next = 18;
|
|
335
365
|
break;
|
|
336
366
|
}
|
|
337
|
-
return
|
|
367
|
+
return _context9.abrupt("return", true);
|
|
338
368
|
case 18:
|
|
339
|
-
return
|
|
369
|
+
return _context9.abrupt("return", false);
|
|
340
370
|
case 19:
|
|
341
371
|
case "end":
|
|
342
|
-
return
|
|
372
|
+
return _context9.stop();
|
|
343
373
|
}
|
|
344
374
|
}
|
|
345
|
-
},
|
|
375
|
+
}, _callee9);
|
|
346
376
|
})));
|
|
347
377
|
_defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
348
|
-
var
|
|
378
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(getPos) {
|
|
349
379
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, auth, source, destination, mediaFile;
|
|
350
|
-
return _regeneratorRuntime.wrap(function
|
|
380
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
351
381
|
while (1) {
|
|
352
|
-
switch (
|
|
382
|
+
switch (_context10.prev = _context10.next) {
|
|
353
383
|
case 0:
|
|
354
384
|
attrs = _this.getAttrs();
|
|
355
385
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
356
|
-
|
|
386
|
+
_context10.next = 3;
|
|
357
387
|
break;
|
|
358
388
|
}
|
|
359
|
-
return
|
|
389
|
+
return _context10.abrupt("return");
|
|
360
390
|
case 3:
|
|
361
391
|
url = attrs.url;
|
|
362
392
|
mediaAttrs = getAttrsFromUrl(url);
|
|
363
393
|
if (mediaAttrs) {
|
|
364
|
-
|
|
394
|
+
_context10.next = 7;
|
|
365
395
|
break;
|
|
366
396
|
}
|
|
367
|
-
return
|
|
397
|
+
return _context10.abrupt("return");
|
|
368
398
|
case 7:
|
|
369
|
-
|
|
399
|
+
_context10.next = 9;
|
|
370
400
|
return _this.props.mediaProvider;
|
|
371
401
|
case 9:
|
|
372
|
-
mediaProvider =
|
|
402
|
+
mediaProvider = _context10.sent;
|
|
373
403
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
374
|
-
|
|
404
|
+
_context10.next = 12;
|
|
375
405
|
break;
|
|
376
406
|
}
|
|
377
|
-
return
|
|
407
|
+
return _context10.abrupt("return");
|
|
378
408
|
case 12:
|
|
379
409
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
380
410
|
contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
|
|
381
411
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
382
412
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
383
|
-
|
|
413
|
+
_context10.next = 17;
|
|
384
414
|
break;
|
|
385
415
|
}
|
|
386
|
-
return
|
|
416
|
+
return _context10.abrupt("return");
|
|
387
417
|
case 17:
|
|
388
418
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
389
|
-
|
|
419
|
+
_context10.next = 20;
|
|
390
420
|
return uploadMediaClientConfig.getAuthFromContext(contextId);
|
|
391
421
|
case 20:
|
|
392
|
-
auth =
|
|
422
|
+
auth = _context10.sent;
|
|
393
423
|
source = {
|
|
394
424
|
id: id,
|
|
395
425
|
collection: collection,
|
|
@@ -402,10 +432,10 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
402
432
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
403
433
|
occurrenceKey: uuidV4()
|
|
404
434
|
};
|
|
405
|
-
|
|
435
|
+
_context10.next = 25;
|
|
406
436
|
return mediaClient.file.copyFile(source, destination);
|
|
407
437
|
case 25:
|
|
408
|
-
mediaFile =
|
|
438
|
+
mediaFile = _context10.sent;
|
|
409
439
|
replaceExternalMedia(getPos() + 1, {
|
|
410
440
|
id: mediaFile.id,
|
|
411
441
|
collection: currentCollectionName,
|
|
@@ -417,50 +447,125 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
417
447
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
418
448
|
case 27:
|
|
419
449
|
case "end":
|
|
420
|
-
return
|
|
450
|
+
return _context10.stop();
|
|
421
451
|
}
|
|
422
452
|
}
|
|
423
|
-
},
|
|
453
|
+
}, _callee10);
|
|
424
454
|
}));
|
|
425
|
-
return function (
|
|
426
|
-
return
|
|
455
|
+
return function (_x4) {
|
|
456
|
+
return _ref11.apply(this, arguments);
|
|
457
|
+
};
|
|
458
|
+
}());
|
|
459
|
+
_defineProperty(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
460
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(getPos, traceContext) {
|
|
461
|
+
var attrs, copiedAttrs;
|
|
462
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
463
|
+
while (1) {
|
|
464
|
+
switch (_context11.prev = _context11.next) {
|
|
465
|
+
case 0:
|
|
466
|
+
attrs = _this.getAttrs();
|
|
467
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
468
|
+
_context11.next = 3;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
return _context11.abrupt("return");
|
|
472
|
+
case 3:
|
|
473
|
+
_context11.next = 5;
|
|
474
|
+
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
475
|
+
case 5:
|
|
476
|
+
copiedAttrs = _context11.sent;
|
|
477
|
+
if (copiedAttrs) {
|
|
478
|
+
_context11.next = 8;
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
return _context11.abrupt("return");
|
|
482
|
+
case 8:
|
|
483
|
+
updateCurrentMediaNodeAttrs(copiedAttrs, {
|
|
484
|
+
node: _this.props.node,
|
|
485
|
+
getPos: getPos
|
|
486
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
487
|
+
case 9:
|
|
488
|
+
case "end":
|
|
489
|
+
return _context11.stop();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}, _callee11);
|
|
493
|
+
}));
|
|
494
|
+
return function (_x5, _x6) {
|
|
495
|
+
return _ref12.apply(this, arguments);
|
|
427
496
|
};
|
|
428
497
|
}());
|
|
429
498
|
_defineProperty(this, "copyNode", /*#__PURE__*/function () {
|
|
430
|
-
var
|
|
431
|
-
var
|
|
432
|
-
return _regeneratorRuntime.wrap(function
|
|
499
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(traceContext) {
|
|
500
|
+
var attrs, view, copiedAttrs;
|
|
501
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
433
502
|
while (1) {
|
|
434
|
-
switch (
|
|
503
|
+
switch (_context12.prev = _context12.next) {
|
|
504
|
+
case 0:
|
|
505
|
+
attrs = _this.getAttrs();
|
|
506
|
+
view = _this.props.view;
|
|
507
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
508
|
+
_context12.next = 4;
|
|
509
|
+
break;
|
|
510
|
+
}
|
|
511
|
+
return _context12.abrupt("return");
|
|
512
|
+
case 4:
|
|
513
|
+
_context12.next = 6;
|
|
514
|
+
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
515
|
+
case 6:
|
|
516
|
+
copiedAttrs = _context12.sent;
|
|
517
|
+
if (copiedAttrs) {
|
|
518
|
+
_context12.next = 9;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
return _context12.abrupt("return");
|
|
522
|
+
case 9:
|
|
523
|
+
updateMediaSingleNodeAttrs(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
524
|
+
case 10:
|
|
525
|
+
case "end":
|
|
526
|
+
return _context12.stop();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}, _callee12);
|
|
530
|
+
}));
|
|
531
|
+
return function (_x7) {
|
|
532
|
+
return _ref13.apply(this, arguments);
|
|
533
|
+
};
|
|
534
|
+
}());
|
|
535
|
+
_defineProperty(this, "copyFile", /*#__PURE__*/function () {
|
|
536
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, collection, traceContext) {
|
|
537
|
+
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, auth, objectId, source, currentCollectionName, destination, mediaFile;
|
|
538
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
539
|
+
while (1) {
|
|
540
|
+
switch (_context13.prev = _context13.next) {
|
|
435
541
|
case 0:
|
|
436
|
-
|
|
542
|
+
_context13.next = 2;
|
|
437
543
|
return _this.props.mediaProvider;
|
|
438
544
|
case 2:
|
|
439
|
-
mediaProvider =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file')) {
|
|
443
|
-
_context10.next = 7;
|
|
545
|
+
mediaProvider = _context13.sent;
|
|
546
|
+
if (!(!id || !collection || !(mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams))) {
|
|
547
|
+
_context13.next = 5;
|
|
444
548
|
break;
|
|
445
549
|
}
|
|
446
|
-
return
|
|
447
|
-
case
|
|
550
|
+
return _context13.abrupt("return");
|
|
551
|
+
case 5:
|
|
448
552
|
nodeContextId = _this.getNodeContextId();
|
|
449
553
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
450
|
-
if (!(uploadMediaClientConfig && uploadMediaClientConfig.getAuthFromContext
|
|
451
|
-
|
|
554
|
+
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
555
|
+
_context13.next = 9;
|
|
452
556
|
break;
|
|
453
557
|
}
|
|
558
|
+
return _context13.abrupt("return");
|
|
559
|
+
case 9:
|
|
454
560
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
455
|
-
|
|
561
|
+
_context13.next = 12;
|
|
456
562
|
return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
457
|
-
case
|
|
458
|
-
auth =
|
|
459
|
-
|
|
563
|
+
case 12:
|
|
564
|
+
auth = _context13.sent;
|
|
565
|
+
_context13.next = 15;
|
|
460
566
|
return _this.getObjectId();
|
|
461
|
-
case
|
|
462
|
-
objectId =
|
|
463
|
-
id = attrs.id, collection = attrs.collection;
|
|
567
|
+
case 15:
|
|
568
|
+
objectId = _context13.sent;
|
|
464
569
|
source = {
|
|
465
570
|
id: id,
|
|
466
571
|
collection: collection,
|
|
@@ -474,24 +579,24 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
474
579
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
475
580
|
occurrenceKey: uuidV4()
|
|
476
581
|
};
|
|
477
|
-
|
|
582
|
+
_context13.next = 21;
|
|
478
583
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
479
|
-
case
|
|
480
|
-
mediaFile =
|
|
481
|
-
|
|
584
|
+
case 21:
|
|
585
|
+
mediaFile = _context13.sent;
|
|
586
|
+
return _context13.abrupt("return", {
|
|
482
587
|
id: mediaFile.id,
|
|
483
588
|
collection: currentCollectionName,
|
|
484
589
|
__contextId: objectId
|
|
485
|
-
}
|
|
486
|
-
case
|
|
590
|
+
});
|
|
591
|
+
case 23:
|
|
487
592
|
case "end":
|
|
488
|
-
return
|
|
593
|
+
return _context13.stop();
|
|
489
594
|
}
|
|
490
595
|
}
|
|
491
|
-
},
|
|
596
|
+
}, _callee13);
|
|
492
597
|
}));
|
|
493
|
-
return function (
|
|
494
|
-
return
|
|
598
|
+
return function (_x8, _x9, _x10) {
|
|
599
|
+
return _ref14.apply(this, arguments);
|
|
495
600
|
};
|
|
496
601
|
}());
|
|
497
602
|
this.props = props;
|
|
@@ -504,47 +609,47 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
504
609
|
}
|
|
505
610
|
|
|
506
611
|
// Updates the node with contextId if it doesn't have one already
|
|
507
|
-
// TODO [MS-2258]: remove updateContextId in order to only use
|
|
612
|
+
// TODO [MS-2258]: remove updateContextId in order to only use updateMediaSingleFileAttrs
|
|
508
613
|
}, {
|
|
509
614
|
key: "getRemoteDimensions",
|
|
510
615
|
value: function () {
|
|
511
|
-
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
616
|
+
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
512
617
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
513
|
-
return _regeneratorRuntime.wrap(function
|
|
618
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
514
619
|
while (1) {
|
|
515
|
-
switch (
|
|
620
|
+
switch (_context14.prev = _context14.next) {
|
|
516
621
|
case 0:
|
|
517
|
-
|
|
622
|
+
_context14.next = 2;
|
|
518
623
|
return this.props.mediaProvider;
|
|
519
624
|
case 2:
|
|
520
|
-
mediaProvider =
|
|
625
|
+
mediaProvider = _context14.sent;
|
|
521
626
|
mediaOptions = this.props.mediaOptions;
|
|
522
627
|
attrs = this.getAttrs();
|
|
523
628
|
if (!(!mediaProvider || !attrs)) {
|
|
524
|
-
|
|
629
|
+
_context14.next = 7;
|
|
525
630
|
break;
|
|
526
631
|
}
|
|
527
|
-
return
|
|
632
|
+
return _context14.abrupt("return", false);
|
|
528
633
|
case 7:
|
|
529
634
|
height = attrs.height, width = attrs.width;
|
|
530
635
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
531
|
-
|
|
636
|
+
_context14.next = 10;
|
|
532
637
|
break;
|
|
533
638
|
}
|
|
534
|
-
return
|
|
639
|
+
return _context14.abrupt("return", false);
|
|
535
640
|
case 10:
|
|
536
641
|
id = attrs.id, collection = attrs.collection;
|
|
537
642
|
if (!(height && width)) {
|
|
538
|
-
|
|
643
|
+
_context14.next = 13;
|
|
539
644
|
break;
|
|
540
645
|
}
|
|
541
|
-
return
|
|
646
|
+
return _context14.abrupt("return", false);
|
|
542
647
|
case 13:
|
|
543
648
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
544
|
-
|
|
649
|
+
_context14.next = 15;
|
|
545
650
|
break;
|
|
546
651
|
}
|
|
547
|
-
return
|
|
652
|
+
return _context14.abrupt("return", {
|
|
548
653
|
id: id,
|
|
549
654
|
height: DEFAULT_IMAGE_HEIGHT,
|
|
550
655
|
width: DEFAULT_IMAGE_WIDTH
|
|
@@ -552,41 +657,41 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
552
657
|
case 15:
|
|
553
658
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
554
659
|
mediaClient = getMediaClient(viewMediaClientConfig);
|
|
555
|
-
|
|
660
|
+
_context14.next = 19;
|
|
556
661
|
return mediaClient.file.getCurrentState(id, {
|
|
557
662
|
collectionName: collection
|
|
558
663
|
});
|
|
559
664
|
case 19:
|
|
560
|
-
currentState =
|
|
665
|
+
currentState = _context14.sent;
|
|
561
666
|
if (isImageRepresentationReady(currentState)) {
|
|
562
|
-
|
|
667
|
+
_context14.next = 22;
|
|
563
668
|
break;
|
|
564
669
|
}
|
|
565
|
-
return
|
|
670
|
+
return _context14.abrupt("return", false);
|
|
566
671
|
case 22:
|
|
567
|
-
|
|
672
|
+
_context14.next = 24;
|
|
568
673
|
return mediaClient.getImageMetadata(id, {
|
|
569
674
|
collection: collection
|
|
570
675
|
});
|
|
571
676
|
case 24:
|
|
572
|
-
imageMetadata =
|
|
677
|
+
imageMetadata = _context14.sent;
|
|
573
678
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
574
|
-
|
|
679
|
+
_context14.next = 27;
|
|
575
680
|
break;
|
|
576
681
|
}
|
|
577
|
-
return
|
|
682
|
+
return _context14.abrupt("return", false);
|
|
578
683
|
case 27:
|
|
579
|
-
return
|
|
684
|
+
return _context14.abrupt("return", {
|
|
580
685
|
id: id,
|
|
581
686
|
height: imageMetadata.original.height || DEFAULT_IMAGE_HEIGHT,
|
|
582
687
|
width: imageMetadata.original.width || DEFAULT_IMAGE_WIDTH
|
|
583
688
|
});
|
|
584
689
|
case 28:
|
|
585
690
|
case "end":
|
|
586
|
-
return
|
|
691
|
+
return _context14.stop();
|
|
587
692
|
}
|
|
588
693
|
}
|
|
589
|
-
},
|
|
694
|
+
}, _callee14, this);
|
|
590
695
|
}));
|
|
591
696
|
function getRemoteDimensions() {
|
|
592
697
|
return _getRemoteDimensions.apply(this, arguments);
|
|
@@ -596,40 +701,40 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
596
701
|
}, {
|
|
597
702
|
key: "handleExternalMedia",
|
|
598
703
|
value: function () {
|
|
599
|
-
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
600
|
-
return _regeneratorRuntime.wrap(function
|
|
704
|
+
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(getPos) {
|
|
705
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
601
706
|
while (1) {
|
|
602
|
-
switch (
|
|
707
|
+
switch (_context15.prev = _context15.next) {
|
|
603
708
|
case 0:
|
|
604
709
|
if (!this.isMediaBlobUrl()) {
|
|
605
|
-
|
|
710
|
+
_context15.next = 12;
|
|
606
711
|
break;
|
|
607
712
|
}
|
|
608
|
-
|
|
609
|
-
|
|
713
|
+
_context15.prev = 1;
|
|
714
|
+
_context15.next = 4;
|
|
610
715
|
return this.copyNodeFromBlobUrl(getPos);
|
|
611
716
|
case 4:
|
|
612
|
-
|
|
717
|
+
_context15.next = 10;
|
|
613
718
|
break;
|
|
614
719
|
case 6:
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
720
|
+
_context15.prev = 6;
|
|
721
|
+
_context15.t0 = _context15["catch"](1);
|
|
722
|
+
_context15.next = 10;
|
|
618
723
|
return this.uploadExternalMedia(getPos);
|
|
619
724
|
case 10:
|
|
620
|
-
|
|
725
|
+
_context15.next = 14;
|
|
621
726
|
break;
|
|
622
727
|
case 12:
|
|
623
|
-
|
|
728
|
+
_context15.next = 14;
|
|
624
729
|
return this.uploadExternalMedia(getPos);
|
|
625
730
|
case 14:
|
|
626
731
|
case "end":
|
|
627
|
-
return
|
|
732
|
+
return _context15.stop();
|
|
628
733
|
}
|
|
629
734
|
}
|
|
630
|
-
},
|
|
735
|
+
}, _callee15, this, [[1, 6]]);
|
|
631
736
|
}));
|
|
632
|
-
function handleExternalMedia(
|
|
737
|
+
function handleExternalMedia(_x11) {
|
|
633
738
|
return _handleExternalMedia.apply(this, arguments);
|
|
634
739
|
}
|
|
635
740
|
return handleExternalMedia;
|