@atlaskit/editor-core 188.8.0 → 188.9.2
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 +20 -0
- package/dist/cjs/composable-editor/editor-internal.js +2 -2
- package/dist/cjs/create-editor/ReactEditorView.js +796 -8
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +7 -4
- package/dist/cjs/plugins/index.js +0 -28
- package/dist/cjs/plugins/insert-block/index.js +4 -6
- package/dist/cjs/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -13
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +15 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +753 -2
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +4 -1
- package/dist/es2019/plugins/index.js +0 -4
- package/dist/es2019/plugins/insert-block/index.js +4 -6
- package/dist/es2019/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +43 -10
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +13 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +797 -8
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +4 -1
- package/dist/esm/plugins/index.js +0 -4
- package/dist/esm/plugins/insert-block/index.js +4 -6
- package/dist/esm/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -12
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +14 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +119 -5
- package/dist/types/labs/next/presets/default.d.ts +43 -43
- package/dist/types/plugins/index.d.ts +0 -4
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +2 -5
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +6 -1
- package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +119 -5
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +43 -43
- package/dist/types-ts4.5/plugins/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +2 -5
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +8 -1
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +0 -812
- package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -15
- package/dist/cjs/plugins/save-on-enter/index.js +0 -70
- package/dist/cjs/plugins/scroll-into-view/index.js +0 -55
- package/dist/cjs/plugins/status/actions.js +0 -158
- package/dist/cjs/plugins/status/analytics.js +0 -31
- package/dist/cjs/plugins/status/index.js +0 -143
- package/dist/cjs/plugins/status/keymap.js +0 -22
- package/dist/cjs/plugins/status/nodeviews/status.js +0 -58
- package/dist/cjs/plugins/status/plugin-key.js +0 -9
- package/dist/cjs/plugins/status/plugin.js +0 -133
- package/dist/cjs/plugins/status/types.js +0 -5
- package/dist/cjs/plugins/status/ui/statusPicker.js +0 -314
- package/dist/cjs/plugins/status/utils.js +0 -22
- package/dist/cjs/plugins/type-ahead/api.js +0 -215
- package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -205
- package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +0 -23
- package/dist/cjs/plugins/type-ahead/commands/update-query.js +0 -27
- package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +0 -27
- package/dist/cjs/plugins/type-ahead/constants.js +0 -15
- package/dist/cjs/plugins/type-ahead/index.js +0 -14
- package/dist/cjs/plugins/type-ahead/insert-utils.js +0 -107
- package/dist/cjs/plugins/type-ahead/messages.js +0 -79
- package/dist/cjs/plugins/type-ahead/plugin.js +0 -382
- package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +0 -16
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +0 -148
- package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +0 -36
- package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -22
- package/dist/cjs/plugins/type-ahead/pm-plugins/key.js +0 -8
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +0 -110
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +0 -158
- package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +0 -18
- package/dist/cjs/plugins/type-ahead/stats-modifier.js +0 -42
- package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +0 -13
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -75
- package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +0 -18
- package/dist/cjs/plugins/type-ahead/types.js +0 -5
- package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +0 -120
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +0 -400
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +0 -285
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +0 -179
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +0 -230
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -127
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -109
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +0 -50
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -41
- package/dist/cjs/plugins/type-ahead/utils.js +0 -130
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +0 -753
- package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -7
- package/dist/es2019/plugins/save-on-enter/index.js +0 -63
- package/dist/es2019/plugins/scroll-into-view/index.js +0 -44
- package/dist/es2019/plugins/status/actions.js +0 -144
- package/dist/es2019/plugins/status/analytics.js +0 -18
- package/dist/es2019/plugins/status/index.js +0 -135
- package/dist/es2019/plugins/status/keymap.js +0 -13
- package/dist/es2019/plugins/status/nodeviews/status.js +0 -60
- package/dist/es2019/plugins/status/plugin-key.js +0 -3
- package/dist/es2019/plugins/status/plugin.js +0 -113
- package/dist/es2019/plugins/status/types.js +0 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +0 -293
- package/dist/es2019/plugins/status/utils.js +0 -12
- package/dist/es2019/plugins/type-ahead/api.js +0 -205
- package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -204
- package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +0 -17
- package/dist/es2019/plugins/type-ahead/commands/update-query.js +0 -21
- package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +0 -21
- package/dist/es2019/plugins/type-ahead/constants.js +0 -9
- package/dist/es2019/plugins/type-ahead/index.js +0 -3
- package/dist/es2019/plugins/type-ahead/insert-utils.js +0 -106
- package/dist/es2019/plugins/type-ahead/messages.js +0 -73
- package/dist/es2019/plugins/type-ahead/plugin.js +0 -381
- package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +0 -10
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -148
- package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
- package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
- package/dist/es2019/plugins/type-ahead/pm-plugins/key.js +0 -2
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +0 -106
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +0 -160
- package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +0 -12
- package/dist/es2019/plugins/type-ahead/stats-modifier.js +0 -33
- package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -71
- package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +0 -10
- package/dist/es2019/plugins/type-ahead/types.js +0 -1
- package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +0 -88
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +0 -393
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +0 -273
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +0 -214
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +0 -233
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -109
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -112
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +0 -41
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -38
- package/dist/es2019/plugins/type-ahead/utils.js +0 -126
- package/dist/esm/create-editor/ReactEditorViewInternal.js +0 -806
- package/dist/esm/create-editor/ReactEditorViewNext.js +0 -7
- package/dist/esm/plugins/save-on-enter/index.js +0 -63
- package/dist/esm/plugins/scroll-into-view/index.js +0 -50
- package/dist/esm/plugins/status/actions.js +0 -151
- package/dist/esm/plugins/status/analytics.js +0 -24
- package/dist/esm/plugins/status/index.js +0 -136
- package/dist/esm/plugins/status/keymap.js +0 -15
- package/dist/esm/plugins/status/nodeviews/status.js +0 -51
- package/dist/esm/plugins/status/plugin-key.js +0 -3
- package/dist/esm/plugins/status/plugin.js +0 -115
- package/dist/esm/plugins/status/types.js +0 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +0 -308
- package/dist/esm/plugins/status/utils.js +0 -16
- package/dist/esm/plugins/type-ahead/api.js +0 -209
- package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -198
- package/dist/esm/plugins/type-ahead/commands/update-list-items.js +0 -17
- package/dist/esm/plugins/type-ahead/commands/update-query.js +0 -21
- package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +0 -21
- package/dist/esm/plugins/type-ahead/constants.js +0 -9
- package/dist/esm/plugins/type-ahead/index.js +0 -3
- package/dist/esm/plugins/type-ahead/insert-utils.js +0 -101
- package/dist/esm/plugins/type-ahead/messages.js +0 -73
- package/dist/esm/plugins/type-ahead/plugin.js +0 -374
- package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +0 -10
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -141
- package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
- package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
- package/dist/esm/plugins/type-ahead/pm-plugins/key.js +0 -2
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +0 -104
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +0 -151
- package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +0 -12
- package/dist/esm/plugins/type-ahead/stats-modifier.js +0 -35
- package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -69
- package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +0 -12
- package/dist/esm/plugins/type-ahead/types.js +0 -1
- package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +0 -115
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +0 -390
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +0 -276
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +0 -169
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +0 -220
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -117
- package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -103
- package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +0 -43
- package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -35
- package/dist/esm/plugins/type-ahead/utils.js +0 -124
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -119
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +0 -8
- package/dist/types/plugins/save-on-enter/index.d.ts +0 -10
- package/dist/types/plugins/scroll-into-view/index.d.ts +0 -14
- package/dist/types/plugins/status/actions.d.ts +0 -16
- package/dist/types/plugins/status/analytics.d.ts +0 -4
- package/dist/types/plugins/status/index.d.ts +0 -15
- package/dist/types/plugins/status/keymap.d.ts +0 -3
- package/dist/types/plugins/status/nodeviews/status.d.ts +0 -25
- package/dist/types/plugins/status/plugin-key.d.ts +0 -4
- package/dist/types/plugins/status/plugin.d.ts +0 -7
- package/dist/types/plugins/status/types.d.ts +0 -18
- package/dist/types/plugins/status/ui/statusPicker.d.ts +0 -63
- package/dist/types/plugins/status/utils.d.ts +0 -5
- package/dist/types/plugins/type-ahead/api.d.ts +0 -61
- package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
- package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
- package/dist/types/plugins/type-ahead/commands/update-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
- package/dist/types/plugins/type-ahead/constants.d.ts +0 -8
- package/dist/types/plugins/type-ahead/index.d.ts +0 -4
- package/dist/types/plugins/type-ahead/insert-utils.d.ts +0 -18
- package/dist/types/plugins/type-ahead/messages.d.ts +0 -72
- package/dist/types/plugins/type-ahead/plugin.d.ts +0 -10
- package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
- package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
- package/dist/types/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
- package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
- package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
- package/dist/types/plugins/type-ahead/stats-modifier.d.ts +0 -20
- package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
- package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/types.d.ts +0 -109
- package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
- package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
- package/dist/types/plugins/type-ahead/utils.d.ts +0 -27
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -119
- package/dist/types-ts4.5/create-editor/ReactEditorViewNext.d.ts +0 -8
- package/dist/types-ts4.5/plugins/save-on-enter/index.d.ts +0 -10
- package/dist/types-ts4.5/plugins/scroll-into-view/index.d.ts +0 -14
- package/dist/types-ts4.5/plugins/status/actions.d.ts +0 -16
- package/dist/types-ts4.5/plugins/status/analytics.d.ts +0 -4
- package/dist/types-ts4.5/plugins/status/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/status/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +0 -25
- package/dist/types-ts4.5/plugins/status/plugin-key.d.ts +0 -4
- package/dist/types-ts4.5/plugins/status/plugin.d.ts +0 -7
- package/dist/types-ts4.5/plugins/status/types.d.ts +0 -18
- package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +0 -63
- package/dist/types-ts4.5/plugins/status/utils.d.ts +0 -5
- package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +0 -61
- package/dist/types-ts4.5/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/constants.d.ts +0 -8
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/type-ahead/insert-utils.d.ts +0 -18
- package/dist/types-ts4.5/plugins/type-ahead/messages.d.ts +0 -72
- package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +0 -10
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/type-ahead/stats-modifier.d.ts +0 -20
- package/dist/types-ts4.5/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
- package/dist/types-ts4.5/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +0 -111
- package/dist/types-ts4.5/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
- package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
- package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -7
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
- package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +0 -27
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import uuid from 'uuid';
|
|
4
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { B400 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { keyName as keyNameNormalized } from 'w3c-keyname';
|
|
8
|
-
import { IntlProvider } from 'react-intl-next';
|
|
9
|
-
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
10
|
-
import { TYPE_AHEAD_DECORATION_KEY, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from '../constants';
|
|
11
|
-
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
12
|
-
import { StatsModifier } from '../stats-modifier';
|
|
13
|
-
import { getTypeAheadQuery } from '../utils';
|
|
14
|
-
import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
15
|
-
export const factoryDecorations = ({
|
|
16
|
-
intl,
|
|
17
|
-
popupMountRef,
|
|
18
|
-
createAnalyticsEvent
|
|
19
|
-
}) => {
|
|
20
|
-
const createDecorations = (tr, {
|
|
21
|
-
triggerHandler,
|
|
22
|
-
inputMethod,
|
|
23
|
-
reopenQuery
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
selection
|
|
27
|
-
} = tr;
|
|
28
|
-
if (!(selection instanceof TextSelection) || !selection.$cursor) {
|
|
29
|
-
return {
|
|
30
|
-
decorationSet: DecorationSet.empty,
|
|
31
|
-
stats: null,
|
|
32
|
-
decorationElement: null
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const decorationId = `decoration_id_${TYPE_AHEAD_DECORATION_KEY}_${uuid()}`;
|
|
36
|
-
const {
|
|
37
|
-
$cursor
|
|
38
|
-
} = selection;
|
|
39
|
-
const typeaheadComponent = document.createElement('mark');
|
|
40
|
-
const stats = new StatsModifier();
|
|
41
|
-
let shouldFocusCursorInsideQuery = true;
|
|
42
|
-
const deco = Decoration.widget($cursor.pos, (editorView, getDecorationPosition) => {
|
|
43
|
-
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
44
|
-
typeaheadComponent.setAttribute('id', decorationId);
|
|
45
|
-
typeaheadComponent.setAttribute('role', 'search');
|
|
46
|
-
typeaheadComponent.dataset.typeAheadQuery = 'true';
|
|
47
|
-
typeaheadComponent.dataset.trigger = triggerHandler.trigger;
|
|
48
|
-
|
|
49
|
-
// This line below seems weird,
|
|
50
|
-
// we need that cuz the clickAreaHelper
|
|
51
|
-
// will try to hijack any click event coming
|
|
52
|
-
// from the inside of the Editor
|
|
53
|
-
// packages/editor/editor-core/src/ui/Addon/click-area-helper.ts
|
|
54
|
-
typeaheadComponent.dataset.editorPopup = 'true';
|
|
55
|
-
typeaheadComponent.dataset.typeAhead = TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
|
|
56
|
-
typeaheadComponent.style.color = `var(--ds-text-accent-blue, ${B400})`;
|
|
57
|
-
typeaheadComponent.style.backgroundColor = 'transparent';
|
|
58
|
-
const onUndoRedo = inputType => {
|
|
59
|
-
if (!['historyUndo', 'historyRedo'].includes(inputType)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
|
|
63
|
-
const currentQuery = getTypeAheadQuery(editorView.state);
|
|
64
|
-
if (hasReopenQuery || (currentQuery === null || currentQuery === void 0 ? void 0 : currentQuery.length) === 0) {
|
|
65
|
-
const command = inputType === 'historyUndo' ? undo : redo;
|
|
66
|
-
let tr = editorView.state.tr;
|
|
67
|
-
const fakeDispatch = customTr => {
|
|
68
|
-
tr = customTr;
|
|
69
|
-
};
|
|
70
|
-
const result = command(editorView.state, fakeDispatch);
|
|
71
|
-
if (result) {
|
|
72
|
-
closeTypeAhead(tr);
|
|
73
|
-
editorView.dispatch(tr);
|
|
74
|
-
editorView.focus();
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
};
|
|
80
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
|
|
81
|
-
locale: intl.locale || 'en',
|
|
82
|
-
messages: intl.messages,
|
|
83
|
-
formats: intl.formats
|
|
84
|
-
}, /*#__PURE__*/React.createElement(WrapperTypeAhead, {
|
|
85
|
-
triggerHandler: triggerHandler,
|
|
86
|
-
editorView: editorView,
|
|
87
|
-
anchorElement: typeaheadComponent,
|
|
88
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
89
|
-
inputMethod: inputMethod,
|
|
90
|
-
getDecorationPosition: getDecorationPosition,
|
|
91
|
-
shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
|
|
92
|
-
popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
|
|
93
|
-
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
94
|
-
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
95
|
-
onUndoRedo: onUndoRedo,
|
|
96
|
-
reopenQuery: reopenQuery
|
|
97
|
-
})), typeaheadComponent);
|
|
98
|
-
shouldFocusCursorInsideQuery = false;
|
|
99
|
-
return typeaheadComponent;
|
|
100
|
-
}, {
|
|
101
|
-
isTypeAheadDecoration: true,
|
|
102
|
-
key: decorationId,
|
|
103
|
-
side: 0,
|
|
104
|
-
stopEvent: e => {
|
|
105
|
-
const key = keyNameNormalized(e);
|
|
106
|
-
const sel = document.getSelection();
|
|
107
|
-
if ('ArrowLeft' === key && (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
},
|
|
112
|
-
ignoreSelection: false
|
|
113
|
-
});
|
|
114
|
-
return {
|
|
115
|
-
decorationSet: DecorationSet.create(tr.doc, [deco]),
|
|
116
|
-
decorationElement: typeaheadComponent,
|
|
117
|
-
stats
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
const removeDecorations = decorationSet => {
|
|
121
|
-
if (!decorationSet || decorationSet === DecorationSet.empty) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
const typeAheadDecorations = decorationSet.find(undefined, undefined, spec => {
|
|
125
|
-
return spec.isTypeAheadDecoration;
|
|
126
|
-
});
|
|
127
|
-
if (!typeAheadDecorations || typeAheadDecorations.length === 0) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
typeAheadDecorations.forEach(({
|
|
131
|
-
spec
|
|
132
|
-
}) => {
|
|
133
|
-
if (!spec.key) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const decoElement = document.querySelector(`#${spec.key}`);
|
|
137
|
-
if (!decoElement) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
ReactDOM.unmountComponentAtNode(decoElement);
|
|
141
|
-
});
|
|
142
|
-
return true;
|
|
143
|
-
};
|
|
144
|
-
return {
|
|
145
|
-
createDecorations,
|
|
146
|
-
removeDecorations
|
|
147
|
-
};
|
|
148
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
2
|
-
import { openTypeAheadAtCursor } from '../transforms/open-typeahead-at-cursor';
|
|
3
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
export function inputRulePlugin(schema, typeAheads, featureFlags) {
|
|
5
|
-
if (!typeAheads || typeAheads.length === 0) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
const rules = typeAheads.reduce((acc, typeAhead) => {
|
|
9
|
-
const trigger = typeAhead.customRegex || typeAhead.trigger;
|
|
10
|
-
if (!trigger) {
|
|
11
|
-
return acc;
|
|
12
|
-
}
|
|
13
|
-
const regex = new RegExp(`(^|[.!?\\s${leafNodeReplacementCharacter}])(${trigger})$`);
|
|
14
|
-
acc.push(createRule(regex, (state, match) => {
|
|
15
|
-
return openTypeAheadAtCursor({
|
|
16
|
-
triggerHandler: typeAhead,
|
|
17
|
-
inputMethod: INPUT_METHOD.KEYBOARD
|
|
18
|
-
})({
|
|
19
|
-
tr: state.tr
|
|
20
|
-
});
|
|
21
|
-
}));
|
|
22
|
-
return acc;
|
|
23
|
-
}, []);
|
|
24
|
-
const plugin = createPlugin('type-ahead', rules, {
|
|
25
|
-
allowInsertTextOnDocument: false
|
|
26
|
-
});
|
|
27
|
-
return plugin;
|
|
28
|
-
}
|
|
29
|
-
export default inputRulePlugin;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ACTIONS } from './actions';
|
|
3
|
-
import { isInsertionTransaction } from './utils';
|
|
4
|
-
export function createPlugin() {
|
|
5
|
-
return new SafePlugin({
|
|
6
|
-
appendTransaction(transactions, _oldState, newState) {
|
|
7
|
-
const insertItemCallback = isInsertionTransaction(transactions, ACTIONS.INSERT_ITEM);
|
|
8
|
-
if (insertItemCallback) {
|
|
9
|
-
const tr = insertItemCallback(newState);
|
|
10
|
-
if (tr) {
|
|
11
|
-
return tr;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
|
|
4
|
-
import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from '../constants';
|
|
5
|
-
import { ACTIONS } from './actions';
|
|
6
|
-
import { pluginKey } from './key';
|
|
7
|
-
import { closest } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { createReducer } from './reducer';
|
|
9
|
-
import { factoryDecorations } from './decorations';
|
|
10
|
-
import { isInsertionTransaction } from './utils';
|
|
11
|
-
const hasValidTypeAheadStep = tr => {
|
|
12
|
-
const steps = tr.steps.filter(step => step instanceof InsertTypeAheadStep);
|
|
13
|
-
|
|
14
|
-
// There are some cases, like collab rebase, where the steps are re-applied
|
|
15
|
-
// We should not re open the type-ahead for those cases
|
|
16
|
-
if (steps.length === 1) {
|
|
17
|
-
return steps[0];
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
export function createPlugin({
|
|
22
|
-
reactDispatch,
|
|
23
|
-
popupMountRef,
|
|
24
|
-
createAnalyticsEvent,
|
|
25
|
-
typeAheadHandlers,
|
|
26
|
-
getIntl
|
|
27
|
-
}) {
|
|
28
|
-
const intl = getIntl();
|
|
29
|
-
const {
|
|
30
|
-
createDecorations,
|
|
31
|
-
removeDecorations
|
|
32
|
-
} = factoryDecorations({
|
|
33
|
-
intl,
|
|
34
|
-
popupMountRef,
|
|
35
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
36
|
-
});
|
|
37
|
-
const reducer = createReducer({
|
|
38
|
-
createDecorations,
|
|
39
|
-
removeDecorations,
|
|
40
|
-
typeAheadHandlers,
|
|
41
|
-
popupMountRef
|
|
42
|
-
});
|
|
43
|
-
return new SafePlugin({
|
|
44
|
-
key: pluginKey,
|
|
45
|
-
state: {
|
|
46
|
-
init() {
|
|
47
|
-
return {
|
|
48
|
-
typeAheadHandlers,
|
|
49
|
-
query: '',
|
|
50
|
-
decorationSet: DecorationSet.empty,
|
|
51
|
-
decorationElement: null,
|
|
52
|
-
items: [],
|
|
53
|
-
selectedIndex: -1,
|
|
54
|
-
stats: null,
|
|
55
|
-
inputMethod: null
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
apply(tr, currentPluginState, oldEditorState, state) {
|
|
59
|
-
const customStep = hasValidTypeAheadStep(tr);
|
|
60
|
-
const nextPluginState = reducer(tr, currentPluginState, customStep);
|
|
61
|
-
if (currentPluginState !== nextPluginState) {
|
|
62
|
-
reactDispatch(pluginKey, nextPluginState);
|
|
63
|
-
}
|
|
64
|
-
return nextPluginState;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
appendTransaction(transactions, _oldState, newState) {
|
|
68
|
-
const insertItemCallback = isInsertionTransaction(transactions, ACTIONS.INSERT_RAW_QUERY);
|
|
69
|
-
if (insertItemCallback) {
|
|
70
|
-
const tr = insertItemCallback(newState);
|
|
71
|
-
if (tr) {
|
|
72
|
-
return tr;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
view() {
|
|
77
|
-
return {
|
|
78
|
-
update(editorView) {}
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
props: {
|
|
82
|
-
decorations: state => {
|
|
83
|
-
var _pluginKey$getState;
|
|
84
|
-
return (_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
|
|
85
|
-
},
|
|
86
|
-
handleDOMEvents: {
|
|
87
|
-
compositionend: (view, event) => {
|
|
88
|
-
return false;
|
|
89
|
-
},
|
|
90
|
-
click: (view, event) => {
|
|
91
|
-
const {
|
|
92
|
-
target
|
|
93
|
-
} = event;
|
|
94
|
-
// ProseMirror view listen to any click event inside of it
|
|
95
|
-
// When this event is coming from the typeahead
|
|
96
|
-
// we should tell to ProseMirror to sit down and relax
|
|
97
|
-
// cuz we know what we are doing (I hope)
|
|
98
|
-
if (target instanceof HTMLElement && closest(target, `[data-type-ahead=${TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE}]`)) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { InsertTypeAheadStep, InsertTypeAheadStages } from '@atlaskit/adf-schema/steps';
|
|
3
|
-
import { ACTIONS } from './actions';
|
|
4
|
-
import { pluginKey } from './key';
|
|
5
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { isTypeAheadHandler } from '../utils';
|
|
7
|
-
const shouldForceOpen = step => {
|
|
8
|
-
if (!(step instanceof InsertTypeAheadStep)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const isDeletionRawQueryOperation = step.isInsertionStep() && step.stage === InsertTypeAheadStages.DELETING_RAW_QUERY;
|
|
12
|
-
const isUndoingInsertionItem = step.isUndoingStep() && step.stage === InsertTypeAheadStages.INSERTING_ITEM;
|
|
13
|
-
return isDeletionRawQueryOperation || isUndoingInsertionItem;
|
|
14
|
-
};
|
|
15
|
-
const shouldForceClose = step => {
|
|
16
|
-
if (!(step instanceof InsertTypeAheadStep)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
const isInsertingItem = step.isInsertionStep() && step.stage === InsertTypeAheadStages.INSERTING_ITEM;
|
|
20
|
-
const isUndoingDeletionRawQuery = step.isUndoingStep() && step.stage === InsertTypeAheadStages.DELETING_RAW_QUERY;
|
|
21
|
-
return isInsertingItem || isUndoingDeletionRawQuery;
|
|
22
|
-
};
|
|
23
|
-
const createFindHandler = typeAheadHandlers => step => {
|
|
24
|
-
if (!(step instanceof InsertTypeAheadStep)) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const handler = typeAheadHandlers.find(h => h.trigger === step.trigger);
|
|
28
|
-
return handler || null;
|
|
29
|
-
};
|
|
30
|
-
export const createReducer = ({
|
|
31
|
-
typeAheadHandlers,
|
|
32
|
-
removeDecorations,
|
|
33
|
-
createDecorations
|
|
34
|
-
}) => {
|
|
35
|
-
const findHandler = createFindHandler(typeAheadHandlers);
|
|
36
|
-
const openMenu = (currentPluginState, {
|
|
37
|
-
tr,
|
|
38
|
-
triggerHandler,
|
|
39
|
-
inputMethod,
|
|
40
|
-
reopenQuery,
|
|
41
|
-
selectedIndex
|
|
42
|
-
}) => {
|
|
43
|
-
removeDecorations(currentPluginState.decorationSet);
|
|
44
|
-
const {
|
|
45
|
-
decorationSet,
|
|
46
|
-
decorationElement,
|
|
47
|
-
stats
|
|
48
|
-
} = createDecorations(tr, {
|
|
49
|
-
triggerHandler,
|
|
50
|
-
inputMethod,
|
|
51
|
-
reopenQuery
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
...currentPluginState,
|
|
55
|
-
stats,
|
|
56
|
-
decorationSet,
|
|
57
|
-
triggerHandler,
|
|
58
|
-
decorationElement,
|
|
59
|
-
inputMethod,
|
|
60
|
-
selectedIndex: typeof selectedIndex === 'number' ? selectedIndex : -1,
|
|
61
|
-
items: [],
|
|
62
|
-
query: reopenQuery || ''
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
const closeMenu = currentPluginState => {
|
|
66
|
-
removeDecorations(currentPluginState.decorationSet);
|
|
67
|
-
return {
|
|
68
|
-
...currentPluginState,
|
|
69
|
-
inputMethod: null,
|
|
70
|
-
query: '',
|
|
71
|
-
decorationElement: null,
|
|
72
|
-
decorationSet: DecorationSet.empty,
|
|
73
|
-
stats: null,
|
|
74
|
-
triggerHandler: undefined,
|
|
75
|
-
items: []
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
return (tr, currentPluginState, typeAheadStepOverride) => {
|
|
79
|
-
const meta = tr.getMeta(pluginKey) || {};
|
|
80
|
-
|
|
81
|
-
// This code below controls when we should force
|
|
82
|
-
// the menu to open or close during undo/redo operations
|
|
83
|
-
const overrideHandler = findHandler(typeAheadStepOverride);
|
|
84
|
-
if (typeAheadStepOverride && overrideHandler && shouldForceOpen(typeAheadStepOverride)) {
|
|
85
|
-
return openMenu(currentPluginState, {
|
|
86
|
-
tr,
|
|
87
|
-
triggerHandler: overrideHandler,
|
|
88
|
-
inputMethod: INPUT_METHOD.KEYBOARD,
|
|
89
|
-
reopenQuery: typeAheadStepOverride.query,
|
|
90
|
-
selectedIndex: typeAheadStepOverride.selectedIndex
|
|
91
|
-
});
|
|
92
|
-
} else if (shouldForceClose(typeAheadStepOverride)) {
|
|
93
|
-
return closeMenu(currentPluginState);
|
|
94
|
-
}
|
|
95
|
-
const {
|
|
96
|
-
action,
|
|
97
|
-
params
|
|
98
|
-
} = meta || {};
|
|
99
|
-
const shouldOpenMenu = action === ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR && isTypeAheadHandler(params === null || params === void 0 ? void 0 : params.triggerHandler);
|
|
100
|
-
const selectionChanged = tr.selectionSet && (tr.isGeneric || Boolean(tr.getMeta('pointer')));
|
|
101
|
-
const shouldCloseMenu = [ACTIONS.CLOSE_TYPE_AHEAD, ACTIONS.INSERT_ITEM].includes(action) || selectionChanged;
|
|
102
|
-
const shouldUpdateQuery = action === ACTIONS.CHANGE_QUERY;
|
|
103
|
-
const shouldUpdateListItems = action === ACTIONS.UPDATE_LIST_ITEMS;
|
|
104
|
-
const shouldUpdateSelectedIndex = action === ACTIONS.UPDATE_SELECTED_INDEX;
|
|
105
|
-
if (shouldOpenMenu) {
|
|
106
|
-
return openMenu(currentPluginState, {
|
|
107
|
-
tr,
|
|
108
|
-
triggerHandler: params.triggerHandler,
|
|
109
|
-
inputMethod: params.inputMethod
|
|
110
|
-
});
|
|
111
|
-
} else if (shouldCloseMenu) {
|
|
112
|
-
return closeMenu(currentPluginState);
|
|
113
|
-
} else if (shouldUpdateQuery) {
|
|
114
|
-
return {
|
|
115
|
-
...currentPluginState,
|
|
116
|
-
query: params.query
|
|
117
|
-
};
|
|
118
|
-
} else if (shouldUpdateListItems) {
|
|
119
|
-
const {
|
|
120
|
-
items
|
|
121
|
-
} = params;
|
|
122
|
-
const {
|
|
123
|
-
selectedIndex
|
|
124
|
-
} = currentPluginState;
|
|
125
|
-
return {
|
|
126
|
-
...currentPluginState,
|
|
127
|
-
items,
|
|
128
|
-
selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
|
|
129
|
-
};
|
|
130
|
-
} else if (shouldUpdateSelectedIndex) {
|
|
131
|
-
return {
|
|
132
|
-
...currentPluginState,
|
|
133
|
-
selectedIndex: params.selectedIndex
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
if (tr.docChanged) {
|
|
137
|
-
const {
|
|
138
|
-
decorationSet
|
|
139
|
-
} = currentPluginState;
|
|
140
|
-
const onRemove = () => {
|
|
141
|
-
// Make sure we are unmounting the component
|
|
142
|
-
// from the react tree when this decoration is removed
|
|
143
|
-
removeDecorations(currentPluginState.decorationSet);
|
|
144
|
-
};
|
|
145
|
-
const mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
|
|
146
|
-
onRemove
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// return same pluginState if decorationSet did not change
|
|
150
|
-
if (mappedDecorationSet === currentPluginState.decorationSet) {
|
|
151
|
-
return currentPluginState;
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
...currentPluginState,
|
|
155
|
-
decorationSet: mappedDecorationSet
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
return currentPluginState;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { pluginKey } from './key';
|
|
2
|
-
export const isInsertionTransaction = (transactions, action) => {
|
|
3
|
-
var _tr$getMeta2;
|
|
4
|
-
const tr = transactions.find(tr => {
|
|
5
|
-
var _tr$getMeta;
|
|
6
|
-
return ((_tr$getMeta = tr.getMeta(pluginKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.action) === action;
|
|
7
|
-
});
|
|
8
|
-
if (!tr) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
return (_tr$getMeta2 = tr.getMeta(pluginKey)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.params;
|
|
12
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
export class StatsModifier {
|
|
3
|
-
constructor() {
|
|
4
|
-
_defineProperty(this, "startedAt", 0);
|
|
5
|
-
_defineProperty(this, "endedAt", 0);
|
|
6
|
-
_defineProperty(this, "keyCount", {
|
|
7
|
-
arrowUp: 0,
|
|
8
|
-
arrowDown: 0
|
|
9
|
-
});
|
|
10
|
-
_defineProperty(this, "increaseArrowUp", () => {
|
|
11
|
-
this.keyCount.arrowUp += 1;
|
|
12
|
-
});
|
|
13
|
-
_defineProperty(this, "increaseArrowDown", () => {
|
|
14
|
-
this.keyCount.arrowDown += 1;
|
|
15
|
-
});
|
|
16
|
-
_defineProperty(this, "serialize", () => {
|
|
17
|
-
var _this$keyCount, _this$keyCount2;
|
|
18
|
-
return {
|
|
19
|
-
startedAt: this.startedAt,
|
|
20
|
-
endedAt: performance.now(),
|
|
21
|
-
keyCount: {
|
|
22
|
-
arrowUp: ((_this$keyCount = this.keyCount) === null || _this$keyCount === void 0 ? void 0 : _this$keyCount.arrowUp) || 0,
|
|
23
|
-
arrowDown: ((_this$keyCount2 = this.keyCount) === null || _this$keyCount2 === void 0 ? void 0 : _this$keyCount2.arrowDown) || 0
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
this.startedAt = performance.now();
|
|
28
|
-
this.keyCount = {
|
|
29
|
-
arrowUp: 0,
|
|
30
|
-
arrowDown: 0
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import { pluginKey } from '../pm-plugins/key';
|
|
4
|
-
import { ACTIONS } from '../pm-plugins/actions';
|
|
5
|
-
export const openTypeAhead = props => tr => {
|
|
6
|
-
const {
|
|
7
|
-
triggerHandler,
|
|
8
|
-
inputMethod,
|
|
9
|
-
query
|
|
10
|
-
} = props;
|
|
11
|
-
tr.setMeta(pluginKey, {
|
|
12
|
-
action: ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR,
|
|
13
|
-
params: {
|
|
14
|
-
triggerHandler,
|
|
15
|
-
inputMethod,
|
|
16
|
-
query
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
export const openTypeAheadAtCursor = ({
|
|
21
|
-
triggerHandler,
|
|
22
|
-
inputMethod,
|
|
23
|
-
query
|
|
24
|
-
}) => ({
|
|
25
|
-
tr
|
|
26
|
-
}) => {
|
|
27
|
-
openTypeAhead({
|
|
28
|
-
triggerHandler,
|
|
29
|
-
inputMethod,
|
|
30
|
-
query
|
|
31
|
-
})(tr);
|
|
32
|
-
const {
|
|
33
|
-
selection
|
|
34
|
-
} = tr;
|
|
35
|
-
if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection)) {
|
|
36
|
-
return tr;
|
|
37
|
-
}
|
|
38
|
-
if (selection instanceof GapCursorSelection) {
|
|
39
|
-
// Create space for the typeahead menu in gap cursor
|
|
40
|
-
tr.insertText(' ');
|
|
41
|
-
// delete 1 pos before wherever selection is now - that will delete the empty space
|
|
42
|
-
tr.delete(tr.selection.from - 1, tr.selection.from);
|
|
43
|
-
} else {
|
|
44
|
-
var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
|
|
45
|
-
if (!selection.$cursor) {
|
|
46
|
-
tr.deleteSelection();
|
|
47
|
-
return tr;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Search & Destroy placeholder
|
|
51
|
-
const cursorPos = selection.$cursor.pos;
|
|
52
|
-
const nodeAtCursor = tr.doc.nodeAt(cursorPos);
|
|
53
|
-
const isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
|
|
54
|
-
if (nodeAtCursor && isPlaceholderAtCursorPosition) {
|
|
55
|
-
tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ME-2375 remove the superfluous '@' inserted before decoration
|
|
59
|
-
// by composition (https://github.com/ProseMirror/prosemirror/issues/903)
|
|
60
|
-
//
|
|
61
|
-
// Update:
|
|
62
|
-
// Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
|
|
63
|
-
// being inserted due to composition by checking if we have the trigger
|
|
64
|
-
// directly before the typeahead. This should not happen unless it has
|
|
65
|
-
// been eroneously added because we require whitespace/newline for typeahead.
|
|
66
|
-
if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, triggerHandler.trigger)) {
|
|
67
|
-
tr.delete(cursorPos - 1, cursorPos);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return tr;
|
|
71
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export const setSelectionBeforeQuery = rawText => tr => {
|
|
3
|
-
const currentPosition = tr.selection.$from.pos;
|
|
4
|
-
const positionBeforeRawText = Math.max(currentPosition - rawText.length, 0);
|
|
5
|
-
const resolvedPositionBeforeText = tr.doc.resolve(positionBeforeRawText);
|
|
6
|
-
const nextSelection = TextSelection.findFrom(resolvedPositionBeforeText, -1, true);
|
|
7
|
-
if (nextSelection) {
|
|
8
|
-
tr.setSelection(nextSelection);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|