@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.
Files changed (555) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +6 -1
  3. package/dist/cjs/editor.js +1 -4
  4. package/dist/cjs/index.js +24 -40
  5. package/dist/cjs/labs/next/presets/default.js +1 -1
  6. package/dist/cjs/messages.js +5 -0
  7. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +1 -2
  8. package/dist/cjs/plugins/analytics/plugin.js +9 -7
  9. package/dist/cjs/plugins/analytics/types/enums.js +5 -0
  10. package/dist/cjs/plugins/analytics/types/type-ahead.js +5 -0
  11. package/dist/cjs/plugins/block-type/messages.js +10 -0
  12. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
  13. package/dist/cjs/plugins/collab-edit/participants.js +15 -0
  14. package/dist/cjs/plugins/collab-edit/plugin-state.js +14 -0
  15. package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
  16. package/dist/cjs/plugins/collab-edit/ui/avatars.js +19 -2
  17. package/dist/cjs/plugins/collab-edit/utils.js +42 -2
  18. package/dist/cjs/plugins/date/actions.js +4 -2
  19. package/dist/cjs/plugins/date/index.js +1 -1
  20. package/dist/cjs/plugins/date/pm-plugins/utils.js +6 -1
  21. package/dist/cjs/plugins/emoji/index.js +143 -120
  22. package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -14
  23. package/dist/cjs/plugins/expand/pm-plugins/keymap.js +3 -7
  24. package/dist/cjs/plugins/extension/actions.js +16 -16
  25. package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
  26. package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
  27. package/dist/cjs/plugins/extension/ui/Extension/index.js +2 -2
  28. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  29. package/dist/cjs/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -14
  30. package/dist/cjs/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +35 -0
  31. package/dist/cjs/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +38 -0
  32. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -7
  33. package/dist/cjs/plugins/help-dialog/ui/index.js +12 -18
  34. package/dist/cjs/plugins/help-dialog/ui/styles.js +2 -6
  35. package/dist/cjs/plugins/hyperlink/index.js +4 -10
  36. package/dist/cjs/plugins/insert-block/index.js +9 -8
  37. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +7 -3
  38. package/dist/cjs/plugins/list/index.js +5 -0
  39. package/dist/cjs/plugins/macro/actions.js +14 -14
  40. package/dist/cjs/plugins/media/index.js +1 -0
  41. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +1 -0
  42. package/dist/cjs/plugins/media/pm-plugins/main.js +26 -14
  43. package/dist/cjs/plugins/media/styles.js +1 -1
  44. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +86 -0
  45. package/dist/cjs/plugins/media/toolbar/index.js +161 -44
  46. package/dist/cjs/plugins/media/toolbar/utils.js +77 -0
  47. package/dist/cjs/plugins/mentions/index.js +57 -602
  48. package/dist/cjs/plugins/mentions/pm-plugins/key.js +11 -0
  49. package/dist/cjs/plugins/mentions/pm-plugins/main.js +162 -0
  50. package/dist/cjs/plugins/mentions/pm-plugins/utils.js +12 -0
  51. package/dist/cjs/plugins/mentions/type-ahead/index.js +449 -0
  52. package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +3 -1
  53. package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +8 -3
  54. package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +3 -3
  55. package/dist/cjs/plugins/mentions/utils.js +24 -2
  56. package/dist/cjs/plugins/panel/index.js +46 -13
  57. package/dist/cjs/plugins/panel/nodeviews/panel.js +39 -25
  58. package/dist/cjs/plugins/panel/toolbar.js +94 -6
  59. package/dist/cjs/plugins/panel/toolbar.test.js +149 -16
  60. package/dist/cjs/plugins/paste/handlers.js +2 -2
  61. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +6 -3
  62. package/dist/cjs/plugins/placeholder/index.js +6 -0
  63. package/dist/cjs/plugins/quick-insert/api.js +30 -0
  64. package/dist/cjs/plugins/quick-insert/assets/custom-panel.js +55 -0
  65. package/dist/cjs/plugins/quick-insert/assets/index.js +14 -1
  66. package/dist/cjs/plugins/quick-insert/index.js +10 -24
  67. package/dist/cjs/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
  68. package/dist/cjs/plugins/rank.js +1 -1
  69. package/dist/cjs/plugins/rule/index.js +1 -25
  70. package/dist/cjs/plugins/scroll-into-view/index.js +1 -4
  71. package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
  72. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
  73. package/dist/cjs/plugins/status/actions.js +5 -2
  74. package/dist/cjs/plugins/status/plugin.js +1 -1
  75. package/dist/cjs/plugins/table/commands/selection.js +24 -24
  76. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
  77. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
  78. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +3 -1
  79. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +3 -1
  80. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  81. package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  82. package/dist/cjs/plugins/type-ahead/api.js +243 -0
  83. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +238 -0
  84. package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +30 -0
  85. package/dist/cjs/plugins/type-ahead/commands/update-query.js +16 -18
  86. package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +36 -0
  87. package/dist/cjs/plugins/type-ahead/constants.js +25 -0
  88. package/dist/cjs/plugins/type-ahead/index.js +183 -52
  89. package/dist/cjs/plugins/type-ahead/insert-utils.js +132 -0
  90. package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +12 -9
  91. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +238 -0
  92. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +20 -40
  93. package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +28 -0
  94. package/dist/cjs/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
  95. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +79 -424
  96. package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +188 -0
  97. package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +26 -0
  98. package/dist/cjs/plugins/type-ahead/stats-modifier.js +49 -0
  99. package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +18 -0
  100. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +51 -0
  101. package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +24 -0
  102. package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +77 -0
  103. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +325 -0
  104. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +195 -0
  105. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +141 -0
  106. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +141 -0
  107. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +151 -0
  108. package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +118 -0
  109. package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +132 -0
  110. package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +61 -0
  111. package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +50 -0
  112. package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +70 -0
  113. package/dist/cjs/plugins/type-ahead/utils.js +127 -0
  114. package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
  115. package/dist/cjs/plugins/view-update-subscription/index.js +19 -14
  116. package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
  117. package/dist/cjs/plugins/view-update-subscription/subscribe/type-ahead-updates.js +46 -0
  118. package/dist/cjs/test-utils.js +17 -0
  119. package/dist/cjs/types/empty-state-handler.js +5 -0
  120. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +4 -21
  121. package/dist/cjs/ui/ElementBrowser/ElementBrowser.js +4 -2
  122. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -0
  123. package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +16 -23
  124. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +11 -4
  125. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
  126. package/dist/cjs/ui/PanelTextInput/index.js +1 -3
  127. package/dist/cjs/utils/compare.js +7 -7
  128. package/dist/cjs/utils/index.js +7 -8
  129. package/dist/cjs/utils/rich-media-utils.js +2 -2
  130. package/dist/cjs/utils/selection.js +6 -3
  131. package/dist/cjs/version-wrapper.js +1 -1
  132. package/dist/cjs/version.json +1 -1
  133. package/dist/es2019/create-editor/create-plugins-list.js +6 -1
  134. package/dist/es2019/editor.js +1 -4
  135. package/dist/es2019/index.js +4 -6
  136. package/dist/es2019/labs/next/presets/default.js +2 -2
  137. package/dist/es2019/messages.js +5 -0
  138. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +1 -2
  139. package/dist/es2019/plugins/analytics/plugin.js +5 -1
  140. package/dist/es2019/plugins/analytics/types/enums.js +5 -0
  141. package/dist/es2019/plugins/analytics/types/type-ahead.js +1 -0
  142. package/dist/es2019/plugins/block-type/messages.js +10 -0
  143. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -3
  144. package/dist/es2019/plugins/collab-edit/participants.js +14 -0
  145. package/dist/es2019/plugins/collab-edit/plugin-state.js +17 -1
  146. package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
  147. package/dist/es2019/plugins/collab-edit/ui/avatars.js +17 -2
  148. package/dist/es2019/plugins/collab-edit/utils.js +34 -0
  149. package/dist/es2019/plugins/date/actions.js +4 -2
  150. package/dist/es2019/plugins/date/index.js +1 -1
  151. package/dist/es2019/plugins/date/pm-plugins/utils.js +6 -1
  152. package/dist/es2019/plugins/emoji/index.js +169 -146
  153. package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -11
  154. package/dist/es2019/plugins/expand/pm-plugins/keymap.js +3 -6
  155. package/dist/es2019/plugins/extension/actions.js +16 -16
  156. package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
  157. package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
  158. package/dist/es2019/plugins/extension/ui/Extension/index.js +2 -2
  159. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  160. package/dist/es2019/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
  161. package/dist/es2019/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
  162. package/dist/es2019/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
  163. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
  164. package/dist/es2019/plugins/help-dialog/ui/index.js +20 -26
  165. package/dist/es2019/plugins/help-dialog/ui/styles.js +2 -2
  166. package/dist/es2019/plugins/hyperlink/index.js +4 -12
  167. package/dist/es2019/plugins/insert-block/index.js +4 -4
  168. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
  169. package/dist/es2019/plugins/list/index.js +20 -14
  170. package/dist/es2019/plugins/macro/actions.js +14 -14
  171. package/dist/es2019/plugins/media/index.js +1 -0
  172. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +1 -0
  173. package/dist/es2019/plugins/media/pm-plugins/main.js +27 -12
  174. package/dist/es2019/plugins/media/styles.js +7 -2
  175. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +59 -0
  176. package/dist/es2019/plugins/media/toolbar/index.js +158 -42
  177. package/dist/es2019/plugins/media/toolbar/utils.js +32 -0
  178. package/dist/es2019/plugins/mentions/index.js +34 -536
  179. package/dist/es2019/plugins/mentions/pm-plugins/key.js +2 -0
  180. package/dist/es2019/plugins/mentions/pm-plugins/main.js +138 -0
  181. package/dist/es2019/plugins/mentions/pm-plugins/utils.js +4 -0
  182. package/dist/es2019/plugins/mentions/type-ahead/index.js +394 -0
  183. package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +2 -1
  184. package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +4 -2
  185. package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +2 -2
  186. package/dist/es2019/plugins/mentions/utils.js +20 -1
  187. package/dist/es2019/plugins/panel/index.js +95 -62
  188. package/dist/es2019/plugins/panel/nodeviews/panel.js +7 -1
  189. package/dist/es2019/plugins/panel/toolbar.js +90 -6
  190. package/dist/es2019/plugins/panel/toolbar.test.js +131 -14
  191. package/dist/es2019/plugins/paste/handlers.js +2 -2
  192. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +6 -3
  193. package/dist/es2019/plugins/placeholder/index.js +5 -0
  194. package/dist/es2019/plugins/quick-insert/api.js +18 -0
  195. package/dist/es2019/plugins/quick-insert/assets/custom-panel.js +45 -0
  196. package/dist/es2019/plugins/quick-insert/assets/index.js +6 -0
  197. package/dist/es2019/plugins/quick-insert/index.js +12 -23
  198. package/dist/es2019/plugins/quick-insert/search.js +1 -3
  199. package/dist/es2019/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
  200. package/dist/es2019/plugins/rank.js +1 -1
  201. package/dist/es2019/plugins/rule/index.js +1 -22
  202. package/dist/es2019/plugins/scroll-into-view/index.js +1 -3
  203. package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
  204. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
  205. package/dist/es2019/plugins/status/actions.js +5 -2
  206. package/dist/es2019/plugins/status/plugin.js +1 -1
  207. package/dist/es2019/plugins/table/commands/selection.js +25 -25
  208. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
  209. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
  210. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
  211. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
  212. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  213. package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  214. package/dist/es2019/plugins/type-ahead/api.js +224 -0
  215. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +222 -0
  216. package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +19 -0
  217. package/dist/es2019/plugins/type-ahead/commands/update-query.js +17 -15
  218. package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +25 -0
  219. package/dist/es2019/plugins/type-ahead/constants.js +15 -0
  220. package/dist/es2019/plugins/type-ahead/index.js +203 -78
  221. package/dist/es2019/plugins/type-ahead/insert-utils.js +119 -0
  222. package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +11 -8
  223. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +211 -0
  224. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +18 -32
  225. package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +19 -0
  226. package/dist/es2019/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
  227. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +81 -401
  228. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +165 -0
  229. package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +16 -0
  230. package/dist/es2019/plugins/type-ahead/stats-modifier.js +41 -0
  231. package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
  232. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +40 -0
  233. package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +11 -0
  234. package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
  235. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +307 -0
  236. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +163 -0
  237. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +136 -0
  238. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +120 -0
  239. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +110 -0
  240. package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +97 -0
  241. package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +126 -0
  242. package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +43 -0
  243. package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +41 -0
  244. package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +53 -0
  245. package/dist/es2019/plugins/type-ahead/utils.js +93 -0
  246. package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +29 -2
  247. package/dist/es2019/plugins/view-update-subscription/index.js +19 -14
  248. package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +9 -3
  249. package/dist/es2019/plugins/view-update-subscription/subscribe/type-ahead-updates.js +34 -0
  250. package/dist/es2019/test-utils.js +7 -0
  251. package/dist/es2019/types/empty-state-handler.js +1 -0
  252. package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +4 -8
  253. package/dist/es2019/ui/ConfigPanel/transformers.js +9 -9
  254. package/dist/es2019/ui/ElementBrowser/ElementBrowser.js +4 -2
  255. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
  256. package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +20 -21
  257. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +9 -2
  258. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
  259. package/dist/es2019/ui/PanelTextInput/index.js +1 -3
  260. package/dist/es2019/utils/compare.js +7 -7
  261. package/dist/es2019/utils/index.js +7 -8
  262. package/dist/es2019/utils/rich-media-utils.js +2 -2
  263. package/dist/es2019/utils/selection.js +6 -3
  264. package/dist/es2019/version-wrapper.js +1 -1
  265. package/dist/es2019/version.json +1 -1
  266. package/dist/esm/create-editor/create-plugins-list.js +6 -1
  267. package/dist/esm/editor.js +1 -4
  268. package/dist/esm/index.js +4 -6
  269. package/dist/esm/labs/next/presets/default.js +2 -2
  270. package/dist/esm/messages.js +5 -0
  271. package/dist/esm/nodeviews/SelectionBasedNodeView.js +1 -2
  272. package/dist/esm/plugins/analytics/plugin.js +8 -6
  273. package/dist/esm/plugins/analytics/types/enums.js +5 -0
  274. package/dist/esm/plugins/analytics/types/type-ahead.js +1 -0
  275. package/dist/esm/plugins/block-type/messages.js +10 -0
  276. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -3
  277. package/dist/esm/plugins/collab-edit/participants.js +15 -0
  278. package/dist/esm/plugins/collab-edit/plugin-state.js +15 -1
  279. package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +6 -4
  280. package/dist/esm/plugins/collab-edit/ui/avatars.js +17 -2
  281. package/dist/esm/plugins/collab-edit/utils.js +32 -0
  282. package/dist/esm/plugins/date/actions.js +4 -2
  283. package/dist/esm/plugins/date/index.js +1 -1
  284. package/dist/esm/plugins/date/pm-plugins/utils.js +6 -1
  285. package/dist/esm/plugins/emoji/index.js +136 -112
  286. package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -13
  287. package/dist/esm/plugins/expand/pm-plugins/keymap.js +3 -6
  288. package/dist/esm/plugins/extension/actions.js +16 -16
  289. package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
  290. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +5 -4
  291. package/dist/esm/plugins/extension/ui/Extension/index.js +2 -2
  292. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +3 -2
  293. package/dist/esm/plugins/floating-toolbar/ui/ConfirmationModal.js +12 -15
  294. package/dist/esm/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +25 -0
  295. package/dist/esm/plugins/floating-toolbar/ui/EditorHideEmojiIcon.js +28 -0
  296. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -5
  297. package/dist/esm/plugins/help-dialog/ui/index.js +13 -19
  298. package/dist/esm/plugins/help-dialog/ui/styles.js +2 -6
  299. package/dist/esm/plugins/hyperlink/index.js +4 -10
  300. package/dist/esm/plugins/insert-block/index.js +5 -5
  301. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +8 -4
  302. package/dist/esm/plugins/list/index.js +5 -0
  303. package/dist/esm/plugins/macro/actions.js +14 -14
  304. package/dist/esm/plugins/media/index.js +1 -0
  305. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -0
  306. package/dist/esm/plugins/media/pm-plugins/main.js +27 -14
  307. package/dist/esm/plugins/media/styles.js +2 -2
  308. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +62 -0
  309. package/dist/esm/plugins/media/toolbar/index.js +154 -43
  310. package/dist/esm/plugins/media/toolbar/utils.js +60 -0
  311. package/dist/esm/plugins/mentions/index.js +45 -557
  312. package/dist/esm/plugins/mentions/pm-plugins/key.js +2 -0
  313. package/dist/esm/plugins/mentions/pm-plugins/main.js +145 -0
  314. package/dist/esm/plugins/mentions/pm-plugins/utils.js +4 -0
  315. package/dist/esm/plugins/mentions/type-ahead/index.js +415 -0
  316. package/dist/esm/plugins/mentions/ui/InviteItem/index.js +2 -1
  317. package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +4 -2
  318. package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +2 -2
  319. package/dist/esm/plugins/mentions/utils.js +19 -0
  320. package/dist/esm/plugins/panel/index.js +44 -13
  321. package/dist/esm/plugins/panel/nodeviews/panel.js +36 -22
  322. package/dist/esm/plugins/panel/toolbar.js +92 -6
  323. package/dist/esm/plugins/panel/toolbar.test.js +148 -16
  324. package/dist/esm/plugins/paste/handlers.js +2 -2
  325. package/dist/esm/plugins/paste/pm-plugins/analytics.js +6 -3
  326. package/dist/esm/plugins/placeholder/index.js +5 -0
  327. package/dist/esm/plugins/quick-insert/api.js +20 -0
  328. package/dist/esm/plugins/quick-insert/assets/custom-panel.js +45 -0
  329. package/dist/esm/plugins/quick-insert/assets/index.js +12 -0
  330. package/dist/esm/plugins/quick-insert/index.js +10 -24
  331. package/dist/esm/plugins/quick-insert/search.js +1 -3
  332. package/dist/esm/plugins/quick-insert/ui/ModalElementBrowser/index.js +1 -0
  333. package/dist/esm/plugins/rank.js +1 -1
  334. package/dist/esm/plugins/rule/index.js +1 -22
  335. package/dist/esm/plugins/scroll-into-view/index.js +1 -3
  336. package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
  337. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
  338. package/dist/esm/plugins/status/actions.js +5 -2
  339. package/dist/esm/plugins/status/plugin.js +1 -1
  340. package/dist/esm/plugins/table/commands/selection.js +24 -24
  341. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +8 -1
  342. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -15
  343. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -1
  344. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -1
  345. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  346. package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  347. package/dist/esm/plugins/type-ahead/api.js +228 -0
  348. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +217 -0
  349. package/dist/esm/plugins/type-ahead/commands/update-list-items.js +19 -0
  350. package/dist/esm/plugins/type-ahead/commands/update-query.js +13 -13
  351. package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +25 -0
  352. package/dist/esm/plugins/type-ahead/constants.js +15 -0
  353. package/dist/esm/plugins/type-ahead/index.js +173 -53
  354. package/dist/esm/plugins/type-ahead/insert-utils.js +116 -0
  355. package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +11 -8
  356. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +204 -0
  357. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +18 -33
  358. package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +18 -0
  359. package/dist/esm/plugins/type-ahead/pm-plugins/{plugin-key.js → key.js} +0 -0
  360. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +80 -393
  361. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +168 -0
  362. package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +16 -0
  363. package/dist/esm/plugins/type-ahead/stats-modifier.js +43 -0
  364. package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +7 -0
  365. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +39 -0
  366. package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +13 -0
  367. package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +51 -0
  368. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +302 -0
  369. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +168 -0
  370. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +105 -0
  371. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +114 -0
  372. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +125 -0
  373. package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +101 -0
  374. package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +118 -0
  375. package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +46 -0
  376. package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +38 -0
  377. package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +48 -0
  378. package/dist/esm/plugins/type-ahead/utils.js +88 -0
  379. package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +33 -2
  380. package/dist/esm/plugins/view-update-subscription/index.js +19 -14
  381. package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +10 -3
  382. package/dist/esm/plugins/view-update-subscription/subscribe/type-ahead-updates.js +33 -0
  383. package/dist/esm/test-utils.js +7 -0
  384. package/dist/esm/types/empty-state-handler.js +1 -0
  385. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +4 -14
  386. package/dist/esm/ui/ElementBrowser/ElementBrowser.js +4 -2
  387. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
  388. package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +16 -23
  389. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +10 -3
  390. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +12 -4
  391. package/dist/esm/ui/PanelTextInput/index.js +1 -3
  392. package/dist/esm/utils/compare.js +7 -7
  393. package/dist/esm/utils/index.js +7 -8
  394. package/dist/esm/utils/rich-media-utils.js +2 -2
  395. package/dist/esm/utils/selection.js +6 -3
  396. package/dist/esm/version-wrapper.js +1 -1
  397. package/dist/esm/version.json +1 -1
  398. package/dist/types/commands/index.d.ts +1 -1
  399. package/dist/types/create-editor/ErrorBoundary.d.ts +1 -1
  400. package/dist/types/index.d.ts +3 -5
  401. package/dist/types/labs/next/full-page.d.ts +1 -1
  402. package/dist/types/labs/next/mobile.d.ts +1 -1
  403. package/dist/types/labs/next/presets/default.d.ts +2 -0
  404. package/dist/types/messages.d.ts +5 -0
  405. package/dist/types/plugins/alignment/commands/index.d.ts +2 -2
  406. package/dist/types/plugins/analytics/types/enums.d.ts +6 -1
  407. package/dist/types/plugins/analytics/types/events.d.ts +12 -2
  408. package/dist/types/plugins/analytics/types/general-events.d.ts +2 -23
  409. package/dist/types/plugins/analytics/types/type-ahead.d.ts +27 -0
  410. package/dist/types/plugins/block-type/messages.d.ts +10 -0
  411. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
  412. package/dist/types/plugins/collab-edit/participants.d.ts +1 -0
  413. package/dist/types/plugins/collab-edit/ui/avatars.d.ts +3 -1
  414. package/dist/types/plugins/collab-edit/ui/invite-to-edit.d.ts +1 -1
  415. package/dist/types/plugins/collab-edit/utils.d.ts +4 -2
  416. package/dist/types/plugins/date/actions.d.ts +1 -1
  417. package/dist/types/plugins/date/pm-plugins/types.d.ts +1 -0
  418. package/dist/types/plugins/emoji/index.d.ts +2 -4
  419. package/dist/types/plugins/emoji/types.d.ts +2 -2
  420. package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
  421. package/dist/types/plugins/extension/ui/Extension/Extension/styles.d.ts +1 -1
  422. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
  423. package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -3
  424. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  425. package/dist/types/plugins/find-replace/ui/styles.d.ts +3 -3
  426. package/dist/types/plugins/floating-toolbar/ui/EditorEmojiAddIcon.d.ts +1 -0
  427. package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +1 -0
  428. package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
  429. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -1
  430. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -0
  431. package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +7 -0
  432. package/dist/types/plugins/media/toolbar/utils.d.ts +4 -0
  433. package/dist/types/plugins/media/types.d.ts +3 -0
  434. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
  435. package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
  436. package/dist/types/plugins/mentions/analytics.d.ts +1 -1
  437. package/dist/types/plugins/mentions/index.d.ts +4 -30
  438. package/dist/types/plugins/mentions/pm-plugins/key.d.ts +3 -0
  439. package/dist/types/plugins/mentions/pm-plugins/main.d.ts +8 -0
  440. package/dist/types/plugins/mentions/pm-plugins/utils.d.ts +3 -0
  441. package/dist/types/plugins/mentions/type-ahead/index.d.ts +17 -0
  442. package/dist/types/plugins/mentions/types.d.ts +2 -0
  443. package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +1 -0
  444. package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +2 -0
  445. package/dist/types/plugins/mentions/utils.d.ts +4 -0
  446. package/dist/types/plugins/panel/nodeviews/panel.d.ts +19 -3
  447. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -0
  448. package/dist/types/plugins/quick-insert/api.d.ts +6 -0
  449. package/dist/types/plugins/quick-insert/assets/custom-panel.d.ts +1 -0
  450. package/dist/types/plugins/quick-insert/assets/index.d.ts +1 -0
  451. package/dist/types/plugins/quick-insert/search.d.ts +1 -1
  452. package/dist/types/plugins/quick-insert/types.d.ts +3 -0
  453. package/dist/types/plugins/status/actions.d.ts +3 -1
  454. package/dist/types/plugins/status/ui/statusPicker.d.ts +1 -1
  455. package/dist/types/plugins/type-ahead/api.d.ts +53 -0
  456. package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +12 -0
  457. package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +3 -0
  458. package/dist/types/plugins/type-ahead/commands/update-query.d.ts +2 -2
  459. package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +2 -0
  460. package/dist/types/plugins/type-ahead/constants.d.ts +10 -0
  461. package/dist/types/plugins/type-ahead/index.d.ts +5 -4
  462. package/dist/types/plugins/type-ahead/insert-utils.d.ts +18 -0
  463. package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +9 -8
  464. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +24 -0
  465. package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -1
  466. package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +2 -0
  467. package/dist/types/plugins/type-ahead/pm-plugins/{plugin-key.d.ts → key.d.ts} +0 -0
  468. package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +12 -39
  469. package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +10 -0
  470. package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +4 -0
  471. package/dist/types/plugins/type-ahead/stats-modifier.d.ts +20 -0
  472. package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +2 -0
  473. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +9 -0
  474. package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +2 -0
  475. package/dist/types/plugins/type-ahead/types.d.ts +95 -30
  476. package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +21 -0
  477. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +22 -0
  478. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +11 -0
  479. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +15 -0
  480. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +22 -0
  481. package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +20 -0
  482. package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +25 -0
  483. package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +3 -0
  484. package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +3 -0
  485. package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +11 -0
  486. package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +9 -0
  487. package/dist/types/plugins/type-ahead/utils.d.ts +18 -0
  488. package/dist/types/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +9 -0
  489. package/dist/types/test-utils.d.ts +2 -0
  490. package/dist/types/types/editor-props.d.ts +2 -0
  491. package/dist/types/types/empty-state-handler.d.ts +7 -0
  492. package/dist/types/types/feature-flags.d.ts +8 -0
  493. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  494. package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
  495. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  496. package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
  497. package/dist/types/ui/ElementBrowser/ElementBrowser.d.ts +2 -0
  498. package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +2 -0
  499. package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
  500. package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +5 -1
  501. package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +3 -1
  502. package/dist/types/ui/LinkSearch/index.d.ts +20 -20
  503. package/dist/types/ui/PortalProvider/index.d.ts +1 -1
  504. package/dist/types/ui/ToolbarButton/index.d.ts +4 -4
  505. package/dist/types/ui/ToolbarButton/styles.d.ts +2 -2
  506. package/dist/types/utils/selection.d.ts +2 -2
  507. package/package.json +32 -29
  508. package/dist/cjs/plugins/emoji/commands/insert-emoji-query.js +0 -22
  509. package/dist/cjs/plugins/mentions/commands/insert-mention-query.js +0 -22
  510. package/dist/cjs/plugins/type-ahead/commands/dismiss.js +0 -44
  511. package/dist/cjs/plugins/type-ahead/commands/insert-query.js +0 -38
  512. package/dist/cjs/plugins/type-ahead/commands/items-list-updated.js +0 -25
  513. package/dist/cjs/plugins/type-ahead/commands/select-item.js +0 -163
  514. package/dist/cjs/plugins/type-ahead/commands/set-current-index.js +0 -25
  515. package/dist/cjs/plugins/type-ahead/pm-plugins/keymap.js +0 -115
  516. package/dist/cjs/plugins/type-ahead/ui/TypeAhead.js +0 -221
  517. package/dist/cjs/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -239
  518. package/dist/cjs/plugins/type-ahead/utils/find-query-mark.js +0 -33
  519. package/dist/cjs/plugins/type-ahead/utils/is-query-active.js +0 -16
  520. package/dist/es2019/plugins/emoji/commands/insert-emoji-query.js +0 -13
  521. package/dist/es2019/plugins/mentions/commands/insert-mention-query.js +0 -13
  522. package/dist/es2019/plugins/type-ahead/commands/dismiss.js +0 -36
  523. package/dist/es2019/plugins/type-ahead/commands/insert-query.js +0 -26
  524. package/dist/es2019/plugins/type-ahead/commands/items-list-updated.js +0 -12
  525. package/dist/es2019/plugins/type-ahead/commands/select-item.js +0 -119
  526. package/dist/es2019/plugins/type-ahead/commands/set-current-index.js +0 -13
  527. package/dist/es2019/plugins/type-ahead/pm-plugins/keymap.js +0 -94
  528. package/dist/es2019/plugins/type-ahead/ui/TypeAhead.js +0 -175
  529. package/dist/es2019/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -196
  530. package/dist/es2019/plugins/type-ahead/utils/find-query-mark.js +0 -29
  531. package/dist/es2019/plugins/type-ahead/utils/is-query-active.js +0 -9
  532. package/dist/esm/plugins/emoji/commands/insert-emoji-query.js +0 -13
  533. package/dist/esm/plugins/mentions/commands/insert-mention-query.js +0 -13
  534. package/dist/esm/plugins/type-ahead/commands/dismiss.js +0 -33
  535. package/dist/esm/plugins/type-ahead/commands/insert-query.js +0 -26
  536. package/dist/esm/plugins/type-ahead/commands/items-list-updated.js +0 -14
  537. package/dist/esm/plugins/type-ahead/commands/select-item.js +0 -132
  538. package/dist/esm/plugins/type-ahead/commands/set-current-index.js +0 -15
  539. package/dist/esm/plugins/type-ahead/pm-plugins/keymap.js +0 -94
  540. package/dist/esm/plugins/type-ahead/ui/TypeAhead.js +0 -202
  541. package/dist/esm/plugins/type-ahead/ui/TypeAheadItemsList.js +0 -204
  542. package/dist/esm/plugins/type-ahead/utils/find-query-mark.js +0 -24
  543. package/dist/esm/plugins/type-ahead/utils/is-query-active.js +0 -9
  544. package/dist/types/plugins/emoji/commands/insert-emoji-query.d.ts +0 -2
  545. package/dist/types/plugins/mentions/commands/insert-mention-query.d.ts +0 -2
  546. package/dist/types/plugins/type-ahead/commands/dismiss.d.ts +0 -2
  547. package/dist/types/plugins/type-ahead/commands/insert-query.d.ts +0 -2
  548. package/dist/types/plugins/type-ahead/commands/items-list-updated.d.ts +0 -3
  549. package/dist/types/plugins/type-ahead/commands/select-item.d.ts +0 -9
  550. package/dist/types/plugins/type-ahead/commands/set-current-index.d.ts +0 -2
  551. package/dist/types/plugins/type-ahead/pm-plugins/keymap.d.ts +0 -3
  552. package/dist/types/plugins/type-ahead/ui/TypeAhead.d.ts +0 -37
  553. package/dist/types/plugins/type-ahead/ui/TypeAheadItemsList.d.ts +0 -32
  554. package/dist/types/plugins/type-ahead/utils/find-query-mark.d.ts +0 -10
  555. package/dist/types/plugins/type-ahead/utils/is-query-active.d.ts +0 -2
@@ -0,0 +1,145 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ 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; }
4
+
5
+ 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) { _defineProperty(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; }
6
+
7
+ import { Plugin } from 'prosemirror-state';
8
+ import { SLI_EVENT_TYPE, SMART_EVENT_TYPE, buildSliPayload } from '@atlaskit/mention/resource';
9
+ import mentionNodeView from '../nodeviews/mention';
10
+ import { mentionPluginKey } from './key';
11
+ var ACTIONS = {
12
+ SET_PROVIDER: 'SET_PROVIDER',
13
+ SET_CONTEXT: 'SET_CONTEXT'
14
+ };
15
+
16
+ var setProvider = function setProvider(provider) {
17
+ return function (state, dispatch) {
18
+ if (dispatch) {
19
+ dispatch(state.tr.setMeta(mentionPluginKey, {
20
+ action: ACTIONS.SET_PROVIDER,
21
+ params: {
22
+ provider: provider
23
+ }
24
+ }));
25
+ }
26
+
27
+ return true;
28
+ };
29
+ };
30
+
31
+ export var setContext = function setContext(context) {
32
+ return function (state, dispatch) {
33
+ if (dispatch) {
34
+ dispatch(state.tr.setMeta(mentionPluginKey, {
35
+ action: ACTIONS.SET_CONTEXT,
36
+ params: {
37
+ context: context
38
+ }
39
+ }));
40
+ }
41
+
42
+ return true;
43
+ };
44
+ };
45
+ export function createMentionPlugin(dispatch, providerFactory, portalProviderAPI, eventDispatcher, fireEvent, options) {
46
+ var mentionProvider;
47
+
48
+ var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
49
+ if (event === SLI_EVENT_TYPE || event === SMART_EVENT_TYPE) {
50
+ fireEvent(buildSliPayload(actionSubject, action, attributes));
51
+ }
52
+ };
53
+
54
+ return new Plugin({
55
+ key: mentionPluginKey,
56
+ state: {
57
+ init: function init() {
58
+ return {};
59
+ },
60
+ apply: function apply(tr, pluginState) {
61
+ var _ref = tr.getMeta(mentionPluginKey) || {
62
+ action: null,
63
+ params: null
64
+ },
65
+ action = _ref.action,
66
+ params = _ref.params;
67
+
68
+ var newPluginState = pluginState;
69
+
70
+ switch (action) {
71
+ case ACTIONS.SET_PROVIDER:
72
+ newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
73
+ mentionProvider: params.provider
74
+ });
75
+ dispatch(mentionPluginKey, newPluginState);
76
+ return newPluginState;
77
+
78
+ case ACTIONS.SET_CONTEXT:
79
+ newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
80
+ contextIdentifierProvider: params.context
81
+ });
82
+ dispatch(mentionPluginKey, newPluginState);
83
+ return newPluginState;
84
+ }
85
+
86
+ return newPluginState;
87
+ }
88
+ },
89
+ props: {
90
+ nodeViews: {
91
+ mention: mentionNodeView(portalProviderAPI, eventDispatcher, providerFactory, options)
92
+ }
93
+ },
94
+ view: function view(editorView) {
95
+ var providerHandler = function providerHandler(name, providerPromise) {
96
+ switch (name) {
97
+ case 'mentionProvider':
98
+ if (!providerPromise) {
99
+ return setProvider(undefined)(editorView.state, editorView.dispatch);
100
+ }
101
+
102
+ providerPromise.then(function (provider) {
103
+ if (mentionProvider) {
104
+ mentionProvider.unsubscribe('mentionPlugin');
105
+ }
106
+
107
+ mentionProvider = provider;
108
+ setProvider(provider)(editorView.state, editorView.dispatch);
109
+ provider.subscribe('mentionPlugin', undefined, undefined, undefined, undefined, sendAnalytics);
110
+ }).catch(function () {
111
+ return setProvider(undefined)(editorView.state, editorView.dispatch);
112
+ });
113
+ break;
114
+
115
+ case 'contextIdentifierProvider':
116
+ if (!providerPromise) {
117
+ return setContext(undefined)(editorView.state, editorView.dispatch);
118
+ }
119
+
120
+ providerPromise.then(function (provider) {
121
+ setContext(provider)(editorView.state, editorView.dispatch);
122
+ });
123
+ break;
124
+ }
125
+
126
+ return;
127
+ };
128
+
129
+ providerFactory.subscribe('mentionProvider', providerHandler);
130
+ providerFactory.subscribe('contextIdentifierProvider', providerHandler);
131
+ return {
132
+ destroy: function destroy() {
133
+ if (providerFactory) {
134
+ providerFactory.unsubscribe('mentionProvider', providerHandler);
135
+ providerFactory.unsubscribe('contextIdentifierProvider', providerHandler);
136
+ }
137
+
138
+ if (mentionProvider) {
139
+ mentionProvider.unsubscribe('mentionPlugin');
140
+ }
141
+ }
142
+ };
143
+ }
144
+ });
145
+ }
@@ -0,0 +1,4 @@
1
+ import { mentionPluginKey } from './key';
2
+ export function getMentionPluginState(state) {
3
+ return mentionPluginKey.getState(state);
4
+ }
@@ -0,0 +1,415 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+
4
+ 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; } } }; }
5
+
6
+ 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); }
7
+
8
+ 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; }
9
+
10
+ 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; }
11
+
12
+ 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) { _defineProperty(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; }
13
+
14
+ import React from 'react';
15
+ import uuid from 'uuid';
16
+ import { Fragment } from 'prosemirror-model';
17
+ import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
18
+ import { MENTION_ITEM_HEIGHT, MentionItem } from '@atlaskit/mention/item';
19
+ import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
20
+ import { TeamMentionHighlight, TeamMentionHighlightController } from '@atlaskit/mention/spotlight';
21
+ import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteExposurePayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from '../analytics';
22
+ import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../ui/InviteItem';
23
+ import { isInviteItem, isTeamType, isTeamStats, shouldKeepInviteItem } from '../utils';
24
+ import { getMentionPluginState } from '../pm-plugins/utils';
25
+
26
+ var createInviteItem = function createInviteItem(_ref) {
27
+ var mentionProvider = _ref.mentionProvider,
28
+ onInviteItemMount = _ref.onInviteItemMount;
29
+ return {
30
+ title: INVITE_ITEM_DESCRIPTION.id,
31
+ render: function render(_ref2) {
32
+ var isSelected = _ref2.isSelected,
33
+ onClick = _ref2.onClick,
34
+ onHover = _ref2.onHover;
35
+ return /*#__PURE__*/React.createElement(InviteItem, {
36
+ productName: mentionProvider ? mentionProvider.productName : undefined,
37
+ selected: isSelected,
38
+ onMount: onInviteItemMount,
39
+ onMouseEnter: onHover,
40
+ onSelection: onClick,
41
+ userRole: mentionProvider.userRole
42
+ });
43
+ },
44
+ mention: INVITE_ITEM_DESCRIPTION
45
+ };
46
+ };
47
+
48
+ var withInviteItem = function withInviteItem(_ref3) {
49
+ var mentionProvider = _ref3.mentionProvider,
50
+ firstQueryWithoutResults = _ref3.firstQueryWithoutResults,
51
+ currentQuery = _ref3.currentQuery,
52
+ onInviteItemMount = _ref3.onInviteItemMount;
53
+ return function (mentionItems) {
54
+ var inviteItem = createInviteItem({
55
+ mentionProvider: mentionProvider,
56
+ onInviteItemMount: onInviteItemMount
57
+ });
58
+ var keepInviteItem = shouldKeepInviteItem(currentQuery, firstQueryWithoutResults);
59
+
60
+ if (mentionItems.length === 0) {
61
+ return keepInviteItem ? [inviteItem] : [];
62
+ }
63
+
64
+ return [].concat(_toConsumableArray(mentionItems), [// invite item should be shown at the bottom
65
+ inviteItem]);
66
+ };
67
+ };
68
+
69
+ export var mentionToTypeaheadItem = function mentionToTypeaheadItem(mention) {
70
+ return {
71
+ title: mention.id,
72
+ render: function render(_ref4) {
73
+ var isSelected = _ref4.isSelected,
74
+ onClick = _ref4.onClick,
75
+ onHover = _ref4.onHover;
76
+ return /*#__PURE__*/React.createElement(MentionItem, {
77
+ mention: mention,
78
+ selected: isSelected,
79
+ onMouseEnter: onHover,
80
+ onSelection: onClick
81
+ });
82
+ },
83
+ getCustomComponentHeight: function getCustomComponentHeight() {
84
+ return MENTION_ITEM_HEIGHT;
85
+ },
86
+ mention: mention
87
+ };
88
+ };
89
+ export function memoize(fn) {
90
+ // Cache results here
91
+ var seen = new Map();
92
+
93
+ function memoized(mention) {
94
+ // Check cache for hits
95
+ var hit = seen.get(mention.id);
96
+
97
+ if (hit) {
98
+ return hit;
99
+ } // Generate new result and cache it
100
+
101
+
102
+ var result = fn(mention);
103
+ seen.set(mention.id, result);
104
+ return result;
105
+ }
106
+
107
+ return {
108
+ call: memoized,
109
+ clear: seen.clear.bind(seen)
110
+ };
111
+ }
112
+ var memoizedToItem = memoize(mentionToTypeaheadItem);
113
+
114
+ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
115
+ return function (_ref5) {
116
+ var query = _ref5.query,
117
+ mentions = _ref5.mentions,
118
+ stats = _ref5.stats;
119
+ var duration = 0;
120
+ var userOrTeamIds = null;
121
+ var teams = null;
122
+
123
+ if (!isTeamStats(stats)) {
124
+ // is from primary mention endpoint which could be just user mentions or user/team mentions
125
+ duration = stats && stats.duration;
126
+ teams = null;
127
+ userOrTeamIds = mentions.map(function (mention) {
128
+ return mention.id;
129
+ });
130
+ } else {
131
+ // is from dedicated team-only mention endpoint
132
+ duration = stats && stats.teamMentionDuration;
133
+ userOrTeamIds = null;
134
+ teams = mentions.map(function (mention) {
135
+ return isTeamType(mention.userType) ? {
136
+ teamId: mention.id,
137
+ includesYou: mention.context.includesYou,
138
+ memberCount: mention.context.memberCount
139
+ } : null;
140
+ }).filter(function (m) {
141
+ return !!m;
142
+ });
143
+ }
144
+
145
+ var payload = buildTypeAheadRenderedPayload(duration, userOrTeamIds, query, teams);
146
+ fireEvent(payload);
147
+ };
148
+ };
149
+
150
+ var isTeamMentionProvider = function isTeamMentionProvider(p) {
151
+ return !!(p.mentionTypeaheadHighlightEnabled && p.mentionTypeaheadCreateTeamPath);
152
+ };
153
+ /**
154
+ * When a team mention is selected, we render a team link and list of member/user mentions
155
+ * in editor content
156
+ */
157
+
158
+
159
+ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selectedMention, mentionProvider, sanitizePrivateContent) {
160
+ var nodes = schema.nodes,
161
+ marks = schema.marks;
162
+ var name = selectedMention.name,
163
+ teamId = selectedMention.id,
164
+ accessLevel = selectedMention.accessLevel,
165
+ context = selectedMention.context; // build team link
166
+
167
+ var defaultTeamLink = "".concat(window.location.origin, "/people/team/").concat(teamId);
168
+ var teamLink = context && context.teamLink ? context.teamLink : defaultTeamLink;
169
+ var teamLinkNode = schema.text(name, [marks.link.create({
170
+ href: teamLink
171
+ })]);
172
+ var openBracketText = schema.text('(');
173
+ var closeBracketText = schema.text(')');
174
+ var emptySpaceText = schema.text(' ');
175
+ var inlineNodes = [teamLinkNode, emptySpaceText, openBracketText];
176
+ var members = context && context.members ? context.members : [];
177
+ members.forEach(function (member, index) {
178
+ var name = member.name,
179
+ id = member.id;
180
+ var mentionName = "@".concat(name);
181
+ var text = sanitizePrivateContent ? '' : mentionName;
182
+
183
+ if (sanitizePrivateContent && isResolvingMentionProvider(mentionProvider)) {
184
+ mentionProvider.cacheMentionName(id, name);
185
+ }
186
+
187
+ var userMentionNode = nodes.mention.createChecked({
188
+ text: text,
189
+ id: member.id,
190
+ accessLevel: accessLevel,
191
+ userType: 'DEFAULT'
192
+ });
193
+ inlineNodes.push(userMentionNode); // should not add empty space after the last user mention.
194
+
195
+ if (index !== members.length - 1) {
196
+ inlineNodes.push(emptySpaceText);
197
+ }
198
+ });
199
+ inlineNodes.push(closeBracketText);
200
+ return Fragment.fromArray(inlineNodes);
201
+ };
202
+
203
+ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
204
+ var sanitizePrivateContent = _ref6.sanitizePrivateContent,
205
+ mentionInsertDisplayName = _ref6.mentionInsertDisplayName,
206
+ fireEvent = _ref6.fireEvent,
207
+ HighlightComponent = _ref6.HighlightComponent;
208
+ var sessionId = uuid();
209
+ var firstQueryWithoutResults = null;
210
+ var subscriptionKeys = new Set();
211
+ var typeAhead = {
212
+ id: TypeAheadAvailableNodes.MENTION,
213
+ trigger: '@',
214
+ // Custom regex must have a capture group around trigger
215
+ // so it's possible to use it without needing to scan through all triggers again
216
+ customRegex: '\\(?(@)',
217
+ getHighlight: function getHighlight(state) {
218
+ var CustomHighlightComponent = HighlightComponent;
219
+
220
+ if (CustomHighlightComponent) {
221
+ return /*#__PURE__*/React.createElement(CustomHighlightComponent, null);
222
+ }
223
+
224
+ var pluginState = getMentionPluginState(state);
225
+ var provider = pluginState.mentionProvider;
226
+
227
+ if (provider) {
228
+ var teamMentionProvider = provider;
229
+
230
+ if (isTeamMentionProvider(teamMentionProvider) && teamMentionProvider.mentionTypeaheadHighlightEnabled()) {
231
+ return /*#__PURE__*/React.createElement(TeamMentionHighlight, {
232
+ createTeamLink: teamMentionProvider.mentionTypeaheadCreateTeamPath(),
233
+ onClose: function onClose() {
234
+ return TeamMentionHighlightController.registerClosed();
235
+ }
236
+ });
237
+ }
238
+ }
239
+
240
+ return null;
241
+ },
242
+ getItems: function getItems(_ref7) {
243
+ var query = _ref7.query,
244
+ editorState = _ref7.editorState;
245
+ var pluginState = getMentionPluginState(editorState);
246
+
247
+ if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
248
+ return Promise.resolve([]);
249
+ }
250
+
251
+ var mentionProvider = pluginState.mentionProvider,
252
+ contextIdentifierProvider = pluginState.contextIdentifierProvider;
253
+ return new Promise(function (resolve) {
254
+ var key = "loadingMentionsForTypeAhead_".concat(uuid());
255
+
256
+ var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
257
+ var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
258
+ var stats = arguments.length > 2 ? arguments[2] : undefined;
259
+
260
+ if (query !== resultQuery) {
261
+ return;
262
+ }
263
+
264
+ mentionProvider.unsubscribe(key);
265
+ subscriptionKeys.delete(key);
266
+ var mentionItems = mentions.map(function (mention) {
267
+ return memoizedToItem.call(mention);
268
+ });
269
+ buildAndSendElementsTypeAheadAnalytics(fireEvent)({
270
+ query: query,
271
+ mentions: mentions,
272
+ stats: stats
273
+ });
274
+
275
+ if (mentions.length === 0 && firstQueryWithoutResults === null) {
276
+ firstQueryWithoutResults = query;
277
+ }
278
+
279
+ if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
280
+ resolve(mentionItems);
281
+ } else {
282
+ var items = withInviteItem({
283
+ mentionProvider: mentionProvider,
284
+ firstQueryWithoutResults: firstQueryWithoutResults || '',
285
+ currentQuery: query,
286
+ onInviteItemMount: function onInviteItemMount() {
287
+ fireEvent(buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, mentionProvider.userRole));
288
+ }
289
+ })(mentionItems);
290
+ resolve(items);
291
+ }
292
+ };
293
+
294
+ subscriptionKeys.add(key);
295
+ mentionProvider.subscribe(key, mentionsSubscribeCallback);
296
+ mentionProvider.filter(query || '', _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
297
+ sessionId: sessionId
298
+ }));
299
+ });
300
+ },
301
+ onOpen: function onOpen(editorState) {
302
+ firstQueryWithoutResults = null;
303
+ var pluginState = getMentionPluginState(editorState);
304
+
305
+ if (!pluginState || !pluginState.mentionProvider) {
306
+ return null;
307
+ }
308
+
309
+ var contextIdentifierProvider = pluginState.contextIdentifierProvider,
310
+ _pluginState$mentionP = pluginState.mentionProvider,
311
+ shouldEnableInvite = _pluginState$mentionP.shouldEnableInvite,
312
+ inviteExperimentCohort = _pluginState$mentionP.inviteExperimentCohort,
313
+ userRole = _pluginState$mentionP.userRole;
314
+ fireEvent(buildTypeAheadInviteExposurePayload(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
315
+ },
316
+ selectItem: function selectItem(state, item, insert, _ref8) {
317
+ var mode = _ref8.mode,
318
+ stats = _ref8.stats,
319
+ query = _ref8.query,
320
+ sourceListItem = _ref8.sourceListItem;
321
+ var schema = state.schema;
322
+ var pluginState = getMentionPluginState(state);
323
+ var mentionProvider = pluginState.mentionProvider;
324
+ var _item$mention = item.mention,
325
+ id = _item$mention.id,
326
+ name = _item$mention.name,
327
+ nickname = _item$mention.nickname,
328
+ accessLevel = _item$mention.accessLevel,
329
+ userType = _item$mention.userType;
330
+ var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
331
+ var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
332
+
333
+ var mentionContext = _objectSpread(_objectSpread({}, pluginState.contextIdentifierProvider), {}, {
334
+ sessionId: sessionId
335
+ });
336
+
337
+ if (mentionProvider && !isInviteItem(item.mention)) {
338
+ mentionProvider.recordMentionSelection(item.mention, mentionContext);
339
+ }
340
+
341
+ var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
342
+
343
+ if (mentionProvider && mentionProvider.shouldEnableInvite && isInviteItem(item.mention)) {
344
+ // Don't fire event and the callback with selection by space press
345
+ if (mode !== 'space') {
346
+ fireEvent(buildTypeAheadInviteItemClickedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, pluginState.contextIdentifierProvider, mentionProvider.userRole));
347
+
348
+ if (mentionProvider.onInviteItemClick) {
349
+ mentionProvider.onInviteItemClick('mention');
350
+ }
351
+ }
352
+
353
+ return state.tr;
354
+ }
355
+
356
+ fireEvent(buildTypeAheadInsertedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, sourceListItem.map(function (x) {
357
+ return x.mention;
358
+ }), query, pluginState.contextIdentifierProvider));
359
+ sessionId = uuid();
360
+
361
+ if (mentionProvider && isTeamType(userType)) {
362
+ TeamMentionHighlightController.registerTeamMention();
363
+ return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
364
+ } // Don't insert into document if document data is sanitized.
365
+
366
+
367
+ var text = sanitizePrivateContent ? '' : "@".concat(renderName);
368
+
369
+ if (sanitizePrivateContent && isResolvingMentionProvider(mentionProvider)) {
370
+ // Cache (locally) for later rendering
371
+ mentionProvider.cacheMentionName(id, renderName);
372
+ }
373
+
374
+ var mentionNode = schema.nodes.mention.createChecked({
375
+ text: text,
376
+ id: id,
377
+ accessLevel: accessLevel,
378
+ userType: userType === 'DEFAULT' ? null : userType
379
+ });
380
+ var space = schema.text(' ');
381
+ return insert(Fragment.from([mentionNode, space]));
382
+ },
383
+ dismiss: function dismiss(_ref9) {
384
+ var editorState = _ref9.editorState,
385
+ query = _ref9.query,
386
+ stats = _ref9.stats;
387
+ firstQueryWithoutResults = null;
388
+ var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
389
+ fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
390
+ var pluginState = getMentionPluginState(editorState);
391
+
392
+ if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
393
+ var mentionProvider = pluginState.mentionProvider;
394
+
395
+ var _iterator = _createForOfIteratorHelper(subscriptionKeys),
396
+ _step;
397
+
398
+ try {
399
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
400
+ var key = _step.value;
401
+ mentionProvider.unsubscribe(key);
402
+ }
403
+ } catch (err) {
404
+ _iterator.e(err);
405
+ } finally {
406
+ _iterator.f();
407
+ }
408
+ }
409
+
410
+ subscriptionKeys.clear();
411
+ sessionId = uuid();
412
+ }
413
+ };
414
+ return typeAhead;
415
+ };
@@ -3,8 +3,9 @@ import AddIcon from '@atlaskit/icon/glyph/add';
3
3
  import { N300 } from '@atlaskit/theme/colors';
4
4
  import React, { useCallback, useEffect } from 'react';
5
5
  import { FormattedMessage } from 'react-intl';
6
- import { AvatarStyle, CapitalizedStyle, MentionItemStyle, NameSectionStyle, RowStyle } from './styles';
6
+ import { AvatarStyle, CapitalizedStyle, MentionItemStyle, NameSectionStyle, RowStyle, ROW_SIDE_PADDING, AVATAR_HEIGHT } from './styles';
7
7
  import { messages } from '../../messages';
8
+ export var INVITE_ITEM_MIN_HEIGHT = AVATAR_HEIGHT + ROW_SIDE_PADDING * 2;
8
9
  export var INVITE_ITEM_DESCRIPTION = {
9
10
  id: 'invite-teammate'
10
11
  };
@@ -5,8 +5,10 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
5
5
  import styled from 'styled-components'; // prettier-ignore
6
6
 
7
7
  import { N30, N300 } from '@atlaskit/theme/colors';
8
- export var RowStyle = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n overflow: hidden;\n padding: 6px 14px;\n text-overflow: ellipsis;\n vertical-align: middle;\n"])));
9
- export var AvatarStyle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n flex: initial;\n opacity: inherit;\n width: 36px;\n height: 36px;\n\n > span {\n width: 24px;\n height: 24px;\n padding: 6px;\n }\n"])));
8
+ export var ROW_SIDE_PADDING = 14;
9
+ export var RowStyle = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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);
10
+ export var AVATAR_HEIGHT = 36;
11
+ export var AvatarStyle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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);
10
12
  export var NameSectionStyle = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n margin-left: 14px;\n color: ", ";\n opacity: ", ";\n"])), N300, function (props) {
11
13
  return props.restricted ? '0.5' : 'inherit';
12
14
  });
@@ -14,8 +14,8 @@ import React from 'react';
14
14
  import { PureComponent } from 'react';
15
15
  import MentionIcon from '@atlaskit/icon/glyph/editor/mention';
16
16
  import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
17
- import { insertMentionQuery } from '../../commands/insert-mention-query';
18
17
  import { INPUT_METHOD } from '../../../analytics';
18
+ import { createTypeAheadTools } from '../../../type-ahead/api';
19
19
 
20
20
  var ToolbarMention = /*#__PURE__*/function (_PureComponent) {
21
21
  _inherits(ToolbarMention, _PureComponent);
@@ -38,7 +38,7 @@ var ToolbarMention = /*#__PURE__*/function (_PureComponent) {
38
38
  return false;
39
39
  }
40
40
 
41
- insertMentionQuery(INPUT_METHOD.TOOLBAR)(_this.props.editorView.state, _this.props.editorView.dispatch);
41
+ createTypeAheadTools(_this.props.editorView).openMention(INPUT_METHOD.INSERT_MENU);
42
42
  return true;
43
43
  });
44
44
 
@@ -7,4 +7,23 @@ export var isTeamStats = function isTeamStats(stat) {
7
7
  };
8
8
  export var isInviteItem = function isInviteItem(mention) {
9
9
  return mention && mention.id === INVITE_ITEM_DESCRIPTION.id;
10
+ };
11
+ /**
12
+ * Actions
13
+ */
14
+
15
+ export var shouldKeepInviteItem = function shouldKeepInviteItem(query, firstQueryWithoutResults) {
16
+ if (!firstQueryWithoutResults) {
17
+ return true;
18
+ }
19
+
20
+ var lastIndexWithResults = firstQueryWithoutResults.length - 1;
21
+ var suffix = query.slice(lastIndexWithResults);
22
+
23
+ if (query[lastIndexWithResults - 1] === ' ') {
24
+ suffix = ' ' + suffix;
25
+ }
26
+
27
+ var depletedExtraWords = /\s[^\s]+\s/.test(suffix);
28
+ return !depletedExtraWords;
10
29
  };