@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
|
@@ -274,7 +274,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
274
274
|
|
|
275
275
|
// We need to call this method on any prop change since attrs can get removed with collab editing
|
|
276
276
|
// the method internally checks if we already have all attrs
|
|
277
|
-
this.createMediaNodeUpdater(nextProps).
|
|
277
|
+
this.createMediaNodeUpdater(nextProps).updateMediaSingleFileAttrs();
|
|
278
278
|
}
|
|
279
279
|
}, {
|
|
280
280
|
key: "componentDidMount",
|
|
@@ -26,7 +26,7 @@ var _PanelTextInput = _interopRequireDefault(require("../../../../../ui/PanelTex
|
|
|
26
26
|
var keymaps = _interopRequireWildcard(require("../../../../../keymaps"));
|
|
27
27
|
var _commands = require("../commands");
|
|
28
28
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
29
|
-
var _analytics = require("
|
|
29
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
30
30
|
var _ToolbarComponents = require("../../../../../ui/LinkSearch/ToolbarComponents");
|
|
31
31
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
32
32
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
@@ -34,7 +34,6 @@ var helpers = _interopRequireWildcard(require("../commands/helpers"));
|
|
|
34
34
|
var _pluginKey = require("./plugin-key");
|
|
35
35
|
var _pickerFacade = _interopRequireDefault(require("../picker-facade"));
|
|
36
36
|
var _types = require("../../analytics/types");
|
|
37
|
-
var _isImage = require("../utils/is-image");
|
|
38
37
|
var _document = require("../../../utils/document");
|
|
39
38
|
var _mediaCommon2 = require("@atlaskit/media-common");
|
|
40
39
|
var _utils2 = require("../../../utils");
|
|
@@ -79,7 +78,6 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
79
78
|
(0, _defineProperty2.default)(this, "isFullscreen", false);
|
|
80
79
|
(0, _defineProperty2.default)(this, "layout", 'center');
|
|
81
80
|
(0, _defineProperty2.default)(this, "mediaNodes", []);
|
|
82
|
-
(0, _defineProperty2.default)(this, "mediaGroupNodes", {});
|
|
83
81
|
(0, _defineProperty2.default)(this, "destroyed", false);
|
|
84
82
|
(0, _defineProperty2.default)(this, "removeOnCloseListener", function () {});
|
|
85
83
|
(0, _defineProperty2.default)(this, "onPopupToggleCallback", function () {});
|
|
@@ -386,12 +384,12 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
386
384
|
}
|
|
387
385
|
return;
|
|
388
386
|
});
|
|
389
|
-
(0, _defineProperty2.default)(this, "
|
|
387
|
+
(0, _defineProperty2.default)(this, "updateMediaSingleNodeAttrs", function (id, attrs) {
|
|
390
388
|
var view = _this.view;
|
|
391
389
|
if (!view) {
|
|
392
390
|
return;
|
|
393
391
|
}
|
|
394
|
-
return (0, helpers.
|
|
392
|
+
return (0, helpers.updateMediaSingleNodeAttrs)(id, attrs)(view.state, view.dispatch);
|
|
395
393
|
});
|
|
396
394
|
(0, _defineProperty2.default)(this, "handleMediaState", function (state) {
|
|
397
395
|
switch (state.status) {
|
|
@@ -401,29 +399,6 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
401
399
|
uploadErrorHandler(state);
|
|
402
400
|
}
|
|
403
401
|
break;
|
|
404
|
-
case 'mobile-upload-end':
|
|
405
|
-
var attrs = {
|
|
406
|
-
id: state.publicId || state.id
|
|
407
|
-
};
|
|
408
|
-
if (typeof state.collection === 'string') {
|
|
409
|
-
attrs.collection = state.collection;
|
|
410
|
-
}
|
|
411
|
-
_this.updateMediaNodeAttrs(state.id, attrs, (0, _mediaSingle.isMediaSingle)(_this.view.state.schema, state.fileMimeType));
|
|
412
|
-
delete _this.mediaGroupNodes[state.id];
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
(0, _defineProperty2.default)(this, "setMediaGroupNode", function (node, getPos) {
|
|
417
|
-
_this.mediaGroupNodes[node.attrs.id] = {
|
|
418
|
-
node: node,
|
|
419
|
-
getPos: getPos
|
|
420
|
-
};
|
|
421
|
-
});
|
|
422
|
-
(0, _defineProperty2.default)(this, "removeNodeById", function (state) {
|
|
423
|
-
var id = state.id;
|
|
424
|
-
var mediaNodeWithPos = helpers.findMediaNode(_this, id, (0, _isImage.isImage)(state.fileMimeType));
|
|
425
|
-
if (mediaNodeWithPos) {
|
|
426
|
-
(0, _mediaCommon.removeMediaNode)(_this.view, mediaNodeWithPos.node, mediaNodeWithPos.getPos);
|
|
427
402
|
}
|
|
428
403
|
});
|
|
429
404
|
(0, _defineProperty2.default)(this, "removeSelectedMediaContainer", function () {
|
|
@@ -31,9 +31,6 @@ var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
31
31
|
};
|
|
32
32
|
var renderMediaViewer = function renderMediaViewer() {
|
|
33
33
|
if (isMediaViewerVisible) {
|
|
34
|
-
var dataSource = {
|
|
35
|
-
list: []
|
|
36
|
-
};
|
|
37
34
|
var selectedNodeAttrs = (0, _utils.getSelectedMediaContainerNodeAttrs)(mediaPluginState);
|
|
38
35
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig) {
|
|
39
36
|
var id = selectedNodeAttrs.id,
|
|
@@ -46,7 +43,7 @@ var FilePreviewItem = function FilePreviewItem(_ref) {
|
|
|
46
43
|
};
|
|
47
44
|
return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_mediaViewer.MediaViewer, {
|
|
48
45
|
collectionName: collection,
|
|
49
|
-
|
|
46
|
+
items: [],
|
|
50
47
|
mediaClientConfig: mediaPluginState.mediaClientConfig,
|
|
51
48
|
selectedItem: identifier,
|
|
52
49
|
onClose: onMediaViewerClose
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
var _panel = require("@atlaskit/editor-common/panel");
|
|
12
|
+
var _editorPalette = require("@atlaskit/editor-palette");
|
|
12
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
14
|
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) { (0, _defineProperty2.default)(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; }
|
|
14
15
|
var findPanel = function findPanel(state, selection) {
|
|
@@ -24,7 +25,9 @@ var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
|
|
|
24
25
|
panelIconText = attrs.panelIconText;
|
|
25
26
|
var isCustomPanel = panelType === _adfSchema.PanelType.CUSTOM && allowCustomPanel;
|
|
26
27
|
var hasIcon = !isCustomPanel || !!panelIcon || !!panelIconId;
|
|
27
|
-
var
|
|
28
|
+
var tokenColor = panelColor && (0, _editorPalette.hexToEditorBackgroundPaletteColor)(panelColor);
|
|
29
|
+
var panelBackgroundColor = tokenColor || panelColor;
|
|
30
|
+
var style = ["".concat(panelColor && isCustomPanel ? "background-color: ".concat(panelBackgroundColor, ";") : ''), "".concat(hasIcon ? '' : 'padding-left: 12px;')].join('');
|
|
28
31
|
var panelAttrs = {
|
|
29
32
|
class: _panel.PanelSharedCssClassName.prefix,
|
|
30
33
|
'data-panel-type': panelType || _adfSchema.PanelType.INFO,
|
|
@@ -16,7 +16,8 @@ exports.handlePasteAsPlainText = handlePasteAsPlainText;
|
|
|
16
16
|
exports.handlePasteIntoCaption = handlePasteIntoCaption;
|
|
17
17
|
exports.handlePasteIntoTaskOrDecisionOrPanel = handlePasteIntoTaskOrDecisionOrPanel;
|
|
18
18
|
exports.handlePasteLinkOnSelectedText = handlePasteLinkOnSelectedText;
|
|
19
|
-
exports.
|
|
19
|
+
exports.handlePasteNonNestableBlockNodesIntoList = handlePasteNonNestableBlockNodesIntoList;
|
|
20
|
+
exports.handlePastePanelOrDecisionContentIntoList = handlePastePanelOrDecisionContentIntoList;
|
|
20
21
|
exports.handlePastePreservingMarks = handlePastePreservingMarks;
|
|
21
22
|
exports.handleRichText = handleRichText;
|
|
22
23
|
exports.handleSelectedTable = void 0;
|
|
@@ -131,23 +132,137 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
131
132
|
return true;
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
136
|
+
return function (state, dispatch) {
|
|
137
|
+
var _tr$doc$nodeAt, _sliceContent$firstCh, _findParentNodeOfType;
|
|
138
|
+
var tr = state.tr;
|
|
139
|
+
var selection = tr.selection;
|
|
140
|
+
var $from = selection.$from,
|
|
141
|
+
$to = selection.$to,
|
|
142
|
+
from = selection.from,
|
|
143
|
+
to = selection.to;
|
|
144
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
145
|
+
orderedList = _state$schema$nodes.orderedList,
|
|
146
|
+
bulletList = _state$schema$nodes.bulletList,
|
|
147
|
+
listItem = _state$schema$nodes.listItem;
|
|
148
|
+
|
|
149
|
+
// Selected nodes
|
|
150
|
+
var selectionParentListItemNode = (0, _prosemirrorUtils.findParentNodeOfType)(listItem)(selection);
|
|
151
|
+
var selectionParentListNodeWithPos = (0, _prosemirrorUtils.findParentNodeOfType)([bulletList, orderedList])(selection);
|
|
152
|
+
var selectionParentListNode = selectionParentListNodeWithPos === null || selectionParentListNodeWithPos === void 0 ? void 0 : selectionParentListNodeWithPos.node;
|
|
153
|
+
|
|
154
|
+
// Slice info
|
|
155
|
+
var sliceContent = slice.content;
|
|
156
|
+
var sliceIsListItems = (0, _node.isListNode)(sliceContent.firstChild) && (0, _node.isListNode)(sliceContent.lastChild);
|
|
157
|
+
|
|
158
|
+
// Find case of slices that can be inserted into a list item
|
|
159
|
+
// (eg. paragraphs, list items, code blocks, media single)
|
|
160
|
+
// These scenarios already get handled elsewhere and don't need to split the list
|
|
161
|
+
var sliceContainsBlockNodesOtherThanThoseAllowedInListItem = false;
|
|
162
|
+
slice.content.forEach(function (child) {
|
|
163
|
+
if (child.isBlock && !listItem.spec.content.includes(child.type.name)) {
|
|
164
|
+
sliceContainsBlockNodesOtherThanThoseAllowedInListItem = true;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
if (!selectionParentListItemNode || !sliceContent || (0, _prosemirrorUtils.canInsert)($from, sliceContent) ||
|
|
168
|
+
// eg. inline nodes that can be inserted in a list item
|
|
169
|
+
!sliceContainsBlockNodesOtherThanThoseAllowedInListItem || sliceIsListItems || !selectionParentListNodeWithPos) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Offsets
|
|
174
|
+
var listWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth + 1; // difference in depth between to position and list node
|
|
175
|
+
var listItemWrappingOffset = $to.depth - selectionParentListNodeWithPos.depth; // difference in depth between to position and list item node
|
|
176
|
+
|
|
177
|
+
// Anything to do with nested lists should safeInsert and not be handled here
|
|
178
|
+
var grandParentListNode = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)(tr.doc.resolve(selectionParentListNodeWithPos.pos), [bulletList, orderedList]);
|
|
179
|
+
var selectionIsInNestedList = !!grandParentListNode;
|
|
180
|
+
var selectedListItemHasNestedList = false;
|
|
181
|
+
selectionParentListItemNode.node.content.forEach(function (child) {
|
|
182
|
+
if ((0, _node.isListNode)(child)) {
|
|
183
|
+
selectedListItemHasNestedList = true;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
if (selectedListItemHasNestedList || selectionIsInNestedList) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Node after the insert position
|
|
191
|
+
var nodeAfterInsertPositionIsListItem = ((_tr$doc$nodeAt = tr.doc.nodeAt(to + listItemWrappingOffset)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.type.name) === 'listItem';
|
|
192
|
+
|
|
193
|
+
// Get the next list items position (used later to find the split out ordered list)
|
|
194
|
+
var indexOfNextListItem = $to.indexAfter($to.depth - listItemWrappingOffset);
|
|
195
|
+
var positionOfNextListItem = tr.doc.resolve(selectionParentListNodeWithPos.pos + 1).posAtIndex(indexOfNextListItem);
|
|
196
|
+
|
|
197
|
+
// These nodes paste as plain text by default so need to be handled differently
|
|
198
|
+
var sliceContainsNodeThatPastesAsPlainText = sliceContent.firstChild && ['taskItem', 'taskList', 'heading', 'blockquote'].includes(sliceContent.firstChild.type.name);
|
|
199
|
+
|
|
200
|
+
// Work out position to replace up to
|
|
201
|
+
var replaceTo;
|
|
202
|
+
if (sliceContainsNodeThatPastesAsPlainText && nodeAfterInsertPositionIsListItem) {
|
|
203
|
+
replaceTo = to + listItemWrappingOffset;
|
|
204
|
+
} else if (sliceContainsNodeThatPastesAsPlainText || !nodeAfterInsertPositionIsListItem) {
|
|
205
|
+
replaceTo = to;
|
|
206
|
+
} else {
|
|
207
|
+
replaceTo = to + listWrappingOffset;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// handle the insertion of the slice
|
|
211
|
+
if (sliceContainsNodeThatPastesAsPlainText || nodeAfterInsertPositionIsListItem || sliceContent.childCount > 1 && ((_sliceContent$firstCh = sliceContent.firstChild) === null || _sliceContent$firstCh === void 0 ? void 0 : _sliceContent$firstCh.type.name) !== 'paragraph') {
|
|
212
|
+
tr.replaceWith(from, replaceTo, sliceContent).scrollIntoView();
|
|
213
|
+
} else {
|
|
214
|
+
// When the selection is not at the end of a list item
|
|
215
|
+
// eg. middle of list item, start of list item
|
|
216
|
+
tr.replaceSelection(slice).scrollIntoView();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Find the ordered list node after the pasted content so we can set it's order
|
|
220
|
+
var mappedPositionOfNextListItem = tr.mapping.map(positionOfNextListItem);
|
|
221
|
+
if (mappedPositionOfNextListItem > tr.doc.nodeSize) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
var nodeAfterPastedContentResolvedPos = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)(tr.doc.resolve(mappedPositionOfNextListItem), [orderedList]);
|
|
225
|
+
|
|
226
|
+
// Work out the new split out lists 'order' (the number it starts from)
|
|
227
|
+
var originalParentOrderedListNodeOrder = selectionParentListNode === null || selectionParentListNode === void 0 ? void 0 : selectionParentListNode.attrs.order;
|
|
228
|
+
var numOfListItemsInOriginalList = (_findParentNodeOfType = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)(tr.doc.resolve(from - 1), [orderedList])) === null || _findParentNodeOfType === void 0 ? void 0 : _findParentNodeOfType.node.childCount;
|
|
229
|
+
|
|
230
|
+
// Set the new split out lists order attribute
|
|
231
|
+
if (typeof originalParentOrderedListNodeOrder === 'number' && numOfListItemsInOriginalList && nodeAfterPastedContentResolvedPos) {
|
|
232
|
+
tr.setNodeMarkup(nodeAfterPastedContentResolvedPos.pos, orderedList, _objectSpread(_objectSpread({}, nodeAfterPastedContentResolvedPos.node.attrs), {}, {
|
|
233
|
+
order: originalParentOrderedListNodeOrder + numOfListItemsInOriginalList
|
|
234
|
+
}));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// dispatch transaction
|
|
238
|
+
if (tr.docChanged) {
|
|
239
|
+
if (dispatch) {
|
|
240
|
+
dispatch(tr);
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function handlePastePanelOrDecisionContentIntoList(slice) {
|
|
135
248
|
return function (state, dispatch) {
|
|
136
249
|
var schema = state.schema,
|
|
137
250
|
tr = state.tr;
|
|
138
251
|
var selection = tr.selection;
|
|
139
252
|
// Check this pasting action is related to copy content from panel node into a selected the list node
|
|
140
|
-
var
|
|
253
|
+
var blockNode = slice.content.firstChild;
|
|
141
254
|
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
142
255
|
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
143
256
|
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !(0, _lists.doesSelectionWhichStartsOrEndsInListContainEntireList)(selection);
|
|
144
|
-
if (!
|
|
257
|
+
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) {
|
|
145
258
|
return false;
|
|
146
259
|
}
|
|
147
260
|
|
|
148
261
|
// Paste the panel node contents extracted instead of pasting the entire panel node
|
|
149
262
|
tr.replaceSelection(slice).scrollIntoView();
|
|
150
|
-
dispatch
|
|
263
|
+
if (dispatch) {
|
|
264
|
+
dispatch(tr);
|
|
265
|
+
}
|
|
151
266
|
return true;
|
|
152
267
|
};
|
|
153
268
|
}
|
|
@@ -456,9 +571,9 @@ function handleExpandPasteInTable(slice) {
|
|
|
456
571
|
if (!(0, _utils2.insideTable)(state) || !checkExpand(slice)) {
|
|
457
572
|
return false;
|
|
458
573
|
}
|
|
459
|
-
var _state$schema$
|
|
460
|
-
expand = _state$schema$
|
|
461
|
-
nestedExpand = _state$schema$
|
|
574
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
575
|
+
expand = _state$schema$nodes2.expand,
|
|
576
|
+
nestedExpand = _state$schema$nodes2.nestedExpand;
|
|
462
577
|
var tr = state.tr;
|
|
463
578
|
var hasExpand = false;
|
|
464
579
|
var newSlice = (0, _slice.mapSlice)(slice, function (maybeNode) {
|
|
@@ -653,11 +768,11 @@ function flattenNestedListInSlice(slice) {
|
|
|
653
768
|
function handleRichText(slice) {
|
|
654
769
|
return function (state, dispatch) {
|
|
655
770
|
var _slice$content, _slice$content2, _panelParentOverCurre;
|
|
656
|
-
var _state$schema$
|
|
657
|
-
codeBlock = _state$schema$
|
|
658
|
-
heading = _state$schema$
|
|
659
|
-
paragraph = _state$schema$
|
|
660
|
-
panel = _state$schema$
|
|
771
|
+
var _state$schema$nodes3 = state.schema.nodes,
|
|
772
|
+
codeBlock = _state$schema$nodes3.codeBlock,
|
|
773
|
+
heading = _state$schema$nodes3.heading,
|
|
774
|
+
paragraph = _state$schema$nodes3.paragraph,
|
|
775
|
+
panel = _state$schema$nodes3.panel;
|
|
661
776
|
var selection = state.selection,
|
|
662
777
|
schema = state.schema;
|
|
663
778
|
var firstChildOfSlice = (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.firstChild;
|
|
@@ -9,7 +9,7 @@ exports.createPasteMeasurePayload = void 0;
|
|
|
9
9
|
exports.getContent = getContent;
|
|
10
10
|
exports.getContentNodeTypes = void 0;
|
|
11
11
|
exports.getMediaTraceId = getMediaTraceId;
|
|
12
|
-
exports.handleSelectedTableWithAnalytics = exports.handleRichTextWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = exports.
|
|
12
|
+
exports.handleSelectedTableWithAnalytics = exports.handleRichTextWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = exports.handlePastePanelOrDecisionIntoListWithAnalytics = exports.handlePasteNonNestableBlockNodesIntoListWithAnalytics = exports.handlePasteLinkOnSelectedTextWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoCaptionWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = exports.handleMediaSingleWithAnalytics = exports.handleMarkdownWithAnalytics = exports.handleExpandWithAnalytics = exports.handleCodeBlockWithAnalytics = void 0;
|
|
13
13
|
exports.pasteCommandWithAnalytics = pasteCommandWithAnalytics;
|
|
14
14
|
exports.sendPasteAnalyticsEvent = sendPasteAnalyticsEvent;
|
|
15
15
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -191,7 +191,8 @@ function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
191
191
|
content: _analytics.PasteContents.text,
|
|
192
192
|
source: source,
|
|
193
193
|
hyperlinkPasteOnText: false,
|
|
194
|
-
linksInPasteCount: linkUrls.length
|
|
194
|
+
linksInPasteCount: linkUrls.length,
|
|
195
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
195
196
|
});
|
|
196
197
|
}
|
|
197
198
|
var linkDomains = linkUrls.map(_utils2.getLinkDomain);
|
|
@@ -202,7 +203,8 @@ function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
|
|
|
202
203
|
source: source,
|
|
203
204
|
hyperlinkPasteOnText: !!pasteContext.hyperlinkPasteOnText,
|
|
204
205
|
linksInPasteCount: linkUrls.length,
|
|
205
|
-
mediaTraceId: mediaTraceId
|
|
206
|
+
mediaTraceId: mediaTraceId,
|
|
207
|
+
pasteSplitList: pasteContext.pasteSplitList
|
|
206
208
|
}, linkDomains);
|
|
207
209
|
}
|
|
208
210
|
|
|
@@ -267,12 +269,19 @@ var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, eve
|
|
|
267
269
|
}))(slice);
|
|
268
270
|
};
|
|
269
271
|
exports.handleRichTextWithAnalytics = handleRichTextWithAnalytics;
|
|
270
|
-
var
|
|
271
|
-
return (0, _utils.pipe)(_handlers.
|
|
272
|
+
var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice) {
|
|
273
|
+
return (0, _utils.pipe)(_handlers.handlePastePanelOrDecisionContentIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
272
274
|
type: _analytics.PasteTypes.richText
|
|
273
275
|
}))(slice);
|
|
274
276
|
};
|
|
275
|
-
exports.
|
|
277
|
+
exports.handlePastePanelOrDecisionIntoListWithAnalytics = handlePastePanelOrDecisionIntoListWithAnalytics;
|
|
278
|
+
var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice) {
|
|
279
|
+
return (0, _utils.pipe)(_handlers.handlePasteNonNestableBlockNodesIntoList, pasteCommandWithAnalytics(view, event, slice, {
|
|
280
|
+
type: _analytics.PasteTypes.richText,
|
|
281
|
+
pasteSplitList: true
|
|
282
|
+
}))(slice);
|
|
283
|
+
};
|
|
284
|
+
exports.handlePasteNonNestableBlockNodesIntoListWithAnalytics = handlePasteNonNestableBlockNodesIntoListWithAnalytics;
|
|
276
285
|
var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
|
|
277
286
|
return (0, _utils.pipe)(_handlers.handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
|
|
278
287
|
type: _analytics.PasteTypes.richText
|
|
@@ -49,6 +49,7 @@ var _tinyMCE = require("../util/tinyMCE");
|
|
|
49
49
|
var _utils9 = require("@atlaskit/editor-tables/utils");
|
|
50
50
|
var _step = require("../../../utils/step");
|
|
51
51
|
var _pluginFactory = require("./plugin-factory");
|
|
52
|
+
var _featureFlagsContext = require("../../feature-flags-context");
|
|
52
53
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
54
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
54
55
|
_analytics.sendPasteAnalyticsEvent;
|
|
@@ -56,9 +57,13 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptions, san
|
|
|
56
57
|
var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _md.md);
|
|
57
58
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
58
59
|
var textInput = text;
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
var textSplitByCodeBlock = textInput.split(/```/);
|
|
61
|
+
for (var i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
62
|
+
if (i % 2 === 0) {
|
|
63
|
+
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
64
|
+
}
|
|
61
65
|
}
|
|
66
|
+
textInput = textSplitByCodeBlock.join('```');
|
|
62
67
|
var doc = atlassianMarkDownParser.parse((0, _util.escapeLinks)(textInput));
|
|
63
68
|
if (doc && doc.content) {
|
|
64
69
|
return new _prosemirrorModel.Slice(doc.content, openStart, openEnd);
|
|
@@ -370,7 +375,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, cardOptions, san
|
|
|
370
375
|
if ((0, _analytics.handlePasteIntoCaptionWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
371
376
|
return true;
|
|
372
377
|
}
|
|
373
|
-
|
|
378
|
+
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
379
|
+
if ((0, _analytics.handlePastePanelOrDecisionIntoListWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && (0, _analytics.handlePasteNonNestableBlockNodesIntoListWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
374
383
|
return true;
|
|
375
384
|
}
|
|
376
385
|
return (0, _analytics.handleRichTextWithAnalytics)(view, event, slice)(state, dispatch);
|
|
@@ -232,8 +232,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
232
232
|
};
|
|
233
233
|
return plugin;
|
|
234
234
|
};
|
|
235
|
-
var placeholderTextPlugin = function placeholderTextPlugin(options) {
|
|
236
|
-
return decorateWithPluginOptions(basePlaceholderTextPlugin(options), options);
|
|
235
|
+
var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
|
|
236
|
+
return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
|
|
237
237
|
};
|
|
238
238
|
var _default = placeholderTextPlugin;
|
|
239
239
|
exports.default = _default;
|
|
@@ -38,7 +38,10 @@ var baseStatusPlugin = function baseStatusPlugin(options) {
|
|
|
38
38
|
}];
|
|
39
39
|
},
|
|
40
40
|
contentComponent: function contentComponent(_ref) {
|
|
41
|
-
var editorView = _ref.editorView
|
|
41
|
+
var editorView = _ref.editorView,
|
|
42
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
43
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
44
|
+
popupsScrollableElement = _ref.popupsScrollableElement;
|
|
42
45
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
43
46
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
44
47
|
plugins: {
|
|
@@ -66,6 +69,9 @@ var baseStatusPlugin = function baseStatusPlugin(options) {
|
|
|
66
69
|
defaultText: text,
|
|
67
70
|
defaultColor: color,
|
|
68
71
|
defaultLocalId: localId,
|
|
72
|
+
mountTo: popupsMountPoint,
|
|
73
|
+
boundariesElement: popupsBoundariesElement,
|
|
74
|
+
scrollableElement: popupsScrollableElement,
|
|
69
75
|
onSelect: function onSelect(status) {
|
|
70
76
|
(0, _actions.updateStatus)(status)(editorView.state, editorView.dispatch);
|
|
71
77
|
},
|
|
@@ -116,8 +122,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
116
122
|
};
|
|
117
123
|
return plugin;
|
|
118
124
|
};
|
|
119
|
-
var statusPlugin = function statusPlugin(options) {
|
|
120
|
-
return decorateWithPluginOptions(baseStatusPlugin(options), options);
|
|
125
|
+
var statusPlugin = function statusPlugin(options, api) {
|
|
126
|
+
return decorateWithPluginOptions(baseStatusPlugin(options, api), options);
|
|
121
127
|
};
|
|
122
128
|
var _default = statusPlugin;
|
|
123
129
|
exports.default = _default;
|
|
@@ -206,7 +206,10 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
|
|
|
206
206
|
value: function render() {
|
|
207
207
|
var _this$props = this.props,
|
|
208
208
|
isNew = _this$props.isNew,
|
|
209
|
-
target = _this$props.target
|
|
209
|
+
target = _this$props.target,
|
|
210
|
+
mountTo = _this$props.mountTo,
|
|
211
|
+
boundariesElement = _this$props.boundariesElement,
|
|
212
|
+
scrollableElement = _this$props.scrollableElement;
|
|
210
213
|
var _this$state3 = this.state,
|
|
211
214
|
color = _this$state3.color,
|
|
212
215
|
text = _this$state3.text;
|
|
@@ -216,7 +219,10 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
|
|
|
216
219
|
handleClickOutside: this.handleClickOutside,
|
|
217
220
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
218
221
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
219
|
-
fitHeight: 40
|
|
222
|
+
fitHeight: 40,
|
|
223
|
+
mountTo: mountTo,
|
|
224
|
+
boundariesElement: boundariesElement,
|
|
225
|
+
scrollableElement: scrollableElement
|
|
220
226
|
}, (0, _react2.jsx)("div", {
|
|
221
227
|
css: pickerContainer,
|
|
222
228
|
onClick: this.handlePopupClick
|
|
@@ -16,6 +16,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _react2 = require("@emotion/react");
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
|
+
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
20
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
21
|
+
var _editorPalette = require("@atlaskit/editor-palette");
|
|
19
22
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
20
23
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
21
24
|
var _ColorPalette = _interopRequireDefault(require("../../../../ui/ColorPalette"));
|
|
@@ -54,7 +57,8 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
54
57
|
}
|
|
55
58
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
56
59
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
57
|
-
isOpen: false
|
|
60
|
+
isOpen: false,
|
|
61
|
+
isOpenedByKeyboard: false
|
|
58
62
|
});
|
|
59
63
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toolbarItemRef", /*#__PURE__*/_react.default.createRef());
|
|
60
64
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeColor", function (color) {
|
|
@@ -68,6 +72,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeTextColor", function (color, disabled) {
|
|
75
|
+
var _this$toolbarItemRef, _this$toolbarItemRef$;
|
|
71
76
|
if (!disabled) {
|
|
72
77
|
var _this$props$editorVie;
|
|
73
78
|
var palette = _this.props.pluginState.palette;
|
|
@@ -87,6 +92,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
87
92
|
//To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
|
|
88
93
|
(_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
|
|
89
94
|
}
|
|
95
|
+
(_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();
|
|
90
96
|
return false;
|
|
91
97
|
});
|
|
92
98
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
|
|
@@ -95,6 +101,15 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
95
101
|
logCloseEvent: true
|
|
96
102
|
});
|
|
97
103
|
});
|
|
104
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
|
|
105
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
_this.setState({
|
|
108
|
+
isOpenedByKeyboard: true
|
|
109
|
+
});
|
|
110
|
+
_this.toggleOpen();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
98
113
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenChange", function (_ref) {
|
|
99
114
|
var isOpen = _ref.isOpen,
|
|
100
115
|
logCloseEvent = _ref.logCloseEvent,
|
|
@@ -102,14 +117,19 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
102
117
|
_this.setState({
|
|
103
118
|
isOpen: isOpen
|
|
104
119
|
});
|
|
120
|
+
if (!isOpen) {
|
|
121
|
+
_this.setState({
|
|
122
|
+
isOpenedByKeyboard: false
|
|
123
|
+
});
|
|
124
|
+
}
|
|
105
125
|
if (logCloseEvent) {
|
|
106
126
|
_this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(isOpen ? _analytics.ACTION.OPENED : _analytics.ACTION.CLOSED, {
|
|
107
127
|
noSelect: isOpen === false
|
|
108
128
|
}));
|
|
109
129
|
}
|
|
110
130
|
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
111
|
-
var _this$
|
|
112
|
-
(_this$
|
|
131
|
+
var _this$toolbarItemRef2, _this$toolbarItemRef3;
|
|
132
|
+
(_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();
|
|
113
133
|
}
|
|
114
134
|
});
|
|
115
135
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function (e) {
|
|
@@ -122,15 +142,15 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
122
142
|
isOpen: false
|
|
123
143
|
});
|
|
124
144
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
125
|
-
var _this$
|
|
126
|
-
(_this$
|
|
145
|
+
var _this$toolbarItemRef4, _this$toolbarItemRef5;
|
|
146
|
+
(_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();
|
|
127
147
|
}
|
|
128
148
|
}
|
|
129
149
|
});
|
|
130
150
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideonEsc", function (e) {
|
|
131
|
-
var _this$
|
|
151
|
+
var _this$toolbarItemRef6, _this$toolbarItemRef7;
|
|
132
152
|
_this.hide(e);
|
|
133
|
-
(_this$
|
|
153
|
+
(_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();
|
|
134
154
|
});
|
|
135
155
|
return _this;
|
|
136
156
|
}
|
|
@@ -138,7 +158,9 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
138
158
|
key: "render",
|
|
139
159
|
value: function render() {
|
|
140
160
|
var _this2 = this;
|
|
141
|
-
var
|
|
161
|
+
var _this$state = this.state,
|
|
162
|
+
isOpen = _this$state.isOpen,
|
|
163
|
+
isOpenedByKeyboard = _this$state.isOpenedByKeyboard;
|
|
142
164
|
var _this$props = this.props,
|
|
143
165
|
popupsMountPoint = _this$props.popupsMountPoint,
|
|
144
166
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
@@ -160,6 +182,9 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
160
182
|
fitWidth = 242;
|
|
161
183
|
}
|
|
162
184
|
var selectedColor = pluginState.color !== pluginState.defaultColor && pluginState.color;
|
|
185
|
+
var _getSelectedRowAndCol = (0, _uiColor.getSelectedRowAndColumnFromPalette)(palette, pluginState.color),
|
|
186
|
+
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
187
|
+
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
163
188
|
return (0, _react2.jsx)("span", {
|
|
164
189
|
css: _styles.wrapperStyle
|
|
165
190
|
}, (0, _react2.jsx)(_Dropdown.default, {
|
|
@@ -173,6 +198,13 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
173
198
|
fitWidth: fitWidth,
|
|
174
199
|
onOpenChange: this.onOpenChange,
|
|
175
200
|
closeOnTab: true,
|
|
201
|
+
arrowKeyNavigationProviderOptions: {
|
|
202
|
+
type: _uiMenu.ArrowKeyNavigationType.COLOR,
|
|
203
|
+
selectedRowIndex: selectedRowIndex,
|
|
204
|
+
selectedColumnIndex: selectedColumnIndex,
|
|
205
|
+
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
206
|
+
isPopupPositioned: true
|
|
207
|
+
},
|
|
176
208
|
trigger: (0, _react2.jsx)(_ToolbarButton.default, {
|
|
177
209
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.TEXT_COLOR,
|
|
178
210
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -183,6 +215,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
183
215
|
"aria-haspopup": true,
|
|
184
216
|
title: labelTextColor,
|
|
185
217
|
onClick: this.toggleOpen,
|
|
218
|
+
onKeyDown: this.onKeyDown,
|
|
186
219
|
ref: this.toolbarItemRef,
|
|
187
220
|
iconBefore: (0, _react2.jsx)("div", {
|
|
188
221
|
css: _styles.triggerWrapperStyles
|
|
@@ -205,6 +238,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
205
238
|
},
|
|
206
239
|
selectedColor: pluginState.color,
|
|
207
240
|
textPalette: true,
|
|
241
|
+
hexToPaletteColor: _editorPalette.hexToEditorTextPaletteColor,
|
|
208
242
|
useSomewhatSemanticTextColorNames: useSomewhatSemanticTextColorNames
|
|
209
243
|
}))), (0, _react2.jsx)("span", {
|
|
210
244
|
css: _styles.separatorStyles
|