@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
|
@@ -111,6 +111,8 @@ const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
|
111
111
|
*
|
|
112
112
|
*/
|
|
113
113
|
const typeAheadPlugin = options => {
|
|
114
|
+
var _options$useBetterTyp;
|
|
115
|
+
const useBetterTypeaheadNavigation = (_options$useBetterTyp = options === null || options === void 0 ? void 0 : options.useBetterTypeaheadNavigation) !== null && _options$useBetterTyp !== void 0 ? _options$useBetterTyp : true;
|
|
114
116
|
const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
115
117
|
const popupMountRef = {
|
|
116
118
|
current: null
|
|
@@ -136,7 +138,8 @@ const typeAheadPlugin = options => {
|
|
|
136
138
|
popupMountRef,
|
|
137
139
|
reactDispatch: dispatch,
|
|
138
140
|
typeAheadHandlers: typeAhead,
|
|
139
|
-
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
|
|
141
|
+
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent,
|
|
142
|
+
useBetterTypeaheadNavigation
|
|
140
143
|
})
|
|
141
144
|
}, {
|
|
142
145
|
name: 'typeAheadInsertItem',
|
|
@@ -15,7 +15,8 @@ import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
|
15
15
|
export const factoryDecorations = ({
|
|
16
16
|
intl,
|
|
17
17
|
popupMountRef,
|
|
18
|
-
createAnalyticsEvent
|
|
18
|
+
createAnalyticsEvent,
|
|
19
|
+
useBetterTypeaheadNavigation
|
|
19
20
|
}) => {
|
|
20
21
|
const createDecorations = (tr, {
|
|
21
22
|
triggerHandler,
|
|
@@ -93,7 +94,8 @@ export const factoryDecorations = ({
|
|
|
93
94
|
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
94
95
|
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
95
96
|
onUndoRedo: onUndoRedo,
|
|
96
|
-
reopenQuery: reopenQuery
|
|
97
|
+
reopenQuery: reopenQuery,
|
|
98
|
+
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
|
|
97
99
|
})), typeaheadComponent);
|
|
98
100
|
shouldFocusCursorInsideQuery = false;
|
|
99
101
|
return typeaheadComponent;
|
|
@@ -145,39 +147,4 @@ export const factoryDecorations = ({
|
|
|
145
147
|
createDecorations,
|
|
146
148
|
removeDecorations
|
|
147
149
|
};
|
|
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
150
|
};
|
|
@@ -23,7 +23,8 @@ export function createPlugin({
|
|
|
23
23
|
popupMountRef,
|
|
24
24
|
createAnalyticsEvent,
|
|
25
25
|
typeAheadHandlers,
|
|
26
|
-
getIntl
|
|
26
|
+
getIntl,
|
|
27
|
+
useBetterTypeaheadNavigation
|
|
27
28
|
}) {
|
|
28
29
|
const intl = getIntl();
|
|
29
30
|
const {
|
|
@@ -32,7 +33,8 @@ export function createPlugin({
|
|
|
32
33
|
} = factoryDecorations({
|
|
33
34
|
intl,
|
|
34
35
|
popupMountRef,
|
|
35
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
36
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
37
|
+
useBetterTypeaheadNavigation
|
|
36
38
|
});
|
|
37
39
|
const reducer = createReducer({
|
|
38
40
|
createDecorations,
|
|
@@ -65,7 +65,8 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
65
65
|
onQueryFocus,
|
|
66
66
|
onUndoRedo,
|
|
67
67
|
editorView,
|
|
68
|
-
items
|
|
68
|
+
items,
|
|
69
|
+
useBetterTypeaheadNavigation
|
|
69
70
|
}) => {
|
|
70
71
|
const ref = useRef(document.createElement('span'));
|
|
71
72
|
const inputRef = useRef(null);
|
|
@@ -134,6 +135,19 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
134
135
|
// Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
|
|
135
136
|
if (!event.isComposing || event.which !== 229 && event.keyCode !== 229) {
|
|
136
137
|
if (selectedIndex === -1) {
|
|
138
|
+
if (useBetterTypeaheadNavigation) {
|
|
139
|
+
/**
|
|
140
|
+
* TODO DTR-1401: (also see ED-17200) There are two options
|
|
141
|
+
* here, either
|
|
142
|
+
* - set the index directly to 1 in WrapperTypeAhead.tsx's
|
|
143
|
+
* `insertSelectedItem` at the cost of breaking some of the a11y
|
|
144
|
+
* focus changes,
|
|
145
|
+
* - or do this jank at the cost of some small analytics noise.
|
|
146
|
+
*
|
|
147
|
+
* The focus behaviour still needs cleanup
|
|
148
|
+
*/
|
|
149
|
+
selectPreviousItem();
|
|
150
|
+
}
|
|
137
151
|
selectNextItem();
|
|
138
152
|
}
|
|
139
153
|
onItemSelect(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER);
|
|
@@ -141,18 +155,41 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
141
155
|
break;
|
|
142
156
|
case 'Tab':
|
|
143
157
|
if (selectedIndex === -1) {
|
|
158
|
+
if (useBetterTypeaheadNavigation) {
|
|
159
|
+
/**
|
|
160
|
+
* TODO DTR-1401: (also see ED-17200) There are two options
|
|
161
|
+
* here, either
|
|
162
|
+
* - set the index directly to 1 in WrapperTypeAhead.tsx's
|
|
163
|
+
* `insertSelectedItem` at the cost of breaking some of the a11y
|
|
164
|
+
* focus changes,
|
|
165
|
+
* - or do this jank at the cost of some small analytics noise.
|
|
166
|
+
*
|
|
167
|
+
*/
|
|
168
|
+
selectPreviousItem();
|
|
169
|
+
}
|
|
144
170
|
selectNextItem();
|
|
145
171
|
}
|
|
172
|
+
// TODO DTR-1401: why is this calling select item when hitting tab? fix this in DTR-1401
|
|
146
173
|
onItemSelect(SelectItemMode.TAB);
|
|
147
174
|
break;
|
|
148
175
|
case 'ArrowDown':
|
|
149
|
-
if (
|
|
176
|
+
if (useBetterTypeaheadNavigation) {
|
|
150
177
|
selectNextItem();
|
|
178
|
+
} else {
|
|
179
|
+
// TODO DTR-1401: why were we preventing selection?
|
|
180
|
+
if (selectedIndex === -1) {
|
|
181
|
+
selectNextItem();
|
|
182
|
+
}
|
|
151
183
|
}
|
|
152
184
|
break;
|
|
153
185
|
case 'ArrowUp':
|
|
154
|
-
if (
|
|
186
|
+
if (useBetterTypeaheadNavigation) {
|
|
155
187
|
selectPreviousItem();
|
|
188
|
+
} else {
|
|
189
|
+
// TODO DTR-1401: why were we preventing selection?
|
|
190
|
+
if (selectedIndex === -1) {
|
|
191
|
+
selectPreviousItem();
|
|
192
|
+
}
|
|
156
193
|
}
|
|
157
194
|
break;
|
|
158
195
|
}
|
|
@@ -165,7 +202,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
165
202
|
event.preventDefault();
|
|
166
203
|
return false;
|
|
167
204
|
}
|
|
168
|
-
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
|
|
205
|
+
}, [useBetterTypeaheadNavigation, onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
|
|
169
206
|
const onClick = useCallback(event => {
|
|
170
207
|
var _inputRef$current;
|
|
171
208
|
event.stopPropagation();
|
|
@@ -166,6 +166,8 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
166
166
|
selectPreviousItem();
|
|
167
167
|
event.preventDefault();
|
|
168
168
|
break;
|
|
169
|
+
|
|
170
|
+
// TODO DTR-1401: why is this calling item click when hitting tab? fix this in DTR-1401
|
|
169
171
|
case 'Tab':
|
|
170
172
|
//Tab key quick inserts the selected item.
|
|
171
173
|
onItemClick(SelectItemMode.TAB, selectedIndex);
|
|
@@ -18,7 +18,8 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
18
18
|
inputMethod,
|
|
19
19
|
getDecorationPosition,
|
|
20
20
|
reopenQuery,
|
|
21
|
-
onUndoRedo
|
|
21
|
+
onUndoRedo,
|
|
22
|
+
useBetterTypeaheadNavigation
|
|
22
23
|
}) => {
|
|
23
24
|
const [closed, setClosed] = useState(false);
|
|
24
25
|
const [query, setQuery] = useState(reopenQuery || '');
|
|
@@ -31,12 +32,14 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
31
32
|
const [onItemInsert, onTextInsert] = useItemInsert(triggerHandler, editorView, items);
|
|
32
33
|
const selectNextItem = useMemo(() => moveSelectedIndex({
|
|
33
34
|
editorView,
|
|
34
|
-
direction: 'next'
|
|
35
|
-
|
|
35
|
+
direction: 'next',
|
|
36
|
+
useBetterTypeaheadNavigation
|
|
37
|
+
}), [editorView, useBetterTypeaheadNavigation]);
|
|
36
38
|
const selectPreviousItem = useMemo(() => moveSelectedIndex({
|
|
37
39
|
editorView,
|
|
38
|
-
direction: 'previous'
|
|
39
|
-
|
|
40
|
+
direction: 'previous',
|
|
41
|
+
useBetterTypeaheadNavigation
|
|
42
|
+
}), [editorView, useBetterTypeaheadNavigation]);
|
|
40
43
|
const cancel = useCallback(({
|
|
41
44
|
setSelectionAt,
|
|
42
45
|
addPrefixTrigger,
|
|
@@ -92,6 +95,7 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
92
95
|
return null;
|
|
93
96
|
}
|
|
94
97
|
return /*#__PURE__*/React.createElement(InputQuery, {
|
|
98
|
+
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation,
|
|
95
99
|
triggerQueryPrefix: triggerHandler.trigger,
|
|
96
100
|
onQueryChange: setQuery,
|
|
97
101
|
onItemSelect: insertSelectedItem,
|
|
@@ -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
|
};
|
|
@@ -75,7 +52,8 @@ export const findHandlerByTrigger = ({
|
|
|
75
52
|
};
|
|
76
53
|
export const moveSelectedIndex = ({
|
|
77
54
|
editorView,
|
|
78
|
-
direction
|
|
55
|
+
direction,
|
|
56
|
+
useBetterTypeaheadNavigation
|
|
79
57
|
}) => () => {
|
|
80
58
|
const typeAheadState = getPluginState(editorView.state);
|
|
81
59
|
if (!typeAheadState) {
|
|
@@ -89,7 +67,26 @@ export const moveSelectedIndex = ({
|
|
|
89
67
|
let nextIndex;
|
|
90
68
|
if (direction === 'next') {
|
|
91
69
|
stats.increaseArrowDown();
|
|
92
|
-
|
|
70
|
+
if (useBetterTypeaheadNavigation) {
|
|
71
|
+
/**
|
|
72
|
+
* See: https://product-fabric.atlassian.net/browse/ED-17200
|
|
73
|
+
* `selectedIndex` is forced to -1 now to not immediately focus the typeahead
|
|
74
|
+
* and only do so when there is explicit logic to focus into the typeahead
|
|
75
|
+
* options.
|
|
76
|
+
*
|
|
77
|
+
* This check for "set index to 1 when -1"
|
|
78
|
+
* - is a temporary workaround to get back the previous behaviour without
|
|
79
|
+
* entirely reverting the a11y improvements
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
if (selectedIndex === -1 && items.length > 1) {
|
|
83
|
+
nextIndex = 1;
|
|
84
|
+
} else {
|
|
85
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
89
|
+
}
|
|
93
90
|
} else {
|
|
94
91
|
stats.increaseArrowUp();
|
|
95
92
|
nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
|
|
@@ -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;
|