@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
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { toggleMark } from 'prosemirror-commands';
|
|
2
|
-
import { Fragment, Slice } from 'prosemirror-model';
|
|
3
2
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
4
|
-
import { findWrapping, liftTarget } from 'prosemirror-transform';
|
|
5
3
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
6
4
|
import { FakeTextCursorSelection } from '../plugins/fake-text-cursor/cursor';
|
|
7
5
|
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
8
6
|
import { isNodeEmpty } from './document';
|
|
9
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
|
+
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
10
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
11
10
|
export { isEmptyParagraph, hasVisibleContent, isNodeEmpty, isEmptyDocument, processRawValue, getStepRange, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export { normaliseNestedLayout, setNodeSelection, setAllSelection, setGapCursorSelection, setCellSelection, setTextSelection, isValidPosition } from './selection';
|
|
16
|
-
export { containsClassName } from './dom';
|
|
11
|
+
export { sanitiseMarksInSelection } from './mark';
|
|
12
|
+
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
|
+
export { normaliseNestedLayout, setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
|
17
14
|
export { default as measurements } from './performance/measure-enum';
|
|
18
|
-
function validateNode(_node) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
15
|
function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
22
16
|
return !mark.type.excludes(markType) && !markType.excludes(mark.type);
|
|
23
17
|
}
|
|
@@ -26,24 +20,13 @@ function isMarkTypeAllowedInNode(markType, state) {
|
|
|
26
20
|
}
|
|
27
21
|
export function canMoveUp(state) {
|
|
28
22
|
const {
|
|
29
|
-
selection
|
|
30
|
-
doc
|
|
23
|
+
selection
|
|
31
24
|
} = state;
|
|
32
|
-
|
|
33
25
|
/**
|
|
34
|
-
* If there's a media element on the selection
|
|
35
|
-
* add text blocks with arrow navigation.
|
|
36
|
-
* Also, the selection could be media | mediaGroup.
|
|
26
|
+
* If there's a media element on the selection it will use a gap cursor to move
|
|
37
27
|
*/
|
|
38
|
-
if (selection instanceof NodeSelection) {
|
|
39
|
-
|
|
40
|
-
/** Weird way of checking if the previous element is a paragraph */
|
|
41
|
-
const mediaAncestorNode = doc.nodeAt(selection.anchor - 3);
|
|
42
|
-
return !!(mediaAncestorNode && mediaAncestorNode.type.name === 'paragraph');
|
|
43
|
-
} else if (selection.node.type.name === 'mediaGroup') {
|
|
44
|
-
const mediaGroupAncestorNode = selection.$anchor.nodeBefore;
|
|
45
|
-
return !!(mediaGroupAncestorNode && mediaGroupAncestorNode.type.name === 'paragraph');
|
|
46
|
-
}
|
|
28
|
+
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
29
|
+
return true;
|
|
47
30
|
}
|
|
48
31
|
if (selection instanceof TextSelection) {
|
|
49
32
|
if (!selection.empty) {
|
|
@@ -54,22 +37,14 @@ export function canMoveUp(state) {
|
|
|
54
37
|
}
|
|
55
38
|
export function canMoveDown(state) {
|
|
56
39
|
const {
|
|
57
|
-
selection
|
|
58
|
-
doc
|
|
40
|
+
selection
|
|
59
41
|
} = state;
|
|
60
42
|
|
|
61
43
|
/**
|
|
62
|
-
* If there's a media element on the selection
|
|
63
|
-
* add text blocks with arrow navigation.
|
|
64
|
-
* Also, the selection could be media | mediaGroup.
|
|
44
|
+
* If there's a media element on the selection it will use a gap cursor to move
|
|
65
45
|
*/
|
|
66
|
-
if (selection instanceof NodeSelection) {
|
|
67
|
-
|
|
68
|
-
const nodeAfter = doc.nodeAt(selection.$head.after());
|
|
69
|
-
return !!(nodeAfter && nodeAfter.type.name === 'paragraph');
|
|
70
|
-
} else if (selection.node.type.name === 'mediaGroup') {
|
|
71
|
-
return !(selection.$head.parentOffset === selection.$anchor.parent.content.size);
|
|
72
|
-
}
|
|
46
|
+
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
47
|
+
return true;
|
|
73
48
|
}
|
|
74
49
|
if (selection instanceof TextSelection) {
|
|
75
50
|
if (!selection.empty) {
|
|
@@ -130,17 +105,6 @@ export function isMarkTypeAllowedInCurrentSelection(markType, state) {
|
|
|
130
105
|
return allowedInActiveMarks;
|
|
131
106
|
});
|
|
132
107
|
}
|
|
133
|
-
export function createSliceWithContent(content, state) {
|
|
134
|
-
return new Slice(Fragment.from(state.schema.text(content)), 0, 0);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Determines if content inside a selection can be joined with the next block.
|
|
139
|
-
* We need this check since the built-in method for "joinDown" will join a orderedList with bulletList.
|
|
140
|
-
*/
|
|
141
|
-
export function canJoinDown(selection, doc, nodeType) {
|
|
142
|
-
return checkNodeDown(selection, doc, node => node.type === nodeType);
|
|
143
|
-
}
|
|
144
108
|
export function checkNodeDown(selection, doc, filter) {
|
|
145
109
|
const ancestorDepth = findAncestorPosition(doc, selection.$to).depth;
|
|
146
110
|
|
|
@@ -152,64 +116,10 @@ export function checkNodeDown(selection, doc, filter) {
|
|
|
152
116
|
return res.nodeAfter ? filter(res.nodeAfter) : false;
|
|
153
117
|
}
|
|
154
118
|
|
|
155
|
-
/**
|
|
156
|
-
* Determines if content inside a selection can be joined with the previous block.
|
|
157
|
-
* We need this check since the built-in method for "joinUp" will join a orderedList with bulletList.
|
|
158
|
-
*/
|
|
159
|
-
export function canJoinUp(selection, doc, nodeType) {
|
|
160
|
-
const res = doc.resolve(selection.$from.before(findAncestorPosition(doc, selection.$from).depth));
|
|
161
|
-
return res.nodeBefore && res.nodeBefore.type === nodeType;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Finds all "selection-groups" within a range. A selection group is based on ancestors.
|
|
166
|
-
*
|
|
167
|
-
* Example:
|
|
168
|
-
* Given the following document and selection ({<} = start of selection and {>} = end)
|
|
169
|
-
* doc
|
|
170
|
-
* blockquote
|
|
171
|
-
* ul
|
|
172
|
-
* li
|
|
173
|
-
* li{<}
|
|
174
|
-
* li
|
|
175
|
-
* p
|
|
176
|
-
* p{>}
|
|
177
|
-
*
|
|
178
|
-
* The output will be two selection-groups. One within the ul and one with the two paragraphs.
|
|
179
|
-
*/
|
|
180
|
-
export function getGroupsInRange(doc, $from, $to, isNodeValid = validateNode) {
|
|
181
|
-
const groups = Array();
|
|
182
|
-
const commonAncestor = hasCommonAncestor(doc, $from, $to);
|
|
183
|
-
const fromAncestor = findAncestorPosition(doc, $from);
|
|
184
|
-
if (commonAncestor || fromAncestor.depth === 1 && isNodeValid($from.node(1))) {
|
|
185
|
-
groups.push({
|
|
186
|
-
$from,
|
|
187
|
-
$to
|
|
188
|
-
});
|
|
189
|
-
} else {
|
|
190
|
-
let current = $from;
|
|
191
|
-
while (current.pos < $to.pos) {
|
|
192
|
-
let ancestorPos = findAncestorPosition(doc, current);
|
|
193
|
-
while (ancestorPos.depth > 1) {
|
|
194
|
-
ancestorPos = findAncestorPosition(doc, ancestorPos);
|
|
195
|
-
}
|
|
196
|
-
const endPos = doc.resolve(Math.min(
|
|
197
|
-
// should not be smaller then start position in case of an empty paragraph for example.
|
|
198
|
-
Math.max(ancestorPos.start(ancestorPos.depth), ancestorPos.end(ancestorPos.depth) - 3), $to.pos));
|
|
199
|
-
groups.push({
|
|
200
|
-
$from: current,
|
|
201
|
-
$to: endPos
|
|
202
|
-
});
|
|
203
|
-
current = doc.resolve(Math.min(endPos.after(1) + 1, doc.nodeSize - 2));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return groups;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
119
|
/**
|
|
210
120
|
* Traverse the document until an "ancestor" is found. Any nestable block can be an ancestor.
|
|
211
121
|
*/
|
|
212
|
-
|
|
122
|
+
function findAncestorPosition(doc, pos) {
|
|
213
123
|
const nestableBlocks = ['blockquote', 'bulletList', 'orderedList'];
|
|
214
124
|
if (pos.depth === 1) {
|
|
215
125
|
return pos;
|
|
@@ -225,102 +135,6 @@ export function findAncestorPosition(doc, pos) {
|
|
|
225
135
|
}
|
|
226
136
|
return newPos;
|
|
227
137
|
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Determine if two positions have a common ancestor.
|
|
231
|
-
*/
|
|
232
|
-
export function hasCommonAncestor(doc, $from, $to) {
|
|
233
|
-
let current;
|
|
234
|
-
let target;
|
|
235
|
-
if ($from.depth > $to.depth) {
|
|
236
|
-
current = findAncestorPosition(doc, $from);
|
|
237
|
-
target = findAncestorPosition(doc, $to);
|
|
238
|
-
} else {
|
|
239
|
-
current = findAncestorPosition(doc, $to);
|
|
240
|
-
target = findAncestorPosition(doc, $from);
|
|
241
|
-
}
|
|
242
|
-
while (current.depth > target.depth && current.depth > 1) {
|
|
243
|
-
current = findAncestorPosition(doc, current);
|
|
244
|
-
}
|
|
245
|
-
return current.node(current.depth) === target.node(target.depth);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Takes a selection $from and $to and lift all text nodes from their parents to document-level
|
|
250
|
-
*/
|
|
251
|
-
export function liftSelection(tr, doc, $from, $to) {
|
|
252
|
-
let startPos = $from.start($from.depth);
|
|
253
|
-
let endPos = $to.end($to.depth);
|
|
254
|
-
const target = Math.max(0, findAncestorPosition(doc, $from).depth - 1);
|
|
255
|
-
tr.doc.nodesBetween(startPos, endPos, (node, pos) => {
|
|
256
|
-
if (node.isText ||
|
|
257
|
-
// Text node
|
|
258
|
-
node.isTextblock && !node.textContent // Empty paragraph
|
|
259
|
-
) {
|
|
260
|
-
const res = tr.doc.resolve(tr.mapping.map(pos));
|
|
261
|
-
const sel = new NodeSelection(res);
|
|
262
|
-
const range = sel.$from.blockRange(sel.$to);
|
|
263
|
-
if (liftTarget(range) !== undefined) {
|
|
264
|
-
tr.lift(range, target);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
startPos = tr.mapping.map(startPos);
|
|
269
|
-
endPos = tr.mapping.map(endPos);
|
|
270
|
-
endPos = tr.doc.resolve(endPos).end(tr.doc.resolve(endPos).depth); // We want to select the entire node
|
|
271
|
-
|
|
272
|
-
tr.setSelection(new TextSelection(tr.doc.resolve(startPos), tr.doc.resolve(endPos)));
|
|
273
|
-
return {
|
|
274
|
-
tr: tr,
|
|
275
|
-
$from: tr.doc.resolve(startPos),
|
|
276
|
-
$to: tr.doc.resolve(endPos)
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Lift nodes in block to one level above.
|
|
282
|
-
*/
|
|
283
|
-
export function liftSiblingNodes(view) {
|
|
284
|
-
const {
|
|
285
|
-
tr
|
|
286
|
-
} = view.state;
|
|
287
|
-
const {
|
|
288
|
-
$from,
|
|
289
|
-
$to
|
|
290
|
-
} = view.state.selection;
|
|
291
|
-
const blockStart = tr.doc.resolve($from.start($from.depth - 1));
|
|
292
|
-
const blockEnd = tr.doc.resolve($to.end($to.depth - 1));
|
|
293
|
-
const range = blockStart.blockRange(blockEnd);
|
|
294
|
-
view.dispatch(tr.lift(range, blockStart.depth - 1));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Lift sibling nodes to document-level and select them.
|
|
299
|
-
*/
|
|
300
|
-
export function liftAndSelectSiblingNodes(view) {
|
|
301
|
-
const {
|
|
302
|
-
tr
|
|
303
|
-
} = view.state;
|
|
304
|
-
const {
|
|
305
|
-
$from,
|
|
306
|
-
$to
|
|
307
|
-
} = view.state.selection;
|
|
308
|
-
const blockStart = tr.doc.resolve($from.start($from.depth - 1));
|
|
309
|
-
const blockEnd = tr.doc.resolve($to.end($to.depth - 1));
|
|
310
|
-
// TODO: [ts30] handle void and null properly
|
|
311
|
-
const range = blockStart.blockRange(blockEnd);
|
|
312
|
-
tr.setSelection(new TextSelection(blockStart, blockEnd));
|
|
313
|
-
tr.lift(range, blockStart.depth - 1);
|
|
314
|
-
return tr;
|
|
315
|
-
}
|
|
316
|
-
export function wrapIn(nodeType, tr, $from, $to) {
|
|
317
|
-
const range = $from.blockRange($to);
|
|
318
|
-
const wrapping = range && findWrapping(range, nodeType);
|
|
319
|
-
if (wrapping) {
|
|
320
|
-
tr = tr.wrap(range, wrapping).scrollIntoView();
|
|
321
|
-
}
|
|
322
|
-
return tr;
|
|
323
|
-
}
|
|
324
138
|
const transformer = new JSONTransformer();
|
|
325
139
|
export function toJSON(node) {
|
|
326
140
|
return transformer.encode(node);
|
|
@@ -22,20 +22,6 @@ export const ruleWithAnalytics = getPayload => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
export const ruleWithTransform = transform => {
|
|
26
|
-
return originalRule => {
|
|
27
|
-
const onHandlerApply = (state, tr, matchResult) => {
|
|
28
|
-
transform(state, tr);
|
|
29
|
-
if (originalRule.onHandlerApply) {
|
|
30
|
-
originalRule.onHandlerApply(state, tr, matchResult);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
...originalRule,
|
|
35
|
-
onHandlerApply
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
25
|
export const createRule = (match, handler) => {
|
|
40
26
|
return {
|
|
41
27
|
match,
|
package/dist/es2019/version.json
CHANGED
|
@@ -4,18 +4,17 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import { Node } from 'prosemirror-model';
|
|
7
|
-
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
8
|
-
import { findParentNode } from 'prosemirror-utils';
|
|
9
|
-
import { toJSON } from '../utils';
|
|
10
|
-
import { processRawValue, isEmptyDocument, processRawFragmentValue } from '../utils/document';
|
|
11
|
-
import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
|
|
12
|
-
import { createDispatch } from '../event-dispatcher';
|
|
13
|
-
import { safeInsert } from 'prosemirror-utils';
|
|
14
7
|
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
9
|
+
import { findParentNode, safeInsert } from 'prosemirror-utils';
|
|
10
|
+
import { createDispatch } from '../event-dispatcher';
|
|
11
|
+
import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
|
|
15
12
|
import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
16
13
|
import { getFeatureFlags } from '../plugins/feature-flags-context/get-feature-flags';
|
|
17
|
-
import {
|
|
14
|
+
import { toJSON } from '../utils';
|
|
15
|
+
import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
|
|
18
16
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
17
|
+
import { isEmptyDocument, processRawFragmentValue, processRawValue } from '../utils/document';
|
|
19
18
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
20
19
|
var EditorActions = /*#__PURE__*/function () {
|
|
21
20
|
function EditorActions() {
|
|
@@ -143,7 +142,22 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
143
142
|
if (!this.editorView || this.editorView.hasFocus()) {
|
|
144
143
|
return false;
|
|
145
144
|
}
|
|
146
|
-
|
|
145
|
+
|
|
146
|
+
// If we focus on componentDidMount the editor can crash due to a prosemirror error.
|
|
147
|
+
// This is fixed in prosemirror-view@1.23.7
|
|
148
|
+
// See: https:github.com/ProseMirror/prosemirror-view/commit/735b88107d1cbe7575a188edb85f05c22fb56e35
|
|
149
|
+
//
|
|
150
|
+
// We don't want this error to crash the editor in the case we can't
|
|
151
|
+
// focus correctly.
|
|
152
|
+
// Revert workaround in: https://product-fabric.atlassian.net/browse/ED-17172
|
|
153
|
+
try {
|
|
154
|
+
this.editorView.focus();
|
|
155
|
+
} catch (err) {
|
|
156
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
157
|
+
// eslint-disable-next-line no-console
|
|
158
|
+
console.error('EditorView focus failed with an error', err);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
147
161
|
this.editorView.dispatch(this.editorView.state.tr.scrollIntoView());
|
|
148
162
|
return true;
|
|
149
163
|
}
|
|
@@ -14,7 +14,7 @@ export var attachPayloadIntoTransaction = function attachPayloadIntoTransaction(
|
|
|
14
14
|
tr.step(new AnalyticsStep([{
|
|
15
15
|
payload: payload,
|
|
16
16
|
channel: channel
|
|
17
|
-
}], actionsToIgnore,
|
|
17
|
+
}], actionsToIgnore, editorState.selection.$from.pos) // We need to create the step based on a position, this prevent split history for relative changes.
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
// When you add a new step all the storedMarks are removed it
|
|
@@ -3,11 +3,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
9
8
|
import { ReactEditorView as BaseReactEditorView } from './ReactEditorViewInternal';
|
|
10
|
-
import getEditorPlugins from '../utils/get-editor-plugins';
|
|
11
9
|
import { injectIntl } from 'react-intl-next';
|
|
12
10
|
export var ReactEditorView = /*#__PURE__*/function (_BaseReactEditorView) {
|
|
13
11
|
_inherits(ReactEditorView, _BaseReactEditorView);
|
|
@@ -18,7 +16,4 @@ export var ReactEditorView = /*#__PURE__*/function (_BaseReactEditorView) {
|
|
|
18
16
|
}
|
|
19
17
|
return _createClass(ReactEditorView);
|
|
20
18
|
}(BaseReactEditorView);
|
|
21
|
-
_defineProperty(ReactEditorView, "defaultProps", {
|
|
22
|
-
getEditorPlugins: getEditorPlugins
|
|
23
|
-
});
|
|
24
19
|
export default injectIntl(ReactEditorView);
|
|
@@ -40,8 +40,7 @@ import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPD
|
|
|
40
40
|
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
41
41
|
import { getContextIdentifier } from '../plugins/base/pm-plugins/context-identifier';
|
|
42
42
|
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
43
|
-
import {
|
|
44
|
-
import { createEditorAnalyticsAPI } from '../analytics-api/api';
|
|
43
|
+
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
45
44
|
function handleEditorFocus(view) {
|
|
46
45
|
if (view.hasFocus()) {
|
|
47
46
|
return;
|
|
@@ -50,31 +49,13 @@ function handleEditorFocus(view) {
|
|
|
50
49
|
view.focus();
|
|
51
50
|
}, 0);
|
|
52
51
|
}
|
|
53
|
-
var EMPTY = [];
|
|
54
|
-
export function shouldReconfigureState(props, nextProps) {
|
|
55
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2, _nextProps$dangerousl, _nextProps$dangerousl2;
|
|
56
|
-
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;
|
|
57
|
-
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;
|
|
58
|
-
if (nextPlugins.length !== prevPlugins.length || prevPlugins.some(function (p) {
|
|
59
|
-
return nextPlugins.some(function (n) {
|
|
60
|
-
return n.name === p.name && n !== p;
|
|
61
|
-
});
|
|
62
|
-
})) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
var mobileProperties = props.appearance === 'mobile' ? ['featureFlags', 'quickInsert'] : [];
|
|
66
|
-
var properties = ['appearance', 'persistScrollGutter', 'allowUndoRedoButtons', 'placeholder', 'sanitizePrivateContent'].concat(mobileProperties);
|
|
67
|
-
return properties.reduce(function (acc, curr) {
|
|
68
|
-
return acc || props[curr] !== nextProps[curr];
|
|
69
|
-
}, false);
|
|
70
|
-
}
|
|
71
52
|
export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
72
53
|
_inherits(ReactEditorView, _React$Component);
|
|
73
54
|
var _super = _createSuper(ReactEditorView);
|
|
74
|
-
function ReactEditorView(
|
|
55
|
+
function ReactEditorView(props, context) {
|
|
75
56
|
var _this;
|
|
76
57
|
_classCallCheck(this, ReactEditorView);
|
|
77
|
-
_this = _super.call(this,
|
|
58
|
+
_this = _super.call(this, props, context);
|
|
78
59
|
_defineProperty(_assertThisInitialized(_this), "editorRef", /*#__PURE__*/React.createRef());
|
|
79
60
|
_defineProperty(_assertThisInitialized(_this), "canDispatchTransactions", true);
|
|
80
61
|
_defineProperty(_assertThisInitialized(_this), "onPluginObservation", function (report, editorState) {
|
|
@@ -88,6 +69,10 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
88
69
|
}
|
|
89
70
|
});
|
|
90
71
|
});
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "getEditorState", function () {
|
|
73
|
+
var _this$view;
|
|
74
|
+
return (_this$view = _this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
|
|
75
|
+
});
|
|
91
76
|
_defineProperty(_assertThisInitialized(_this), "formatFullWidthAppearance", function (appearance) {
|
|
92
77
|
if (appearance === 'full-width') {
|
|
93
78
|
return FULL_WIDTH_MODE.FULL_WIDTH;
|
|
@@ -135,48 +120,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
135
120
|
sel.removeAllRanges();
|
|
136
121
|
}
|
|
137
122
|
});
|
|
138
|
-
_defineProperty(_assertThisInitialized(_this), "reconfigureState", function (props) {
|
|
139
|
-
if (!_this.view) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
144
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
145
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
146
|
-
_this.blur();
|
|
147
|
-
var editorPlugins = _this.getPlugins(props.editorProps, _this.props.editorProps, _this.props.createAnalyticsEvent);
|
|
148
|
-
_this.config = processPluginsList(editorPlugins);
|
|
149
|
-
var state = _this.editorState;
|
|
150
|
-
var plugins = createPMPlugins({
|
|
151
|
-
schema: state.schema,
|
|
152
|
-
dispatch: _this.dispatch,
|
|
153
|
-
errorReporter: _this.errorReporter,
|
|
154
|
-
editorConfig: _this.config,
|
|
155
|
-
eventDispatcher: _this.eventDispatcher,
|
|
156
|
-
providerFactory: props.providerFactory,
|
|
157
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
158
|
-
reactContext: function reactContext() {
|
|
159
|
-
return _this.context;
|
|
160
|
-
},
|
|
161
|
-
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
162
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
163
|
-
transactionTracker: _this.transactionTracker,
|
|
164
|
-
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
165
|
-
getIntl: function getIntl() {
|
|
166
|
-
return _this.props.intl;
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
var newState = state.reconfigure({
|
|
170
|
-
plugins: plugins
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// need to update the state first so when the view builds the nodeviews it is
|
|
174
|
-
// using the latest plugins
|
|
175
|
-
_this.view.updateState(newState);
|
|
176
|
-
return _this.view.update(_objectSpread(_objectSpread({}, _this.view.props), {}, {
|
|
177
|
-
state: newState
|
|
178
|
-
}));
|
|
179
|
-
});
|
|
180
123
|
_defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (payload) {
|
|
181
124
|
if (!_this.props.allowAnalyticsGASV3) {
|
|
182
125
|
return;
|
|
@@ -207,7 +150,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
207
150
|
return _this.editorState;
|
|
208
151
|
}
|
|
209
152
|
} else {
|
|
210
|
-
_this.config = processPluginsList(_this.getPlugins(options.props.
|
|
153
|
+
_this.config = processPluginsList(_this.getPlugins(options.props.preset));
|
|
211
154
|
schema = createSchema(_this.config);
|
|
212
155
|
}
|
|
213
156
|
var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
|
|
@@ -322,6 +265,10 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
322
265
|
var _this$experienceStore3;
|
|
323
266
|
(_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
324
267
|
});
|
|
268
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
269
|
+
newEditorState: editorState,
|
|
270
|
+
oldEditorState: oldEditorState
|
|
271
|
+
});
|
|
325
272
|
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
326
273
|
_this.onEditorViewStateUpdated({
|
|
327
274
|
originalTransaction: transaction,
|
|
@@ -449,6 +396,10 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
449
396
|
_this.view = new EditorView({
|
|
450
397
|
mount: node
|
|
451
398
|
}, _this.getDirectEditorProps());
|
|
399
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
400
|
+
newEditorState: _this.view.state,
|
|
401
|
+
oldEditorState: undefined
|
|
402
|
+
});
|
|
452
403
|
});
|
|
453
404
|
_defineProperty(_assertThisInitialized(_this), "handleEditorViewRef", function (node) {
|
|
454
405
|
if (!_this.view && node) {
|
|
@@ -531,9 +482,12 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
531
482
|
"aria-label": _this.props.intl.formatMessage(editorMessages.editorAssistiveLabel),
|
|
532
483
|
role: "textbox"
|
|
533
484
|
}));
|
|
485
|
+
_this.pluginInjectionAPI = new EditorPluginInjectionAPI({
|
|
486
|
+
getEditorState: _this.getEditorState
|
|
487
|
+
});
|
|
534
488
|
_this.eventDispatcher = new EventDispatcher();
|
|
535
489
|
_this.dispatch = createDispatch(_this.eventDispatcher);
|
|
536
|
-
_this.errorReporter = createErrorReporter(
|
|
490
|
+
_this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
537
491
|
_this.transactionTracker = new TransactionTracker();
|
|
538
492
|
_this.pluginPerformanceObserver = new PluginPerformanceObserver(function (report) {
|
|
539
493
|
return _this.onPluginObservation(report, _this.editorState);
|
|
@@ -561,11 +515,11 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
561
515
|
_this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
562
516
|
_this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
|
|
563
517
|
_this.editorState = _this.createEditorState({
|
|
564
|
-
props:
|
|
518
|
+
props: props,
|
|
565
519
|
context: context,
|
|
566
|
-
doc:
|
|
520
|
+
doc: props.editorProps.defaultValue,
|
|
567
521
|
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
568
|
-
selectionAtStart: isFullPage(
|
|
522
|
+
selectionAtStart: isFullPage(props.editorProps.appearance)
|
|
569
523
|
});
|
|
570
524
|
_this.dispatchAnalyticsEvent({
|
|
571
525
|
action: ACTION.STARTED,
|
|
@@ -625,7 +579,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
625
579
|
}
|
|
626
580
|
var appearance = this.props.editorProps.appearance;
|
|
627
581
|
var nextAppearance = nextProps.editorProps.appearance;
|
|
628
|
-
if (
|
|
582
|
+
if (this.props.preset !== nextProps.preset) {
|
|
629
583
|
this.reconfigureState(nextProps);
|
|
630
584
|
}
|
|
631
585
|
if (nextAppearance !== appearance) {
|
|
@@ -645,6 +599,51 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
645
599
|
this.pluginPerformanceObserver.disconnect();
|
|
646
600
|
}
|
|
647
601
|
}
|
|
602
|
+
}, {
|
|
603
|
+
key: "reconfigureState",
|
|
604
|
+
value: function reconfigureState(props) {
|
|
605
|
+
var _this2 = this;
|
|
606
|
+
if (!this.view) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
611
|
+
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
612
|
+
// nodes that haven't been re-rendered to the document yet.
|
|
613
|
+
this.blur();
|
|
614
|
+
var editorPlugins = this.getPlugins(props.preset);
|
|
615
|
+
this.config = processPluginsList(editorPlugins);
|
|
616
|
+
var state = this.editorState;
|
|
617
|
+
var plugins = createPMPlugins({
|
|
618
|
+
schema: state.schema,
|
|
619
|
+
dispatch: this.dispatch,
|
|
620
|
+
errorReporter: this.errorReporter,
|
|
621
|
+
editorConfig: this.config,
|
|
622
|
+
eventDispatcher: this.eventDispatcher,
|
|
623
|
+
providerFactory: props.providerFactory,
|
|
624
|
+
portalProviderAPI: props.portalProviderAPI,
|
|
625
|
+
reactContext: function reactContext() {
|
|
626
|
+
return _this2.context;
|
|
627
|
+
},
|
|
628
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
629
|
+
performanceTracking: props.editorProps.performanceTracking,
|
|
630
|
+
transactionTracker: this.transactionTracker,
|
|
631
|
+
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
632
|
+
getIntl: function getIntl() {
|
|
633
|
+
return _this2.props.intl;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
var newState = state.reconfigure({
|
|
637
|
+
plugins: plugins
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// need to update the state first so when the view builds the nodeviews it is
|
|
641
|
+
// using the latest plugins
|
|
642
|
+
this.view.updateState(newState);
|
|
643
|
+
return this.view.update(_objectSpread(_objectSpread({}, this.view.props), {}, {
|
|
644
|
+
state: newState
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
648
647
|
}, {
|
|
649
648
|
key: "componentDidMount",
|
|
650
649
|
value: function componentDidMount() {
|
|
@@ -693,39 +692,11 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
693
692
|
key: "getPlugins",
|
|
694
693
|
value:
|
|
695
694
|
// Helper to allow tests to inject plugins directly
|
|
696
|
-
function getPlugins(
|
|
697
|
-
var
|
|
698
|
-
|
|
699
|
-
_this$props$getEditor2,
|
|
700
|
-
_this$props;
|
|
701
|
-
var insertNodeAPI = createInsertNodeAPI({
|
|
702
|
-
getEditorView: function getEditorView() {
|
|
703
|
-
return _this2.view;
|
|
704
|
-
},
|
|
705
|
-
getEditorPlugins: function getEditorPlugins() {
|
|
706
|
-
return _this2.editorPlugins;
|
|
707
|
-
}
|
|
695
|
+
function getPlugins(preset) {
|
|
696
|
+
var plugins = preset.build({
|
|
697
|
+
pluginInjectionAPI: this.pluginInjectionAPI
|
|
708
698
|
});
|
|
709
|
-
|
|
710
|
-
getEditorView: function getEditorView() {
|
|
711
|
-
return _this2.view;
|
|
712
|
-
},
|
|
713
|
-
getCreateUIAnalyticsEvent: function getCreateUIAnalyticsEvent() {
|
|
714
|
-
return createAnalyticsEvent;
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
var getPluginsProps = {
|
|
718
|
-
props: editorProps,
|
|
719
|
-
prevAppearance: prevEditorProps === null || prevEditorProps === void 0 ? void 0 : prevEditorProps.appearance,
|
|
720
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
721
|
-
insertNodeAPI: insertNodeAPI,
|
|
722
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
723
|
-
};
|
|
724
|
-
if (this.props.getEditorPlugins === undefined) {
|
|
725
|
-
// eslint-disable-next-line no-console
|
|
726
|
-
console.error('getEditorPlugins is undefined in ReactEditorViewInternal - no editor plugins will be added.');
|
|
727
|
-
}
|
|
728
|
-
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 : [];
|
|
699
|
+
this.editorPlugins = plugins;
|
|
729
700
|
return this.editorPlugins;
|
|
730
701
|
}
|
|
731
702
|
}, {
|