@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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { stateKey as mediaPluginKey } from '../pm-plugins/plugin-key';
|
|
2
2
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
3
|
+
/**
|
|
4
|
+
* Note that Media Inline is inserted like a media single node into the media plugin state.
|
|
5
|
+
* Though it is not of type mediaSingle, it shares the same `findMediaSingleNode` method
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
3
8
|
export const findMediaSingleNode = (mediaPluginState, id) => {
|
|
4
9
|
const {
|
|
5
10
|
mediaNodes
|
|
@@ -19,51 +24,20 @@ export const findMediaSingleNode = (mediaPluginState, id) => {
|
|
|
19
24
|
return memo;
|
|
20
25
|
}, null);
|
|
21
26
|
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Finds the media inline node with the given id.
|
|
25
|
-
* Media Inline is inserted like a media single node into the media plugin state.
|
|
26
|
-
* However it is not of type mediaSingle.
|
|
27
|
-
*
|
|
28
|
-
* @param mediaPluginState
|
|
29
|
-
* @param id
|
|
30
|
-
* @param isMediaSingle
|
|
31
|
-
* @returns {MediaNodeWithPosHandler | null}
|
|
32
|
-
*/
|
|
33
|
-
export const findMediaInlineNode = (mediaPluginState, id, isMediaSingle) => {
|
|
34
|
-
if (!isMediaSingle) {
|
|
35
|
-
return findMediaSingleNode(mediaPluginState, id);
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
27
|
export const findAllMediaSingleNodes = (mediaPluginState, id) => {
|
|
40
28
|
const {
|
|
41
29
|
mediaNodes
|
|
42
30
|
} = mediaPluginState;
|
|
43
31
|
return mediaNodes.filter(nodeWithHandler => nodeWithHandler.node.attrs.id === id);
|
|
44
32
|
};
|
|
45
|
-
export const findMediaNode = (mediaPluginState, id, isMediaSingle) => {
|
|
46
|
-
const mediaNodeWithPos = isMediaSingle ? findMediaSingleNode(mediaPluginState, id) : mediaPluginState.mediaGroupNodes[id];
|
|
47
|
-
|
|
48
|
-
// Should attempt to find media inline node if media single node or media group node is not found
|
|
49
|
-
if (!mediaNodeWithPos) {
|
|
50
|
-
return findMediaInlineNode(mediaPluginState, id, isMediaSingle);
|
|
51
|
-
}
|
|
52
|
-
return mediaNodeWithPos;
|
|
53
|
-
};
|
|
54
33
|
export const isMediaNode = (pos, state) => {
|
|
55
34
|
const node = state.doc.nodeAt(pos);
|
|
56
35
|
return node && ['media', 'mediaInline'].includes(node.type.name);
|
|
57
36
|
};
|
|
58
|
-
export const
|
|
37
|
+
export const updateAllMediaSingleNodesAttrs = (id, attrs) => (state, dispatch) => {
|
|
59
38
|
const mediaPluginState = mediaPluginKey.getState(state);
|
|
60
39
|
let mediaNodes;
|
|
61
|
-
|
|
62
|
-
mediaNodes = findAllMediaSingleNodes(mediaPluginState, id);
|
|
63
|
-
} else {
|
|
64
|
-
const mediaGroupNode = findMediaNode(mediaPluginState, id, isMediaSingle);
|
|
65
|
-
mediaNodes = mediaGroupNode ? [mediaGroupNode] : [];
|
|
66
|
-
}
|
|
40
|
+
mediaNodes = findAllMediaSingleNodes(mediaPluginState, id);
|
|
67
41
|
const validMediaNodePositions = mediaNodes.reduce((acc, {
|
|
68
42
|
getPos
|
|
69
43
|
}) => {
|
|
@@ -98,9 +72,9 @@ export const updateCurrentMediaNodeAttrs = (attrs, mediaNode) => (state, dispatc
|
|
|
98
72
|
}
|
|
99
73
|
return true;
|
|
100
74
|
};
|
|
101
|
-
export const
|
|
75
|
+
export const updateMediaSingleNodeAttrs = (id, attrs) => (state, dispatch) => {
|
|
102
76
|
const mediaPluginState = mediaPluginKey.getState(state);
|
|
103
|
-
const mediaNodeWithPos =
|
|
77
|
+
const mediaNodeWithPos = findMediaSingleNode(mediaPluginState, id);
|
|
104
78
|
if (!mediaNodeWithPos) {
|
|
105
79
|
return false;
|
|
106
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { updateMediaSingleNodeAttrs, updateAllMediaSingleNodesAttrs, replaceExternalMedia } from './helpers';
|
|
@@ -55,7 +55,6 @@ class MediaGroup extends React.Component {
|
|
|
55
55
|
this.mediaNodes = [];
|
|
56
56
|
node.forEach((item, childOffset) => {
|
|
57
57
|
const getPos = () => props.getPos() + childOffset + 1;
|
|
58
|
-
this.mediaPluginState.setMediaGroupNode(item, getPos);
|
|
59
58
|
this.mediaNodes.push(item);
|
|
60
59
|
if (updatedAttrs) {
|
|
61
60
|
this.updateNodeAttrs(props, item, getPos);
|
|
@@ -157,13 +156,14 @@ class MediaGroup extends React.Component {
|
|
|
157
156
|
node,
|
|
158
157
|
isMediaSingle: false
|
|
159
158
|
});
|
|
159
|
+
const getPos = () => this.props.getPos() + 1;
|
|
160
160
|
const contextId = mediaNodeUpdater.getNodeContextId();
|
|
161
161
|
if (!contextId) {
|
|
162
|
-
await mediaNodeUpdater.
|
|
162
|
+
await mediaNodeUpdater.updateNodeContextId(getPos);
|
|
163
163
|
}
|
|
164
164
|
const hasDifferentContextId = await mediaNodeUpdater.hasDifferentContextId();
|
|
165
165
|
if (hasDifferentContextId) {
|
|
166
|
-
await mediaNodeUpdater.
|
|
166
|
+
await mediaNodeUpdater.copyNodeFromPos(getPos, {
|
|
167
167
|
traceId: node.attrs.__mediaTraceId
|
|
168
168
|
});
|
|
169
169
|
}
|
|
@@ -3,7 +3,7 @@ import uuidV4 from 'uuid/v4';
|
|
|
3
3
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { getMediaClient, isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
6
|
-
import { replaceExternalMedia,
|
|
6
|
+
import { replaceExternalMedia, updateAllMediaSingleNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaSingleNodeAttrs } from '../commands/helpers';
|
|
7
7
|
export class MediaNodeUpdater {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
_defineProperty(this, "updateContextId", async () => {
|
|
@@ -15,9 +15,22 @@ export class MediaNodeUpdater {
|
|
|
15
15
|
id
|
|
16
16
|
} = attrs;
|
|
17
17
|
const objectId = await this.getObjectId();
|
|
18
|
-
|
|
18
|
+
updateAllMediaSingleNodesAttrs(id, {
|
|
19
19
|
__contextId: objectId
|
|
20
|
-
}
|
|
20
|
+
})(this.props.view.state, this.props.view.dispatch);
|
|
21
|
+
});
|
|
22
|
+
_defineProperty(this, "updateNodeContextId", async getPos => {
|
|
23
|
+
const attrs = this.getAttrs();
|
|
24
|
+
if ((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const objectId = await this.getObjectId();
|
|
28
|
+
updateCurrentMediaNodeAttrs({
|
|
29
|
+
__contextId: objectId
|
|
30
|
+
}, {
|
|
31
|
+
node: this.props.node,
|
|
32
|
+
getPos
|
|
33
|
+
})(this.props.view.state, this.props.view.dispatch);
|
|
21
34
|
});
|
|
22
35
|
_defineProperty(this, "hasFileAttributesDefined", attrs => {
|
|
23
36
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
@@ -62,13 +75,13 @@ export class MediaNodeUpdater {
|
|
|
62
75
|
}
|
|
63
76
|
return newAttrs;
|
|
64
77
|
});
|
|
65
|
-
_defineProperty(this, "
|
|
78
|
+
_defineProperty(this, "updateMediaSingleFileAttrs", async () => {
|
|
66
79
|
const newAttrs = await this.getNewFileAttrsForNode();
|
|
67
80
|
const {
|
|
68
81
|
id
|
|
69
82
|
} = this.getAttrs();
|
|
70
83
|
if (id && newAttrs) {
|
|
71
|
-
|
|
84
|
+
updateAllMediaSingleNodesAttrs(id, newAttrs)(this.props.view.state, this.props.view.dispatch);
|
|
72
85
|
}
|
|
73
86
|
});
|
|
74
87
|
_defineProperty(this, "updateNodeAttrs", async getPos => {
|
|
@@ -138,10 +151,10 @@ export class MediaNodeUpdater {
|
|
|
138
151
|
return attrs.__contextId || null;
|
|
139
152
|
});
|
|
140
153
|
_defineProperty(this, "updateDimensions", dimensions => {
|
|
141
|
-
|
|
154
|
+
updateAllMediaSingleNodesAttrs(dimensions.id, {
|
|
142
155
|
height: dimensions.height,
|
|
143
156
|
width: dimensions.width
|
|
144
|
-
}
|
|
157
|
+
})(this.props.view.state, this.props.view.dispatch);
|
|
145
158
|
});
|
|
146
159
|
_defineProperty(this, "hasDifferentContextId", async () => {
|
|
147
160
|
const nodeContextId = this.getNodeContextId();
|
|
@@ -225,44 +238,64 @@ export class MediaNodeUpdater {
|
|
|
225
238
|
__fileSize: size
|
|
226
239
|
})(this.props.view.state, this.props.view.dispatch);
|
|
227
240
|
});
|
|
241
|
+
_defineProperty(this, "copyNodeFromPos", async (getPos, traceContext) => {
|
|
242
|
+
const attrs = this.getAttrs();
|
|
243
|
+
if ((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file') {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const copiedAttrs = await this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
247
|
+
if (!copiedAttrs) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
updateCurrentMediaNodeAttrs(copiedAttrs, {
|
|
251
|
+
node: this.props.node,
|
|
252
|
+
getPos
|
|
253
|
+
})(this.props.view.state, this.props.view.dispatch);
|
|
254
|
+
});
|
|
228
255
|
_defineProperty(this, "copyNode", async traceContext => {
|
|
229
|
-
const
|
|
256
|
+
const attrs = this.getAttrs();
|
|
230
257
|
const {
|
|
231
|
-
isMediaSingle,
|
|
232
258
|
view
|
|
233
259
|
} = this.props;
|
|
234
|
-
|
|
235
|
-
|
|
260
|
+
if ((attrs === null || attrs === void 0 ? void 0 : attrs.type) !== 'file') {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const copiedAttrs = await this.copyFile(attrs.id, attrs.collection, traceContext);
|
|
264
|
+
if (!copiedAttrs) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
updateMediaSingleNodeAttrs(attrs.id, copiedAttrs)(view.state, view.dispatch);
|
|
268
|
+
});
|
|
269
|
+
_defineProperty(this, "copyFile", async (id, collection, traceContext) => {
|
|
270
|
+
const mediaProvider = await this.props.mediaProvider;
|
|
271
|
+
if (!id || !collection || !(mediaProvider !== null && mediaProvider !== void 0 && mediaProvider.uploadParams)) {
|
|
236
272
|
return;
|
|
237
273
|
}
|
|
238
274
|
const nodeContextId = this.getNodeContextId();
|
|
239
275
|
const uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
240
|
-
if (uploadMediaClientConfig && uploadMediaClientConfig.getAuthFromContext
|
|
241
|
-
|
|
242
|
-
const auth = await uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
243
|
-
const objectId = await this.getObjectId();
|
|
244
|
-
const {
|
|
245
|
-
id,
|
|
246
|
-
collection
|
|
247
|
-
} = attrs;
|
|
248
|
-
const source = {
|
|
249
|
-
id,
|
|
250
|
-
collection,
|
|
251
|
-
authProvider: () => Promise.resolve(auth)
|
|
252
|
-
};
|
|
253
|
-
const currentCollectionName = mediaProvider.uploadParams.collection;
|
|
254
|
-
const destination = {
|
|
255
|
-
collection: currentCollectionName,
|
|
256
|
-
authProvider: uploadMediaClientConfig.authProvider,
|
|
257
|
-
occurrenceKey: uuidV4()
|
|
258
|
-
};
|
|
259
|
-
const mediaFile = await mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
260
|
-
updateMediaNodeAttrs(source.id, {
|
|
261
|
-
id: mediaFile.id,
|
|
262
|
-
collection: currentCollectionName,
|
|
263
|
-
__contextId: objectId
|
|
264
|
-
}, isMediaSingle)(view.state, view.dispatch);
|
|
276
|
+
if (!(uploadMediaClientConfig !== null && uploadMediaClientConfig !== void 0 && uploadMediaClientConfig.getAuthFromContext) || !nodeContextId) {
|
|
277
|
+
return;
|
|
265
278
|
}
|
|
279
|
+
const mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
280
|
+
const auth = await uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
281
|
+
const objectId = await this.getObjectId();
|
|
282
|
+
const source = {
|
|
283
|
+
id,
|
|
284
|
+
collection,
|
|
285
|
+
authProvider: () => Promise.resolve(auth)
|
|
286
|
+
};
|
|
287
|
+
const currentCollectionName = mediaProvider.uploadParams.collection;
|
|
288
|
+
const destination = {
|
|
289
|
+
collection: currentCollectionName,
|
|
290
|
+
authProvider: uploadMediaClientConfig.authProvider,
|
|
291
|
+
occurrenceKey: uuidV4()
|
|
292
|
+
};
|
|
293
|
+
const mediaFile = await mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
294
|
+
return {
|
|
295
|
+
id: mediaFile.id,
|
|
296
|
+
collection: currentCollectionName,
|
|
297
|
+
__contextId: objectId
|
|
298
|
+
};
|
|
266
299
|
});
|
|
267
300
|
this.props = props;
|
|
268
301
|
}
|
|
@@ -272,7 +305,7 @@ export class MediaNodeUpdater {
|
|
|
272
305
|
}
|
|
273
306
|
|
|
274
307
|
// Updates the node with contextId if it doesn't have one already
|
|
275
|
-
// TODO [MS-2258]: remove updateContextId in order to only use
|
|
308
|
+
// TODO [MS-2258]: remove updateContextId in order to only use updateMediaSingleFileAttrs
|
|
276
309
|
|
|
277
310
|
async getRemoteDimensions() {
|
|
278
311
|
const mediaProvider = await this.props.mediaProvider;
|
|
@@ -193,7 +193,7 @@ export default class MediaSingleNode extends Component {
|
|
|
193
193
|
|
|
194
194
|
// We need to call this method on any prop change since attrs can get removed with collab editing
|
|
195
195
|
// the method internally checks if we already have all attrs
|
|
196
|
-
this.createMediaNodeUpdater(nextProps).
|
|
196
|
+
this.createMediaNodeUpdater(nextProps).updateMediaSingleFileAttrs();
|
|
197
197
|
}
|
|
198
198
|
async componentDidMount() {
|
|
199
199
|
const {
|
|
@@ -13,7 +13,7 @@ import * as keymaps from '../../../../../keymaps';
|
|
|
13
13
|
import { ToolTipContent } from '../../../../../keymaps';
|
|
14
14
|
import { closeMediaAltTextMenu, updateAltText } from '../commands';
|
|
15
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
|
-
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, ACTION } from '
|
|
16
|
+
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, ACTION } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import { RECENT_SEARCH_WIDTH_IN_PX } from '../../../../../ui/LinkSearch/ToolbarComponents';
|
|
18
18
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { ErrorMessage } from '@atlaskit/editor-common/ui';
|
|
@@ -13,11 +13,10 @@ import DropPlaceholder from '../ui/Media/DropPlaceholder';
|
|
|
13
13
|
import { insertMediaGroupNode, insertMediaInlineNode, canInsertMediaInline } from '../utils/media-files';
|
|
14
14
|
import { isInsidePotentialEmptyParagraph, removeMediaNode, splitMediaGroup } from '../utils/media-common';
|
|
15
15
|
import * as helpers from '../commands/helpers';
|
|
16
|
-
import {
|
|
16
|
+
import { updateMediaSingleNodeAttrs } from '../commands/helpers';
|
|
17
17
|
import { stateKey } from './plugin-key';
|
|
18
18
|
import PickerFacade from '../picker-facade';
|
|
19
19
|
import { INPUT_METHOD } from '../../analytics/types';
|
|
20
|
-
import { isImage } from '../utils/is-image';
|
|
21
20
|
import { isInEmptyLine } from '../../../utils/document';
|
|
22
21
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
23
22
|
import { isInListItem } from '../../../utils';
|
|
@@ -53,7 +52,6 @@ export class MediaPluginStateImplementation {
|
|
|
53
52
|
_defineProperty(this, "isFullscreen", false);
|
|
54
53
|
_defineProperty(this, "layout", 'center');
|
|
55
54
|
_defineProperty(this, "mediaNodes", []);
|
|
56
|
-
_defineProperty(this, "mediaGroupNodes", {});
|
|
57
55
|
_defineProperty(this, "destroyed", false);
|
|
58
56
|
_defineProperty(this, "removeOnCloseListener", () => {});
|
|
59
57
|
_defineProperty(this, "onPopupToggleCallback", () => {});
|
|
@@ -300,14 +298,14 @@ export class MediaPluginStateImplementation {
|
|
|
300
298
|
}
|
|
301
299
|
return;
|
|
302
300
|
});
|
|
303
|
-
_defineProperty(this, "
|
|
301
|
+
_defineProperty(this, "updateMediaSingleNodeAttrs", (id, attrs) => {
|
|
304
302
|
const {
|
|
305
303
|
view
|
|
306
304
|
} = this;
|
|
307
305
|
if (!view) {
|
|
308
306
|
return;
|
|
309
307
|
}
|
|
310
|
-
return
|
|
308
|
+
return updateMediaSingleNodeAttrs(id, attrs)(view.state, view.dispatch);
|
|
311
309
|
});
|
|
312
310
|
_defineProperty(this, "handleMediaState", state => {
|
|
313
311
|
switch (state.status) {
|
|
@@ -319,31 +317,6 @@ export class MediaPluginStateImplementation {
|
|
|
319
317
|
uploadErrorHandler(state);
|
|
320
318
|
}
|
|
321
319
|
break;
|
|
322
|
-
case 'mobile-upload-end':
|
|
323
|
-
const attrs = {
|
|
324
|
-
id: state.publicId || state.id
|
|
325
|
-
};
|
|
326
|
-
if (typeof state.collection === 'string') {
|
|
327
|
-
attrs.collection = state.collection;
|
|
328
|
-
}
|
|
329
|
-
this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(this.view.state.schema, state.fileMimeType));
|
|
330
|
-
delete this.mediaGroupNodes[state.id];
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
_defineProperty(this, "setMediaGroupNode", (node, getPos) => {
|
|
335
|
-
this.mediaGroupNodes[node.attrs.id] = {
|
|
336
|
-
node,
|
|
337
|
-
getPos
|
|
338
|
-
};
|
|
339
|
-
});
|
|
340
|
-
_defineProperty(this, "removeNodeById", state => {
|
|
341
|
-
const {
|
|
342
|
-
id
|
|
343
|
-
} = state;
|
|
344
|
-
const mediaNodeWithPos = helpers.findMediaNode(this, id, isImage(state.fileMimeType));
|
|
345
|
-
if (mediaNodeWithPos) {
|
|
346
|
-
removeMediaNode(this.view, mediaNodeWithPos.node, mediaNodeWithPos.getPos);
|
|
347
320
|
}
|
|
348
321
|
});
|
|
349
322
|
_defineProperty(this, "removeSelectedMediaContainer", () => {
|
|
@@ -18,9 +18,6 @@ export const FilePreviewItem = ({
|
|
|
18
18
|
};
|
|
19
19
|
const renderMediaViewer = () => {
|
|
20
20
|
if (isMediaViewerVisible) {
|
|
21
|
-
const dataSource = {
|
|
22
|
-
list: []
|
|
23
|
-
};
|
|
24
21
|
const selectedNodeAttrs = getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
25
22
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
26
23
|
const {
|
|
@@ -34,7 +31,7 @@ export const FilePreviewItem = ({
|
|
|
34
31
|
};
|
|
35
32
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
|
|
36
33
|
collectionName: collection,
|
|
37
|
-
|
|
34
|
+
items: [],
|
|
38
35
|
mediaClientConfig: mediaPluginState.mediaClientConfig,
|
|
39
36
|
selectedItem: identifier,
|
|
40
37
|
onClose: onMediaViewerClose
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { findSelectedNodeOfType, findParentNodeOfType } from 'prosemirror-utils';
|
|
2
2
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
4
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
4
5
|
export const findPanel = (state, selection) => {
|
|
5
6
|
const {
|
|
6
7
|
panel
|
|
@@ -17,7 +18,9 @@ export const panelAttrsToDom = (attrs, allowCustomPanel) => {
|
|
|
17
18
|
} = attrs;
|
|
18
19
|
const isCustomPanel = panelType === PanelType.CUSTOM && allowCustomPanel;
|
|
19
20
|
const hasIcon = !isCustomPanel || !!panelIcon || !!panelIconId;
|
|
20
|
-
const
|
|
21
|
+
const tokenColor = panelColor && hexToEditorBackgroundPaletteColor(panelColor);
|
|
22
|
+
const panelBackgroundColor = tokenColor || panelColor;
|
|
23
|
+
const style = [`${panelColor && isCustomPanel ? `background-color: ${panelBackgroundColor};` : ''}`, `${hasIcon ? '' : 'padding-left: 12px;'}`].join('');
|
|
21
24
|
let panelAttrs = {
|
|
22
25
|
class: PanelSharedCssClassName.prefix,
|
|
23
26
|
'data-panel-type': panelType || PanelType.INFO,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { closeHistory } from 'prosemirror-history';
|
|
2
2
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
3
3
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
4
|
-
import { canInsert, findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
4
|
+
import { canInsert, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
5
5
|
import uuid from 'uuid/v4';
|
|
6
6
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell, isInListItem } from '../../utils';
|
|
@@ -112,7 +112,127 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
112
112
|
return true;
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
export function
|
|
115
|
+
export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
116
|
+
return (state, dispatch) => {
|
|
117
|
+
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
118
|
+
const {
|
|
119
|
+
tr
|
|
120
|
+
} = state;
|
|
121
|
+
const {
|
|
122
|
+
selection
|
|
123
|
+
} = tr;
|
|
124
|
+
const {
|
|
125
|
+
$from,
|
|
126
|
+
$to,
|
|
127
|
+
from,
|
|
128
|
+
to
|
|
129
|
+
} = selection;
|
|
130
|
+
const {
|
|
131
|
+
orderedList,
|
|
132
|
+
bulletList,
|
|
133
|
+
listItem
|
|
134
|
+
} = state.schema.nodes;
|
|
135
|
+
|
|
136
|
+
// Selected nodes
|
|
137
|
+
const selectionParentListItemNode = findParentNodeOfType(listItem)(selection);
|
|
138
|
+
const selectionParentListNodeWithPos = findParentNodeOfType([bulletList, orderedList])(selection);
|
|
139
|
+
const selectionParentListNode = selectionParentListNodeWithPos === null || selectionParentListNodeWithPos === void 0 ? void 0 : selectionParentListNodeWithPos.node;
|
|
140
|
+
|
|
141
|
+
// Slice info
|
|
142
|
+
const sliceContent = slice.content;
|
|
143
|
+
const sliceIsListItems = isListNode(sliceContent.firstChild) && isListNode(sliceContent.lastChild);
|
|
144
|
+
|
|
145
|
+
// Find case of slices that can be inserted into a list item
|
|
146
|
+
// (eg. paragraphs, list items, code blocks, media single)
|
|
147
|
+
// These scenarios already get handled elsewhere and don't need to split the list
|
|
148
|
+
let sliceContainsBlockNodesOtherThanThoseAllowedInListItem = false;
|
|
149
|
+
slice.content.forEach(child => {
|
|
150
|
+
if (child.isBlock && !listItem.spec.content.includes(child.type.name)) {
|
|
151
|
+
sliceContainsBlockNodesOtherThanThoseAllowedInListItem = true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
if (!selectionParentListItemNode || !sliceContent || canInsert($from, sliceContent) ||
|
|
155
|
+
// eg. inline nodes that can be inserted in a list item
|
|
156
|
+
!sliceContainsBlockNodesOtherThanThoseAllowedInListItem || sliceIsListItems || !selectionParentListNodeWithPos) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Offsets
|
|
161
|
+
const listWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth + 1; // difference in depth between to position and list node
|
|
162
|
+
const listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
|
|
163
|
+
|
|
164
|
+
// Anything to do with nested lists should safeInsert and not be handled here
|
|
165
|
+
const grandParentListNode = findParentNodeOfTypeClosestToPos(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
|
|
166
|
+
const selectionIsInNestedList = !!grandParentListNode;
|
|
167
|
+
let selectedListItemHasNestedList = false;
|
|
168
|
+
selectionParentListItemNode.node.content.forEach(child => {
|
|
169
|
+
if (isListNode(child)) {
|
|
170
|
+
selectedListItemHasNestedList = true;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
if (selectedListItemHasNestedList || selectionIsInNestedList) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Node after the insert position
|
|
178
|
+
const nodeAfterInsertPositionIsListItem = ((_tr$doc$nodeAt = tr.doc.nodeAt(to + listItemWrappingOffset)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) === 'listItem';
|
|
179
|
+
|
|
180
|
+
// Get the next list items position (used later to find the split out ordered list)
|
|
181
|
+
const indexOfNextListItem = $to.indexAfter($to.depth - listItemWrappingOffset);
|
|
182
|
+
const positionOfNextListItem = tr.doc.resolve(selectionParentListNodeWithPos.pos + 1).posAtIndex(indexOfNextListItem);
|
|
183
|
+
|
|
184
|
+
// These nodes paste as plain text by default so need to be handled differently
|
|
185
|
+
const sliceContainsNodeThatPastesAsPlainText = sliceContent.firstChild && ['taskItem', 'taskList', 'heading', 'blockquote'].includes(sliceContent.firstChild.type.name);
|
|
186
|
+
|
|
187
|
+
// Work out position to replace up to
|
|
188
|
+
let replaceTo;
|
|
189
|
+
if (sliceContainsNodeThatPastesAsPlainText && nodeAfterInsertPositionIsListItem) {
|
|
190
|
+
replaceTo = to + listItemWrappingOffset;
|
|
191
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || !nodeAfterInsertPositionIsListItem) {
|
|
192
|
+
replaceTo = to;
|
|
193
|
+
} else {
|
|
194
|
+
replaceTo = to + listWrappingOffset;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// handle the insertion of the slice
|
|
198
|
+
if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
199
|
+
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
200
|
+
} else {
|
|
201
|
+
// When the selection is not at the end of a list item
|
|
202
|
+
// eg. middle of list item, start of list item
|
|
203
|
+
tr.replaceSelection(slice).scrollIntoView();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Find the ordered list node after the pasted content so we can set it's order
|
|
207
|
+
const mappedPositionOfNextListItem = tr.mapping.map(positionOfNextListItem);
|
|
208
|
+
if (mappedPositionOfNextListItem > tr.doc.nodeSize) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
const nodeAfterPastedContentResolvedPos = findParentNodeOfTypeClosestToPos(tr.doc.resolve(mappedPositionOfNextListItem), [orderedList]);
|
|
212
|
+
|
|
213
|
+
// Work out the new split out lists 'order' (the number it starts from)
|
|
214
|
+
const originalParentOrderedListNodeOrder = selectionParentListNode === null || selectionParentListNode === void 0 ? void 0 : selectionParentListNode.attrs.order;
|
|
215
|
+
const numOfListItemsInOriginalList = (_findParentNodeOfType = findParentNodeOfTypeClosestToPos(tr.doc.resolve(from - 1), [orderedList])) === null || _findParentNodeOfType === void 0 ? void 0 : _findParentNodeOfType.node.childCount;
|
|
216
|
+
|
|
217
|
+
// Set the new split out lists order attribute
|
|
218
|
+
if (typeof originalParentOrderedListNodeOrder === 'number' && numOfListItemsInOriginalList && nodeAfterPastedContentResolvedPos) {
|
|
219
|
+
tr.setNodeMarkup(nodeAfterPastedContentResolvedPos.pos, orderedList, {
|
|
220
|
+
...nodeAfterPastedContentResolvedPos.node.attrs,
|
|
221
|
+
order: originalParentOrderedListNodeOrder + numOfListItemsInOriginalList
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// dispatch transaction
|
|
226
|
+
if (tr.docChanged) {
|
|
227
|
+
if (dispatch) {
|
|
228
|
+
dispatch(tr);
|
|
229
|
+
}
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
export function handlePastePanelOrDecisionContentIntoList(slice) {
|
|
116
236
|
return (state, dispatch) => {
|
|
117
237
|
const {
|
|
118
238
|
schema,
|
|
@@ -122,17 +242,19 @@ export function handlePastePanelIntoList(slice) {
|
|
|
122
242
|
selection
|
|
123
243
|
} = tr;
|
|
124
244
|
// Check this pasting action is related to copy content from panel node into a selected the list node
|
|
125
|
-
const
|
|
245
|
+
const blockNode = slice.content.firstChild;
|
|
126
246
|
const isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
127
247
|
const selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
128
248
|
const sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection);
|
|
129
|
-
if (!
|
|
249
|
+
if (!selectionParentListItemNode || (selectionParentListItemNode === null || selectionParentListItemNode === void 0 ? void 0 : selectionParentListItemNode.type) !== schema.nodes.listItem || !blockNode || !['panel', 'decisionList'].includes(blockNode === null || blockNode === void 0 ? void 0 : blockNode.type.name) || slice.content.childCount > 1 || (blockNode === null || blockNode === void 0 ? void 0 : blockNode.content.firstChild) === undefined || sliceIsWholeNodeButShouldNotReplaceSelection) {
|
|
130
250
|
return false;
|
|
131
251
|
}
|
|
132
252
|
|
|
133
253
|
// Paste the panel node contents extracted instead of pasting the entire panel node
|
|
134
254
|
tr.replaceSelection(slice).scrollIntoView();
|
|
135
|
-
dispatch
|
|
255
|
+
if (dispatch) {
|
|
256
|
+
dispatch(tr);
|
|
257
|
+
}
|
|
136
258
|
return true;
|
|
137
259
|
};
|
|
138
260
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
|
|
2
2
|
import { getPasteSource } from '../util';
|
|
3
|
-
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption,
|
|
3
|
+
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
4
4
|
import { pipe } from '../../../utils';
|
|
5
5
|
import { findParentNode } from 'prosemirror-utils';
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
@@ -186,7 +186,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
186
186
|
content: PasteContents.text,
|
|
187
187
|
source,
|
|
188
188
|
hyperlinkPasteOnText: false,
|
|
189
|
-
linksInPasteCount: linkUrls.length
|
|
189
|
+
linksInPasteCount: linkUrls.length,
|
|
190
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
const linkDomains = linkUrls.map(getLinkDomain);
|
|
@@ -197,7 +198,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
197
198
|
source,
|
|
198
199
|
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText,
|
|
199
200
|
linksInPasteCount: linkUrls.length,
|
|
200
|
-
mediaTraceId
|
|
201
|
+
mediaTraceId,
|
|
202
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
201
203
|
}, linkDomains);
|
|
202
204
|
}
|
|
203
205
|
|
|
@@ -238,9 +240,13 @@ export const handleMarkdownWithAnalytics = (view, event, slice) => pipe(handleMa
|
|
|
238
240
|
export const handleRichTextWithAnalytics = (view, event, slice) => pipe(handleRichText, pasteCommandWithAnalytics(view, event, slice, {
|
|
239
241
|
type: PasteTypes.richText
|
|
240
242
|
}))(slice);
|
|
241
|
-
export const
|
|
243
|
+
export const handlePastePanelOrDecisionIntoListWithAnalytics = (view, event, slice) => pipe(handlePastePanelOrDecisionContentIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
242
244
|
type: PasteTypes.richText
|
|
243
245
|
}))(slice);
|
|
246
|
+
export const handlePasteNonNestableBlockNodesIntoListWithAnalytics = (view, event, slice) => pipe(handlePasteNonNestableBlockNodesIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
247
|
+
type: PasteTypes.richText,
|
|
248
|
+
pasteSplitList: true
|
|
249
|
+
}))(slice);
|
|
244
250
|
export const handleExpandWithAnalytics = (view, event, slice) => pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
|
|
245
251
|
type: PasteTypes.richText
|
|
246
252
|
}))(slice);
|
|
@@ -12,7 +12,7 @@ import { linkifyContent } from '../../hyperlink/utils';
|
|
|
12
12
|
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
13
13
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
14
14
|
import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
|
|
15
|
-
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics,
|
|
15
|
+
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
16
16
|
import { analyticsPluginKey, PasteTypes } from '../../analytics';
|
|
17
17
|
import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
|
|
18
18
|
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
@@ -30,13 +30,18 @@ import { extractSliceFromStep } from '../../../utils/step';
|
|
|
30
30
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
31
31
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
32
32
|
export { md } from '../md';
|
|
33
|
+
import { getFeatureFlags } from '../../feature-flags-context';
|
|
33
34
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
34
35
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
35
36
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
36
37
|
let textInput = text;
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const textSplitByCodeBlock = textInput.split(/```/);
|
|
39
|
+
for (let i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
40
|
+
if (i % 2 === 0) {
|
|
41
|
+
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
42
|
+
}
|
|
39
43
|
}
|
|
44
|
+
textInput = textSplitByCodeBlock.join('```');
|
|
40
45
|
const doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
|
|
41
46
|
if (doc && doc.content) {
|
|
42
47
|
return new Slice(doc.content, openStart, openEnd);
|
|
@@ -328,7 +333,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptio
|
|
|
328
333
|
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
329
334
|
return true;
|
|
330
335
|
}
|
|
331
|
-
|
|
336
|
+
const featureFlags = getFeatureFlags(state);
|
|
337
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
332
341
|
return true;
|
|
333
342
|
}
|
|
334
343
|
return handleRichTextWithAnalytics(view, event, slice)(state, dispatch);
|