@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
package/dist/esm/index.js
CHANGED
|
@@ -61,4 +61,5 @@ export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ui/Co
|
|
|
61
61
|
export { DEFAULT_BORDER_COLOR } from './ui/ColorPalette/Palettes/common';
|
|
62
62
|
export { default as messages, statusMessages, dateMessages } from './messages';
|
|
63
63
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
64
|
-
export { createQuickInsertTools } from './plugins/quick-insert/api';
|
|
64
|
+
export { createQuickInsertTools } from './plugins/quick-insert/api';
|
|
65
|
+
export { default as EditorMigrationComponent } from './editor-next/editor-migration-component';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { fireAnalyticsEvent } from '
|
|
3
|
-
import { analyticsEventKey } from '
|
|
2
|
+
import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Subscribes to analytics events fired from editor components
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Node } from 'prosemirror-model';
|
|
2
|
-
import {
|
|
2
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../../../../../utils/nodes';
|
|
4
5
|
import { compose, toJSON } from '../../../../../utils';
|
|
5
6
|
import { getDocStructure } from '../../../../../utils/document-logger';
|
|
6
|
-
import { analyticsEventKey } from '../../../../../plugins/analytics/consts';
|
|
7
|
-
|
|
8
7
|
// Helper to assure correct payload when dispatch analytics
|
|
9
8
|
function dispatchAnalytics(dispatch, payload) {
|
|
10
9
|
dispatch(analyticsEventKey, payload);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
+
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
4
|
+
import { createEditorSelectionAPI } from '../../../selection-api/api';
|
|
5
|
+
import { createInsertNodeAPI } from '../../../insert-api/api';
|
|
6
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { attachPayloadIntoTransaction } from '../../../analytics-api/attach-payload-into-transaction';
|
|
8
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* DO NOT USE THIS FUNCTION
|
|
12
|
+
*
|
|
13
|
+
* IT IS A TEMPORARY PLACEHOLDER UNTIL THOSE TICKETS XX-11111 XX-22222 are done
|
|
14
|
+
**/
|
|
15
|
+
export var createStubInternalApis = function createStubInternalApis() {
|
|
16
|
+
var editorViewRef = {
|
|
17
|
+
current: null
|
|
18
|
+
};
|
|
19
|
+
var createAnalyticsEventRef = {
|
|
20
|
+
current: null
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
var createAnalyticsEvent = function createAnalyticsEvent(payload) {
|
|
25
|
+
// That means the AnalyticsNext context is being used
|
|
26
|
+
if (createAnalyticsEventRef.current) {
|
|
27
|
+
return createAnalyticsEventRef.current(payload);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// That means, there is no createAnalyticsEvent available at all.
|
|
31
|
+
// This should not happen, but if it does, we will send a mock function to avoid
|
|
32
|
+
// regression on SmartLinks (they are the only one using this function directly)
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.error('This should never be called, if it does we have a problem');
|
|
35
|
+
return {
|
|
36
|
+
fire: function fire() {}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var editorSelectionAPI = createEditorSelectionAPI();
|
|
40
|
+
var editorAnalyticsAPI = {
|
|
41
|
+
attachAnalyticsEvent: function attachAnalyticsEvent(payload) {
|
|
42
|
+
return function (tr) {
|
|
43
|
+
var editorView = editorViewRef.current;
|
|
44
|
+
if (!tr || !createAnalyticsEvent || !editorView) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
attachPayloadIntoTransaction({
|
|
48
|
+
tr: tr,
|
|
49
|
+
editorState: editorView.state,
|
|
50
|
+
payload: payload,
|
|
51
|
+
channel: FabricChannel.editor
|
|
52
|
+
});
|
|
53
|
+
return true;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var insertNodeAPI = createInsertNodeAPI({
|
|
58
|
+
getEditorView: function getEditorView() {
|
|
59
|
+
return editorViewRef.current;
|
|
60
|
+
},
|
|
61
|
+
getEditorPlugins: function getEditorPlugins() {
|
|
62
|
+
var fakeTablePlugin = tablesPlugin();
|
|
63
|
+
if (!(fakeTablePlugin !== null && fakeTablePlugin !== void 0 && fakeTablePlugin.pluginsOptions)) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
return [fakeTablePlugin];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var MountCreateAnalyticsEventRef = function MountCreateAnalyticsEventRef() {
|
|
70
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
71
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
72
|
+
React.useLayoutEffect(function () {
|
|
73
|
+
createAnalyticsEventRef.current = createAnalyticsEvent;
|
|
74
|
+
}, [createAnalyticsEvent]);
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
var stubInternalApisPlugin = function stubInternalApisPlugin() {
|
|
78
|
+
return {
|
|
79
|
+
name: 'stubInternalApisPlugin',
|
|
80
|
+
pmPlugins: function pmPlugins() {
|
|
81
|
+
return [{
|
|
82
|
+
name: 'stubInternalApisPMPlugin',
|
|
83
|
+
plugin: function plugin() {
|
|
84
|
+
return new SafePlugin({
|
|
85
|
+
view: function view(editorView) {
|
|
86
|
+
editorViewRef.current = editorView;
|
|
87
|
+
return {
|
|
88
|
+
destroy: function destroy() {
|
|
89
|
+
editorViewRef.current = null;
|
|
90
|
+
createAnalyticsEventRef.current = null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}];
|
|
97
|
+
},
|
|
98
|
+
contentComponent: function contentComponent() {
|
|
99
|
+
return /*#__PURE__*/React.createElement(MountCreateAnalyticsEventRef);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
editorSelectionAPI: editorSelectionAPI,
|
|
105
|
+
insertNodeAPI: insertNodeAPI,
|
|
106
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
107
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
108
|
+
stubInternalApisPlugin: stubInternalApisPlugin
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -76,11 +76,6 @@ export var Preset = /*#__PURE__*/function () {
|
|
|
76
76
|
cache.forEach(function (options, fn) {
|
|
77
77
|
plugins.push(fn(options));
|
|
78
78
|
});
|
|
79
|
-
if (plugins.some(function (plugin) {
|
|
80
|
-
return typeof plugin === 'function';
|
|
81
|
-
})) {
|
|
82
|
-
throw new Error("!!! NextEditorPluginWithDependencies detected in presets. That's an unsupported runtime use case right now.");
|
|
83
|
-
}
|
|
84
79
|
return plugins;
|
|
85
80
|
}
|
|
86
81
|
}, {
|
|
@@ -8,6 +8,7 @@ import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
|
|
|
8
8
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
9
9
|
import { createDefaultPreset } from './default';
|
|
10
10
|
import { shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
11
|
+
import { createStubInternalApis } from './create-stub-internal-apis';
|
|
11
12
|
/**
|
|
12
13
|
* Creates a preset with all of the available plugins.
|
|
13
14
|
* Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
|
|
@@ -24,7 +25,7 @@ import { shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
|
24
25
|
* @param getEditorContainerWidth
|
|
25
26
|
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
26
27
|
*/
|
|
27
|
-
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
28
|
+
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, maybeCreateAnalyticsEvent, _insertNodeAPI, _editorAnalyticsAPI, _editorSelectionAPI, _getEditorContainerWidth) {
|
|
28
29
|
var _props$linking;
|
|
29
30
|
var isMobile = appearance === 'mobile';
|
|
30
31
|
var isComment = appearance === 'comment';
|
|
@@ -33,6 +34,13 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
33
34
|
var getEditorFeatureFlags = function getEditorFeatureFlags() {
|
|
34
35
|
return featureFlags;
|
|
35
36
|
};
|
|
37
|
+
var stubs = createStubInternalApis();
|
|
38
|
+
var editorSelectionAPI = stubs.editorSelectionAPI,
|
|
39
|
+
insertNodeAPI = stubs.insertNodeAPI,
|
|
40
|
+
editorAnalyticsAPI = stubs.editorAnalyticsAPI,
|
|
41
|
+
stubInternalApisPlugin = stubs.stubInternalApisPlugin;
|
|
42
|
+
var createAnalyticsEvent = maybeCreateAnalyticsEvent ? maybeCreateAnalyticsEvent : stubs.createAnalyticsEvent;
|
|
43
|
+
preset.add(stubInternalApisPlugin);
|
|
36
44
|
if (props.allowAnalyticsGASV3) {
|
|
37
45
|
var performanceTracking = props.performanceTracking;
|
|
38
46
|
preset.add([analyticsPlugin, {
|
|
@@ -221,7 +229,8 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
221
229
|
platform: isMobile ? 'mobile' : 'web',
|
|
222
230
|
fullWidthMode: fullWidthMode,
|
|
223
231
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
224
|
-
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker
|
|
232
|
+
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker,
|
|
233
|
+
editorAppearance: appearance
|
|
225
234
|
})]);
|
|
226
235
|
}
|
|
227
236
|
if (props.autoformattingProvider) {
|
|
@@ -5,6 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
12
|
/** @jsx jsx */
|
|
@@ -30,7 +32,8 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
30
32
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
33
|
_defineProperty(_assertThisInitialized(_this), "toolbarItemRef", /*#__PURE__*/React.createRef());
|
|
32
34
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
33
|
-
isOpen: false
|
|
35
|
+
isOpen: false,
|
|
36
|
+
isOpenedByKeyboard: false
|
|
34
37
|
});
|
|
35
38
|
_defineProperty(_assertThisInitialized(_this), "changeAlignment", function (align, togglePopup) {
|
|
36
39
|
if (togglePopup) {
|
|
@@ -39,16 +42,20 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
39
42
|
return _this.props.changeAlignment(align);
|
|
40
43
|
});
|
|
41
44
|
_defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
|
|
42
|
-
_this.handleOpenChange({
|
|
43
|
-
isOpen: !_this.state.isOpen
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "handleOpenChange", function (_ref) {
|
|
47
|
-
var isOpen = _ref.isOpen;
|
|
48
45
|
_this.setState({
|
|
49
|
-
isOpen: isOpen
|
|
46
|
+
isOpen: !_this.state.isOpen,
|
|
47
|
+
isOpenedByKeyboard: false
|
|
50
48
|
});
|
|
51
49
|
});
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "toggleOpenByKeyboard", function (event) {
|
|
51
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
_this.setState({
|
|
54
|
+
isOpen: !_this.state.isOpen,
|
|
55
|
+
isOpenedByKeyboard: true
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
52
59
|
_defineProperty(_assertThisInitialized(_this), "hide", function (attrs) {
|
|
53
60
|
if (_this.state.isOpen) {
|
|
54
61
|
_this.setState({
|
|
@@ -71,7 +78,9 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
71
78
|
key: "render",
|
|
72
79
|
value: function render() {
|
|
73
80
|
var _this2 = this;
|
|
74
|
-
var
|
|
81
|
+
var _this$state = this.state,
|
|
82
|
+
isOpen = _this$state.isOpen,
|
|
83
|
+
isOpenedByKeyboard = _this$state.isOpenedByKeyboard;
|
|
75
84
|
var _this$props = this.props,
|
|
76
85
|
popupsMountPoint = _this$props.popupsMountPoint,
|
|
77
86
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
@@ -88,13 +97,19 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
88
97
|
boundariesElement: popupsBoundariesElement,
|
|
89
98
|
scrollableElement: popupsScrollableElement,
|
|
90
99
|
isOpen: isOpen,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
101
|
+
if (isOpenedByKeyboard) {
|
|
102
|
+
_this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {
|
|
103
|
+
isOpenedByKeyboard: false
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
return isOpenedByKeyboard;
|
|
107
|
+
},
|
|
108
|
+
onOpenChange: function onOpenChange(_ref) {
|
|
109
|
+
var isOpen = _ref.isOpen;
|
|
94
110
|
_this2.setState({
|
|
95
111
|
isOpen: isOpen
|
|
96
112
|
});
|
|
97
|
-
(_this2$toolbarItemRef = _this2.toolbarItemRef) === null || _this2$toolbarItemRef === void 0 ? void 0 : (_this2$toolbarItemRef2 = _this2$toolbarItemRef.current) === null || _this2$toolbarItemRef2 === void 0 ? void 0 : _this2$toolbarItemRef2.focus();
|
|
98
113
|
},
|
|
99
114
|
handleClickOutside: function handleClickOutside(event) {
|
|
100
115
|
if (event instanceof MouseEvent) {
|
|
@@ -118,6 +133,7 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
118
133
|
"aria-expanded": isOpen,
|
|
119
134
|
"aria-haspopup": true,
|
|
120
135
|
onClick: this.toggleOpen,
|
|
136
|
+
onKeyDown: this.toggleOpenByKeyboard,
|
|
121
137
|
iconBefore: jsx("div", {
|
|
122
138
|
css: triggerWrapper
|
|
123
139
|
}, jsx(IconMap, {
|
|
@@ -138,6 +154,25 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
138
154
|
css: separator
|
|
139
155
|
}));
|
|
140
156
|
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "componentDidUpdate",
|
|
159
|
+
value: function componentDidUpdate(prevProps) {
|
|
160
|
+
var _this3 = this;
|
|
161
|
+
if (this.state.isOpen && this.state.isOpenedByKeyboard) {
|
|
162
|
+
// by triggering the keyboard event with a setTimeout, we ensure that the tooltip
|
|
163
|
+
// associated with the alignment button doesn't render until the next render cycle
|
|
164
|
+
// where the popup will be correctly positioned and the relative position of the tooltip
|
|
165
|
+
// will not overlap with the button.
|
|
166
|
+
setTimeout(function () {
|
|
167
|
+
var _this3$toolbarItemRef;
|
|
168
|
+
var keyboardEvent = new KeyboardEvent('keydown', {
|
|
169
|
+
bubbles: true,
|
|
170
|
+
key: 'ArrowDown'
|
|
171
|
+
});
|
|
172
|
+
(_this3$toolbarItemRef = _this3.toolbarItemRef.current) === null || _this3$toolbarItemRef === void 0 ? void 0 : _this3$toolbarItemRef.dispatchEvent(keyboardEvent);
|
|
173
|
+
}, 0);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
141
176
|
}]);
|
|
142
177
|
return AlignmentToolbar;
|
|
143
178
|
}(React.Component);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import analyticsPlugin from './plugin';
|
|
2
2
|
import { analyticsPluginKey as pluginKey } from './plugin-key';
|
|
3
|
-
export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
export { withAnalytics, addAnalytics, findInsertLocation,
|
|
3
|
+
export { ACTION_SUBJECT_ID, ACTION_SUBJECT, ACTION, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE, FULL_WIDTH_MODE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, MODE, PasteContents, PasteSources, PasteTypes, PLATFORMS, PUNC, SYMBOL, TABLE_ACTION, TABLE_BREAKOUT, TRIGGER_METHOD, USER_CONTEXT, DELETE_DIRECTION, LIST_TEXT_SCENARIOS, fireAnalyticsEvent, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export { withAnalytics, addAnalytics, findInsertLocation, getSelectionType, getStateContext, mapActionSubjectIdToAttributes } from './utils';
|
|
5
5
|
export var analyticsPluginKey = pluginKey;
|
|
6
|
-
export default analyticsPlugin;
|
|
7
|
-
export { fireAnalyticsEvent } from './fire-analytics-event';
|
|
6
|
+
export default analyticsPlugin;
|
|
@@ -8,9 +8,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
9
|
import { isPerformanceAPIAvailable, measureRender } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { ACTION, EVENT_TYPE } from './types';
|
|
11
|
-
import { getAnalyticsEventsFromTransaction } from './utils';
|
|
12
11
|
import { analyticsPluginKey } from './plugin-key';
|
|
13
|
-
import { fireAnalyticsEvent } from '
|
|
12
|
+
import { fireAnalyticsEvent, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import { getFeatureFlags } from '../feature-flags-context';
|
|
15
14
|
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
16
15
|
import { generateUndoRedoInputSoucePayload } from '../undo-redo/undo-redo-input-source';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
3
1
|
import { editorAnalyticsChannel } from './consts';
|
|
4
2
|
import { analyticsPluginKey } from './plugin-key';
|
|
5
3
|
function getCreateUIAnalyticsEvent(editorState) {
|
|
@@ -41,11 +39,4 @@ export function withAnalytics(payload, channel) {
|
|
|
41
39
|
}, view);
|
|
42
40
|
};
|
|
43
41
|
};
|
|
44
|
-
}
|
|
45
|
-
export function getAnalyticsEventsFromTransaction(tr) {
|
|
46
|
-
return tr.steps.filter(function (step) {
|
|
47
|
-
return step instanceof AnalyticsStep;
|
|
48
|
-
}).reduce(function (acc, step) {
|
|
49
|
-
return [].concat(_toConsumableArray(acc), _toConsumableArray(step.analyticsEvents));
|
|
50
|
-
}, []);
|
|
51
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ACTION_SUBJECT, ACTION, EVENT_TYPE, getAnalyticsEventsFromTransaction } from '
|
|
2
|
+
import { ACTION_SUBJECT, ACTION, EVENT_TYPE, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
var hasInvalidSteps = function hasInvalidSteps(tr) {
|
|
4
4
|
return (tr.steps || []).some(function (step) {
|
|
5
5
|
return step.from > step.to;
|
|
@@ -42,6 +42,8 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
|
|
|
42
42
|
export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
|
|
43
43
|
var interactionType;
|
|
44
44
|
var inputLatencyTracker = null;
|
|
45
|
+
var inputLatencySingleKeyTracker = null;
|
|
46
|
+
var inputLatencyRenderedTracker = null;
|
|
45
47
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
46
48
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
|
|
47
49
|
}
|
|
@@ -65,19 +67,80 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
65
67
|
var shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
|
|
66
68
|
var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
|
|
67
69
|
var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
|
|
70
|
+
var createDispatchSample = function createDispatchSample(action, view) {
|
|
71
|
+
return function (time, severity) {
|
|
72
|
+
var _getContextIdentifier2;
|
|
73
|
+
var state = view.state;
|
|
74
|
+
var nodesCount = getNodeCount(state);
|
|
75
|
+
var samplePayload = {
|
|
76
|
+
action: action,
|
|
77
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
78
|
+
attributes: _objectSpread(_objectSpread({
|
|
79
|
+
time: time,
|
|
80
|
+
nodeSize: state.doc.nodeSize
|
|
81
|
+
}, nodesCount), {}, {
|
|
82
|
+
participants: getParticipantsCount(state),
|
|
83
|
+
objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
|
|
84
|
+
severity: shouldTrackSeverity ? severity : undefined
|
|
85
|
+
}),
|
|
86
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
87
|
+
};
|
|
88
|
+
dispatchAnalyticsEvent(samplePayload);
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
var createDispatchAverage = function createDispatchAverage(action, view) {
|
|
92
|
+
return function (_ref, severity) {
|
|
93
|
+
var _getContextIdentifier3;
|
|
94
|
+
var mean = _ref.mean,
|
|
95
|
+
median = _ref.median,
|
|
96
|
+
sampleSize = _ref.sampleSize;
|
|
97
|
+
var state = view.state;
|
|
98
|
+
var nodeCount = getNodeCount(state);
|
|
99
|
+
var averagePayload = {
|
|
100
|
+
action: action,
|
|
101
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
102
|
+
attributes: _objectSpread(_objectSpread({
|
|
103
|
+
mean: mean,
|
|
104
|
+
median: median,
|
|
105
|
+
sampleSize: sampleSize
|
|
106
|
+
}, nodeCount), {}, {
|
|
107
|
+
nodeSize: state.doc.nodeSize,
|
|
108
|
+
severity: shouldTrackSeverity ? severity : undefined,
|
|
109
|
+
participants: getParticipantsCount(state),
|
|
110
|
+
objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId
|
|
111
|
+
}),
|
|
112
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
113
|
+
};
|
|
114
|
+
dispatchAnalyticsEvent(averagePayload);
|
|
115
|
+
};
|
|
116
|
+
};
|
|
68
117
|
return new SafePlugin({
|
|
69
118
|
key: frozenEditorPluginKey,
|
|
70
119
|
props: isPerformanceAPIAvailable() ? {
|
|
71
120
|
handleTextInput: function handleTextInput(view) {
|
|
72
|
-
var _inputLatencyTracker;
|
|
73
|
-
(_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.start();
|
|
74
121
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
75
122
|
interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
76
123
|
}
|
|
77
|
-
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
124
|
+
if (inputLatencyTracker) {
|
|
125
|
+
var end = inputLatencyTracker.start();
|
|
126
|
+
|
|
127
|
+
// This is called after all handleTextInput events are executed which means first handleTextInput time incorporates following handleTextInput processing time
|
|
128
|
+
// Also this is called before browser rendering so it doesn't count it.
|
|
129
|
+
requestAnimationFrame(end);
|
|
130
|
+
}
|
|
131
|
+
if (inputLatencySingleKeyTracker) {
|
|
132
|
+
var _end = inputLatencySingleKeyTracker.start();
|
|
133
|
+
|
|
134
|
+
// This is executed before next handleTextInput when multiple keypress events are in one animation frame
|
|
135
|
+
// so it tracks individual keypress processing time
|
|
136
|
+
Promise.resolve().then(_end);
|
|
137
|
+
}
|
|
138
|
+
if (inputLatencyRenderedTracker) {
|
|
139
|
+
var _end2 = inputLatencyRenderedTracker.start();
|
|
140
|
+
|
|
141
|
+
// This is called at the next event loop so it counts browser rendering time.
|
|
142
|
+
setTimeout(_end2);
|
|
143
|
+
}
|
|
81
144
|
return false;
|
|
82
145
|
},
|
|
83
146
|
handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
|
|
@@ -105,10 +168,10 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
105
168
|
onSampleStart: function onSampleStart() {
|
|
106
169
|
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
|
|
107
170
|
},
|
|
108
|
-
onSampleEnd: function onSampleEnd(time,
|
|
109
|
-
var
|
|
110
|
-
var isSlow =
|
|
111
|
-
severity =
|
|
171
|
+
onSampleEnd: function onSampleEnd(time, _ref2) {
|
|
172
|
+
var _getContextIdentifier4;
|
|
173
|
+
var isSlow = _ref2.isSlow,
|
|
174
|
+
severity = _ref2.severity;
|
|
112
175
|
var state = _view.state;
|
|
113
176
|
var nodesCount = getNodeCount(state);
|
|
114
177
|
if (isSlow) {
|
|
@@ -120,54 +183,13 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
120
183
|
nodeSize: state.doc.nodeSize
|
|
121
184
|
}, nodesCount), {}, {
|
|
122
185
|
participants: getParticipantsCount(state),
|
|
123
|
-
objectId: (
|
|
186
|
+
objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
|
|
124
187
|
time: time,
|
|
125
188
|
severity: shouldTrackSeverity ? severity : undefined
|
|
126
189
|
}));
|
|
127
190
|
},
|
|
128
|
-
dispatchSample:
|
|
129
|
-
|
|
130
|
-
var state = _view.state;
|
|
131
|
-
var nodesCount = getNodeCount(state);
|
|
132
|
-
var samplePayload = {
|
|
133
|
-
action: ACTION.INPUT_PERF_SAMPLING,
|
|
134
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
135
|
-
attributes: _objectSpread(_objectSpread({
|
|
136
|
-
time: time,
|
|
137
|
-
nodeSize: state.doc.nodeSize
|
|
138
|
-
}, nodesCount), {}, {
|
|
139
|
-
participants: getParticipantsCount(state),
|
|
140
|
-
objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
|
|
141
|
-
severity: shouldTrackSeverity ? severity : undefined
|
|
142
|
-
}),
|
|
143
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
144
|
-
};
|
|
145
|
-
dispatchAnalyticsEvent(samplePayload);
|
|
146
|
-
},
|
|
147
|
-
dispatchAverage: function dispatchAverage(_ref2, severity) {
|
|
148
|
-
var _getContextIdentifier4;
|
|
149
|
-
var mean = _ref2.mean,
|
|
150
|
-
median = _ref2.median,
|
|
151
|
-
sampleSize = _ref2.sampleSize;
|
|
152
|
-
var state = _view.state;
|
|
153
|
-
var nodeCount = getNodeCount(state);
|
|
154
|
-
var averagePayload = {
|
|
155
|
-
action: ACTION.INPUT_PERF_SAMPLING_AVG,
|
|
156
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
157
|
-
attributes: _objectSpread(_objectSpread({
|
|
158
|
-
mean: mean,
|
|
159
|
-
median: median,
|
|
160
|
-
sampleSize: sampleSize
|
|
161
|
-
}, nodeCount), {}, {
|
|
162
|
-
nodeSize: state.doc.nodeSize,
|
|
163
|
-
severity: shouldTrackSeverity ? severity : undefined,
|
|
164
|
-
participants: getParticipantsCount(state),
|
|
165
|
-
objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId
|
|
166
|
-
}),
|
|
167
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
168
|
-
};
|
|
169
|
-
dispatchAnalyticsEvent(averagePayload);
|
|
170
|
-
},
|
|
191
|
+
dispatchSample: createDispatchSample(ACTION.INPUT_PERF_SAMPLING, _view),
|
|
192
|
+
dispatchAverage: createDispatchAverage(ACTION.INPUT_PERF_SAMPLING_AVG, _view),
|
|
171
193
|
onSlowInput: function onSlowInput(time) {
|
|
172
194
|
var _getContextIdentifier5;
|
|
173
195
|
var state = _view.state;
|
|
@@ -187,6 +209,26 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
187
209
|
}
|
|
188
210
|
});
|
|
189
211
|
}
|
|
212
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackSingleKeypress) {
|
|
213
|
+
inputLatencySingleKeyTracker = new InputLatencyTracker({
|
|
214
|
+
samplingRate: samplingRate,
|
|
215
|
+
slowThreshold: slowThreshold,
|
|
216
|
+
normalThreshold: severityThresholdNormal,
|
|
217
|
+
degradedThreshold: severityThresholdDegraded,
|
|
218
|
+
dispatchSample: createDispatchSample(ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS, _view),
|
|
219
|
+
dispatchAverage: createDispatchAverage(ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS_AVG, _view)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackRenderingTime) {
|
|
223
|
+
inputLatencyRenderedTracker = new InputLatencyTracker({
|
|
224
|
+
samplingRate: samplingRate,
|
|
225
|
+
slowThreshold: slowThreshold,
|
|
226
|
+
normalThreshold: severityThresholdNormal,
|
|
227
|
+
degradedThreshold: severityThresholdDegraded,
|
|
228
|
+
dispatchSample: createDispatchSample(ACTION.INPUT_PERF_SAMPLING_RENDERED, _view),
|
|
229
|
+
dispatchAverage: createDispatchAverage(ACTION.INPUT_PERF_SAMPLING_RENDERED_AVG, _view)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
190
232
|
var observer;
|
|
191
233
|
try {
|
|
192
234
|
var _observer = new PerformanceObserver(function (list) {
|
|
@@ -206,8 +248,8 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
|
|
|
206
248
|
} catch (e) {}
|
|
207
249
|
return {
|
|
208
250
|
destroy: function destroy() {
|
|
209
|
-
var
|
|
210
|
-
(
|
|
251
|
+
var _inputLatencyTracker;
|
|
252
|
+
(_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.flush();
|
|
211
253
|
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
212
254
|
}
|
|
213
255
|
};
|
|
@@ -17,7 +17,6 @@ var InputLatencyTracker = /*#__PURE__*/function () {
|
|
|
17
17
|
_classCallCheck(this, InputLatencyTracker);
|
|
18
18
|
_defineProperty(this, "samples", []);
|
|
19
19
|
_defineProperty(this, "total", 0);
|
|
20
|
-
this.currentStart = null;
|
|
21
20
|
this.samplingRate = samplingRate;
|
|
22
21
|
this.slowThreshold = slowThreshold;
|
|
23
22
|
this.normalThreshold = normalThreshold;
|
|
@@ -31,34 +30,34 @@ var InputLatencyTracker = /*#__PURE__*/function () {
|
|
|
31
30
|
_createClass(InputLatencyTracker, [{
|
|
32
31
|
key: "start",
|
|
33
32
|
value: function start() {
|
|
34
|
-
|
|
33
|
+
var _this = this;
|
|
34
|
+
var currentStart = performance.now();
|
|
35
35
|
if (this.samples.length + 1 === this.samplingRate) {
|
|
36
36
|
var _this$onSampleStart;
|
|
37
37
|
(_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
(_this
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
39
|
+
var end = function end() {
|
|
40
|
+
if (currentStart === null) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var isSlow = false;
|
|
44
|
+
var time = getTimeSince(currentStart);
|
|
45
|
+
_this.push(time);
|
|
46
|
+
if (time > _this.slowThreshold) {
|
|
47
|
+
var _this$onSlowInput;
|
|
48
|
+
(_this$onSlowInput = _this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(_this, time);
|
|
49
|
+
isSlow = true;
|
|
50
|
+
}
|
|
51
|
+
if (_this.samples.length === _this.samplingRate) {
|
|
52
|
+
var _this$onSampleEnd;
|
|
53
|
+
_this.flush();
|
|
54
|
+
(_this$onSampleEnd = _this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(_this, time, {
|
|
55
|
+
isSlow: isSlow,
|
|
56
|
+
severity: _this.severity(time)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return end;
|
|
62
61
|
}
|
|
63
62
|
}, {
|
|
64
63
|
key: "flush",
|
|
@@ -22,6 +22,7 @@ export var BlockTypeButton = function BlockTypeButton(props) {
|
|
|
22
22
|
className: "block-type-btn",
|
|
23
23
|
disabled: props.disabled,
|
|
24
24
|
onClick: props.onClick,
|
|
25
|
+
onKeyDown: props.onKeyDown,
|
|
25
26
|
title: labelTextStyles,
|
|
26
27
|
"aria-label": labelTextStyles,
|
|
27
28
|
"aria-haspopup": true,
|