@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
|
@@ -145,39 +145,4 @@ export const factoryDecorations = ({
|
|
|
145
145
|
createDecorations,
|
|
146
146
|
removeDecorations
|
|
147
147
|
};
|
|
148
|
-
};
|
|
149
|
-
export const isSelectionInsideTypeAhead = ({
|
|
150
|
-
decorationSet,
|
|
151
|
-
selection
|
|
152
|
-
}) => {
|
|
153
|
-
if (!decorationSet || decorationSet === DecorationSet.empty) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
const typeAheadDecorations = decorationSet.find(undefined, undefined, spec => {
|
|
157
|
-
return spec.isTypeAheadDecoration;
|
|
158
|
-
});
|
|
159
|
-
if (!typeAheadDecorations || typeAheadDecorations.length === 0) {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
return typeAheadDecorations.some(dec => {
|
|
163
|
-
return dec.from === selection.from && dec.to === selection.to;
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
export const findDecorationElement = ({
|
|
167
|
-
selection,
|
|
168
|
-
decorationSet
|
|
169
|
-
}) => {
|
|
170
|
-
if (!decorationSet || decorationSet === DecorationSet.empty || !(selection instanceof TextSelection) || !selection.$cursor) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
const {
|
|
174
|
-
$cursor: {
|
|
175
|
-
pos
|
|
176
|
-
}
|
|
177
|
-
} = selection;
|
|
178
|
-
const decoration = decorationSet.find(pos, pos, spec => spec === null || spec === void 0 ? void 0 : spec.isTypeAheadDecoration);
|
|
179
|
-
if (!decoration || decoration.length !== 1) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
return document.querySelector(`#${decoration[0].spec.key}`);
|
|
183
148
|
};
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import { TextSelection } from 'prosemirror-state';
|
|
2
|
-
import { DecorationSet } from 'prosemirror-view';
|
|
3
1
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
4
2
|
import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
|
|
5
3
|
import { updateSelectedIndex } from './commands/update-selected-index';
|
|
6
4
|
import { StatsModifier } from './stats-modifier';
|
|
7
5
|
import { typeAheadListMessages } from './messages';
|
|
8
|
-
export const findTypeAheadDecorations = state => {
|
|
9
|
-
const {
|
|
10
|
-
selection
|
|
11
|
-
} = state;
|
|
12
|
-
const {
|
|
13
|
-
decorationSet
|
|
14
|
-
} = typeAheadPluginKey.getState(state);
|
|
15
|
-
if (!decorationSet || decorationSet === DecorationSet.empty || !(selection instanceof TextSelection) || !selection.$cursor) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const {
|
|
19
|
-
$cursor: {
|
|
20
|
-
pos
|
|
21
|
-
}
|
|
22
|
-
} = selection;
|
|
23
|
-
const decoration = decorationSet.find(pos, pos, spec => spec === null || spec === void 0 ? void 0 : spec.isTypeAheadDecoration);
|
|
24
|
-
if (!decoration || decoration.length !== 1) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return decoration[0];
|
|
28
|
-
};
|
|
29
6
|
export const isTypeAheadHandler = handler => {
|
|
30
7
|
return handler && Object.values(TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
|
|
31
8
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { TextSelection } from 'prosemirror-state';
|
|
2
2
|
import { sortByOrder } from './create-editor/sort-by-order';
|
|
3
|
-
import { Preset } from './labs/next/presets/preset';
|
|
4
3
|
import { createSchema } from './create-editor/create-schema';
|
|
5
4
|
import basePlugin from './plugins/base';
|
|
6
5
|
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
7
6
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
8
|
-
|
|
7
|
+
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
9
8
|
export function getFireAnalytics(editorView) {
|
|
10
9
|
var _analyticsPluginKey$g;
|
|
11
10
|
return analyticsPluginKey === null || analyticsPluginKey === void 0 ? void 0 : (_analyticsPluginKey$g = analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
|
|
@@ -50,12 +49,10 @@ function lightProcessPluginsList(editorPlugins) {
|
|
|
50
49
|
onEditorViewStateUpdatedCallbacks: []
|
|
51
50
|
});
|
|
52
51
|
}
|
|
53
|
-
export const createPMSchemaAndPlugins = (
|
|
52
|
+
export const createPMSchemaAndPlugins = (inputPreset = new EditorPresetBuilder()) => pluginFactoryParams => {
|
|
54
53
|
let editorPlugins = [];
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
editorPlugins = preset.getEditorPlugins();
|
|
54
|
+
const preset = inputPreset.has(basePlugin) ? inputPreset : inputPreset.add(basePlugin);
|
|
55
|
+
editorPlugins = preset.build();
|
|
59
56
|
const editorConfig = lightProcessPluginsList(editorPlugins);
|
|
60
57
|
const schema = createSchema(editorConfig);
|
|
61
58
|
const plugins = editorConfig.plugins.sort(sortByOrder('plugins')).map(({
|
|
@@ -41,10 +41,18 @@ const stickyToolbarWrapperStyle = css`
|
|
|
41
41
|
`;
|
|
42
42
|
const StickyToolbar = props => {
|
|
43
43
|
const [top, setTop] = useState(0);
|
|
44
|
+
|
|
45
|
+
// ED-15802: if externalToolbarRef is passed in, set top to externalToolbarRef?.current?.clientHeight
|
|
46
|
+
// else if offsetTop is a number set top to offsetTop
|
|
47
|
+
// otherwise top is 0 as initial state
|
|
44
48
|
useEffect(() => {
|
|
45
49
|
var _props$externalToolba, _props$externalToolba2;
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
if ((_props$externalToolba = props.externalToolbarRef) !== null && _props$externalToolba !== void 0 && (_props$externalToolba2 = _props$externalToolba.current) !== null && _props$externalToolba2 !== void 0 && _props$externalToolba2.clientHeight) {
|
|
51
|
+
setTop(props.externalToolbarRef.current.clientHeight);
|
|
52
|
+
} else {
|
|
53
|
+
setTop(props.offsetTop || 0);
|
|
54
|
+
}
|
|
55
|
+
}, [props.externalToolbarRef, props.offsetTop]);
|
|
48
56
|
return jsx("div", {
|
|
49
57
|
css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, css`
|
|
50
58
|
top: ${top}px;
|
|
@@ -57,14 +65,40 @@ const FixedToolbar = props => jsx("div", {
|
|
|
57
65
|
css: mainToolbarWrapperStyle,
|
|
58
66
|
"data-testid": "ak-editor-main-toolbar"
|
|
59
67
|
}, props.children);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* ED-15802: Scenarios when a sticky bar is used:
|
|
71
|
+
* 1. useStickyToolbar is true
|
|
72
|
+
* 2. useStickyToolbar is a DOM element
|
|
73
|
+
* 3. useStickyToolbar is an object and has offsetTop key;
|
|
74
|
+
*/
|
|
75
|
+
const getStickyParameters = configuration => {
|
|
76
|
+
// const isUsingStickyOffset, isHTMLElement is used so TS can properly infer types.
|
|
77
|
+
const isHTMLElement = typeof configuration === 'object' && !('offsetTop' in configuration);
|
|
78
|
+
const isUsingStickyOffset = typeof configuration === 'object' && 'offsetTop' in configuration;
|
|
79
|
+
if (typeof configuration !== 'object') {
|
|
80
|
+
return {
|
|
81
|
+
externalToolbarRef: undefined,
|
|
82
|
+
offsetTop: undefined
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (isUsingStickyOffset) {
|
|
86
|
+
return {
|
|
87
|
+
offsetTop: configuration.offsetTop
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (isHTMLElement) {
|
|
91
|
+
return {
|
|
92
|
+
externalToolbarRef: configuration
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
};
|
|
60
96
|
export const MainToolbar = ({
|
|
61
97
|
useStickyToolbar,
|
|
62
98
|
children
|
|
63
99
|
}) => {
|
|
64
|
-
if (
|
|
65
|
-
return jsx(StickyToolbar,
|
|
66
|
-
externalToolbarRef: typeof useStickyToolbar === 'boolean' ? undefined : useStickyToolbar
|
|
67
|
-
}, children);
|
|
100
|
+
if (useStickyToolbar) {
|
|
101
|
+
return jsx(StickyToolbar, getStickyParameters(useStickyToolbar), children);
|
|
68
102
|
}
|
|
69
103
|
return jsx(FixedToolbar, null, children);
|
|
70
104
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { ColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
1
|
+
import { ColorPalette, backgroundPaletteTooltipMessages, textPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
2
|
+
export { ColorPalette, backgroundPaletteTooltipMessages, textPaletteTooltipMessages };
|
|
2
3
|
export default ColorPalette;
|
|
@@ -127,13 +127,17 @@ const ColorPickerButton = props => {
|
|
|
127
127
|
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
128
128
|
isPopupPositioned: isPopupPositioned
|
|
129
129
|
}, jsx(ColorPaletteWithListeners, {
|
|
130
|
-
palette: props.colorPalette,
|
|
131
130
|
cols: props.cols,
|
|
132
131
|
selectedColor: selectedColor,
|
|
133
132
|
onClick: onColorSelected,
|
|
134
133
|
handleClickOutside: togglePopup,
|
|
135
134
|
handleEscapeKeydown: handleEsc,
|
|
136
|
-
|
|
135
|
+
paletteOptions: {
|
|
136
|
+
palette: props.colorPalette,
|
|
137
|
+
hexToPaletteColor: props.hexToPaletteColor,
|
|
138
|
+
showSomewhatSemanticTooltips: props.showSomewhatSemanticTooltips,
|
|
139
|
+
paletteColorTooltipMessages: props.paletteColorTooltipMessages
|
|
140
|
+
}
|
|
137
141
|
}))));
|
|
138
142
|
};
|
|
139
143
|
const title = props.title || '';
|
|
@@ -2,12 +2,6 @@ import { ValidationError } from './types';
|
|
|
2
2
|
export const validate = (field, value) => {
|
|
3
3
|
return validateRequired(field, value);
|
|
4
4
|
};
|
|
5
|
-
export const fromEntries = iterable => {
|
|
6
|
-
return [...iterable].reduce((obj, [key, val]) => {
|
|
7
|
-
obj[key] = val;
|
|
8
|
-
return obj;
|
|
9
|
-
}, {});
|
|
10
|
-
};
|
|
11
5
|
const isEmptyString = value => typeof value === 'string' && value === '';
|
|
12
6
|
const isEmptyArray = value => Array.isArray(value) && value.length === 0;
|
|
13
7
|
export const validateRequired = ({
|
|
@@ -14,7 +14,6 @@ export const SIDEBAR_WIDTH = `${GRID_SIZE * 25}px`;
|
|
|
14
14
|
export const SIDEBAR_HEADING_WRAPPER_HEIGHT = `${GRID_SIZE * 6}px`;
|
|
15
15
|
export const SIDEBAR_HEADING_PADDING_LEFT = '12px';
|
|
16
16
|
export const INLINE_SIDEBAR_HEIGHT = '54px';
|
|
17
|
-
export const SEARCH_ITEM_MARGIN = '12px';
|
|
18
17
|
export const SEARCH_ITEM_HEIGHT_WIDTH = '20px';
|
|
19
18
|
export const SCROLLBAR_WIDTH = 15;
|
|
20
19
|
export const ELEMENT_LIST_PADDING = 2;
|
package/dist/es2019/ui/styles.js
CHANGED
|
@@ -55,12 +55,6 @@ export const buttonContentStyle = css`
|
|
|
55
55
|
export const buttonContentReducedSpacingStyle = css`
|
|
56
56
|
padding: 8px;
|
|
57
57
|
`;
|
|
58
|
-
|
|
59
|
-
// Taken from the style of inline dialog components
|
|
60
|
-
export const dropShadow = css`
|
|
61
|
-
box-shadow: ${`var(--ds-shadow-overlay, ${`0 0 1px rgba(9, 30, 66, 0.31),
|
|
62
|
-
0 4px 8px -2px rgba(9, 30, 66, 0.25)`})`};
|
|
63
|
-
`;
|
|
64
58
|
export const clickSelectWrapperStyle = css`
|
|
65
59
|
user-select: all;
|
|
66
60
|
`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createEditorSelectionAPI } from '../selection-api/api';
|
|
2
1
|
import createPluginsList from '../create-editor/create-plugins-list';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -17,9 +16,8 @@ const getEditorPlugins = ({
|
|
|
17
16
|
}) => {
|
|
18
17
|
var _props$dangerouslyApp, _props$dangerouslyApp2;
|
|
19
18
|
const dangerouslyAppendedPlugins = (_props$dangerouslyApp = (_props$dangerouslyApp2 = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp2 === void 0 ? void 0 : _props$dangerouslyApp2.__plugins) !== null && _props$dangerouslyApp !== void 0 ? _props$dangerouslyApp : [];
|
|
20
|
-
const selectionAPI = createEditorSelectionAPI();
|
|
21
19
|
return [...createPluginsList(props, {
|
|
22
20
|
appearance: prevAppearance
|
|
23
|
-
}, createAnalyticsEvent
|
|
21
|
+
}, createAnalyticsEvent), ...dangerouslyAppendedPlugins];
|
|
24
22
|
};
|
|
25
23
|
export default getEditorPlugins;
|
|
@@ -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
|