@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,308 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
9
|
-
var _templateObject;
|
|
10
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
/** @jsx jsx */
|
|
13
|
-
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { css, jsx } from '@emotion/react';
|
|
16
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
17
|
-
import { Popup } from '@atlaskit/editor-common/ui';
|
|
18
|
-
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
19
|
-
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
20
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
21
|
-
import { N0 } from '@atlaskit/theme/colors';
|
|
22
|
-
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
23
|
-
import { DEFAULT_STATUS } from '../actions';
|
|
24
|
-
import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
|
|
25
|
-
var PopupWithListeners = withOuterListeners(Popup);
|
|
26
|
-
export var InputMethod = /*#__PURE__*/function (InputMethod) {
|
|
27
|
-
InputMethod["blur"] = "blur";
|
|
28
|
-
InputMethod["escKey"] = "escKey";
|
|
29
|
-
InputMethod["enterKey"] = "enterKey";
|
|
30
|
-
return InputMethod;
|
|
31
|
-
}({});
|
|
32
|
-
export var closingMethods = /*#__PURE__*/function (closingMethods) {
|
|
33
|
-
closingMethods["ArrowLeft"] = "arrowLeft";
|
|
34
|
-
closingMethods["ArrowRight"] = "arrowRight";
|
|
35
|
-
return closingMethods;
|
|
36
|
-
}({});
|
|
37
|
-
var pickerContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n :focus {\n outline: none;\n }\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(N0, ")"), "var(--ds-space-100, 8px)", borderRadius(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
|
|
38
|
-
export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
|
|
39
|
-
_inherits(StatusPickerWithoutAnalytcs, _React$Component);
|
|
40
|
-
var _super = _createSuper(StatusPickerWithoutAnalytcs);
|
|
41
|
-
function StatusPickerWithoutAnalytcs(props) {
|
|
42
|
-
var _this;
|
|
43
|
-
_classCallCheck(this, StatusPickerWithoutAnalytcs);
|
|
44
|
-
_this = _super.call(this, props);
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (event) {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
_this.inputMethod = InputMethod.blur;
|
|
48
|
-
var selectedText = window.getSelection();
|
|
49
|
-
if (!selectedText) {
|
|
50
|
-
_this.props.closeStatusPicker();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "handleEscapeKeydown", function (event) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
_this.inputMethod = InputMethod.escKey;
|
|
56
|
-
_this.props.onEnter(_this.state);
|
|
57
|
-
});
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "handleTabPress", function (event) {
|
|
59
|
-
var colorButtons = event.currentTarget.querySelectorAll('button');
|
|
60
|
-
var inputField = event.currentTarget.querySelector('input');
|
|
61
|
-
var isInputFocussed = document.activeElement === inputField;
|
|
62
|
-
var isButtonFocussed = Array.from(colorButtons).some(function (buttonElement) {
|
|
63
|
-
var _document;
|
|
64
|
-
return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
|
|
65
|
-
});
|
|
66
|
-
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
67
|
-
/* shift + tab */
|
|
68
|
-
if (isInputFocussed) {
|
|
69
|
-
colorButtons[0].focus();
|
|
70
|
-
event.preventDefault();
|
|
71
|
-
}
|
|
72
|
-
/* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
|
|
73
|
-
To correctly set focus to the input field instead of the first color button we need to set focus manually
|
|
74
|
-
*/
|
|
75
|
-
if (isButtonFocussed) {
|
|
76
|
-
inputField === null || inputField === void 0 || inputField.focus();
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
/* tab */
|
|
81
|
-
if (isButtonFocussed) {
|
|
82
|
-
inputField === null || inputField === void 0 || inputField.focus();
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "handleArrow", function (event, closingMethod) {
|
|
88
|
-
var _document2;
|
|
89
|
-
if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === _this.popupBodyWrapper.current) {
|
|
90
|
-
var _this$popupBodyWrappe;
|
|
91
|
-
event.preventDefault();
|
|
92
|
-
(_this$popupBodyWrappe = _this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 || (_this$popupBodyWrappe = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe === void 0 || _this$popupBodyWrappe.blur();
|
|
93
|
-
_this.props.closeStatusPicker({
|
|
94
|
-
closingMethod: closingMethod
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
99
|
-
var isTabPressed = event.key === 'Tab';
|
|
100
|
-
if (isTabPressed) {
|
|
101
|
-
return _this.handleTabPress(event);
|
|
102
|
-
}
|
|
103
|
-
if (event.key in closingMethods) {
|
|
104
|
-
return _this.handleArrow(event, closingMethods[event.key]);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "onColorHover", function (color) {
|
|
108
|
-
_this.createStatusAnalyticsAndFireFunc({
|
|
109
|
-
action: 'hovered',
|
|
110
|
-
actionSubject: 'statusColorPicker',
|
|
111
|
-
attributes: {
|
|
112
|
-
color: color,
|
|
113
|
-
localId: _this.state.localId,
|
|
114
|
-
state: analyticsState(_this.props.isNew)
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
_defineProperty(_assertThisInitialized(_this), "onColorClick", function (color) {
|
|
119
|
-
var _this$state = _this.state,
|
|
120
|
-
text = _this$state.text,
|
|
121
|
-
localId = _this$state.localId;
|
|
122
|
-
if (color === _this.state.color) {
|
|
123
|
-
_this.createStatusAnalyticsAndFireFunc({
|
|
124
|
-
action: 'clicked',
|
|
125
|
-
actionSubject: 'statusColorPicker',
|
|
126
|
-
attributes: {
|
|
127
|
-
color: color,
|
|
128
|
-
localId: localId,
|
|
129
|
-
state: analyticsState(_this.props.isNew)
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
// closes status box and commits colour
|
|
133
|
-
_this.onEnter();
|
|
134
|
-
} else {
|
|
135
|
-
_this.setState({
|
|
136
|
-
color: color
|
|
137
|
-
});
|
|
138
|
-
_this.props.onSelect({
|
|
139
|
-
text: text,
|
|
140
|
-
color: color,
|
|
141
|
-
localId: localId
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
_defineProperty(_assertThisInitialized(_this), "onTextChanged", function (text) {
|
|
146
|
-
var _this$state2 = _this.state,
|
|
147
|
-
color = _this$state2.color,
|
|
148
|
-
localId = _this$state2.localId;
|
|
149
|
-
_this.setState({
|
|
150
|
-
text: text
|
|
151
|
-
});
|
|
152
|
-
_this.props.onTextChanged({
|
|
153
|
-
text: text,
|
|
154
|
-
color: color,
|
|
155
|
-
localId: localId
|
|
156
|
-
}, !!_this.props.isNew);
|
|
157
|
-
});
|
|
158
|
-
_defineProperty(_assertThisInitialized(_this), "onEnter", function () {
|
|
159
|
-
_this.inputMethod = InputMethod.enterKey;
|
|
160
|
-
_this.props.onEnter(_this.state);
|
|
161
|
-
});
|
|
162
|
-
// cancel bubbling to fix clickOutside logic:
|
|
163
|
-
// popup re-renders its content before the click event bubbles up to the document
|
|
164
|
-
// therefore click target element would be different from the popup content
|
|
165
|
-
_defineProperty(_assertThisInitialized(_this), "handlePopupClick", function (event) {
|
|
166
|
-
return event.nativeEvent.stopImmediatePropagation();
|
|
167
|
-
});
|
|
168
|
-
_this.state = _this.extractStateFromProps(props);
|
|
169
|
-
_this.createStatusAnalyticsAndFireFunc = createStatusAnalyticsAndFire(props.createAnalyticsEvent);
|
|
170
|
-
_this.popupBodyWrapper = /*#__PURE__*/React.createRef();
|
|
171
|
-
return _this;
|
|
172
|
-
}
|
|
173
|
-
_createClass(StatusPickerWithoutAnalytcs, [{
|
|
174
|
-
key: "fireStatusPopupOpenedAnalytics",
|
|
175
|
-
value: function fireStatusPopupOpenedAnalytics(state) {
|
|
176
|
-
var color = state.color,
|
|
177
|
-
text = state.text,
|
|
178
|
-
localId = state.localId,
|
|
179
|
-
isNew = state.isNew;
|
|
180
|
-
this.startTime = Date.now();
|
|
181
|
-
this.createStatusAnalyticsAndFireFunc({
|
|
182
|
-
action: 'opened',
|
|
183
|
-
actionSubject: 'statusPopup',
|
|
184
|
-
attributes: {
|
|
185
|
-
textLength: text ? text.length : 0,
|
|
186
|
-
selectedColor: color,
|
|
187
|
-
localId: localId,
|
|
188
|
-
state: analyticsState(isNew)
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}, {
|
|
193
|
-
key: "fireStatusPopupClosedAnalytics",
|
|
194
|
-
value: function fireStatusPopupClosedAnalytics(state) {
|
|
195
|
-
var color = state.color,
|
|
196
|
-
text = state.text,
|
|
197
|
-
localId = state.localId,
|
|
198
|
-
isNew = state.isNew;
|
|
199
|
-
this.createStatusAnalyticsAndFireFunc({
|
|
200
|
-
action: 'closed',
|
|
201
|
-
actionSubject: 'statusPopup',
|
|
202
|
-
attributes: {
|
|
203
|
-
inputMethod: this.inputMethod,
|
|
204
|
-
duration: Date.now() - this.startTime,
|
|
205
|
-
textLength: text ? text.length : 0,
|
|
206
|
-
selectedColor: color,
|
|
207
|
-
localId: localId,
|
|
208
|
-
state: analyticsState(isNew)
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}, {
|
|
213
|
-
key: "reset",
|
|
214
|
-
value: function reset() {
|
|
215
|
-
this.startTime = Date.now();
|
|
216
|
-
this.inputMethod = InputMethod.blur;
|
|
217
|
-
}
|
|
218
|
-
}, {
|
|
219
|
-
key: "componentDidMount",
|
|
220
|
-
value: function componentDidMount() {
|
|
221
|
-
var _this2 = this;
|
|
222
|
-
this.reset();
|
|
223
|
-
this.fireStatusPopupOpenedAnalytics(this.state);
|
|
224
|
-
if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
|
|
225
|
-
// Wrapper should be focused only if status already exists otherwise input field will receive focus
|
|
226
|
-
this.focusTimeout = requestAnimationFrame(function () {
|
|
227
|
-
var _this2$popupBodyWrapp;
|
|
228
|
-
// Defer to prevent editor scrolling to top. See https://product-fabric.atlassian.net/browse/DTR-1952
|
|
229
|
-
(_this2$popupBodyWrapp = _this2.popupBodyWrapper) === null || _this2$popupBodyWrapp === void 0 || (_this2$popupBodyWrapp = _this2$popupBodyWrapp.current) === null || _this2$popupBodyWrapp === void 0 || _this2$popupBodyWrapp.focus();
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
key: "componentWillUnmount",
|
|
235
|
-
value: function componentWillUnmount() {
|
|
236
|
-
this.focusTimeout && cancelAnimationFrame(this.focusTimeout);
|
|
237
|
-
this.fireStatusPopupClosedAnalytics(this.state);
|
|
238
|
-
this.startTime = 0;
|
|
239
|
-
}
|
|
240
|
-
}, {
|
|
241
|
-
key: "componentDidUpdate",
|
|
242
|
-
value: function componentDidUpdate(prevProps, prevState, _snapshot) {
|
|
243
|
-
var element = this.props.target;
|
|
244
|
-
if (prevProps.target !== element) {
|
|
245
|
-
var newState = this.extractStateFromProps(this.props);
|
|
246
|
-
this.setState(newState);
|
|
247
|
-
this.fireStatusPopupClosedAnalytics(prevState);
|
|
248
|
-
this.reset();
|
|
249
|
-
this.fireStatusPopupOpenedAnalytics(newState);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}, {
|
|
253
|
-
key: "extractStateFromProps",
|
|
254
|
-
value: function extractStateFromProps(props) {
|
|
255
|
-
var defaultColor = props.defaultColor,
|
|
256
|
-
defaultText = props.defaultText,
|
|
257
|
-
defaultLocalId = props.defaultLocalId,
|
|
258
|
-
isNew = props.isNew;
|
|
259
|
-
return {
|
|
260
|
-
color: defaultColor || DEFAULT_STATUS.color,
|
|
261
|
-
text: defaultText || DEFAULT_STATUS.text,
|
|
262
|
-
localId: defaultLocalId,
|
|
263
|
-
isNew: isNew
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}, {
|
|
267
|
-
key: "render",
|
|
268
|
-
value: function render() {
|
|
269
|
-
var _this$props = this.props,
|
|
270
|
-
isNew = _this$props.isNew,
|
|
271
|
-
target = _this$props.target,
|
|
272
|
-
mountTo = _this$props.mountTo,
|
|
273
|
-
boundariesElement = _this$props.boundariesElement,
|
|
274
|
-
scrollableElement = _this$props.scrollableElement;
|
|
275
|
-
var _this$state3 = this.state,
|
|
276
|
-
color = _this$state3.color,
|
|
277
|
-
text = _this$state3.text;
|
|
278
|
-
return target && jsx(PopupWithListeners, {
|
|
279
|
-
target: target,
|
|
280
|
-
offset: [0, 8],
|
|
281
|
-
handleClickOutside: this.handleClickOutside,
|
|
282
|
-
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
283
|
-
zIndex: akEditorFloatingDialogZIndex,
|
|
284
|
-
fitHeight: 40,
|
|
285
|
-
mountTo: mountTo,
|
|
286
|
-
boundariesElement: boundariesElement,
|
|
287
|
-
scrollableElement: scrollableElement,
|
|
288
|
-
closeOnTab: false
|
|
289
|
-
}, jsx("div", {
|
|
290
|
-
css: pickerContainer,
|
|
291
|
-
tabIndex: -1,
|
|
292
|
-
ref: this.popupBodyWrapper,
|
|
293
|
-
onClick: this.handlePopupClick,
|
|
294
|
-
onKeyDown: this.onKeyDown
|
|
295
|
-
}, jsx(AkStatusPicker, {
|
|
296
|
-
autoFocus: isNew,
|
|
297
|
-
selectedColor: color,
|
|
298
|
-
text: text,
|
|
299
|
-
onColorClick: this.onColorClick,
|
|
300
|
-
onColorHover: this.onColorHover,
|
|
301
|
-
onTextChanged: this.onTextChanged,
|
|
302
|
-
onEnter: this.onEnter
|
|
303
|
-
})));
|
|
304
|
-
}
|
|
305
|
-
}]);
|
|
306
|
-
return StatusPickerWithoutAnalytcs;
|
|
307
|
-
}(React.Component);
|
|
308
|
-
export default withAnalyticsEvents()(StatusPickerWithoutAnalytcs);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export var mayGetStatusAtSelection = function mayGetStatusAtSelection(selection) {
|
|
3
|
-
if (selection && selection instanceof NodeSelection) {
|
|
4
|
-
var nodeSelection = selection;
|
|
5
|
-
if (nodeSelection.node.type.name === 'status') {
|
|
6
|
-
return selection.node.attrs || null;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return null;
|
|
10
|
-
};
|
|
11
|
-
export var isEmptyStatus = function isEmptyStatus(node) {
|
|
12
|
-
return node && (node.text && node.text.trim().length === 0 || node.text === '');
|
|
13
|
-
};
|
|
14
|
-
export var setNodeSelectionNearPos = function setNodeSelectionNearPos(tr, pos) {
|
|
15
|
-
return tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(pos)));
|
|
16
|
-
};
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { TypeAheadAvailableNodes, SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
2
|
-
import { findHandler, isTypeAheadOpen, getTypeAheadHandler, getTypeAheadQuery } from './utils';
|
|
3
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
|
|
5
|
-
import { closeTypeAhead } from './transforms/close-type-ahead';
|
|
6
|
-
import { updateQuery } from './commands/update-query';
|
|
7
|
-
import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
|
|
8
|
-
var open = function open(_ref) {
|
|
9
|
-
var editorView = _ref.editorView;
|
|
10
|
-
return function (itemType) {
|
|
11
|
-
return function (inputMethod) {
|
|
12
|
-
var state = editorView.state;
|
|
13
|
-
var handler = findHandler(itemType, state);
|
|
14
|
-
if (!handler) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
var tr = state.tr;
|
|
18
|
-
openTypeAheadAtCursor({
|
|
19
|
-
triggerHandler: handler,
|
|
20
|
-
inputMethod: inputMethod
|
|
21
|
-
})({
|
|
22
|
-
tr: tr
|
|
23
|
-
});
|
|
24
|
-
editorView.dispatch(tr);
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var defaultCloseOptions = {
|
|
30
|
-
insertCurrentQueryAsRawText: false
|
|
31
|
-
};
|
|
32
|
-
var close = function close(_ref2) {
|
|
33
|
-
var editorView = _ref2.editorView;
|
|
34
|
-
return function () {
|
|
35
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultCloseOptions;
|
|
36
|
-
var state = editorView.state;
|
|
37
|
-
var currentQuery = getTypeAheadQuery(editorView.state);
|
|
38
|
-
var tr = state.tr;
|
|
39
|
-
if (options.attachCommand) {
|
|
40
|
-
var fakeDispatch = function fakeDispatch(customTr) {
|
|
41
|
-
tr = customTr;
|
|
42
|
-
};
|
|
43
|
-
options.attachCommand(state, fakeDispatch);
|
|
44
|
-
}
|
|
45
|
-
closeTypeAhead(tr);
|
|
46
|
-
if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
|
|
47
|
-
var handler = getTypeAheadHandler(state);
|
|
48
|
-
var text = handler.trigger.concat(currentQuery);
|
|
49
|
-
tr.replaceSelectionWith(state.schema.text(text));
|
|
50
|
-
}
|
|
51
|
-
editorView.dispatch(tr);
|
|
52
|
-
if (!editorView.hasFocus()) {
|
|
53
|
-
editorView.focus();
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
var search = function search(_ref3) {
|
|
59
|
-
var editorView = _ref3.editorView;
|
|
60
|
-
return function (itemType) {
|
|
61
|
-
return function () {
|
|
62
|
-
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
63
|
-
var state = editorView.state;
|
|
64
|
-
var handler = findHandler(itemType, state);
|
|
65
|
-
if (!handler) {
|
|
66
|
-
throw new Error("Handler not found, did you load the ".concat(itemType, " plugin properly"));
|
|
67
|
-
}
|
|
68
|
-
open({
|
|
69
|
-
editorView: editorView
|
|
70
|
-
})(itemType)(INPUT_METHOD.KEYBOARD);
|
|
71
|
-
updateQuery(query)(editorView.state, editorView.dispatch);
|
|
72
|
-
var lastQuery = {
|
|
73
|
-
current: query
|
|
74
|
-
};
|
|
75
|
-
var last = handler.getItems({
|
|
76
|
-
query: query,
|
|
77
|
-
editorState: state
|
|
78
|
-
}).then(function (items) {
|
|
79
|
-
if (!handler.forceSelect) {
|
|
80
|
-
return items;
|
|
81
|
-
}
|
|
82
|
-
var forceSelectedItem = handler.forceSelect({
|
|
83
|
-
items: items,
|
|
84
|
-
query: query,
|
|
85
|
-
editorState: state
|
|
86
|
-
});
|
|
87
|
-
if (!forceSelectedItem) {
|
|
88
|
-
return items;
|
|
89
|
-
}
|
|
90
|
-
insertTypeAheadItem(editorView)({
|
|
91
|
-
handler: handler,
|
|
92
|
-
item: forceSelectedItem,
|
|
93
|
-
query: query,
|
|
94
|
-
mode: SelectItemMode.SELECTED,
|
|
95
|
-
sourceListItem: items
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
var results = {
|
|
99
|
-
last: last
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
type: function type(appendValue) {
|
|
103
|
-
if (!appendValue) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
lastQuery.current += appendValue;
|
|
107
|
-
updateQuery(lastQuery.current)(editorView.state, editorView.dispatch);
|
|
108
|
-
var promise = handler.getItems({
|
|
109
|
-
query: lastQuery.current,
|
|
110
|
-
editorState: state
|
|
111
|
-
});
|
|
112
|
-
results.last = promise;
|
|
113
|
-
return promise;
|
|
114
|
-
},
|
|
115
|
-
result: function result() {
|
|
116
|
-
return results.last;
|
|
117
|
-
},
|
|
118
|
-
close: close({
|
|
119
|
-
editorView: editorView
|
|
120
|
-
}),
|
|
121
|
-
insert: function insert(_ref4) {
|
|
122
|
-
var index = _ref4.index,
|
|
123
|
-
mode = _ref4.mode;
|
|
124
|
-
return results.last.then(function (result) {
|
|
125
|
-
var item = result ? result[index] : null;
|
|
126
|
-
if (result && item) {
|
|
127
|
-
insertTypeAheadItem(editorView)({
|
|
128
|
-
handler: handler,
|
|
129
|
-
item: item,
|
|
130
|
-
query: query,
|
|
131
|
-
mode: mode || SelectItemMode.SELECTED,
|
|
132
|
-
sourceListItem: result
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
var insertItem = function insertItem(_ref5) {
|
|
142
|
-
var editorView = _ref5.editorView;
|
|
143
|
-
return function (itemType) {
|
|
144
|
-
return function (_ref6) {
|
|
145
|
-
var contentItem = _ref6.contentItem,
|
|
146
|
-
query = _ref6.query,
|
|
147
|
-
sourceListItem = _ref6.sourceListItem;
|
|
148
|
-
var state = editorView.state;
|
|
149
|
-
var handler = findHandler(itemType, state);
|
|
150
|
-
if (!handler) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
insertTypeAheadItem(editorView)({
|
|
154
|
-
handler: handler,
|
|
155
|
-
item: contentItem,
|
|
156
|
-
mode: SelectItemMode.SELECTED,
|
|
157
|
-
query: query,
|
|
158
|
-
sourceListItem: sourceListItem
|
|
159
|
-
});
|
|
160
|
-
return true;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
var isOpen = function isOpen(_ref7) {
|
|
165
|
-
var editorView = _ref7.editorView;
|
|
166
|
-
return function () {
|
|
167
|
-
if (!isTypeAheadOpen(editorView.state)) {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
var handler = getTypeAheadHandler(editorView.state);
|
|
171
|
-
if (!handler) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
return handler;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
var currentQuery = function currentQuery(_ref8) {
|
|
178
|
-
var editorView = _ref8.editorView;
|
|
179
|
-
return function () {
|
|
180
|
-
return getTypeAheadQuery(editorView.state);
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Please do not use it. Ping #help-editor and talk to the Lego team before use it.
|
|
186
|
-
*
|
|
187
|
-
* @private
|
|
188
|
-
* @deprecated
|
|
189
|
-
*
|
|
190
|
-
*/
|
|
191
|
-
export var createTypeAheadTools = function createTypeAheadTools(editorView) {
|
|
192
|
-
var props = {
|
|
193
|
-
editorView: editorView
|
|
194
|
-
};
|
|
195
|
-
return {
|
|
196
|
-
isOpen: isOpen(props),
|
|
197
|
-
currentQuery: currentQuery(props),
|
|
198
|
-
close: close(props),
|
|
199
|
-
openMention: open(props)(TypeAheadAvailableNodes.MENTION),
|
|
200
|
-
searchMention: search(props)(TypeAheadAvailableNodes.MENTION),
|
|
201
|
-
openQuickInsert: open(props)(TypeAheadAvailableNodes.QUICK_INSERT),
|
|
202
|
-
searchQuickInsert: search(props)(TypeAheadAvailableNodes.QUICK_INSERT),
|
|
203
|
-
openEmoji: open(props)(TypeAheadAvailableNodes.EMOJI),
|
|
204
|
-
searchEmoji: search(props)(TypeAheadAvailableNodes.EMOJI),
|
|
205
|
-
insertItemMention: insertItem(props)(TypeAheadAvailableNodes.MENTION),
|
|
206
|
-
insertItemEmoji: insertItem(props)(TypeAheadAvailableNodes.EMOJI),
|
|
207
|
-
insertItemQuickInsert: insertItem(props)(TypeAheadAvailableNodes.QUICK_INSERT)
|
|
208
|
-
};
|
|
209
|
-
};
|