@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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mentionPluginKey = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var mentionPluginKey = new _prosemirrorState.PluginKey('mentionPlugin');
|
|
11
|
+
exports.mentionPluginKey = mentionPluginKey;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createMentionPlugin = createMentionPlugin;
|
|
9
|
+
exports.setContext = void 0;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
14
|
+
|
|
15
|
+
var _resource = require("@atlaskit/mention/resource");
|
|
16
|
+
|
|
17
|
+
var _mention = _interopRequireDefault(require("../nodeviews/mention"));
|
|
18
|
+
|
|
19
|
+
var _key = require("./key");
|
|
20
|
+
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
24
|
+
|
|
25
|
+
var ACTIONS = {
|
|
26
|
+
SET_PROVIDER: 'SET_PROVIDER',
|
|
27
|
+
SET_CONTEXT: 'SET_CONTEXT'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var setProvider = function setProvider(provider) {
|
|
31
|
+
return function (state, dispatch) {
|
|
32
|
+
if (dispatch) {
|
|
33
|
+
dispatch(state.tr.setMeta(_key.mentionPluginKey, {
|
|
34
|
+
action: ACTIONS.SET_PROVIDER,
|
|
35
|
+
params: {
|
|
36
|
+
provider: provider
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var setContext = function setContext(context) {
|
|
46
|
+
return function (state, dispatch) {
|
|
47
|
+
if (dispatch) {
|
|
48
|
+
dispatch(state.tr.setMeta(_key.mentionPluginKey, {
|
|
49
|
+
action: ACTIONS.SET_CONTEXT,
|
|
50
|
+
params: {
|
|
51
|
+
context: context
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.setContext = setContext;
|
|
61
|
+
|
|
62
|
+
function createMentionPlugin(dispatch, providerFactory, portalProviderAPI, eventDispatcher, fireEvent, options) {
|
|
63
|
+
var mentionProvider;
|
|
64
|
+
|
|
65
|
+
var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
|
|
66
|
+
if (event === _resource.SLI_EVENT_TYPE || event === _resource.SMART_EVENT_TYPE) {
|
|
67
|
+
fireEvent((0, _resource.buildSliPayload)(actionSubject, action, attributes));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return new _prosemirrorState.Plugin({
|
|
72
|
+
key: _key.mentionPluginKey,
|
|
73
|
+
state: {
|
|
74
|
+
init: function init() {
|
|
75
|
+
return {};
|
|
76
|
+
},
|
|
77
|
+
apply: function apply(tr, pluginState) {
|
|
78
|
+
var _ref = tr.getMeta(_key.mentionPluginKey) || {
|
|
79
|
+
action: null,
|
|
80
|
+
params: null
|
|
81
|
+
},
|
|
82
|
+
action = _ref.action,
|
|
83
|
+
params = _ref.params;
|
|
84
|
+
|
|
85
|
+
var newPluginState = pluginState;
|
|
86
|
+
|
|
87
|
+
switch (action) {
|
|
88
|
+
case ACTIONS.SET_PROVIDER:
|
|
89
|
+
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
90
|
+
mentionProvider: params.provider
|
|
91
|
+
});
|
|
92
|
+
dispatch(_key.mentionPluginKey, newPluginState);
|
|
93
|
+
return newPluginState;
|
|
94
|
+
|
|
95
|
+
case ACTIONS.SET_CONTEXT:
|
|
96
|
+
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
97
|
+
contextIdentifierProvider: params.context
|
|
98
|
+
});
|
|
99
|
+
dispatch(_key.mentionPluginKey, newPluginState);
|
|
100
|
+
return newPluginState;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return newPluginState;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
props: {
|
|
107
|
+
nodeViews: {
|
|
108
|
+
mention: (0, _mention.default)(portalProviderAPI, eventDispatcher, providerFactory, options)
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
view: function view(editorView) {
|
|
112
|
+
var providerHandler = function providerHandler(name, providerPromise) {
|
|
113
|
+
switch (name) {
|
|
114
|
+
case 'mentionProvider':
|
|
115
|
+
if (!providerPromise) {
|
|
116
|
+
return setProvider(undefined)(editorView.state, editorView.dispatch);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
providerPromise.then(function (provider) {
|
|
120
|
+
if (mentionProvider) {
|
|
121
|
+
mentionProvider.unsubscribe('mentionPlugin');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
mentionProvider = provider;
|
|
125
|
+
setProvider(provider)(editorView.state, editorView.dispatch);
|
|
126
|
+
provider.subscribe('mentionPlugin', undefined, undefined, undefined, undefined, sendAnalytics);
|
|
127
|
+
}).catch(function () {
|
|
128
|
+
return setProvider(undefined)(editorView.state, editorView.dispatch);
|
|
129
|
+
});
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case 'contextIdentifierProvider':
|
|
133
|
+
if (!providerPromise) {
|
|
134
|
+
return setContext(undefined)(editorView.state, editorView.dispatch);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
providerPromise.then(function (provider) {
|
|
138
|
+
setContext(provider)(editorView.state, editorView.dispatch);
|
|
139
|
+
});
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
providerFactory.subscribe('mentionProvider', providerHandler);
|
|
147
|
+
providerFactory.subscribe('contextIdentifierProvider', providerHandler);
|
|
148
|
+
return {
|
|
149
|
+
destroy: function destroy() {
|
|
150
|
+
if (providerFactory) {
|
|
151
|
+
providerFactory.unsubscribe('mentionProvider', providerHandler);
|
|
152
|
+
providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (mentionProvider) {
|
|
156
|
+
mentionProvider.unsubscribe('mentionPlugin');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getMentionPluginState = getMentionPluginState;
|
|
7
|
+
|
|
8
|
+
var _key = require("./key");
|
|
9
|
+
|
|
10
|
+
function getMentionPluginState(state) {
|
|
11
|
+
return _key.mentionPluginKey.getState(state);
|
|
12
|
+
}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.memoize = memoize;
|
|
11
|
+
exports.createTypeAheadConfig = exports.mentionToTypeaheadItem = void 0;
|
|
12
|
+
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
|
|
15
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
|
+
|
|
17
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
|
|
19
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
20
|
+
|
|
21
|
+
var _prosemirrorModel = require("prosemirror-model");
|
|
22
|
+
|
|
23
|
+
var _resource = require("@atlaskit/mention/resource");
|
|
24
|
+
|
|
25
|
+
var _item = require("@atlaskit/mention/item");
|
|
26
|
+
|
|
27
|
+
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
28
|
+
|
|
29
|
+
var _spotlight = require("@atlaskit/mention/spotlight");
|
|
30
|
+
|
|
31
|
+
var _analytics = require("../analytics");
|
|
32
|
+
|
|
33
|
+
var _InviteItem = _interopRequireWildcard(require("../ui/InviteItem"));
|
|
34
|
+
|
|
35
|
+
var _utils = require("../utils");
|
|
36
|
+
|
|
37
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
38
|
+
|
|
39
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
|
+
|
|
41
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
42
|
+
|
|
43
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
44
|
+
|
|
45
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
46
|
+
|
|
47
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
48
|
+
|
|
49
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
50
|
+
|
|
51
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
52
|
+
|
|
53
|
+
var createInviteItem = function createInviteItem(_ref) {
|
|
54
|
+
var mentionProvider = _ref.mentionProvider,
|
|
55
|
+
onInviteItemMount = _ref.onInviteItemMount;
|
|
56
|
+
return {
|
|
57
|
+
title: _InviteItem.INVITE_ITEM_DESCRIPTION.id,
|
|
58
|
+
render: function render(_ref2) {
|
|
59
|
+
var isSelected = _ref2.isSelected,
|
|
60
|
+
onClick = _ref2.onClick,
|
|
61
|
+
onHover = _ref2.onHover;
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_InviteItem.default, {
|
|
63
|
+
productName: mentionProvider ? mentionProvider.productName : undefined,
|
|
64
|
+
selected: isSelected,
|
|
65
|
+
onMount: onInviteItemMount,
|
|
66
|
+
onMouseEnter: onHover,
|
|
67
|
+
onSelection: onClick,
|
|
68
|
+
userRole: mentionProvider.userRole
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
mention: _InviteItem.INVITE_ITEM_DESCRIPTION
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var withInviteItem = function withInviteItem(_ref3) {
|
|
76
|
+
var mentionProvider = _ref3.mentionProvider,
|
|
77
|
+
firstQueryWithoutResults = _ref3.firstQueryWithoutResults,
|
|
78
|
+
currentQuery = _ref3.currentQuery,
|
|
79
|
+
onInviteItemMount = _ref3.onInviteItemMount;
|
|
80
|
+
return function (mentionItems) {
|
|
81
|
+
var inviteItem = createInviteItem({
|
|
82
|
+
mentionProvider: mentionProvider,
|
|
83
|
+
onInviteItemMount: onInviteItemMount
|
|
84
|
+
});
|
|
85
|
+
var keepInviteItem = (0, _utils.shouldKeepInviteItem)(currentQuery, firstQueryWithoutResults);
|
|
86
|
+
|
|
87
|
+
if (mentionItems.length === 0) {
|
|
88
|
+
return keepInviteItem ? [inviteItem] : [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return [].concat((0, _toConsumableArray2.default)(mentionItems), [// invite item should be shown at the bottom
|
|
92
|
+
inviteItem]);
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var mentionToTypeaheadItem = function mentionToTypeaheadItem(mention) {
|
|
97
|
+
return {
|
|
98
|
+
title: mention.id,
|
|
99
|
+
render: function render(_ref4) {
|
|
100
|
+
var isSelected = _ref4.isSelected,
|
|
101
|
+
onClick = _ref4.onClick,
|
|
102
|
+
onHover = _ref4.onHover;
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_item.MentionItem, {
|
|
104
|
+
mention: mention,
|
|
105
|
+
selected: isSelected,
|
|
106
|
+
onMouseEnter: onHover,
|
|
107
|
+
onSelection: onClick
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
getCustomComponentHeight: function getCustomComponentHeight() {
|
|
111
|
+
return _item.MENTION_ITEM_HEIGHT;
|
|
112
|
+
},
|
|
113
|
+
mention: mention
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
exports.mentionToTypeaheadItem = mentionToTypeaheadItem;
|
|
118
|
+
|
|
119
|
+
function memoize(fn) {
|
|
120
|
+
// Cache results here
|
|
121
|
+
var seen = new Map();
|
|
122
|
+
|
|
123
|
+
function memoized(mention) {
|
|
124
|
+
// Check cache for hits
|
|
125
|
+
var hit = seen.get(mention.id);
|
|
126
|
+
|
|
127
|
+
if (hit) {
|
|
128
|
+
return hit;
|
|
129
|
+
} // Generate new result and cache it
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
var result = fn(mention);
|
|
133
|
+
seen.set(mention.id, result);
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
call: memoized,
|
|
139
|
+
clear: seen.clear.bind(seen)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var memoizedToItem = memoize(mentionToTypeaheadItem);
|
|
144
|
+
|
|
145
|
+
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
146
|
+
return function (_ref5) {
|
|
147
|
+
var query = _ref5.query,
|
|
148
|
+
mentions = _ref5.mentions,
|
|
149
|
+
stats = _ref5.stats;
|
|
150
|
+
var duration = 0;
|
|
151
|
+
var userOrTeamIds = null;
|
|
152
|
+
var teams = null;
|
|
153
|
+
|
|
154
|
+
if (!(0, _utils.isTeamStats)(stats)) {
|
|
155
|
+
// is from primary mention endpoint which could be just user mentions or user/team mentions
|
|
156
|
+
duration = stats && stats.duration;
|
|
157
|
+
teams = null;
|
|
158
|
+
userOrTeamIds = mentions.map(function (mention) {
|
|
159
|
+
return mention.id;
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
// is from dedicated team-only mention endpoint
|
|
163
|
+
duration = stats && stats.teamMentionDuration;
|
|
164
|
+
userOrTeamIds = null;
|
|
165
|
+
teams = mentions.map(function (mention) {
|
|
166
|
+
return (0, _utils.isTeamType)(mention.userType) ? {
|
|
167
|
+
teamId: mention.id,
|
|
168
|
+
includesYou: mention.context.includesYou,
|
|
169
|
+
memberCount: mention.context.memberCount
|
|
170
|
+
} : null;
|
|
171
|
+
}).filter(function (m) {
|
|
172
|
+
return !!m;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var payload = (0, _analytics.buildTypeAheadRenderedPayload)(duration, userOrTeamIds, query, teams);
|
|
177
|
+
fireEvent(payload);
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var isTeamMentionProvider = function isTeamMentionProvider(p) {
|
|
182
|
+
return !!(p.mentionTypeaheadHighlightEnabled && p.mentionTypeaheadCreateTeamPath);
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* When a team mention is selected, we render a team link and list of member/user mentions
|
|
186
|
+
* in editor content
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selectedMention, mentionProvider, sanitizePrivateContent) {
|
|
191
|
+
var nodes = schema.nodes,
|
|
192
|
+
marks = schema.marks;
|
|
193
|
+
var name = selectedMention.name,
|
|
194
|
+
teamId = selectedMention.id,
|
|
195
|
+
accessLevel = selectedMention.accessLevel,
|
|
196
|
+
context = selectedMention.context; // build team link
|
|
197
|
+
|
|
198
|
+
var defaultTeamLink = "".concat(window.location.origin, "/people/team/").concat(teamId);
|
|
199
|
+
var teamLink = context && context.teamLink ? context.teamLink : defaultTeamLink;
|
|
200
|
+
var teamLinkNode = schema.text(name, [marks.link.create({
|
|
201
|
+
href: teamLink
|
|
202
|
+
})]);
|
|
203
|
+
var openBracketText = schema.text('(');
|
|
204
|
+
var closeBracketText = schema.text(')');
|
|
205
|
+
var emptySpaceText = schema.text(' ');
|
|
206
|
+
var inlineNodes = [teamLinkNode, emptySpaceText, openBracketText];
|
|
207
|
+
var members = context && context.members ? context.members : [];
|
|
208
|
+
members.forEach(function (member, index) {
|
|
209
|
+
var name = member.name,
|
|
210
|
+
id = member.id;
|
|
211
|
+
var mentionName = "@".concat(name);
|
|
212
|
+
var text = sanitizePrivateContent ? '' : mentionName;
|
|
213
|
+
|
|
214
|
+
if (sanitizePrivateContent && (0, _resource.isResolvingMentionProvider)(mentionProvider)) {
|
|
215
|
+
mentionProvider.cacheMentionName(id, name);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
var userMentionNode = nodes.mention.createChecked({
|
|
219
|
+
text: text,
|
|
220
|
+
id: member.id,
|
|
221
|
+
accessLevel: accessLevel,
|
|
222
|
+
userType: 'DEFAULT'
|
|
223
|
+
});
|
|
224
|
+
inlineNodes.push(userMentionNode); // should not add empty space after the last user mention.
|
|
225
|
+
|
|
226
|
+
if (index !== members.length - 1) {
|
|
227
|
+
inlineNodes.push(emptySpaceText);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
inlineNodes.push(closeBracketText);
|
|
231
|
+
return _prosemirrorModel.Fragment.fromArray(inlineNodes);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
235
|
+
var sanitizePrivateContent = _ref6.sanitizePrivateContent,
|
|
236
|
+
mentionInsertDisplayName = _ref6.mentionInsertDisplayName,
|
|
237
|
+
fireEvent = _ref6.fireEvent,
|
|
238
|
+
HighlightComponent = _ref6.HighlightComponent;
|
|
239
|
+
var sessionId = (0, _uuid.default)();
|
|
240
|
+
var firstQueryWithoutResults = null;
|
|
241
|
+
var subscriptionKeys = new Set();
|
|
242
|
+
var typeAhead = {
|
|
243
|
+
id: _typeAhead.TypeAheadAvailableNodes.MENTION,
|
|
244
|
+
trigger: '@',
|
|
245
|
+
// Custom regex must have a capture group around trigger
|
|
246
|
+
// so it's possible to use it without needing to scan through all triggers again
|
|
247
|
+
customRegex: '\\(?(@)',
|
|
248
|
+
getHighlight: function getHighlight(state) {
|
|
249
|
+
var CustomHighlightComponent = HighlightComponent;
|
|
250
|
+
|
|
251
|
+
if (CustomHighlightComponent) {
|
|
252
|
+
return /*#__PURE__*/_react.default.createElement(CustomHighlightComponent, null);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var pluginState = (0, _utils2.getMentionPluginState)(state);
|
|
256
|
+
var provider = pluginState.mentionProvider;
|
|
257
|
+
|
|
258
|
+
if (provider) {
|
|
259
|
+
var teamMentionProvider = provider;
|
|
260
|
+
|
|
261
|
+
if (isTeamMentionProvider(teamMentionProvider) && teamMentionProvider.mentionTypeaheadHighlightEnabled()) {
|
|
262
|
+
return /*#__PURE__*/_react.default.createElement(_spotlight.TeamMentionHighlight, {
|
|
263
|
+
createTeamLink: teamMentionProvider.mentionTypeaheadCreateTeamPath(),
|
|
264
|
+
onClose: function onClose() {
|
|
265
|
+
return _spotlight.TeamMentionHighlightController.registerClosed();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return null;
|
|
272
|
+
},
|
|
273
|
+
getItems: function getItems(_ref7) {
|
|
274
|
+
var query = _ref7.query,
|
|
275
|
+
editorState = _ref7.editorState;
|
|
276
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
277
|
+
|
|
278
|
+
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
279
|
+
return Promise.resolve([]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
var mentionProvider = pluginState.mentionProvider,
|
|
283
|
+
contextIdentifierProvider = pluginState.contextIdentifierProvider;
|
|
284
|
+
return new Promise(function (resolve) {
|
|
285
|
+
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.default)());
|
|
286
|
+
|
|
287
|
+
var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
|
|
288
|
+
var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
289
|
+
var stats = arguments.length > 2 ? arguments[2] : undefined;
|
|
290
|
+
|
|
291
|
+
if (query !== resultQuery) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
mentionProvider.unsubscribe(key);
|
|
296
|
+
subscriptionKeys.delete(key);
|
|
297
|
+
var mentionItems = mentions.map(function (mention) {
|
|
298
|
+
return memoizedToItem.call(mention);
|
|
299
|
+
});
|
|
300
|
+
buildAndSendElementsTypeAheadAnalytics(fireEvent)({
|
|
301
|
+
query: query,
|
|
302
|
+
mentions: mentions,
|
|
303
|
+
stats: stats
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
if (mentions.length === 0 && firstQueryWithoutResults === null) {
|
|
307
|
+
firstQueryWithoutResults = query;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
|
|
311
|
+
resolve(mentionItems);
|
|
312
|
+
} else {
|
|
313
|
+
var items = withInviteItem({
|
|
314
|
+
mentionProvider: mentionProvider,
|
|
315
|
+
firstQueryWithoutResults: firstQueryWithoutResults || '',
|
|
316
|
+
currentQuery: query,
|
|
317
|
+
onInviteItemMount: function onInviteItemMount() {
|
|
318
|
+
fireEvent((0, _analytics.buildTypeAheadInviteItemViewedPayload)(sessionId, contextIdentifierProvider, mentionProvider.userRole));
|
|
319
|
+
}
|
|
320
|
+
})(mentionItems);
|
|
321
|
+
resolve(items);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
subscriptionKeys.add(key);
|
|
326
|
+
mentionProvider.subscribe(key, mentionsSubscribeCallback);
|
|
327
|
+
mentionProvider.filter(query || '', _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
328
|
+
sessionId: sessionId
|
|
329
|
+
}));
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
onOpen: function onOpen(editorState) {
|
|
333
|
+
firstQueryWithoutResults = null;
|
|
334
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
335
|
+
|
|
336
|
+
if (!pluginState || !pluginState.mentionProvider) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
var contextIdentifierProvider = pluginState.contextIdentifierProvider,
|
|
341
|
+
_pluginState$mentionP = pluginState.mentionProvider,
|
|
342
|
+
shouldEnableInvite = _pluginState$mentionP.shouldEnableInvite,
|
|
343
|
+
inviteExperimentCohort = _pluginState$mentionP.inviteExperimentCohort,
|
|
344
|
+
userRole = _pluginState$mentionP.userRole;
|
|
345
|
+
fireEvent((0, _analytics.buildTypeAheadInviteExposurePayload)(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
|
|
346
|
+
},
|
|
347
|
+
selectItem: function selectItem(state, item, insert, _ref8) {
|
|
348
|
+
var mode = _ref8.mode,
|
|
349
|
+
stats = _ref8.stats,
|
|
350
|
+
query = _ref8.query,
|
|
351
|
+
sourceListItem = _ref8.sourceListItem;
|
|
352
|
+
var schema = state.schema;
|
|
353
|
+
var pluginState = (0, _utils2.getMentionPluginState)(state);
|
|
354
|
+
var mentionProvider = pluginState.mentionProvider;
|
|
355
|
+
var _item$mention = item.mention,
|
|
356
|
+
id = _item$mention.id,
|
|
357
|
+
name = _item$mention.name,
|
|
358
|
+
nickname = _item$mention.nickname,
|
|
359
|
+
accessLevel = _item$mention.accessLevel,
|
|
360
|
+
userType = _item$mention.userType;
|
|
361
|
+
var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
362
|
+
var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
363
|
+
|
|
364
|
+
var mentionContext = _objectSpread(_objectSpread({}, pluginState.contextIdentifierProvider), {}, {
|
|
365
|
+
sessionId: sessionId
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
if (mentionProvider && !(0, _utils.isInviteItem)(item.mention)) {
|
|
369
|
+
mentionProvider.recordMentionSelection(item.mention, mentionContext);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
373
|
+
|
|
374
|
+
if (mentionProvider && mentionProvider.shouldEnableInvite && (0, _utils.isInviteItem)(item.mention)) {
|
|
375
|
+
// Don't fire event and the callback with selection by space press
|
|
376
|
+
if (mode !== 'space') {
|
|
377
|
+
fireEvent((0, _analytics.buildTypeAheadInviteItemClickedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, pluginState.contextIdentifierProvider, mentionProvider.userRole));
|
|
378
|
+
|
|
379
|
+
if (mentionProvider.onInviteItemClick) {
|
|
380
|
+
mentionProvider.onInviteItemClick('mention');
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return state.tr;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
fireEvent((0, _analytics.buildTypeAheadInsertedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, sourceListItem.map(function (x) {
|
|
388
|
+
return x.mention;
|
|
389
|
+
}), query, pluginState.contextIdentifierProvider));
|
|
390
|
+
sessionId = (0, _uuid.default)();
|
|
391
|
+
|
|
392
|
+
if (mentionProvider && (0, _utils.isTeamType)(userType)) {
|
|
393
|
+
_spotlight.TeamMentionHighlightController.registerTeamMention();
|
|
394
|
+
|
|
395
|
+
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
396
|
+
} // Don't insert into document if document data is sanitized.
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
var text = sanitizePrivateContent ? '' : "@".concat(renderName);
|
|
400
|
+
|
|
401
|
+
if (sanitizePrivateContent && (0, _resource.isResolvingMentionProvider)(mentionProvider)) {
|
|
402
|
+
// Cache (locally) for later rendering
|
|
403
|
+
mentionProvider.cacheMentionName(id, renderName);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
var mentionNode = schema.nodes.mention.createChecked({
|
|
407
|
+
text: text,
|
|
408
|
+
id: id,
|
|
409
|
+
accessLevel: accessLevel,
|
|
410
|
+
userType: userType === 'DEFAULT' ? null : userType
|
|
411
|
+
});
|
|
412
|
+
var space = schema.text(' ');
|
|
413
|
+
return insert(_prosemirrorModel.Fragment.from([mentionNode, space]));
|
|
414
|
+
},
|
|
415
|
+
dismiss: function dismiss(_ref9) {
|
|
416
|
+
var editorState = _ref9.editorState,
|
|
417
|
+
query = _ref9.query,
|
|
418
|
+
stats = _ref9.stats;
|
|
419
|
+
firstQueryWithoutResults = null;
|
|
420
|
+
var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
|
|
421
|
+
fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
|
|
422
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
423
|
+
|
|
424
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
425
|
+
var mentionProvider = pluginState.mentionProvider;
|
|
426
|
+
|
|
427
|
+
var _iterator = _createForOfIteratorHelper(subscriptionKeys),
|
|
428
|
+
_step;
|
|
429
|
+
|
|
430
|
+
try {
|
|
431
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
432
|
+
var key = _step.value;
|
|
433
|
+
mentionProvider.unsubscribe(key);
|
|
434
|
+
}
|
|
435
|
+
} catch (err) {
|
|
436
|
+
_iterator.e(err);
|
|
437
|
+
} finally {
|
|
438
|
+
_iterator.f();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
subscriptionKeys.clear();
|
|
443
|
+
sessionId = (0, _uuid.default)();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
return typeAhead;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
exports.createTypeAheadConfig = createTypeAheadConfig;
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = exports.INVITE_ITEM_DESCRIPTION = void 0;
|
|
10
|
+
exports.default = exports.INVITE_ITEM_DESCRIPTION = exports.INVITE_ITEM_MIN_HEIGHT = void 0;
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
@@ -27,6 +27,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
+
var INVITE_ITEM_MIN_HEIGHT = _styles.AVATAR_HEIGHT + _styles.ROW_SIDE_PADDING * 2;
|
|
31
|
+
exports.INVITE_ITEM_MIN_HEIGHT = INVITE_ITEM_MIN_HEIGHT;
|
|
30
32
|
var INVITE_ITEM_DESCRIPTION = {
|
|
31
33
|
id: 'invite-teammate'
|
|
32
34
|
};
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.CapitalizedStyle = exports.MentionItemStyle = exports.NameSectionStyle = exports.AvatarStyle = exports.RowStyle = void 0;
|
|
8
|
+
exports.CapitalizedStyle = exports.MentionItemStyle = exports.NameSectionStyle = exports.AvatarStyle = exports.AVATAR_HEIGHT = exports.RowStyle = exports.ROW_SIDE_PADDING = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -15,11 +15,16 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var ROW_SIDE_PADDING = 14;
|
|
19
|
+
exports.ROW_SIDE_PADDING = ROW_SIDE_PADDING;
|
|
20
|
+
|
|
21
|
+
var RowStyle = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n overflow: hidden;\n padding: 6px ", "px;\n text-overflow: ellipsis;\n vertical-align: middle;\n"])), ROW_SIDE_PADDING);
|
|
19
22
|
|
|
20
23
|
exports.RowStyle = RowStyle;
|
|
24
|
+
var AVATAR_HEIGHT = 36;
|
|
25
|
+
exports.AVATAR_HEIGHT = AVATAR_HEIGHT;
|
|
21
26
|
|
|
22
|
-
var AvatarStyle = _styledComponents.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n flex: initial;\n opacity: inherit;\n width: 36px;\n height:
|
|
27
|
+
var AvatarStyle = _styledComponents.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n flex: initial;\n opacity: inherit;\n width: 36px;\n height: ", "px;\n\n > span {\n width: 24px;\n height: 24px;\n padding: 6px;\n }\n"])), AVATAR_HEIGHT);
|
|
23
28
|
|
|
24
29
|
exports.AvatarStyle = AvatarStyle;
|
|
25
30
|
|