@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,382 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.typeAheadPlugin = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
-
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
14
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
15
|
-
var _insertTypeAheadItem = require("./commands/insert-type-ahead-item");
|
|
16
|
-
var _updateSelectedIndex = require("./commands/update-selected-index");
|
|
17
|
-
var _inputRules = require("./pm-plugins/input-rules");
|
|
18
|
-
var _insertItemPlugin = require("./pm-plugins/insert-item-plugin");
|
|
19
|
-
var _key = require("./pm-plugins/key");
|
|
20
|
-
var _main = require("./pm-plugins/main");
|
|
21
|
-
var _statsModifier = require("./stats-modifier");
|
|
22
|
-
var _closeTypeAhead = require("./transforms/close-type-ahead");
|
|
23
|
-
var _openTypeaheadAtCursor = require("./transforms/open-typeahead-at-cursor");
|
|
24
|
-
var _useItemInsert3 = require("./ui/hooks/use-item-insert");
|
|
25
|
-
var _TypeAheadPopup = require("./ui/TypeAheadPopup");
|
|
26
|
-
var _utils = require("./utils");
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
30
|
-
*
|
|
31
|
-
* https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
var TypeAheadMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
37
|
-
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
38
|
-
var editorView = _ref.editorView,
|
|
39
|
-
popupMountRef = _ref.popupMountRef,
|
|
40
|
-
typeAheadState = _ref.typeAheadState,
|
|
41
|
-
fireAnalyticsCallback = _ref.fireAnalyticsCallback;
|
|
42
|
-
var isOpen = typeAheadState.decorationSet.find().length > 0;
|
|
43
|
-
var triggerHandler = typeAheadState.triggerHandler,
|
|
44
|
-
items = typeAheadState.items,
|
|
45
|
-
selectedIndex = typeAheadState.selectedIndex,
|
|
46
|
-
decorationElement = typeAheadState.decorationElement,
|
|
47
|
-
decorationSet = typeAheadState.decorationSet,
|
|
48
|
-
query = typeAheadState.query;
|
|
49
|
-
var _useItemInsert = (0, _useItemInsert3.useItemInsert)(triggerHandler, editorView, items),
|
|
50
|
-
_useItemInsert2 = (0, _slicedToArray2.default)(_useItemInsert, 3),
|
|
51
|
-
onItemInsert = _useItemInsert2[0],
|
|
52
|
-
onTextInsert = _useItemInsert2[1],
|
|
53
|
-
onItemMatch = _useItemInsert2[2];
|
|
54
|
-
var setSelectedItem = _react.default.useCallback(function (_ref2) {
|
|
55
|
-
var nextIndex = _ref2.index;
|
|
56
|
-
queueMicrotask(function () {
|
|
57
|
-
(0, _updateSelectedIndex.updateSelectedIndex)(nextIndex)(editorView.state, editorView.dispatch);
|
|
58
|
-
});
|
|
59
|
-
}, [editorView]);
|
|
60
|
-
var insertItem = _react.default.useCallback(function () {
|
|
61
|
-
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _typeAhead.SelectItemMode.SELECTED;
|
|
62
|
-
var index = arguments.length > 1 ? arguments[1] : undefined;
|
|
63
|
-
queueMicrotask(function () {
|
|
64
|
-
onItemInsert({
|
|
65
|
-
mode: mode,
|
|
66
|
-
index: index,
|
|
67
|
-
query: query
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}, [onItemInsert, query]);
|
|
71
|
-
var cancel = _react.default.useCallback(function (_ref3) {
|
|
72
|
-
var setSelectionAt = _ref3.setSelectionAt,
|
|
73
|
-
addPrefixTrigger = _ref3.addPrefixTrigger,
|
|
74
|
-
forceFocusOnEditor = _ref3.forceFocusOnEditor;
|
|
75
|
-
var fullQuery = addPrefixTrigger ? "".concat(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger).concat(query) : query;
|
|
76
|
-
onTextInsert({
|
|
77
|
-
forceFocusOnEditor: forceFocusOnEditor,
|
|
78
|
-
setSelectionAt: setSelectionAt,
|
|
79
|
-
text: fullQuery
|
|
80
|
-
});
|
|
81
|
-
}, [triggerHandler, onTextInsert, query]);
|
|
82
|
-
_react.default.useEffect(function () {
|
|
83
|
-
if (!isOpen || !query) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
var isLastCharSpace = query[query.length - 1] === ' ';
|
|
87
|
-
if (!isLastCharSpace) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
var result = onItemMatch({
|
|
91
|
-
mode: _typeAhead.SelectItemMode.SPACE,
|
|
92
|
-
query: query.trim()
|
|
93
|
-
});
|
|
94
|
-
if (!result) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}, [isOpen, query, onItemMatch]);
|
|
98
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(_TypeAheadPopup.TypeAheadPopup, {
|
|
102
|
-
editorView: editorView,
|
|
103
|
-
popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
|
|
104
|
-
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
105
|
-
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
106
|
-
anchorElement: decorationElement,
|
|
107
|
-
triggerHandler: triggerHandler,
|
|
108
|
-
fireAnalyticsCallback: fireAnalyticsCallback,
|
|
109
|
-
items: items,
|
|
110
|
-
selectedIndex: selectedIndex,
|
|
111
|
-
setSelectedItem: setSelectedItem,
|
|
112
|
-
onItemInsert: insertItem,
|
|
113
|
-
decorationSet: decorationSet,
|
|
114
|
-
isEmptyQuery: !query,
|
|
115
|
-
cancel: cancel
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
var createOpenAtTransaction = function createOpenAtTransaction(editorAnalyticsAPI) {
|
|
119
|
-
return function (props) {
|
|
120
|
-
return function (tr) {
|
|
121
|
-
var triggerHandler = props.triggerHandler,
|
|
122
|
-
inputMethod = props.inputMethod;
|
|
123
|
-
(0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
|
|
124
|
-
triggerHandler: triggerHandler,
|
|
125
|
-
inputMethod: inputMethod
|
|
126
|
-
})({
|
|
127
|
-
tr: tr
|
|
128
|
-
});
|
|
129
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
130
|
-
action: _analytics.ACTION.INVOKED,
|
|
131
|
-
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
132
|
-
actionSubjectId: triggerHandler.id,
|
|
133
|
-
attributes: {
|
|
134
|
-
inputMethod: inputMethod
|
|
135
|
-
},
|
|
136
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
137
|
-
})(tr);
|
|
138
|
-
return true;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef, editorAnalyticsAPI) {
|
|
143
|
-
return function (props) {
|
|
144
|
-
if (!editorViewRef.current) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
var view = editorViewRef.current;
|
|
148
|
-
var tr = view.state.tr;
|
|
149
|
-
createOpenAtTransaction(editorAnalyticsAPI)(props)(tr);
|
|
150
|
-
view.dispatch(tr);
|
|
151
|
-
return true;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
var createInsertTypeAheadItem = function createInsertTypeAheadItem(editorViewRef) {
|
|
155
|
-
return function (props) {
|
|
156
|
-
if (!editorViewRef.current) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
var view = editorViewRef.current;
|
|
160
|
-
var triggerHandler = props.triggerHandler,
|
|
161
|
-
contentItem = props.contentItem,
|
|
162
|
-
query = props.query,
|
|
163
|
-
sourceListItem = props.sourceListItem,
|
|
164
|
-
mode = props.mode;
|
|
165
|
-
(0, _insertTypeAheadItem.insertTypeAheadItem)(view)({
|
|
166
|
-
handler: triggerHandler,
|
|
167
|
-
item: contentItem,
|
|
168
|
-
mode: mode || _typeAhead.SelectItemMode.SELECTED,
|
|
169
|
-
query: query,
|
|
170
|
-
sourceListItem: sourceListItem
|
|
171
|
-
});
|
|
172
|
-
return true;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
var createFindHandlerByTrigger = function createFindHandlerByTrigger(editorViewRef) {
|
|
176
|
-
return function (trigger) {
|
|
177
|
-
if (!editorViewRef.current) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
var view = editorViewRef.current;
|
|
181
|
-
return (0, _utils.findHandler)(trigger, view.state);
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
var createCloseTypeAhead = function createCloseTypeAhead(editorViewRef) {
|
|
185
|
-
return function (options) {
|
|
186
|
-
if (!editorViewRef.current) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
var view = editorViewRef.current;
|
|
190
|
-
var currentQuery = (0, _utils.getTypeAheadQuery)(view.state) || '';
|
|
191
|
-
var state = view.state;
|
|
192
|
-
var tr = state.tr;
|
|
193
|
-
if (options.attachCommand) {
|
|
194
|
-
var fakeDispatch = function fakeDispatch(customTr) {
|
|
195
|
-
tr = customTr;
|
|
196
|
-
};
|
|
197
|
-
options.attachCommand(state, fakeDispatch);
|
|
198
|
-
}
|
|
199
|
-
(0, _closeTypeAhead.closeTypeAhead)(tr);
|
|
200
|
-
if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
|
|
201
|
-
var handler = (0, _utils.getTypeAheadHandler)(state);
|
|
202
|
-
if (!handler) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
var text = handler.trigger.concat(currentQuery);
|
|
206
|
-
tr.replaceSelectionWith(state.schema.text(text));
|
|
207
|
-
}
|
|
208
|
-
view.dispatch(tr);
|
|
209
|
-
if (!view.hasFocus()) {
|
|
210
|
-
view.focus();
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
219
|
-
*
|
|
220
|
-
* https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*/
|
|
224
|
-
var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref4) {
|
|
225
|
-
var _api$analytics, _api$analytics2;
|
|
226
|
-
var options = _ref4.config,
|
|
227
|
-
api = _ref4.api;
|
|
228
|
-
var fireAnalyticsCallback = (0, _analytics.fireAnalyticsEvent)(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
229
|
-
var popupMountRef = {
|
|
230
|
-
current: null
|
|
231
|
-
};
|
|
232
|
-
var editorViewRef = {
|
|
233
|
-
current: null
|
|
234
|
-
};
|
|
235
|
-
return {
|
|
236
|
-
name: 'typeAhead',
|
|
237
|
-
marks: function marks() {
|
|
238
|
-
// We need to keep this to make sure
|
|
239
|
-
// All documents with typeahead marks will be loaded normally
|
|
240
|
-
return [{
|
|
241
|
-
name: 'typeAheadQuery',
|
|
242
|
-
mark: _adfSchema.typeAheadQuery
|
|
243
|
-
}];
|
|
244
|
-
},
|
|
245
|
-
pmPlugins: function pmPlugins() {
|
|
246
|
-
var typeAhead = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
247
|
-
return [{
|
|
248
|
-
name: 'typeAhead',
|
|
249
|
-
plugin: function plugin(_ref5) {
|
|
250
|
-
var dispatch = _ref5.dispatch,
|
|
251
|
-
getIntl = _ref5.getIntl;
|
|
252
|
-
return (0, _main.createPlugin)({
|
|
253
|
-
getIntl: getIntl,
|
|
254
|
-
popupMountRef: popupMountRef,
|
|
255
|
-
reactDispatch: dispatch,
|
|
256
|
-
typeAheadHandlers: typeAhead,
|
|
257
|
-
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}, {
|
|
261
|
-
name: 'typeAheadEditorViewRef',
|
|
262
|
-
plugin: function plugin() {
|
|
263
|
-
return new _safePlugin.SafePlugin({
|
|
264
|
-
view: function view(_view) {
|
|
265
|
-
editorViewRef.current = _view;
|
|
266
|
-
return {
|
|
267
|
-
destroy: function destroy() {
|
|
268
|
-
editorViewRef.current = null;
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}, {
|
|
275
|
-
name: 'typeAheadInsertItem',
|
|
276
|
-
plugin: _insertItemPlugin.createPlugin
|
|
277
|
-
}, {
|
|
278
|
-
name: 'typeAheadInputRule',
|
|
279
|
-
plugin: function plugin(_ref6) {
|
|
280
|
-
var schema = _ref6.schema,
|
|
281
|
-
featureFlags = _ref6.featureFlags;
|
|
282
|
-
return (0, _inputRules.inputRulePlugin)(schema, typeAhead, featureFlags);
|
|
283
|
-
}
|
|
284
|
-
}];
|
|
285
|
-
},
|
|
286
|
-
getSharedState: function getSharedState(editorState) {
|
|
287
|
-
if (!editorState) {
|
|
288
|
-
return {
|
|
289
|
-
query: '',
|
|
290
|
-
isOpen: false,
|
|
291
|
-
isAllowed: false,
|
|
292
|
-
currentHandler: undefined
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
var isOpen = (0, _utils.isTypeAheadOpen)(editorState);
|
|
296
|
-
return {
|
|
297
|
-
query: (0, _utils.getTypeAheadQuery)(editorState) || '',
|
|
298
|
-
currentHandler: (0, _utils.getTypeAheadHandler)(editorState),
|
|
299
|
-
isOpen: isOpen,
|
|
300
|
-
isAllowed: !isOpen
|
|
301
|
-
};
|
|
302
|
-
},
|
|
303
|
-
actions: {
|
|
304
|
-
isOpen: _utils.isTypeAheadOpen,
|
|
305
|
-
isAllowed: _utils.isTypeAheadAllowed,
|
|
306
|
-
open: createOpenTypeAhead(editorViewRef, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
307
|
-
openAtTransaction: createOpenAtTransaction(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
308
|
-
findHandlerByTrigger: createFindHandlerByTrigger(editorViewRef),
|
|
309
|
-
insert: createInsertTypeAheadItem(editorViewRef),
|
|
310
|
-
close: createCloseTypeAhead(editorViewRef)
|
|
311
|
-
},
|
|
312
|
-
contentComponent: function contentComponent(_ref7) {
|
|
313
|
-
var editorView = _ref7.editorView,
|
|
314
|
-
containerElement = _ref7.containerElement,
|
|
315
|
-
popupsMountPoint = _ref7.popupsMountPoint,
|
|
316
|
-
popupsBoundariesElement = _ref7.popupsBoundariesElement,
|
|
317
|
-
popupsScrollableElement = _ref7.popupsScrollableElement,
|
|
318
|
-
wrapperElement = _ref7.wrapperElement;
|
|
319
|
-
popupMountRef.current = {
|
|
320
|
-
popupsMountPoint: popupsMountPoint || wrapperElement || undefined,
|
|
321
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
322
|
-
popupsScrollableElement: popupsScrollableElement || containerElement || undefined
|
|
323
|
-
};
|
|
324
|
-
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
325
|
-
plugins: {
|
|
326
|
-
typeAheadState: _key.pluginKey
|
|
327
|
-
},
|
|
328
|
-
render: function render(_ref8) {
|
|
329
|
-
var typeAheadState = _ref8.typeAheadState;
|
|
330
|
-
if (!typeAheadState) {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
return /*#__PURE__*/_react.default.createElement(TypeAheadMenu, {
|
|
334
|
-
editorView: editorView,
|
|
335
|
-
popupMountRef: popupMountRef,
|
|
336
|
-
typeAheadState: typeAheadState,
|
|
337
|
-
fireAnalyticsCallback: fireAnalyticsCallback
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
},
|
|
342
|
-
onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref9) {
|
|
343
|
-
var originalTransaction = _ref9.originalTransaction,
|
|
344
|
-
oldEditorState = _ref9.oldEditorState,
|
|
345
|
-
newEditorState = _ref9.newEditorState;
|
|
346
|
-
var oldPluginState = (0, _utils.getPluginState)(oldEditorState);
|
|
347
|
-
var newPluginState = (0, _utils.getPluginState)(newEditorState);
|
|
348
|
-
if (!oldPluginState || !newPluginState) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
var oldTriggerHandler = oldPluginState.triggerHandler;
|
|
352
|
-
var newTriggerHandler = newPluginState.triggerHandler;
|
|
353
|
-
var isANewHandler = oldTriggerHandler !== newTriggerHandler;
|
|
354
|
-
if (oldTriggerHandler !== null && oldTriggerHandler !== void 0 && oldTriggerHandler.dismiss && isANewHandler) {
|
|
355
|
-
var typeAheadMessage = originalTransaction.getMeta(_key.pluginKey);
|
|
356
|
-
var wasItemInserted = typeAheadMessage && typeAheadMessage.action === 'INSERT_RAW_QUERY';
|
|
357
|
-
oldTriggerHandler.dismiss({
|
|
358
|
-
editorState: newEditorState,
|
|
359
|
-
query: oldPluginState.query,
|
|
360
|
-
stats: (oldPluginState.stats || new _statsModifier.StatsModifier()).serialize(),
|
|
361
|
-
wasItemInserted: wasItemInserted
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
|
|
365
|
-
newTriggerHandler.onOpen(newEditorState);
|
|
366
|
-
}
|
|
367
|
-
if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
|
|
368
|
-
fireAnalyticsCallback({
|
|
369
|
-
payload: {
|
|
370
|
-
action: _analytics.ACTION.INVOKED,
|
|
371
|
-
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
372
|
-
actionSubjectId: newTriggerHandler.id || 'not_set',
|
|
373
|
-
attributes: {
|
|
374
|
-
inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
|
|
375
|
-
},
|
|
376
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ACTIONS = void 0;
|
|
7
|
-
var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
8
|
-
ACTIONS["OPEN_TYPEAHEAD_AT_CURSOR"] = "OPEN_TYPEAHEAD_AT_CURSOR";
|
|
9
|
-
ACTIONS["CLOSE_TYPE_AHEAD"] = "CLOSE_TYPE_AHEAD";
|
|
10
|
-
ACTIONS["CHANGE_QUERY"] = "CHANGE_QUERY";
|
|
11
|
-
ACTIONS["INSERT_ITEM"] = "INSERT_ITEM";
|
|
12
|
-
ACTIONS["INSERT_RAW_QUERY"] = "INSERT_RAW_QUERY";
|
|
13
|
-
ACTIONS["UPDATE_LIST_ITEMS"] = "UPDATE_LIST_ITEMS";
|
|
14
|
-
ACTIONS["UPDATE_SELECTED_INDEX"] = "UPDATE_SELECTED_INDEX";
|
|
15
|
-
return ACTIONS;
|
|
16
|
-
}({});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.factoryDecorations = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
11
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
-
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
14
|
-
var _w3cKeyname = require("w3c-keyname");
|
|
15
|
-
var _reactIntlNext = require("react-intl-next");
|
|
16
|
-
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
var _WrapperTypeAhead = require("../ui/WrapperTypeAhead");
|
|
19
|
-
var _statsModifier = require("../stats-modifier");
|
|
20
|
-
var _utils = require("../utils");
|
|
21
|
-
var _closeTypeAhead = require("../transforms/close-type-ahead");
|
|
22
|
-
var factoryDecorations = exports.factoryDecorations = function factoryDecorations(_ref) {
|
|
23
|
-
var intl = _ref.intl,
|
|
24
|
-
popupMountRef = _ref.popupMountRef,
|
|
25
|
-
createAnalyticsEvent = _ref.createAnalyticsEvent;
|
|
26
|
-
var createDecorations = function createDecorations(tr, _ref2) {
|
|
27
|
-
var triggerHandler = _ref2.triggerHandler,
|
|
28
|
-
inputMethod = _ref2.inputMethod,
|
|
29
|
-
reopenQuery = _ref2.reopenQuery;
|
|
30
|
-
var selection = tr.selection;
|
|
31
|
-
if (!(selection instanceof _state.TextSelection) || !selection.$cursor) {
|
|
32
|
-
return {
|
|
33
|
-
decorationSet: _view.DecorationSet.empty,
|
|
34
|
-
stats: null,
|
|
35
|
-
decorationElement: null
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
var decorationId = "decoration_id_".concat(_constants.TYPE_AHEAD_DECORATION_KEY, "_").concat((0, _uuid.default)());
|
|
39
|
-
var $cursor = selection.$cursor;
|
|
40
|
-
var typeaheadComponent = document.createElement('mark');
|
|
41
|
-
var stats = new _statsModifier.StatsModifier();
|
|
42
|
-
var shouldFocusCursorInsideQuery = true;
|
|
43
|
-
var deco = _view.Decoration.widget($cursor.pos, function (editorView, getDecorationPosition) {
|
|
44
|
-
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
45
|
-
typeaheadComponent.setAttribute('id', decorationId);
|
|
46
|
-
typeaheadComponent.setAttribute('role', 'search');
|
|
47
|
-
typeaheadComponent.dataset.typeAheadQuery = 'true';
|
|
48
|
-
typeaheadComponent.dataset.trigger = triggerHandler.trigger;
|
|
49
|
-
|
|
50
|
-
// This line below seems weird,
|
|
51
|
-
// we need that cuz the clickAreaHelper
|
|
52
|
-
// will try to hijack any click event coming
|
|
53
|
-
// from the inside of the Editor
|
|
54
|
-
// packages/editor/editor-core/src/ui/Addon/click-area-helper.ts
|
|
55
|
-
typeaheadComponent.dataset.editorPopup = 'true';
|
|
56
|
-
typeaheadComponent.dataset.typeAhead = _constants.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
|
|
57
|
-
typeaheadComponent.style.color = "var(--ds-text-accent-blue, ".concat(_colors.B400, ")");
|
|
58
|
-
typeaheadComponent.style.backgroundColor = 'transparent';
|
|
59
|
-
var onUndoRedo = function onUndoRedo(inputType) {
|
|
60
|
-
if (!['historyUndo', 'historyRedo'].includes(inputType)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
|
|
64
|
-
var currentQuery = (0, _utils.getTypeAheadQuery)(editorView.state);
|
|
65
|
-
if (hasReopenQuery || (currentQuery === null || currentQuery === void 0 ? void 0 : currentQuery.length) === 0) {
|
|
66
|
-
var command = inputType === 'historyUndo' ? _history.undo : _history.redo;
|
|
67
|
-
var _tr = editorView.state.tr;
|
|
68
|
-
var fakeDispatch = function fakeDispatch(customTr) {
|
|
69
|
-
_tr = customTr;
|
|
70
|
-
};
|
|
71
|
-
var result = command(editorView.state, fakeDispatch);
|
|
72
|
-
if (result) {
|
|
73
|
-
(0, _closeTypeAhead.closeTypeAhead)(_tr);
|
|
74
|
-
editorView.dispatch(_tr);
|
|
75
|
-
editorView.focus();
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
};
|
|
81
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
|
|
82
|
-
locale: intl.locale || 'en',
|
|
83
|
-
messages: intl.messages,
|
|
84
|
-
formats: intl.formats
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement(_WrapperTypeAhead.WrapperTypeAhead, {
|
|
86
|
-
triggerHandler: triggerHandler,
|
|
87
|
-
editorView: editorView,
|
|
88
|
-
anchorElement: typeaheadComponent,
|
|
89
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
90
|
-
inputMethod: inputMethod,
|
|
91
|
-
getDecorationPosition: getDecorationPosition,
|
|
92
|
-
shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
|
|
93
|
-
popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
|
|
94
|
-
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
95
|
-
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
96
|
-
onUndoRedo: onUndoRedo,
|
|
97
|
-
reopenQuery: reopenQuery
|
|
98
|
-
})), typeaheadComponent);
|
|
99
|
-
shouldFocusCursorInsideQuery = false;
|
|
100
|
-
return typeaheadComponent;
|
|
101
|
-
}, {
|
|
102
|
-
isTypeAheadDecoration: true,
|
|
103
|
-
key: decorationId,
|
|
104
|
-
side: 0,
|
|
105
|
-
stopEvent: function stopEvent(e) {
|
|
106
|
-
var key = (0, _w3cKeyname.keyName)(e);
|
|
107
|
-
var sel = document.getSelection();
|
|
108
|
-
if ('ArrowLeft' === key && (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
},
|
|
113
|
-
ignoreSelection: false
|
|
114
|
-
});
|
|
115
|
-
return {
|
|
116
|
-
decorationSet: _view.DecorationSet.create(tr.doc, [deco]),
|
|
117
|
-
decorationElement: typeaheadComponent,
|
|
118
|
-
stats: stats
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
var removeDecorations = function removeDecorations(decorationSet) {
|
|
122
|
-
if (!decorationSet || decorationSet === _view.DecorationSet.empty) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
var typeAheadDecorations = decorationSet.find(undefined, undefined, function (spec) {
|
|
126
|
-
return spec.isTypeAheadDecoration;
|
|
127
|
-
});
|
|
128
|
-
if (!typeAheadDecorations || typeAheadDecorations.length === 0) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
typeAheadDecorations.forEach(function (_ref3) {
|
|
132
|
-
var spec = _ref3.spec;
|
|
133
|
-
if (!spec.key) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
var decoElement = document.querySelector("#".concat(spec.key));
|
|
137
|
-
if (!decoElement) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
_reactDom.default.unmountComponentAtNode(decoElement);
|
|
141
|
-
});
|
|
142
|
-
return true;
|
|
143
|
-
};
|
|
144
|
-
return {
|
|
145
|
-
createDecorations: createDecorations,
|
|
146
|
-
removeDecorations: removeDecorations
|
|
147
|
-
};
|
|
148
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.inputRulePlugin = inputRulePlugin;
|
|
8
|
-
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
9
|
-
var _openTypeaheadAtCursor = require("../transforms/open-typeahead-at-cursor");
|
|
10
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
-
function inputRulePlugin(schema, typeAheads, featureFlags) {
|
|
12
|
-
if (!typeAheads || typeAheads.length === 0) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
var rules = typeAheads.reduce(function (acc, typeAhead) {
|
|
16
|
-
var trigger = typeAhead.customRegex || typeAhead.trigger;
|
|
17
|
-
if (!trigger) {
|
|
18
|
-
return acc;
|
|
19
|
-
}
|
|
20
|
-
var regex = new RegExp("(^|[.!?\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(").concat(trigger, ")$"));
|
|
21
|
-
acc.push((0, _prosemirrorInputRules.createRule)(regex, function (state, match) {
|
|
22
|
-
return (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
|
|
23
|
-
triggerHandler: typeAhead,
|
|
24
|
-
inputMethod: _analytics.INPUT_METHOD.KEYBOARD
|
|
25
|
-
})({
|
|
26
|
-
tr: state.tr
|
|
27
|
-
});
|
|
28
|
-
}));
|
|
29
|
-
return acc;
|
|
30
|
-
}, []);
|
|
31
|
-
var plugin = (0, _prosemirrorInputRules.createPlugin)('type-ahead', rules, {
|
|
32
|
-
allowInsertTextOnDocument: false
|
|
33
|
-
});
|
|
34
|
-
return plugin;
|
|
35
|
-
}
|
|
36
|
-
var _default = exports.default = inputRulePlugin;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createPlugin = createPlugin;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _actions = require("./actions");
|
|
9
|
-
var _utils = require("./utils");
|
|
10
|
-
function createPlugin() {
|
|
11
|
-
return new _safePlugin.SafePlugin({
|
|
12
|
-
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
13
|
-
var insertItemCallback = (0, _utils.isInsertionTransaction)(transactions, _actions.ACTIONS.INSERT_ITEM);
|
|
14
|
-
if (insertItemCallback) {
|
|
15
|
-
var tr = insertItemCallback(newState);
|
|
16
|
-
if (tr) {
|
|
17
|
-
return tr;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|