@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
|
@@ -265,7 +265,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
265
265
|
|
|
266
266
|
// We need to call this method on any prop change since attrs can get removed with collab editing
|
|
267
267
|
// the method internally checks if we already have all attrs
|
|
268
|
-
this.createMediaNodeUpdater(nextProps).
|
|
268
|
+
this.createMediaNodeUpdater(nextProps).updateMediaSingleFileAttrs();
|
|
269
269
|
}
|
|
270
270
|
}, {
|
|
271
271
|
key: "componentDidMount",
|
|
@@ -23,7 +23,7 @@ import * as keymaps from '../../../../../keymaps';
|
|
|
23
23
|
import { ToolTipContent } from '../../../../../keymaps';
|
|
24
24
|
import { closeMediaAltTextMenu, updateAltText } from '../commands';
|
|
25
25
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
26
|
-
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, ACTION } from '
|
|
26
|
+
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, ACTION } from '@atlaskit/editor-common/analytics';
|
|
27
27
|
import { RECENT_SEARCH_WIDTH_IN_PX } from '../../../../../ui/LinkSearch/ToolbarComponents';
|
|
28
28
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
29
29
|
import { ErrorMessage } from '@atlaskit/editor-common/ui';
|
|
@@ -22,11 +22,10 @@ import DropPlaceholder from '../ui/Media/DropPlaceholder';
|
|
|
22
22
|
import { insertMediaGroupNode, insertMediaInlineNode, canInsertMediaInline } from '../utils/media-files';
|
|
23
23
|
import { isInsidePotentialEmptyParagraph, removeMediaNode, splitMediaGroup } from '../utils/media-common';
|
|
24
24
|
import * as helpers from '../commands/helpers';
|
|
25
|
-
import {
|
|
25
|
+
import { updateMediaSingleNodeAttrs } from '../commands/helpers';
|
|
26
26
|
import { stateKey } from './plugin-key';
|
|
27
27
|
import PickerFacade from '../picker-facade';
|
|
28
28
|
import { INPUT_METHOD } from '../../analytics/types';
|
|
29
|
-
import { isImage } from '../utils/is-image';
|
|
30
29
|
import { isInEmptyLine } from '../../../utils/document';
|
|
31
30
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
32
31
|
import { isInListItem } from '../../../utils';
|
|
@@ -64,7 +63,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
64
63
|
_defineProperty(this, "isFullscreen", false);
|
|
65
64
|
_defineProperty(this, "layout", 'center');
|
|
66
65
|
_defineProperty(this, "mediaNodes", []);
|
|
67
|
-
_defineProperty(this, "mediaGroupNodes", {});
|
|
68
66
|
_defineProperty(this, "destroyed", false);
|
|
69
67
|
_defineProperty(this, "removeOnCloseListener", function () {});
|
|
70
68
|
_defineProperty(this, "onPopupToggleCallback", function () {});
|
|
@@ -371,12 +369,12 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
371
369
|
}
|
|
372
370
|
return;
|
|
373
371
|
});
|
|
374
|
-
_defineProperty(this, "
|
|
372
|
+
_defineProperty(this, "updateMediaSingleNodeAttrs", function (id, attrs) {
|
|
375
373
|
var view = _this.view;
|
|
376
374
|
if (!view) {
|
|
377
375
|
return;
|
|
378
376
|
}
|
|
379
|
-
return
|
|
377
|
+
return updateMediaSingleNodeAttrs(id, attrs)(view.state, view.dispatch);
|
|
380
378
|
});
|
|
381
379
|
_defineProperty(this, "handleMediaState", function (state) {
|
|
382
380
|
switch (state.status) {
|
|
@@ -386,29 +384,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
386
384
|
uploadErrorHandler(state);
|
|
387
385
|
}
|
|
388
386
|
break;
|
|
389
|
-
case 'mobile-upload-end':
|
|
390
|
-
var attrs = {
|
|
391
|
-
id: state.publicId || state.id
|
|
392
|
-
};
|
|
393
|
-
if (typeof state.collection === 'string') {
|
|
394
|
-
attrs.collection = state.collection;
|
|
395
|
-
}
|
|
396
|
-
_this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(_this.view.state.schema, state.fileMimeType));
|
|
397
|
-
delete _this.mediaGroupNodes[state.id];
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
_defineProperty(this, "setMediaGroupNode", function (node, getPos) {
|
|
402
|
-
_this.mediaGroupNodes[node.attrs.id] = {
|
|
403
|
-
node: node,
|
|
404
|
-
getPos: getPos
|
|
405
|
-
};
|
|
406
|
-
});
|
|
407
|
-
_defineProperty(this, "removeNodeById", function (state) {
|
|
408
|
-
var id = state.id;
|
|
409
|
-
var mediaNodeWithPos = helpers.findMediaNode(_this, id, isImage(state.fileMimeType));
|
|
410
|
-
if (mediaNodeWithPos) {
|
|
411
|
-
removeMediaNode(_this.view, mediaNodeWithPos.node, mediaNodeWithPos.getPos);
|
|
412
387
|
}
|
|
413
388
|
});
|
|
414
389
|
_defineProperty(this, "removeSelectedMediaContainer", function () {
|
|
@@ -21,9 +21,6 @@ export var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
21
21
|
};
|
|
22
22
|
var renderMediaViewer = function renderMediaViewer() {
|
|
23
23
|
if (isMediaViewerVisible) {
|
|
24
|
-
var dataSource = {
|
|
25
|
-
list: []
|
|
26
|
-
};
|
|
27
24
|
var selectedNodeAttrs = getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
28
25
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
29
26
|
var id = selectedNodeAttrs.id,
|
|
@@ -36,7 +33,7 @@ export var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
36
33
|
};
|
|
37
34
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
|
|
38
35
|
collectionName: collection,
|
|
39
|
-
|
|
36
|
+
items: [],
|
|
40
37
|
mediaClientConfig: mediaPluginState.mediaClientConfig,
|
|
41
38
|
selectedItem: identifier,
|
|
42
39
|
onClose: onMediaViewerClose
|
|
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { findSelectedNodeOfType, findParentNodeOfType } from 'prosemirror-utils';
|
|
5
5
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
6
6
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
7
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
7
8
|
export var findPanel = function findPanel(state, selection) {
|
|
8
9
|
var panel = state.schema.nodes.panel;
|
|
9
10
|
return findSelectedNodeOfType(panel)(selection || state.selection) || findParentNodeOfType(panel)(selection || state.selection);
|
|
@@ -16,7 +17,9 @@ export var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
16
17
|
panelIconText = attrs.panelIconText;
|
|
17
18
|
var isCustomPanel = panelType === PanelType.CUSTOM && allowCustomPanel;
|
|
18
19
|
var hasIcon = !isCustomPanel || !!panelIcon || !!panelIconId;
|
|
19
|
-
var
|
|
20
|
+
var tokenColor = panelColor && hexToEditorBackgroundPaletteColor(panelColor);
|
|
21
|
+
var panelBackgroundColor = tokenColor || panelColor;
|
|
22
|
+
var style = ["".concat(panelColor && isCustomPanel ? "background-color: ".concat(panelBackgroundColor, ";") : ''), "".concat(hasIcon ? '' : 'padding-left: 12px;')].join('');
|
|
20
23
|
var panelAttrs = {
|
|
21
24
|
class: PanelSharedCssClassName.prefix,
|
|
22
25
|
'data-panel-type': panelType || PanelType.INFO,
|
|
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
9
|
import { closeHistory } from 'prosemirror-history';
|
|
10
10
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
11
11
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
12
|
-
import { canInsert, findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
12
|
+
import { canInsert, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
13
13
|
import uuid from 'uuid/v4';
|
|
14
14
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
15
15
|
import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell, isInListItem } from '../../utils';
|
|
@@ -110,23 +110,137 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
110
110
|
return true;
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
export function
|
|
113
|
+
export function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
114
|
+
return function (state, dispatch) {
|
|
115
|
+
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
116
|
+
var tr = state.tr;
|
|
117
|
+
var selection = tr.selection;
|
|
118
|
+
var $from = selection.$from,
|
|
119
|
+
$to = selection.$to,
|
|
120
|
+
from = selection.from,
|
|
121
|
+
to = selection.to;
|
|
122
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
123
|
+
orderedList = _state$schema$nodes.orderedList,
|
|
124
|
+
bulletList = _state$schema$nodes.bulletList,
|
|
125
|
+
listItem = _state$schema$nodes.listItem;
|
|
126
|
+
|
|
127
|
+
// Selected nodes
|
|
128
|
+
var selectionParentListItemNode = findParentNodeOfType(listItem)(selection);
|
|
129
|
+
var selectionParentListNodeWithPos = findParentNodeOfType([bulletList, orderedList])(selection);
|
|
130
|
+
var selectionParentListNode = selectionParentListNodeWithPos === null || selectionParentListNodeWithPos === void 0 ? void 0 : selectionParentListNodeWithPos.node;
|
|
131
|
+
|
|
132
|
+
// Slice info
|
|
133
|
+
var sliceContent = slice.content;
|
|
134
|
+
var sliceIsListItems = isListNode(sliceContent.firstChild) && isListNode(sliceContent.lastChild);
|
|
135
|
+
|
|
136
|
+
// Find case of slices that can be inserted into a list item
|
|
137
|
+
// (eg. paragraphs, list items, code blocks, media single)
|
|
138
|
+
// These scenarios already get handled elsewhere and don't need to split the list
|
|
139
|
+
var sliceContainsBlockNodesOtherThanThoseAllowedInListItem = false;
|
|
140
|
+
slice.content.forEach(function (child) {
|
|
141
|
+
if (child.isBlock && !listItem.spec.content.includes(child.type.name)) {
|
|
142
|
+
sliceContainsBlockNodesOtherThanThoseAllowedInListItem = true;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (!selectionParentListItemNode || !sliceContent || canInsert($from, sliceContent) ||
|
|
146
|
+
// eg. inline nodes that can be inserted in a list item
|
|
147
|
+
!sliceContainsBlockNodesOtherThanThoseAllowedInListItem || sliceIsListItems || !selectionParentListNodeWithPos) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Offsets
|
|
152
|
+
var listWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth + 1; // difference in depth between to position and list node
|
|
153
|
+
var listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
|
|
154
|
+
|
|
155
|
+
// Anything to do with nested lists should safeInsert and not be handled here
|
|
156
|
+
var grandParentListNode = findParentNodeOfTypeClosestToPos(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
|
|
157
|
+
var selectionIsInNestedList = !!grandParentListNode;
|
|
158
|
+
var selectedListItemHasNestedList = false;
|
|
159
|
+
selectionParentListItemNode.node.content.forEach(function (child) {
|
|
160
|
+
if (isListNode(child)) {
|
|
161
|
+
selectedListItemHasNestedList = true;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
if (selectedListItemHasNestedList || selectionIsInNestedList) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Node after the insert position
|
|
169
|
+
var nodeAfterInsertPositionIsListItem = ((_tr$doc$nodeAt = tr.doc.nodeAt(to + listItemWrappingOffset)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) === 'listItem';
|
|
170
|
+
|
|
171
|
+
// Get the next list items position (used later to find the split out ordered list)
|
|
172
|
+
var indexOfNextListItem = $to.indexAfter($to.depth - listItemWrappingOffset);
|
|
173
|
+
var positionOfNextListItem = tr.doc.resolve(selectionParentListNodeWithPos.pos + 1).posAtIndex(indexOfNextListItem);
|
|
174
|
+
|
|
175
|
+
// These nodes paste as plain text by default so need to be handled differently
|
|
176
|
+
var sliceContainsNodeThatPastesAsPlainText = sliceContent.firstChild && ['taskItem', 'taskList', 'heading', 'blockquote'].includes(sliceContent.firstChild.type.name);
|
|
177
|
+
|
|
178
|
+
// Work out position to replace up to
|
|
179
|
+
var replaceTo;
|
|
180
|
+
if (sliceContainsNodeThatPastesAsPlainText && nodeAfterInsertPositionIsListItem) {
|
|
181
|
+
replaceTo = to + listItemWrappingOffset;
|
|
182
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || !nodeAfterInsertPositionIsListItem) {
|
|
183
|
+
replaceTo = to;
|
|
184
|
+
} else {
|
|
185
|
+
replaceTo = to + listWrappingOffset;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// handle the insertion of the slice
|
|
189
|
+
if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
190
|
+
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
191
|
+
} else {
|
|
192
|
+
// When the selection is not at the end of a list item
|
|
193
|
+
// eg. middle of list item, start of list item
|
|
194
|
+
tr.replaceSelection(slice).scrollIntoView();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Find the ordered list node after the pasted content so we can set it's order
|
|
198
|
+
var mappedPositionOfNextListItem = tr.mapping.map(positionOfNextListItem);
|
|
199
|
+
if (mappedPositionOfNextListItem > tr.doc.nodeSize) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
var nodeAfterPastedContentResolvedPos = findParentNodeOfTypeClosestToPos(tr.doc.resolve(mappedPositionOfNextListItem), [orderedList]);
|
|
203
|
+
|
|
204
|
+
// Work out the new split out lists 'order' (the number it starts from)
|
|
205
|
+
var originalParentOrderedListNodeOrder = selectionParentListNode === null || selectionParentListNode === void 0 ? void 0 : selectionParentListNode.attrs.order;
|
|
206
|
+
var numOfListItemsInOriginalList = (_findParentNodeOfType = findParentNodeOfTypeClosestToPos(tr.doc.resolve(from - 1), [orderedList])) === null || _findParentNodeOfType === void 0 ? void 0 : _findParentNodeOfType.node.childCount;
|
|
207
|
+
|
|
208
|
+
// Set the new split out lists order attribute
|
|
209
|
+
if (typeof originalParentOrderedListNodeOrder === 'number' && numOfListItemsInOriginalList && nodeAfterPastedContentResolvedPos) {
|
|
210
|
+
tr.setNodeMarkup(nodeAfterPastedContentResolvedPos.pos, orderedList, _objectSpread(_objectSpread({}, nodeAfterPastedContentResolvedPos.node.attrs), {}, {
|
|
211
|
+
order: originalParentOrderedListNodeOrder + numOfListItemsInOriginalList
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// dispatch transaction
|
|
216
|
+
if (tr.docChanged) {
|
|
217
|
+
if (dispatch) {
|
|
218
|
+
dispatch(tr);
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export function handlePastePanelOrDecisionContentIntoList(slice) {
|
|
114
226
|
return function (state, dispatch) {
|
|
115
227
|
var schema = state.schema,
|
|
116
228
|
tr = state.tr;
|
|
117
229
|
var selection = tr.selection;
|
|
118
230
|
// Check this pasting action is related to copy content from panel node into a selected the list node
|
|
119
|
-
var
|
|
231
|
+
var blockNode = slice.content.firstChild;
|
|
120
232
|
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
121
233
|
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
122
234
|
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection);
|
|
123
|
-
if (!
|
|
235
|
+
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) {
|
|
124
236
|
return false;
|
|
125
237
|
}
|
|
126
238
|
|
|
127
239
|
// Paste the panel node contents extracted instead of pasting the entire panel node
|
|
128
240
|
tr.replaceSelection(slice).scrollIntoView();
|
|
129
|
-
dispatch
|
|
241
|
+
if (dispatch) {
|
|
242
|
+
dispatch(tr);
|
|
243
|
+
}
|
|
130
244
|
return true;
|
|
131
245
|
};
|
|
132
246
|
}
|
|
@@ -435,9 +549,9 @@ export function handleExpandPasteInTable(slice) {
|
|
|
435
549
|
if (!insideTable(state) || !checkExpand(slice)) {
|
|
436
550
|
return false;
|
|
437
551
|
}
|
|
438
|
-
var _state$schema$
|
|
439
|
-
expand = _state$schema$
|
|
440
|
-
nestedExpand = _state$schema$
|
|
552
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
553
|
+
expand = _state$schema$nodes2.expand,
|
|
554
|
+
nestedExpand = _state$schema$nodes2.nestedExpand;
|
|
441
555
|
var tr = state.tr;
|
|
442
556
|
var hasExpand = false;
|
|
443
557
|
var newSlice = mapSlice(slice, function (maybeNode) {
|
|
@@ -632,11 +746,11 @@ export function flattenNestedListInSlice(slice) {
|
|
|
632
746
|
export function handleRichText(slice) {
|
|
633
747
|
return function (state, dispatch) {
|
|
634
748
|
var _slice$content, _slice$content2, _panelParentOverCurre;
|
|
635
|
-
var _state$schema$
|
|
636
|
-
codeBlock = _state$schema$
|
|
637
|
-
heading = _state$schema$
|
|
638
|
-
paragraph = _state$schema$
|
|
639
|
-
panel = _state$schema$
|
|
749
|
+
var _state$schema$nodes3 = state.schema.nodes,
|
|
750
|
+
codeBlock = _state$schema$nodes3.codeBlock,
|
|
751
|
+
heading = _state$schema$nodes3.heading,
|
|
752
|
+
paragraph = _state$schema$nodes3.paragraph,
|
|
753
|
+
panel = _state$schema$nodes3.panel;
|
|
640
754
|
var selection = state.selection,
|
|
641
755
|
schema = state.schema;
|
|
642
756
|
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
5
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
|
|
6
6
|
import { getPasteSource } from '../util';
|
|
7
|
-
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption,
|
|
7
|
+
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
8
8
|
import { pipe } from '../../../utils';
|
|
9
9
|
import { findParentNode } from 'prosemirror-utils';
|
|
10
10
|
import { mapSlice } from '../../../utils/slice';
|
|
@@ -177,7 +177,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
177
177
|
content: PasteContents.text,
|
|
178
178
|
source: source,
|
|
179
179
|
hyperlinkPasteOnText: false,
|
|
180
|
-
linksInPasteCount: linkUrls.length
|
|
180
|
+
linksInPasteCount: linkUrls.length,
|
|
181
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
181
182
|
});
|
|
182
183
|
}
|
|
183
184
|
var linkDomains = linkUrls.map(getLinkDomain);
|
|
@@ -188,7 +189,8 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
188
189
|
source: source,
|
|
189
190
|
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText,
|
|
190
191
|
linksInPasteCount: linkUrls.length,
|
|
191
|
-
mediaTraceId: mediaTraceId
|
|
192
|
+
mediaTraceId: mediaTraceId,
|
|
193
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
192
194
|
}, linkDomains);
|
|
193
195
|
}
|
|
194
196
|
|
|
@@ -245,11 +247,17 @@ export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(vi
|
|
|
245
247
|
type: PasteTypes.richText
|
|
246
248
|
}))(slice);
|
|
247
249
|
};
|
|
248
|
-
export var
|
|
249
|
-
return pipe(
|
|
250
|
+
export var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice) {
|
|
251
|
+
return pipe(handlePastePanelOrDecisionContentIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
250
252
|
type: PasteTypes.richText
|
|
251
253
|
}))(slice);
|
|
252
254
|
};
|
|
255
|
+
export var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice) {
|
|
256
|
+
return pipe(handlePasteNonNestableBlockNodesIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
257
|
+
type: PasteTypes.richText,
|
|
258
|
+
pasteSplitList: true
|
|
259
|
+
}))(slice);
|
|
260
|
+
};
|
|
253
261
|
export var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
|
|
254
262
|
return pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
|
|
255
263
|
type: PasteTypes.richText
|
|
@@ -14,7 +14,7 @@ import { linkifyContent } from '../../hyperlink/utils';
|
|
|
14
14
|
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
15
15
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
16
16
|
import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
|
|
17
|
-
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics,
|
|
17
|
+
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
18
18
|
import { analyticsPluginKey, PasteTypes } from '../../analytics';
|
|
19
19
|
import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
|
|
20
20
|
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
@@ -32,13 +32,18 @@ import { extractSliceFromStep } from '../../../utils/step';
|
|
|
32
32
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
33
33
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
34
34
|
export { md } from '../md';
|
|
35
|
+
import { getFeatureFlags } from '../../feature-flags-context';
|
|
35
36
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
36
37
|
var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
37
38
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
38
39
|
var textInput = text;
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
var textSplitByCodeBlock = textInput.split(/```/);
|
|
41
|
+
for (var i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
42
|
+
if (i % 2 === 0) {
|
|
43
|
+
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
44
|
+
}
|
|
41
45
|
}
|
|
46
|
+
textInput = textSplitByCodeBlock.join('```');
|
|
42
47
|
var doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
|
|
43
48
|
if (doc && doc.content) {
|
|
44
49
|
return new Slice(doc.content, openStart, openEnd);
|
|
@@ -350,7 +355,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptio
|
|
|
350
355
|
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
351
356
|
return true;
|
|
352
357
|
}
|
|
353
|
-
|
|
358
|
+
var featureFlags = getFeatureFlags(state);
|
|
359
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
354
363
|
return true;
|
|
355
364
|
}
|
|
356
365
|
return handleRichTextWithAnalytics(view, event, slice)(state, dispatch);
|
|
@@ -224,7 +224,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
224
224
|
};
|
|
225
225
|
return plugin;
|
|
226
226
|
};
|
|
227
|
-
var placeholderTextPlugin = function placeholderTextPlugin(options) {
|
|
228
|
-
return decorateWithPluginOptions(basePlaceholderTextPlugin(options), options);
|
|
227
|
+
var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
|
|
228
|
+
return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
|
|
229
229
|
};
|
|
230
230
|
export default placeholderTextPlugin;
|
|
@@ -31,7 +31,10 @@ var baseStatusPlugin = function baseStatusPlugin(options) {
|
|
|
31
31
|
}];
|
|
32
32
|
},
|
|
33
33
|
contentComponent: function contentComponent(_ref) {
|
|
34
|
-
var editorView = _ref.editorView
|
|
34
|
+
var editorView = _ref.editorView,
|
|
35
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
36
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
37
|
+
popupsScrollableElement = _ref.popupsScrollableElement;
|
|
35
38
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
36
39
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
37
40
|
plugins: {
|
|
@@ -59,6 +62,9 @@ var baseStatusPlugin = function baseStatusPlugin(options) {
|
|
|
59
62
|
defaultText: text,
|
|
60
63
|
defaultColor: color,
|
|
61
64
|
defaultLocalId: localId,
|
|
65
|
+
mountTo: popupsMountPoint,
|
|
66
|
+
boundariesElement: popupsBoundariesElement,
|
|
67
|
+
scrollableElement: popupsScrollableElement,
|
|
62
68
|
onSelect: function onSelect(status) {
|
|
63
69
|
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
64
70
|
},
|
|
@@ -109,7 +115,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
109
115
|
};
|
|
110
116
|
return plugin;
|
|
111
117
|
};
|
|
112
|
-
var statusPlugin = function statusPlugin(options) {
|
|
113
|
-
return decorateWithPluginOptions(baseStatusPlugin(options), options);
|
|
118
|
+
var statusPlugin = function statusPlugin(options, api) {
|
|
119
|
+
return decorateWithPluginOptions(baseStatusPlugin(options, api), options);
|
|
114
120
|
};
|
|
115
121
|
export default statusPlugin;
|
|
@@ -199,7 +199,10 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
|
|
|
199
199
|
value: function render() {
|
|
200
200
|
var _this$props = this.props,
|
|
201
201
|
isNew = _this$props.isNew,
|
|
202
|
-
target = _this$props.target
|
|
202
|
+
target = _this$props.target,
|
|
203
|
+
mountTo = _this$props.mountTo,
|
|
204
|
+
boundariesElement = _this$props.boundariesElement,
|
|
205
|
+
scrollableElement = _this$props.scrollableElement;
|
|
203
206
|
var _this$state3 = this.state,
|
|
204
207
|
color = _this$state3.color,
|
|
205
208
|
text = _this$state3.text;
|
|
@@ -209,7 +212,10 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
|
|
|
209
212
|
handleClickOutside: this.handleClickOutside,
|
|
210
213
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
211
214
|
zIndex: akEditorFloatingDialogZIndex,
|
|
212
|
-
fitHeight: 40
|
|
215
|
+
fitHeight: 40,
|
|
216
|
+
mountTo: mountTo,
|
|
217
|
+
boundariesElement: boundariesElement,
|
|
218
|
+
scrollableElement: scrollableElement
|
|
213
219
|
}, jsx("div", {
|
|
214
220
|
css: pickerContainer,
|
|
215
221
|
onClick: this.handlePopupClick
|
|
@@ -13,6 +13,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { jsx } from '@emotion/react';
|
|
15
15
|
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
16
|
+
import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
17
|
+
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
18
|
+
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
16
19
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
17
20
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
18
21
|
import ColorPalette from '../../../../ui/ColorPalette';
|
|
@@ -44,7 +47,8 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
44
47
|
}
|
|
45
48
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
49
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
47
|
-
isOpen: false
|
|
50
|
+
isOpen: false,
|
|
51
|
+
isOpenedByKeyboard: false
|
|
48
52
|
});
|
|
49
53
|
_defineProperty(_assertThisInitialized(_this), "toolbarItemRef", /*#__PURE__*/React.createRef());
|
|
50
54
|
_defineProperty(_assertThisInitialized(_this), "changeColor", function (color) {
|
|
@@ -58,6 +62,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
64
|
_defineProperty(_assertThisInitialized(_this), "changeTextColor", function (color, disabled) {
|
|
65
|
+
var _this$toolbarItemRef, _this$toolbarItemRef$;
|
|
61
66
|
if (!disabled) {
|
|
62
67
|
var _this$props$editorVie;
|
|
63
68
|
var palette = _this.props.pluginState.palette;
|
|
@@ -77,6 +82,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
77
82
|
//To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
|
|
78
83
|
(_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
|
|
79
84
|
}
|
|
85
|
+
(_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 ? void 0 : (_this$toolbarItemRef$ = _this$toolbarItemRef.current) === null || _this$toolbarItemRef$ === void 0 ? void 0 : _this$toolbarItemRef$.focus();
|
|
80
86
|
return false;
|
|
81
87
|
});
|
|
82
88
|
_defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
|
|
@@ -85,6 +91,15 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
85
91
|
logCloseEvent: true
|
|
86
92
|
});
|
|
87
93
|
});
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
95
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
_this.setState({
|
|
98
|
+
isOpenedByKeyboard: true
|
|
99
|
+
});
|
|
100
|
+
_this.toggleOpen();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
88
103
|
_defineProperty(_assertThisInitialized(_this), "handleOpenChange", function (_ref) {
|
|
89
104
|
var isOpen = _ref.isOpen,
|
|
90
105
|
logCloseEvent = _ref.logCloseEvent,
|
|
@@ -92,14 +107,19 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
92
107
|
_this.setState({
|
|
93
108
|
isOpen: isOpen
|
|
94
109
|
});
|
|
110
|
+
if (!isOpen) {
|
|
111
|
+
_this.setState({
|
|
112
|
+
isOpenedByKeyboard: false
|
|
113
|
+
});
|
|
114
|
+
}
|
|
95
115
|
if (logCloseEvent) {
|
|
96
116
|
_this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(isOpen ? ACTION.OPENED : ACTION.CLOSED, {
|
|
97
117
|
noSelect: isOpen === false
|
|
98
118
|
}));
|
|
99
119
|
}
|
|
100
120
|
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
101
|
-
var _this$
|
|
102
|
-
(_this$
|
|
121
|
+
var _this$toolbarItemRef2, _this$toolbarItemRef3;
|
|
122
|
+
(_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 ? void 0 : (_this$toolbarItemRef3 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef3 === void 0 ? void 0 : _this$toolbarItemRef3.focus();
|
|
103
123
|
}
|
|
104
124
|
});
|
|
105
125
|
_defineProperty(_assertThisInitialized(_this), "hide", function (e) {
|
|
@@ -112,15 +132,15 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
112
132
|
isOpen: false
|
|
113
133
|
});
|
|
114
134
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
115
|
-
var _this$
|
|
116
|
-
(_this$
|
|
135
|
+
var _this$toolbarItemRef4, _this$toolbarItemRef5;
|
|
136
|
+
(_this$toolbarItemRef4 = _this.toolbarItemRef) === null || _this$toolbarItemRef4 === void 0 ? void 0 : (_this$toolbarItemRef5 = _this$toolbarItemRef4.current) === null || _this$toolbarItemRef5 === void 0 ? void 0 : _this$toolbarItemRef5.focus();
|
|
117
137
|
}
|
|
118
138
|
}
|
|
119
139
|
});
|
|
120
140
|
_defineProperty(_assertThisInitialized(_this), "hideonEsc", function (e) {
|
|
121
|
-
var _this$
|
|
141
|
+
var _this$toolbarItemRef6, _this$toolbarItemRef7;
|
|
122
142
|
_this.hide(e);
|
|
123
|
-
(_this$
|
|
143
|
+
(_this$toolbarItemRef6 = _this.toolbarItemRef) === null || _this$toolbarItemRef6 === void 0 ? void 0 : (_this$toolbarItemRef7 = _this$toolbarItemRef6.current) === null || _this$toolbarItemRef7 === void 0 ? void 0 : _this$toolbarItemRef7.focus();
|
|
124
144
|
});
|
|
125
145
|
return _this;
|
|
126
146
|
}
|
|
@@ -128,7 +148,9 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
128
148
|
key: "render",
|
|
129
149
|
value: function render() {
|
|
130
150
|
var _this2 = this;
|
|
131
|
-
var
|
|
151
|
+
var _this$state = this.state,
|
|
152
|
+
isOpen = _this$state.isOpen,
|
|
153
|
+
isOpenedByKeyboard = _this$state.isOpenedByKeyboard;
|
|
132
154
|
var _this$props = this.props,
|
|
133
155
|
popupsMountPoint = _this$props.popupsMountPoint,
|
|
134
156
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
@@ -150,6 +172,9 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
150
172
|
fitWidth = 242;
|
|
151
173
|
}
|
|
152
174
|
var selectedColor = pluginState.color !== pluginState.defaultColor && pluginState.color;
|
|
175
|
+
var _getSelectedRowAndCol = getSelectedRowAndColumnFromPalette(palette, pluginState.color),
|
|
176
|
+
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
177
|
+
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
153
178
|
return jsx("span", {
|
|
154
179
|
css: wrapperStyle
|
|
155
180
|
}, jsx(Dropdown, {
|
|
@@ -163,6 +188,13 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
163
188
|
fitWidth: fitWidth,
|
|
164
189
|
onOpenChange: this.onOpenChange,
|
|
165
190
|
closeOnTab: true,
|
|
191
|
+
arrowKeyNavigationProviderOptions: {
|
|
192
|
+
type: ArrowKeyNavigationType.COLOR,
|
|
193
|
+
selectedRowIndex: selectedRowIndex,
|
|
194
|
+
selectedColumnIndex: selectedColumnIndex,
|
|
195
|
+
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
196
|
+
isPopupPositioned: true
|
|
197
|
+
},
|
|
166
198
|
trigger: jsx(ToolbarButton, {
|
|
167
199
|
buttonId: TOOLBAR_BUTTON.TEXT_COLOR,
|
|
168
200
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -173,6 +205,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
173
205
|
"aria-haspopup": true,
|
|
174
206
|
title: labelTextColor,
|
|
175
207
|
onClick: this.toggleOpen,
|
|
208
|
+
onKeyDown: this.onKeyDown,
|
|
176
209
|
ref: this.toolbarItemRef,
|
|
177
210
|
iconBefore: jsx("div", {
|
|
178
211
|
css: triggerWrapperStyles
|
|
@@ -195,6 +228,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
195
228
|
},
|
|
196
229
|
selectedColor: pluginState.color,
|
|
197
230
|
textPalette: true,
|
|
231
|
+
hexToPaletteColor: hexToEditorTextPaletteColor,
|
|
198
232
|
useSomewhatSemanticTextColorNames: useSomewhatSemanticTextColorNames
|
|
199
233
|
}))), jsx("span", {
|
|
200
234
|
css: separatorStyles
|