@atlaskit/editor-core 179.1.2 → 180.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
- package/dist/cjs/actions/index.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +12 -762
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +35 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
- package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
- package/dist/cjs/editor-next/index.js +139 -0
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
- package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
- package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
- package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
- package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
- package/dist/cjs/editor.js +130 -443
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
- package/dist/cjs/labs/next/presets/preset.js +0 -5
- package/dist/cjs/labs/next/presets/universal.js +11 -2
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/cjs/plugins/analytics/index.js +2 -3
- package/dist/cjs/plugins/analytics/plugin.js +5 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
- package/dist/cjs/plugins/hyperlink/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/cjs/plugins/media/commands/helpers.js +12 -40
- package/dist/cjs/plugins/media/commands/index.js +4 -4
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/cjs/plugins/panel/utils.js +4 -1
- package/dist/cjs/plugins/paste/handlers.js +128 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/cjs/plugins/text-formatting/utils.js +1 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/types/get-editor-props.js +5 -0
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ContextPanel/context.js +13 -12
- package/dist/cjs/ui/Dropdown/index.js +7 -2
- package/dist/cjs/ui/DropdownMenu/index.js +7 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +32 -0
- package/dist/cjs/utils/linking-utils.js +1 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
- package/dist/cjs/utils/performance/safer-transactions.js +1 -1
- package/dist/cjs/utils/prepare-extension-provider.js +25 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -2
- package/dist/es2019/create-editor/ReactEditorView.js +6 -708
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -0
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +10 -0
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
- package/dist/es2019/editor-next/index.js +90 -0
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
- package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
- package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
- package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
- package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
- package/dist/es2019/editor.js +111 -396
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
- package/dist/es2019/labs/next/presets/preset.js +0 -3
- package/dist/es2019/labs/next/presets/universal.js +13 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
- package/dist/es2019/plugins/analytics/index.js +3 -4
- package/dist/es2019/plugins/analytics/plugin.js +1 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
- package/dist/es2019/plugins/hyperlink/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
- package/dist/es2019/plugins/media/commands/helpers.js +9 -35
- package/dist/es2019/plugins/media/commands/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/es2019/plugins/text-formatting/utils.js +0 -8
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/types/get-editor-props.js +1 -0
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ContextPanel/context.js +5 -4
- package/dist/es2019/ui/Dropdown/index.js +5 -2
- package/dist/es2019/ui/DropdownMenu/index.js +5 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +25 -0
- package/dist/es2019/utils/linking-utils.js +1 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
- package/dist/es2019/utils/performance/safer-transactions.js +1 -1
- package/dist/es2019/utils/prepare-extension-provider.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -2
- package/dist/esm/create-editor/ReactEditorView.js +12 -763
- package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -0
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +28 -0
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
- package/dist/esm/editor-next/index.js +134 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
- package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
- package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/esm/editor-next/utils/handleProviders.js +50 -0
- package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
- package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
- package/dist/esm/editor.js +130 -440
- package/dist/esm/index.js +2 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
- package/dist/esm/labs/next/presets/preset.js +0 -5
- package/dist/esm/labs/next/presets/universal.js +11 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/esm/plugins/analytics/index.js +3 -4
- package/dist/esm/plugins/analytics/plugin.js +1 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/hyperlink/analytics.js +1 -1
- package/dist/esm/plugins/hyperlink/index.js +1 -1
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/esm/plugins/media/commands/helpers.js +9 -35
- package/dist/esm/plugins/media/commands/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/esm/plugins/text-formatting/utils.js +0 -8
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/types/get-editor-props.js +1 -0
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPickerButton/index.js +69 -7
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ContextPanel/context.js +8 -8
- package/dist/esm/ui/Dropdown/index.js +7 -2
- package/dist/esm/ui/DropdownMenu/index.js +7 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +25 -0
- package/dist/esm/utils/linking-utils.js +1 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
- package/dist/esm/utils/performance/safer-transactions.js +1 -1
- package/dist/esm/utils/prepare-extension-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
- package/dist/types/editor-next/editor-internal.d.ts +44 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
- package/dist/types/editor-next/index.d.ts +34 -0
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
- package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
- package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
- package/dist/types/editor.d.ts +47 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
- package/dist/types/labs/next/presets/preset.d.ts +6 -6
- package/dist/types/labs/next/presets/universal.d.ts +1 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
- package/dist/types/plugins/analytics/index.d.ts +3 -6
- package/dist/types/plugins/analytics/plugin.d.ts +3 -1
- package/dist/types/plugins/analytics/utils.d.ts +2 -3
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -1
- package/dist/types/plugins/base/index.d.ts +3 -1
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
- package/dist/types/plugins/block-type/index.d.ts +3 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/breakout/index.d.ts +3 -1
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/context-panel/index.d.ts +1 -1
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +3 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
- package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/hyperlink/types.d.ts +3 -1
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types/plugins/layout/index.d.ts +3 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/max-content-size/index.d.ts +3 -1
- package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
- package/dist/types/plugins/media/commands/index.d.ts +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
- package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +3 -1
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
- package/dist/types/plugins/placeholder/index.d.ts +3 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/plugins/quick-insert/index.d.ts +3 -1
- package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
- package/dist/types/plugins/selection/index.d.ts +3 -1
- package/dist/types/plugins/status/index.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
- package/dist/types/plugins/submit-editor/index.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/index.d.ts +3 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/types/get-editor-props.d.ts +12 -0
- package/dist/types/types/performance-tracking.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/utils/document.d.ts +4 -3
- package/dist/types/utils/get-editor-plugins.d.ts +10 -0
- package/dist/types/utils/linking-utils.d.ts +1 -1
- package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
- package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
- package/docs/0-intro.tsx +0 -1
- package/package.json +27 -26
- package/report.api.md +193 -139
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
- package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
|
@@ -210,5 +210,5 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
210
210
|
};
|
|
211
211
|
return plugin;
|
|
212
212
|
};
|
|
213
|
-
const placeholderTextPlugin = options => decorateWithPluginOptions(basePlaceholderTextPlugin(options), options);
|
|
213
|
+
const placeholderTextPlugin = (options, api) => decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
|
|
214
214
|
export default placeholderTextPlugin;
|
|
@@ -28,7 +28,10 @@ const baseStatusPlugin = options => ({
|
|
|
28
28
|
}];
|
|
29
29
|
},
|
|
30
30
|
contentComponent({
|
|
31
|
-
editorView
|
|
31
|
+
editorView,
|
|
32
|
+
popupsMountPoint,
|
|
33
|
+
popupsBoundariesElement,
|
|
34
|
+
popupsScrollableElement
|
|
32
35
|
}) {
|
|
33
36
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
34
37
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
@@ -60,6 +63,9 @@ const baseStatusPlugin = options => ({
|
|
|
60
63
|
defaultText: text,
|
|
61
64
|
defaultColor: color,
|
|
62
65
|
defaultLocalId: localId,
|
|
66
|
+
mountTo: popupsMountPoint,
|
|
67
|
+
boundariesElement: popupsBoundariesElement,
|
|
68
|
+
scrollableElement: popupsScrollableElement,
|
|
63
69
|
onSelect: status => {
|
|
64
70
|
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
65
71
|
},
|
|
@@ -106,5 +112,5 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
106
112
|
};
|
|
107
113
|
return plugin;
|
|
108
114
|
};
|
|
109
|
-
const statusPlugin = options => decorateWithPluginOptions(baseStatusPlugin(options), options);
|
|
115
|
+
const statusPlugin = (options, api) => decorateWithPluginOptions(baseStatusPlugin(options, api), options);
|
|
110
116
|
export default statusPlugin;
|
|
@@ -182,7 +182,10 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
|
|
|
182
182
|
render() {
|
|
183
183
|
const {
|
|
184
184
|
isNew,
|
|
185
|
-
target
|
|
185
|
+
target,
|
|
186
|
+
mountTo,
|
|
187
|
+
boundariesElement,
|
|
188
|
+
scrollableElement
|
|
186
189
|
} = this.props;
|
|
187
190
|
const {
|
|
188
191
|
color,
|
|
@@ -194,7 +197,10 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
|
|
|
194
197
|
handleClickOutside: this.handleClickOutside,
|
|
195
198
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
196
199
|
zIndex: akEditorFloatingDialogZIndex,
|
|
197
|
-
fitHeight: 40
|
|
200
|
+
fitHeight: 40,
|
|
201
|
+
mountTo: mountTo,
|
|
202
|
+
boundariesElement: boundariesElement,
|
|
203
|
+
scrollableElement: scrollableElement
|
|
198
204
|
}, jsx("div", {
|
|
199
205
|
css: pickerContainer,
|
|
200
206
|
onClick: this.handlePopupClick
|
|
@@ -3,6 +3,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
6
|
+
import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
7
|
+
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
8
|
+
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
6
9
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
10
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
8
11
|
import ColorPalette from '../../../../ui/ColorPalette';
|
|
@@ -27,7 +30,8 @@ export class ToolbarTextColor extends React.Component {
|
|
|
27
30
|
constructor(...args) {
|
|
28
31
|
super(...args);
|
|
29
32
|
_defineProperty(this, "state", {
|
|
30
|
-
isOpen: false
|
|
33
|
+
isOpen: false,
|
|
34
|
+
isOpenedByKeyboard: false
|
|
31
35
|
});
|
|
32
36
|
_defineProperty(this, "toolbarItemRef", /*#__PURE__*/React.createRef());
|
|
33
37
|
_defineProperty(this, "changeColor", color => commands.changeColor(color)(this.props.editorView.state, this.props.editorView.dispatch));
|
|
@@ -39,6 +43,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
39
43
|
});
|
|
40
44
|
});
|
|
41
45
|
_defineProperty(this, "changeTextColor", (color, disabled) => {
|
|
46
|
+
var _this$toolbarItemRef, _this$toolbarItemRef$;
|
|
42
47
|
if (!disabled) {
|
|
43
48
|
var _this$props$editorVie;
|
|
44
49
|
const {
|
|
@@ -60,6 +65,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
60
65
|
//To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
|
|
61
66
|
(_this$props$editorVie = this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
|
|
62
67
|
}
|
|
68
|
+
(_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();
|
|
63
69
|
return false;
|
|
64
70
|
});
|
|
65
71
|
_defineProperty(this, "toggleOpen", () => {
|
|
@@ -68,6 +74,15 @@ export class ToolbarTextColor extends React.Component {
|
|
|
68
74
|
logCloseEvent: true
|
|
69
75
|
});
|
|
70
76
|
});
|
|
77
|
+
_defineProperty(this, "onKeyDown", event => {
|
|
78
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
this.setState({
|
|
81
|
+
isOpenedByKeyboard: true
|
|
82
|
+
});
|
|
83
|
+
this.toggleOpen();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
71
86
|
_defineProperty(this, "handleOpenChange", ({
|
|
72
87
|
isOpen,
|
|
73
88
|
logCloseEvent,
|
|
@@ -76,14 +91,19 @@ export class ToolbarTextColor extends React.Component {
|
|
|
76
91
|
this.setState({
|
|
77
92
|
isOpen
|
|
78
93
|
});
|
|
94
|
+
if (!isOpen) {
|
|
95
|
+
this.setState({
|
|
96
|
+
isOpenedByKeyboard: false
|
|
97
|
+
});
|
|
98
|
+
}
|
|
79
99
|
if (logCloseEvent) {
|
|
80
100
|
this.dispatchAnalyticsEvent(this.buildAnalyticsPalette(isOpen ? ACTION.OPENED : ACTION.CLOSED, {
|
|
81
101
|
noSelect: isOpen === false
|
|
82
102
|
}));
|
|
83
103
|
}
|
|
84
104
|
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
85
|
-
var _this$
|
|
86
|
-
(_this$
|
|
105
|
+
var _this$toolbarItemRef2, _this$toolbarItemRef3;
|
|
106
|
+
(_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();
|
|
87
107
|
}
|
|
88
108
|
});
|
|
89
109
|
_defineProperty(this, "hide", e => {
|
|
@@ -98,20 +118,21 @@ export class ToolbarTextColor extends React.Component {
|
|
|
98
118
|
isOpen: false
|
|
99
119
|
});
|
|
100
120
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
101
|
-
var _this$
|
|
102
|
-
(_this$
|
|
121
|
+
var _this$toolbarItemRef4, _this$toolbarItemRef5;
|
|
122
|
+
(_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();
|
|
103
123
|
}
|
|
104
124
|
}
|
|
105
125
|
});
|
|
106
126
|
_defineProperty(this, "hideonEsc", e => {
|
|
107
|
-
var _this$
|
|
127
|
+
var _this$toolbarItemRef6, _this$toolbarItemRef7;
|
|
108
128
|
this.hide(e);
|
|
109
|
-
(_this$
|
|
129
|
+
(_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();
|
|
110
130
|
});
|
|
111
131
|
}
|
|
112
132
|
render() {
|
|
113
133
|
const {
|
|
114
|
-
isOpen
|
|
134
|
+
isOpen,
|
|
135
|
+
isOpenedByKeyboard
|
|
115
136
|
} = this.state;
|
|
116
137
|
const {
|
|
117
138
|
popupsMountPoint,
|
|
@@ -138,6 +159,10 @@ export class ToolbarTextColor extends React.Component {
|
|
|
138
159
|
fitWidth = 242;
|
|
139
160
|
}
|
|
140
161
|
const selectedColor = pluginState.color !== pluginState.defaultColor && pluginState.color;
|
|
162
|
+
const {
|
|
163
|
+
selectedRowIndex,
|
|
164
|
+
selectedColumnIndex
|
|
165
|
+
} = getSelectedRowAndColumnFromPalette(palette, pluginState.color);
|
|
141
166
|
return jsx("span", {
|
|
142
167
|
css: wrapperStyle
|
|
143
168
|
}, jsx(Dropdown, {
|
|
@@ -151,6 +176,13 @@ export class ToolbarTextColor extends React.Component {
|
|
|
151
176
|
fitWidth: fitWidth,
|
|
152
177
|
onOpenChange: this.onOpenChange,
|
|
153
178
|
closeOnTab: true,
|
|
179
|
+
arrowKeyNavigationProviderOptions: {
|
|
180
|
+
type: ArrowKeyNavigationType.COLOR,
|
|
181
|
+
selectedRowIndex,
|
|
182
|
+
selectedColumnIndex,
|
|
183
|
+
isOpenedByKeyboard,
|
|
184
|
+
isPopupPositioned: true
|
|
185
|
+
},
|
|
154
186
|
trigger: jsx(ToolbarButton, {
|
|
155
187
|
buttonId: TOOLBAR_BUTTON.TEXT_COLOR,
|
|
156
188
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -161,6 +193,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
161
193
|
"aria-haspopup": true,
|
|
162
194
|
title: labelTextColor,
|
|
163
195
|
onClick: this.toggleOpen,
|
|
196
|
+
onKeyDown: this.onKeyDown,
|
|
164
197
|
ref: this.toolbarItemRef,
|
|
165
198
|
iconBefore: jsx("div", {
|
|
166
199
|
css: triggerWrapperStyles
|
|
@@ -181,6 +214,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
181
214
|
onClick: color => this.changeTextColor(color, pluginState.disabled),
|
|
182
215
|
selectedColor: pluginState.color,
|
|
183
216
|
textPalette: true,
|
|
217
|
+
hexToPaletteColor: hexToEditorTextPaletteColor,
|
|
184
218
|
useSomewhatSemanticTextColorNames: useSomewhatSemanticTextColorNames
|
|
185
219
|
}))), jsx("span", {
|
|
186
220
|
css: separatorStyles
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
3
|
import DropdownMenu from '../../../../ui/DropdownMenu';
|
|
4
4
|
import { useMenuState } from './hooks/menu-state';
|
|
@@ -14,6 +14,7 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
|
|
|
14
14
|
popupsScrollableElement
|
|
15
15
|
}) => {
|
|
16
16
|
const [isMenuOpen, toggleMenu, closeMenu] = useMenuState();
|
|
17
|
+
const [isOpenedByKeyboard, setIsOpenedByKeyboard] = useState(false);
|
|
17
18
|
const group = useMemo(() => [{
|
|
18
19
|
items
|
|
19
20
|
}], [items]);
|
|
@@ -37,13 +38,29 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
|
|
|
37
38
|
zIndex: akEditorMenuZIndex,
|
|
38
39
|
fitHeight: 188,
|
|
39
40
|
fitWidth: 136,
|
|
40
|
-
shouldUseDefaultRole: true
|
|
41
|
+
shouldUseDefaultRole: true,
|
|
42
|
+
shouldFocusFirstItem: () => {
|
|
43
|
+
if (isOpenedByKeyboard) {
|
|
44
|
+
setIsOpenedByKeyboard(false);
|
|
45
|
+
}
|
|
46
|
+
return isOpenedByKeyboard;
|
|
47
|
+
}
|
|
41
48
|
}, /*#__PURE__*/React.createElement(MoreButton, {
|
|
42
49
|
isSelected: isMenuOpen || hasFormattingActive,
|
|
43
50
|
label: moreButtonLabel,
|
|
44
51
|
isReducedSpacing: isReducedSpacing,
|
|
45
52
|
isDisabled: false,
|
|
46
|
-
onClick:
|
|
53
|
+
onClick: () => {
|
|
54
|
+
toggleMenu();
|
|
55
|
+
setIsOpenedByKeyboard(false);
|
|
56
|
+
},
|
|
57
|
+
onKeyDown: event => {
|
|
58
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
toggleMenu();
|
|
61
|
+
setIsOpenedByKeyboard(true);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
47
64
|
"aria-expanded": isMenuOpen
|
|
48
65
|
}));
|
|
49
66
|
});
|
|
@@ -10,8 +10,9 @@ import { SingleToolbarButtons } from './single-toolbar-buttons';
|
|
|
10
10
|
import { MoreButton } from './more-button';
|
|
11
11
|
import { FormattingTextDropdownMenu } from './dropdown-menu';
|
|
12
12
|
import { toolbarMessages } from './toolbar-messages';
|
|
13
|
-
import {
|
|
13
|
+
import { compareItemsArrays, isArrayContainsContent } from '../../utils';
|
|
14
14
|
import Announcer from '../../../../utils/announcer/announcer';
|
|
15
|
+
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
15
16
|
const ToolbarFormatting = ({
|
|
16
17
|
shouldUseResponsiveToolbar,
|
|
17
18
|
popupsMountPoint,
|
|
@@ -23,6 +24,7 @@ const ToolbarFormatting = ({
|
|
|
23
24
|
isToolbarDisabled,
|
|
24
25
|
intl
|
|
25
26
|
}) => {
|
|
27
|
+
var _usePreviousState;
|
|
26
28
|
const editorState = useMemo(() => editorView.state, [editorView.state]);
|
|
27
29
|
const [message, setMessage] = useState('');
|
|
28
30
|
const defaultIcons = useFormattingIcons({
|
|
@@ -54,7 +56,7 @@ const ToolbarFormatting = ({
|
|
|
54
56
|
const superscriptOffSubscriptOnStatus = intl.formatMessage(toolbarMessages.superscriptOffSubscriptOn);
|
|
55
57
|
const subscriptOffSuperscriptOnStatus = intl.formatMessage(toolbarMessages.subscriptOffSuperscriptOn);
|
|
56
58
|
const activeItems = [...dropdownItems, ...singleItems].filter(item => item.isActive);
|
|
57
|
-
const prevActiveItems =
|
|
59
|
+
const prevActiveItems = (_usePreviousState = usePreviousState(activeItems)) !== null && _usePreviousState !== void 0 ? _usePreviousState : [];
|
|
58
60
|
const fromSuperscriptToSubscript = isArrayContainsContent(activeItems, 'Subscript') && isArrayContainsContent(prevActiveItems, 'Superscript');
|
|
59
61
|
const fromSubscriptToSuperscript = isArrayContainsContent(activeItems, 'Superscript') && isArrayContainsContent(prevActiveItems, 'Subscript');
|
|
60
62
|
let comparedItems;
|
|
@@ -10,12 +10,14 @@ export const MoreButton = /*#__PURE__*/React.memo(({
|
|
|
10
10
|
isReducedSpacing,
|
|
11
11
|
isSelected,
|
|
12
12
|
isDisabled,
|
|
13
|
-
onClick
|
|
13
|
+
onClick,
|
|
14
|
+
onKeyDown
|
|
14
15
|
}) => {
|
|
15
16
|
return jsx(ToolbarButton, {
|
|
16
17
|
disabled: isDisabled,
|
|
17
18
|
selected: isSelected,
|
|
18
19
|
onClick: onClick,
|
|
20
|
+
onKeyDown: onKeyDown,
|
|
19
21
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
20
22
|
title: label,
|
|
21
23
|
iconBefore: jsx("div", {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
1
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
2
|
import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
|
|
4
3
|
export const nodeLen = node => {
|
|
@@ -116,13 +115,6 @@ const marksArePresent = state => {
|
|
|
116
115
|
export const checkFormattingIsPresent = state => {
|
|
117
116
|
return marksArePresent(state) || blockStylingIsPresent(state);
|
|
118
117
|
};
|
|
119
|
-
export const usePreviousObjectState = value => {
|
|
120
|
-
const ref = useRef([]);
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
ref.current = value;
|
|
123
|
-
});
|
|
124
|
-
return ref.current;
|
|
125
|
-
};
|
|
126
118
|
export const compareItemsArrays = (items, prevItems) => {
|
|
127
119
|
return items && items.filter(item => !prevItems.includes(item));
|
|
128
120
|
};
|
|
@@ -25,6 +25,7 @@ export function ToolbarDropdown(props) {
|
|
|
25
25
|
onItemActivated
|
|
26
26
|
} = props;
|
|
27
27
|
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
|
|
28
|
+
const [isOpenedByKeyboard, setOpenedByKeyboard] = React.useState(false);
|
|
28
29
|
const labelLists = formatMessage(listMessages.lists);
|
|
29
30
|
const onOpenChange = attrs => {
|
|
30
31
|
setIsDropdownOpen(attrs.isDropdownOpen);
|
|
@@ -34,6 +35,13 @@ export function ToolbarDropdown(props) {
|
|
|
34
35
|
isDropdownOpen: !isDropdownOpen
|
|
35
36
|
});
|
|
36
37
|
};
|
|
38
|
+
const handleOnKeyDown = event => {
|
|
39
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setIsDropdownOpen(!isDropdownOpen);
|
|
42
|
+
setOpenedByKeyboard(true);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
37
45
|
const items = useItems(props);
|
|
38
46
|
const handleOnItemActivated = ({
|
|
39
47
|
item,
|
|
@@ -57,7 +65,13 @@ export function ToolbarDropdown(props) {
|
|
|
57
65
|
onOpenChange: onOpenChange,
|
|
58
66
|
fitHeight: 188,
|
|
59
67
|
fitWidth: 175,
|
|
60
|
-
shouldUseDefaultRole: true
|
|
68
|
+
shouldUseDefaultRole: true,
|
|
69
|
+
shouldFocusFirstItem: () => {
|
|
70
|
+
if (isOpenedByKeyboard) {
|
|
71
|
+
setOpenedByKeyboard(false);
|
|
72
|
+
}
|
|
73
|
+
return isOpenedByKeyboard;
|
|
74
|
+
}
|
|
61
75
|
}, jsx(ToolbarButton, {
|
|
62
76
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
63
77
|
selected: bulletListActive || orderedListActive,
|
|
@@ -66,6 +80,7 @@ export function ToolbarDropdown(props) {
|
|
|
66
80
|
"aria-label": labelLists,
|
|
67
81
|
disabled: disabled,
|
|
68
82
|
onClick: handleTriggerClick,
|
|
83
|
+
onKeyDown: handleOnKeyDown,
|
|
69
84
|
title: labelLists,
|
|
70
85
|
iconBefore: jsx("span", {
|
|
71
86
|
css: wrapperStyle
|
|
@@ -19,7 +19,7 @@ import { getPluginState } from './utils';
|
|
|
19
19
|
import { useItemInsert } from './ui/hooks/use-item-insert';
|
|
20
20
|
import { updateSelectedIndex } from './commands/update-selected-index';
|
|
21
21
|
import { StatsModifier } from './stats-modifier';
|
|
22
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '
|
|
22
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
23
23
|
const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
24
24
|
editorView,
|
|
25
25
|
popupMountRef,
|
|
@@ -10,7 +10,21 @@ import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../constants';
|
|
|
10
10
|
import { AssistiveText } from './AssistiveText';
|
|
11
11
|
import { typeAheadListMessages } from '../messages';
|
|
12
12
|
import { useIntl } from 'react-intl-next';
|
|
13
|
-
import
|
|
13
|
+
import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
14
|
+
const querySpan = css({
|
|
15
|
+
outline: 'none',
|
|
16
|
+
'& input': {
|
|
17
|
+
width: '5px',
|
|
18
|
+
border: 'none',
|
|
19
|
+
background: 'transparent',
|
|
20
|
+
padding: 0,
|
|
21
|
+
margin: 0,
|
|
22
|
+
// ED-17022 Fixes firefox caret position
|
|
23
|
+
fontSize: '1em',
|
|
24
|
+
height: blockNodesVerticalMargin,
|
|
25
|
+
caretColor: "var(--ds-text-accent-blue, #0052CC)"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
14
28
|
const isNavigationKey = event => {
|
|
15
29
|
return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
|
|
16
30
|
};
|
|
@@ -27,10 +41,6 @@ const isUndoRedoShortcut = event => {
|
|
|
27
41
|
}
|
|
28
42
|
return false;
|
|
29
43
|
};
|
|
30
|
-
const isSelectAllShortcut = event => {
|
|
31
|
-
const key = keyNameNormalized(event);
|
|
32
|
-
return (event.ctrlKey || event.metaKey) && key === 'a';
|
|
33
|
-
};
|
|
34
44
|
const getAriaLabel = (triggerPrefix, intl) => {
|
|
35
45
|
switch (triggerPrefix) {
|
|
36
46
|
case '@':
|
|
@@ -57,20 +67,25 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
57
67
|
editorView,
|
|
58
68
|
items
|
|
59
69
|
}) => {
|
|
60
|
-
const ref = useRef(document.createElement('
|
|
61
|
-
const
|
|
62
|
-
const [
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
const ref = useRef(document.createElement('span'));
|
|
71
|
+
const inputRef = useRef(null);
|
|
72
|
+
const [query, setQuery] = useState(null);
|
|
73
|
+
const cleanedInputContent = useCallback(() => {
|
|
74
|
+
var _ref$current;
|
|
75
|
+
const raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
|
|
76
|
+
return raw;
|
|
77
|
+
}, []);
|
|
78
|
+
const onKeyUp = useCallback(event => {
|
|
79
|
+
const text = cleanedInputContent();
|
|
68
80
|
onQueryChange(text);
|
|
69
|
-
}, [onQueryChange]);
|
|
81
|
+
}, [onQueryChange, cleanedInputContent]);
|
|
70
82
|
const [isInFocus, setInFocus] = useState(false);
|
|
71
83
|
const checkKeyEvent = useCallback(event => {
|
|
84
|
+
var _ref$current2;
|
|
72
85
|
const key = keyNameNormalized(event);
|
|
73
|
-
const
|
|
86
|
+
const sel = document.getSelection();
|
|
87
|
+
const raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
|
|
88
|
+
const text = cleanedInputContent();
|
|
74
89
|
let stopDefault = false;
|
|
75
90
|
const {
|
|
76
91
|
selectedIndex
|
|
@@ -102,7 +117,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
102
117
|
stopDefault = true;
|
|
103
118
|
break;
|
|
104
119
|
case 'Backspace':
|
|
105
|
-
if (
|
|
120
|
+
if (raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
|
|
106
121
|
event.stopPropagation();
|
|
107
122
|
event.preventDefault();
|
|
108
123
|
cancel({
|
|
@@ -141,66 +156,24 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
141
156
|
}
|
|
142
157
|
break;
|
|
143
158
|
}
|
|
144
|
-
if (isSelectAllShortcut(event)) {
|
|
145
|
-
cancel({
|
|
146
|
-
forceFocusOnEditor: true,
|
|
147
|
-
addPrefixTrigger: true,
|
|
148
|
-
text: ref.current.value,
|
|
149
|
-
setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED
|
|
150
|
-
});
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
159
|
const undoRedoType = isUndoRedoShortcut(event);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
|
|
157
|
-
setRedoBuffer(buffer => [ref.current.value, ...buffer]);
|
|
158
|
-
const undoValue = text.substring(0, text.length - 1);
|
|
159
|
-
ref.current.value = undoValue;
|
|
160
|
-
sizeSpanRef.current.textContent = undoValue;
|
|
161
|
-
stopDefault = true;
|
|
162
|
-
} else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
|
|
163
|
-
const redoValue = redoBuffer[0];
|
|
164
|
-
ref.current.value = redoValue;
|
|
165
|
-
sizeSpanRef.current.textContent = redoValue;
|
|
166
|
-
setRedoBuffer(buffer => buffer.slice(1));
|
|
167
|
-
stopDefault = true;
|
|
168
|
-
} else {
|
|
169
|
-
stopDefault = onUndoRedo(undoRedoType);
|
|
170
|
-
}
|
|
160
|
+
if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
|
|
161
|
+
stopDefault = true;
|
|
171
162
|
}
|
|
172
163
|
if (isNavigationKey(event) || stopDefault) {
|
|
173
164
|
event.stopPropagation();
|
|
174
165
|
event.preventDefault();
|
|
175
166
|
return false;
|
|
176
167
|
}
|
|
177
|
-
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state
|
|
168
|
+
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
|
|
178
169
|
const onClick = useCallback(event => {
|
|
179
|
-
var
|
|
170
|
+
var _inputRef$current;
|
|
180
171
|
event.stopPropagation();
|
|
181
172
|
event.preventDefault();
|
|
182
173
|
onQueryFocus();
|
|
183
|
-
(
|
|
174
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
184
175
|
return false;
|
|
185
176
|
}, [onQueryFocus]);
|
|
186
|
-
const queryStyle = css({
|
|
187
|
-
'&&': {
|
|
188
|
-
outline: 'none',
|
|
189
|
-
position: 'absolute',
|
|
190
|
-
fontFamily: 'inherit',
|
|
191
|
-
fontSize: 'inherit',
|
|
192
|
-
fontWeight: 'inherit',
|
|
193
|
-
letterSpacing: 'inherit',
|
|
194
|
-
padding: 0,
|
|
195
|
-
height: '100%',
|
|
196
|
-
width: '100%',
|
|
197
|
-
top: 0,
|
|
198
|
-
left: 0,
|
|
199
|
-
background: 'transparent',
|
|
200
|
-
border: 'none',
|
|
201
|
-
color: `${`var(--ds-link, ${colors.B400})`}`
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
177
|
useLayoutEffect(() => {
|
|
205
178
|
if (!ref.current) {
|
|
206
179
|
return;
|
|
@@ -214,18 +187,18 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
214
187
|
const keyDown = event => {
|
|
215
188
|
const key = keyNameNormalized(event);
|
|
216
189
|
if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
|
|
217
|
-
var _ref$
|
|
218
|
-
const q = ((_ref$
|
|
219
|
-
const
|
|
220
|
-
const isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
|
|
221
|
-
const isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
|
|
190
|
+
var _ref$current3;
|
|
191
|
+
const q = ((_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.textContent) || '';
|
|
192
|
+
const sel = document.getSelection();
|
|
193
|
+
const isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
|
|
194
|
+
const isMovingLeft = sel && 'ArrowLeft' === key && (sel.anchorOffset === 0 || event.metaKey);
|
|
222
195
|
if (!isMovingRight && !isMovingLeft) {
|
|
223
196
|
return;
|
|
224
197
|
}
|
|
225
198
|
cancel({
|
|
226
199
|
forceFocusOnEditor: true,
|
|
227
200
|
addPrefixTrigger: true,
|
|
228
|
-
text:
|
|
201
|
+
text: cleanedInputContent(),
|
|
229
202
|
setSelectionAt: isMovingRight ? CloseSelectionOptions.AFTER_TEXT_INSERTED : CloseSelectionOptions.BEFORE_TEXT_INSERTED
|
|
230
203
|
});
|
|
231
204
|
event.preventDefault();
|
|
@@ -258,8 +231,8 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
258
231
|
}
|
|
259
232
|
cancel({
|
|
260
233
|
addPrefixTrigger: true,
|
|
261
|
-
text:
|
|
262
|
-
setSelectionAt: CloseSelectionOptions.
|
|
234
|
+
text: cleanedInputContent(),
|
|
235
|
+
setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED,
|
|
263
236
|
forceFocusOnEditor: false
|
|
264
237
|
});
|
|
265
238
|
};
|
|
@@ -277,7 +250,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
277
250
|
const {
|
|
278
251
|
target
|
|
279
252
|
} = e;
|
|
280
|
-
if (e.isComposing || !(target instanceof
|
|
253
|
+
if (e.isComposing || !(target instanceof HTMLElement)) {
|
|
281
254
|
return;
|
|
282
255
|
}
|
|
283
256
|
if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
|
|
@@ -286,6 +259,23 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
286
259
|
close();
|
|
287
260
|
return;
|
|
288
261
|
}
|
|
262
|
+
if (e.data != null && inputRef.current === null) {
|
|
263
|
+
setQuery('');
|
|
264
|
+
|
|
265
|
+
// We need to change the content on Safari
|
|
266
|
+
// and set the cursor at the right place
|
|
267
|
+
if (browser.safari) {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
const dataElement = document.createTextNode(e.data);
|
|
270
|
+
element.appendChild(dataElement);
|
|
271
|
+
const sel = window.getSelection();
|
|
272
|
+
const range = document.createRange();
|
|
273
|
+
range.setStart(dataElement, dataElement.length);
|
|
274
|
+
range.collapse(true);
|
|
275
|
+
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
|
276
|
+
sel === null || sel === void 0 ? void 0 : sel.addRange(range);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
289
279
|
};
|
|
290
280
|
let onInput = null;
|
|
291
281
|
if (browser.safari) {
|
|
@@ -297,7 +287,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
297
287
|
const {
|
|
298
288
|
target
|
|
299
289
|
} = e;
|
|
300
|
-
if (e.isComposing || !(target instanceof
|
|
290
|
+
if (e.isComposing || !(target instanceof HTMLElement)) {
|
|
301
291
|
return;
|
|
302
292
|
}
|
|
303
293
|
if (e.inputType === 'historyUndo' && ((_target$textContent2 = target.textContent) === null || _target$textContent2 === void 0 ? void 0 : _target$textContent2.length) === 1) {
|
|
@@ -322,12 +312,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
322
312
|
element.removeEventListener('input', onInput);
|
|
323
313
|
}
|
|
324
314
|
};
|
|
325
|
-
}, [triggerQueryPrefix,
|
|
315
|
+
}, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
|
|
326
316
|
useLayoutEffect(() => {
|
|
327
317
|
const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
|
|
328
318
|
if (ref.current && forceFocus) {
|
|
329
|
-
|
|
330
|
-
sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
|
|
319
|
+
setQuery(hasReopenQuery ? reopenQuery : null);
|
|
331
320
|
requestAnimationFrame(() => {
|
|
332
321
|
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
|
333
322
|
return;
|
|
@@ -355,20 +344,10 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
355
344
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
356
345
|
*/
|
|
357
346
|
return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
}, jsx("span", {
|
|
362
|
-
ref: sizeSpanRef,
|
|
363
|
-
"aria-hidden": true,
|
|
364
|
-
style: {
|
|
365
|
-
marginLeft: '1px',
|
|
366
|
-
visibility: 'hidden'
|
|
367
|
-
}
|
|
368
|
-
}), jsx("input", {
|
|
369
|
-
css: queryStyle,
|
|
347
|
+
css: querySpan,
|
|
348
|
+
contentEditable: true,
|
|
370
349
|
ref: ref,
|
|
371
|
-
|
|
350
|
+
onKeyUp: onKeyUp,
|
|
372
351
|
onClick: onClick,
|
|
373
352
|
role: "combobox",
|
|
374
353
|
"aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
|
|
@@ -376,9 +355,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
376
355
|
"aria-expanded": items.length !== 0,
|
|
377
356
|
"aria-labelledby": assistiveHintID,
|
|
378
357
|
suppressContentEditableWarning: true,
|
|
379
|
-
"data-query-prefix": triggerQueryPrefix
|
|
380
|
-
|
|
381
|
-
|
|
358
|
+
"data-query-prefix": triggerQueryPrefix
|
|
359
|
+
}, query === null ? jsx("input", {
|
|
360
|
+
ref: inputRef,
|
|
361
|
+
type: "text"
|
|
362
|
+
}) : query), jsx("span", {
|
|
382
363
|
id: assistiveHintID,
|
|
383
364
|
style: {
|
|
384
365
|
display: 'none'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -30,6 +30,7 @@ class ChromeCollapsed extends PureComponent {
|
|
|
30
30
|
render() {
|
|
31
31
|
const placeholder = this.props.text || this.props.intl.formatMessage(messages.chromeCollapsedPlaceholder);
|
|
32
32
|
return jsx("input", {
|
|
33
|
+
"data-testid": "chrome-collapsed",
|
|
33
34
|
css: inputStyle,
|
|
34
35
|
ref: this.handleInputRef,
|
|
35
36
|
onFocus: this.focusHandler,
|