@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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Fragment } from 'prosemirror-model';
|
|
2
|
-
import { insertSelectedItem } from '../../../utils/insert';
|
|
3
|
-
import { ACTIONS } from '../pm-plugins/actions';
|
|
4
|
-
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
5
|
-
import { findTypeAheadQuery } from '../utils/find-query-mark';
|
|
6
|
-
import { isInviteItem } from '../../mentions/utils';
|
|
7
|
-
import { dismissCommand } from './dismiss';
|
|
8
|
-
export const selectCurrentItem = (mode = 'selected') => (state, dispatch) => {
|
|
9
|
-
const {
|
|
10
|
-
active,
|
|
11
|
-
currentIndex,
|
|
12
|
-
items,
|
|
13
|
-
typeAheadHandler
|
|
14
|
-
} = pluginKey.getState(state);
|
|
15
|
-
|
|
16
|
-
if (!active || !typeAheadHandler) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (!typeAheadHandler.selectItem || !items[currentIndex]) {
|
|
21
|
-
return withTypeAheadQueryMarkPosition(state, (start, end) => insertFallbackCommand(start, end)(state, dispatch));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return selectItem(typeAheadHandler, items[currentIndex], mode)(state, dispatch);
|
|
25
|
-
};
|
|
26
|
-
export const selectSingleItemOrDismiss = (mode = 'selected') => (state, dispatch) => {
|
|
27
|
-
const {
|
|
28
|
-
active,
|
|
29
|
-
items,
|
|
30
|
-
typeAheadHandler
|
|
31
|
-
} = pluginKey.getState(state);
|
|
32
|
-
|
|
33
|
-
if (!active || !typeAheadHandler || !typeAheadHandler.selectItem) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (items.length === 1) {
|
|
38
|
-
return selectItem(typeAheadHandler, items[0], mode)(state, dispatch);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!items || items.length === 0) {
|
|
42
|
-
dismissCommand()(state, dispatch);
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
};
|
|
48
|
-
export const selectByIndex = index => (state, dispatch) => {
|
|
49
|
-
const {
|
|
50
|
-
active,
|
|
51
|
-
items,
|
|
52
|
-
typeAheadHandler
|
|
53
|
-
} = pluginKey.getState(state);
|
|
54
|
-
|
|
55
|
-
if (!active || !typeAheadHandler || !typeAheadHandler.selectItem || !items[index]) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return selectItem(typeAheadHandler, items[index])(state, dispatch);
|
|
60
|
-
};
|
|
61
|
-
export const selectItem = (handler, item, mode = 'selected') => (state, dispatch) => {
|
|
62
|
-
return withTypeAheadQueryMarkPosition(state, (start, end) => {
|
|
63
|
-
const insert = (maybeNode, opts = {}) => {
|
|
64
|
-
let tr = state.tr;
|
|
65
|
-
tr = tr.setMeta(pluginKey, {
|
|
66
|
-
action: ACTIONS.SELECT_CURRENT
|
|
67
|
-
}).replaceWith(start, end, Fragment.empty);
|
|
68
|
-
return insertSelectedItem(maybeNode, opts)(state, tr, start);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const tr = handler.selectItem(state, item, insert, {
|
|
72
|
-
mode
|
|
73
|
-
}); // if this is the invite teammates item, delete the trigger and query
|
|
74
|
-
|
|
75
|
-
if (isInviteItem(item.mention)) {
|
|
76
|
-
// allow the user the select the invite item by left click or enter, but not by space bar
|
|
77
|
-
if (mode !== 'space') {
|
|
78
|
-
if (dispatch) {
|
|
79
|
-
dispatch(state.tr.delete(start, end));
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (tr === false) {
|
|
88
|
-
return insertFallbackCommand(start, end)(state, dispatch);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (dispatch) {
|
|
92
|
-
dispatch(tr);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return true;
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
export const insertFallbackCommand = (start, end) => (state, dispatch) => {
|
|
99
|
-
const {
|
|
100
|
-
query,
|
|
101
|
-
trigger
|
|
102
|
-
} = pluginKey.getState(state);
|
|
103
|
-
const node = state.schema.text(trigger + query);
|
|
104
|
-
|
|
105
|
-
if (dispatch) {
|
|
106
|
-
dispatch(state.tr.replaceWith(start, end, node));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return true;
|
|
110
|
-
};
|
|
111
|
-
export const withTypeAheadQueryMarkPosition = (state, cb) => {
|
|
112
|
-
const queryMark = findTypeAheadQuery(state);
|
|
113
|
-
|
|
114
|
-
if (!queryMark || queryMark.start === -1) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return cb(queryMark.start, queryMark.end);
|
|
119
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ACTIONS, pluginKey } from '../pm-plugins/main';
|
|
2
|
-
export const setCurrentIndex = currentIndex => (state, dispatch) => {
|
|
3
|
-
if (dispatch) {
|
|
4
|
-
dispatch(state.tr.setMeta(pluginKey, {
|
|
5
|
-
action: ACTIONS.SET_CURRENT_INDEX,
|
|
6
|
-
params: {
|
|
7
|
-
currentIndex
|
|
8
|
-
}
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return true;
|
|
13
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { keymap } from 'prosemirror-keymap';
|
|
2
|
-
import * as keymaps from '../../../keymaps';
|
|
3
|
-
import { dismissCommand } from '../commands/dismiss';
|
|
4
|
-
import { selectCurrentItem, selectSingleItemOrDismiss } from '../commands/select-item';
|
|
5
|
-
import { ACTIONS, pluginKey } from './main';
|
|
6
|
-
export function keymapPlugin() {
|
|
7
|
-
const list = {};
|
|
8
|
-
keymaps.bindKeymapWithCommand(keymaps.enter.common, (state, dispatch) => {
|
|
9
|
-
const pluginState = pluginKey.getState(state);
|
|
10
|
-
|
|
11
|
-
if (!pluginState || !pluginState.active) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return selectCurrentItem('enter')(state, dispatch);
|
|
16
|
-
}, list);
|
|
17
|
-
keymaps.bindKeymapWithCommand(keymaps.moveUp.common, (state, dispatch) => {
|
|
18
|
-
const pluginState = pluginKey.getState(state);
|
|
19
|
-
|
|
20
|
-
if (!pluginState || !pluginState.active) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (dispatch) {
|
|
25
|
-
dispatch(state.tr.setMeta(pluginKey, {
|
|
26
|
-
action: ACTIONS.SELECT_PREV
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return true;
|
|
31
|
-
}, list);
|
|
32
|
-
keymaps.bindKeymapWithCommand(keymaps.moveDown.common, (state, dispatch) => {
|
|
33
|
-
const pluginState = pluginKey.getState(state);
|
|
34
|
-
|
|
35
|
-
if (!pluginState || !pluginState.active) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (dispatch) {
|
|
40
|
-
dispatch(state.tr.setMeta(pluginKey, {
|
|
41
|
-
action: ACTIONS.SELECT_NEXT
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return true;
|
|
46
|
-
}, list);
|
|
47
|
-
keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, (state, dispatch) => {
|
|
48
|
-
const pluginState = pluginKey.getState(state);
|
|
49
|
-
|
|
50
|
-
if (!pluginState || !pluginState.active) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return selectCurrentItem('shift-enter')(state, dispatch);
|
|
55
|
-
}, list);
|
|
56
|
-
keymaps.bindKeymapWithCommand(keymaps.tab.common, (state, dispatch) => {
|
|
57
|
-
const pluginState = pluginKey.getState(state);
|
|
58
|
-
|
|
59
|
-
if (!pluginState || !pluginState.active) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return selectCurrentItem('tab')(state, dispatch);
|
|
64
|
-
}, list);
|
|
65
|
-
keymaps.bindKeymapWithCommand(keymaps.escape.common, (state, dispatch) => {
|
|
66
|
-
const pluginState = pluginKey.getState(state);
|
|
67
|
-
|
|
68
|
-
if (!pluginState || !pluginState.active) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Jira uses escape to toggle the collapsed editor
|
|
73
|
-
* stop the event propagation when the picker is open
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (window.event) {
|
|
78
|
-
window.event.stopPropagation();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return dismissCommand()(state, dispatch);
|
|
82
|
-
}, list);
|
|
83
|
-
keymaps.bindKeymapWithCommand(keymaps.space.common, (state, dispatch) => {
|
|
84
|
-
const pluginState = pluginKey.getState(state);
|
|
85
|
-
|
|
86
|
-
if (pluginState && pluginState.active) {
|
|
87
|
-
return selectSingleItemOrDismiss('space')(state, dispatch);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return false;
|
|
91
|
-
}, list);
|
|
92
|
-
return keymap(list);
|
|
93
|
-
}
|
|
94
|
-
export default keymapPlugin;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Popup } from '@atlaskit/editor-common';
|
|
5
|
-
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
7
|
-
import { N0, N60A, N50A } from '@atlaskit/theme/colors';
|
|
8
|
-
import { divide } from '@atlaskit/theme/math';
|
|
9
|
-
import { selectByIndex } from '../commands/select-item';
|
|
10
|
-
import { setCurrentIndex } from '../commands/set-current-index';
|
|
11
|
-
import { TypeAheadItemsList } from './TypeAheadItemsList';
|
|
12
|
-
import { fireAnalyticsEvent, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
13
|
-
import { editorAnalyticsChannel } from '../../analytics/consts';
|
|
14
|
-
export const TypeAheadContent = styled.div`
|
|
15
|
-
background: ${N0};
|
|
16
|
-
border-radius: ${borderRadius()}px;
|
|
17
|
-
box-shadow: 0 0 1px ${N60A}, 0 4px 8px -2px ${N50A};
|
|
18
|
-
padding: ${divide(gridSize, 2)}px 0;
|
|
19
|
-
width: 320px;
|
|
20
|
-
max-height: 380px; /* ~5.5 visibile items */
|
|
21
|
-
overflow-y: auto;
|
|
22
|
-
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
23
|
-
position: relative;
|
|
24
|
-
`;
|
|
25
|
-
export class TypeAhead extends React.Component {
|
|
26
|
-
constructor(...args) {
|
|
27
|
-
super(...args);
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "composing", false);
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "shouldFireRendered", false);
|
|
32
|
-
|
|
33
|
-
_defineProperty(this, "handleKeyPress", () => {
|
|
34
|
-
// When user starts typing, they are not using their mouse
|
|
35
|
-
// Marks as composing, to prevent false positive mouse events
|
|
36
|
-
this.composing = true;
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "handleMouseMove", () => {
|
|
40
|
-
// User is actively moving mouse, hence can enable mouse events again
|
|
41
|
-
this.composing = false;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
_defineProperty(this, "fireRendered", () => {
|
|
45
|
-
if (this.shouldFireRendered) {
|
|
46
|
-
var _this$props$items;
|
|
47
|
-
|
|
48
|
-
const payload = {
|
|
49
|
-
action: ACTION.RENDERED,
|
|
50
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
51
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
52
|
-
attributes: {
|
|
53
|
-
time: this.renderStart ? performance.now() - this.renderStart : undefined,
|
|
54
|
-
items: (_this$props$items = this.props.items) === null || _this$props$items === void 0 ? void 0 : _this$props$items.length,
|
|
55
|
-
initial: this.props.query === ''
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
fireAnalyticsEvent(this.props.createAnalyticsEvent)({
|
|
59
|
-
channel: editorAnalyticsChannel,
|
|
60
|
-
payload
|
|
61
|
-
});
|
|
62
|
-
this.renderStart = undefined;
|
|
63
|
-
this.shouldFireRendered = false;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
_defineProperty(this, "fireItemViewed", () => {
|
|
68
|
-
if (this.props.currentIndex !== this.sentIndex) {
|
|
69
|
-
var _this$props$items2;
|
|
70
|
-
|
|
71
|
-
const itemPayload = {
|
|
72
|
-
action: ACTION.VIEWED,
|
|
73
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
|
|
74
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
75
|
-
attributes: {
|
|
76
|
-
index: this.props.currentIndex,
|
|
77
|
-
items: (_this$props$items2 = this.props.items) === null || _this$props$items2 === void 0 ? void 0 : _this$props$items2.length
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
fireAnalyticsEvent(this.props.createAnalyticsEvent)({
|
|
81
|
-
channel: editorAnalyticsChannel,
|
|
82
|
-
payload: itemPayload
|
|
83
|
-
});
|
|
84
|
-
this.sentIndex = this.props.currentIndex;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
_defineProperty(this, "componentDidMount", () => {
|
|
89
|
-
window.addEventListener('keypress', this.handleKeyPress);
|
|
90
|
-
window.addEventListener('mousemove', this.handleMouseMove);
|
|
91
|
-
this.fireRendered();
|
|
92
|
-
this.fireItemViewed();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
_defineProperty(this, "componentWillUnmount", () => {
|
|
96
|
-
window.removeEventListener('keypress', this.handleKeyPress);
|
|
97
|
-
window.removeEventListener('mousemove', this.handleMouseMove);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
_defineProperty(this, "componentDidUpdate", () => {
|
|
101
|
-
this.fireRendered();
|
|
102
|
-
this.fireItemViewed();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
_defineProperty(this, "insertByIndex", index => {
|
|
106
|
-
selectByIndex(index)(this.props.editorView.state, this.props.editorView.dispatch);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
_defineProperty(this, "setCurrentIndex", index => {
|
|
110
|
-
if (this.composing) {
|
|
111
|
-
// User is typing, mouse events are false positives
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (index !== this.props.currentIndex) {
|
|
116
|
-
setCurrentIndex(index)(this.props.editorView.state, this.props.editorView.dispatch);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
componentWillReceiveProps(nextProps) {
|
|
122
|
-
var _this$props$items$map, _this$props$items3, _nextProps$items$map$, _nextProps$items;
|
|
123
|
-
|
|
124
|
-
const prev = (_this$props$items$map = (_this$props$items3 = this.props.items) === null || _this$props$items3 === void 0 ? void 0 : _this$props$items3.map(({
|
|
125
|
-
title
|
|
126
|
-
}) => title).join('-')) !== null && _this$props$items$map !== void 0 ? _this$props$items$map : '';
|
|
127
|
-
const next = (_nextProps$items$map$ = (_nextProps$items = nextProps.items) === null || _nextProps$items === void 0 ? void 0 : _nextProps$items.map(({
|
|
128
|
-
title
|
|
129
|
-
}) => title).join('-')) !== null && _nextProps$items$map$ !== void 0 ? _nextProps$items$map$ : '';
|
|
130
|
-
|
|
131
|
-
if (prev !== next) {
|
|
132
|
-
this.renderStart = performance.now();
|
|
133
|
-
this.shouldFireRendered = true;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
render() {
|
|
138
|
-
const {
|
|
139
|
-
active,
|
|
140
|
-
items,
|
|
141
|
-
isLoading,
|
|
142
|
-
anchorElement,
|
|
143
|
-
currentIndex,
|
|
144
|
-
popupsMountPoint,
|
|
145
|
-
popupsBoundariesElement,
|
|
146
|
-
popupsScrollableElement,
|
|
147
|
-
highlight
|
|
148
|
-
} = this.props;
|
|
149
|
-
|
|
150
|
-
if (!active || !anchorElement || !items || !items.length) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return /*#__PURE__*/React.createElement(Popup, {
|
|
155
|
-
zIndex: akEditorFloatingDialogZIndex,
|
|
156
|
-
target: anchorElement,
|
|
157
|
-
mountTo: popupsMountPoint,
|
|
158
|
-
boundariesElement: popupsBoundariesElement,
|
|
159
|
-
scrollableElement: popupsScrollableElement,
|
|
160
|
-
fitHeight: 300,
|
|
161
|
-
fitWidth: 340,
|
|
162
|
-
offset: [0, 8]
|
|
163
|
-
}, /*#__PURE__*/React.createElement(TypeAheadContent, {
|
|
164
|
-
className: "fabric-editor-typeahead"
|
|
165
|
-
}, highlight, Array.isArray(items) ? /*#__PURE__*/React.createElement(TypeAheadItemsList, {
|
|
166
|
-
insertByIndex: this.insertByIndex,
|
|
167
|
-
setCurrentIndex: this.setCurrentIndex,
|
|
168
|
-
items: items,
|
|
169
|
-
currentIndex: currentIndex
|
|
170
|
-
}) : !items && isLoading ? 'loading...' : 'no items'));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
_defineProperty(TypeAhead, "displayName", 'TypeAhead');
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { ThemeProvider } from 'styled-components';
|
|
4
|
-
import Item, { ItemGroup, itemThemeNamespace } from '@atlaskit/item';
|
|
5
|
-
import { themed } from '@atlaskit/theme/components';
|
|
6
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
|
-
import * as colors from '@atlaskit/theme/colors';
|
|
8
|
-
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { Shortcut } from '../../../ui/styles';
|
|
10
|
-
import IconFallback from '../../quick-insert/assets/fallback';
|
|
11
|
-
const hidden = {
|
|
12
|
-
overflow: 'hidden'
|
|
13
|
-
};
|
|
14
|
-
const itemTheme = {
|
|
15
|
-
[itemThemeNamespace]: {
|
|
16
|
-
padding: {
|
|
17
|
-
default: {
|
|
18
|
-
bottom: 12,
|
|
19
|
-
left: 12,
|
|
20
|
-
right: 12,
|
|
21
|
-
top: 12
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
beforeItemSpacing: {
|
|
25
|
-
default: () => 12
|
|
26
|
-
},
|
|
27
|
-
borderRadius: () => 0,
|
|
28
|
-
hover: {
|
|
29
|
-
// background: colors.transparent, transparent is not a thing
|
|
30
|
-
text: colors.text,
|
|
31
|
-
secondaryText: colors.N200
|
|
32
|
-
},
|
|
33
|
-
selected: {
|
|
34
|
-
background: themed({
|
|
35
|
-
light: colors.N20,
|
|
36
|
-
dark: colors.DN70
|
|
37
|
-
}),
|
|
38
|
-
text: themed({
|
|
39
|
-
light: colors.N800,
|
|
40
|
-
dark: colors.DN600
|
|
41
|
-
}),
|
|
42
|
-
secondaryText: themed({
|
|
43
|
-
light: colors.N200,
|
|
44
|
-
dark: colors.DN300
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
export const ItemIcon = styled.div`
|
|
50
|
-
width: 40px;
|
|
51
|
-
height: 40px;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
border: 1px solid rgba(223, 225, 229, 0.5); /* N60 at 50% */
|
|
54
|
-
border-radius: ${borderRadius()}px;
|
|
55
|
-
box-sizing: border-box;
|
|
56
|
-
|
|
57
|
-
display: flex;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
align-items: center;
|
|
60
|
-
|
|
61
|
-
div {
|
|
62
|
-
width: 40px;
|
|
63
|
-
height: 40px;
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
const ItemBody = styled.div`
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
flex-wrap: nowrap;
|
|
70
|
-
justify-content: space-between;
|
|
71
|
-
line-height: 1.4;
|
|
72
|
-
`;
|
|
73
|
-
const ItemText = styled.div`
|
|
74
|
-
white-space: initial;
|
|
75
|
-
.item-description {
|
|
76
|
-
font-size: ${relativeFontSizeToBase16(11.67)};
|
|
77
|
-
color: ${colors.N200};
|
|
78
|
-
margin-top: 4px;
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
const ItemAfter = styled.div`
|
|
82
|
-
flex: 0 0 auto;
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const fallbackIcon = () => {
|
|
86
|
-
return /*#__PURE__*/React.createElement(IconFallback, null);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export function scrollIntoViewIfNeeded(element) {
|
|
90
|
-
const {
|
|
91
|
-
offsetTop,
|
|
92
|
-
offsetHeight,
|
|
93
|
-
offsetParent
|
|
94
|
-
} = element;
|
|
95
|
-
const {
|
|
96
|
-
offsetHeight: offsetParentHeight,
|
|
97
|
-
scrollTop
|
|
98
|
-
} = offsetParent;
|
|
99
|
-
const direction = offsetTop + offsetHeight > offsetParentHeight + scrollTop ? 1 : scrollTop > offsetTop ? -1 : 0;
|
|
100
|
-
|
|
101
|
-
if (direction !== 0 && offsetParent) {
|
|
102
|
-
offsetParent.scrollTop = direction === 1 ? offsetTop + offsetHeight - offsetParentHeight : offsetTop;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
export function TypeAheadItemsList({
|
|
106
|
-
items,
|
|
107
|
-
currentIndex,
|
|
108
|
-
insertByIndex,
|
|
109
|
-
setCurrentIndex
|
|
110
|
-
}) {
|
|
111
|
-
if (!Array.isArray(items)) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
116
|
-
theme: itemTheme
|
|
117
|
-
}, /*#__PURE__*/React.createElement(ItemGroup, null, items.map((item, index) => /*#__PURE__*/React.createElement(TypeAheadItemComponent, {
|
|
118
|
-
key: item.key || item.title,
|
|
119
|
-
item: item,
|
|
120
|
-
index: index,
|
|
121
|
-
currentIndex: currentIndex,
|
|
122
|
-
insertByIndex: insertByIndex,
|
|
123
|
-
setCurrentIndex: setCurrentIndex
|
|
124
|
-
}))));
|
|
125
|
-
}
|
|
126
|
-
export class TypeAheadItemComponent extends React.Component {
|
|
127
|
-
constructor(...args) {
|
|
128
|
-
super(...args);
|
|
129
|
-
|
|
130
|
-
_defineProperty(this, "state", {
|
|
131
|
-
ref: null
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
_defineProperty(this, "insertByIndex", () => {
|
|
135
|
-
this.props.insertByIndex(this.props.index);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
_defineProperty(this, "setCurrentIndex", () => {
|
|
139
|
-
if (!this.isSelected(this.props)) {
|
|
140
|
-
this.props.setCurrentIndex(this.props.index);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
_defineProperty(this, "handleRef", rawRef => {
|
|
145
|
-
const hasRef = ref => ref && ref.ref;
|
|
146
|
-
|
|
147
|
-
const ref = hasRef(rawRef) ? rawRef.ref : rawRef;
|
|
148
|
-
this.setState({
|
|
149
|
-
ref
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
shouldComponentUpdate(nextProps) {
|
|
155
|
-
return this.isSelected(this.props) !== this.isSelected(nextProps);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
isSelected(props) {
|
|
159
|
-
return props.index === props.currentIndex;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
componentDidUpdate() {
|
|
163
|
-
const ref = this.state.ref;
|
|
164
|
-
|
|
165
|
-
if (this.props.index === this.props.currentIndex && ref) {
|
|
166
|
-
scrollIntoViewIfNeeded(ref);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
render() {
|
|
171
|
-
const {
|
|
172
|
-
item
|
|
173
|
-
} = this.props;
|
|
174
|
-
return item.render ? /*#__PURE__*/React.createElement("div", {
|
|
175
|
-
onMouseMove: this.setCurrentIndex,
|
|
176
|
-
ref: this.handleRef,
|
|
177
|
-
style: hidden
|
|
178
|
-
}, /*#__PURE__*/React.createElement(item.render, {
|
|
179
|
-
onClick: this.insertByIndex,
|
|
180
|
-
onHover: this.setCurrentIndex,
|
|
181
|
-
isSelected: this.isSelected(this.props)
|
|
182
|
-
})) : /*#__PURE__*/React.createElement(Item, {
|
|
183
|
-
onClick: this.insertByIndex,
|
|
184
|
-
onMouseMove: this.setCurrentIndex,
|
|
185
|
-
elemBefore: /*#__PURE__*/React.createElement(ItemIcon, null, item.icon ? item.icon() : fallbackIcon()),
|
|
186
|
-
isSelected: this.isSelected(this.props),
|
|
187
|
-
"aria-describedby": item.title,
|
|
188
|
-
ref: this.handleRef
|
|
189
|
-
}, /*#__PURE__*/React.createElement(ItemBody, null, /*#__PURE__*/React.createElement(ItemText, null, /*#__PURE__*/React.createElement("div", {
|
|
190
|
-
className: "item-title"
|
|
191
|
-
}, item.title), item.description && /*#__PURE__*/React.createElement("div", {
|
|
192
|
-
className: "item-description"
|
|
193
|
-
}, item.description)), /*#__PURE__*/React.createElement(ItemAfter, null, item.keyshortcut && /*#__PURE__*/React.createElement(Shortcut, null, item.keyshortcut))));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function findQueryMark(mark, doc, from, to) {
|
|
2
|
-
let queryMark = {
|
|
3
|
-
start: -1,
|
|
4
|
-
end: -1
|
|
5
|
-
};
|
|
6
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
7
|
-
if (queryMark.start === -1 && mark.isInSet(node.marks)) {
|
|
8
|
-
queryMark = {
|
|
9
|
-
start: pos,
|
|
10
|
-
end: pos + Math.max(node.textContent.length, 1)
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return queryMark;
|
|
15
|
-
}
|
|
16
|
-
export function findTypeAheadQuery(state) {
|
|
17
|
-
const {
|
|
18
|
-
doc,
|
|
19
|
-
schema
|
|
20
|
-
} = state;
|
|
21
|
-
const {
|
|
22
|
-
typeAheadQuery
|
|
23
|
-
} = schema.marks;
|
|
24
|
-
const {
|
|
25
|
-
from,
|
|
26
|
-
to
|
|
27
|
-
} = state.selection;
|
|
28
|
-
return findQueryMark(typeAheadQuery, doc, from - 1, to);
|
|
29
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { insertTypeAheadQuery } from '../../type-ahead/commands/insert-query';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../../analytics';
|
|
3
|
-
export function insertEmojiQuery(inputMethod) {
|
|
4
|
-
return withAnalytics({
|
|
5
|
-
action: ACTION.INVOKED,
|
|
6
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
7
|
-
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_EMOJI,
|
|
8
|
-
attributes: {
|
|
9
|
-
inputMethod: inputMethod
|
|
10
|
-
},
|
|
11
|
-
eventType: EVENT_TYPE.UI
|
|
12
|
-
})(insertTypeAheadQuery(':'));
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { insertTypeAheadQuery } from '../../type-ahead/commands/insert-query';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../../analytics';
|
|
3
|
-
export function insertMentionQuery(inputMethod) {
|
|
4
|
-
return withAnalytics({
|
|
5
|
-
action: ACTION.INVOKED,
|
|
6
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
7
|
-
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
|
8
|
-
attributes: {
|
|
9
|
-
inputMethod: inputMethod
|
|
10
|
-
},
|
|
11
|
-
eventType: EVENT_TYPE.UI
|
|
12
|
-
})(insertTypeAheadQuery('@'));
|
|
13
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
2
|
-
import { findTypeAheadQuery } from '../utils/find-query-mark';
|
|
3
|
-
export var dismissCommand = function dismissCommand() {
|
|
4
|
-
return function (state, dispatch) {
|
|
5
|
-
var queryMark = findTypeAheadQuery(state);
|
|
6
|
-
|
|
7
|
-
if (queryMark === null) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var start = queryMark.start,
|
|
12
|
-
end = queryMark.end;
|
|
13
|
-
var schema = state.schema;
|
|
14
|
-
var markType = schema.marks.typeAheadQuery;
|
|
15
|
-
|
|
16
|
-
if (start === -1) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var _pluginKey$getState = pluginKey.getState(state),
|
|
21
|
-
typeAheadHandler = _pluginKey$getState.typeAheadHandler;
|
|
22
|
-
|
|
23
|
-
if (typeAheadHandler && typeAheadHandler.dismiss) {
|
|
24
|
-
typeAheadHandler.dismiss(state);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (dispatch) {
|
|
28
|
-
dispatch(state.tr.removeMark(start, end, markType).removeStoredMark(markType));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return true;
|
|
32
|
-
};
|
|
33
|
-
};
|