@atlaskit/editor-core 148.0.0 → 149.0.3
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 +110 -0
- package/dist/cjs/create-editor/create-plugins-list.js +6 -1
- package/dist/cjs/editor.js +1 -4
- package/dist/cjs/index.js +24 -40
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/cjs/plugins/analytics/plugin.js +9 -7
- package/dist/cjs/plugins/analytics/types/enums.js +5 -0
- package/dist/cjs/plugins/analytics/types/type-ahead.js +5 -0
- package/dist/cjs/plugins/block-type/messages.js +10 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/collab-edit/participants.js +15 -0
- package/dist/cjs/plugins/collab-edit/plugin-state.js +14 -0
- package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/cjs/plugins/collab-edit/ui/avatars.js +19 -2
- package/dist/cjs/plugins/collab-edit/utils.js +42 -2
- package/dist/cjs/plugins/date/actions.js +4 -2
- package/dist/cjs/plugins/date/index.js +1 -1
- package/dist/cjs/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/cjs/plugins/emoji/index.js +143 -120
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -14
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +3 -7
- package/dist/cjs/plugins/extension/actions.js +16 -16
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/cjs/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -14
- package/dist/cjs/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +35 -0
- package/dist/cjs/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +38 -0
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -7
- package/dist/cjs/plugins/help-dialog/ui/index.js +12 -18
- package/dist/cjs/plugins/help-dialog/ui/styles.js +2 -6
- package/dist/cjs/plugins/hyperlink/index.js +4 -10
- package/dist/cjs/plugins/insert-block/index.js +9 -8
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +7 -3
- package/dist/cjs/plugins/list/index.js +5 -0
- package/dist/cjs/plugins/macro/actions.js +14 -14
- package/dist/cjs/plugins/media/index.js +1 -0
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +26 -14
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +86 -0
- package/dist/cjs/plugins/media/toolbar/index.js +161 -44
- package/dist/cjs/plugins/media/toolbar/utils.js +77 -0
- package/dist/cjs/plugins/mentions/index.js +57 -602
- package/dist/cjs/plugins/mentions/pm-plugins/key.js +11 -0
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +162 -0
- package/dist/cjs/plugins/mentions/pm-plugins/utils.js +12 -0
- package/dist/cjs/plugins/mentions/type-ahead/index.js +449 -0
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +3 -1
- package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +8 -3
- package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +3 -3
- package/dist/cjs/plugins/mentions/utils.js +24 -2
- package/dist/cjs/plugins/panel/index.js +46 -13
- package/dist/cjs/plugins/panel/nodeviews/panel.js +39 -25
- package/dist/cjs/plugins/panel/toolbar.js +94 -6
- package/dist/cjs/plugins/panel/toolbar.test.js +149 -16
- package/dist/cjs/plugins/paste/handlers.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/cjs/plugins/placeholder/index.js +6 -0
- package/dist/cjs/plugins/quick-insert/api.js +30 -0
- package/dist/cjs/plugins/quick-insert/assets/custom-panel.js +55 -0
- package/dist/cjs/plugins/quick-insert/assets/index.js +14 -1
- package/dist/cjs/plugins/quick-insert/index.js +10 -24
- package/dist/cjs/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/rule/index.js +1 -25
- package/dist/cjs/plugins/scroll-into-view/index.js +1 -4
- package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/cjs/plugins/status/actions.js +5 -2
- package/dist/cjs/plugins/status/plugin.js +1 -1
- package/dist/cjs/plugins/table/commands/selection.js +24 -24
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +3 -1
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +3 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/cjs/plugins/type-ahead/api.js +243 -0
- package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +238 -0
- package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +30 -0
- package/dist/cjs/plugins/type-ahead/commands/update-query.js +16 -18
- package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +36 -0
- package/dist/cjs/plugins/type-ahead/constants.js +25 -0
- package/dist/cjs/plugins/type-ahead/index.js +183 -52
- package/dist/cjs/plugins/type-ahead/insert-utils.js +132 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +12 -9
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +238 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +20 -40
- package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +28 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +79 -424
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +188 -0
- package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +26 -0
- package/dist/cjs/plugins/type-ahead/stats-modifier.js +49 -0
- package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +18 -0
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +51 -0
- package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +24 -0
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +77 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +325 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +195 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +141 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +141 -0
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +151 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +118 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +132 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +61 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +50 -0
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +70 -0
- package/dist/cjs/plugins/type-ahead/utils.js +127 -0
- package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
- package/dist/cjs/plugins/view-update-subscription/index.js +19 -14
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
- package/dist/cjs/plugins/view-update-subscription/subscribe/type-ahead-updates.js +46 -0
- package/dist/cjs/test-utils.js +17 -0
- package/dist/cjs/types/empty-state-handler.js +5 -0
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +4 -21
- package/dist/cjs/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +16 -23
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +11 -4
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/cjs/ui/PanelTextInput/index.js +1 -3
- package/dist/cjs/utils/compare.js +7 -7
- package/dist/cjs/utils/index.js +7 -8
- package/dist/cjs/utils/rich-media-utils.js +2 -2
- package/dist/cjs/utils/selection.js +6 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +6 -1
- package/dist/es2019/editor.js +1 -4
- package/dist/es2019/index.js +4 -6
- package/dist/es2019/labs/next/presets/default.js +2 -2
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/es2019/plugins/analytics/plugin.js +5 -1
- package/dist/es2019/plugins/analytics/types/enums.js +5 -0
- package/dist/es2019/plugins/analytics/types/type-ahead.js +1 -0
- package/dist/es2019/plugins/block-type/messages.js +10 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/es2019/plugins/collab-edit/participants.js +14 -0
- package/dist/es2019/plugins/collab-edit/plugin-state.js +17 -1
- package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/es2019/plugins/collab-edit/ui/avatars.js +17 -2
- package/dist/es2019/plugins/collab-edit/utils.js +34 -0
- package/dist/es2019/plugins/date/actions.js +4 -2
- package/dist/es2019/plugins/date/index.js +1 -1
- package/dist/es2019/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/es2019/plugins/emoji/index.js +169 -146
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -11
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +3 -6
- package/dist/es2019/plugins/extension/actions.js +16 -16
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/es2019/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
- package/dist/es2019/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/es2019/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
- package/dist/es2019/plugins/help-dialog/ui/index.js +20 -26
- package/dist/es2019/plugins/help-dialog/ui/styles.js +2 -2
- package/dist/es2019/plugins/hyperlink/index.js +4 -12
- package/dist/es2019/plugins/insert-block/index.js +4 -4
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
- package/dist/es2019/plugins/list/index.js +20 -14
- package/dist/es2019/plugins/macro/actions.js +14 -14
- package/dist/es2019/plugins/media/index.js +1 -0
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +27 -12
- package/dist/es2019/plugins/media/styles.js +7 -2
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +59 -0
- package/dist/es2019/plugins/media/toolbar/index.js +158 -42
- package/dist/es2019/plugins/media/toolbar/utils.js +32 -0
- package/dist/es2019/plugins/mentions/index.js +34 -536
- package/dist/es2019/plugins/mentions/pm-plugins/key.js +2 -0
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +138 -0
- package/dist/es2019/plugins/mentions/pm-plugins/utils.js +4 -0
- package/dist/es2019/plugins/mentions/type-ahead/index.js +394 -0
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +4 -2
- package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +2 -2
- package/dist/es2019/plugins/mentions/utils.js +20 -1
- package/dist/es2019/plugins/panel/index.js +95 -62
- package/dist/es2019/plugins/panel/nodeviews/panel.js +7 -1
- package/dist/es2019/plugins/panel/toolbar.js +90 -6
- package/dist/es2019/plugins/panel/toolbar.test.js +131 -14
- package/dist/es2019/plugins/paste/handlers.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/es2019/plugins/placeholder/index.js +5 -0
- package/dist/es2019/plugins/quick-insert/api.js +18 -0
- package/dist/es2019/plugins/quick-insert/assets/custom-panel.js +45 -0
- package/dist/es2019/plugins/quick-insert/assets/index.js +6 -0
- package/dist/es2019/plugins/quick-insert/index.js +12 -23
- package/dist/es2019/plugins/quick-insert/search.js +1 -3
- package/dist/es2019/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/rule/index.js +1 -22
- package/dist/es2019/plugins/scroll-into-view/index.js +1 -3
- package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/es2019/plugins/status/actions.js +5 -2
- package/dist/es2019/plugins/status/plugin.js +1 -1
- package/dist/es2019/plugins/table/commands/selection.js +25 -25
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/es2019/plugins/type-ahead/api.js +224 -0
- package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +222 -0
- package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +19 -0
- package/dist/es2019/plugins/type-ahead/commands/update-query.js +17 -15
- package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +25 -0
- package/dist/es2019/plugins/type-ahead/constants.js +15 -0
- package/dist/es2019/plugins/type-ahead/index.js +203 -78
- package/dist/es2019/plugins/type-ahead/insert-utils.js +119 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +11 -8
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +211 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +18 -32
- package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +19 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +81 -401
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +165 -0
- package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +16 -0
- package/dist/es2019/plugins/type-ahead/stats-modifier.js +41 -0
- package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +40 -0
- package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +11 -0
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +307 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +163 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +136 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +120 -0
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +110 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +97 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +126 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +43 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +41 -0
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +53 -0
- package/dist/es2019/plugins/type-ahead/utils.js +93 -0
- package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +29 -2
- package/dist/es2019/plugins/view-update-subscription/index.js +19 -14
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +9 -3
- package/dist/es2019/plugins/view-update-subscription/subscribe/type-ahead-updates.js +34 -0
- package/dist/es2019/test-utils.js +7 -0
- package/dist/es2019/types/empty-state-handler.js +1 -0
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +4 -8
- package/dist/es2019/ui/ConfigPanel/transformers.js +9 -9
- package/dist/es2019/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +20 -21
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +9 -2
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/es2019/ui/PanelTextInput/index.js +1 -3
- package/dist/es2019/utils/compare.js +7 -7
- package/dist/es2019/utils/index.js +7 -8
- package/dist/es2019/utils/rich-media-utils.js +2 -2
- package/dist/es2019/utils/selection.js +6 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +6 -1
- package/dist/esm/editor.js +1 -4
- package/dist/esm/index.js +4 -6
- package/dist/esm/labs/next/presets/default.js +2 -2
- package/dist/esm/messages.js +5 -0
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +1 -2
- package/dist/esm/plugins/analytics/plugin.js +8 -6
- package/dist/esm/plugins/analytics/types/enums.js +5 -0
- package/dist/esm/plugins/analytics/types/type-ahead.js +1 -0
- package/dist/esm/plugins/block-type/messages.js +10 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/esm/plugins/collab-edit/participants.js +15 -0
- package/dist/esm/plugins/collab-edit/plugin-state.js +15 -1
- package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
- package/dist/esm/plugins/collab-edit/ui/avatars.js +17 -2
- package/dist/esm/plugins/collab-edit/utils.js +32 -0
- package/dist/esm/plugins/date/actions.js +4 -2
- package/dist/esm/plugins/date/index.js +1 -1
- package/dist/esm/plugins/date/pm-plugins/utils.js +6 -1
- package/dist/esm/plugins/emoji/index.js +136 -112
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -13
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +3 -6
- package/dist/esm/plugins/extension/actions.js +16 -16
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
- package/dist/esm/plugins/extension/ui/Extension/index.js +2 -2
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
- package/dist/esm/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/esm/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
- package/dist/esm/plugins/help-dialog/ui/index.js +13 -19
- package/dist/esm/plugins/help-dialog/ui/styles.js +2 -6
- package/dist/esm/plugins/hyperlink/index.js +4 -10
- package/dist/esm/plugins/insert-block/index.js +5 -5
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
- package/dist/esm/plugins/list/index.js +5 -0
- package/dist/esm/plugins/macro/actions.js +14 -14
- package/dist/esm/plugins/media/index.js +1 -0
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +27 -14
- package/dist/esm/plugins/media/styles.js +2 -2
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +62 -0
- package/dist/esm/plugins/media/toolbar/index.js +154 -43
- package/dist/esm/plugins/media/toolbar/utils.js +60 -0
- package/dist/esm/plugins/mentions/index.js +45 -557
- package/dist/esm/plugins/mentions/pm-plugins/key.js +2 -0
- package/dist/esm/plugins/mentions/pm-plugins/main.js +145 -0
- package/dist/esm/plugins/mentions/pm-plugins/utils.js +4 -0
- package/dist/esm/plugins/mentions/type-ahead/index.js +415 -0
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +2 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +4 -2
- package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +2 -2
- package/dist/esm/plugins/mentions/utils.js +19 -0
- package/dist/esm/plugins/panel/index.js +44 -13
- package/dist/esm/plugins/panel/nodeviews/panel.js +36 -22
- package/dist/esm/plugins/panel/toolbar.js +92 -6
- package/dist/esm/plugins/panel/toolbar.test.js +148 -16
- package/dist/esm/plugins/paste/handlers.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +6 -3
- package/dist/esm/plugins/placeholder/index.js +5 -0
- package/dist/esm/plugins/quick-insert/api.js +20 -0
- package/dist/esm/plugins/quick-insert/assets/custom-panel.js +45 -0
- package/dist/esm/plugins/quick-insert/assets/index.js +12 -0
- package/dist/esm/plugins/quick-insert/index.js +10 -24
- package/dist/esm/plugins/quick-insert/search.js +1 -3
- package/dist/esm/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/rule/index.js +1 -22
- package/dist/esm/plugins/scroll-into-view/index.js +1 -3
- package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
- package/dist/esm/plugins/status/actions.js +5 -2
- package/dist/esm/plugins/status/plugin.js +1 -1
- package/dist/esm/plugins/table/commands/selection.js +24 -24
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
- package/dist/esm/plugins/type-ahead/api.js +228 -0
- package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +217 -0
- package/dist/esm/plugins/type-ahead/commands/update-list-items.js +19 -0
- package/dist/esm/plugins/type-ahead/commands/update-query.js +13 -13
- package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +25 -0
- package/dist/esm/plugins/type-ahead/constants.js +15 -0
- package/dist/esm/plugins/type-ahead/index.js +173 -53
- package/dist/esm/plugins/type-ahead/insert-utils.js +116 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +11 -8
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +204 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +18 -33
- package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +18 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +80 -393
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +168 -0
- package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +16 -0
- package/dist/esm/plugins/type-ahead/stats-modifier.js +43 -0
- package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +39 -0
- package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +13 -0
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +302 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +168 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +105 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +114 -0
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +125 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +101 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +118 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +46 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +38 -0
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +48 -0
- package/dist/esm/plugins/type-ahead/utils.js +88 -0
- package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
- package/dist/esm/plugins/view-update-subscription/index.js +19 -14
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
- package/dist/esm/plugins/view-update-subscription/subscribe/type-ahead-updates.js +33 -0
- package/dist/esm/test-utils.js +7 -0
- package/dist/esm/types/empty-state-handler.js +1 -0
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +4 -14
- package/dist/esm/ui/ElementBrowser/ElementBrowser.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +16 -23
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +10 -3
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
- package/dist/esm/ui/PanelTextInput/index.js +1 -3
- package/dist/esm/utils/compare.js +7 -7
- package/dist/esm/utils/index.js +7 -8
- package/dist/esm/utils/rich-media-utils.js +2 -2
- package/dist/esm/utils/selection.js +6 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/labs/next/full-page.d.ts +1 -1
- package/dist/types/labs/next/mobile.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/alignment/commands/index.d.ts +2 -2
- package/dist/types/plugins/analytics/types/enums.d.ts +6 -1
- package/dist/types/plugins/analytics/types/events.d.ts +12 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +2 -23
- package/dist/types/plugins/analytics/types/type-ahead.d.ts +27 -0
- package/dist/types/plugins/block-type/messages.d.ts +10 -0
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/collab-edit/participants.d.ts +1 -0
- package/dist/types/plugins/collab-edit/ui/avatars.d.ts +3 -1
- package/dist/types/plugins/collab-edit/ui/invite-to-edit.d.ts +1 -1
- package/dist/types/plugins/collab-edit/utils.d.ts +4 -2
- package/dist/types/plugins/date/actions.d.ts +1 -1
- package/dist/types/plugins/date/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -4
- package/dist/types/plugins/emoji/types.d.ts +2 -2
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/Extension/styles.d.ts +1 -1
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -3
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
- package/dist/types/plugins/find-replace/ui/styles.d.ts +3 -3
- package/dist/types/plugins/floating-toolbar/ui/EditorEmojiAddIcon.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +1 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -0
- package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +7 -0
- package/dist/types/plugins/media/toolbar/utils.d.ts +4 -0
- package/dist/types/plugins/media/types.d.ts +3 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
- package/dist/types/plugins/mentions/analytics.d.ts +1 -1
- package/dist/types/plugins/mentions/index.d.ts +4 -30
- package/dist/types/plugins/mentions/pm-plugins/key.d.ts +3 -0
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +8 -0
- package/dist/types/plugins/mentions/pm-plugins/utils.d.ts +3 -0
- package/dist/types/plugins/mentions/type-ahead/index.d.ts +17 -0
- package/dist/types/plugins/mentions/types.d.ts +2 -0
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +1 -0
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +2 -0
- package/dist/types/plugins/mentions/utils.d.ts +4 -0
- package/dist/types/plugins/panel/nodeviews/panel.d.ts +19 -3
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -0
- package/dist/types/plugins/quick-insert/api.d.ts +6 -0
- package/dist/types/plugins/quick-insert/assets/custom-panel.d.ts +1 -0
- package/dist/types/plugins/quick-insert/assets/index.d.ts +1 -0
- package/dist/types/plugins/quick-insert/search.d.ts +1 -1
- package/dist/types/plugins/quick-insert/types.d.ts +3 -0
- package/dist/types/plugins/status/actions.d.ts +3 -1
- package/dist/types/plugins/status/ui/statusPicker.d.ts +1 -1
- package/dist/types/plugins/type-ahead/api.d.ts +53 -0
- package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +12 -0
- package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +3 -0
- package/dist/types/plugins/type-ahead/commands/update-query.d.ts +2 -2
- package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +2 -0
- package/dist/types/plugins/type-ahead/constants.d.ts +10 -0
- package/dist/types/plugins/type-ahead/index.d.ts +5 -4
- package/dist/types/plugins/type-ahead/insert-utils.d.ts +18 -0
- package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +9 -8
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +24 -0
- package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -1
- package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +2 -0
- package/dist/types/plugins/type-ahead/pm-plugins/{plugin-key.d.ts → key.d.ts} +0 -0
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +12 -39
- package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +10 -0
- package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +4 -0
- package/dist/types/plugins/type-ahead/stats-modifier.d.ts +20 -0
- package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +2 -0
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +9 -0
- package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +2 -0
- package/dist/types/plugins/type-ahead/types.d.ts +95 -30
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +21 -0
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +22 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +11 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +15 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +22 -0
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +20 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +25 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +11 -0
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +9 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +18 -0
- package/dist/types/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +9 -0
- package/dist/types/test-utils.d.ts +2 -0
- package/dist/types/types/editor-props.d.ts +2 -0
- package/dist/types/types/empty-state-handler.d.ts +7 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/ElementBrowser.d.ts +2 -0
- package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +2 -0
- package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +5 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +3 -1
- package/dist/types/ui/LinkSearch/index.d.ts +20 -20
- package/dist/types/ui/PortalProvider/index.d.ts +1 -1
- package/dist/types/ui/ToolbarButton/index.d.ts +4 -4
- package/dist/types/ui/ToolbarButton/styles.d.ts +2 -2
- package/dist/types/utils/selection.d.ts +2 -2
- package/package.json +32 -29
- package/dist/cjs/plugins/emoji/commands/insert-emoji-query.js +0 -22
- package/dist/cjs/plugins/mentions/commands/insert-mention-query.js +0 -22
- package/dist/cjs/plugins/type-ahead/commands/dismiss.js +0 -44
- package/dist/cjs/plugins/type-ahead/commands/insert-query.js +0 -38
- package/dist/cjs/plugins/type-ahead/commands/items-list-updated.js +0 -25
- package/dist/cjs/plugins/type-ahead/commands/select-item.js +0 -163
- package/dist/cjs/plugins/type-ahead/commands/set-current-index.js +0 -25
- package/dist/cjs/plugins/type-ahead/pm-plugins/keymap.js +0 -115
- package/dist/cjs/plugins/type-ahead/ui/TypeAhead.js +0 -221
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -239
- package/dist/cjs/plugins/type-ahead/utils/find-query-mark.js +0 -33
- package/dist/cjs/plugins/type-ahead/utils/is-query-active.js +0 -16
- package/dist/es2019/plugins/emoji/commands/insert-emoji-query.js +0 -13
- package/dist/es2019/plugins/mentions/commands/insert-mention-query.js +0 -13
- package/dist/es2019/plugins/type-ahead/commands/dismiss.js +0 -36
- package/dist/es2019/plugins/type-ahead/commands/insert-query.js +0 -26
- package/dist/es2019/plugins/type-ahead/commands/items-list-updated.js +0 -12
- package/dist/es2019/plugins/type-ahead/commands/select-item.js +0 -119
- package/dist/es2019/plugins/type-ahead/commands/set-current-index.js +0 -13
- package/dist/es2019/plugins/type-ahead/pm-plugins/keymap.js +0 -94
- package/dist/es2019/plugins/type-ahead/ui/TypeAhead.js +0 -175
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -196
- package/dist/es2019/plugins/type-ahead/utils/find-query-mark.js +0 -29
- package/dist/es2019/plugins/type-ahead/utils/is-query-active.js +0 -9
- package/dist/esm/plugins/emoji/commands/insert-emoji-query.js +0 -13
- package/dist/esm/plugins/mentions/commands/insert-mention-query.js +0 -13
- package/dist/esm/plugins/type-ahead/commands/dismiss.js +0 -33
- package/dist/esm/plugins/type-ahead/commands/insert-query.js +0 -26
- package/dist/esm/plugins/type-ahead/commands/items-list-updated.js +0 -14
- package/dist/esm/plugins/type-ahead/commands/select-item.js +0 -132
- package/dist/esm/plugins/type-ahead/commands/set-current-index.js +0 -15
- package/dist/esm/plugins/type-ahead/pm-plugins/keymap.js +0 -94
- package/dist/esm/plugins/type-ahead/ui/TypeAhead.js +0 -202
- package/dist/esm/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -204
- package/dist/esm/plugins/type-ahead/utils/find-query-mark.js +0 -24
- package/dist/esm/plugins/type-ahead/utils/is-query-active.js +0 -9
- package/dist/types/plugins/emoji/commands/insert-emoji-query.d.ts +0 -2
- package/dist/types/plugins/mentions/commands/insert-mention-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/dismiss.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/insert-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/items-list-updated.d.ts +0 -3
- package/dist/types/plugins/type-ahead/commands/select-item.d.ts +0 -9
- package/dist/types/plugins/type-ahead/commands/set-current-index.d.ts +0 -2
- package/dist/types/plugins/type-ahead/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/TypeAhead.d.ts +0 -37
- package/dist/types/plugins/type-ahead/ui/TypeAheadItemsList.d.ts +0 -32
- package/dist/types/plugins/type-ahead/utils/find-query-mark.d.ts +0 -10
- package/dist/types/plugins/type-ahead/utils/is-query-active.d.ts +0 -2
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { Node as PMNode, Fragment } from 'prosemirror-model';
|
|
2
|
+
import { InsertTypeAheadStep, InsertTypeAheadStages } from '@atlaskit/adf-schema/steps';
|
|
3
|
+
import { closeHistory } from 'prosemirror-history';
|
|
4
|
+
import { pluginKey } from '../pm-plugins/key';
|
|
5
|
+
import { insertBlockNode, insertInlineNodeOrFragment } from '../insert-utils';
|
|
6
|
+
import { StatsModifier } from '../stats-modifier';
|
|
7
|
+
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
+
import { ACTIONS } from '../pm-plugins/actions';
|
|
9
|
+
import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
10
|
+
import { getPluginState } from '../utils';
|
|
11
|
+
|
|
12
|
+
const validateNode = ({
|
|
13
|
+
schema,
|
|
14
|
+
maybeNode
|
|
15
|
+
}) => {
|
|
16
|
+
if (!maybeNode) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (maybeNode instanceof PMNode || maybeNode instanceof Fragment) {
|
|
21
|
+
return maybeNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof maybeNode === 'string') {
|
|
25
|
+
return schema.text(maybeNode);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
return PMNode.fromJSON(schema, maybeNode);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error(e);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const createInsertCallback = ({
|
|
38
|
+
editorState: state,
|
|
39
|
+
handler,
|
|
40
|
+
query,
|
|
41
|
+
mode,
|
|
42
|
+
wasInsertedBySpace,
|
|
43
|
+
selectedIndex,
|
|
44
|
+
textStartPosition,
|
|
45
|
+
textInserted
|
|
46
|
+
}) => (maybeNode, opts = {}) => {
|
|
47
|
+
const {
|
|
48
|
+
tr
|
|
49
|
+
} = state;
|
|
50
|
+
const position = {
|
|
51
|
+
start: textStartPosition,
|
|
52
|
+
end: textStartPosition + (wasInsertedBySpace ? textInserted.length : 0)
|
|
53
|
+
};
|
|
54
|
+
const node = validateNode({
|
|
55
|
+
schema: state.schema,
|
|
56
|
+
maybeNode
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (!node) {
|
|
60
|
+
closeTypeAhead(tr); // In this kind of situation we need to
|
|
61
|
+
// delete the raw text query
|
|
62
|
+
|
|
63
|
+
tr.delete(position.start, position.end);
|
|
64
|
+
return tr;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
node instanceof PMNode && node.isBlock ? insertBlockNode({
|
|
68
|
+
node,
|
|
69
|
+
tr,
|
|
70
|
+
position
|
|
71
|
+
}) : insertInlineNodeOrFragment({
|
|
72
|
+
maybeFragment: node,
|
|
73
|
+
tr,
|
|
74
|
+
position,
|
|
75
|
+
selectInlineNode: Boolean(opts.selectInlineNode)
|
|
76
|
+
});
|
|
77
|
+
closeHistory(tr);
|
|
78
|
+
|
|
79
|
+
if (wasInsertedBySpace) {
|
|
80
|
+
return tr;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const config = {
|
|
84
|
+
stage: InsertTypeAheadStages.INSERTING_ITEM,
|
|
85
|
+
query,
|
|
86
|
+
selectedIndex,
|
|
87
|
+
trigger: handler.trigger
|
|
88
|
+
};
|
|
89
|
+
tr.step(new InsertTypeAheadStep(config));
|
|
90
|
+
return tr;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const createDeleteRawTextCallback = ({
|
|
94
|
+
trigger,
|
|
95
|
+
selectedIndex,
|
|
96
|
+
position,
|
|
97
|
+
query,
|
|
98
|
+
wasInsertedBySpace,
|
|
99
|
+
insertItem
|
|
100
|
+
}) => {
|
|
101
|
+
return newState => {
|
|
102
|
+
const tr = newState.tr;
|
|
103
|
+
closeHistory(tr);
|
|
104
|
+
|
|
105
|
+
if (!wasInsertedBySpace) {
|
|
106
|
+
tr.delete(position.start, position.end);
|
|
107
|
+
const config = {
|
|
108
|
+
stage: InsertTypeAheadStages.DELETING_RAW_QUERY,
|
|
109
|
+
selectedIndex,
|
|
110
|
+
query,
|
|
111
|
+
trigger
|
|
112
|
+
};
|
|
113
|
+
tr.step(new InsertTypeAheadStep(config));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
tr.setMeta(pluginKey, {
|
|
117
|
+
action: ACTIONS.INSERT_ITEM,
|
|
118
|
+
params: insertItem
|
|
119
|
+
});
|
|
120
|
+
return tr;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const insertTypeAheadItem = view => ({
|
|
125
|
+
item,
|
|
126
|
+
handler,
|
|
127
|
+
mode,
|
|
128
|
+
query,
|
|
129
|
+
sourceListItem
|
|
130
|
+
}) => {
|
|
131
|
+
const pluginState = getPluginState(view.state);
|
|
132
|
+
|
|
133
|
+
if (!pluginState) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const stats = (pluginState.stats || new StatsModifier()).serialize();
|
|
138
|
+
const meta = {
|
|
139
|
+
mode,
|
|
140
|
+
query,
|
|
141
|
+
stats,
|
|
142
|
+
sourceListItem
|
|
143
|
+
};
|
|
144
|
+
const {
|
|
145
|
+
tr
|
|
146
|
+
} = view.state;
|
|
147
|
+
const trigger = handler.trigger;
|
|
148
|
+
let text = `${trigger}${query}`;
|
|
149
|
+
|
|
150
|
+
if (mode === SelectItemMode.SPACE) {
|
|
151
|
+
text = text.trim().concat(' ');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const selectedIndex = Math.max(sourceListItem.indexOf(item), 0);
|
|
155
|
+
const wasInsertedBySpace = mode === SelectItemMode.SPACE;
|
|
156
|
+
const {
|
|
157
|
+
selection: {
|
|
158
|
+
from: textStartPosition
|
|
159
|
+
}
|
|
160
|
+
} = tr;
|
|
161
|
+
|
|
162
|
+
const insertItem = newEditorSate => {
|
|
163
|
+
const insertCallback = createInsertCallback({
|
|
164
|
+
editorState: newEditorSate,
|
|
165
|
+
query,
|
|
166
|
+
mode,
|
|
167
|
+
handler,
|
|
168
|
+
wasInsertedBySpace,
|
|
169
|
+
selectedIndex,
|
|
170
|
+
textInserted: text,
|
|
171
|
+
textStartPosition
|
|
172
|
+
});
|
|
173
|
+
let wasInsertCallbackCalled = false; // Some wierd plugins doesn't call the insert item callback
|
|
174
|
+
// For example, the link quick insert item
|
|
175
|
+
// For those cases we need to make sure we are closing the typeahead
|
|
176
|
+
|
|
177
|
+
const proxyHandler = {
|
|
178
|
+
apply: function (target, _thisContext, argumentsList) {
|
|
179
|
+
wasInsertCallbackCalled = true;
|
|
180
|
+
return target(...argumentsList);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const insertCallbackProxy = new Proxy(insertCallback, proxyHandler);
|
|
184
|
+
const nextTr = handler.selectItem(newEditorSate, item, insertCallbackProxy, meta);
|
|
185
|
+
|
|
186
|
+
if (!wasInsertCallbackCalled && nextTr) {
|
|
187
|
+
closeHistory(nextTr); // In some cases we need to re-open the typeahead
|
|
188
|
+
// e.g.: addign mentions from the quick insert
|
|
189
|
+
//
|
|
190
|
+
// Today, the QuickInsert API doesn't have a tool
|
|
191
|
+
// to help on this. So the code below will close the typeahead
|
|
192
|
+
// only if there is no previous metadata about typeahead in the
|
|
193
|
+
// next transaction
|
|
194
|
+
|
|
195
|
+
if (!nextTr.getMeta(pluginKey)) {
|
|
196
|
+
closeTypeAhead(nextTr);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return nextTr;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const position = {
|
|
204
|
+
start: tr.selection.from,
|
|
205
|
+
end: tr.selection.from + text.length
|
|
206
|
+
};
|
|
207
|
+
tr.setMeta(pluginKey, {
|
|
208
|
+
action: ACTIONS.INSERT_RAW_QUERY,
|
|
209
|
+
params: createDeleteRawTextCallback({
|
|
210
|
+
wasInsertedBySpace,
|
|
211
|
+
selectedIndex,
|
|
212
|
+
insertItem,
|
|
213
|
+
position,
|
|
214
|
+
query,
|
|
215
|
+
trigger
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
tr.insertText(text);
|
|
219
|
+
closeHistory(tr);
|
|
220
|
+
view.dispatch(tr);
|
|
221
|
+
view.focus();
|
|
222
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pluginKey as typeAheadPluginKey } from '../pm-plugins/key';
|
|
2
|
+
import { ACTIONS } from '../pm-plugins/actions';
|
|
3
|
+
export const updateListItem = items => {
|
|
4
|
+
return (state, dispatch) => {
|
|
5
|
+
const tr = state.tr;
|
|
6
|
+
tr.setMeta(typeAheadPluginKey, {
|
|
7
|
+
action: ACTIONS.UPDATE_LIST_ITEMS,
|
|
8
|
+
params: {
|
|
9
|
+
items
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (dispatch) {
|
|
14
|
+
dispatch(tr);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
import { pluginKey as typeAheadPluginKey } from '../pm-plugins/key';
|
|
1
2
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const updateQueryCommand = query => (state, dispatch) => {
|
|
6
|
-
const queryMark = findTypeAheadQuery(state);
|
|
7
|
-
const activeQuery = isQueryActive(state.schema.marks.typeAheadQuery, state.doc, state.selection.from, state.selection.to);
|
|
3
|
+
export const updateQuery = query => {
|
|
4
|
+
return (state, dispatch) => {
|
|
5
|
+
const pluginState = typeAheadPluginKey.getState(state);
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
if (pluginState.query === query) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
action: ACTIONS.
|
|
11
|
+
const tr = state.tr;
|
|
12
|
+
tr.setMeta(typeAheadPluginKey, {
|
|
13
|
+
action: ACTIONS.CHANGE_QUERY,
|
|
16
14
|
params: {
|
|
17
15
|
query
|
|
18
16
|
}
|
|
19
|
-
})
|
|
20
|
-
}
|
|
17
|
+
});
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
if (dispatch) {
|
|
20
|
+
dispatch(tr);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
23
25
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { pluginKey as typeAheadPluginKey } from '../pm-plugins/key';
|
|
2
|
+
import { ACTIONS } from '../pm-plugins/actions';
|
|
3
|
+
export const updateSelectedIndex = selectedIndex => {
|
|
4
|
+
return (state, dispatch) => {
|
|
5
|
+
const pluginState = typeAheadPluginKey.getState(state);
|
|
6
|
+
|
|
7
|
+
if (pluginState.selectedIndex === selectedIndex) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const tr = state.tr;
|
|
12
|
+
tr.setMeta(typeAheadPluginKey, {
|
|
13
|
+
action: ACTIONS.UPDATE_SELECTED_INDEX,
|
|
14
|
+
params: {
|
|
15
|
+
selectedIndex
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (dispatch) {
|
|
20
|
+
dispatch(tr);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const TYPE_AHEAD_DECORATION_KEY = 'typeahead_decoration_key';
|
|
2
|
+
export const TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE = 'typeaheadDecoration';
|
|
3
|
+
export let NavigationDirection;
|
|
4
|
+
|
|
5
|
+
(function (NavigationDirection) {
|
|
6
|
+
NavigationDirection[NavigationDirection["LEFT"] = -1] = "LEFT";
|
|
7
|
+
NavigationDirection[NavigationDirection["RIGHT"] = 1] = "RIGHT";
|
|
8
|
+
})(NavigationDirection || (NavigationDirection = {}));
|
|
9
|
+
|
|
10
|
+
export let CloseSelectionOptions;
|
|
11
|
+
|
|
12
|
+
(function (CloseSelectionOptions) {
|
|
13
|
+
CloseSelectionOptions["BEFORE_TEXT_INSERTED"] = "BEFORE_TEXT_INSERTED";
|
|
14
|
+
CloseSelectionOptions["AFTER_TEXT_INSERTED"] = "AFTER_TEXT_INSERTED";
|
|
15
|
+
})(CloseSelectionOptions || (CloseSelectionOptions = {}));
|
|
@@ -1,91 +1,216 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
+
import { createPlugin } from './pm-plugins/main';
|
|
4
|
+
import { createPlugin as createInsertItemPlugin } from './pm-plugins/insert-item-plugin';
|
|
3
5
|
import WithPluginState from '../../ui/WithPluginState';
|
|
6
|
+
import { typeAheadQuery } from '@atlaskit/adf-schema';
|
|
7
|
+
import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
|
|
4
8
|
import { inputRulePlugin } from './pm-plugins/input-rules';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
9
|
+
import { TypeAheadPopup } from './ui/TypeAheadPopup';
|
|
10
|
+
import { getPluginState } from './utils';
|
|
11
|
+
import { useItemInsert } from './ui/hooks/use-item-insert';
|
|
12
|
+
import { updateSelectedIndex } from './commands/update-selected-index';
|
|
13
|
+
import { StatsModifier } from './stats-modifier';
|
|
14
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '../analytics';
|
|
15
|
+
const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
16
|
+
editorView,
|
|
17
|
+
popupMountRef,
|
|
18
|
+
typeAheadState,
|
|
19
|
+
fireAnalyticsCallback
|
|
20
|
+
}) => {
|
|
21
|
+
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
22
|
+
|
|
23
|
+
const isOpen = typeAheadState.decorationSet.find().length > 0;
|
|
24
|
+
const {
|
|
25
|
+
triggerHandler,
|
|
26
|
+
items,
|
|
27
|
+
selectedIndex,
|
|
28
|
+
decorationElement,
|
|
29
|
+
decorationSet,
|
|
30
|
+
query
|
|
31
|
+
} = typeAheadState;
|
|
32
|
+
const [onItemInsert,, onItemMatch] = useItemInsert(triggerHandler, editorView, items);
|
|
33
|
+
const setSelectedItem = React.useCallback(({
|
|
34
|
+
index: nextIndex
|
|
35
|
+
}) => {
|
|
36
|
+
queueMicrotask(() => {
|
|
37
|
+
updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
|
|
38
|
+
});
|
|
39
|
+
}, [editorView]);
|
|
40
|
+
const insertItem = React.useCallback((mode = SelectItemMode.SELECTED, index) => {
|
|
41
|
+
queueMicrotask(() => {
|
|
42
|
+
onItemInsert({
|
|
43
|
+
mode,
|
|
44
|
+
index,
|
|
45
|
+
query
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}, [onItemInsert, query]);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (!isOpen || !query) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const isLastCharSpace = query[query.length - 1] === ' ';
|
|
55
|
+
|
|
56
|
+
if (!isLastCharSpace) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const result = onItemMatch({
|
|
61
|
+
mode: SelectItemMode.SPACE,
|
|
62
|
+
query: query.trim()
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!result) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}, [isOpen, query, onItemMatch]);
|
|
69
|
+
|
|
70
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/React.createElement(TypeAheadPopup, {
|
|
75
|
+
editorView: editorView,
|
|
76
|
+
popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
|
|
77
|
+
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
78
|
+
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
79
|
+
anchorElement: decorationElement,
|
|
80
|
+
triggerHandler: triggerHandler,
|
|
81
|
+
fireAnalyticsCallback: fireAnalyticsCallback,
|
|
82
|
+
items: items,
|
|
83
|
+
selectedIndex: selectedIndex,
|
|
84
|
+
setSelectedItem: setSelectedItem,
|
|
85
|
+
onItemInsert: insertItem,
|
|
86
|
+
decorationSet: decorationSet,
|
|
87
|
+
isEmptyQuery: !query
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const typeAheadPlugin = options => {
|
|
92
|
+
const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
93
|
+
const popupMountRef = {
|
|
94
|
+
current: null
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
name: 'typeAhead',
|
|
54
98
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
99
|
+
marks() {
|
|
100
|
+
// We need to keep this to make sure
|
|
101
|
+
// All documents with typeahead marks will be loaded normaly
|
|
102
|
+
return [{
|
|
103
|
+
name: 'typeAheadQuery',
|
|
104
|
+
mark: typeAheadQuery
|
|
105
|
+
}];
|
|
106
|
+
},
|
|
59
107
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
108
|
+
pmPlugins(typeAhead = []) {
|
|
109
|
+
return [{
|
|
110
|
+
name: 'typeAhead',
|
|
111
|
+
plugin: ({
|
|
112
|
+
dispatch,
|
|
113
|
+
reactContext
|
|
114
|
+
}) => createPlugin({
|
|
115
|
+
reactContext,
|
|
116
|
+
popupMountRef,
|
|
117
|
+
reactDispatch: dispatch,
|
|
118
|
+
typeAheadHandlers: typeAhead,
|
|
119
|
+
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
|
|
120
|
+
})
|
|
121
|
+
}, {
|
|
122
|
+
name: 'typeAheadInsertItem',
|
|
123
|
+
plugin: createInsertItemPlugin
|
|
124
|
+
}, {
|
|
125
|
+
name: 'typeAheadInputRule',
|
|
126
|
+
plugin: ({
|
|
127
|
+
schema,
|
|
128
|
+
featureFlags
|
|
129
|
+
}) => inputRulePlugin(schema, typeAhead, featureFlags)
|
|
130
|
+
}];
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
contentComponent({
|
|
134
|
+
editorView,
|
|
135
|
+
containerElement,
|
|
136
|
+
popupsMountPoint,
|
|
137
|
+
popupsBoundariesElement,
|
|
138
|
+
popupsScrollableElement
|
|
139
|
+
}) {
|
|
140
|
+
popupMountRef.current = {
|
|
141
|
+
popupsMountPoint: popupsMountPoint || containerElement || undefined,
|
|
142
|
+
popupsBoundariesElement,
|
|
143
|
+
popupsScrollableElement
|
|
144
|
+
};
|
|
145
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
146
|
+
plugins: {
|
|
147
|
+
typeAheadState: typeAheadPluginKey
|
|
148
|
+
},
|
|
149
|
+
render: ({
|
|
150
|
+
typeAheadState
|
|
151
|
+
}) => {
|
|
152
|
+
if (!typeAheadState) {
|
|
65
153
|
return null;
|
|
66
154
|
}
|
|
155
|
+
|
|
156
|
+
return /*#__PURE__*/React.createElement(TypeAheadMenu, {
|
|
157
|
+
editorView: editorView,
|
|
158
|
+
popupMountRef: popupMountRef,
|
|
159
|
+
typeAheadState: typeAheadState,
|
|
160
|
+
fireAnalyticsCallback: fireAnalyticsCallback
|
|
161
|
+
});
|
|
67
162
|
}
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
onEditorViewStateUpdated({
|
|
167
|
+
oldEditorState,
|
|
168
|
+
newEditorState
|
|
169
|
+
}) {
|
|
170
|
+
const oldPluginState = getPluginState(oldEditorState);
|
|
171
|
+
const newPluginState = getPluginState(newEditorState);
|
|
172
|
+
|
|
173
|
+
if (!oldPluginState || !newPluginState) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const {
|
|
178
|
+
triggerHandler: oldTriggerHandler
|
|
179
|
+
} = oldPluginState;
|
|
180
|
+
const {
|
|
181
|
+
triggerHandler: newTriggerHandler
|
|
182
|
+
} = newPluginState;
|
|
183
|
+
const isANewHandler = oldTriggerHandler !== newTriggerHandler;
|
|
68
184
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
75
|
-
anchorElement: anchorElement,
|
|
76
|
-
active: typeAhead.active,
|
|
77
|
-
isLoading: !!typeAhead.itemsLoader,
|
|
78
|
-
items: typeAhead.items,
|
|
79
|
-
currentIndex: typeAhead.currentIndex,
|
|
80
|
-
highlight: typeAhead.highlight,
|
|
81
|
-
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent,
|
|
82
|
-
query: typeAhead.query
|
|
185
|
+
if (oldTriggerHandler !== null && oldTriggerHandler !== void 0 && oldTriggerHandler.dismiss && isANewHandler) {
|
|
186
|
+
oldTriggerHandler.dismiss({
|
|
187
|
+
editorState: newEditorState,
|
|
188
|
+
query: oldPluginState.query,
|
|
189
|
+
stats: (oldPluginState.stats || new StatsModifier()).serialize()
|
|
83
190
|
});
|
|
84
191
|
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
192
|
|
|
88
|
-
|
|
193
|
+
if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
|
|
194
|
+
newTriggerHandler.onOpen(newEditorState);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
|
|
198
|
+
fireAnalyticsCallback({
|
|
199
|
+
payload: {
|
|
200
|
+
action: ACTION.INVOKED,
|
|
201
|
+
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
202
|
+
actionSubjectId: newTriggerHandler.id || 'not_set',
|
|
203
|
+
attributes: {
|
|
204
|
+
inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
|
|
205
|
+
},
|
|
206
|
+
eventType: EVENT_TYPE.UI
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
};
|
|
213
|
+
};
|
|
89
214
|
|
|
90
|
-
export
|
|
91
|
-
export
|
|
215
|
+
export default typeAheadPlugin;
|
|
216
|
+
export { typeAheadPluginKey };
|