@atlaskit/editor-core 180.1.0 → 181.0.1
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 +50 -0
- package/dist/cjs/actions/index.js +25 -10
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/cjs/create-editor/ReactEditorView.js +0 -5
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +73 -103
- package/dist/cjs/create-editor/create-plugins-list.js +37 -5
- package/dist/cjs/create-editor/feature-flags-from-props.js +31 -26
- package/dist/cjs/create-editor/preset-utils.js +27 -0
- package/dist/cjs/editor-next/editor-internal.js +2 -2
- package/dist/cjs/editor-next/editor-migration-component.js +18 -2
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/cjs/editor-next/index.js +13 -9
- package/dist/cjs/editor-next/utils/getProvidersFromEditorProps.js +41 -0
- package/dist/cjs/editor-next/utils/handleProviders.js +17 -22
- package/dist/cjs/editor.js +20 -13
- package/dist/cjs/keymaps/consts.js +1 -16
- 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 +330 -257
- package/dist/cjs/labs/next/presets/useUniversalPreset.js +36 -0
- package/dist/cjs/plugins/analytics/plugin.js +6 -0
- package/dist/cjs/plugins/annotation/utils.js +2 -36
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +2 -7
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -10
- package/dist/cjs/plugins/caption/index.js +0 -7
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +9 -4
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +6 -3
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main-state.js +2 -14
- 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/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/floating-toolbar/ui/Button.js +7 -3
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +24 -8
- package/dist/cjs/plugins/floating-toolbar/utils.js +0 -12
- package/dist/cjs/plugins/fragment/index.js +0 -8
- package/dist/cjs/plugins/help-dialog/commands.js +2 -6
- package/dist/cjs/plugins/image-upload/pm-plugins/main.js +50 -12
- 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/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/paste/index.js +1 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +123 -87
- package/dist/cjs/plugins/paste/util/index.js +0 -46
- 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/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 +7 -5
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/cjs/plugins/text-formatting/utils.js +1 -26
- package/dist/cjs/plugins/type-ahead/constants.js +1 -7
- package/dist/cjs/plugins/type-ahead/index.js +4 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +6 -37
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/cjs/plugins/type-ahead/utils.js +25 -24
- package/dist/cjs/test-utils.js +4 -12
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +43 -8
- package/dist/cjs/ui/ColorPalette/index.js +18 -0
- package/dist/cjs/ui/ColorPickerButton/index.js +6 -2
- 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/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +1 -3
- package/dist/cjs/ui/Resizer/utils.js +1 -3
- package/dist/cjs/ui/styles.js +3 -7
- package/dist/cjs/utils/get-editor-plugins.js +1 -3
- package/dist/cjs/utils/index.js +9 -269
- package/dist/cjs/utils/input-rules.js +1 -15
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +23 -9
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +0 -5
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +67 -82
- package/dist/es2019/create-editor/create-plugins-list.js +32 -5
- package/dist/es2019/create-editor/feature-flags-from-props.js +31 -26
- package/dist/es2019/create-editor/preset-utils.js +15 -0
- package/dist/es2019/editor-next/editor-internal.js +2 -2
- package/dist/es2019/editor-next/editor-migration-component.js +19 -2
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/es2019/editor-next/index.js +13 -7
- package/dist/es2019/editor-next/utils/getProvidersFromEditorProps.js +36 -0
- package/dist/es2019/editor-next/utils/handleProviders.js +18 -24
- package/dist/es2019/editor.js +20 -11
- package/dist/es2019/keymaps/consts.js +7 -11
- 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 +338 -265
- package/dist/es2019/labs/next/presets/useUniversalPreset.js +25 -0
- package/dist/es2019/plugins/analytics/plugin.js +7 -0
- package/dist/es2019/plugins/annotation/utils.js +2 -30
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +1 -3
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -9
- package/dist/es2019/plugins/caption/index.js +0 -2
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -4
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +6 -3
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main-state.js +1 -9
- 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/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/floating-toolbar/ui/Button.js +7 -3
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +1 -11
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +21 -4
- package/dist/es2019/plugins/floating-toolbar/utils.js +0 -10
- package/dist/es2019/plugins/fragment/index.js +0 -7
- package/dist/es2019/plugins/help-dialog/commands.js +1 -2
- package/dist/es2019/plugins/image-upload/pm-plugins/main.js +47 -5
- 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/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/paste/index.js +1 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +126 -94
- package/dist/es2019/plugins/paste/util/index.js +5 -45
- 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/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 +7 -5
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/es2019/plugins/text-formatting/utils.js +0 -19
- package/dist/es2019/plugins/type-ahead/constants.js +0 -5
- package/dist/es2019/plugins/type-ahead/index.js +4 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +4 -37
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/es2019/plugins/type-ahead/utils.js +22 -25
- package/dist/es2019/test-utils.js +4 -7
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +40 -6
- package/dist/es2019/ui/ColorPalette/index.js +2 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +6 -2
- 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/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/es2019/ui/ElementBrowser/constants.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -1
- package/dist/es2019/ui/styles.js +0 -6
- package/dist/es2019/utils/get-editor-plugins.js +1 -3
- package/dist/es2019/utils/index.js +13 -199
- package/dist/es2019/utils/input-rules.js +0 -14
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +23 -9
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +0 -5
- package/dist/esm/create-editor/ReactEditorViewInternal.js +73 -102
- package/dist/esm/create-editor/create-plugins-list.js +36 -5
- package/dist/esm/create-editor/feature-flags-from-props.js +31 -26
- package/dist/esm/create-editor/preset-utils.js +21 -0
- package/dist/esm/editor-next/editor-internal.js +2 -2
- package/dist/esm/editor-next/editor-migration-component.js +18 -2
- package/dist/esm/editor-next/hooks/useProviderFactory.js +4 -3
- package/dist/esm/editor-next/index.js +13 -9
- package/dist/esm/editor-next/utils/getProvidersFromEditorProps.js +35 -0
- package/dist/esm/editor-next/utils/handleProviders.js +17 -22
- package/dist/esm/editor.js +20 -13
- package/dist/esm/keymaps/consts.js +7 -11
- 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 +330 -257
- package/dist/esm/labs/next/presets/useUniversalPreset.js +29 -0
- package/dist/esm/plugins/analytics/plugin.js +6 -0
- package/dist/esm/plugins/annotation/utils.js +2 -32
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +1 -5
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -9
- package/dist/esm/plugins/caption/index.js +0 -2
- package/dist/esm/plugins/card/nodeviews/blockCard.js +9 -4
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +6 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +6 -3
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -0
- package/dist/esm/plugins/code-block/pm-plugins/main-state.js +0 -10
- 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/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/floating-toolbar/ui/Button.js +7 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +10 -5
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +24 -8
- package/dist/esm/plugins/floating-toolbar/utils.js +0 -10
- package/dist/esm/plugins/fragment/index.js +0 -7
- package/dist/esm/plugins/help-dialog/commands.js +0 -3
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +51 -12
- 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/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/paste/index.js +1 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +122 -86
- package/dist/esm/plugins/paste/util/index.js +5 -45
- 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/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 +7 -5
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
- package/dist/esm/plugins/text-formatting/utils.js +0 -21
- package/dist/esm/plugins/type-ahead/constants.js +0 -5
- package/dist/esm/plugins/type-ahead/index.js +4 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +4 -33
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/esm/plugins/type-ahead/utils.js +24 -22
- package/dist/esm/test-utils.js +4 -7
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +41 -6
- package/dist/esm/ui/ColorPalette/index.js +2 -1
- package/dist/esm/ui/ColorPickerButton/index.js +6 -2
- 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/ElementBrowser/ModalElementBrowser.js +1 -1
- package/dist/esm/ui/ElementBrowser/constants.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -1
- package/dist/esm/ui/styles.js +2 -5
- package/dist/esm/utils/get-editor-plugins.js +1 -3
- package/dist/esm/utils/index.js +13 -196
- package/dist/esm/utils/input-rules.js +0 -13
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +4 -4
- package/dist/types/create-editor/ReactEditorView.d.ts +0 -3
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +9 -7
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +3 -4
- 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 +9 -9
- package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +2 -2
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +2 -2
- package/dist/types/editor-next/index.d.ts +6 -6
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -2
- package/dist/types/editor-next/utils/editorPropTypes.d.ts +1 -1
- package/dist/types/editor-next/utils/getProvidersFromEditorProps.d.ts +9 -0
- package/dist/types/editor-next/utils/handleProviders.d.ts +2 -2
- package/dist/types/editor-next/utils/onEditorCreated.d.ts +2 -2
- package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +1 -1
- package/dist/types/editor.d.ts +7 -4
- package/dist/types/keymaps/consts.d.ts +0 -11
- 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/pm-plugins/types.d.ts +0 -11
- package/dist/types/plugins/annotation/utils.d.ts +0 -17
- package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +2 -3
- package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +2 -6
- package/dist/types/plugins/caption/index.d.ts +0 -2
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +2 -10
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/plugins/code-block/actions.d.ts +0 -4
- package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +0 -3
- 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 +2 -3
- 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/extension/commands.d.ts +0 -1
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +0 -5
- package/dist/types/plugins/feedback-dialog/index.d.ts +0 -2
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +3 -1
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
- 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/help-dialog/commands.d.ts +0 -1
- package/dist/types/plugins/history/actions.d.ts +1 -2
- package/dist/types/plugins/layout/styles.d.ts +2 -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/media/utils/media-common.d.ts +0 -5
- 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/paste/index.d.ts +0 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +6 -3
- package/dist/types/plugins/paste/util/index.d.ts +0 -6
- package/dist/types/plugins/quick-insert/assets/index.d.ts +0 -2
- package/dist/types/plugins/status/utils.d.ts +0 -3
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/text-color/pm-plugins/main.d.ts +2 -12
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +0 -4
- package/dist/types/plugins/type-ahead/constants.d.ts +0 -4
- package/dist/types/plugins/type-ahead/index.d.ts +1 -0
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +2 -11
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +1 -0
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +1 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +3 -3
- 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/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 +3 -3
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -5
- 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 +4 -2
- 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/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/Resizer/utils.d.ts +0 -1
- package/dist/types/ui/styles.d.ts +0 -1
- package/dist/types/utils/index.d.ts +6 -65
- package/dist/types/utils/input-rules.d.ts +1 -2
- package/dist/types/utils/table.d.ts +0 -1
- package/package.json +23 -24
- package/report.api.md +155 -146
- package/dist/cjs/labs/next/presets/preset.js +0 -101
- package/dist/cjs/plugins/analytics/types/type-ahead.js +0 -5
- 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 -68
- package/dist/es2019/plugins/analytics/types/type-ahead.js +0 -1
- 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/es2019/ui/WithPluginState/types.js +0 -1
- package/dist/esm/labs/next/presets/preset.js +0 -93
- 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/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
|
@@ -29,8 +29,7 @@ import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPD
|
|
|
29
29
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
30
30
|
import { getContextIdentifier } from '../plugins/base/pm-plugins/context-identifier';
|
|
31
31
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
32
|
-
import {
|
|
33
|
-
import { createEditorAnalyticsAPI } from '../analytics-api/api';
|
|
32
|
+
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
34
33
|
function handleEditorFocus(view) {
|
|
35
34
|
if (view.hasFocus()) {
|
|
36
35
|
return;
|
|
@@ -39,18 +38,6 @@ function handleEditorFocus(view) {
|
|
|
39
38
|
view.focus();
|
|
40
39
|
}, 0);
|
|
41
40
|
}
|
|
42
|
-
const EMPTY = [];
|
|
43
|
-
export function shouldReconfigureState(props, nextProps) {
|
|
44
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
45
|
-
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;
|
|
46
|
-
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;
|
|
47
|
-
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(p => nextPlugins.some(n => n.name === p.name && n !== p))) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
const mobileProperties = props.appearance === 'mobile' ? ['featureFlags', 'quickInsert'] : [];
|
|
51
|
-
const properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent', ...mobileProperties];
|
|
52
|
-
return properties.reduce((acc, curr) => acc || props[curr] !== nextProps[curr], false);
|
|
53
|
-
}
|
|
54
41
|
export class ReactEditorView extends React.Component {
|
|
55
42
|
// ProseMirror is instantiated prior to the initial React render cycle,
|
|
56
43
|
// so we allow transactions by default, to avoid discarding the initial one.
|
|
@@ -67,8 +54,8 @@ export class ReactEditorView extends React.Component {
|
|
|
67
54
|
countNodes() {
|
|
68
55
|
return countNodes(this.editorState);
|
|
69
56
|
}
|
|
70
|
-
constructor(
|
|
71
|
-
super(
|
|
57
|
+
constructor(props, context) {
|
|
58
|
+
super(props, context);
|
|
72
59
|
_defineProperty(this, "editorRef", /*#__PURE__*/React.createRef());
|
|
73
60
|
_defineProperty(this, "canDispatchTransactions", true);
|
|
74
61
|
_defineProperty(this, "onPluginObservation", (report, editorState) => {
|
|
@@ -82,6 +69,10 @@ export class ReactEditorView extends React.Component {
|
|
|
82
69
|
}
|
|
83
70
|
});
|
|
84
71
|
});
|
|
72
|
+
_defineProperty(this, "getEditorState", () => {
|
|
73
|
+
var _this$view;
|
|
74
|
+
return (_this$view = this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
|
|
75
|
+
});
|
|
85
76
|
_defineProperty(this, "formatFullWidthAppearance", appearance => {
|
|
86
77
|
if (appearance === 'full-width') {
|
|
87
78
|
return FULL_WIDTH_MODE.FULL_WIDTH;
|
|
@@ -130,45 +121,6 @@ export class ReactEditorView extends React.Component {
|
|
|
130
121
|
sel.removeAllRanges();
|
|
131
122
|
}
|
|
132
123
|
});
|
|
133
|
-
_defineProperty(this, "reconfigureState", props => {
|
|
134
|
-
if (!this.view) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
139
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
140
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
141
|
-
this.blur();
|
|
142
|
-
const editorPlugins = this.getPlugins(props.editorProps, this.props.editorProps, this.props.createAnalyticsEvent);
|
|
143
|
-
this.config = processPluginsList(editorPlugins);
|
|
144
|
-
const state = this.editorState;
|
|
145
|
-
const plugins = createPMPlugins({
|
|
146
|
-
schema: state.schema,
|
|
147
|
-
dispatch: this.dispatch,
|
|
148
|
-
errorReporter: this.errorReporter,
|
|
149
|
-
editorConfig: this.config,
|
|
150
|
-
eventDispatcher: this.eventDispatcher,
|
|
151
|
-
providerFactory: props.providerFactory,
|
|
152
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
153
|
-
reactContext: () => this.context,
|
|
154
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
155
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
156
|
-
transactionTracker: this.transactionTracker,
|
|
157
|
-
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
158
|
-
getIntl: () => this.props.intl
|
|
159
|
-
});
|
|
160
|
-
const newState = state.reconfigure({
|
|
161
|
-
plugins: plugins
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// need to update the state first so when the view builds the nodeviews it is
|
|
165
|
-
// using the latest plugins
|
|
166
|
-
this.view.updateState(newState);
|
|
167
|
-
return this.view.update({
|
|
168
|
-
...this.view.props,
|
|
169
|
-
state: newState
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
124
|
_defineProperty(this, "handleAnalyticsEvent", payload => {
|
|
173
125
|
if (!this.props.allowAnalyticsGASV3) {
|
|
174
126
|
return;
|
|
@@ -199,7 +151,7 @@ export class ReactEditorView extends React.Component {
|
|
|
199
151
|
return this.editorState;
|
|
200
152
|
}
|
|
201
153
|
} else {
|
|
202
|
-
this.config = processPluginsList(this.getPlugins(options.props.
|
|
154
|
+
this.config = processPluginsList(this.getPlugins(options.props.preset));
|
|
203
155
|
schema = createSchema(this.config);
|
|
204
156
|
}
|
|
205
157
|
const {
|
|
@@ -319,6 +271,10 @@ export class ReactEditorView extends React.Component {
|
|
|
319
271
|
var _this$experienceStore3;
|
|
320
272
|
(_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
321
273
|
});
|
|
274
|
+
this.pluginInjectionAPI.onEditorViewUpdated({
|
|
275
|
+
newEditorState: editorState,
|
|
276
|
+
oldEditorState
|
|
277
|
+
});
|
|
322
278
|
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
323
279
|
this.onEditorViewStateUpdated({
|
|
324
280
|
originalTransaction: transaction,
|
|
@@ -441,6 +397,10 @@ export class ReactEditorView extends React.Component {
|
|
|
441
397
|
this.view = new EditorView({
|
|
442
398
|
mount: node
|
|
443
399
|
}, this.getDirectEditorProps());
|
|
400
|
+
this.pluginInjectionAPI.onEditorViewUpdated({
|
|
401
|
+
newEditorState: this.view.state,
|
|
402
|
+
oldEditorState: undefined
|
|
403
|
+
});
|
|
444
404
|
});
|
|
445
405
|
_defineProperty(this, "handleEditorViewRef", node => {
|
|
446
406
|
if (!this.view && node) {
|
|
@@ -523,9 +483,12 @@ export class ReactEditorView extends React.Component {
|
|
|
523
483
|
"aria-label": this.props.intl.formatMessage(editorMessages.editorAssistiveLabel),
|
|
524
484
|
role: "textbox"
|
|
525
485
|
}));
|
|
486
|
+
this.pluginInjectionAPI = new EditorPluginInjectionAPI({
|
|
487
|
+
getEditorState: this.getEditorState
|
|
488
|
+
});
|
|
526
489
|
this.eventDispatcher = new EventDispatcher();
|
|
527
490
|
this.dispatch = createDispatch(this.eventDispatcher);
|
|
528
|
-
this.errorReporter = createErrorReporter(
|
|
491
|
+
this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
529
492
|
this.transactionTracker = new TransactionTracker();
|
|
530
493
|
this.pluginPerformanceObserver = new PluginPerformanceObserver(report => this.onPluginObservation(report, this.editorState)).withPlugins(() => this.getPluginNames()).withNodeCounts(() => this.countNodes()).withOptions(() => this.transactionTracking).withTransactionTracker(() => this.transactionTracker);
|
|
531
494
|
this.validTransactionCount = 0;
|
|
@@ -543,11 +506,11 @@ export class ReactEditorView extends React.Component {
|
|
|
543
506
|
this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
|
|
544
507
|
this.eventDispatcher.on('resetEditorState', this.resetEditorState);
|
|
545
508
|
this.editorState = this.createEditorState({
|
|
546
|
-
props
|
|
509
|
+
props,
|
|
547
510
|
context,
|
|
548
|
-
doc:
|
|
511
|
+
doc: props.editorProps.defaultValue,
|
|
549
512
|
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
550
|
-
selectionAtStart: isFullPage(
|
|
513
|
+
selectionAtStart: isFullPage(props.editorProps.appearance)
|
|
551
514
|
});
|
|
552
515
|
this.dispatchAnalyticsEvent({
|
|
553
516
|
action: ACTION.STARTED,
|
|
@@ -582,7 +545,7 @@ export class ReactEditorView extends React.Component {
|
|
|
582
545
|
const {
|
|
583
546
|
appearance: nextAppearance
|
|
584
547
|
} = nextProps.editorProps;
|
|
585
|
-
if (
|
|
548
|
+
if (this.props.preset !== nextProps.preset) {
|
|
586
549
|
this.reconfigureState(nextProps);
|
|
587
550
|
}
|
|
588
551
|
if (nextAppearance !== appearance) {
|
|
@@ -602,6 +565,45 @@ export class ReactEditorView extends React.Component {
|
|
|
602
565
|
this.pluginPerformanceObserver.disconnect();
|
|
603
566
|
}
|
|
604
567
|
}
|
|
568
|
+
reconfigureState(props) {
|
|
569
|
+
if (!this.view) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
574
|
+
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
575
|
+
// nodes that haven't been re-rendered to the document yet.
|
|
576
|
+
this.blur();
|
|
577
|
+
const editorPlugins = this.getPlugins(props.preset);
|
|
578
|
+
this.config = processPluginsList(editorPlugins);
|
|
579
|
+
const state = this.editorState;
|
|
580
|
+
const plugins = createPMPlugins({
|
|
581
|
+
schema: state.schema,
|
|
582
|
+
dispatch: this.dispatch,
|
|
583
|
+
errorReporter: this.errorReporter,
|
|
584
|
+
editorConfig: this.config,
|
|
585
|
+
eventDispatcher: this.eventDispatcher,
|
|
586
|
+
providerFactory: props.providerFactory,
|
|
587
|
+
portalProviderAPI: props.portalProviderAPI,
|
|
588
|
+
reactContext: () => this.context,
|
|
589
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
590
|
+
performanceTracking: props.editorProps.performanceTracking,
|
|
591
|
+
transactionTracker: this.transactionTracker,
|
|
592
|
+
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
593
|
+
getIntl: () => this.props.intl
|
|
594
|
+
});
|
|
595
|
+
const newState = state.reconfigure({
|
|
596
|
+
plugins: plugins
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
// need to update the state first so when the view builds the nodeviews it is
|
|
600
|
+
// using the latest plugins
|
|
601
|
+
this.view.updateState(newState);
|
|
602
|
+
return this.view.update({
|
|
603
|
+
...this.view.props,
|
|
604
|
+
state: newState
|
|
605
|
+
});
|
|
606
|
+
}
|
|
605
607
|
componentDidMount() {
|
|
606
608
|
// Transaction dispatching is already enabled by default prior to
|
|
607
609
|
// mounting, but we reset it here, just in case the editor view
|
|
@@ -644,28 +646,11 @@ export class ReactEditorView extends React.Component {
|
|
|
644
646
|
}
|
|
645
647
|
|
|
646
648
|
// Helper to allow tests to inject plugins directly
|
|
647
|
-
getPlugins(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
getEditorView: () => this.view,
|
|
651
|
-
getEditorPlugins: () => this.editorPlugins
|
|
652
|
-
});
|
|
653
|
-
const editorAnalyticsAPI = createEditorAnalyticsAPI({
|
|
654
|
-
getEditorView: () => this.view,
|
|
655
|
-
getCreateUIAnalyticsEvent: () => createAnalyticsEvent
|
|
649
|
+
getPlugins(preset) {
|
|
650
|
+
const plugins = preset.build({
|
|
651
|
+
pluginInjectionAPI: this.pluginInjectionAPI
|
|
656
652
|
});
|
|
657
|
-
|
|
658
|
-
props: editorProps,
|
|
659
|
-
prevAppearance: prevEditorProps === null || prevEditorProps === void 0 ? void 0 : prevEditorProps.appearance,
|
|
660
|
-
createAnalyticsEvent,
|
|
661
|
-
insertNodeAPI,
|
|
662
|
-
editorAnalyticsAPI
|
|
663
|
-
};
|
|
664
|
-
if (this.props.getEditorPlugins === undefined) {
|
|
665
|
-
// eslint-disable-next-line no-console
|
|
666
|
-
console.error('getEditorPlugins is undefined in ReactEditorViewInternal - no editor plugins will be added.');
|
|
667
|
-
}
|
|
668
|
-
this.editorPlugins = (_this$props$getEditor = (_this$props$getEditor2 = (_this$props = this.props).getEditorPlugins) === null || _this$props$getEditor2 === void 0 ? void 0 : _this$props$getEditor2.call(_this$props, getPluginsProps)) !== null && _this$props$getEditor !== void 0 ? _this$props$getEditor : [];
|
|
653
|
+
this.editorPlugins = plugins;
|
|
669
654
|
return this.editorPlugins;
|
|
670
655
|
}
|
|
671
656
|
render() {
|
|
@@ -29,17 +29,22 @@ export function getScrollGutterOptions(props) {
|
|
|
29
29
|
return undefined;
|
|
30
30
|
}
|
|
31
31
|
export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
32
|
-
var _props$performanceTra, _props$linking, _props$performanceTra2, _props$textFormatting, _props$linking2;
|
|
32
|
+
var _props$performanceTra, _props$linking, _ref, _props$featureFlags$u, _props$featureFlags, _props$featureFlags2, _props$performanceTra2, _props$textFormatting, _props$linking2;
|
|
33
33
|
const appearance = props.appearance;
|
|
34
34
|
const isMobile = appearance === 'mobile';
|
|
35
35
|
const inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
|
|
36
36
|
const cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
|
|
37
|
+
|
|
38
|
+
// duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
|
|
39
|
+
const pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
|
|
40
|
+
const useBetterTypeaheadNavigation = Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true);
|
|
37
41
|
return {
|
|
38
42
|
...props,
|
|
39
43
|
createAnalyticsEvent,
|
|
40
44
|
typeAhead: {
|
|
41
45
|
createAnalyticsEvent,
|
|
42
|
-
isMobile
|
|
46
|
+
isMobile,
|
|
47
|
+
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
|
|
43
48
|
},
|
|
44
49
|
featureFlags: createFeatureFlagsFromProps(props),
|
|
45
50
|
paste: {
|
|
@@ -100,13 +105,35 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
100
105
|
* Note: The order that presets are added determines
|
|
101
106
|
* their placement in the editor toolbar
|
|
102
107
|
*/
|
|
103
|
-
export default function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
104
|
-
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent
|
|
108
|
+
export default function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
109
|
+
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
|
|
105
110
|
const excludes = new Set();
|
|
106
111
|
if (!isCodeBlockAllowed({
|
|
107
112
|
allowBlockType: props.allowBlockType
|
|
108
113
|
})) {
|
|
109
114
|
excludes.add('codeBlock');
|
|
110
115
|
}
|
|
111
|
-
return preset.
|
|
116
|
+
return preset.build({
|
|
117
|
+
excludePlugins: excludes
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function withDangerouslyAppendPlugins(preset) {
|
|
121
|
+
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
122
|
+
return plugins ? plugins.map(plugin => () => plugin) : [];
|
|
123
|
+
}
|
|
124
|
+
return editorPluginsToAppend => {
|
|
125
|
+
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
126
|
+
return preset;
|
|
127
|
+
}
|
|
128
|
+
const nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
129
|
+
const presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce((acc, plugin) => {
|
|
130
|
+
return acc.add(plugin);
|
|
131
|
+
}, preset);
|
|
132
|
+
return presetWithAppendedPlugins;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function createPreset(props, prevProps, createAnalyticsEvent) {
|
|
136
|
+
var _props$dangerouslyApp;
|
|
137
|
+
const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
|
|
138
|
+
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
112
139
|
}
|
|
@@ -21,9 +21,12 @@ function getSpellCheck(featureFlags) {
|
|
|
21
21
|
* which is used by both current and archv3 editors.
|
|
22
22
|
*/
|
|
23
23
|
export function createFeatureFlagsFromProps(props) {
|
|
24
|
-
var _props$featureFlags, _props$
|
|
24
|
+
var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _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$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _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, _props$featureFlags46, _props$featureFlags47;
|
|
25
25
|
const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
26
26
|
const tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
|
|
27
|
+
|
|
28
|
+
// duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
|
|
29
|
+
const pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
|
|
27
30
|
return {
|
|
28
31
|
...normalizedFeatureFlags,
|
|
29
32
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
@@ -35,37 +38,39 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
35
38
|
singleLayout: typeof props.allowLayouts === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
|
|
36
39
|
undoRedoButtons: props.allowUndoRedoButtons,
|
|
37
40
|
catchAllTracking: (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.catchAllTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled,
|
|
38
|
-
stickyHeadersOptimization: typeof ((_props$
|
|
39
|
-
initialRenderOptimization: typeof ((_props$
|
|
40
|
-
mouseMoveOptimization: typeof ((_props$
|
|
41
|
-
tableRenderOptimization: typeof ((_props$
|
|
42
|
-
tableOverflowShadowsOptimization: typeof ((_props$
|
|
41
|
+
stickyHeadersOptimization: typeof ((_props$featureFlags4 = props.featureFlags) === null || _props$featureFlags4 === void 0 ? void 0 : _props$featureFlags4.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.stickyHeadersOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
|
|
42
|
+
initialRenderOptimization: typeof ((_props$featureFlags6 = props.featureFlags) === null || _props$featureFlags6 === void 0 ? void 0 : _props$featureFlags6.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.initialRenderOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
|
|
43
|
+
mouseMoveOptimization: typeof ((_props$featureFlags8 = props.featureFlags) === null || _props$featureFlags8 === void 0 ? void 0 : _props$featureFlags8.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.mouseMoveOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
|
|
44
|
+
tableRenderOptimization: typeof ((_props$featureFlags10 = props.featureFlags) === null || _props$featureFlags10 === void 0 ? void 0 : _props$featureFlags10.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags11 = props.featureFlags) !== null && _props$featureFlags11 !== void 0 && _props$featureFlags11.tableRenderOptimization) : typeof props.allowTables === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
|
|
45
|
+
tableOverflowShadowsOptimization: typeof ((_props$featureFlags12 = props.featureFlags) === null || _props$featureFlags12 === void 0 ? void 0 : _props$featureFlags12.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags13 = props.featureFlags) !== null && _props$featureFlags13 !== void 0 && _props$featureFlags13.tableOverflowShadowsOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
|
|
43
46
|
extendFloatingToolbar: Boolean(typeof props.allowExtension === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
|
|
44
|
-
showAvatarGroupAsPlugin: Boolean(typeof ((_props$
|
|
45
|
-
errorBoundaryDocStructure: Boolean(typeof ((_props$
|
|
46
|
-
synchronyErrorDocStructure: Boolean(typeof ((_props$
|
|
47
|
-
enableViewUpdateSubscription: Boolean(typeof ((_props$
|
|
48
|
-
collabAvatarScroll: Boolean(typeof ((_props$
|
|
49
|
-
ufo: Boolean(typeof ((_props$
|
|
50
|
-
twoLineEditorToolbar: Boolean(typeof ((_props$
|
|
51
|
-
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$
|
|
52
|
-
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$
|
|
47
|
+
showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags14 = props.featureFlags) === null || _props$featureFlags14 === void 0 ? void 0 : _props$featureFlags14.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags15 = props.featureFlags) !== null && _props$featureFlags15 !== void 0 && _props$featureFlags15.showAvatarGroupAsPlugin) : false),
|
|
48
|
+
errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.useErrorBoundaryDocStructure) : false),
|
|
49
|
+
synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.synchronyErrorDocStructure) : false),
|
|
50
|
+
enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.enableViewUpdateSubscription) : false),
|
|
51
|
+
collabAvatarScroll: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.collabAvatarScroll) : false),
|
|
52
|
+
ufo: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.ufo) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.ufo) : false),
|
|
53
|
+
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.twoLineEditorToolbar) : false),
|
|
54
|
+
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.saferDispatchedTransactions) : false)),
|
|
55
|
+
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags31 = props.featureFlags) !== null && _props$featureFlags31 !== void 0 && _props$featureFlags31.saferDispatchedTransactionsAnalyticsOnly) : false)),
|
|
53
56
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
54
|
-
chromeCursorHandlerFixedVersion: typeof ((_props$
|
|
57
|
+
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags32 = props.featureFlags) === null || _props$featureFlags32 === void 0 ? void 0 : _props$featureFlags32.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
55
58
|
tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
|
|
56
|
-
showHoverPreview: Boolean(typeof ((_props$
|
|
57
|
-
indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$
|
|
58
|
-
floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$
|
|
59
|
-
floatingToolbarLinkSettingsButton: typeof ((_props$
|
|
59
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.showHoverPreview) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.showHoverPreview) : false),
|
|
60
|
+
indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.indentationButtonsInTheToolbar) : false)),
|
|
61
|
+
floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags38 = props.featureFlags) !== null && _props$featureFlags38 !== void 0 && _props$featureFlags38.floatingToolbarCopyButton) : false)),
|
|
62
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
60
63
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
|
|
61
64
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
62
65
|
// are included (they are not kebab cased)
|
|
63
|
-
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$
|
|
64
|
-
listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$
|
|
65
|
-
restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$
|
|
66
|
-
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$
|
|
66
|
+
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedLists) === true,
|
|
67
|
+
listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41.listNumberContinuity) === true,
|
|
68
|
+
restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags42 = props.featureFlags) === null || _props$featureFlags42 === void 0 ? void 0 : _props$featureFlags42.restartNumberedListsToolbar) === true,
|
|
69
|
+
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44.useSomewhatSemanticTextColorNames) : false)),
|
|
67
70
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
68
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
69
|
-
useEditorNext: normalizedFeatureFlags.useEditorNext === true || ((_props$
|
|
71
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags45 = props.featureFlags) === null || _props$featureFlags45 === void 0 ? void 0 : _props$featureFlags45['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags46 = props.featureFlags) !== null && _props$featureFlags46 !== void 0 && _props$featureFlags46['prevent-popup-overflow']) : false),
|
|
72
|
+
useEditorNext: normalizedFeatureFlags.useEditorNext === true || ((_props$featureFlags47 = props.featureFlags) === null || _props$featureFlags47 === void 0 ? void 0 : _props$featureFlags47.useEditorNext) === true,
|
|
73
|
+
// duplicated logic from `create-plugins-list.ts` due to presets not being finalised
|
|
74
|
+
useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
|
|
70
75
|
};
|
|
71
76
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const EMPTY = [];
|
|
2
|
+
export function shouldRecreatePreset(props, nextProps) {
|
|
3
|
+
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
4
|
+
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;
|
|
5
|
+
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;
|
|
6
|
+
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(p => nextPlugins.some(n => n.name === p.name && n !== p))) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return shouldReconfigureState(props, nextProps);
|
|
10
|
+
}
|
|
11
|
+
function shouldReconfigureState(props, nextProps) {
|
|
12
|
+
const mobileProperties = props.appearance === 'mobile' ? ['quickInsert', 'featureFlags'] : [];
|
|
13
|
+
const properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent', ...mobileProperties];
|
|
14
|
+
return properties.reduce((acc, curr) => acc || props[curr] !== nextProps[curr], false);
|
|
15
|
+
}
|
|
@@ -48,7 +48,7 @@ export function EditorInternalWithoutHooks({
|
|
|
48
48
|
providerFactory,
|
|
49
49
|
onEditorCreated,
|
|
50
50
|
onEditorDestroyed,
|
|
51
|
-
|
|
51
|
+
preset
|
|
52
52
|
}) {
|
|
53
53
|
var _props$performanceTra, _props$performanceTra2;
|
|
54
54
|
const Component = getUiComponent(props.appearance);
|
|
@@ -90,7 +90,7 @@ export function EditorInternalWithoutHooks({
|
|
|
90
90
|
onEditorDestroyed: onEditorDestroyed,
|
|
91
91
|
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
92
92
|
disabled: props.disabled,
|
|
93
|
-
|
|
93
|
+
preset: preset,
|
|
94
94
|
render: ({
|
|
95
95
|
editor,
|
|
96
96
|
view,
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
2
4
|
import Editor from '../editor';
|
|
3
5
|
import EditorNext from './index';
|
|
4
|
-
import
|
|
6
|
+
import useUniversalPreset from '../labs/next/presets/useUniversalPreset';
|
|
7
|
+
const EditorNextWrapper = ({
|
|
8
|
+
props
|
|
9
|
+
}) => {
|
|
10
|
+
const preset = useUniversalPreset({
|
|
11
|
+
props
|
|
12
|
+
});
|
|
13
|
+
return /*#__PURE__*/React.createElement(EditorNext, _extends({
|
|
14
|
+
preset: preset
|
|
15
|
+
}, props));
|
|
16
|
+
};
|
|
5
17
|
export default class EditorMigrationComponent extends React.Component {
|
|
6
18
|
render() {
|
|
7
19
|
const featureFlags = createFeatureFlagsFromProps(this.props);
|
|
8
|
-
|
|
20
|
+
if (!featureFlags.useEditorNext) {
|
|
21
|
+
return /*#__PURE__*/React.createElement(Editor, this.props);
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement(EditorNextWrapper, {
|
|
24
|
+
props: this.props
|
|
25
|
+
});
|
|
9
26
|
}
|
|
10
27
|
}
|
|
@@ -4,6 +4,7 @@ import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
|
4
4
|
import prepareQuickInsertProvider from '../../utils/prepare-quick-insert-provider';
|
|
5
5
|
import prepareExtensionProvider from '../../utils/prepare-extension-provider';
|
|
6
6
|
import handleProviders from '../utils/handleProviders';
|
|
7
|
+
import getProvidersFromEditorProps from '../utils/getProvidersFromEditorProps';
|
|
7
8
|
function createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
8
9
|
const extensionProvider = prepareExtensionProvider(() => editorActions)(extensionProviders);
|
|
9
10
|
const quickInsertProvider = prepareQuickInsertProvider(editorActions, extensionProvider, quickInsert, createAnalyticsEvent);
|
|
@@ -42,11 +43,11 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
42
43
|
quickInsert && quickInsert !== (prevProps === null || prevProps === void 0 ? void 0 : prevProps.quickInsert)) {
|
|
43
44
|
const newState = createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent);
|
|
44
45
|
setProviderState(newState);
|
|
45
|
-
handleProviders(providerFactory.current, props, newState.extensionProvider, newState.quickInsertProvider);
|
|
46
|
+
handleProviders(providerFactory.current, getProvidersFromEditorProps(props), newState.extensionProvider, newState.quickInsertProvider);
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
handleProviders(providerFactory.current, props, providerState.extensionProvider, providerState.quickInsertProvider);
|
|
49
|
-
}, [props, prevProps, createAnalyticsEvent, editorActions, providerState.extensionProvider, providerState.quickInsertProvider, extensionProviders, quickInsert]);
|
|
49
|
+
handleProviders(providerFactory.current, getProvidersFromEditorProps(props), providerState.extensionProvider, providerState.quickInsertProvider);
|
|
50
|
+
}, [props, prevProps === null || prevProps === void 0 ? void 0 : prevProps.quickInsert, prevProps === null || prevProps === void 0 ? void 0 : prevProps.extensionProviders, createAnalyticsEvent, editorActions, providerState.extensionProvider, providerState.quickInsertProvider, extensionProviders, quickInsert]);
|
|
50
51
|
|
|
51
52
|
// componentWillUnmount equivalent
|
|
52
53
|
useEffect(() => {
|
|
@@ -16,7 +16,7 @@ import { defaultProps, propTypes } from './utils/editorPropTypes';
|
|
|
16
16
|
import trackEditorActions from './utils/trackEditorActions';
|
|
17
17
|
import onEditorCreated from './utils/onEditorCreated';
|
|
18
18
|
import deprecationWarnings from './utils/deprecationWarnings';
|
|
19
|
-
import
|
|
19
|
+
import { basePlugin } from '../plugins';
|
|
20
20
|
export default class EditorNext extends React.Component {
|
|
21
21
|
/**
|
|
22
22
|
* WARNING: Code should be shared between Editor + EditorNext
|
|
@@ -39,7 +39,6 @@ export default class EditorNext extends React.Component {
|
|
|
39
39
|
this.onEditorCreated = this.onEditorCreated.bind(this);
|
|
40
40
|
this.onEditorDestroyed = this.onEditorDestroyed.bind(this);
|
|
41
41
|
this.getExperienceStore = this.getExperienceStore.bind(this);
|
|
42
|
-
this.getEditorPlugins = this.getEditorPlugins.bind(this);
|
|
43
42
|
trackEditorActions(this.editorActions, props.performanceTracking, value => this.handleAnalyticsEvent(value));
|
|
44
43
|
}
|
|
45
44
|
onEditorCreated(instance) {
|
|
@@ -70,7 +69,7 @@ export default class EditorNext extends React.Component {
|
|
|
70
69
|
props: this.props,
|
|
71
70
|
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
72
71
|
createAnalyticsEvent: this.createAnalyticsEvent,
|
|
73
|
-
|
|
72
|
+
preset: this.props.preset,
|
|
74
73
|
handleSave: this.handleSave,
|
|
75
74
|
editorActions: this.editorActions,
|
|
76
75
|
getExperienceStore: this.getExperienceStore,
|
|
@@ -79,12 +78,19 @@ export default class EditorNext extends React.Component {
|
|
|
79
78
|
})
|
|
80
79
|
}));
|
|
81
80
|
}
|
|
82
|
-
getEditorPlugins(props) {
|
|
83
|
-
return getEditorPlugins(props);
|
|
84
|
-
}
|
|
85
81
|
}
|
|
86
82
|
_defineProperty(EditorNext, "defaultProps", defaultProps);
|
|
87
83
|
_defineProperty(EditorNext, "contextTypes", {
|
|
88
84
|
editorActions: PropTypes.object
|
|
89
85
|
});
|
|
90
|
-
_defineProperty(EditorNext, "propTypes",
|
|
86
|
+
_defineProperty(EditorNext, "propTypes", {
|
|
87
|
+
...propTypes('minHeight only supports editor appearance chromeless and comment for EditorNext'),
|
|
88
|
+
preset: ({
|
|
89
|
+
preset
|
|
90
|
+
}) => {
|
|
91
|
+
if (!preset.has(basePlugin)) {
|
|
92
|
+
return new Error('Presets must contain the base plugin');
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default function getProvidersFromEditorProps({
|
|
2
|
+
linking,
|
|
3
|
+
smartLinks,
|
|
4
|
+
UNSAFE_cards,
|
|
5
|
+
autoformattingProvider,
|
|
6
|
+
media,
|
|
7
|
+
emojiProvider,
|
|
8
|
+
mentionProvider,
|
|
9
|
+
legacyImageUploadProvider,
|
|
10
|
+
taskDecisionProvider,
|
|
11
|
+
contextIdentifierProvider,
|
|
12
|
+
searchProvider,
|
|
13
|
+
macroProvider,
|
|
14
|
+
activityProvider,
|
|
15
|
+
collabEdit,
|
|
16
|
+
collabEditProvider,
|
|
17
|
+
presenceProvider
|
|
18
|
+
}) {
|
|
19
|
+
var _linking$smartLinks;
|
|
20
|
+
const cardProvider = (linking === null || linking === void 0 ? void 0 : (_linking$smartLinks = linking.smartLinks) === null || _linking$smartLinks === void 0 ? void 0 : _linking$smartLinks.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider;
|
|
21
|
+
return {
|
|
22
|
+
mediaProvider: media === null || media === void 0 ? void 0 : media.provider,
|
|
23
|
+
emojiProvider: emojiProvider,
|
|
24
|
+
mentionProvider: mentionProvider,
|
|
25
|
+
autoformattingProvider: autoformattingProvider,
|
|
26
|
+
cardProvider: cardProvider,
|
|
27
|
+
activityProvider: activityProvider,
|
|
28
|
+
imageUploadProvider: legacyImageUploadProvider,
|
|
29
|
+
taskDecisionProvider: taskDecisionProvider,
|
|
30
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
31
|
+
searchProvider: searchProvider,
|
|
32
|
+
presenceProvider: presenceProvider,
|
|
33
|
+
macroProvider: macroProvider,
|
|
34
|
+
collabEditProvider: collabEdit && collabEdit.provider ? collabEdit.provider : collabEditProvider
|
|
35
|
+
};
|
|
36
|
+
}
|