@atlaskit/editor-core 180.0.0 → 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 +74 -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 +23 -22
- 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
|
@@ -37,9 +37,9 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
37
37
|
return _this.getObjectId();
|
|
38
38
|
case 6:
|
|
39
39
|
objectId = _context.sent;
|
|
40
|
-
(0, _helpers.
|
|
40
|
+
(0, _helpers.updateAllMediaSingleNodesAttrs)(id, {
|
|
41
41
|
__contextId: objectId
|
|
42
|
-
}
|
|
42
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
43
43
|
case 8:
|
|
44
44
|
case "end":
|
|
45
45
|
return _context.stop();
|
|
@@ -47,60 +47,95 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
47
47
|
}
|
|
48
48
|
}, _callee);
|
|
49
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) {
|
|
55
|
+
switch (_context2.prev = _context2.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
attrs = _this.getAttrs();
|
|
58
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
59
|
+
_context2.next = 3;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
return _context2.abrupt("return");
|
|
63
|
+
case 3:
|
|
64
|
+
_context2.next = 5;
|
|
65
|
+
return _this.getObjectId();
|
|
66
|
+
case 5:
|
|
67
|
+
objectId = _context2.sent;
|
|
68
|
+
(0, _helpers.updateCurrentMediaNodeAttrs)({
|
|
69
|
+
__contextId: objectId
|
|
70
|
+
}, {
|
|
71
|
+
node: _this.props.node,
|
|
72
|
+
getPos: getPos
|
|
73
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
74
|
+
case 7:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context2.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
return function (_x) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}());
|
|
50
85
|
(0, _defineProperty2.default)(this, "hasFileAttributesDefined", function (attrs) {
|
|
51
86
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
52
87
|
});
|
|
53
|
-
(0, _defineProperty2.default)(this, "getNewFileAttrsForNode", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
88
|
+
(0, _defineProperty2.default)(this, "getNewFileAttrsForNode", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
54
89
|
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
|
|
55
|
-
return _regenerator.default.wrap(function
|
|
90
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
56
91
|
while (1) {
|
|
57
|
-
switch (
|
|
92
|
+
switch (_context3.prev = _context3.next) {
|
|
58
93
|
case 0:
|
|
59
94
|
attrs = _this.getAttrs();
|
|
60
|
-
|
|
95
|
+
_context3.next = 3;
|
|
61
96
|
return _this.props.mediaProvider;
|
|
62
97
|
case 3:
|
|
63
|
-
mediaProvider =
|
|
98
|
+
mediaProvider = _context3.sent;
|
|
64
99
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined(attrs))) {
|
|
65
|
-
|
|
100
|
+
_context3.next = 6;
|
|
66
101
|
break;
|
|
67
102
|
}
|
|
68
|
-
return
|
|
103
|
+
return _context3.abrupt("return");
|
|
69
104
|
case 6:
|
|
70
105
|
mediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
71
106
|
mediaClient = (0, _mediaClient.getMediaClient)(mediaClientConfig);
|
|
72
107
|
id = attrs.id, collectionName = attrs.collection;
|
|
73
|
-
|
|
74
|
-
|
|
108
|
+
_context3.prev = 9;
|
|
109
|
+
_context3.next = 12;
|
|
75
110
|
return mediaClient.file.getCurrentState(id, {
|
|
76
111
|
collectionName: collectionName
|
|
77
112
|
});
|
|
78
113
|
case 12:
|
|
79
|
-
fileState =
|
|
114
|
+
fileState = _context3.sent;
|
|
80
115
|
if (!(fileState.status === 'error')) {
|
|
81
|
-
|
|
116
|
+
_context3.next = 15;
|
|
82
117
|
break;
|
|
83
118
|
}
|
|
84
|
-
return
|
|
119
|
+
return _context3.abrupt("return");
|
|
85
120
|
case 15:
|
|
86
|
-
|
|
121
|
+
_context3.next = 20;
|
|
87
122
|
break;
|
|
88
123
|
case 17:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return
|
|
124
|
+
_context3.prev = 17;
|
|
125
|
+
_context3.t0 = _context3["catch"](9);
|
|
126
|
+
return _context3.abrupt("return");
|
|
92
127
|
case 20:
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
128
|
+
_context3.t1 = _this.getNodeContextId();
|
|
129
|
+
if (_context3.t1) {
|
|
130
|
+
_context3.next = 25;
|
|
96
131
|
break;
|
|
97
132
|
}
|
|
98
|
-
|
|
133
|
+
_context3.next = 24;
|
|
99
134
|
return _this.getObjectId();
|
|
100
135
|
case 24:
|
|
101
|
-
|
|
136
|
+
_context3.t1 = _context3.sent;
|
|
102
137
|
case 25:
|
|
103
|
-
contextId =
|
|
138
|
+
contextId = _context3.t1;
|
|
104
139
|
_fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
|
|
105
140
|
newAttrs = {
|
|
106
141
|
__fileName: name,
|
|
@@ -109,56 +144,51 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
109
144
|
__contextId: contextId
|
|
110
145
|
};
|
|
111
146
|
if (hasPrivateAttrsChanged(attrs, newAttrs)) {
|
|
112
|
-
|
|
147
|
+
_context3.next = 30;
|
|
113
148
|
break;
|
|
114
149
|
}
|
|
115
|
-
return
|
|
150
|
+
return _context3.abrupt("return");
|
|
116
151
|
case 30:
|
|
117
|
-
return
|
|
152
|
+
return _context3.abrupt("return", newAttrs);
|
|
118
153
|
case 31:
|
|
119
154
|
case "end":
|
|
120
|
-
return
|
|
155
|
+
return _context3.stop();
|
|
121
156
|
}
|
|
122
157
|
}
|
|
123
|
-
},
|
|
158
|
+
}, _callee3, null, [[9, 17]]);
|
|
124
159
|
})));
|
|
125
|
-
(0, _defineProperty2.default)(this, "
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
_ref4,
|
|
129
|
-
id,
|
|
130
|
-
_args3 = arguments;
|
|
131
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
160
|
+
(0, _defineProperty2.default)(this, "updateMediaSingleFileAttrs", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
161
|
+
var newAttrs, _ref5, id;
|
|
162
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
132
163
|
while (1) {
|
|
133
|
-
switch (
|
|
164
|
+
switch (_context4.prev = _context4.next) {
|
|
134
165
|
case 0:
|
|
135
|
-
|
|
136
|
-
_context3.next = 3;
|
|
166
|
+
_context4.next = 2;
|
|
137
167
|
return _this.getNewFileAttrsForNode();
|
|
138
|
-
case
|
|
139
|
-
newAttrs =
|
|
140
|
-
|
|
168
|
+
case 2:
|
|
169
|
+
newAttrs = _context4.sent;
|
|
170
|
+
_ref5 = _this.getAttrs(), id = _ref5.id;
|
|
141
171
|
if (id && newAttrs) {
|
|
142
|
-
(0, _helpers.
|
|
172
|
+
(0, _helpers.updateAllMediaSingleNodesAttrs)(id, newAttrs)(_this.props.view.state, _this.props.view.dispatch);
|
|
143
173
|
}
|
|
144
|
-
case
|
|
174
|
+
case 5:
|
|
145
175
|
case "end":
|
|
146
|
-
return
|
|
176
|
+
return _context4.stop();
|
|
147
177
|
}
|
|
148
178
|
}
|
|
149
|
-
},
|
|
179
|
+
}, _callee4);
|
|
150
180
|
})));
|
|
151
181
|
(0, _defineProperty2.default)(this, "updateNodeAttrs", /*#__PURE__*/function () {
|
|
152
|
-
var
|
|
182
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(getPos) {
|
|
153
183
|
var newAttrs;
|
|
154
|
-
return _regenerator.default.wrap(function
|
|
184
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
155
185
|
while (1) {
|
|
156
|
-
switch (
|
|
186
|
+
switch (_context5.prev = _context5.next) {
|
|
157
187
|
case 0:
|
|
158
|
-
|
|
188
|
+
_context5.next = 2;
|
|
159
189
|
return _this.getNewFileAttrsForNode();
|
|
160
190
|
case 2:
|
|
161
|
-
newAttrs =
|
|
191
|
+
newAttrs = _context5.sent;
|
|
162
192
|
if (newAttrs) {
|
|
163
193
|
(0, _helpers.updateCurrentMediaNodeAttrs)(newAttrs, {
|
|
164
194
|
node: _this.props.node,
|
|
@@ -167,13 +197,13 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
167
197
|
}
|
|
168
198
|
case 4:
|
|
169
199
|
case "end":
|
|
170
|
-
return
|
|
200
|
+
return _context5.stop();
|
|
171
201
|
}
|
|
172
202
|
}
|
|
173
|
-
},
|
|
203
|
+
}, _callee5);
|
|
174
204
|
}));
|
|
175
|
-
return function (
|
|
176
|
-
return
|
|
205
|
+
return function (_x2) {
|
|
206
|
+
return _ref6.apply(this, arguments);
|
|
177
207
|
};
|
|
178
208
|
}());
|
|
179
209
|
(0, _defineProperty2.default)(this, "getAttrs", function () {
|
|
@@ -183,54 +213,54 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
183
213
|
}
|
|
184
214
|
return undefined;
|
|
185
215
|
});
|
|
186
|
-
(0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
216
|
+
(0, _defineProperty2.default)(this, "getObjectId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
187
217
|
var contextIdentifierProvider;
|
|
188
|
-
return _regenerator.default.wrap(function
|
|
218
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
189
219
|
while (1) {
|
|
190
|
-
switch (
|
|
220
|
+
switch (_context6.prev = _context6.next) {
|
|
191
221
|
case 0:
|
|
192
|
-
|
|
222
|
+
_context6.next = 2;
|
|
193
223
|
return _this.props.contextIdentifierProvider;
|
|
194
224
|
case 2:
|
|
195
|
-
contextIdentifierProvider =
|
|
196
|
-
return
|
|
225
|
+
contextIdentifierProvider = _context6.sent;
|
|
226
|
+
return _context6.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
197
227
|
case 4:
|
|
198
228
|
case "end":
|
|
199
|
-
return
|
|
229
|
+
return _context6.stop();
|
|
200
230
|
}
|
|
201
231
|
}
|
|
202
|
-
},
|
|
232
|
+
}, _callee6);
|
|
203
233
|
})));
|
|
204
234
|
(0, _defineProperty2.default)(this, "uploadExternalMedia", /*#__PURE__*/function () {
|
|
205
|
-
var
|
|
235
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(getPos) {
|
|
206
236
|
var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions;
|
|
207
|
-
return _regenerator.default.wrap(function
|
|
237
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
208
238
|
while (1) {
|
|
209
|
-
switch (
|
|
239
|
+
switch (_context7.prev = _context7.next) {
|
|
210
240
|
case 0:
|
|
211
241
|
node = _this.props.node;
|
|
212
|
-
|
|
242
|
+
_context7.next = 3;
|
|
213
243
|
return _this.props.mediaProvider;
|
|
214
244
|
case 3:
|
|
215
|
-
mediaProvider =
|
|
245
|
+
mediaProvider = _context7.sent;
|
|
216
246
|
if (!(node && mediaProvider)) {
|
|
217
|
-
|
|
247
|
+
_context7.next = 21;
|
|
218
248
|
break;
|
|
219
249
|
}
|
|
220
250
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
221
251
|
if (!(!uploadMediaClientConfig || !node.attrs.url)) {
|
|
222
|
-
|
|
252
|
+
_context7.next = 8;
|
|
223
253
|
break;
|
|
224
254
|
}
|
|
225
|
-
return
|
|
255
|
+
return _context7.abrupt("return");
|
|
226
256
|
case 8:
|
|
227
257
|
mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
|
|
228
258
|
collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
_context7.prev = 10;
|
|
260
|
+
_context7.next = 13;
|
|
231
261
|
return mediaClient.file.uploadExternal(node.attrs.url, collection);
|
|
232
262
|
case 13:
|
|
233
|
-
uploader =
|
|
263
|
+
uploader = _context7.sent;
|
|
234
264
|
uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
|
|
235
265
|
(0, _helpers.replaceExternalMedia)(getPos() + 1, {
|
|
236
266
|
id: uploadableFileUpfrontIds.id,
|
|
@@ -239,11 +269,11 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
239
269
|
width: dimensions.width,
|
|
240
270
|
occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
|
|
241
271
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
242
|
-
|
|
272
|
+
_context7.next = 21;
|
|
243
273
|
break;
|
|
244
274
|
case 18:
|
|
245
|
-
|
|
246
|
-
|
|
275
|
+
_context7.prev = 18;
|
|
276
|
+
_context7.t0 = _context7["catch"](10);
|
|
247
277
|
//keep it as external media
|
|
248
278
|
if (_this.props.dispatchAnalyticsEvent) {
|
|
249
279
|
_this.props.dispatchAnalyticsEvent({
|
|
@@ -254,13 +284,13 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
254
284
|
}
|
|
255
285
|
case 21:
|
|
256
286
|
case "end":
|
|
257
|
-
return
|
|
287
|
+
return _context7.stop();
|
|
258
288
|
}
|
|
259
289
|
}
|
|
260
|
-
},
|
|
290
|
+
}, _callee7, null, [[10, 18]]);
|
|
261
291
|
}));
|
|
262
|
-
return function (
|
|
263
|
-
return
|
|
292
|
+
return function (_x3) {
|
|
293
|
+
return _ref8.apply(this, arguments);
|
|
264
294
|
};
|
|
265
295
|
}());
|
|
266
296
|
(0, _defineProperty2.default)(this, "getNodeContextId", function () {
|
|
@@ -271,132 +301,132 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
271
301
|
return attrs.__contextId || null;
|
|
272
302
|
});
|
|
273
303
|
(0, _defineProperty2.default)(this, "updateDimensions", function (dimensions) {
|
|
274
|
-
(0, _helpers.
|
|
304
|
+
(0, _helpers.updateAllMediaSingleNodesAttrs)(dimensions.id, {
|
|
275
305
|
height: dimensions.height,
|
|
276
306
|
width: dimensions.width
|
|
277
|
-
}
|
|
307
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
278
308
|
});
|
|
279
|
-
(0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
309
|
+
(0, _defineProperty2.default)(this, "hasDifferentContextId", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
280
310
|
var nodeContextId, currentContextId;
|
|
281
|
-
return _regenerator.default.wrap(function
|
|
311
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
282
312
|
while (1) {
|
|
283
|
-
switch (
|
|
313
|
+
switch (_context8.prev = _context8.next) {
|
|
284
314
|
case 0:
|
|
285
315
|
nodeContextId = _this.getNodeContextId();
|
|
286
|
-
|
|
316
|
+
_context8.next = 3;
|
|
287
317
|
return _this.getObjectId();
|
|
288
318
|
case 3:
|
|
289
|
-
currentContextId =
|
|
319
|
+
currentContextId = _context8.sent;
|
|
290
320
|
if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
|
|
291
|
-
|
|
321
|
+
_context8.next = 6;
|
|
292
322
|
break;
|
|
293
323
|
}
|
|
294
|
-
return
|
|
324
|
+
return _context8.abrupt("return", true);
|
|
295
325
|
case 6:
|
|
296
|
-
return
|
|
326
|
+
return _context8.abrupt("return", false);
|
|
297
327
|
case 7:
|
|
298
328
|
case "end":
|
|
299
|
-
return
|
|
329
|
+
return _context8.stop();
|
|
300
330
|
}
|
|
301
331
|
}
|
|
302
|
-
},
|
|
332
|
+
}, _callee8);
|
|
303
333
|
})));
|
|
304
|
-
(0, _defineProperty2.default)(this, "isNodeFromDifferentCollection", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
334
|
+
(0, _defineProperty2.default)(this, "isNodeFromDifferentCollection", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
305
335
|
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
306
|
-
return _regenerator.default.wrap(function
|
|
336
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
307
337
|
while (1) {
|
|
308
|
-
switch (
|
|
338
|
+
switch (_context9.prev = _context9.next) {
|
|
309
339
|
case 0:
|
|
310
|
-
|
|
340
|
+
_context9.next = 2;
|
|
311
341
|
return _this.props.mediaProvider;
|
|
312
342
|
case 2:
|
|
313
|
-
mediaProvider =
|
|
343
|
+
mediaProvider = _context9.sent;
|
|
314
344
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
315
|
-
|
|
345
|
+
_context9.next = 5;
|
|
316
346
|
break;
|
|
317
347
|
}
|
|
318
|
-
return
|
|
348
|
+
return _context9.abrupt("return", false);
|
|
319
349
|
case 5:
|
|
320
350
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
321
351
|
attrs = _this.getAttrs();
|
|
322
352
|
if (!(!attrs || attrs.type !== 'file')) {
|
|
323
|
-
|
|
353
|
+
_context9.next = 9;
|
|
324
354
|
break;
|
|
325
355
|
}
|
|
326
|
-
return
|
|
356
|
+
return _context9.abrupt("return", false);
|
|
327
357
|
case 9:
|
|
328
358
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
329
|
-
|
|
330
|
-
if (
|
|
331
|
-
|
|
359
|
+
_context9.t0 = __contextId;
|
|
360
|
+
if (_context9.t0) {
|
|
361
|
+
_context9.next = 15;
|
|
332
362
|
break;
|
|
333
363
|
}
|
|
334
|
-
|
|
364
|
+
_context9.next = 14;
|
|
335
365
|
return _this.getObjectId();
|
|
336
366
|
case 14:
|
|
337
|
-
|
|
367
|
+
_context9.t0 = _context9.sent;
|
|
338
368
|
case 15:
|
|
339
|
-
contextId =
|
|
369
|
+
contextId = _context9.t0;
|
|
340
370
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
341
|
-
|
|
371
|
+
_context9.next = 18;
|
|
342
372
|
break;
|
|
343
373
|
}
|
|
344
|
-
return
|
|
374
|
+
return _context9.abrupt("return", true);
|
|
345
375
|
case 18:
|
|
346
|
-
return
|
|
376
|
+
return _context9.abrupt("return", false);
|
|
347
377
|
case 19:
|
|
348
378
|
case "end":
|
|
349
|
-
return
|
|
379
|
+
return _context9.stop();
|
|
350
380
|
}
|
|
351
381
|
}
|
|
352
|
-
},
|
|
382
|
+
}, _callee9);
|
|
353
383
|
})));
|
|
354
384
|
(0, _defineProperty2.default)(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
355
|
-
var
|
|
385
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(getPos) {
|
|
356
386
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, auth, source, destination, mediaFile;
|
|
357
|
-
return _regenerator.default.wrap(function
|
|
387
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
358
388
|
while (1) {
|
|
359
|
-
switch (
|
|
389
|
+
switch (_context10.prev = _context10.next) {
|
|
360
390
|
case 0:
|
|
361
391
|
attrs = _this.getAttrs();
|
|
362
392
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
363
|
-
|
|
393
|
+
_context10.next = 3;
|
|
364
394
|
break;
|
|
365
395
|
}
|
|
366
|
-
return
|
|
396
|
+
return _context10.abrupt("return");
|
|
367
397
|
case 3:
|
|
368
398
|
url = attrs.url;
|
|
369
399
|
mediaAttrs = (0, _mediaClient.getAttrsFromUrl)(url);
|
|
370
400
|
if (mediaAttrs) {
|
|
371
|
-
|
|
401
|
+
_context10.next = 7;
|
|
372
402
|
break;
|
|
373
403
|
}
|
|
374
|
-
return
|
|
404
|
+
return _context10.abrupt("return");
|
|
375
405
|
case 7:
|
|
376
|
-
|
|
406
|
+
_context10.next = 9;
|
|
377
407
|
return _this.props.mediaProvider;
|
|
378
408
|
case 9:
|
|
379
|
-
mediaProvider =
|
|
409
|
+
mediaProvider = _context10.sent;
|
|
380
410
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
381
|
-
|
|
411
|
+
_context10.next = 12;
|
|
382
412
|
break;
|
|
383
413
|
}
|
|
384
|
-
return
|
|
414
|
+
return _context10.abrupt("return");
|
|
385
415
|
case 12:
|
|
386
416
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
387
417
|
contextId = mediaAttrs.contextId, id = mediaAttrs.id, collection = mediaAttrs.collection, height = mediaAttrs.height, width = mediaAttrs.width, mimeType = mediaAttrs.mimeType, name = mediaAttrs.name, size = mediaAttrs.size;
|
|
388
418
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
389
419
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
390
|
-
|
|
420
|
+
_context10.next = 17;
|
|
391
421
|
break;
|
|
392
422
|
}
|
|
393
|
-
return
|
|
423
|
+
return _context10.abrupt("return");
|
|
394
424
|
case 17:
|
|
395
425
|
mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
|
|
396
|
-
|
|
426
|
+
_context10.next = 20;
|
|
397
427
|
return uploadMediaClientConfig.getAuthFromContext(contextId);
|
|
398
428
|
case 20:
|
|
399
|
-
auth =
|
|
429
|
+
auth = _context10.sent;
|
|
400
430
|
source = {
|
|
401
431
|
id: id,
|
|
402
432
|
collection: collection,
|
|
@@ -409,10 +439,10 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
409
439
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
410
440
|
occurrenceKey: (0, _v.default)()
|
|
411
441
|
};
|
|
412
|
-
|
|
442
|
+
_context10.next = 25;
|
|
413
443
|
return mediaClient.file.copyFile(source, destination);
|
|
414
444
|
case 25:
|
|
415
|
-
mediaFile =
|
|
445
|
+
mediaFile = _context10.sent;
|
|
416
446
|
(0, _helpers.replaceExternalMedia)(getPos() + 1, {
|
|
417
447
|
id: mediaFile.id,
|
|
418
448
|
collection: currentCollectionName,
|
|
@@ -424,50 +454,125 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
424
454
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
425
455
|
case 27:
|
|
426
456
|
case "end":
|
|
427
|
-
return
|
|
457
|
+
return _context10.stop();
|
|
428
458
|
}
|
|
429
459
|
}
|
|
430
|
-
},
|
|
460
|
+
}, _callee10);
|
|
431
461
|
}));
|
|
432
|
-
return function (
|
|
433
|
-
return
|
|
462
|
+
return function (_x4) {
|
|
463
|
+
return _ref11.apply(this, arguments);
|
|
464
|
+
};
|
|
465
|
+
}());
|
|
466
|
+
(0, _defineProperty2.default)(this, "copyNodeFromPos", /*#__PURE__*/function () {
|
|
467
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(getPos, traceContext) {
|
|
468
|
+
var attrs, copiedAttrs;
|
|
469
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
470
|
+
while (1) {
|
|
471
|
+
switch (_context11.prev = _context11.next) {
|
|
472
|
+
case 0:
|
|
473
|
+
attrs = _this.getAttrs();
|
|
474
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
475
|
+
_context11.next = 3;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
return _context11.abrupt("return");
|
|
479
|
+
case 3:
|
|
480
|
+
_context11.next = 5;
|
|
481
|
+
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
482
|
+
case 5:
|
|
483
|
+
copiedAttrs = _context11.sent;
|
|
484
|
+
if (copiedAttrs) {
|
|
485
|
+
_context11.next = 8;
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
return _context11.abrupt("return");
|
|
489
|
+
case 8:
|
|
490
|
+
(0, _helpers.updateCurrentMediaNodeAttrs)(copiedAttrs, {
|
|
491
|
+
node: _this.props.node,
|
|
492
|
+
getPos: getPos
|
|
493
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
494
|
+
case 9:
|
|
495
|
+
case "end":
|
|
496
|
+
return _context11.stop();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}, _callee11);
|
|
500
|
+
}));
|
|
501
|
+
return function (_x5, _x6) {
|
|
502
|
+
return _ref12.apply(this, arguments);
|
|
434
503
|
};
|
|
435
504
|
}());
|
|
436
505
|
(0, _defineProperty2.default)(this, "copyNode", /*#__PURE__*/function () {
|
|
437
|
-
var
|
|
438
|
-
var
|
|
439
|
-
return _regenerator.default.wrap(function
|
|
506
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(traceContext) {
|
|
507
|
+
var attrs, view, copiedAttrs;
|
|
508
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
440
509
|
while (1) {
|
|
441
|
-
switch (
|
|
510
|
+
switch (_context12.prev = _context12.next) {
|
|
511
|
+
case 0:
|
|
512
|
+
attrs = _this.getAttrs();
|
|
513
|
+
view = _this.props.view;
|
|
514
|
+
if (!((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file')) {
|
|
515
|
+
_context12.next = 4;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
return _context12.abrupt("return");
|
|
519
|
+
case 4:
|
|
520
|
+
_context12.next = 6;
|
|
521
|
+
return _this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
522
|
+
case 6:
|
|
523
|
+
copiedAttrs = _context12.sent;
|
|
524
|
+
if (copiedAttrs) {
|
|
525
|
+
_context12.next = 9;
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
return _context12.abrupt("return");
|
|
529
|
+
case 9:
|
|
530
|
+
(0, _helpers.updateMediaSingleNodeAttrs)(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
531
|
+
case 10:
|
|
532
|
+
case "end":
|
|
533
|
+
return _context12.stop();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}, _callee12);
|
|
537
|
+
}));
|
|
538
|
+
return function (_x7) {
|
|
539
|
+
return _ref13.apply(this, arguments);
|
|
540
|
+
};
|
|
541
|
+
}());
|
|
542
|
+
(0, _defineProperty2.default)(this, "copyFile", /*#__PURE__*/function () {
|
|
543
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, collection, traceContext) {
|
|
544
|
+
var mediaProvider, nodeContextId, uploadMediaClientConfig, mediaClient, auth, objectId, source, currentCollectionName, destination, mediaFile;
|
|
545
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
546
|
+
while (1) {
|
|
547
|
+
switch (_context13.prev = _context13.next) {
|
|
442
548
|
case 0:
|
|
443
|
-
|
|
549
|
+
_context13.next = 2;
|
|
444
550
|
return _this.props.mediaProvider;
|
|
445
551
|
case 2:
|
|
446
|
-
mediaProvider =
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file')) {
|
|
450
|
-
_context10.next = 7;
|
|
552
|
+
mediaProvider = _context13.sent;
|
|
553
|
+
if (!(!id || !collection || !(mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams))) {
|
|
554
|
+
_context13.next = 5;
|
|
451
555
|
break;
|
|
452
556
|
}
|
|
453
|
-
return
|
|
454
|
-
case
|
|
557
|
+
return _context13.abrupt("return");
|
|
558
|
+
case 5:
|
|
455
559
|
nodeContextId = _this.getNodeContextId();
|
|
456
560
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
457
|
-
if (!(uploadMediaClientConfig && uploadMediaClientConfig.getAuthFromContext
|
|
458
|
-
|
|
561
|
+
if (!(!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId)) {
|
|
562
|
+
_context13.next = 9;
|
|
459
563
|
break;
|
|
460
564
|
}
|
|
565
|
+
return _context13.abrupt("return");
|
|
566
|
+
case 9:
|
|
461
567
|
mediaClient = (0, _mediaClient.getMediaClient)(uploadMediaClientConfig);
|
|
462
|
-
|
|
568
|
+
_context13.next = 12;
|
|
463
569
|
return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
464
|
-
case
|
|
465
|
-
auth =
|
|
466
|
-
|
|
570
|
+
case 12:
|
|
571
|
+
auth = _context13.sent;
|
|
572
|
+
_context13.next = 15;
|
|
467
573
|
return _this.getObjectId();
|
|
468
|
-
case
|
|
469
|
-
objectId =
|
|
470
|
-
id = attrs.id, collection = attrs.collection;
|
|
574
|
+
case 15:
|
|
575
|
+
objectId = _context13.sent;
|
|
471
576
|
source = {
|
|
472
577
|
id: id,
|
|
473
578
|
collection: collection,
|
|
@@ -481,24 +586,24 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
481
586
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
482
587
|
occurrenceKey: (0, _v.default)()
|
|
483
588
|
};
|
|
484
|
-
|
|
589
|
+
_context13.next = 21;
|
|
485
590
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
486
|
-
case
|
|
487
|
-
mediaFile =
|
|
488
|
-
|
|
591
|
+
case 21:
|
|
592
|
+
mediaFile = _context13.sent;
|
|
593
|
+
return _context13.abrupt("return", {
|
|
489
594
|
id: mediaFile.id,
|
|
490
595
|
collection: currentCollectionName,
|
|
491
596
|
__contextId: objectId
|
|
492
|
-
}
|
|
493
|
-
case
|
|
597
|
+
});
|
|
598
|
+
case 23:
|
|
494
599
|
case "end":
|
|
495
|
-
return
|
|
600
|
+
return _context13.stop();
|
|
496
601
|
}
|
|
497
602
|
}
|
|
498
|
-
},
|
|
603
|
+
}, _callee13);
|
|
499
604
|
}));
|
|
500
|
-
return function (
|
|
501
|
-
return
|
|
605
|
+
return function (_x8, _x9, _x10) {
|
|
606
|
+
return _ref14.apply(this, arguments);
|
|
502
607
|
};
|
|
503
608
|
}());
|
|
504
609
|
this.props = props;
|
|
@@ -511,47 +616,47 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
511
616
|
}
|
|
512
617
|
|
|
513
618
|
// Updates the node with contextId if it doesn't have one already
|
|
514
|
-
// TODO [MS-2258]: remove updateContextId in order to only use
|
|
619
|
+
// TODO [MS-2258]: remove updateContextId in order to only use updateMediaSingleFileAttrs
|
|
515
620
|
}, {
|
|
516
621
|
key: "getRemoteDimensions",
|
|
517
622
|
value: function () {
|
|
518
|
-
var _getRemoteDimensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
623
|
+
var _getRemoteDimensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
519
624
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
520
|
-
return _regenerator.default.wrap(function
|
|
625
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
521
626
|
while (1) {
|
|
522
|
-
switch (
|
|
627
|
+
switch (_context14.prev = _context14.next) {
|
|
523
628
|
case 0:
|
|
524
|
-
|
|
629
|
+
_context14.next = 2;
|
|
525
630
|
return this.props.mediaProvider;
|
|
526
631
|
case 2:
|
|
527
|
-
mediaProvider =
|
|
632
|
+
mediaProvider = _context14.sent;
|
|
528
633
|
mediaOptions = this.props.mediaOptions;
|
|
529
634
|
attrs = this.getAttrs();
|
|
530
635
|
if (!(!mediaProvider || !attrs)) {
|
|
531
|
-
|
|
636
|
+
_context14.next = 7;
|
|
532
637
|
break;
|
|
533
638
|
}
|
|
534
|
-
return
|
|
639
|
+
return _context14.abrupt("return", false);
|
|
535
640
|
case 7:
|
|
536
641
|
height = attrs.height, width = attrs.width;
|
|
537
642
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
538
|
-
|
|
643
|
+
_context14.next = 10;
|
|
539
644
|
break;
|
|
540
645
|
}
|
|
541
|
-
return
|
|
646
|
+
return _context14.abrupt("return", false);
|
|
542
647
|
case 10:
|
|
543
648
|
id = attrs.id, collection = attrs.collection;
|
|
544
649
|
if (!(height && width)) {
|
|
545
|
-
|
|
650
|
+
_context14.next = 13;
|
|
546
651
|
break;
|
|
547
652
|
}
|
|
548
|
-
return
|
|
653
|
+
return _context14.abrupt("return", false);
|
|
549
654
|
case 13:
|
|
550
655
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
551
|
-
|
|
656
|
+
_context14.next = 15;
|
|
552
657
|
break;
|
|
553
658
|
}
|
|
554
|
-
return
|
|
659
|
+
return _context14.abrupt("return", {
|
|
555
660
|
id: id,
|
|
556
661
|
height: _ui.DEFAULT_IMAGE_HEIGHT,
|
|
557
662
|
width: _ui.DEFAULT_IMAGE_WIDTH
|
|
@@ -559,41 +664,41 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
559
664
|
case 15:
|
|
560
665
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
561
666
|
mediaClient = (0, _mediaClient.getMediaClient)(viewMediaClientConfig);
|
|
562
|
-
|
|
667
|
+
_context14.next = 19;
|
|
563
668
|
return mediaClient.file.getCurrentState(id, {
|
|
564
669
|
collectionName: collection
|
|
565
670
|
});
|
|
566
671
|
case 19:
|
|
567
|
-
currentState =
|
|
672
|
+
currentState = _context14.sent;
|
|
568
673
|
if ((0, _mediaClient.isImageRepresentationReady)(currentState)) {
|
|
569
|
-
|
|
674
|
+
_context14.next = 22;
|
|
570
675
|
break;
|
|
571
676
|
}
|
|
572
|
-
return
|
|
677
|
+
return _context14.abrupt("return", false);
|
|
573
678
|
case 22:
|
|
574
|
-
|
|
679
|
+
_context14.next = 24;
|
|
575
680
|
return mediaClient.getImageMetadata(id, {
|
|
576
681
|
collection: collection
|
|
577
682
|
});
|
|
578
683
|
case 24:
|
|
579
|
-
imageMetadata =
|
|
684
|
+
imageMetadata = _context14.sent;
|
|
580
685
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
581
|
-
|
|
686
|
+
_context14.next = 27;
|
|
582
687
|
break;
|
|
583
688
|
}
|
|
584
|
-
return
|
|
689
|
+
return _context14.abrupt("return", false);
|
|
585
690
|
case 27:
|
|
586
|
-
return
|
|
691
|
+
return _context14.abrupt("return", {
|
|
587
692
|
id: id,
|
|
588
693
|
height: imageMetadata.original.height || _ui.DEFAULT_IMAGE_HEIGHT,
|
|
589
694
|
width: imageMetadata.original.width || _ui.DEFAULT_IMAGE_WIDTH
|
|
590
695
|
});
|
|
591
696
|
case 28:
|
|
592
697
|
case "end":
|
|
593
|
-
return
|
|
698
|
+
return _context14.stop();
|
|
594
699
|
}
|
|
595
700
|
}
|
|
596
|
-
},
|
|
701
|
+
}, _callee14, this);
|
|
597
702
|
}));
|
|
598
703
|
function getRemoteDimensions() {
|
|
599
704
|
return _getRemoteDimensions.apply(this, arguments);
|
|
@@ -603,40 +708,40 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
603
708
|
}, {
|
|
604
709
|
key: "handleExternalMedia",
|
|
605
710
|
value: function () {
|
|
606
|
-
var _handleExternalMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
607
|
-
return _regenerator.default.wrap(function
|
|
711
|
+
var _handleExternalMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(getPos) {
|
|
712
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
608
713
|
while (1) {
|
|
609
|
-
switch (
|
|
714
|
+
switch (_context15.prev = _context15.next) {
|
|
610
715
|
case 0:
|
|
611
716
|
if (!this.isMediaBlobUrl()) {
|
|
612
|
-
|
|
717
|
+
_context15.next = 12;
|
|
613
718
|
break;
|
|
614
719
|
}
|
|
615
|
-
|
|
616
|
-
|
|
720
|
+
_context15.prev = 1;
|
|
721
|
+
_context15.next = 4;
|
|
617
722
|
return this.copyNodeFromBlobUrl(getPos);
|
|
618
723
|
case 4:
|
|
619
|
-
|
|
724
|
+
_context15.next = 10;
|
|
620
725
|
break;
|
|
621
726
|
case 6:
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
727
|
+
_context15.prev = 6;
|
|
728
|
+
_context15.t0 = _context15["catch"](1);
|
|
729
|
+
_context15.next = 10;
|
|
625
730
|
return this.uploadExternalMedia(getPos);
|
|
626
731
|
case 10:
|
|
627
|
-
|
|
732
|
+
_context15.next = 14;
|
|
628
733
|
break;
|
|
629
734
|
case 12:
|
|
630
|
-
|
|
735
|
+
_context15.next = 14;
|
|
631
736
|
return this.uploadExternalMedia(getPos);
|
|
632
737
|
case 14:
|
|
633
738
|
case "end":
|
|
634
|
-
return
|
|
739
|
+
return _context15.stop();
|
|
635
740
|
}
|
|
636
741
|
}
|
|
637
|
-
},
|
|
742
|
+
}, _callee15, this, [[1, 6]]);
|
|
638
743
|
}));
|
|
639
|
-
function handleExternalMedia(
|
|
744
|
+
function handleExternalMedia(_x11) {
|
|
640
745
|
return _handleExternalMedia.apply(this, arguments);
|
|
641
746
|
}
|
|
642
747
|
return handleExternalMedia;
|