@atlaskit/editor-core 180.0.0 → 180.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
- package/dist/cjs/actions/index.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +12 -762
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +35 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
- package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
- package/dist/cjs/editor-next/index.js +139 -0
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
- package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
- package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
- package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
- package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
- package/dist/cjs/editor.js +130 -443
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
- package/dist/cjs/labs/next/presets/preset.js +0 -5
- package/dist/cjs/labs/next/presets/universal.js +11 -2
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/cjs/plugins/analytics/index.js +2 -3
- package/dist/cjs/plugins/analytics/plugin.js +5 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
- package/dist/cjs/plugins/hyperlink/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/cjs/plugins/media/commands/helpers.js +12 -40
- package/dist/cjs/plugins/media/commands/index.js +4 -4
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/cjs/plugins/panel/utils.js +4 -1
- package/dist/cjs/plugins/paste/handlers.js +128 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/cjs/plugins/text-formatting/utils.js +1 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/types/get-editor-props.js +5 -0
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ContextPanel/context.js +13 -12
- package/dist/cjs/ui/Dropdown/index.js +7 -2
- package/dist/cjs/ui/DropdownMenu/index.js +7 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +32 -0
- package/dist/cjs/utils/linking-utils.js +1 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
- package/dist/cjs/utils/performance/safer-transactions.js +1 -1
- package/dist/cjs/utils/prepare-extension-provider.js +25 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -2
- package/dist/es2019/create-editor/ReactEditorView.js +6 -708
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -0
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +10 -0
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
- package/dist/es2019/editor-next/index.js +90 -0
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
- package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
- package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
- package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
- package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
- package/dist/es2019/editor.js +111 -396
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
- package/dist/es2019/labs/next/presets/preset.js +0 -3
- package/dist/es2019/labs/next/presets/universal.js +13 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
- package/dist/es2019/plugins/analytics/index.js +3 -4
- package/dist/es2019/plugins/analytics/plugin.js +1 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
- package/dist/es2019/plugins/hyperlink/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
- package/dist/es2019/plugins/media/commands/helpers.js +9 -35
- package/dist/es2019/plugins/media/commands/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/es2019/plugins/text-formatting/utils.js +0 -8
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/types/get-editor-props.js +1 -0
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ContextPanel/context.js +5 -4
- package/dist/es2019/ui/Dropdown/index.js +5 -2
- package/dist/es2019/ui/DropdownMenu/index.js +5 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +25 -0
- package/dist/es2019/utils/linking-utils.js +1 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
- package/dist/es2019/utils/performance/safer-transactions.js +1 -1
- package/dist/es2019/utils/prepare-extension-provider.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -2
- package/dist/esm/create-editor/ReactEditorView.js +12 -763
- package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -0
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +28 -0
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
- package/dist/esm/editor-next/index.js +134 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
- package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
- package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/esm/editor-next/utils/handleProviders.js +50 -0
- package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
- package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
- package/dist/esm/editor.js +130 -440
- package/dist/esm/index.js +2 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
- package/dist/esm/labs/next/presets/preset.js +0 -5
- package/dist/esm/labs/next/presets/universal.js +11 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/esm/plugins/analytics/index.js +3 -4
- package/dist/esm/plugins/analytics/plugin.js +1 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/hyperlink/analytics.js +1 -1
- package/dist/esm/plugins/hyperlink/index.js +1 -1
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/esm/plugins/media/commands/helpers.js +9 -35
- package/dist/esm/plugins/media/commands/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/esm/plugins/text-formatting/utils.js +0 -8
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/types/get-editor-props.js +1 -0
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPickerButton/index.js +69 -7
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ContextPanel/context.js +8 -8
- package/dist/esm/ui/Dropdown/index.js +7 -2
- package/dist/esm/ui/DropdownMenu/index.js +7 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +25 -0
- package/dist/esm/utils/linking-utils.js +1 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
- package/dist/esm/utils/performance/safer-transactions.js +1 -1
- package/dist/esm/utils/prepare-extension-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
- package/dist/types/editor-next/editor-internal.d.ts +44 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
- package/dist/types/editor-next/index.d.ts +34 -0
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
- package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
- package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
- package/dist/types/editor.d.ts +47 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
- package/dist/types/labs/next/presets/preset.d.ts +6 -6
- package/dist/types/labs/next/presets/universal.d.ts +1 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
- package/dist/types/plugins/analytics/index.d.ts +3 -6
- package/dist/types/plugins/analytics/plugin.d.ts +3 -1
- package/dist/types/plugins/analytics/utils.d.ts +2 -3
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -1
- package/dist/types/plugins/base/index.d.ts +3 -1
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
- package/dist/types/plugins/block-type/index.d.ts +3 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/breakout/index.d.ts +3 -1
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/context-panel/index.d.ts +1 -1
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +3 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
- package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/hyperlink/types.d.ts +3 -1
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types/plugins/layout/index.d.ts +3 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/max-content-size/index.d.ts +3 -1
- package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
- package/dist/types/plugins/media/commands/index.d.ts +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
- package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +3 -1
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
- package/dist/types/plugins/placeholder/index.d.ts +3 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/plugins/quick-insert/index.d.ts +3 -1
- package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
- package/dist/types/plugins/selection/index.d.ts +3 -1
- package/dist/types/plugins/status/index.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
- package/dist/types/plugins/submit-editor/index.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/index.d.ts +3 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/types/get-editor-props.d.ts +12 -0
- package/dist/types/types/performance-tracking.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/utils/document.d.ts +4 -3
- package/dist/types/utils/get-editor-plugins.d.ts +10 -0
- package/dist/types/utils/linking-utils.d.ts +1 -1
- package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
- package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
- package/docs/0-intro.tsx +0 -1
- package/package.json +23 -22
- package/report.api.md +193 -139
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
- package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import DropdownMenu from '../../../../ui/DropdownMenu';
|
|
5
5
|
import { useMenuState } from './hooks/menu-state';
|
|
@@ -18,6 +18,10 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
|
|
|
18
18
|
isMenuOpen = _useMenuState2[0],
|
|
19
19
|
toggleMenu = _useMenuState2[1],
|
|
20
20
|
closeMenu = _useMenuState2[2];
|
|
21
|
+
var _useState = useState(false),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
isOpenedByKeyboard = _useState2[0],
|
|
24
|
+
setIsOpenedByKeyboard = _useState2[1];
|
|
21
25
|
var group = useMemo(function () {
|
|
22
26
|
return [{
|
|
23
27
|
items: items
|
|
@@ -43,13 +47,29 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
|
|
|
43
47
|
zIndex: akEditorMenuZIndex,
|
|
44
48
|
fitHeight: 188,
|
|
45
49
|
fitWidth: 136,
|
|
46
|
-
shouldUseDefaultRole: true
|
|
50
|
+
shouldUseDefaultRole: true,
|
|
51
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
52
|
+
if (isOpenedByKeyboard) {
|
|
53
|
+
setIsOpenedByKeyboard(false);
|
|
54
|
+
}
|
|
55
|
+
return isOpenedByKeyboard;
|
|
56
|
+
}
|
|
47
57
|
}, /*#__PURE__*/React.createElement(MoreButton, {
|
|
48
58
|
isSelected: isMenuOpen || hasFormattingActive,
|
|
49
59
|
label: moreButtonLabel,
|
|
50
60
|
isReducedSpacing: isReducedSpacing,
|
|
51
61
|
isDisabled: false,
|
|
52
|
-
onClick:
|
|
62
|
+
onClick: function onClick() {
|
|
63
|
+
toggleMenu();
|
|
64
|
+
setIsOpenedByKeyboard(false);
|
|
65
|
+
},
|
|
66
|
+
onKeyDown: function onKeyDown(event) {
|
|
67
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
toggleMenu();
|
|
70
|
+
setIsOpenedByKeyboard(true);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
53
73
|
"aria-expanded": isMenuOpen
|
|
54
74
|
}));
|
|
55
75
|
});
|
|
@@ -19,9 +19,11 @@ import { SingleToolbarButtons } from './single-toolbar-buttons';
|
|
|
19
19
|
import { MoreButton } from './more-button';
|
|
20
20
|
import { FormattingTextDropdownMenu } from './dropdown-menu';
|
|
21
21
|
import { toolbarMessages } from './toolbar-messages';
|
|
22
|
-
import {
|
|
22
|
+
import { compareItemsArrays, isArrayContainsContent } from '../../utils';
|
|
23
23
|
import Announcer from '../../../../utils/announcer/announcer';
|
|
24
|
+
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
24
25
|
var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
26
|
+
var _usePreviousState;
|
|
25
27
|
var shouldUseResponsiveToolbar = _ref.shouldUseResponsiveToolbar,
|
|
26
28
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
27
29
|
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
@@ -68,7 +70,7 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
|
|
|
68
70
|
var activeItems = [].concat(_toConsumableArray(dropdownItems), _toConsumableArray(singleItems)).filter(function (item) {
|
|
69
71
|
return item.isActive;
|
|
70
72
|
});
|
|
71
|
-
var prevActiveItems =
|
|
73
|
+
var prevActiveItems = (_usePreviousState = usePreviousState(activeItems)) !== null && _usePreviousState !== void 0 ? _usePreviousState : [];
|
|
72
74
|
var fromSuperscriptToSubscript = isArrayContainsContent(activeItems, 'Subscript') && isArrayContainsContent(prevActiveItems, 'Superscript');
|
|
73
75
|
var fromSubscriptToSuperscript = isArrayContainsContent(activeItems, 'Superscript') && isArrayContainsContent(prevActiveItems, 'Subscript');
|
|
74
76
|
var comparedItems;
|
|
@@ -10,11 +10,13 @@ export var MoreButton = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
10
10
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
11
11
|
isSelected = _ref.isSelected,
|
|
12
12
|
isDisabled = _ref.isDisabled,
|
|
13
|
-
onClick = _ref.onClick
|
|
13
|
+
onClick = _ref.onClick,
|
|
14
|
+
onKeyDown = _ref.onKeyDown;
|
|
14
15
|
return jsx(ToolbarButton, {
|
|
15
16
|
disabled: isDisabled,
|
|
16
17
|
selected: isSelected,
|
|
17
18
|
onClick: onClick,
|
|
19
|
+
onKeyDown: onKeyDown,
|
|
18
20
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
19
21
|
title: label,
|
|
20
22
|
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 var nodeLen = function nodeLen(node) {
|
|
@@ -112,13 +111,6 @@ var marksArePresent = function marksArePresent(state) {
|
|
|
112
111
|
export var checkFormattingIsPresent = function checkFormattingIsPresent(state) {
|
|
113
112
|
return marksArePresent(state) || blockStylingIsPresent(state);
|
|
114
113
|
};
|
|
115
|
-
export var usePreviousObjectState = function usePreviousObjectState(value) {
|
|
116
|
-
var ref = useRef([]);
|
|
117
|
-
useEffect(function () {
|
|
118
|
-
ref.current = value;
|
|
119
|
-
});
|
|
120
|
-
return ref.current;
|
|
121
|
-
};
|
|
122
114
|
export var compareItemsArrays = function compareItemsArrays(items, prevItems) {
|
|
123
115
|
return items && items.filter(function (item) {
|
|
124
116
|
return !prevItems.includes(item);
|
|
@@ -26,6 +26,10 @@ export function ToolbarDropdown(props) {
|
|
|
26
26
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
27
27
|
isDropdownOpen = _React$useState2[0],
|
|
28
28
|
setIsDropdownOpen = _React$useState2[1];
|
|
29
|
+
var _React$useState3 = React.useState(false),
|
|
30
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
31
|
+
isOpenedByKeyboard = _React$useState4[0],
|
|
32
|
+
setOpenedByKeyboard = _React$useState4[1];
|
|
29
33
|
var labelLists = formatMessage(listMessages.lists);
|
|
30
34
|
var onOpenChange = function onOpenChange(attrs) {
|
|
31
35
|
setIsDropdownOpen(attrs.isDropdownOpen);
|
|
@@ -35,6 +39,13 @@ export function ToolbarDropdown(props) {
|
|
|
35
39
|
isDropdownOpen: !isDropdownOpen
|
|
36
40
|
});
|
|
37
41
|
};
|
|
42
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
43
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
setIsDropdownOpen(!isDropdownOpen);
|
|
46
|
+
setOpenedByKeyboard(true);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
38
49
|
var items = useItems(props);
|
|
39
50
|
var handleOnItemActivated = function handleOnItemActivated(_ref) {
|
|
40
51
|
var item = _ref.item,
|
|
@@ -58,7 +69,13 @@ export function ToolbarDropdown(props) {
|
|
|
58
69
|
onOpenChange: onOpenChange,
|
|
59
70
|
fitHeight: 188,
|
|
60
71
|
fitWidth: 175,
|
|
61
|
-
shouldUseDefaultRole: true
|
|
72
|
+
shouldUseDefaultRole: true,
|
|
73
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
74
|
+
if (isOpenedByKeyboard) {
|
|
75
|
+
setOpenedByKeyboard(false);
|
|
76
|
+
}
|
|
77
|
+
return isOpenedByKeyboard;
|
|
78
|
+
}
|
|
62
79
|
}, jsx(ToolbarButton, {
|
|
63
80
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
64
81
|
selected: bulletListActive || orderedListActive,
|
|
@@ -67,6 +84,7 @@ export function ToolbarDropdown(props) {
|
|
|
67
84
|
"aria-label": labelLists,
|
|
68
85
|
disabled: disabled,
|
|
69
86
|
onClick: handleTriggerClick,
|
|
87
|
+
onKeyDown: handleOnKeyDown,
|
|
70
88
|
title: labelLists,
|
|
71
89
|
iconBefore: jsx("span", {
|
|
72
90
|
css: wrapperStyle
|
|
@@ -20,7 +20,7 @@ import { getPluginState } from './utils';
|
|
|
20
20
|
import { useItemInsert } from './ui/hooks/use-item-insert';
|
|
21
21
|
import { updateSelectedIndex } from './commands/update-selected-index';
|
|
22
22
|
import { StatsModifier } from './stats-modifier';
|
|
23
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '
|
|
23
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
24
24
|
var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
25
25
|
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
26
26
|
var editorView = _ref.editorView,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React, { useRef, useCallback, Fragment, useLayoutEffect, useState } from 'react';
|
|
@@ -12,7 +11,21 @@ import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../constants';
|
|
|
12
11
|
import { AssistiveText } from './AssistiveText';
|
|
13
12
|
import { typeAheadListMessages } from '../messages';
|
|
14
13
|
import { useIntl } from 'react-intl-next';
|
|
15
|
-
import
|
|
14
|
+
import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
var querySpan = css({
|
|
16
|
+
outline: 'none',
|
|
17
|
+
'& input': {
|
|
18
|
+
width: '5px',
|
|
19
|
+
border: 'none',
|
|
20
|
+
background: 'transparent',
|
|
21
|
+
padding: 0,
|
|
22
|
+
margin: 0,
|
|
23
|
+
// ED-17022 Fixes firefox caret position
|
|
24
|
+
fontSize: '1em',
|
|
25
|
+
height: blockNodesVerticalMargin,
|
|
26
|
+
caretColor: "var(--ds-text-accent-blue, #0052CC)"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
16
29
|
var isNavigationKey = function isNavigationKey(event) {
|
|
17
30
|
return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
|
|
18
31
|
};
|
|
@@ -29,10 +42,6 @@ var isUndoRedoShortcut = function isUndoRedoShortcut(event) {
|
|
|
29
42
|
}
|
|
30
43
|
return false;
|
|
31
44
|
};
|
|
32
|
-
var isSelectAllShortcut = function isSelectAllShortcut(event) {
|
|
33
|
-
var key = keyNameNormalized(event);
|
|
34
|
-
return (event.ctrlKey || event.metaKey) && key === 'a';
|
|
35
|
-
};
|
|
36
45
|
var getAriaLabel = function getAriaLabel(triggerPrefix, intl) {
|
|
37
46
|
switch (triggerPrefix) {
|
|
38
47
|
case '@':
|
|
@@ -58,29 +67,31 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
58
67
|
onUndoRedo = _ref.onUndoRedo,
|
|
59
68
|
editorView = _ref.editorView,
|
|
60
69
|
items = _ref.items;
|
|
61
|
-
var ref = useRef(document.createElement('
|
|
62
|
-
var
|
|
63
|
-
var _useState = useState(
|
|
70
|
+
var ref = useRef(document.createElement('span'));
|
|
71
|
+
var inputRef = useRef(null);
|
|
72
|
+
var _useState = useState(null),
|
|
64
73
|
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
setQuery(text);
|
|
74
|
+
query = _useState2[0],
|
|
75
|
+
setQuery = _useState2[1];
|
|
76
|
+
var cleanedInputContent = useCallback(function () {
|
|
77
|
+
var _ref$current;
|
|
78
|
+
var raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
|
|
79
|
+
return raw;
|
|
80
|
+
}, []);
|
|
81
|
+
var onKeyUp = useCallback(function (event) {
|
|
82
|
+
var text = cleanedInputContent();
|
|
75
83
|
onQueryChange(text);
|
|
76
|
-
}, [onQueryChange]);
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
isInFocus =
|
|
80
|
-
setInFocus =
|
|
84
|
+
}, [onQueryChange, cleanedInputContent]);
|
|
85
|
+
var _useState3 = useState(false),
|
|
86
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
87
|
+
isInFocus = _useState4[0],
|
|
88
|
+
setInFocus = _useState4[1];
|
|
81
89
|
var checkKeyEvent = useCallback(function (event) {
|
|
90
|
+
var _ref$current2;
|
|
82
91
|
var key = keyNameNormalized(event);
|
|
83
|
-
var
|
|
92
|
+
var sel = document.getSelection();
|
|
93
|
+
var raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
|
|
94
|
+
var text = cleanedInputContent();
|
|
84
95
|
var stopDefault = false;
|
|
85
96
|
var _getPluginState = getPluginState(editorView.state),
|
|
86
97
|
selectedIndex = _getPluginState.selectedIndex;
|
|
@@ -111,7 +122,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
111
122
|
stopDefault = true;
|
|
112
123
|
break;
|
|
113
124
|
case 'Backspace':
|
|
114
|
-
if (
|
|
125
|
+
if (raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
|
|
115
126
|
event.stopPropagation();
|
|
116
127
|
event.preventDefault();
|
|
117
128
|
cancel({
|
|
@@ -150,70 +161,24 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
150
161
|
}
|
|
151
162
|
break;
|
|
152
163
|
}
|
|
153
|
-
if (isSelectAllShortcut(event)) {
|
|
154
|
-
cancel({
|
|
155
|
-
forceFocusOnEditor: true,
|
|
156
|
-
addPrefixTrigger: true,
|
|
157
|
-
text: ref.current.value,
|
|
158
|
-
setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED
|
|
159
|
-
});
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
164
|
var undoRedoType = isUndoRedoShortcut(event);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
|
|
166
|
-
setRedoBuffer(function (buffer) {
|
|
167
|
-
return [ref.current.value].concat(_toConsumableArray(buffer));
|
|
168
|
-
});
|
|
169
|
-
var undoValue = text.substring(0, text.length - 1);
|
|
170
|
-
ref.current.value = undoValue;
|
|
171
|
-
sizeSpanRef.current.textContent = undoValue;
|
|
172
|
-
stopDefault = true;
|
|
173
|
-
} else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
|
|
174
|
-
var redoValue = redoBuffer[0];
|
|
175
|
-
ref.current.value = redoValue;
|
|
176
|
-
sizeSpanRef.current.textContent = redoValue;
|
|
177
|
-
setRedoBuffer(function (buffer) {
|
|
178
|
-
return buffer.slice(1);
|
|
179
|
-
});
|
|
180
|
-
stopDefault = true;
|
|
181
|
-
} else {
|
|
182
|
-
stopDefault = onUndoRedo(undoRedoType);
|
|
183
|
-
}
|
|
165
|
+
if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
|
|
166
|
+
stopDefault = true;
|
|
184
167
|
}
|
|
185
168
|
if (isNavigationKey(event) || stopDefault) {
|
|
186
169
|
event.stopPropagation();
|
|
187
170
|
event.preventDefault();
|
|
188
171
|
return false;
|
|
189
172
|
}
|
|
190
|
-
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state
|
|
173
|
+
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
|
|
191
174
|
var onClick = useCallback(function (event) {
|
|
192
|
-
var
|
|
175
|
+
var _inputRef$current;
|
|
193
176
|
event.stopPropagation();
|
|
194
177
|
event.preventDefault();
|
|
195
178
|
onQueryFocus();
|
|
196
|
-
(
|
|
179
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
197
180
|
return false;
|
|
198
181
|
}, [onQueryFocus]);
|
|
199
|
-
var queryStyle = css({
|
|
200
|
-
'&&': {
|
|
201
|
-
outline: 'none',
|
|
202
|
-
position: 'absolute',
|
|
203
|
-
fontFamily: 'inherit',
|
|
204
|
-
fontSize: 'inherit',
|
|
205
|
-
fontWeight: 'inherit',
|
|
206
|
-
letterSpacing: 'inherit',
|
|
207
|
-
padding: 0,
|
|
208
|
-
height: '100%',
|
|
209
|
-
width: '100%',
|
|
210
|
-
top: 0,
|
|
211
|
-
left: 0,
|
|
212
|
-
background: 'transparent',
|
|
213
|
-
border: 'none',
|
|
214
|
-
color: "".concat("var(--ds-link, ".concat(colors.B400, ")"))
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
182
|
useLayoutEffect(function () {
|
|
218
183
|
if (!ref.current) {
|
|
219
184
|
return;
|
|
@@ -225,18 +190,18 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
225
190
|
var keyDown = function keyDown(event) {
|
|
226
191
|
var key = keyNameNormalized(event);
|
|
227
192
|
if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
|
|
228
|
-
var _ref$
|
|
229
|
-
var q = ((_ref$
|
|
230
|
-
var
|
|
231
|
-
var isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
|
|
232
|
-
var isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
|
|
193
|
+
var _ref$current3;
|
|
194
|
+
var q = ((_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.textContent) || '';
|
|
195
|
+
var sel = document.getSelection();
|
|
196
|
+
var isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
|
|
197
|
+
var isMovingLeft = sel && 'ArrowLeft' === key && (sel.anchorOffset === 0 || event.metaKey);
|
|
233
198
|
if (!isMovingRight && !isMovingLeft) {
|
|
234
199
|
return;
|
|
235
200
|
}
|
|
236
201
|
cancel({
|
|
237
202
|
forceFocusOnEditor: true,
|
|
238
203
|
addPrefixTrigger: true,
|
|
239
|
-
text:
|
|
204
|
+
text: cleanedInputContent(),
|
|
240
205
|
setSelectionAt: isMovingRight ? CloseSelectionOptions.AFTER_TEXT_INSERTED : CloseSelectionOptions.BEFORE_TEXT_INSERTED
|
|
241
206
|
});
|
|
242
207
|
event.preventDefault();
|
|
@@ -267,8 +232,8 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
267
232
|
}
|
|
268
233
|
cancel({
|
|
269
234
|
addPrefixTrigger: true,
|
|
270
|
-
text:
|
|
271
|
-
setSelectionAt: CloseSelectionOptions.
|
|
235
|
+
text: cleanedInputContent(),
|
|
236
|
+
setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED,
|
|
272
237
|
forceFocusOnEditor: false
|
|
273
238
|
});
|
|
274
239
|
};
|
|
@@ -284,7 +249,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
284
249
|
var _target$textContent;
|
|
285
250
|
setInFocus(false);
|
|
286
251
|
var target = e.target;
|
|
287
|
-
if (e.isComposing || !(target instanceof
|
|
252
|
+
if (e.isComposing || !(target instanceof HTMLElement)) {
|
|
288
253
|
return;
|
|
289
254
|
}
|
|
290
255
|
if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
|
|
@@ -293,6 +258,23 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
293
258
|
close();
|
|
294
259
|
return;
|
|
295
260
|
}
|
|
261
|
+
if (e.data != null && inputRef.current === null) {
|
|
262
|
+
setQuery('');
|
|
263
|
+
|
|
264
|
+
// We need to change the content on Safari
|
|
265
|
+
// and set the cursor at the right place
|
|
266
|
+
if (browser.safari) {
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
var dataElement = document.createTextNode(e.data);
|
|
269
|
+
element.appendChild(dataElement);
|
|
270
|
+
var sel = window.getSelection();
|
|
271
|
+
var range = document.createRange();
|
|
272
|
+
range.setStart(dataElement, dataElement.length);
|
|
273
|
+
range.collapse(true);
|
|
274
|
+
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
|
275
|
+
sel === null || sel === void 0 ? void 0 : sel.addRange(range);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
296
278
|
};
|
|
297
279
|
var onInput = null;
|
|
298
280
|
if (browser.safari) {
|
|
@@ -302,7 +284,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
302
284
|
var _onInput = function _onInput(e) {
|
|
303
285
|
var _target$textContent2;
|
|
304
286
|
var target = e.target;
|
|
305
|
-
if (e.isComposing || !(target instanceof
|
|
287
|
+
if (e.isComposing || !(target instanceof HTMLElement)) {
|
|
306
288
|
return;
|
|
307
289
|
}
|
|
308
290
|
if (e.inputType === 'historyUndo' && ((_target$textContent2 = target.textContent) === null || _target$textContent2 === void 0 ? void 0 : _target$textContent2.length) === 1) {
|
|
@@ -327,12 +309,11 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
327
309
|
element.removeEventListener('input', onInput);
|
|
328
310
|
}
|
|
329
311
|
};
|
|
330
|
-
}, [triggerQueryPrefix,
|
|
312
|
+
}, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
|
|
331
313
|
useLayoutEffect(function () {
|
|
332
314
|
var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
|
|
333
315
|
if (ref.current && forceFocus) {
|
|
334
|
-
|
|
335
|
-
sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
|
|
316
|
+
setQuery(hasReopenQuery ? reopenQuery : null);
|
|
336
317
|
requestAnimationFrame(function () {
|
|
337
318
|
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
|
338
319
|
return;
|
|
@@ -360,20 +341,10 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
360
341
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
361
342
|
*/
|
|
362
343
|
return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
}, jsx("span", {
|
|
367
|
-
ref: sizeSpanRef,
|
|
368
|
-
"aria-hidden": true,
|
|
369
|
-
style: {
|
|
370
|
-
marginLeft: '1px',
|
|
371
|
-
visibility: 'hidden'
|
|
372
|
-
}
|
|
373
|
-
}), jsx("input", {
|
|
374
|
-
css: queryStyle,
|
|
344
|
+
css: querySpan,
|
|
345
|
+
contentEditable: true,
|
|
375
346
|
ref: ref,
|
|
376
|
-
|
|
347
|
+
onKeyUp: onKeyUp,
|
|
377
348
|
onClick: onClick,
|
|
378
349
|
role: "combobox",
|
|
379
350
|
"aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
|
|
@@ -381,9 +352,11 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
381
352
|
"aria-expanded": items.length !== 0,
|
|
382
353
|
"aria-labelledby": assistiveHintID,
|
|
383
354
|
suppressContentEditableWarning: true,
|
|
384
|
-
"data-query-prefix": triggerQueryPrefix
|
|
385
|
-
|
|
386
|
-
|
|
355
|
+
"data-query-prefix": triggerQueryPrefix
|
|
356
|
+
}, query === null ? jsx("input", {
|
|
357
|
+
ref: inputRef,
|
|
358
|
+
type: "text"
|
|
359
|
+
}) : query), jsx("span", {
|
|
387
360
|
id: assistiveHintID,
|
|
388
361
|
style: {
|
|
389
362
|
display: 'none'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -48,6 +48,7 @@ var ChromeCollapsed = /*#__PURE__*/function (_PureComponent) {
|
|
|
48
48
|
value: function render() {
|
|
49
49
|
var placeholder = this.props.text || this.props.intl.formatMessage(messages.chromeCollapsedPlaceholder);
|
|
50
50
|
return jsx("input", {
|
|
51
|
+
"data-testid": "chrome-collapsed",
|
|
51
52
|
css: inputStyle,
|
|
52
53
|
ref: this.handleInputRef,
|
|
53
54
|
onFocus: this.focusHandler,
|
|
@@ -10,6 +10,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import Editor from '../../editor';
|
|
13
|
+
import EditorNext from '../../editor-next';
|
|
14
|
+
import EditorMigrationComponent from '../../editor-next/editor-migration-component';
|
|
13
15
|
import EditorWithActions from '../../labs/EditorWithActions';
|
|
14
16
|
import ChromeCollapsed from '../ChromeCollapsed';
|
|
15
17
|
var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -31,28 +33,20 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
31
33
|
return _this;
|
|
32
34
|
}
|
|
33
35
|
_createClass(CollapsedEditor, [{
|
|
34
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
35
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
36
|
-
if (!this.props.isExpanded && nextProps.isExpanded) {
|
|
37
|
-
this.shouldTriggerExpandEvent = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
36
|
key: "componentDidUpdate",
|
|
42
37
|
value: function componentDidUpdate() {
|
|
43
|
-
if (this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.props.onExpand();
|
|
47
|
-
}
|
|
38
|
+
if (this.props.isExpanded && this.editorComponent && (!this.previouslyExpanded || this.previouslyExpanded === undefined)) {
|
|
39
|
+
var _this$props$onExpand, _this$props;
|
|
40
|
+
(_this$props$onExpand = (_this$props = this.props).onExpand) === null || _this$props$onExpand === void 0 ? void 0 : _this$props$onExpand.call(_this$props);
|
|
48
41
|
}
|
|
42
|
+
this.previouslyExpanded = this.props.isExpanded;
|
|
49
43
|
}
|
|
50
44
|
}, {
|
|
51
45
|
key: "render",
|
|
52
46
|
value: function render() {
|
|
53
47
|
var _this2 = this;
|
|
54
48
|
var child = React.Children.only(this.props.children);
|
|
55
|
-
if (child.type !== Editor && child.type !== EditorWithActions) {
|
|
49
|
+
if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext && child.type !== EditorMigrationComponent) {
|
|
56
50
|
throw new Error('Expected child to be of type `Editor`');
|
|
57
51
|
}
|
|
58
52
|
if (!this.props.isExpanded) {
|