@atlaskit/editor-core 180.0.0 → 181.0.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 +117 -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 +26 -11
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +9 -764
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +753 -0
- package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +31 -3
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
- package/dist/cjs/create-editor/preset-utils.js +27 -0
- package/dist/cjs/editor-next/editor-internal.js +147 -0
- package/dist/cjs/editor-next/editor-migration-component.js +51 -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 +73 -0
- package/dist/cjs/editor-next/index.js +143 -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/getProvidersFromEditorProps.js +41 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +51 -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 +139 -445
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/keymaps/consts.js +1 -16
- 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/cxhtml.js +56 -55
- package/dist/cjs/labs/next/presets/default.js +15 -42
- package/dist/cjs/labs/next/presets/mobile.js +76 -89
- package/dist/cjs/labs/next/presets/universal.js +337 -255
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +36 -0
- 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 +11 -6
- package/dist/cjs/plugins/analytics/utils.js +0 -11
- package/dist/cjs/plugins/annotation/utils.js +2 -36
- 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/pm-plugins/react-nodeview.js +2 -7
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -10
- 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/caption/index.js +0 -7
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +9 -3
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +10 -5
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/cjs/plugins/code-block/pm-plugins/main-state.js +2 -14
- package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
- package/dist/cjs/plugins/collab-edit/provider/index.js +1 -8
- package/dist/cjs/plugins/collab-edit/provider/types.js +1 -12
- package/dist/cjs/plugins/context-panel/index.js +1 -6
- package/dist/cjs/plugins/data-consumer/index.js +0 -8
- package/dist/cjs/plugins/date/utils/internal.js +0 -4
- package/dist/cjs/plugins/extension/commands.js +1 -8
- package/dist/cjs/plugins/extension/toolbar.js +7 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +9 -2
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/cjs/plugins/feedback-dialog/index.js +1 -4
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +9 -3
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +48 -14
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +24 -21
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +32 -5
- package/dist/cjs/plugins/floating-toolbar/utils.js +0 -12
- package/dist/cjs/plugins/fragment/index.js +0 -8
- package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/cjs/plugins/help-dialog/commands.js +2 -6
- 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/image-upload/pm-plugins/main.js +50 -12
- 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/layout/styles.js +10 -1
- package/dist/cjs/plugins/list/utils/find.js +0 -28
- package/dist/cjs/plugins/list/utils/indentation.js +1 -25
- package/dist/cjs/plugins/list/utils/node.js +0 -5
- package/dist/cjs/plugins/list/utils/selection.js +2 -15
- 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/media/utils/media-common.js +1 -20
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +100 -16
- package/dist/cjs/plugins/mentions/type-ahead/index.js +1 -18
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +1 -3
- package/dist/cjs/plugins/mobile-dimensions/index.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/index.js +1 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +133 -88
- package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
- package/dist/cjs/plugins/paste/util/index.js +0 -46
- package/dist/cjs/plugins/placeholder-text/index.js +2 -2
- package/dist/cjs/plugins/quick-insert/assets/index.js +1 -27
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +49 -44
- package/dist/cjs/plugins/status/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
- package/dist/cjs/plugins/status/utils.js +1 -15
- package/dist/cjs/plugins/text-color/pm-plugins/main.js +0 -1
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +48 -12
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- 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 -35
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/cjs/plugins/type-ahead/constants.js +1 -7
- package/dist/cjs/plugins/type-ahead/index.js +1 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +2 -35
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/cjs/plugins/type-ahead/utils.js +3 -22
- package/dist/cjs/test-utils.js +4 -12
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +43 -8
- package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
- package/dist/cjs/ui/ColorPalette/index.js +18 -0
- package/dist/cjs/ui/ColorPickerButton/index.js +73 -7
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/cjs/ui/ConfigPanel/utils.js +4 -17
- package/dist/cjs/ui/ContentStyles/index.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/ModalElementBrowser.js +1 -1
- 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/ElementBrowser/constants.js +1 -3
- package/dist/cjs/ui/PanelTextInput/index.js +4 -4
- package/dist/cjs/ui/PortalProvider/index.js +5 -5
- package/dist/cjs/ui/Resizer/utils.js +1 -3
- package/dist/cjs/ui/WidthEmitter/index.js +29 -35
- package/dist/cjs/ui/styles.js +3 -7
- package/dist/cjs/utils/document.js +15 -0
- package/dist/cjs/utils/extensions.js +6 -7
- package/dist/cjs/utils/get-editor-plugins.js +30 -0
- package/dist/cjs/utils/index.js +9 -269
- package/dist/cjs/utils/input-rules.js +1 -15
- 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 +24 -10
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +3 -710
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +697 -0
- package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/es2019/create-editor/create-plugins-list.js +26 -3
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
- package/dist/es2019/create-editor/preset-utils.js +15 -0
- package/dist/es2019/editor-next/editor-internal.js +142 -0
- package/dist/es2019/editor-next/editor-migration-component.js +27 -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 +62 -0
- package/dist/es2019/editor-next/index.js +96 -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/getProvidersFromEditorProps.js +36 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +46 -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 +122 -398
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/keymaps/consts.js +7 -11
- 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/cxhtml.js +56 -53
- package/dist/es2019/labs/next/presets/default.js +18 -38
- package/dist/es2019/labs/next/presets/mobile.js +88 -88
- package/dist/es2019/labs/next/presets/universal.js +347 -263
- package/dist/es2019/labs/next/presets/useUniversalPreset.js +25 -0
- 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 +8 -2
- package/dist/es2019/plugins/analytics/utils.js +0 -4
- package/dist/es2019/plugins/annotation/utils.js +2 -30
- 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/pm-plugins/react-nodeview.js +1 -3
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -9
- 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/caption/index.js +0 -2
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +10 -3
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +9 -4
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
- package/dist/es2019/plugins/code-block/pm-plugins/main-state.js +1 -9
- package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
- package/dist/es2019/plugins/collab-edit/provider/index.js +1 -1
- package/dist/es2019/plugins/collab-edit/provider/types.js +1 -10
- package/dist/es2019/plugins/context-panel/index.js +0 -3
- package/dist/es2019/plugins/data-consumer/index.js +0 -7
- package/dist/es2019/plugins/date/utils/internal.js +0 -3
- package/dist/es2019/plugins/extension/commands.js +0 -6
- package/dist/es2019/plugins/extension/toolbar.js +7 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +12 -2
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +3 -0
- package/dist/es2019/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/es2019/plugins/feedback-dialog/index.js +0 -2
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +9 -3
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +45 -12
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +1 -11
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +29 -1
- package/dist/es2019/plugins/floating-toolbar/utils.js +0 -10
- package/dist/es2019/plugins/fragment/index.js +0 -7
- package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/es2019/plugins/help-dialog/commands.js +1 -2
- 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/image-upload/pm-plugins/main.js +47 -5
- 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/layout/styles.js +12 -4
- package/dist/es2019/plugins/list/utils/find.js +0 -27
- package/dist/es2019/plugins/list/utils/indentation.js +0 -23
- package/dist/es2019/plugins/list/utils/node.js +1 -4
- package/dist/es2019/plugins/list/utils/selection.js +2 -15
- 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/media/utils/media-common.js +1 -19
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +64 -16
- package/dist/es2019/plugins/mentions/type-ahead/index.js +1 -14
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +1 -2
- package/dist/es2019/plugins/mobile-dimensions/index.js +0 -3
- package/dist/es2019/plugins/panel/utils.js +4 -1
- package/dist/es2019/plugins/paste/handlers.js +127 -5
- package/dist/es2019/plugins/paste/index.js +1 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +131 -93
- package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/es2019/plugins/paste/util/index.js +5 -45
- package/dist/es2019/plugins/placeholder-text/index.js +1 -1
- package/dist/es2019/plugins/quick-insert/assets/index.js +0 -8
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +56 -56
- package/dist/es2019/plugins/status/index.js +8 -2
- package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
- package/dist/es2019/plugins/status/utils.js +1 -11
- package/dist/es2019/plugins/text-color/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +48 -12
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- 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 -27
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
- package/dist/es2019/plugins/type-ahead/constants.js +0 -5
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -35
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
- package/dist/es2019/plugins/type-ahead/utils.js +0 -23
- package/dist/es2019/test-utils.js +4 -7
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +40 -6
- package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
- package/dist/es2019/ui/ColorPalette/index.js +2 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +66 -9
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/es2019/ui/ConfigPanel/utils.js +0 -6
- package/dist/es2019/ui/ContentStyles/index.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/ModalElementBrowser.js +1 -1
- 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/ElementBrowser/constants.js +0 -1
- package/dist/es2019/ui/PanelTextInput/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/index.js +1 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -1
- package/dist/es2019/ui/WidthEmitter/index.js +25 -29
- package/dist/es2019/ui/styles.js +0 -6
- package/dist/es2019/utils/document.js +11 -1
- package/dist/es2019/utils/extensions.js +1 -3
- package/dist/es2019/utils/get-editor-plugins.js +23 -0
- package/dist/es2019/utils/index.js +13 -199
- package/dist/es2019/utils/input-rules.js +0 -14
- 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 +24 -10
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +9 -765
- package/dist/esm/create-editor/ReactEditorViewInternal.js +747 -0
- package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
- package/dist/esm/create-editor/create-plugins-list.js +30 -3
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
- package/dist/esm/create-editor/preset-utils.js +21 -0
- package/dist/esm/editor-next/editor-internal.js +141 -0
- package/dist/esm/editor-next/editor-migration-component.js +44 -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 +66 -0
- package/dist/esm/editor-next/index.js +138 -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/getProvidersFromEditorProps.js +35 -0
- package/dist/esm/editor-next/utils/handleProviders.js +45 -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 +139 -442
- package/dist/esm/index.js +2 -1
- package/dist/esm/keymaps/consts.js +7 -11
- 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/cxhtml.js +56 -55
- package/dist/esm/labs/next/presets/default.js +18 -41
- package/dist/esm/labs/next/presets/mobile.js +88 -90
- package/dist/esm/labs/next/presets/universal.js +337 -255
- package/dist/esm/labs/next/presets/useUniversalPreset.js +29 -0
- 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 +7 -2
- package/dist/esm/plugins/analytics/utils.js +0 -9
- package/dist/esm/plugins/annotation/utils.js +2 -32
- 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/pm-plugins/react-nodeview.js +1 -5
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -9
- 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/caption/index.js +0 -2
- package/dist/esm/plugins/card/nodeviews/blockCard.js +9 -3
- package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +10 -5
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
- package/dist/esm/plugins/code-block/pm-plugins/main-state.js +0 -10
- package/dist/esm/plugins/collab-edit/plugin.js +1 -2
- package/dist/esm/plugins/collab-edit/provider/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/types.js +1 -10
- package/dist/esm/plugins/context-panel/index.js +0 -3
- package/dist/esm/plugins/data-consumer/index.js +0 -7
- package/dist/esm/plugins/date/utils/internal.js +0 -3
- package/dist/esm/plugins/extension/commands.js +0 -6
- package/dist/esm/plugins/extension/toolbar.js +7 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +9 -2
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/Extension/Lozenge.js +1 -0
- package/dist/esm/plugins/feedback-dialog/index.js +0 -2
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +9 -3
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +48 -14
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +24 -21
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +32 -5
- package/dist/esm/plugins/floating-toolbar/utils.js +0 -10
- package/dist/esm/plugins/fragment/index.js +0 -7
- package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
- package/dist/esm/plugins/help-dialog/commands.js +0 -3
- 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/image-upload/pm-plugins/main.js +51 -12
- 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/layout/styles.js +11 -2
- package/dist/esm/plugins/list/utils/find.js +0 -27
- package/dist/esm/plugins/list/utils/indentation.js +0 -23
- package/dist/esm/plugins/list/utils/node.js +1 -4
- package/dist/esm/plugins/list/utils/selection.js +2 -12
- 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/media/utils/media-common.js +1 -17
- package/dist/esm/plugins/mentions/nodeviews/mention.js +97 -16
- package/dist/esm/plugins/mentions/type-ahead/index.js +1 -18
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +1 -2
- package/dist/esm/plugins/mobile-dimensions/index.js +0 -3
- package/dist/esm/plugins/panel/utils.js +4 -1
- package/dist/esm/plugins/paste/handlers.js +127 -13
- package/dist/esm/plugins/paste/index.js +1 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +130 -86
- package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
- package/dist/esm/plugins/paste/util/index.js +5 -45
- package/dist/esm/plugins/placeholder-text/index.js +2 -2
- package/dist/esm/plugins/quick-insert/assets/index.js +0 -20
- package/dist/esm/plugins/selection/gap-cursor/actions.js +52 -45
- package/dist/esm/plugins/status/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
- package/dist/esm/plugins/status/utils.js +1 -13
- package/dist/esm/plugins/text-color/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +48 -12
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- 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 -29
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
- package/dist/esm/plugins/type-ahead/constants.js +0 -5
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -31
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
- package/dist/esm/plugins/type-ahead/utils.js +2 -20
- package/dist/esm/test-utils.js +4 -7
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +41 -6
- package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
- package/dist/esm/ui/CollapsedEditor/index.js +7 -13
- package/dist/esm/ui/ColorPalette/index.js +2 -1
- package/dist/esm/ui/ColorPickerButton/index.js +74 -8
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +1 -0
- package/dist/esm/ui/ConfigPanel/utils.js +3 -14
- package/dist/esm/ui/ContentStyles/index.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/ModalElementBrowser.js +1 -1
- 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/ElementBrowser/constants.js +0 -1
- package/dist/esm/ui/PanelTextInput/index.js +4 -4
- package/dist/esm/ui/PortalProvider/index.js +1 -1
- package/dist/esm/ui/Resizer/utils.js +0 -1
- package/dist/esm/ui/WidthEmitter/index.js +28 -37
- package/dist/esm/ui/styles.js +2 -5
- package/dist/esm/utils/document.js +15 -1
- package/dist/esm/utils/extensions.js +1 -3
- package/dist/esm/utils/get-editor-plugins.js +23 -0
- package/dist/esm/utils/index.js +13 -196
- package/dist/esm/utils/input-rules.js +0 -13
- 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 +5 -5
- package/dist/types/create-editor/ReactEditorView.d.ts +5 -110
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +114 -0
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +8 -0
- package/dist/types/create-editor/create-plugins-list.d.ts +3 -5
- package/dist/types/create-editor/preset-utils.d.ts +2 -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/getProvidersFromEditorProps.d.ts +9 -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 +50 -25
- package/dist/types/index.d.ts +1 -0
- package/dist/types/keymaps/consts.d.ts +0 -11
- 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/cxhtml.d.ts +33 -1
- package/dist/types/labs/next/presets/default.d.ts +67 -10
- package/dist/types/labs/next/presets/mobile.d.ts +33 -1
- package/dist/types/labs/next/presets/universal.d.ts +5 -13
- package/dist/types/labs/next/presets/useUniversalPreset.d.ts +7 -0
- package/dist/types/nodeviews/context-adapter.d.ts +0 -1
- package/dist/types/nodeviews/index.d.ts +0 -1
- package/dist/types/plugins/alignment/index.d.ts +1 -1
- package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -11
- 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/annotation/utils.d.ts +0 -17
- 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/pm-plugins/react-nodeview.d.ts +2 -3
- 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/pm-plugins/input-rule.d.ts +2 -6
- 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/caption/index.d.ts +0 -2
- package/dist/types/plugins/card/index.d.ts +3 -1
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +2 -10
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/plugins/card/nodeviews/inlineCard.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/actions.d.ts +0 -4
- package/dist/types/plugins/code-block/index.d.ts +3 -1
- package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +0 -3
- package/dist/types/plugins/collab-edit/index.d.ts +3 -1
- package/dist/types/plugins/collab-edit/provider/index.d.ts +1 -2
- package/dist/types/plugins/collab-edit/provider/types.d.ts +1 -36
- package/dist/types/plugins/context-panel/index.d.ts +3 -4
- package/dist/types/plugins/data-consumer/index.d.ts +0 -2
- package/dist/types/plugins/date/utils/internal.d.ts +0 -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/commands.d.ts +0 -1
- package/dist/types/plugins/extension/index.d.ts +3 -1
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +0 -5
- 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 -3
- package/dist/types/plugins/find-replace/index.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +4 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +6 -2
- package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
- package/dist/types/plugins/fragment/index.d.ts +0 -2
- package/dist/types/plugins/grid/index.d.ts +3 -1
- package/dist/types/plugins/help-dialog/commands.d.ts +0 -1
- package/dist/types/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types/plugins/history/actions.d.ts +1 -2
- 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/layout/styles.d.ts +2 -1
- package/dist/types/plugins/list/index.d.ts +3 -1
- package/dist/types/plugins/list/utils/find.d.ts +0 -1
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -1
- package/dist/types/plugins/list/utils/node.d.ts +0 -2
- package/dist/types/plugins/list/utils/selection.d.ts +0 -3
- 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/media/utils/media-common.d.ts +0 -5
- package/dist/types/plugins/mentions/index.d.ts +3 -1
- package/dist/types/plugins/mentions/types.d.ts +1 -2
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +2 -3
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +0 -6
- package/dist/types/plugins/mentions/ui/ToolbarMention/index.d.ts +1 -4
- package/dist/types/plugins/mobile-dimensions/index.d.ts +0 -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 -2
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +10 -4
- package/dist/types/plugins/paste/util/index.d.ts +0 -6
- 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/assets/index.d.ts +0 -2
- 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/status/utils.d.ts +0 -3
- 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/tasks-and-decisions/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/text-color/index.d.ts +3 -1
- package/dist/types/plugins/text-color/pm-plugins/main.d.ts +2 -12
- 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/pm-plugins/clear-formatting.d.ts +0 -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 -5
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/constants.d.ts +0 -4
- package/dist/types/plugins/type-ahead/index.d.ts +3 -1
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -10
- package/dist/types/plugins/type-ahead/utils.d.ts +1 -2
- package/dist/types/test-utils.d.ts +4 -5
- package/dist/types/types/editor-appearance-component.d.ts +2 -2
- package/dist/types/types/editor-props.d.ts +55 -42
- 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/Chromeless.d.ts +0 -5
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +0 -7
- package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +3 -2
- package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -4
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -5
- package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
- package/dist/types/ui/ColorPalette/Palettes/index.d.ts +1 -1
- package/dist/types/ui/ColorPalette/Palettes/type.d.ts +1 -1
- package/dist/types/ui/ColorPalette/index.d.ts +2 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +5 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/types.d.ts +0 -3
- package/dist/types/ui/ConfigPanel/utils.d.ts +2 -3
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ContextPanel/context.d.ts +2 -1
- package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +0 -3
- package/dist/types/ui/ElementBrowser/constants.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +0 -5
- package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/ui/Resizer/utils.d.ts +0 -1
- package/dist/types/ui/styles.d.ts +0 -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/index.d.ts +6 -65
- package/dist/types/utils/input-rules.d.ts +1 -2
- 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/dist/types/utils/table.d.ts +0 -1
- package/docs/0-intro.tsx +0 -1
- package/package.json +37 -37
- package/report.api.md +307 -244
- package/dist/cjs/labs/next/presets/preset.js +0 -106
- package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
- package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
- package/dist/cjs/plugins/collab-edit/provider/channel.js +0 -313
- package/dist/cjs/plugins/collab-edit/provider/logger.js +0 -17
- package/dist/cjs/plugins/collab-edit/provider/mock-users.js +0 -19
- package/dist/cjs/plugins/data-consumer/plugin-key.js +0 -9
- package/dist/cjs/plugins/media/toolbar/toolbar-messages.js +0 -15
- package/dist/cjs/profiler/render-count.js +0 -60
- package/dist/cjs/ui/ColorPalette/Color/index.js +0 -9
- package/dist/cjs/ui/ConfigPanel/FieldDescription.js +0 -19
- package/dist/cjs/ui/WithPluginState/types.js +0 -5
- package/dist/es2019/labs/next/presets/preset.js +0 -71
- package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
- package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
- package/dist/es2019/plugins/collab-edit/provider/channel.js +0 -179
- package/dist/es2019/plugins/collab-edit/provider/logger.js +0 -8
- package/dist/es2019/plugins/collab-edit/provider/mock-users.js +0 -12
- package/dist/es2019/plugins/data-consumer/plugin-key.js +0 -2
- package/dist/es2019/plugins/media/toolbar/toolbar-messages.js +0 -8
- package/dist/es2019/profiler/render-count.js +0 -53
- package/dist/es2019/ui/ColorPalette/Color/index.js +0 -2
- package/dist/es2019/ui/ConfigPanel/FieldDescription.js +0 -12
- package/dist/esm/labs/next/presets/preset.js +0 -98
- package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
- package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
- package/dist/esm/plugins/analytics/types/type-ahead.js +0 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +0 -305
- package/dist/esm/plugins/collab-edit/provider/logger.js +0 -10
- package/dist/esm/plugins/collab-edit/provider/mock-users.js +0 -12
- package/dist/esm/plugins/data-consumer/plugin-key.js +0 -2
- package/dist/esm/plugins/media/toolbar/toolbar-messages.js +0 -8
- package/dist/esm/profiler/render-count.js +0 -49
- package/dist/esm/ui/ColorPalette/Color/index.js +0 -2
- package/dist/esm/ui/ConfigPanel/FieldDescription.js +0 -11
- package/dist/esm/ui/WithPluginState/types.js +0 -1
- package/dist/types/labs/next/presets/preset.d.ts +0 -46
- 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/types/plugins/analytics/types/type-ahead.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/channel.d.ts +0 -48
- package/dist/types/plugins/collab-edit/provider/logger.d.ts +0 -1
- package/dist/types/plugins/collab-edit/provider/mock-users.d.ts +0 -6
- package/dist/types/plugins/data-consumer/plugin-key.d.ts +0 -2
- package/dist/types/plugins/media/toolbar/toolbar-messages.d.ts +0 -7
- package/dist/types/profiler/render-count.d.ts +0 -14
- package/dist/types/ui/ColorPalette/Color/index.d.ts +0 -2
- package/dist/types/ui/ConfigPanel/FieldDescription.d.ts +0 -6
- package/dist/types/ui/WithPluginState/types.d.ts +0 -10
- /package/dist/cjs/{plugins/analytics/types/type-ahead.js → types/get-editor-props.js} +0 -0
- /package/dist/es2019/{plugins/analytics/types/type-ahead.js → types/get-editor-props.js} +0 -0
- /package/dist/{es2019/ui/WithPluginState/types.js → esm/types/get-editor-props.js} +0 -0
|
@@ -1,711 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { EditorState, Selection } from 'prosemirror-state';
|
|
5
|
-
import { EditorView } from 'prosemirror-view';
|
|
1
|
+
import { ReactEditorView as BaseReactEditorView } from './ReactEditorViewInternal';
|
|
6
2
|
import { injectIntl } from 'react-intl-next';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
10
|
-
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
11
|
-
import { processRawValue } from '../utils';
|
|
12
|
-
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
13
|
-
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
14
|
-
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
|
15
|
-
import createPluginList from './create-plugins-list';
|
|
16
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '../plugins/analytics';
|
|
17
|
-
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
18
|
-
import { getEnabledFeatureFlagKeys } from '../plugins/feature-flags-context/get-enabled-feature-flag-keys';
|
|
19
|
-
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
20
|
-
import { getDocStructure } from '../utils/document-logger';
|
|
21
|
-
import { isFullPage } from '../utils/is-full-page';
|
|
22
|
-
import measurements from '../utils/performance/measure-enum';
|
|
23
|
-
import { getNodesCount } from '../utils/document';
|
|
24
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
25
|
-
import { createSchema } from './create-schema';
|
|
26
|
-
import { PluginPerformanceObserver } from '../utils/performance/plugin-performance-observer';
|
|
27
|
-
import { getParticipantsCount } from '../plugins/collab-edit/get-participants-count';
|
|
28
|
-
import { countNodes } from '../utils/count-nodes';
|
|
29
|
-
import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
30
|
-
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE } from '../utils/performance/track-transactions';
|
|
31
|
-
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
32
|
-
import { getContextIdentifier } from '../plugins/base/pm-plugins/context-identifier';
|
|
33
|
-
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
34
|
-
import { createInsertNodeAPI } from '../insert-api/api';
|
|
35
|
-
import { createEditorAnalyticsAPI } from '../analytics-api/api';
|
|
36
|
-
import { createEditorSelectionAPI } from '../selection-api/api';
|
|
37
|
-
function handleEditorFocus(view) {
|
|
38
|
-
if (view.hasFocus()) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
return window.setTimeout(() => {
|
|
42
|
-
view.focus();
|
|
43
|
-
}, 0);
|
|
44
|
-
}
|
|
45
|
-
const EMPTY = [];
|
|
46
|
-
export function shouldReconfigureState(props, nextProps) {
|
|
47
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
48
|
-
const prevPlugins = (_props$dangerouslyApp = (_props$dangerouslyApp2 = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp2 === void 0 ? void 0 : _props$dangerouslyApp2.__plugins) !== null && _props$dangerouslyApp !== void 0 ? _props$dangerouslyApp : EMPTY;
|
|
49
|
-
const nextPlugins = (_nextProps$dangerousl = (_nextProps$dangerousl2 = nextProps.dangerouslyAppendPlugins) === null || _nextProps$dangerousl2 === void 0 ? void 0 : _nextProps$dangerousl2.__plugins) !== null && _nextProps$dangerousl !== void 0 ? _nextProps$dangerousl : EMPTY;
|
|
50
|
-
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(p => nextPlugins.some(n => n.name === p.name && n !== p))) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
const mobileProperties = props.appearance === 'mobile' ? ['featureFlags', 'quickInsert'] : [];
|
|
54
|
-
const properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent', ...mobileProperties];
|
|
55
|
-
return properties.reduce((acc, curr) => acc || props[curr] !== nextProps[curr], false);
|
|
56
|
-
}
|
|
57
|
-
export class ReactEditorView extends React.Component {
|
|
58
|
-
// ProseMirror is instantiated prior to the initial React render cycle,
|
|
59
|
-
// so we allow transactions by default, to avoid discarding the initial one.
|
|
60
|
-
|
|
61
|
-
get transactionTracking() {
|
|
62
|
-
var _this$props$editorPro, _this$props$editorPro2;
|
|
63
|
-
return (_this$props$editorPro = (_this$props$editorPro2 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro2 === void 0 ? void 0 : _this$props$editorPro2.transactionTracking) !== null && _this$props$editorPro !== void 0 ? _this$props$editorPro : {
|
|
64
|
-
enabled: false
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
getPluginNames() {
|
|
68
|
-
return this.editorState.plugins.map(p => p.key);
|
|
69
|
-
}
|
|
70
|
-
countNodes() {
|
|
71
|
-
return countNodes(this.editorState);
|
|
72
|
-
}
|
|
73
|
-
constructor(_props, context) {
|
|
74
|
-
super(_props, context);
|
|
75
|
-
_defineProperty(this, "editorRef", /*#__PURE__*/React.createRef());
|
|
76
|
-
_defineProperty(this, "canDispatchTransactions", true);
|
|
77
|
-
_defineProperty(this, "onPluginObservation", (report, editorState) => {
|
|
78
|
-
this.dispatchAnalyticsEvent({
|
|
79
|
-
action: ACTION.TRANSACTION_DISPATCHED,
|
|
80
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
81
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
82
|
-
attributes: {
|
|
83
|
-
report,
|
|
84
|
-
participants: getParticipantsCount(editorState)
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
_defineProperty(this, "formatFullWidthAppearance", appearance => {
|
|
89
|
-
if (appearance === 'full-width') {
|
|
90
|
-
return FULL_WIDTH_MODE.FULL_WIDTH;
|
|
91
|
-
}
|
|
92
|
-
return FULL_WIDTH_MODE.FIXED_WIDTH;
|
|
93
|
-
});
|
|
94
|
-
_defineProperty(this, "resetEditorState", ({
|
|
95
|
-
doc,
|
|
96
|
-
shouldScrollToBottom
|
|
97
|
-
}) => {
|
|
98
|
-
var _this$props$editorPro3, _this$props$editorPro4;
|
|
99
|
-
if (!this.view) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
104
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
105
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
106
|
-
this.blur();
|
|
107
|
-
this.featureFlags = createFeatureFlagsFromProps(this.props.editorProps);
|
|
108
|
-
this.editorState = this.createEditorState({
|
|
109
|
-
props: this.props,
|
|
110
|
-
context: this.context,
|
|
111
|
-
doc: doc,
|
|
112
|
-
resetting: true,
|
|
113
|
-
selectionAtStart: !shouldScrollToBottom
|
|
114
|
-
});
|
|
115
|
-
this.view.updateState(this.editorState);
|
|
116
|
-
(_this$props$editorPro3 = (_this$props$editorPro4 = this.props.editorProps).onChange) === null || _this$props$editorPro3 === void 0 ? void 0 : _this$props$editorPro3.call(_this$props$editorPro4, this.view, {
|
|
117
|
-
source: 'local'
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
_defineProperty(this, "blur", () => {
|
|
121
|
-
if (!this.view) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (this.view.dom instanceof HTMLElement && this.view.hasFocus()) {
|
|
125
|
-
this.view.dom.blur();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// The selectionToDOM method uses the document selection to determine currently selected node
|
|
129
|
-
// We need to mimic blurring this as it seems doing the above is not enough.
|
|
130
|
-
// @ts-expect-error
|
|
131
|
-
const sel = this.view.root.getSelection();
|
|
132
|
-
if (sel) {
|
|
133
|
-
sel.removeAllRanges();
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
_defineProperty(this, "reconfigureState", props => {
|
|
137
|
-
if (!this.view) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
142
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
143
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
144
|
-
this.blur();
|
|
145
|
-
const editorPlugins = this.getPlugins(props.editorProps, this.props.editorProps, this.props.createAnalyticsEvent);
|
|
146
|
-
this.config = processPluginsList(editorPlugins);
|
|
147
|
-
const state = this.editorState;
|
|
148
|
-
const plugins = createPMPlugins({
|
|
149
|
-
schema: state.schema,
|
|
150
|
-
dispatch: this.dispatch,
|
|
151
|
-
errorReporter: this.errorReporter,
|
|
152
|
-
editorConfig: this.config,
|
|
153
|
-
eventDispatcher: this.eventDispatcher,
|
|
154
|
-
providerFactory: props.providerFactory,
|
|
155
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
156
|
-
reactContext: () => this.context,
|
|
157
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
158
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
159
|
-
transactionTracker: this.transactionTracker,
|
|
160
|
-
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
161
|
-
getIntl: () => this.props.intl
|
|
162
|
-
});
|
|
163
|
-
const newState = state.reconfigure({
|
|
164
|
-
plugins: plugins
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// need to update the state first so when the view builds the nodeviews it is
|
|
168
|
-
// using the latest plugins
|
|
169
|
-
this.view.updateState(newState);
|
|
170
|
-
return this.view.update({
|
|
171
|
-
...this.view.props,
|
|
172
|
-
state: newState
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
_defineProperty(this, "handleAnalyticsEvent", payload => {
|
|
176
|
-
if (!this.props.allowAnalyticsGASV3) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
fireAnalyticsEvent(this.props.createAnalyticsEvent)(payload);
|
|
180
|
-
});
|
|
181
|
-
_defineProperty(this, "editorPlugins", []);
|
|
182
|
-
_defineProperty(this, "createEditorState", options => {
|
|
183
|
-
let schema;
|
|
184
|
-
if (this.view) {
|
|
185
|
-
if (options.resetting) {
|
|
186
|
-
/**
|
|
187
|
-
* ReactEditorView currently does NOT handle dynamic schema,
|
|
188
|
-
* We are reusing the existing schema, and rely on #reconfigureState
|
|
189
|
-
* to update `this.config`
|
|
190
|
-
*/
|
|
191
|
-
schema = this.view.state.schema;
|
|
192
|
-
} else {
|
|
193
|
-
/**
|
|
194
|
-
* There's presently a number of issues with changing the schema of a
|
|
195
|
-
* editor inflight. A significant issue is that we lose the ability
|
|
196
|
-
* to keep track of a user's history as the internal plugin state
|
|
197
|
-
* keeps a list of Steps to undo/redo (which are tied to the schema).
|
|
198
|
-
* Without a good way to do work around this, we prevent this for now.
|
|
199
|
-
*/
|
|
200
|
-
// eslint-disable-next-line no-console
|
|
201
|
-
console.warn('The editor does not support changing the schema dynamically.');
|
|
202
|
-
return this.editorState;
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
this.config = processPluginsList(this.getPlugins(options.props.editorProps, undefined, options.props.createAnalyticsEvent));
|
|
206
|
-
schema = createSchema(this.config);
|
|
207
|
-
}
|
|
208
|
-
const {
|
|
209
|
-
contentTransformerProvider
|
|
210
|
-
} = options.props.editorProps;
|
|
211
|
-
const plugins = createPMPlugins({
|
|
212
|
-
schema,
|
|
213
|
-
dispatch: this.dispatch,
|
|
214
|
-
errorReporter: this.errorReporter,
|
|
215
|
-
editorConfig: this.config,
|
|
216
|
-
eventDispatcher: this.eventDispatcher,
|
|
217
|
-
providerFactory: options.props.providerFactory,
|
|
218
|
-
portalProviderAPI: this.props.portalProviderAPI,
|
|
219
|
-
reactContext: () => options.context,
|
|
220
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
221
|
-
performanceTracking: this.props.editorProps.performanceTracking,
|
|
222
|
-
transactionTracker: this.transactionTracker,
|
|
223
|
-
featureFlags: this.featureFlags,
|
|
224
|
-
getIntl: () => this.props.intl
|
|
225
|
-
});
|
|
226
|
-
this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
227
|
-
let doc;
|
|
228
|
-
if (options.doc) {
|
|
229
|
-
doc = processRawValue(schema, options.doc, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, this.contentTransformer, this.dispatchAnalyticsEvent);
|
|
230
|
-
}
|
|
231
|
-
let selection;
|
|
232
|
-
if (doc) {
|
|
233
|
-
selection = options.selectionAtStart ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
234
|
-
}
|
|
235
|
-
// Workaround for ED-3507: When media node is the last element, scrollIntoView throws an error
|
|
236
|
-
const patchedSelection = selection ? Selection.findFrom(selection.$head, -1, true) || undefined : undefined;
|
|
237
|
-
return EditorState.create({
|
|
238
|
-
schema,
|
|
239
|
-
plugins: plugins,
|
|
240
|
-
doc,
|
|
241
|
-
selection: patchedSelection
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
_defineProperty(this, "onEditorViewStateUpdated", ({
|
|
245
|
-
originalTransaction,
|
|
246
|
-
transactions,
|
|
247
|
-
oldEditorState,
|
|
248
|
-
newEditorState
|
|
249
|
-
}) => {
|
|
250
|
-
const {
|
|
251
|
-
enabled: trackinEnabled
|
|
252
|
-
} = this.transactionTracking;
|
|
253
|
-
this.config.onEditorViewStateUpdatedCallbacks.forEach(entry => {
|
|
254
|
-
trackinEnabled && startMeasure(`🦉 ${entry.pluginName}::onEditorViewStateUpdated`);
|
|
255
|
-
entry.callback({
|
|
256
|
-
originalTransaction,
|
|
257
|
-
transactions,
|
|
258
|
-
oldEditorState,
|
|
259
|
-
newEditorState
|
|
260
|
-
});
|
|
261
|
-
trackinEnabled && stopMeasure(`🦉 ${entry.pluginName}::onEditorViewStateUpdated`);
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
_defineProperty(this, "trackValidTransactions", () => {
|
|
265
|
-
const {
|
|
266
|
-
editorProps
|
|
267
|
-
} = this.props;
|
|
268
|
-
if (editorProps !== null && editorProps !== void 0 && editorProps.trackValidTransactions) {
|
|
269
|
-
this.validTransactionCount++;
|
|
270
|
-
const samplingRate = typeof editorProps.trackValidTransactions === 'object' && editorProps.trackValidTransactions.samplingRate || DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS;
|
|
271
|
-
if (this.validTransactionCount >= samplingRate) {
|
|
272
|
-
this.dispatchAnalyticsEvent({
|
|
273
|
-
action: ACTION.DISPATCHED_VALID_TRANSACTION,
|
|
274
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
275
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
276
|
-
});
|
|
277
|
-
this.validTransactionCount = 0;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
_defineProperty(this, "dispatchTransaction", unsafeTransaction => {
|
|
282
|
-
if (!this.view) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
this.transactionTracker.bumpDispatchCounter(this.transactionTracking);
|
|
286
|
-
const {
|
|
287
|
-
startMeasure,
|
|
288
|
-
stopMeasure
|
|
289
|
-
} = this.transactionTracker.getMeasureHelpers(this.transactionTracking);
|
|
290
|
-
startMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
|
|
291
|
-
if (this.transactionTracker.shouldTrackTransaction(this.transactionTracking)) {
|
|
292
|
-
var _this$experienceStore;
|
|
293
|
-
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.start(EditorExperience.interaction);
|
|
294
|
-
}
|
|
295
|
-
const nodes = findChangedNodesFromTransaction(unsafeTransaction);
|
|
296
|
-
const changedNodesValid = validateNodes(nodes);
|
|
297
|
-
const transaction = this.featureFlags.saferDispatchedTransactions || this.featureFlags.saferDispatchedTransactionsAnalyticsOnly ? new Proxy(unsafeTransaction, freezeUnsafeTransactionProperties({
|
|
298
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
299
|
-
pluginKey: 'unknown-reacteditorview',
|
|
300
|
-
analyticsOnly: this.featureFlags.saferDispatchedTransactionsAnalyticsOnly
|
|
301
|
-
})) : unsafeTransaction;
|
|
302
|
-
if (changedNodesValid) {
|
|
303
|
-
const oldEditorState = this.view.state;
|
|
304
|
-
|
|
305
|
-
// go ahead and update the state now we know the transaction is good
|
|
306
|
-
startMeasure(EVENT_NAME_STATE_APPLY);
|
|
307
|
-
const {
|
|
308
|
-
state: editorState,
|
|
309
|
-
transactions
|
|
310
|
-
} = this.view.state.applyTransaction(transaction);
|
|
311
|
-
stopMeasure(EVENT_NAME_STATE_APPLY, (duration, startTime) => {
|
|
312
|
-
var _this$experienceStore2;
|
|
313
|
-
(_this$experienceStore2 = this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.mark(EditorExperience.interaction, 'stateApply', startTime + duration);
|
|
314
|
-
});
|
|
315
|
-
this.trackValidTransactions();
|
|
316
|
-
if (editorState === oldEditorState) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
startMeasure(EVENT_NAME_UPDATE_STATE);
|
|
320
|
-
this.view.updateState(editorState);
|
|
321
|
-
stopMeasure(EVENT_NAME_UPDATE_STATE, (duration, startTime) => {
|
|
322
|
-
var _this$experienceStore3;
|
|
323
|
-
(_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
324
|
-
});
|
|
325
|
-
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
326
|
-
this.onEditorViewStateUpdated({
|
|
327
|
-
originalTransaction: transaction,
|
|
328
|
-
transactions,
|
|
329
|
-
oldEditorState,
|
|
330
|
-
newEditorState: editorState
|
|
331
|
-
});
|
|
332
|
-
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED, (duration, startTime) => {
|
|
333
|
-
var _this$experienceStore4;
|
|
334
|
-
(_this$experienceStore4 = this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
|
|
335
|
-
});
|
|
336
|
-
if (this.props.editorProps.onChange && transaction.docChanged) {
|
|
337
|
-
const source = transaction.getMeta('isRemote') ? 'remote' : 'local';
|
|
338
|
-
startMeasure(EVENT_NAME_ON_CHANGE);
|
|
339
|
-
this.props.editorProps.onChange(this.view, {
|
|
340
|
-
source
|
|
341
|
-
});
|
|
342
|
-
stopMeasure(EVENT_NAME_ON_CHANGE, (duration, startTime) => {
|
|
343
|
-
var _this$experienceStore5, _this$props$editorPro5, _this$props$editorPro6;
|
|
344
|
-
(_this$experienceStore5 = this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.mark(EditorExperience.interaction, 'onChange', startTime + duration);
|
|
345
|
-
if (((_this$props$editorPro5 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro5 === void 0 ? void 0 : (_this$props$editorPro6 = _this$props$editorPro5.onChangeCallbackTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.enabled) !== true) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
this.dispatchAnalyticsEvent({
|
|
349
|
-
action: ACTION.ON_CHANGE_CALLBACK,
|
|
350
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
351
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
352
|
-
attributes: {
|
|
353
|
-
duration,
|
|
354
|
-
startTime
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
this.editorState = editorState;
|
|
360
|
-
stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION, (duration, startTime) => {
|
|
361
|
-
var _this$experienceStore6, _this$experienceStore7;
|
|
362
|
-
(_this$experienceStore6 = this.experienceStore) === null || _this$experienceStore6 === void 0 ? void 0 : _this$experienceStore6.mark(EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
|
|
363
|
-
(_this$experienceStore7 = this.experienceStore) === null || _this$experienceStore7 === void 0 ? void 0 : _this$experienceStore7.success(EditorExperience.interaction);
|
|
364
|
-
});
|
|
365
|
-
} else {
|
|
366
|
-
var _this$experienceStore8;
|
|
367
|
-
const invalidNodes = nodes.filter(node => !validNode(node)).map(node => getDocStructure(node, {
|
|
368
|
-
compact: true
|
|
369
|
-
}));
|
|
370
|
-
this.dispatchAnalyticsEvent({
|
|
371
|
-
action: ACTION.DISPATCHED_INVALID_TRANSACTION,
|
|
372
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
373
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
374
|
-
attributes: {
|
|
375
|
-
analyticsEventPayloads: getAnalyticsEventsFromTransaction(transaction),
|
|
376
|
-
invalidNodes
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
(_this$experienceStore8 = this.experienceStore) === null || _this$experienceStore8 === void 0 ? void 0 : _this$experienceStore8.fail(EditorExperience.interaction, {
|
|
380
|
-
reason: 'invalid transaction',
|
|
381
|
-
invalidNodes: invalidNodes.toString()
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
_defineProperty(this, "getDirectEditorProps", state => {
|
|
386
|
-
return {
|
|
387
|
-
state: state || this.editorState,
|
|
388
|
-
dispatchTransaction: tr => {
|
|
389
|
-
// Block stale transactions:
|
|
390
|
-
// Prevent runtime exeptions from async transactions that would attempt to
|
|
391
|
-
// update the DOM after React has unmounted the Editor.
|
|
392
|
-
if (this.canDispatchTransactions) {
|
|
393
|
-
this.dispatchTransaction(tr);
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
397
|
-
editable: _state => !this.props.editorProps.disabled,
|
|
398
|
-
attributes: {
|
|
399
|
-
'data-gramm': 'false'
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
});
|
|
403
|
-
_defineProperty(this, "createEditorView", node => {
|
|
404
|
-
measureRender(measurements.PROSEMIRROR_RENDERED, ({
|
|
405
|
-
duration,
|
|
406
|
-
startTime,
|
|
407
|
-
distortedDuration
|
|
408
|
-
}) => {
|
|
409
|
-
var _this$props$editorPro7, _this$props$editorPro8, _proseMirrorRenderedT, _proseMirrorRenderedT2;
|
|
410
|
-
const proseMirrorRenderedTracking = (_this$props$editorPro7 = this.props.editorProps) === null || _this$props$editorPro7 === void 0 ? void 0 : (_this$props$editorPro8 = _this$props$editorPro7.performanceTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.proseMirrorRenderedTracking;
|
|
411
|
-
const forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
|
|
412
|
-
this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
413
|
-
if (this.view) {
|
|
414
|
-
var _getContextIdentifier, _this$experienceStore10;
|
|
415
|
-
const nodes = getNodesCount(this.view.state.doc);
|
|
416
|
-
const ttfb = getResponseEndTime();
|
|
417
|
-
this.dispatchAnalyticsEvent({
|
|
418
|
-
action: ACTION.PROSEMIRROR_RENDERED,
|
|
419
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
420
|
-
attributes: {
|
|
421
|
-
duration,
|
|
422
|
-
startTime,
|
|
423
|
-
nodes,
|
|
424
|
-
ttfb,
|
|
425
|
-
severity: this.proseMirrorRenderedSeverity,
|
|
426
|
-
objectId: (_getContextIdentifier = getContextIdentifier(this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId,
|
|
427
|
-
distortedDuration
|
|
428
|
-
},
|
|
429
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
430
|
-
});
|
|
431
|
-
if (!distortedDuration) {
|
|
432
|
-
var _this$experienceStore9;
|
|
433
|
-
(_this$experienceStore9 = this.experienceStore) === null || _this$experienceStore9 === void 0 ? void 0 : _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
434
|
-
}
|
|
435
|
-
(_this$experienceStore10 = this.experienceStore) === null || _this$experienceStore10 === void 0 ? void 0 : _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
|
|
436
|
-
nodes,
|
|
437
|
-
ttfb
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
// Creates the editor-view from this.editorState. If an editor has been mounted
|
|
443
|
-
// previously, this will contain the previous state of the editor.
|
|
444
|
-
this.view = new EditorView({
|
|
445
|
-
mount: node
|
|
446
|
-
}, this.getDirectEditorProps());
|
|
447
|
-
});
|
|
448
|
-
_defineProperty(this, "handleEditorViewRef", node => {
|
|
449
|
-
if (!this.view && node) {
|
|
450
|
-
this.createEditorView(node);
|
|
451
|
-
const view = this.view;
|
|
452
|
-
this.props.onEditorCreated({
|
|
453
|
-
view,
|
|
454
|
-
config: this.config,
|
|
455
|
-
eventDispatcher: this.eventDispatcher,
|
|
456
|
-
transformer: this.contentTransformer
|
|
457
|
-
});
|
|
458
|
-
if (this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
|
|
459
|
-
this.focusTimeoutId = handleEditorFocus(view);
|
|
460
|
-
}
|
|
461
|
-
if (this.featureFlags.ufo) {
|
|
462
|
-
this.experienceStore = ExperienceStore.getInstance(view);
|
|
463
|
-
this.experienceStore.start(EditorExperience.editSession);
|
|
464
|
-
this.experienceStore.addMetadata(EditorExperience.editSession, {
|
|
465
|
-
reliabilityInterval: RELIABILITY_INTERVAL
|
|
466
|
-
});
|
|
467
|
-
this.reliabilityInterval = window.setInterval(() => {
|
|
468
|
-
var _this$experienceStore11, _this$experienceStore12;
|
|
469
|
-
(_this$experienceStore11 = this.experienceStore) === null || _this$experienceStore11 === void 0 ? void 0 : (_this$experienceStore12 = _this$experienceStore11.success(EditorExperience.editSession)) === null || _this$experienceStore12 === void 0 ? void 0 : _this$experienceStore12.finally(() => {
|
|
470
|
-
var _this$experienceStore13, _this$experienceStore14;
|
|
471
|
-
(_this$experienceStore13 = this.experienceStore) === null || _this$experienceStore13 === void 0 ? void 0 : _this$experienceStore13.start(EditorExperience.editSession);
|
|
472
|
-
(_this$experienceStore14 = this.experienceStore) === null || _this$experienceStore14 === void 0 ? void 0 : _this$experienceStore14.addMetadata(EditorExperience.editSession, {
|
|
473
|
-
reliabilityInterval: RELIABILITY_INTERVAL
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
|
-
const reliabilityEvent = {
|
|
477
|
-
action: ACTION.UFO_SESSION_COMPLETE,
|
|
478
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
479
|
-
attributes: {
|
|
480
|
-
interval: RELIABILITY_INTERVAL
|
|
481
|
-
},
|
|
482
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
483
|
-
};
|
|
484
|
-
this.dispatchAnalyticsEvent(reliabilityEvent);
|
|
485
|
-
}, RELIABILITY_INTERVAL);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// Force React to re-render so consumers get a reference to the editor view
|
|
489
|
-
this.forceUpdate();
|
|
490
|
-
} else if (this.view && !node) {
|
|
491
|
-
// When the appearance is changed, React will call handleEditorViewRef with node === null
|
|
492
|
-
// to destroy the old EditorView, before calling this method again with node === div to
|
|
493
|
-
// create the new EditorView
|
|
494
|
-
this.props.onEditorDestroyed({
|
|
495
|
-
view: this.view,
|
|
496
|
-
config: this.config,
|
|
497
|
-
eventDispatcher: this.eventDispatcher,
|
|
498
|
-
transformer: this.contentTransformer
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
// Allows us to dispatch analytics within the plugin view.destory methods
|
|
502
|
-
const analyticsConnected = this.eventDispatcher.has(analyticsEventKey, this.handleAnalyticsEvent);
|
|
503
|
-
if (!analyticsConnected) {
|
|
504
|
-
this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
|
|
505
|
-
}
|
|
506
|
-
this.view.destroy(); // Destroys the dom node & all node views
|
|
507
|
-
|
|
508
|
-
if (!analyticsConnected) {
|
|
509
|
-
this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
|
|
510
|
-
}
|
|
511
|
-
this.view = undefined;
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
_defineProperty(this, "dispatchAnalyticsEvent", payload => {
|
|
515
|
-
if (this.props.allowAnalyticsGASV3 && this.eventDispatcher) {
|
|
516
|
-
const dispatch = createDispatch(this.eventDispatcher);
|
|
517
|
-
dispatch(analyticsEventKey, {
|
|
518
|
-
payload
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
_defineProperty(this, "editor", /*#__PURE__*/React.createElement("div", {
|
|
523
|
-
className: getUAPrefix(),
|
|
524
|
-
key: "ProseMirror",
|
|
525
|
-
ref: this.handleEditorViewRef,
|
|
526
|
-
"aria-label": this.props.intl.formatMessage(editorMessages.editorAssistiveLabel),
|
|
527
|
-
role: "textbox"
|
|
528
|
-
}));
|
|
529
|
-
this.eventDispatcher = new EventDispatcher();
|
|
530
|
-
this.dispatch = createDispatch(this.eventDispatcher);
|
|
531
|
-
this.errorReporter = createErrorReporter(_props.editorProps.errorReporterHandler);
|
|
532
|
-
this.transactionTracker = new TransactionTracker();
|
|
533
|
-
this.pluginPerformanceObserver = new PluginPerformanceObserver(report => this.onPluginObservation(report, this.editorState)).withPlugins(() => this.getPluginNames()).withNodeCounts(() => this.countNodes()).withOptions(() => this.transactionTracking).withTransactionTracker(() => this.transactionTracker);
|
|
534
|
-
this.validTransactionCount = 0;
|
|
535
|
-
this.featureFlags = createFeatureFlagsFromProps(this.props.editorProps);
|
|
536
|
-
const featureFlagsEnabled = this.featureFlags ? getEnabledFeatureFlagKeys(this.featureFlags) : [];
|
|
537
|
-
|
|
538
|
-
// START TEMPORARY CODE ED-10584
|
|
539
|
-
if (this.props.createAnalyticsEvent) {
|
|
540
|
-
this.props.createAnalyticsEvent.__queueAnalytics = this.featureFlags.queueAnalytics;
|
|
541
|
-
}
|
|
542
|
-
// END TEMPORARY CODE ED-10584
|
|
543
|
-
|
|
544
|
-
// This needs to be before initialising editorState because
|
|
545
|
-
// we dispatch analytics events in plugin initialisation
|
|
546
|
-
this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
|
|
547
|
-
this.eventDispatcher.on('resetEditorState', this.resetEditorState);
|
|
548
|
-
this.editorState = this.createEditorState({
|
|
549
|
-
props: _props,
|
|
550
|
-
context,
|
|
551
|
-
doc: _props.editorProps.defaultValue,
|
|
552
|
-
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
553
|
-
selectionAtStart: isFullPage(_props.editorProps.appearance)
|
|
554
|
-
});
|
|
555
|
-
this.dispatchAnalyticsEvent({
|
|
556
|
-
action: ACTION.STARTED,
|
|
557
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
558
|
-
attributes: {
|
|
559
|
-
platform: PLATFORMS.WEB,
|
|
560
|
-
featureFlags: featureFlagsEnabled
|
|
561
|
-
},
|
|
562
|
-
eventType: EVENT_TYPE.UI
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
566
|
-
// START TEMPORARY CODE ED-10584
|
|
567
|
-
if (nextProps.createAnalyticsEvent && nextProps.createAnalyticsEvent !== this.props.createAnalyticsEvent) {
|
|
568
|
-
const featureFlags = createFeatureFlagsFromProps(nextProps.editorProps);
|
|
569
|
-
nextProps.createAnalyticsEvent.__queueAnalytics = featureFlags.queueAnalytics;
|
|
570
|
-
}
|
|
571
|
-
// END TEMPORARY CODE ED-10584
|
|
572
|
-
|
|
573
|
-
if (this.view && this.props.editorProps.disabled !== nextProps.editorProps.disabled) {
|
|
574
|
-
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
575
|
-
this.view.setProps({
|
|
576
|
-
editable: _state => !nextProps.editorProps.disabled
|
|
577
|
-
});
|
|
578
|
-
if (!nextProps.editorProps.disabled && nextProps.editorProps.shouldFocus) {
|
|
579
|
-
this.focusTimeoutId = handleEditorFocus(this.view);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
const {
|
|
583
|
-
appearance
|
|
584
|
-
} = this.props.editorProps;
|
|
585
|
-
const {
|
|
586
|
-
appearance: nextAppearance
|
|
587
|
-
} = nextProps.editorProps;
|
|
588
|
-
if (shouldReconfigureState(this.props.editorProps, nextProps.editorProps)) {
|
|
589
|
-
this.reconfigureState(nextProps);
|
|
590
|
-
}
|
|
591
|
-
if (nextAppearance !== appearance) {
|
|
592
|
-
if (nextAppearance === 'full-width' || appearance === 'full-width') {
|
|
593
|
-
this.dispatchAnalyticsEvent({
|
|
594
|
-
action: ACTION.CHANGED_FULL_WIDTH_MODE,
|
|
595
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
596
|
-
eventType: EVENT_TYPE.TRACK,
|
|
597
|
-
attributes: {
|
|
598
|
-
previousMode: this.formatFullWidthAppearance(appearance),
|
|
599
|
-
newMode: this.formatFullWidthAppearance(nextAppearance)
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
if (!this.transactionTracking.enabled) {
|
|
605
|
-
this.pluginPerformanceObserver.disconnect();
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
componentDidMount() {
|
|
609
|
-
// Transaction dispatching is already enabled by default prior to
|
|
610
|
-
// mounting, but we reset it here, just in case the editor view
|
|
611
|
-
// instance is ever recycled (mounted again after unmounting) with
|
|
612
|
-
// the same key.
|
|
613
|
-
// Although storing mounted state is an anti-pattern in React,
|
|
614
|
-
// we do so here so that we can intercept and abort asynchronous
|
|
615
|
-
// ProseMirror transactions when a dismount is imminent.
|
|
616
|
-
this.canDispatchTransactions = true;
|
|
617
|
-
if (this.transactionTracking.enabled) {
|
|
618
|
-
this.pluginPerformanceObserver.observe();
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Clean up any non-PM resources when the editor is unmounted
|
|
624
|
-
*/
|
|
625
|
-
componentWillUnmount() {
|
|
626
|
-
// We can ignore any transactions from this point onwards.
|
|
627
|
-
// This serves to avoid potential runtime exceptions which could arise
|
|
628
|
-
// from an async dispatched transaction after it's unmounted.
|
|
629
|
-
this.canDispatchTransactions = false;
|
|
630
|
-
clearTimeout(this.focusTimeoutId);
|
|
631
|
-
if (this.reliabilityInterval) {
|
|
632
|
-
clearInterval(this.reliabilityInterval);
|
|
633
|
-
}
|
|
634
|
-
this.pluginPerformanceObserver.disconnect();
|
|
635
|
-
if (this.view) {
|
|
636
|
-
// Destroy the state if the Editor is being unmounted
|
|
637
|
-
const editorState = this.view.state;
|
|
638
|
-
editorState.plugins.forEach(plugin => {
|
|
639
|
-
const state = plugin.getState(editorState);
|
|
640
|
-
if (state && state.destroy) {
|
|
641
|
-
state.destroy();
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
this.eventDispatcher.destroy();
|
|
646
|
-
// this.view will be destroyed when React unmounts in handleEditorViewRef
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
// Helper to allow tests to inject plugins directly
|
|
650
|
-
getPlugins(editorProps, prevEditorProps, createAnalyticsEvent) {
|
|
651
|
-
var _editorProps$dangerou, _editorProps$dangerou2;
|
|
652
|
-
const editorPlugins = (_editorProps$dangerou = (_editorProps$dangerou2 = editorProps.dangerouslyAppendPlugins) === null || _editorProps$dangerou2 === void 0 ? void 0 : _editorProps$dangerou2.__plugins) !== null && _editorProps$dangerou !== void 0 ? _editorProps$dangerou : [];
|
|
653
|
-
const insertNodeAPI = createInsertNodeAPI({
|
|
654
|
-
getEditorView: () => this.view,
|
|
655
|
-
getEditorPlugins: () => this.editorPlugins
|
|
656
|
-
});
|
|
657
|
-
const editorAnalyticsAPI = createEditorAnalyticsAPI({
|
|
658
|
-
getEditorView: () => this.view,
|
|
659
|
-
getCreateUIAnalyticsEvent: () => createAnalyticsEvent
|
|
660
|
-
});
|
|
661
|
-
const editorSelectionAPI = createEditorSelectionAPI();
|
|
662
|
-
const builtinPlugins = createPluginList(editorProps, prevEditorProps, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI);
|
|
663
|
-
if (editorPlugins && editorPlugins.length > 0) {
|
|
664
|
-
builtinPlugins.push(...editorPlugins);
|
|
665
|
-
}
|
|
666
|
-
this.editorPlugins = builtinPlugins;
|
|
667
|
-
return builtinPlugins;
|
|
668
|
-
}
|
|
669
|
-
render() {
|
|
670
|
-
var _this$props$editorPro9, _this$props$editorPro10;
|
|
671
|
-
const renderTracking = (_this$props$editorPro9 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro9 === void 0 ? void 0 : (_this$props$editorPro10 = _this$props$editorPro9.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
|
|
672
|
-
const renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
673
|
-
const useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
674
|
-
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
675
|
-
value: {
|
|
676
|
-
editorRef: this.editorRef,
|
|
677
|
-
editorView: this.view
|
|
678
|
-
}
|
|
679
|
-
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
680
|
-
componentProps: this.props,
|
|
681
|
-
action: ACTION.RE_RENDERED,
|
|
682
|
-
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
683
|
-
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
684
|
-
useShallow: useShallow
|
|
685
|
-
}), this.props.render ? this.props.render({
|
|
686
|
-
editor: this.editor,
|
|
687
|
-
view: this.view,
|
|
688
|
-
config: this.config,
|
|
689
|
-
eventDispatcher: this.eventDispatcher,
|
|
690
|
-
transformer: this.contentTransformer,
|
|
691
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
692
|
-
editorRef: this.editorRef
|
|
693
|
-
}) : this.editor);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
_defineProperty(ReactEditorView, "contextTypes", {
|
|
697
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.func
|
|
698
|
-
});
|
|
699
|
-
export default injectIntl(ReactEditorView);
|
|
700
|
-
function getUAPrefix() {
|
|
701
|
-
if (browser.chrome) {
|
|
702
|
-
return 'ua-chrome';
|
|
703
|
-
} else if (browser.ie) {
|
|
704
|
-
return 'ua-ie';
|
|
705
|
-
} else if (browser.gecko) {
|
|
706
|
-
return 'ua-firefox';
|
|
707
|
-
} else if (browser.safari) {
|
|
708
|
-
return 'ua-safari';
|
|
709
|
-
}
|
|
710
|
-
return '';
|
|
711
|
-
}
|
|
3
|
+
export class ReactEditorView extends BaseReactEditorView {}
|
|
4
|
+
export default injectIntl(ReactEditorView);
|