@atlaskit/editor-core 180.1.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 +43 -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 +30 -3
- 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/pm-plugins/decorations.js +2 -35
- 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/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 +25 -3
- 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/pm-plugins/decorations.js +0 -35
- 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/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 +29 -3
- 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/pm-plugins/decorations.js +0 -31
- 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/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/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/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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 181.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`6c543971074`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c543971074) - [ux] PTC-6520 remove team mention highlight
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [`a697f9eb7ca`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a697f9eb7ca) - [ED-16746] Introduce the shareable actions concept into the NextEditorPlugin
|
|
12
|
+
- [`a7e36157e01`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7e36157e01) - [ED-15941] Refactor Preset into EditorPresetBuilder
|
|
13
|
+
- [`406c29f8cf1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/406c29f8cf1) - ED-15802:Added stickyOffsetTop prop inside useStickyToolbar to support customise top for main toolbar when it is sticky.
|
|
14
|
+
- [`0078ddc7e2e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0078ddc7e2e) - New smartLinks prop to allow renderer and editor to determine whether smart link should show actions that can change the link resource.
|
|
15
|
+
- [`0ad977ead6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0ad977ead6d) - EDM-2674: remove last reference to plainTextPasteLinkification feature flag in cleanup process."
|
|
16
|
+
- [`4292f200ec9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4292f200ec9) - [ED-16560] Add preset prop to EditorNext
|
|
17
|
+
- [`592e3761622`](https://bitbucket.org/atlassian/atlassian-frontend/commits/592e3761622) - [ED-15941] NextEditorPlugins will receive an api with the plugins dependencies on runtime
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`b38ca291f7b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b38ca291f7b) - Fixed inlineCode issue cause by apostrophe replacements reported in DTR-987
|
|
22
|
+
- [`1a2ba1a53a9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1a2ba1a53a9) - ED-17113: Fixed assistive text in mentions not including user name due to async look up.
|
|
23
|
+
- [`deeb5ebee1f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/deeb5ebee1f) - Fix self mention highlighting
|
|
24
|
+
- [`f07824eeccc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f07824eeccc) - ED-15647 fix undo when pasting table with resized column in expand
|
|
25
|
+
- [`f81e7ba7c07`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f81e7ba7c07) - [ux] ED-16556 Fixed - Table floating toolbar "Table Options" and "Cell Options" are not accessible
|
|
26
|
+
- [`dae1c82956b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dae1c82956b) - [ux] ED-17122 - Toolbar extension icons use tooltip as aria label
|
|
27
|
+
- [`9d3fb04c725`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d3fb04c725) - [ED-16948] Fix crash in template editor when image is the first node.
|
|
28
|
+
- [`568b7d96689`](https://bitbucket.org/atlassian/atlassian-frontend/commits/568b7d96689) - [ux] [ED-16819] Prevent up/down arrow from a media selection from creating new paragraphs. Should move to gap cursor instead if it cannot move into node before.
|
|
29
|
+
- [`9dde8374c54`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9dde8374c54) - Update import of EditorCardProvider from `@atlaskit/link-provider` to `@atlaskit/editor-card-provider` for scheduled release packages.
|
|
30
|
+
- [`f7fc96b3738`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f7fc96b3738) - ED-17086 - Added feature flag for expandedChartColors
|
|
31
|
+
- [`a6b3a866e9d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a6b3a866e9d) - [ux] ED-16941: we now ignore screenshots when pasting text from Microsoft Office when using the image-upload plugin (legacyImageUploadProvider)
|
|
32
|
+
- [`a57e2849f71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a57e2849f71) - Remove unused code in editor-core that is not imported anywhere
|
|
33
|
+
- [`eb7ef06e38c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eb7ef06e38c) - Contextual toolbar focus will now be regained when exiting via ArrowLeft / ArrowRight keys, and will progress to the next toolbar item. onBlur will now also be called correctly when dropdown menu items lose focus.
|
|
34
|
+
- [`2661a586431`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2661a586431) - ED-15843 Applied fix for bodiedExtensions animation as per DTR-807
|
|
35
|
+
- [`023b96ba3da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/023b96ba3da) - emoji picker vertical alignment refinement
|
|
36
|
+
- [`db34131a1e4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/db34131a1e4) - [ED-16579] Add methods to Preset object including `setProvider`, `getProvider` and `getAllProviders`.
|
|
37
|
+
|
|
38
|
+
These are used internally to set providers (objects which can return functionality such as `emojiProvider`).
|
|
39
|
+
|
|
40
|
+
- [`8ef5e96b6c4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8ef5e96b6c4) - Fix that removes remaining layout attribute from inlineCard type during updating from embedCard type to inlineCard type when embed is not allowed.
|
|
41
|
+
- [`7f26be97caf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f26be97caf) - [ux] ED-14957: add border color for dark mode for layout
|
|
42
|
+
- [`68f4ce6955d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/68f4ce6955d) - Fix logic to reconfigure state in ReactEditorView to fix a breakage on NCS pages.
|
|
43
|
+
- [`1720ddc8076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1720ddc8076) - [ux] ED-16725 Added support for semantic tooltip names for background color palette.
|
|
44
|
+
- Updated dependencies
|
|
45
|
+
|
|
3
46
|
## 180.1.0
|
|
4
47
|
|
|
5
48
|
### Minor Changes
|
|
@@ -11,17 +11,17 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _prosemirrorModel = require("prosemirror-model");
|
|
14
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
15
|
var _prosemirrorState = require("prosemirror-state");
|
|
15
16
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
16
|
-
var _utils = require("../utils");
|
|
17
|
-
var _document = require("../utils/document");
|
|
18
|
-
var _action = require("../utils/action");
|
|
19
17
|
var _eventDispatcher = require("../event-dispatcher");
|
|
20
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
21
|
-
var _utils3 = require("../plugins/extension/utils");
|
|
22
|
-
var _getFeatureFlags = require("../plugins/feature-flags-context/get-feature-flags");
|
|
23
18
|
var _nativeCollabProviderPlugin = require("../plugins/collab-edit/native-collab-provider-plugin");
|
|
19
|
+
var _utils2 = require("../plugins/extension/utils");
|
|
20
|
+
var _getFeatureFlags = require("../plugins/feature-flags-context/get-feature-flags");
|
|
21
|
+
var _utils3 = require("../utils");
|
|
22
|
+
var _action = require("../utils/action");
|
|
24
23
|
var _deprecationWarnings = _interopRequireDefault(require("../utils/deprecation-warnings"));
|
|
24
|
+
var _document = require("../utils/document");
|
|
25
25
|
var _nodesByLocalIds = require("../utils/nodes-by-localIds");
|
|
26
26
|
var EditorActions = /*#__PURE__*/function () {
|
|
27
27
|
function EditorActions() {
|
|
@@ -31,7 +31,7 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
31
31
|
(0, _defineProperty2.default)(this, "dispatchAnalyticsEvent", function (payload) {
|
|
32
32
|
if (_this.eventDispatcher) {
|
|
33
33
|
var dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
34
|
-
dispatch(
|
|
34
|
+
dispatch(_utils.analyticsEventKey, {
|
|
35
35
|
payload: payload
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -149,7 +149,22 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
149
149
|
if (!this.editorView || this.editorView.hasFocus()) {
|
|
150
150
|
return false;
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
|
|
153
|
+
// If we focus on componentDidMount the editor can crash due to a prosemirror error.
|
|
154
|
+
// This is fixed in prosemirror-view@1.23.7
|
|
155
|
+
// See: https:github.com/ProseMirror/prosemirror-view/commit/735b88107d1cbe7575a188edb85f05c22fb56e35
|
|
156
|
+
//
|
|
157
|
+
// We don't want this error to crash the editor in the case we can't
|
|
158
|
+
// focus correctly.
|
|
159
|
+
// Revert workaround in: https://product-fabric.atlassian.net/browse/ED-17172
|
|
160
|
+
try {
|
|
161
|
+
this.editorView.focus();
|
|
162
|
+
} catch (err) {
|
|
163
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
164
|
+
// eslint-disable-next-line no-console
|
|
165
|
+
console.error('EditorView focus failed with an error', err);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
153
168
|
this.editorView.dispatch(this.editorView.state.tr.scrollIntoView());
|
|
154
169
|
return true;
|
|
155
170
|
}
|
|
@@ -223,7 +238,7 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
223
238
|
return (0, _action.getEditorValueWithMedia)(editorView);
|
|
224
239
|
case 5:
|
|
225
240
|
doc = _context3.sent;
|
|
226
|
-
json = (0,
|
|
241
|
+
json = (0, _utils3.toJSON)(doc);
|
|
227
242
|
if (this.contentEncode) {
|
|
228
243
|
_context3.next = 9;
|
|
229
244
|
break;
|
|
@@ -250,7 +265,7 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
250
265
|
var _this$editorView;
|
|
251
266
|
if ((_this$editorView = this.editorView) !== null && _this$editorView !== void 0 && _this$editorView.state) {
|
|
252
267
|
var _findNodePosWithLocal, _this$editorView2;
|
|
253
|
-
return (_findNodePosWithLocal = (0,
|
|
268
|
+
return (_findNodePosWithLocal = (0, _utils2.findNodePosWithLocalId)((_this$editorView2 = this.editorView) === null || _this$editorView2 === void 0 ? void 0 : _this$editorView2.state, id)) === null || _findNodePosWithLocal === void 0 ? void 0 : _findNodePosWithLocal.node;
|
|
254
269
|
}
|
|
255
270
|
}
|
|
256
271
|
}, {
|
|
@@ -20,7 +20,7 @@ var attachPayloadIntoTransaction = function attachPayloadIntoTransaction(_ref) {
|
|
|
20
20
|
tr.step(new _steps.AnalyticsStep([{
|
|
21
21
|
payload: payload,
|
|
22
22
|
channel: channel
|
|
23
|
-
}], actionsToIgnore,
|
|
23
|
+
}], actionsToIgnore, editorState.selection.$from.pos) // We need to create the step based on a position, this prevent split history for relative changes.
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// When you add a new step all the storedMarks are removed it
|
|
@@ -10,9 +10,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
10
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
13
|
var _ReactEditorViewInternal = require("./ReactEditorViewInternal");
|
|
15
|
-
var _getEditorPlugins = _interopRequireDefault(require("../utils/get-editor-plugins"));
|
|
16
14
|
var _reactIntlNext = require("react-intl-next");
|
|
17
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
18
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -26,8 +24,5 @@ var ReactEditorView = /*#__PURE__*/function (_BaseReactEditorView) {
|
|
|
26
24
|
return (0, _createClass2.default)(ReactEditorView);
|
|
27
25
|
}(_ReactEditorViewInternal.ReactEditorView);
|
|
28
26
|
exports.ReactEditorView = ReactEditorView;
|
|
29
|
-
(0, _defineProperty2.default)(ReactEditorView, "defaultProps", {
|
|
30
|
-
getEditorPlugins: _getEditorPlugins.default
|
|
31
|
-
});
|
|
32
27
|
var _default = (0, _reactIntlNext.injectIntl)(ReactEditorView);
|
|
33
28
|
exports.default = _default;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ReactEditorView = void 0;
|
|
8
|
-
exports.shouldReconfigureState = shouldReconfigureState;
|
|
9
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -42,8 +41,7 @@ var _trackTransactions = require("../utils/performance/track-transactions");
|
|
|
42
41
|
var _consts = require("./consts");
|
|
43
42
|
var _contextIdentifier = require("../plugins/base/pm-plugins/context-identifier");
|
|
44
43
|
var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
|
|
45
|
-
var
|
|
46
|
-
var _api2 = require("../analytics-api/api");
|
|
44
|
+
var _preset = require("@atlaskit/editor-common/preset");
|
|
47
45
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
48
46
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
47
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -56,31 +54,13 @@ function handleEditorFocus(view) {
|
|
|
56
54
|
view.focus();
|
|
57
55
|
}, 0);
|
|
58
56
|
}
|
|
59
|
-
var EMPTY = [];
|
|
60
|
-
function shouldReconfigureState(props, nextProps) {
|
|
61
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
62
|
-
var 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;
|
|
63
|
-
var 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;
|
|
64
|
-
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(function (p) {
|
|
65
|
-
return nextPlugins.some(function (n) {
|
|
66
|
-
return n.name === p.name && n !== p;
|
|
67
|
-
});
|
|
68
|
-
})) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
var mobileProperties = props.appearance === 'mobile' ? ['featureFlags', 'quickInsert'] : [];
|
|
72
|
-
var properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent'].concat(mobileProperties);
|
|
73
|
-
return properties.reduce(function (acc, curr) {
|
|
74
|
-
return acc || props[curr] !== nextProps[curr];
|
|
75
|
-
}, false);
|
|
76
|
-
}
|
|
77
57
|
var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
78
58
|
(0, _inherits2.default)(ReactEditorView, _React$Component);
|
|
79
59
|
var _super = _createSuper(ReactEditorView);
|
|
80
|
-
function ReactEditorView(
|
|
60
|
+
function ReactEditorView(props, context) {
|
|
81
61
|
var _this;
|
|
82
62
|
(0, _classCallCheck2.default)(this, ReactEditorView);
|
|
83
|
-
_this = _super.call(this,
|
|
63
|
+
_this = _super.call(this, props, context);
|
|
84
64
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorRef", /*#__PURE__*/_react.default.createRef());
|
|
85
65
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "canDispatchTransactions", true);
|
|
86
66
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onPluginObservation", function (report, editorState) {
|
|
@@ -94,6 +74,10 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
94
74
|
}
|
|
95
75
|
});
|
|
96
76
|
});
|
|
77
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getEditorState", function () {
|
|
78
|
+
var _this$view;
|
|
79
|
+
return (_this$view = _this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
|
|
80
|
+
});
|
|
97
81
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatFullWidthAppearance", function (appearance) {
|
|
98
82
|
if (appearance === 'full-width') {
|
|
99
83
|
return _analytics.FULL_WIDTH_MODE.FULL_WIDTH;
|
|
@@ -141,48 +125,6 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
141
125
|
sel.removeAllRanges();
|
|
142
126
|
}
|
|
143
127
|
});
|
|
144
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reconfigureState", function (props) {
|
|
145
|
-
if (!_this.view) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
150
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
151
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
152
|
-
_this.blur();
|
|
153
|
-
var editorPlugins = _this.getPlugins(props.editorProps, _this.props.editorProps, _this.props.createAnalyticsEvent);
|
|
154
|
-
_this.config = (0, _createEditor.processPluginsList)(editorPlugins);
|
|
155
|
-
var state = _this.editorState;
|
|
156
|
-
var plugins = (0, _createEditor.createPMPlugins)({
|
|
157
|
-
schema: state.schema,
|
|
158
|
-
dispatch: _this.dispatch,
|
|
159
|
-
errorReporter: _this.errorReporter,
|
|
160
|
-
editorConfig: _this.config,
|
|
161
|
-
eventDispatcher: _this.eventDispatcher,
|
|
162
|
-
providerFactory: props.providerFactory,
|
|
163
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
164
|
-
reactContext: function reactContext() {
|
|
165
|
-
return _this.context;
|
|
166
|
-
},
|
|
167
|
-
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
168
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
169
|
-
transactionTracker: _this.transactionTracker,
|
|
170
|
-
featureFlags: (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props.editorProps),
|
|
171
|
-
getIntl: function getIntl() {
|
|
172
|
-
return _this.props.intl;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
var newState = state.reconfigure({
|
|
176
|
-
plugins: plugins
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// need to update the state first so when the view builds the nodeviews it is
|
|
180
|
-
// using the latest plugins
|
|
181
|
-
_this.view.updateState(newState);
|
|
182
|
-
return _this.view.update(_objectSpread(_objectSpread({}, _this.view.props), {}, {
|
|
183
|
-
state: newState
|
|
184
|
-
}));
|
|
185
|
-
});
|
|
186
128
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleAnalyticsEvent", function (payload) {
|
|
187
129
|
if (!_this.props.allowAnalyticsGASV3) {
|
|
188
130
|
return;
|
|
@@ -213,7 +155,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
213
155
|
return _this.editorState;
|
|
214
156
|
}
|
|
215
157
|
} else {
|
|
216
|
-
_this.config = (0, _createEditor.processPluginsList)(_this.getPlugins(options.props.
|
|
158
|
+
_this.config = (0, _createEditor.processPluginsList)(_this.getPlugins(options.props.preset));
|
|
217
159
|
schema = (0, _createSchema.createSchema)(_this.config);
|
|
218
160
|
}
|
|
219
161
|
var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
|
|
@@ -328,6 +270,10 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
328
270
|
var _this$experienceStore3;
|
|
329
271
|
(_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(_ufo.EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
330
272
|
});
|
|
273
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
274
|
+
newEditorState: editorState,
|
|
275
|
+
oldEditorState: oldEditorState
|
|
276
|
+
});
|
|
331
277
|
startMeasure(_trackTransactions.EVENT_NAME_VIEW_STATE_UPDATED);
|
|
332
278
|
_this.onEditorViewStateUpdated({
|
|
333
279
|
originalTransaction: transaction,
|
|
@@ -455,6 +401,10 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
455
401
|
_this.view = new _prosemirrorView.EditorView({
|
|
456
402
|
mount: node
|
|
457
403
|
}, _this.getDirectEditorProps());
|
|
404
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
405
|
+
newEditorState: _this.view.state,
|
|
406
|
+
oldEditorState: undefined
|
|
407
|
+
});
|
|
458
408
|
});
|
|
459
409
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEditorViewRef", function (node) {
|
|
460
410
|
if (!_this.view && node) {
|
|
@@ -537,9 +487,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
537
487
|
"aria-label": _this.props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel),
|
|
538
488
|
role: "textbox"
|
|
539
489
|
}));
|
|
490
|
+
_this.pluginInjectionAPI = new _preset.EditorPluginInjectionAPI({
|
|
491
|
+
getEditorState: _this.getEditorState
|
|
492
|
+
});
|
|
540
493
|
_this.eventDispatcher = new _eventDispatcher.EventDispatcher();
|
|
541
494
|
_this.dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
542
|
-
_this.errorReporter = (0, _createEditor.createErrorReporter)(
|
|
495
|
+
_this.errorReporter = (0, _createEditor.createErrorReporter)(props.editorProps.errorReporterHandler);
|
|
543
496
|
_this.transactionTracker = new _trackTransactions.TransactionTracker();
|
|
544
497
|
_this.pluginPerformanceObserver = new _pluginPerformanceObserver.PluginPerformanceObserver(function (report) {
|
|
545
498
|
return _this.onPluginObservation(report, _this.editorState);
|
|
@@ -567,11 +520,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
567
520
|
_this.eventDispatcher.on(_utils.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
568
521
|
_this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
|
|
569
522
|
_this.editorState = _this.createEditorState({
|
|
570
|
-
props:
|
|
523
|
+
props: props,
|
|
571
524
|
context: context,
|
|
572
|
-
doc:
|
|
525
|
+
doc: props.editorProps.defaultValue,
|
|
573
526
|
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
574
|
-
selectionAtStart: (0, _isFullPage.isFullPage)(
|
|
527
|
+
selectionAtStart: (0, _isFullPage.isFullPage)(props.editorProps.appearance)
|
|
575
528
|
});
|
|
576
529
|
_this.dispatchAnalyticsEvent({
|
|
577
530
|
action: _analytics.ACTION.STARTED,
|
|
@@ -631,7 +584,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
631
584
|
}
|
|
632
585
|
var appearance = this.props.editorProps.appearance;
|
|
633
586
|
var nextAppearance = nextProps.editorProps.appearance;
|
|
634
|
-
if (
|
|
587
|
+
if (this.props.preset !== nextProps.preset) {
|
|
635
588
|
this.reconfigureState(nextProps);
|
|
636
589
|
}
|
|
637
590
|
if (nextAppearance !== appearance) {
|
|
@@ -651,6 +604,51 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
651
604
|
this.pluginPerformanceObserver.disconnect();
|
|
652
605
|
}
|
|
653
606
|
}
|
|
607
|
+
}, {
|
|
608
|
+
key: "reconfigureState",
|
|
609
|
+
value: function reconfigureState(props) {
|
|
610
|
+
var _this2 = this;
|
|
611
|
+
if (!this.view) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
616
|
+
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
617
|
+
// nodes that haven't been re-rendered to the document yet.
|
|
618
|
+
this.blur();
|
|
619
|
+
var editorPlugins = this.getPlugins(props.preset);
|
|
620
|
+
this.config = (0, _createEditor.processPluginsList)(editorPlugins);
|
|
621
|
+
var state = this.editorState;
|
|
622
|
+
var plugins = (0, _createEditor.createPMPlugins)({
|
|
623
|
+
schema: state.schema,
|
|
624
|
+
dispatch: this.dispatch,
|
|
625
|
+
errorReporter: this.errorReporter,
|
|
626
|
+
editorConfig: this.config,
|
|
627
|
+
eventDispatcher: this.eventDispatcher,
|
|
628
|
+
providerFactory: props.providerFactory,
|
|
629
|
+
portalProviderAPI: props.portalProviderAPI,
|
|
630
|
+
reactContext: function reactContext() {
|
|
631
|
+
return _this2.context;
|
|
632
|
+
},
|
|
633
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
634
|
+
performanceTracking: props.editorProps.performanceTracking,
|
|
635
|
+
transactionTracker: this.transactionTracker,
|
|
636
|
+
featureFlags: (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props.editorProps),
|
|
637
|
+
getIntl: function getIntl() {
|
|
638
|
+
return _this2.props.intl;
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
var newState = state.reconfigure({
|
|
642
|
+
plugins: plugins
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
// need to update the state first so when the view builds the nodeviews it is
|
|
646
|
+
// using the latest plugins
|
|
647
|
+
this.view.updateState(newState);
|
|
648
|
+
return this.view.update(_objectSpread(_objectSpread({}, this.view.props), {}, {
|
|
649
|
+
state: newState
|
|
650
|
+
}));
|
|
651
|
+
}
|
|
654
652
|
}, {
|
|
655
653
|
key: "componentDidMount",
|
|
656
654
|
value: function componentDidMount() {
|
|
@@ -699,39 +697,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
699
697
|
key: "getPlugins",
|
|
700
698
|
value:
|
|
701
699
|
// Helper to allow tests to inject plugins directly
|
|
702
|
-
function getPlugins(
|
|
703
|
-
var
|
|
704
|
-
|
|
705
|
-
_this$props$getEditor2,
|
|
706
|
-
_this$props;
|
|
707
|
-
var insertNodeAPI = (0, _api.createInsertNodeAPI)({
|
|
708
|
-
getEditorView: function getEditorView() {
|
|
709
|
-
return _this2.view;
|
|
710
|
-
},
|
|
711
|
-
getEditorPlugins: function getEditorPlugins() {
|
|
712
|
-
return _this2.editorPlugins;
|
|
713
|
-
}
|
|
700
|
+
function getPlugins(preset) {
|
|
701
|
+
var plugins = preset.build({
|
|
702
|
+
pluginInjectionAPI: this.pluginInjectionAPI
|
|
714
703
|
});
|
|
715
|
-
|
|
716
|
-
getEditorView: function getEditorView() {
|
|
717
|
-
return _this2.view;
|
|
718
|
-
},
|
|
719
|
-
getCreateUIAnalyticsEvent: function getCreateUIAnalyticsEvent() {
|
|
720
|
-
return createAnalyticsEvent;
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
var getPluginsProps = {
|
|
724
|
-
props: editorProps,
|
|
725
|
-
prevAppearance: prevEditorProps === null || prevEditorProps === void 0 ? void 0 : prevEditorProps.appearance,
|
|
726
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
727
|
-
insertNodeAPI: insertNodeAPI,
|
|
728
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
729
|
-
};
|
|
730
|
-
if (this.props.getEditorPlugins === undefined) {
|
|
731
|
-
// eslint-disable-next-line no-console
|
|
732
|
-
console.error('getEditorPlugins is undefined in ReactEditorViewInternal - no editor plugins will be added.');
|
|
733
|
-
}
|
|
734
|
-
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 : [];
|
|
704
|
+
this.editorPlugins = plugins;
|
|
735
705
|
return this.editorPlugins;
|
|
736
706
|
}
|
|
737
707
|
}, {
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.createPreset = createPreset;
|
|
7
8
|
exports.default = createPluginsList;
|
|
8
9
|
exports.getDefaultPresetOptionsFromEditorProps = getDefaultPresetOptionsFromEditorProps;
|
|
9
10
|
exports.getScrollGutterOptions = getScrollGutterOptions;
|
|
@@ -111,13 +112,39 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
|
111
112
|
* Note: The order that presets are added determines
|
|
112
113
|
* their placement in the editor toolbar
|
|
113
114
|
*/
|
|
114
|
-
function createPluginsList(props, prevProps, createAnalyticsEvent
|
|
115
|
-
var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent
|
|
115
|
+
function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
116
|
+
var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
|
|
116
117
|
var excludes = new Set();
|
|
117
118
|
if (!isCodeBlockAllowed({
|
|
118
119
|
allowBlockType: props.allowBlockType
|
|
119
120
|
})) {
|
|
120
121
|
excludes.add('codeBlock');
|
|
121
122
|
}
|
|
122
|
-
return preset.
|
|
123
|
+
return preset.build({
|
|
124
|
+
excludePlugins: excludes
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function withDangerouslyAppendPlugins(preset) {
|
|
128
|
+
function createEditorNextPluginsFromDangerouslyAppended(plugins) {
|
|
129
|
+
return plugins ? plugins.map(function (plugin) {
|
|
130
|
+
return function () {
|
|
131
|
+
return plugin;
|
|
132
|
+
};
|
|
133
|
+
}) : [];
|
|
134
|
+
}
|
|
135
|
+
return function (editorPluginsToAppend) {
|
|
136
|
+
if (!editorPluginsToAppend || editorPluginsToAppend.length === 0) {
|
|
137
|
+
return preset;
|
|
138
|
+
}
|
|
139
|
+
var nextEditorPluginsToAppend = createEditorNextPluginsFromDangerouslyAppended(editorPluginsToAppend);
|
|
140
|
+
var presetWithAppendedPlugins = nextEditorPluginsToAppend.reduce(function (acc, plugin) {
|
|
141
|
+
return acc.add(plugin);
|
|
142
|
+
}, preset);
|
|
143
|
+
return presetWithAppendedPlugins;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function createPreset(props, prevProps, createAnalyticsEvent) {
|
|
147
|
+
var _props$dangerouslyApp;
|
|
148
|
+
var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent);
|
|
149
|
+
return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
|
|
123
150
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shouldRecreatePreset = shouldRecreatePreset;
|
|
7
|
+
var EMPTY = [];
|
|
8
|
+
function shouldRecreatePreset(props, nextProps) {
|
|
9
|
+
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
10
|
+
var 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;
|
|
11
|
+
var 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;
|
|
12
|
+
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(function (p) {
|
|
13
|
+
return nextPlugins.some(function (n) {
|
|
14
|
+
return n.name === p.name && n !== p;
|
|
15
|
+
});
|
|
16
|
+
})) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return shouldReconfigureState(props, nextProps);
|
|
20
|
+
}
|
|
21
|
+
function shouldReconfigureState(props, nextProps) {
|
|
22
|
+
var mobileProperties = props.appearance === 'mobile' ? ['quickInsert', 'featureFlags'] : [];
|
|
23
|
+
var properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent'].concat(mobileProperties);
|
|
24
|
+
return properties.reduce(function (acc, curr) {
|
|
25
|
+
return acc || props[curr] !== nextProps[curr];
|
|
26
|
+
}, false);
|
|
27
|
+
}
|
|
@@ -55,7 +55,7 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
55
55
|
providerFactory = _ref.providerFactory,
|
|
56
56
|
onEditorCreated = _ref.onEditorCreated,
|
|
57
57
|
onEditorDestroyed = _ref.onEditorDestroyed,
|
|
58
|
-
|
|
58
|
+
preset = _ref.preset;
|
|
59
59
|
var Component = (0, _createEditor.getUiComponent)(props.appearance);
|
|
60
60
|
var overriddenEditorProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
61
61
|
onSave: props.onSave ? handleSave : undefined,
|
|
@@ -95,7 +95,7 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
95
95
|
onEditorDestroyed: onEditorDestroyed,
|
|
96
96
|
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
97
97
|
disabled: props.disabled,
|
|
98
|
-
|
|
98
|
+
preset: preset,
|
|
99
99
|
render: function render(_ref2) {
|
|
100
100
|
var _props$featureFlags, _props$featureFlags2;
|
|
101
101
|
var editor = _ref2.editor,
|
|
@@ -10,12 +10,23 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
|
|
14
16
|
var _editor = _interopRequireDefault(require("../editor"));
|
|
15
17
|
var _index = _interopRequireDefault(require("./index"));
|
|
16
|
-
var
|
|
18
|
+
var _useUniversalPreset = _interopRequireDefault(require("../labs/next/presets/useUniversalPreset"));
|
|
17
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
18
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
22
|
+
var props = _ref.props;
|
|
23
|
+
var preset = (0, _useUniversalPreset.default)({
|
|
24
|
+
props: props
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({
|
|
27
|
+
preset: preset
|
|
28
|
+
}, props));
|
|
29
|
+
};
|
|
19
30
|
var EditorMigrationComponent = /*#__PURE__*/function (_React$Component) {
|
|
20
31
|
(0, _inherits2.default)(EditorMigrationComponent, _React$Component);
|
|
21
32
|
var _super = _createSuper(EditorMigrationComponent);
|
|
@@ -27,7 +38,12 @@ var EditorMigrationComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
27
38
|
key: "render",
|
|
28
39
|
value: function render() {
|
|
29
40
|
var featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(this.props);
|
|
30
|
-
|
|
41
|
+
if (!featureFlags.useEditorNext) {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_editor.default, this.props);
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(EditorNextWrapper, {
|
|
45
|
+
props: this.props
|
|
46
|
+
});
|
|
31
47
|
}
|
|
32
48
|
}]);
|
|
33
49
|
return EditorMigrationComponent;
|
|
@@ -12,6 +12,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _prepareQuickInsertProvider = _interopRequireDefault(require("../../utils/prepare-quick-insert-provider"));
|
|
13
13
|
var _prepareExtensionProvider = _interopRequireDefault(require("../../utils/prepare-extension-provider"));
|
|
14
14
|
var _handleProviders = _interopRequireDefault(require("../utils/handleProviders"));
|
|
15
|
+
var _getProvidersFromEditorProps = _interopRequireDefault(require("../utils/getProvidersFromEditorProps"));
|
|
15
16
|
function createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent) {
|
|
16
17
|
var extensionProvider = (0, _prepareExtensionProvider.default)(function () {
|
|
17
18
|
return editorActions;
|
|
@@ -53,11 +54,11 @@ function useProviderFactory(props, editorActions, createAnalyticsEvent) {
|
|
|
53
54
|
quickInsert && quickInsert !== (prevProps === null || prevProps === void 0 ? void 0 : prevProps.quickInsert)) {
|
|
54
55
|
var newState = createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent);
|
|
55
56
|
setProviderState(newState);
|
|
56
|
-
(0, _handleProviders.default)(providerFactory.current, props, newState.extensionProvider, newState.quickInsertProvider);
|
|
57
|
+
(0, _handleProviders.default)(providerFactory.current, (0, _getProvidersFromEditorProps.default)(props), newState.extensionProvider, newState.quickInsertProvider);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
(0, _handleProviders.default)(providerFactory.current, props, providerState.extensionProvider, providerState.quickInsertProvider);
|
|
60
|
-
}, [props, prevProps, createAnalyticsEvent, editorActions, providerState.extensionProvider, providerState.quickInsertProvider, extensionProviders, quickInsert]);
|
|
60
|
+
(0, _handleProviders.default)(providerFactory.current, (0, _getProvidersFromEditorProps.default)(props), providerState.extensionProvider, providerState.quickInsertProvider);
|
|
61
|
+
}, [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]);
|
|
61
62
|
|
|
62
63
|
// componentWillUnmount equivalent
|
|
63
64
|
(0, _react.useEffect)(function () {
|