@atlaskit/editor-core 179.1.2 → 180.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
- package/dist/cjs/actions/index.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +12 -762
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +1 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +35 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
- package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
- package/dist/cjs/editor-next/index.js +139 -0
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
- package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
- package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
- package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
- package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
- package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
- package/dist/cjs/editor.js +130 -443
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
- package/dist/cjs/labs/next/presets/preset.js +0 -5
- package/dist/cjs/labs/next/presets/universal.js +11 -2
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/cjs/plugins/analytics/index.js +2 -3
- package/dist/cjs/plugins/analytics/plugin.js +5 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
- package/dist/cjs/plugins/hyperlink/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/cjs/plugins/media/commands/helpers.js +12 -40
- package/dist/cjs/plugins/media/commands/index.js +4 -4
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/cjs/plugins/panel/utils.js +4 -1
- package/dist/cjs/plugins/paste/handlers.js +128 -13
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/cjs/plugins/text-formatting/utils.js +1 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/types/get-editor-props.js +5 -0
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ContextPanel/context.js +13 -12
- package/dist/cjs/ui/Dropdown/index.js +7 -2
- package/dist/cjs/ui/DropdownMenu/index.js +7 -2
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +32 -0
- package/dist/cjs/utils/linking-utils.js +1 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
- package/dist/cjs/utils/performance/safer-transactions.js +1 -1
- package/dist/cjs/utils/prepare-extension-provider.js +25 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -2
- package/dist/es2019/create-editor/ReactEditorView.js +6 -708
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +1 -0
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +10 -0
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
- package/dist/es2019/editor-next/index.js +90 -0
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
- package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
- package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
- package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
- package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
- package/dist/es2019/editor.js +111 -396
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
- package/dist/es2019/labs/next/presets/preset.js +0 -3
- package/dist/es2019/labs/next/presets/universal.js +13 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
- package/dist/es2019/plugins/analytics/index.js +3 -4
- package/dist/es2019/plugins/analytics/plugin.js +1 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
- package/dist/es2019/plugins/hyperlink/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
- package/dist/es2019/plugins/media/commands/helpers.js +9 -35
- package/dist/es2019/plugins/media/commands/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/es2019/plugins/text-formatting/utils.js +0 -8
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/types/get-editor-props.js +1 -0
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ContextPanel/context.js +5 -4
- package/dist/es2019/ui/Dropdown/index.js +5 -2
- package/dist/es2019/ui/DropdownMenu/index.js +5 -2
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +25 -0
- package/dist/es2019/utils/linking-utils.js +1 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
- package/dist/es2019/utils/performance/safer-transactions.js +1 -1
- package/dist/es2019/utils/prepare-extension-provider.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -2
- package/dist/esm/create-editor/ReactEditorView.js +12 -763
- package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +1 -0
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +28 -0
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
- package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
- package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
- package/dist/esm/editor-next/index.js +134 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
- package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
- package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
- package/dist/esm/editor-next/utils/handleProviders.js +50 -0
- package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
- package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
- package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
- package/dist/esm/editor.js +130 -440
- package/dist/esm/index.js +2 -1
- package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
- package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
- package/dist/esm/labs/next/presets/preset.js +0 -5
- package/dist/esm/labs/next/presets/universal.js +11 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
- package/dist/esm/plugins/analytics/index.js +3 -4
- package/dist/esm/plugins/analytics/plugin.js +1 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/hyperlink/analytics.js +1 -1
- package/dist/esm/plugins/hyperlink/index.js +1 -1
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
- package/dist/esm/plugins/media/commands/helpers.js +9 -35
- package/dist/esm/plugins/media/commands/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
- package/dist/esm/plugins/text-formatting/utils.js +0 -8
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/types/get-editor-props.js +1 -0
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPickerButton/index.js +69 -7
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ContextPanel/context.js +8 -8
- package/dist/esm/ui/Dropdown/index.js +7 -2
- package/dist/esm/ui/DropdownMenu/index.js +7 -2
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +25 -0
- package/dist/esm/utils/linking-utils.js +1 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
- package/dist/esm/utils/performance/safer-transactions.js +1 -1
- package/dist/esm/utils/prepare-extension-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
- package/dist/types/editor-next/editor-internal.d.ts +44 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
- package/dist/types/editor-next/index.d.ts +34 -0
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
- package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
- package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
- package/dist/types/editor.d.ts +47 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
- package/dist/types/labs/next/presets/preset.d.ts +6 -6
- package/dist/types/labs/next/presets/universal.d.ts +1 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
- package/dist/types/plugins/analytics/index.d.ts +3 -6
- package/dist/types/plugins/analytics/plugin.d.ts +3 -1
- package/dist/types/plugins/analytics/utils.d.ts +2 -3
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -1
- package/dist/types/plugins/base/index.d.ts +3 -1
- package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
- package/dist/types/plugins/block-type/index.d.ts +3 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/breakout/index.d.ts +3 -1
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/context-panel/index.d.ts +1 -1
- package/dist/types/plugins/emoji/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +3 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +5 -0
- package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
- package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +3 -1
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/hyperlink/types.d.ts +3 -1
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types/plugins/layout/index.d.ts +3 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/max-content-size/index.d.ts +3 -1
- package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
- package/dist/types/plugins/media/commands/index.d.ts +1 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
- package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +3 -1
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
- package/dist/types/plugins/placeholder/index.d.ts +3 -1
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/plugins/quick-insert/index.d.ts +3 -1
- package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
- package/dist/types/plugins/selection/index.d.ts +3 -1
- package/dist/types/plugins/status/index.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
- package/dist/types/plugins/submit-editor/index.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/index.d.ts +3 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/types/get-editor-props.d.ts +12 -0
- package/dist/types/types/performance-tracking.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/utils/document.d.ts +4 -3
- package/dist/types/utils/get-editor-plugins.d.ts +10 -0
- package/dist/types/utils/linking-utils.d.ts +1 -1
- package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
- package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
- package/docs/0-intro.tsx +0 -1
- package/package.json +27 -26
- package/report.api.md +193 -139
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
- package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactEditorView } from './ReactEditorViewInternal';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
export function ReactEditorViewEditor(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(ReactEditorView, props);
|
|
6
|
+
}
|
|
7
|
+
export default injectIntl(ReactEditorViewEditor);
|
|
@@ -83,6 +83,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
83
83
|
},
|
|
84
84
|
cardOptions: cardOptions,
|
|
85
85
|
hyperlinkOptions: {
|
|
86
|
+
editorAppearance: props.appearance,
|
|
86
87
|
linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker,
|
|
87
88
|
cardOptions: cardOptions,
|
|
88
89
|
platform: isMobile ? 'mobile' : 'web'
|
|
@@ -25,7 +25,7 @@ function getSpellCheck(featureFlags) {
|
|
|
25
25
|
* which is used by both current and archv3 editors.
|
|
26
26
|
*/
|
|
27
27
|
export function createFeatureFlagsFromProps(props) {
|
|
28
|
-
var _props$featureFlags, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$collabEdit, _props$collabEdit2, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44;
|
|
28
|
+
var _props$featureFlags, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$collabEdit, _props$collabEdit2, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44, _props$featureFlags45;
|
|
29
29
|
var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
30
30
|
var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
|
|
31
31
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
@@ -68,6 +68,7 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
68
68
|
restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedListsToolbar) === true,
|
|
69
69
|
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42.useSomewhatSemanticTextColorNames) : false)),
|
|
70
70
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
71
|
-
preventPopupOverflow: Boolean(typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44['prevent-popup-overflow']) : false)
|
|
71
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44['prevent-popup-overflow']) : false),
|
|
72
|
+
useEditorNext: normalizedFeatureFlags.useEditorNext === true || ((_props$featureFlags45 = props.featureFlags) === null || _props$featureFlags45 === void 0 ? void 0 : _props$featureFlags45.useEditorNext) === true
|
|
72
73
|
});
|
|
73
74
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
|
|
6
|
+
import { BaseTheme, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
7
|
+
import { jsx, css } from '@emotion/react';
|
|
8
|
+
import { Fragment } from 'react';
|
|
9
|
+
import { getUiComponent } from '../create-editor';
|
|
10
|
+
import ReactEditorView from '../create-editor/ReactEditorViewNext';
|
|
11
|
+
import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
12
|
+
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
13
|
+
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
14
|
+
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
15
|
+
import EditorContext from '../ui/EditorContext';
|
|
16
|
+
import { PortalProviderWithThemeProviders, PortalRenderer } from '../ui/PortalProvider';
|
|
17
|
+
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
18
|
+
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
19
|
+
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
20
|
+
import useProviderFactory from './hooks/useProviderFactory';
|
|
21
|
+
/**
|
|
22
|
+
* EditorInternal is used for the internal editor react component
|
|
23
|
+
* with the lifecycle methods extracted into hooks.
|
|
24
|
+
*/
|
|
25
|
+
export default function EditorInternal(props) {
|
|
26
|
+
var editorProps = props.props,
|
|
27
|
+
getExperienceStore = props.getExperienceStore,
|
|
28
|
+
editorActions = props.editorActions,
|
|
29
|
+
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
30
|
+
useMeasureEditorMountTime(editorProps, getExperienceStore, createAnalyticsEvent);
|
|
31
|
+
var providerFactory = useProviderFactory(editorProps, editorActions, createAnalyticsEvent);
|
|
32
|
+
var updatedProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
+
providerFactory: providerFactory
|
|
34
|
+
});
|
|
35
|
+
return jsx(EditorInternalWithoutHooks, updatedProps);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* EditorInternalComponent is used to capture the common component
|
|
40
|
+
* from the `render` method of `Editor` and share it with `EditorNext`.
|
|
41
|
+
*/
|
|
42
|
+
export function EditorInternalWithoutHooks(_ref) {
|
|
43
|
+
var _props$performanceTra, _props$performanceTra2;
|
|
44
|
+
var props = _ref.props,
|
|
45
|
+
handleAnalyticsEvent = _ref.handleAnalyticsEvent,
|
|
46
|
+
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
47
|
+
handleSave = _ref.handleSave,
|
|
48
|
+
editorActions = _ref.editorActions,
|
|
49
|
+
providerFactory = _ref.providerFactory,
|
|
50
|
+
onEditorCreated = _ref.onEditorCreated,
|
|
51
|
+
onEditorDestroyed = _ref.onEditorDestroyed,
|
|
52
|
+
getEditorPlugins = _ref.getEditorPlugins;
|
|
53
|
+
var Component = getUiComponent(props.appearance);
|
|
54
|
+
var overriddenEditorProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
55
|
+
onSave: props.onSave ? handleSave : undefined,
|
|
56
|
+
// noop all analytic events, even if a handler is still passed.
|
|
57
|
+
analyticsHandler: undefined
|
|
58
|
+
});
|
|
59
|
+
var featureFlags = createFeatureFlagsFromProps(props);
|
|
60
|
+
var renderTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.renderTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.editor;
|
|
61
|
+
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
62
|
+
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
63
|
+
return jsx(Fragment, null, renderTrackingEnabled && jsx(RenderTracking, {
|
|
64
|
+
componentProps: props,
|
|
65
|
+
action: ACTION.RE_RENDERED,
|
|
66
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
67
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
68
|
+
propsToIgnore: ['defaultValue'],
|
|
69
|
+
useShallow: useShallow
|
|
70
|
+
}), jsx(ErrorBoundary, {
|
|
71
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
72
|
+
contextIdentifierProvider: props.contextIdentifierProvider
|
|
73
|
+
}, jsx(WidthProvider, {
|
|
74
|
+
css: css({
|
|
75
|
+
height: '100%'
|
|
76
|
+
})
|
|
77
|
+
}, jsx(EditorContext, {
|
|
78
|
+
editorActions: editorActions
|
|
79
|
+
}, jsx(ContextAdapter, null, jsx(PortalProviderWithThemeProviders, {
|
|
80
|
+
onAnalyticsEvent: handleAnalyticsEvent,
|
|
81
|
+
useAnalyticsContext: props.UNSAFE_useAnalyticsContext,
|
|
82
|
+
render: function render(portalProviderAPI) {
|
|
83
|
+
return jsx(Fragment, null, jsx(ReactEditorView, {
|
|
84
|
+
editorProps: overriddenEditorProps,
|
|
85
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
86
|
+
portalProviderAPI: portalProviderAPI,
|
|
87
|
+
providerFactory: providerFactory,
|
|
88
|
+
onEditorCreated: onEditorCreated,
|
|
89
|
+
onEditorDestroyed: onEditorDestroyed,
|
|
90
|
+
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
91
|
+
disabled: props.disabled,
|
|
92
|
+
getEditorPlugins: getEditorPlugins,
|
|
93
|
+
render: function render(_ref2) {
|
|
94
|
+
var _props$featureFlags, _props$featureFlags2;
|
|
95
|
+
var editor = _ref2.editor,
|
|
96
|
+
view = _ref2.view,
|
|
97
|
+
eventDispatcher = _ref2.eventDispatcher,
|
|
98
|
+
config = _ref2.config,
|
|
99
|
+
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
100
|
+
editorRef = _ref2.editorRef;
|
|
101
|
+
return jsx(BaseTheme, {
|
|
102
|
+
baseFontSize: getBaseFontSize(props.appearance)
|
|
103
|
+
}, jsx(Component, {
|
|
104
|
+
innerRef: editorRef,
|
|
105
|
+
appearance: props.appearance,
|
|
106
|
+
disabled: props.disabled,
|
|
107
|
+
editorActions: editorActions,
|
|
108
|
+
editorDOMElement: editor,
|
|
109
|
+
editorView: view,
|
|
110
|
+
providerFactory: providerFactory,
|
|
111
|
+
eventDispatcher: eventDispatcher,
|
|
112
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
113
|
+
maxHeight: props.maxHeight,
|
|
114
|
+
minHeight: props.minHeight,
|
|
115
|
+
onSave: props.onSave ? handleSave : undefined,
|
|
116
|
+
onCancel: props.onCancel,
|
|
117
|
+
popupsMountPoint: props.popupsMountPoint,
|
|
118
|
+
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
119
|
+
popupsScrollableElement: props.popupsScrollableElement,
|
|
120
|
+
contentComponents: config.contentComponents,
|
|
121
|
+
primaryToolbarComponents: config.primaryToolbarComponents,
|
|
122
|
+
primaryToolbarIconBefore: props.primaryToolbarIconBefore,
|
|
123
|
+
secondaryToolbarComponents: config.secondaryToolbarComponents,
|
|
124
|
+
insertMenuItems: props.insertMenuItems,
|
|
125
|
+
customContentComponents: props.contentComponents,
|
|
126
|
+
customPrimaryToolbarComponents: props.primaryToolbarComponents,
|
|
127
|
+
customSecondaryToolbarComponents: props.secondaryToolbarComponents,
|
|
128
|
+
contextPanel: props.contextPanel,
|
|
129
|
+
collabEdit: props.collabEdit,
|
|
130
|
+
persistScrollGutter: props.persistScrollGutter,
|
|
131
|
+
enableToolbarMinWidth: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.toolbarMinWidthOverflow) != null ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.toolbarMinWidthOverflow) : props.allowUndoRedoButtons,
|
|
132
|
+
useStickyToolbar: props.useStickyToolbar,
|
|
133
|
+
featureFlags: featureFlags
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
}), jsx(PortalRenderer, {
|
|
137
|
+
portalProviderAPI: portalProviderAPI
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}))))));
|
|
141
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
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); }; }
|
|
7
|
+
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; } }
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import Editor from '../editor';
|
|
10
|
+
import EditorNext from './index';
|
|
11
|
+
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
12
|
+
var EditorMigrationComponent = /*#__PURE__*/function (_React$Component) {
|
|
13
|
+
_inherits(EditorMigrationComponent, _React$Component);
|
|
14
|
+
var _super = _createSuper(EditorMigrationComponent);
|
|
15
|
+
function EditorMigrationComponent() {
|
|
16
|
+
_classCallCheck(this, EditorMigrationComponent);
|
|
17
|
+
return _super.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
_createClass(EditorMigrationComponent, [{
|
|
20
|
+
key: "render",
|
|
21
|
+
value: function render() {
|
|
22
|
+
var featureFlags = createFeatureFlagsFromProps(this.props);
|
|
23
|
+
return featureFlags.useEditorNext ? /*#__PURE__*/React.createElement(EditorNext, this.props) : /*#__PURE__*/React.createElement(Editor, this.props);
|
|
24
|
+
}
|
|
25
|
+
}]);
|
|
26
|
+
return EditorMigrationComponent;
|
|
27
|
+
}(React.Component);
|
|
28
|
+
export { EditorMigrationComponent as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
|
|
3
|
+
import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { measureTTI, startMeasure } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import measurements from '../../utils/performance/measure-enum';
|
|
6
|
+
import editorMeasureTTICallback from '../utils/editorMeasureTTICallback';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Hook to be used for running analytics on mounting the editor.
|
|
11
|
+
* Should run once.
|
|
12
|
+
* WARNING: Consider any changes to also make to `src/editor.tsx`
|
|
13
|
+
*
|
|
14
|
+
* @param performanceTracking
|
|
15
|
+
* @param featureFlags
|
|
16
|
+
* @param getExperienceStore function to retrieve the Editor's current ExperienceStore
|
|
17
|
+
* @param createAnalyticsEvent
|
|
18
|
+
*/
|
|
19
|
+
export default function useEditorConstructor(performanceTracking, featureFlags, getExperienceStore, createAnalyticsEvent) {
|
|
20
|
+
useConstructor(function () {
|
|
21
|
+
var _performanceTracking$;
|
|
22
|
+
startMeasure(measurements.EDITOR_MOUNTED);
|
|
23
|
+
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled || featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
24
|
+
var _performanceTracking$2, _performanceTracking$3;
|
|
25
|
+
measureTTI(function (tti, ttiFromInvocation, canceled) {
|
|
26
|
+
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, getExperienceStore());
|
|
27
|
+
}, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$2 = performanceTracking.ttiTracking) === null || _performanceTracking$2 === void 0 ? void 0 : _performanceTracking$2.ttiIdleThreshold, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$3 = performanceTracking.ttiTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.ttiCancelTimeout);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { clearMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import measurements from '../../utils/performance/measure-enum';
|
|
6
|
+
import sendDurationAnalytics from '../utils/sendDurationAnalytics';
|
|
7
|
+
import useEditorConstructor from './useEditorMeasuresConstructor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Hook to run the analytics for the Editor component.
|
|
12
|
+
* WARNING: Consider any changes to also make to `src/editor.tsx`
|
|
13
|
+
*
|
|
14
|
+
* @param props EditorProps
|
|
15
|
+
* @param getExperienceStore function to retrieve the Editor's current ExperienceStore
|
|
16
|
+
* @param createAnalyticsEvent
|
|
17
|
+
*/
|
|
18
|
+
export default function useMeasureEditorMountTime(props, getExperienceStore, createAnalyticsEvent) {
|
|
19
|
+
useEditorConstructor(props.performanceTracking, props.featureFlags, getExperienceStore, createAnalyticsEvent);
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
stopMeasure(measurements.EDITOR_MOUNTED, sendDurationAnalytics(ACTION.EDITOR_MOUNTED, props, getExperienceStore, createAnalyticsEvent));
|
|
22
|
+
return function () {
|
|
23
|
+
var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
|
|
24
|
+
clearMeasure(measurements.EDITOR_MOUNTED);
|
|
25
|
+
(props === null || props === void 0 ? void 0 : (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.onEditorReadyCallbackTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
26
|
+
if ((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
27
|
+
var _getExperienceStore;
|
|
28
|
+
(_getExperienceStore = getExperienceStore()) === null || _getExperienceStore === void 0 ? void 0 : _getExperienceStore.abortAll({
|
|
29
|
+
reason: 'editor component unmounted'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
34
|
+
// Disable Exhaustive Deps here since we only want to stop the measure on mount.
|
|
35
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
|
|
6
|
+
import prepareExtensionProvider from '../../utils/prepare-extension-provider';
|
|
7
|
+
import handleProviders from '../utils/handleProviders';
|
|
8
|
+
function createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
9
|
+
var extensionProvider = prepareExtensionProvider(function () {
|
|
10
|
+
return editorActions;
|
|
11
|
+
})(extensionProviders);
|
|
12
|
+
var quickInsertProvider = prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
13
|
+
return {
|
|
14
|
+
extensionProvider: extensionProvider,
|
|
15
|
+
quickInsertProvider: quickInsertProvider
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* This hook is used to create the provider factory object.
|
|
22
|
+
* WARNING: Consider any changes to also make to `src/editor.tsx`
|
|
23
|
+
*
|
|
24
|
+
* @param props
|
|
25
|
+
* @param editorActions
|
|
26
|
+
* @param createAnalyticsEvent
|
|
27
|
+
* @returns ProviderFactory for Editor
|
|
28
|
+
*/
|
|
29
|
+
export default function useProviderFactory(props, editorActions, createAnalyticsEvent) {
|
|
30
|
+
var extensionProviders = props.extensionProviders,
|
|
31
|
+
quickInsert = props.quickInsert;
|
|
32
|
+
var providerFactory = useRef(new ProviderFactory());
|
|
33
|
+
var _useState = useState(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
providerState = _useState2[0],
|
|
36
|
+
setProviderState = _useState2[1];
|
|
37
|
+
var prevProps = usePreviousState({
|
|
38
|
+
extensionProviders: extensionProviders,
|
|
39
|
+
quickInsert: quickInsert
|
|
40
|
+
});
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (extensionProviders && extensionProviders !== (prevProps === null || prevProps === void 0 ? void 0 : prevProps.extensionProviders) ||
|
|
43
|
+
// Though this will introduce some performance regression related to quick insert
|
|
44
|
+
// loading but we can remove it soon when Forge will move to new API.
|
|
45
|
+
// quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
|
|
46
|
+
quickInsert && quickInsert !== (prevProps === null || prevProps === void 0 ? void 0 : prevProps.quickInsert)) {
|
|
47
|
+
var newState = createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent);
|
|
48
|
+
setProviderState(newState);
|
|
49
|
+
handleProviders(providerFactory.current, props, newState.extensionProvider, newState.quickInsertProvider);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
handleProviders(providerFactory.current, props, providerState.extensionProvider, providerState.quickInsertProvider);
|
|
53
|
+
}, [props, prevProps, createAnalyticsEvent, editorActions, providerState.extensionProvider, providerState.quickInsertProvider, extensionProviders, quickInsert]);
|
|
54
|
+
|
|
55
|
+
// componentWillUnmount equivalent
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
return function () {
|
|
58
|
+
// Disable this next line because it is not a React node
|
|
59
|
+
// so we can safely call destroy on the ref.
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
providerFactory.current.destroy();
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return providerFactory.current;
|
|
65
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
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
|
+
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
|
+
/** @jsx jsx */
|
|
11
|
+
|
|
12
|
+
import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
14
|
+
import { jsx } from '@emotion/react';
|
|
15
|
+
import PropTypes from 'prop-types';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { name, version } from '../version-wrapper';
|
|
18
|
+
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
19
|
+
import uuid from 'uuid/v4';
|
|
20
|
+
import EditorActions from '../actions';
|
|
21
|
+
import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
22
|
+
import EditorInternal from './editor-internal';
|
|
23
|
+
import { defaultProps, propTypes } from './utils/editorPropTypes';
|
|
24
|
+
import trackEditorActions from './utils/trackEditorActions';
|
|
25
|
+
import _onEditorCreated from './utils/onEditorCreated';
|
|
26
|
+
import deprecationWarnings from './utils/deprecationWarnings';
|
|
27
|
+
import _getEditorPlugins from '../utils/get-editor-plugins';
|
|
28
|
+
var EditorNext = /*#__PURE__*/function (_React$Component) {
|
|
29
|
+
_inherits(EditorNext, _React$Component);
|
|
30
|
+
var _super = _createSuper(EditorNext);
|
|
31
|
+
/**
|
|
32
|
+
* WARNING: Code should be shared between Editor + EditorNext
|
|
33
|
+
* If you are making changes that affect both, consider making them
|
|
34
|
+
* in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
function EditorNext(props, context) {
|
|
38
|
+
var _this;
|
|
39
|
+
_classCallCheck(this, EditorNext);
|
|
40
|
+
_this = _super.call(this, props);
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "handleSave", function (view) {
|
|
42
|
+
var _this$props$onSave, _this$props;
|
|
43
|
+
return (_this$props$onSave = (_this$props = _this.props).onSave) === null || _this$props$onSave === void 0 ? void 0 : _this$props$onSave.call(_this$props, view);
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (data) {
|
|
46
|
+
return fireAnalyticsEvent(_this.createAnalyticsEvent)(data);
|
|
47
|
+
});
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "getExperienceStore", function () {
|
|
49
|
+
return _this.experienceStore;
|
|
50
|
+
});
|
|
51
|
+
deprecationWarnings(props);
|
|
52
|
+
_this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
53
|
+
_this.editorSessionId = uuid();
|
|
54
|
+
_this.startTime = performance.now();
|
|
55
|
+
_this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
|
|
56
|
+
_this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
|
|
57
|
+
_this.getExperienceStore = _this.getExperienceStore.bind(_assertThisInitialized(_this));
|
|
58
|
+
_this.getEditorPlugins = _this.getEditorPlugins.bind(_assertThisInitialized(_this));
|
|
59
|
+
trackEditorActions(_this.editorActions, props.performanceTracking, function (value) {
|
|
60
|
+
return _this.handleAnalyticsEvent(value);
|
|
61
|
+
});
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
_createClass(EditorNext, [{
|
|
65
|
+
key: "onEditorCreated",
|
|
66
|
+
value: function onEditorCreated(instance) {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
_onEditorCreated(instance, this.props, function (experienceStore) {
|
|
69
|
+
return _this2.experienceStore = experienceStore;
|
|
70
|
+
}, this.getExperienceStore, function () {
|
|
71
|
+
return _this2.createAnalyticsEvent;
|
|
72
|
+
}, this.editorActions, this.startTime, function (view, dispatcher, transformerForActions) {
|
|
73
|
+
return _this2.registerEditorForActions(view, dispatcher, transformerForActions);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "onEditorDestroyed",
|
|
78
|
+
value: function onEditorDestroyed(_instance) {
|
|
79
|
+
var _this$props$onDestroy, _this$props2;
|
|
80
|
+
this.unregisterEditorFromActions();
|
|
81
|
+
(_this$props$onDestroy = (_this$props2 = this.props).onDestroy) === null || _this$props$onDestroy === void 0 ? void 0 : _this$props$onDestroy.call(_this$props2);
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "registerEditorForActions",
|
|
85
|
+
value: function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
|
|
86
|
+
this.editorActions._privateRegisterEditor(editorView, eventDispatcher, contentTransformer);
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "unregisterEditorFromActions",
|
|
90
|
+
value: function unregisterEditorFromActions() {
|
|
91
|
+
this.editorActions._privateUnregisterEditor();
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "render",
|
|
95
|
+
value: function render() {
|
|
96
|
+
var _this3 = this;
|
|
97
|
+
return jsx(FabricEditorAnalyticsContext, {
|
|
98
|
+
data: {
|
|
99
|
+
packageName: name,
|
|
100
|
+
packageVersion: version,
|
|
101
|
+
componentName: 'editorCore',
|
|
102
|
+
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
103
|
+
editorSessionId: this.editorSessionId
|
|
104
|
+
}
|
|
105
|
+
}, jsx(WithCreateAnalyticsEvent, {
|
|
106
|
+
render: function render(createAnalyticsEvent) {
|
|
107
|
+
return (_this3.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
|
|
108
|
+
props: _this3.props,
|
|
109
|
+
handleAnalyticsEvent: _this3.handleAnalyticsEvent,
|
|
110
|
+
createAnalyticsEvent: _this3.createAnalyticsEvent,
|
|
111
|
+
getEditorPlugins: _this3.getEditorPlugins,
|
|
112
|
+
handleSave: _this3.handleSave,
|
|
113
|
+
editorActions: _this3.editorActions,
|
|
114
|
+
getExperienceStore: _this3.getExperienceStore,
|
|
115
|
+
onEditorCreated: _this3.onEditorCreated,
|
|
116
|
+
onEditorDestroyed: _this3.onEditorDestroyed
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "getEditorPlugins",
|
|
123
|
+
value: function getEditorPlugins(props) {
|
|
124
|
+
return _getEditorPlugins(props);
|
|
125
|
+
}
|
|
126
|
+
}]);
|
|
127
|
+
return EditorNext;
|
|
128
|
+
}(React.Component);
|
|
129
|
+
_defineProperty(EditorNext, "defaultProps", defaultProps);
|
|
130
|
+
_defineProperty(EditorNext, "contextTypes", {
|
|
131
|
+
editorActions: PropTypes.object
|
|
132
|
+
});
|
|
133
|
+
_defineProperty(EditorNext, "propTypes", propTypes('minHeight only supports editor appearance chromeless and comment for EditorNext'));
|
|
134
|
+
export { EditorNext as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { nextMajorVersion } from '../../version-wrapper';
|
|
2
|
+
export default function deprecationWarnings(props) {
|
|
3
|
+
var _props$allowTextColor;
|
|
4
|
+
if (process.env.NODE_ENV === 'production') {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
var nextVersion = nextMajorVersion();
|
|
8
|
+
var deprecatedProperties = {
|
|
9
|
+
allowTasksAndDecisions: {
|
|
10
|
+
message: 'To allow tasks and decisions use taskDecisionProvider – <Editor taskDecisionProvider={{ provider }} />',
|
|
11
|
+
type: 'removed'
|
|
12
|
+
},
|
|
13
|
+
allowConfluenceInlineComment: {
|
|
14
|
+
message: 'To integrate inline comments use experimental annotationProvider – <Editor annotationProviders={{ provider }} />',
|
|
15
|
+
type: 'removed'
|
|
16
|
+
},
|
|
17
|
+
smartLinks: {
|
|
18
|
+
message: 'To use smartLinks, pass the same object into the smartlinks key of linking - <Editor linking={{ smartLinks: {existing object} }}.',
|
|
19
|
+
type: 'removed'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
Object.keys(deprecatedProperties).forEach(function (property) {
|
|
23
|
+
if (props.hasOwnProperty(property)) {
|
|
24
|
+
var meta = deprecatedProperties[property];
|
|
25
|
+
var type = meta.type || 'enabled by default';
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn("".concat(property, " property is deprecated. ").concat(meta.message || '', " [Will be ").concat(type, " in editor-core@").concat(nextVersion, "]"));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (props.hasOwnProperty('allowTables') && typeof props.allowTables !== 'boolean' && (!props.allowTables || !props.allowTables.advanced)) {
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
console.warn("Advanced table options are deprecated (except isHeaderRowRequired) to continue using advanced table features use - <Editor allowTables={{ advanced: true }} /> [Will be changed in editor-core@".concat(nextVersion, "]"));
|
|
34
|
+
}
|
|
35
|
+
if (props.hasOwnProperty('allowTextColor') && typeof props.allowTextColor !== 'boolean' && (props === null || props === void 0 ? void 0 : (_props$allowTextColor = props.allowTextColor) === null || _props$allowTextColor === void 0 ? void 0 : _props$allowTextColor.allowMoreTextColors) !== undefined) {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.warn("\"allowMoreTextColors\" field of \"allowTextColor\" property is deprecated. It will be removedin editor-core@".concat(nextVersion, ". The color palette now shows more colors by default."));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getTTISeverity } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { EditorExperience } from '@atlaskit/editor-common/ufo';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
|
|
5
|
+
var _performanceTracking$;
|
|
6
|
+
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled && createAnalyticsEvent) {
|
|
7
|
+
var _ttiTracking;
|
|
8
|
+
var ttiEvent = {
|
|
9
|
+
payload: {
|
|
10
|
+
action: ACTION.EDITOR_TTI,
|
|
11
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
12
|
+
attributes: {
|
|
13
|
+
tti: tti,
|
|
14
|
+
ttiFromInvocation: ttiFromInvocation,
|
|
15
|
+
canceled: canceled
|
|
16
|
+
},
|
|
17
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if ((_ttiTracking = performanceTracking.ttiTracking) !== null && _ttiTracking !== void 0 && _ttiTracking.trackSeverity) {
|
|
21
|
+
var _ttiTracking2 = performanceTracking.ttiTracking,
|
|
22
|
+
ttiSeverityNormalThreshold = _ttiTracking2.ttiSeverityNormalThreshold,
|
|
23
|
+
ttiSeverityDegradedThreshold = _ttiTracking2.ttiSeverityDegradedThreshold,
|
|
24
|
+
ttiFromInvocationSeverityNormalThreshold = _ttiTracking2.ttiFromInvocationSeverityNormalThreshold,
|
|
25
|
+
ttiFromInvocationSeverityDegradedThreshold = _ttiTracking2.ttiFromInvocationSeverityDegradedThreshold;
|
|
26
|
+
var _getTTISeverity = getTTISeverity(tti, ttiFromInvocation, ttiSeverityNormalThreshold, ttiSeverityDegradedThreshold, ttiFromInvocationSeverityNormalThreshold, ttiFromInvocationSeverityDegradedThreshold),
|
|
27
|
+
ttiSeverity = _getTTISeverity.ttiSeverity,
|
|
28
|
+
ttiFromInvocationSeverity = _getTTISeverity.ttiFromInvocationSeverity;
|
|
29
|
+
ttiEvent.payload.attributes.ttiSeverity = ttiSeverity;
|
|
30
|
+
ttiEvent.payload.attributes.ttiFromInvocationSeverity = ttiFromInvocationSeverity;
|
|
31
|
+
}
|
|
32
|
+
fireAnalyticsEvent(createAnalyticsEvent)(ttiEvent);
|
|
33
|
+
}
|
|
34
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
35
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.mark(EditorExperience.loadEditor, ACTION.EDITOR_TTI, tti);
|
|
36
|
+
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.loadEditor);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Logic for Editor prop types (ie. `static propTypes = propTypes(message)`)
|
|
4
|
+
* for use with 'prop-types' library
|
|
5
|
+
*
|
|
6
|
+
* @param errorMessage
|
|
7
|
+
* @returns Editor prop-types
|
|
8
|
+
*/
|
|
9
|
+
export function propTypes(errorMessage) {
|
|
10
|
+
return {
|
|
11
|
+
minHeight: function minHeight(_ref) {
|
|
12
|
+
var appearance = _ref.appearance,
|
|
13
|
+
_minHeight = _ref.minHeight;
|
|
14
|
+
if (_minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
|
|
15
|
+
return new Error(errorMessage);
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export var defaultProps = {
|
|
22
|
+
appearance: 'comment',
|
|
23
|
+
disabled: false,
|
|
24
|
+
extensionHandlers: {},
|
|
25
|
+
allowHelpDialog: true,
|
|
26
|
+
allowNewInsertionBehaviour: true,
|
|
27
|
+
quickInsert: true
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
/**
|
|
3
|
+
* @param appearance
|
|
4
|
+
* @returns default font size if valid
|
|
5
|
+
*/
|
|
6
|
+
export function getBaseFontSize(appearance) {
|
|
7
|
+
if (appearance === undefined) {
|
|
8
|
+
return akEditorFullPageDefaultFontSize;
|
|
9
|
+
}
|
|
10
|
+
return !['comment', 'chromeless', 'mobile'].includes(appearance) ? akEditorFullPageDefaultFontSize : undefined;
|
|
11
|
+
}
|