@atlaskit/editor-core 175.0.5 → 176.0.0

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 (380) hide show
  1. package/.eslintrc.js +23 -57
  2. package/CHANGELOG.md +70 -0
  3. package/dist/cjs/create-editor/ReactEditorView.js +1 -1
  4. package/dist/cjs/create-editor/create-plugins-list.js +2 -4
  5. package/dist/cjs/keymaps/index.js +0 -6
  6. package/dist/cjs/labs/next/presets/cxhtml.js +1 -3
  7. package/dist/cjs/labs/next/presets/mobile.js +1 -3
  8. package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +12 -5
  9. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  10. package/dist/cjs/plugins/alignment/pm-plugins/keymap.js +0 -1
  11. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +27 -4
  12. package/dist/cjs/plugins/annotation/nodeviews/index.js +7 -35
  13. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +28 -2
  14. package/dist/cjs/plugins/annotation/utils.js +7 -3
  15. package/dist/cjs/plugins/base/pm-plugins/inline-cursor-target.js +1 -0
  16. package/dist/cjs/plugins/caption/nodeviews/index.js +4 -1
  17. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +1 -0
  18. package/dist/cjs/plugins/card/ui/LinkToolbarIconDropdown.js +2 -1
  19. package/dist/cjs/plugins/code-block/nodeviews/code-block.js +7 -3
  20. package/dist/cjs/plugins/code-block/refresh-browser-selection.js +3 -1
  21. package/dist/cjs/plugins/code-block/styles.js +6 -2
  22. package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
  23. package/dist/cjs/plugins/collab-edit/utils.js +4 -0
  24. package/dist/cjs/plugins/copy-button/commands.js +5 -3
  25. package/dist/cjs/plugins/emoji/messages.js +17 -0
  26. package/dist/cjs/plugins/emoji/nodeviews/emoji.js +18 -2
  27. package/dist/cjs/plugins/expand/pm-plugins/keymap.js +11 -1
  28. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +17 -13
  29. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +1 -0
  30. package/dist/cjs/plugins/floating-toolbar/index.js +2 -0
  31. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +9 -1
  32. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +20 -1
  33. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +6 -2
  34. package/dist/cjs/plugins/floating-toolbar/ui/Select.js +10 -4
  35. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -0
  36. package/dist/cjs/plugins/help-dialog/ui/index.js +1 -4
  37. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +2 -2
  38. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -9
  39. package/dist/cjs/plugins/media/index.js +2 -2
  40. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +27 -3
  41. package/dist/cjs/plugins/media/pm-plugins/main.js +17 -2
  42. package/dist/cjs/plugins/media/toolbar/alt-text.js +1 -0
  43. package/dist/cjs/plugins/media/toolbar/linking.js +1 -0
  44. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.js +9 -6
  45. package/dist/cjs/plugins/media/ui/ToolbarMedia/toolbar-media-messages.js +2 -2
  46. package/dist/cjs/plugins/mentions/messages.js +5 -0
  47. package/dist/cjs/plugins/mentions/nodeviews/mention.js +18 -2
  48. package/dist/cjs/plugins/mentions/styles.js +1 -1
  49. package/dist/cjs/plugins/mentions/ui/Mention/index.js +15 -0
  50. package/dist/cjs/plugins/panel/actions.js +1 -1
  51. package/dist/cjs/plugins/panel/index.js +1 -0
  52. package/dist/cjs/plugins/panel/toolbar.js +2 -2
  53. package/dist/cjs/plugins/paste/index.js +2 -3
  54. package/dist/cjs/plugins/paste/pm-plugins/main.js +2 -2
  55. package/dist/cjs/plugins/quick-insert/assets/action.js +3 -0
  56. package/dist/cjs/plugins/quick-insert/assets/code.js +3 -0
  57. package/dist/cjs/plugins/quick-insert/assets/custom-panel.js +3 -0
  58. package/dist/cjs/plugins/quick-insert/assets/date.js +3 -0
  59. package/dist/cjs/plugins/quick-insert/assets/decision.js +3 -0
  60. package/dist/cjs/plugins/quick-insert/assets/divider.js +3 -0
  61. package/dist/cjs/plugins/quick-insert/assets/emoji.js +3 -0
  62. package/dist/cjs/plugins/quick-insert/assets/expand.js +3 -0
  63. package/dist/cjs/plugins/quick-insert/assets/fallback.js +3 -0
  64. package/dist/cjs/plugins/quick-insert/assets/feedback.js +3 -0
  65. package/dist/cjs/plugins/quick-insert/assets/heading1.js +3 -0
  66. package/dist/cjs/plugins/quick-insert/assets/heading2.js +3 -0
  67. package/dist/cjs/plugins/quick-insert/assets/heading3.js +3 -0
  68. package/dist/cjs/plugins/quick-insert/assets/heading4.js +3 -0
  69. package/dist/cjs/plugins/quick-insert/assets/heading5.js +3 -0
  70. package/dist/cjs/plugins/quick-insert/assets/heading6.js +3 -0
  71. package/dist/cjs/plugins/quick-insert/assets/images.js +3 -0
  72. package/dist/cjs/plugins/quick-insert/assets/layout.js +3 -0
  73. package/dist/cjs/plugins/quick-insert/assets/link.js +3 -0
  74. package/dist/cjs/plugins/quick-insert/assets/list-number.js +3 -0
  75. package/dist/cjs/plugins/quick-insert/assets/list.js +3 -0
  76. package/dist/cjs/plugins/quick-insert/assets/mention.js +3 -0
  77. package/dist/cjs/plugins/quick-insert/assets/panel-error.js +3 -0
  78. package/dist/cjs/plugins/quick-insert/assets/panel-note.js +3 -0
  79. package/dist/cjs/plugins/quick-insert/assets/panel-success.js +3 -0
  80. package/dist/cjs/plugins/quick-insert/assets/panel-warning.js +3 -0
  81. package/dist/cjs/plugins/quick-insert/assets/panel.js +3 -0
  82. package/dist/cjs/plugins/quick-insert/assets/quote.js +3 -0
  83. package/dist/cjs/plugins/quick-insert/assets/status.js +3 -0
  84. package/dist/cjs/plugins/selection/gap-cursor/actions.js +26 -3
  85. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +41 -4
  86. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/styles.js +6 -1
  87. package/dist/cjs/plugins/text-color/utils/color.js +3 -0
  88. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +4 -3
  89. package/dist/cjs/plugins/type-ahead/index.js +42 -22
  90. package/dist/cjs/plugins/type-ahead/messages.js +13 -3
  91. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +25 -16
  92. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +126 -64
  93. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +12 -14
  94. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +37 -14
  95. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +36 -5
  96. package/dist/cjs/plugins/type-ahead/utils.js +3 -1
  97. package/dist/cjs/ui/Alignment/index.js +0 -1
  98. package/dist/cjs/ui/Appearance/Chromeless.js +1 -1
  99. package/dist/cjs/ui/Appearance/Comment/Toolbar.js +1 -1
  100. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +6 -2
  101. package/dist/cjs/ui/ColorPickerButton/index.js +4 -0
  102. package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -4
  103. package/dist/cjs/ui/ConfigPanel/Fields/Select.js +1 -3
  104. package/dist/cjs/ui/Dropdown/index.js +28 -1
  105. package/dist/cjs/ui/DropdownMenu/index.js +25 -1
  106. package/dist/cjs/ui/ElementBrowser/constants.js +0 -1
  107. package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +166 -0
  108. package/dist/cjs/ui/styles.js +12 -18
  109. package/dist/cjs/utils/clipboard.js +17 -12
  110. package/dist/cjs/utils/document.js +13 -0
  111. package/dist/cjs/utils/index.js +0 -9
  112. package/dist/cjs/utils/input-rules.js +7 -5
  113. package/dist/cjs/utils/table.js +35 -0
  114. package/dist/cjs/version-wrapper.js +1 -1
  115. package/dist/cjs/version.json +1 -1
  116. package/dist/es2019/create-editor/ReactEditorView.js +1 -1
  117. package/dist/es2019/create-editor/create-plugins-list.js +2 -4
  118. package/dist/es2019/keymaps/index.js +1 -1
  119. package/dist/es2019/labs/next/presets/cxhtml.js +1 -3
  120. package/dist/es2019/labs/next/presets/mobile.js +1 -3
  121. package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +11 -4
  122. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  123. package/dist/es2019/plugins/alignment/pm-plugins/keymap.js +1 -2
  124. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +26 -4
  125. package/dist/es2019/plugins/annotation/nodeviews/index.js +7 -31
  126. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +24 -3
  127. package/dist/es2019/plugins/annotation/utils.js +8 -4
  128. package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +1 -0
  129. package/dist/es2019/plugins/caption/nodeviews/index.js +4 -1
  130. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +1 -0
  131. package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +2 -1
  132. package/dist/es2019/plugins/code-block/nodeviews/code-block.js +7 -3
  133. package/dist/es2019/plugins/code-block/refresh-browser-selection.js +2 -1
  134. package/dist/es2019/plugins/code-block/styles.js +21 -5
  135. package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
  136. package/dist/es2019/plugins/collab-edit/utils.js +5 -1
  137. package/dist/es2019/plugins/copy-button/commands.js +5 -3
  138. package/dist/es2019/plugins/emoji/messages.js +8 -0
  139. package/dist/es2019/plugins/emoji/nodeviews/emoji.js +16 -2
  140. package/dist/es2019/plugins/expand/pm-plugins/keymap.js +10 -1
  141. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +17 -13
  142. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +1 -0
  143. package/dist/es2019/plugins/floating-toolbar/index.js +2 -0
  144. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +9 -1
  145. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +20 -1
  146. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +3 -2
  147. package/dist/es2019/plugins/floating-toolbar/ui/Select.js +9 -3
  148. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -0
  149. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -2
  150. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +2 -2
  151. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +15 -2
  152. package/dist/es2019/plugins/media/index.js +2 -2
  153. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +25 -4
  154. package/dist/es2019/plugins/media/pm-plugins/main.js +14 -1
  155. package/dist/es2019/plugins/media/toolbar/alt-text.js +1 -0
  156. package/dist/es2019/plugins/media/toolbar/linking.js +1 -0
  157. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.js +4 -2
  158. package/dist/es2019/plugins/media/ui/ToolbarMedia/toolbar-media-messages.js +2 -2
  159. package/dist/es2019/plugins/mentions/messages.js +5 -0
  160. package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -2
  161. package/dist/es2019/plugins/mentions/styles.js +2 -1
  162. package/dist/es2019/plugins/mentions/ui/Mention/index.js +12 -0
  163. package/dist/es2019/plugins/panel/actions.js +2 -2
  164. package/dist/es2019/plugins/panel/index.js +1 -0
  165. package/dist/es2019/plugins/panel/toolbar.js +3 -3
  166. package/dist/es2019/plugins/paste/index.js +2 -3
  167. package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -2
  168. package/dist/es2019/plugins/quick-insert/assets/action.js +3 -0
  169. package/dist/es2019/plugins/quick-insert/assets/code.js +3 -0
  170. package/dist/es2019/plugins/quick-insert/assets/custom-panel.js +3 -0
  171. package/dist/es2019/plugins/quick-insert/assets/date.js +3 -0
  172. package/dist/es2019/plugins/quick-insert/assets/decision.js +3 -0
  173. package/dist/es2019/plugins/quick-insert/assets/divider.js +3 -0
  174. package/dist/es2019/plugins/quick-insert/assets/emoji.js +3 -0
  175. package/dist/es2019/plugins/quick-insert/assets/expand.js +3 -0
  176. package/dist/es2019/plugins/quick-insert/assets/fallback.js +3 -0
  177. package/dist/es2019/plugins/quick-insert/assets/feedback.js +3 -0
  178. package/dist/es2019/plugins/quick-insert/assets/heading1.js +3 -0
  179. package/dist/es2019/plugins/quick-insert/assets/heading2.js +3 -0
  180. package/dist/es2019/plugins/quick-insert/assets/heading3.js +3 -0
  181. package/dist/es2019/plugins/quick-insert/assets/heading4.js +3 -0
  182. package/dist/es2019/plugins/quick-insert/assets/heading5.js +3 -0
  183. package/dist/es2019/plugins/quick-insert/assets/heading6.js +3 -0
  184. package/dist/es2019/plugins/quick-insert/assets/images.js +3 -0
  185. package/dist/es2019/plugins/quick-insert/assets/layout.js +3 -0
  186. package/dist/es2019/plugins/quick-insert/assets/link.js +3 -0
  187. package/dist/es2019/plugins/quick-insert/assets/list-number.js +3 -0
  188. package/dist/es2019/plugins/quick-insert/assets/list.js +3 -0
  189. package/dist/es2019/plugins/quick-insert/assets/mention.js +3 -0
  190. package/dist/es2019/plugins/quick-insert/assets/panel-error.js +3 -0
  191. package/dist/es2019/plugins/quick-insert/assets/panel-note.js +3 -0
  192. package/dist/es2019/plugins/quick-insert/assets/panel-success.js +3 -0
  193. package/dist/es2019/plugins/quick-insert/assets/panel-warning.js +3 -0
  194. package/dist/es2019/plugins/quick-insert/assets/panel.js +3 -0
  195. package/dist/es2019/plugins/quick-insert/assets/quote.js +3 -0
  196. package/dist/es2019/plugins/quick-insert/assets/status.js +3 -0
  197. package/dist/es2019/plugins/selection/gap-cursor/actions.js +26 -5
  198. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -4
  199. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/styles.js +6 -1
  200. package/dist/es2019/plugins/text-color/utils/color.js +3 -0
  201. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +4 -3
  202. package/dist/es2019/plugins/type-ahead/index.js +17 -4
  203. package/dist/es2019/plugins/type-ahead/messages.js +13 -3
  204. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +24 -16
  205. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +108 -61
  206. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +12 -14
  207. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +32 -8
  208. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +42 -7
  209. package/dist/es2019/plugins/type-ahead/utils.js +3 -1
  210. package/dist/es2019/ui/Alignment/index.js +1 -2
  211. package/dist/es2019/ui/Appearance/Chromeless.js +4 -0
  212. package/dist/es2019/ui/Appearance/Comment/Toolbar.js +1 -1
  213. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +5 -2
  214. package/dist/es2019/ui/ColorPickerButton/index.js +4 -0
  215. package/dist/es2019/ui/ConfigPanel/Fields/CustomSelect.js +2 -4
  216. package/dist/es2019/ui/ConfigPanel/Fields/Select.js +1 -3
  217. package/dist/es2019/ui/Dropdown/index.js +16 -1
  218. package/dist/es2019/ui/DropdownMenu/index.js +13 -1
  219. package/dist/es2019/ui/ElementBrowser/constants.js +0 -1
  220. package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +148 -0
  221. package/dist/es2019/ui/styles.js +1 -7
  222. package/dist/es2019/utils/clipboard.js +11 -9
  223. package/dist/es2019/utils/document.js +14 -1
  224. package/dist/es2019/utils/index.js +0 -7
  225. package/dist/es2019/utils/input-rules.js +4 -3
  226. package/dist/es2019/utils/table.js +28 -0
  227. package/dist/es2019/version-wrapper.js +1 -1
  228. package/dist/es2019/version.json +1 -1
  229. package/dist/esm/create-editor/ReactEditorView.js +1 -1
  230. package/dist/esm/create-editor/create-plugins-list.js +2 -4
  231. package/dist/esm/keymaps/index.js +1 -1
  232. package/dist/esm/labs/next/presets/cxhtml.js +1 -3
  233. package/dist/esm/labs/next/presets/mobile.js +1 -3
  234. package/dist/esm/nodeviews/getInlineNodeViewProducer.js +11 -4
  235. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  236. package/dist/esm/plugins/alignment/pm-plugins/keymap.js +1 -2
  237. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +29 -4
  238. package/dist/esm/plugins/annotation/nodeviews/index.js +7 -33
  239. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +28 -3
  240. package/dist/esm/plugins/annotation/utils.js +8 -4
  241. package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +1 -0
  242. package/dist/esm/plugins/caption/nodeviews/index.js +4 -1
  243. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +1 -0
  244. package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +2 -1
  245. package/dist/esm/plugins/code-block/nodeviews/code-block.js +7 -3
  246. package/dist/esm/plugins/code-block/refresh-browser-selection.js +2 -1
  247. package/dist/esm/plugins/code-block/styles.js +7 -2
  248. package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
  249. package/dist/esm/plugins/collab-edit/utils.js +5 -2
  250. package/dist/esm/plugins/copy-button/commands.js +5 -3
  251. package/dist/esm/plugins/emoji/messages.js +8 -0
  252. package/dist/esm/plugins/emoji/nodeviews/emoji.js +15 -2
  253. package/dist/esm/plugins/expand/pm-plugins/keymap.js +10 -1
  254. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +17 -13
  255. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +1 -0
  256. package/dist/esm/plugins/floating-toolbar/index.js +2 -0
  257. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +10 -1
  258. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +20 -1
  259. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +5 -2
  260. package/dist/esm/plugins/floating-toolbar/ui/Select.js +9 -3
  261. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -0
  262. package/dist/esm/plugins/help-dialog/ui/index.js +1 -4
  263. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +2 -2
  264. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +23 -9
  265. package/dist/esm/plugins/media/index.js +2 -2
  266. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +25 -4
  267. package/dist/esm/plugins/media/pm-plugins/main.js +14 -1
  268. package/dist/esm/plugins/media/toolbar/alt-text.js +1 -0
  269. package/dist/esm/plugins/media/toolbar/linking.js +1 -0
  270. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.js +3 -1
  271. package/dist/esm/plugins/media/ui/ToolbarMedia/toolbar-media-messages.js +2 -2
  272. package/dist/esm/plugins/mentions/messages.js +5 -0
  273. package/dist/esm/plugins/mentions/nodeviews/mention.js +15 -2
  274. package/dist/esm/plugins/mentions/styles.js +1 -1
  275. package/dist/esm/plugins/mentions/ui/Mention/index.js +13 -0
  276. package/dist/esm/plugins/panel/actions.js +2 -2
  277. package/dist/esm/plugins/panel/index.js +1 -0
  278. package/dist/esm/plugins/panel/toolbar.js +3 -3
  279. package/dist/esm/plugins/paste/index.js +2 -3
  280. package/dist/esm/plugins/paste/pm-plugins/main.js +2 -2
  281. package/dist/esm/plugins/quick-insert/assets/action.js +3 -0
  282. package/dist/esm/plugins/quick-insert/assets/code.js +3 -0
  283. package/dist/esm/plugins/quick-insert/assets/custom-panel.js +3 -0
  284. package/dist/esm/plugins/quick-insert/assets/date.js +3 -0
  285. package/dist/esm/plugins/quick-insert/assets/decision.js +3 -0
  286. package/dist/esm/plugins/quick-insert/assets/divider.js +3 -0
  287. package/dist/esm/plugins/quick-insert/assets/emoji.js +3 -0
  288. package/dist/esm/plugins/quick-insert/assets/expand.js +3 -0
  289. package/dist/esm/plugins/quick-insert/assets/fallback.js +3 -0
  290. package/dist/esm/plugins/quick-insert/assets/feedback.js +3 -0
  291. package/dist/esm/plugins/quick-insert/assets/heading1.js +3 -0
  292. package/dist/esm/plugins/quick-insert/assets/heading2.js +3 -0
  293. package/dist/esm/plugins/quick-insert/assets/heading3.js +3 -0
  294. package/dist/esm/plugins/quick-insert/assets/heading4.js +3 -0
  295. package/dist/esm/plugins/quick-insert/assets/heading5.js +3 -0
  296. package/dist/esm/plugins/quick-insert/assets/heading6.js +3 -0
  297. package/dist/esm/plugins/quick-insert/assets/images.js +3 -0
  298. package/dist/esm/plugins/quick-insert/assets/layout.js +3 -0
  299. package/dist/esm/plugins/quick-insert/assets/link.js +3 -0
  300. package/dist/esm/plugins/quick-insert/assets/list-number.js +3 -0
  301. package/dist/esm/plugins/quick-insert/assets/list.js +3 -0
  302. package/dist/esm/plugins/quick-insert/assets/mention.js +3 -0
  303. package/dist/esm/plugins/quick-insert/assets/panel-error.js +3 -0
  304. package/dist/esm/plugins/quick-insert/assets/panel-note.js +3 -0
  305. package/dist/esm/plugins/quick-insert/assets/panel-success.js +3 -0
  306. package/dist/esm/plugins/quick-insert/assets/panel-warning.js +3 -0
  307. package/dist/esm/plugins/quick-insert/assets/panel.js +3 -0
  308. package/dist/esm/plugins/quick-insert/assets/quote.js +3 -0
  309. package/dist/esm/plugins/quick-insert/assets/status.js +3 -0
  310. package/dist/esm/plugins/selection/gap-cursor/actions.js +24 -5
  311. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +44 -4
  312. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/styles.js +6 -1
  313. package/dist/esm/plugins/text-color/utils/color.js +3 -0
  314. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +4 -3
  315. package/dist/esm/plugins/type-ahead/index.js +35 -22
  316. package/dist/esm/plugins/type-ahead/messages.js +13 -3
  317. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +24 -16
  318. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +124 -64
  319. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +12 -14
  320. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +35 -14
  321. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +38 -7
  322. package/dist/esm/plugins/type-ahead/utils.js +3 -1
  323. package/dist/esm/ui/Alignment/index.js +1 -2
  324. package/dist/esm/ui/Appearance/Chromeless.js +1 -1
  325. package/dist/esm/ui/Appearance/Comment/Toolbar.js +1 -1
  326. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +5 -2
  327. package/dist/esm/ui/ColorPickerButton/index.js +4 -0
  328. package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +2 -4
  329. package/dist/esm/ui/ConfigPanel/Fields/Select.js +1 -3
  330. package/dist/esm/ui/Dropdown/index.js +17 -1
  331. package/dist/esm/ui/DropdownMenu/index.js +14 -1
  332. package/dist/esm/ui/ElementBrowser/constants.js +0 -1
  333. package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +147 -0
  334. package/dist/esm/ui/styles.js +12 -16
  335. package/dist/esm/utils/clipboard.js +17 -12
  336. package/dist/esm/utils/document.js +14 -1
  337. package/dist/esm/utils/index.js +0 -7
  338. package/dist/esm/utils/input-rules.js +4 -3
  339. package/dist/esm/utils/table.js +28 -0
  340. package/dist/esm/version-wrapper.js +1 -1
  341. package/dist/esm/version.json +1 -1
  342. package/dist/types/keymaps/index.d.ts +1 -1
  343. package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +2 -0
  344. package/dist/types/plugins/annotation/utils.d.ts +2 -2
  345. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -0
  346. package/dist/types/plugins/code-block/refresh-browser-selection.d.ts +2 -0
  347. package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
  348. package/dist/types/plugins/emoji/messages.d.ts +7 -0
  349. package/dist/types/plugins/extension/index.d.ts +0 -1
  350. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
  351. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +6 -0
  352. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -0
  353. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +3 -1
  354. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
  355. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +4 -1
  356. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -0
  357. package/dist/types/plugins/media/ui/CaptionPlaceholder/index.d.ts +3 -3
  358. package/dist/types/plugins/mentions/messages.d.ts +5 -0
  359. package/dist/types/plugins/mentions/ui/Mention/index.d.ts +1 -0
  360. package/dist/types/plugins/paste/index.d.ts +1 -2
  361. package/dist/types/plugins/paste/pm-plugins/main.d.ts +1 -1
  362. package/dist/types/plugins/selection/gap-cursor/actions.d.ts +2 -0
  363. package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +3 -0
  364. package/dist/types/plugins/type-ahead/messages.d.ts +10 -0
  365. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +7 -1
  366. package/dist/types/plugins/type-ahead/utils.d.ts +1 -0
  367. package/dist/types/types/extension-config.d.ts +0 -1
  368. package/dist/types/ui/ConfigPanel/Fields/SelectItem.d.ts +1 -1
  369. package/dist/types/ui/Dropdown/index.d.ts +6 -1
  370. package/dist/types/ui/DropdownMenu/index.d.ts +2 -1
  371. package/dist/types/ui/ElementBrowser/types.d.ts +3 -1
  372. package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +18 -0
  373. package/dist/types/ui/styles.d.ts +0 -1
  374. package/dist/types/utils/clipboard.d.ts +1 -1
  375. package/dist/types/utils/index.d.ts +0 -4
  376. package/dist/types/utils/input-rules.d.ts +2 -2
  377. package/dist/types/utils/table.d.ts +3 -0
  378. package/docs/3-annotations.tsx +1 -0
  379. package/package.json +20 -18
  380. package/report.api.md +74 -74
@@ -1,13 +1,11 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
-
4
- var _templateObject;
5
3
 
6
4
  /** @jsx jsx */
7
5
  import React, { useRef, useCallback, Fragment, useLayoutEffect, useState } from 'react';
8
6
  import { css, jsx } from '@emotion/react';
9
7
  import { keyName as keyNameNormalized } from 'w3c-keyname';
10
- import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
8
+ import { browser } from '@atlaskit/editor-common/utils';
11
9
  import { getPluginState } from '../utils';
12
10
  import { CloseSelectionOptions, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
13
11
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -15,7 +13,8 @@ import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../constants';
15
13
  import { AssistiveText } from './AssistiveText';
16
14
  import { typeAheadListMessages } from '../messages';
17
15
  import { useIntl } from 'react-intl-next';
18
- var querySpan = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n"])));
16
+ import { token } from '@atlaskit/tokens';
17
+ import * as colors from '@atlaskit/theme/colors';
19
18
 
20
19
  var isNavigationKey = function isNavigationKey(event) {
21
20
  return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
@@ -39,6 +38,11 @@ var isUndoRedoShortcut = function isUndoRedoShortcut(event) {
39
38
  return false;
40
39
  };
41
40
 
41
+ var isSelectAllShortcut = function isSelectAllShortcut(event) {
42
+ var key = keyNameNormalized(event);
43
+ return (event.ctrlKey || event.metaKey) && key === 'a';
44
+ };
45
+
42
46
  export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
43
47
  var triggerQueryPrefix = _ref.triggerQueryPrefix,
44
48
  cancel = _ref.cancel,
@@ -52,30 +56,34 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
52
56
  onUndoRedo = _ref.onUndoRedo,
53
57
  editorView = _ref.editorView,
54
58
  items = _ref.items;
55
- var ref = useRef(document.createElement('span'));
56
- var cleanedInputContent = useCallback(function () {
57
- var _ref$current;
59
+ var ref = useRef(document.createElement('input'));
60
+ var sizeSpanRef = useRef(document.createElement('span'));
58
61
 
59
- var raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
60
- return raw.replace(ZERO_WIDTH_SPACE, '');
61
- }, []);
62
- var onKeyUp = useCallback(function (event) {
63
- var text = cleanedInputContent();
62
+ var _useState = useState([]),
63
+ _useState2 = _slicedToArray(_useState, 2),
64
+ redoBuffer = _useState2[0],
65
+ setRedoBuffer = _useState2[1];
66
+
67
+ var _useState3 = useState(reopenQuery),
68
+ _useState4 = _slicedToArray(_useState3, 2),
69
+ query = _useState4[0],
70
+ setQuery = _useState4[1];
71
+
72
+ var onChange = useCallback(function (event) {
73
+ var text = event.currentTarget.value;
74
+ sizeSpanRef.current.textContent = text;
75
+ setQuery(text);
64
76
  onQueryChange(text);
65
- }, [onQueryChange, cleanedInputContent]);
77
+ }, [onQueryChange]);
66
78
 
67
- var _useState = useState(false),
68
- _useState2 = _slicedToArray(_useState, 2),
69
- isInFocus = _useState2[0],
70
- setInFocus = _useState2[1];
79
+ var _useState5 = useState(false),
80
+ _useState6 = _slicedToArray(_useState5, 2),
81
+ isInFocus = _useState6[0],
82
+ setInFocus = _useState6[1];
71
83
 
72
84
  var checkKeyEvent = useCallback(function (event) {
73
- var _ref$current2;
74
-
75
85
  var key = keyNameNormalized(event);
76
- var sel = document.getSelection();
77
- var raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
78
- var text = cleanedInputContent();
86
+ var text = ref.current.value;
79
87
  var stopDefault = false;
80
88
 
81
89
  var _getPluginState = getPluginState(editorView.state),
@@ -99,6 +107,9 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
99
107
  break;
100
108
 
101
109
  case 'Escape':
110
+ case 'PageUp':
111
+ case 'PageDown':
112
+ case 'Home':
102
113
  cancel({
103
114
  text: text,
104
115
  forceFocusOnEditor: true,
@@ -109,7 +120,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
109
120
  break;
110
121
 
111
122
  case 'Backspace':
112
- if (raw === ZERO_WIDTH_SPACE || raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
123
+ if (text.length === 0 || ref.current.selectionStart === 0) {
113
124
  event.stopPropagation();
114
125
  event.preventDefault();
115
126
  cancel({
@@ -150,12 +161,48 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
150
161
  }
151
162
 
152
163
  break;
164
+
165
+ case 'ArrowUp':
166
+ if (selectedIndex === -1) {
167
+ selectPreviousItem();
168
+ }
169
+
170
+ break;
171
+ }
172
+
173
+ if (isSelectAllShortcut(event)) {
174
+ cancel({
175
+ forceFocusOnEditor: true,
176
+ addPrefixTrigger: true,
177
+ text: ref.current.value,
178
+ setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED
179
+ });
180
+ return true;
153
181
  }
154
182
 
155
183
  var undoRedoType = isUndoRedoShortcut(event);
184
+ var hasReopenQuery = reopenQuery && reopenQuery.length > 0;
156
185
 
157
- if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
158
- stopDefault = true;
186
+ if (onUndoRedo && undoRedoType) {
187
+ if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
188
+ setRedoBuffer(function (buffer) {
189
+ return [ref.current.value].concat(_toConsumableArray(buffer));
190
+ });
191
+ var undoValue = text.substring(0, text.length - 1);
192
+ ref.current.value = undoValue;
193
+ sizeSpanRef.current.textContent = undoValue;
194
+ stopDefault = true;
195
+ } else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
196
+ var redoValue = redoBuffer[0];
197
+ ref.current.value = redoValue;
198
+ sizeSpanRef.current.textContent = redoValue;
199
+ setRedoBuffer(function (buffer) {
200
+ return buffer.slice(1);
201
+ });
202
+ stopDefault = true;
203
+ } else {
204
+ stopDefault = onUndoRedo(undoRedoType);
205
+ }
159
206
  }
160
207
 
161
208
  if (isNavigationKey(event) || stopDefault) {
@@ -163,16 +210,34 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
163
210
  event.preventDefault();
164
211
  return false;
165
212
  }
166
- }, [onUndoRedo, onItemSelect, selectNextItem, cancel, cleanedInputContent, editorView.state]);
213
+ }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state, redoBuffer, reopenQuery]);
167
214
  var onClick = useCallback(function (event) {
168
- var _ref$current3;
215
+ var _ref$current;
169
216
 
170
217
  event.stopPropagation();
171
218
  event.preventDefault();
172
219
  onQueryFocus();
173
- (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.focus();
220
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
174
221
  return false;
175
222
  }, [onQueryFocus]);
223
+ var queryStyle = css({
224
+ outline: 'none',
225
+ position: 'absolute',
226
+ fontFamily: 'inherit',
227
+ fontSize: 'inherit',
228
+ fontWeight: 'inherit',
229
+ letterSpacing: 'inherit',
230
+ padding: 0,
231
+ height: '100%',
232
+ width: '100%',
233
+ top: 0,
234
+ left: 0,
235
+ background: 'transparent',
236
+ border: 'none',
237
+ '&&': {
238
+ color: "".concat(token('color.link', colors.B400))
239
+ }
240
+ });
176
241
  useLayoutEffect(function () {
177
242
  if (!ref.current) {
178
243
  return;
@@ -188,12 +253,12 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
188
253
  var key = keyNameNormalized(event);
189
254
 
190
255
  if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
191
- var _ref$current4;
256
+ var _ref$current2, _ref$current3;
192
257
 
193
- var q = ((_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.textContent) || '';
194
- var sel = document.getSelection();
195
- var isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
196
- var isMovingLeft = sel && 'ArrowLeft' === key && sel.anchorOffset === 0;
258
+ var q = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.value) || '';
259
+ var anchorOffset = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.selectionStart;
260
+ var isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
261
+ var isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
197
262
 
198
263
  if (!isMovingRight && !isMovingLeft) {
199
264
  return;
@@ -202,7 +267,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
202
267
  cancel({
203
268
  forceFocusOnEditor: true,
204
269
  addPrefixTrigger: true,
205
- text: cleanedInputContent(),
270
+ text: ref.current.value,
206
271
  setSelectionAt: isMovingRight ? CloseSelectionOptions.AFTER_TEXT_INSERTED : CloseSelectionOptions.BEFORE_TEXT_INSERTED
207
272
  });
208
273
  event.preventDefault();
@@ -236,8 +301,8 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
236
301
 
237
302
  cancel({
238
303
  addPrefixTrigger: true,
239
- text: cleanedInputContent(),
240
- setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED,
304
+ text: ref.current.value,
305
+ setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
241
306
  forceFocusOnEditor: false
242
307
  });
243
308
  };
@@ -257,33 +322,16 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
257
322
  setInFocus(false);
258
323
  var target = e.target;
259
324
 
260
- if (e.isComposing || !(target instanceof HTMLElement)) {
325
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
261
326
  return;
262
327
  }
263
328
 
264
- if (e.inputType === 'historyUndo' && (((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0 || target.textContent === ZERO_WIDTH_SPACE)) {
329
+ if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
265
330
  e.preventDefault();
266
331
  e.stopPropagation();
267
332
  close();
268
333
  return;
269
334
  }
270
-
271
- if (e.data != null && target.textContent === ZERO_WIDTH_SPACE) {
272
- element.textContent = ''; // We need to change the content on Safari
273
- // and set the cursor at the right place
274
-
275
- if (browser.safari) {
276
- e.preventDefault();
277
- var dataElement = document.createTextNode(e.data);
278
- element.appendChild(dataElement);
279
- var sel = window.getSelection();
280
- var range = document.createRange();
281
- range.setStart(dataElement, dataElement.length);
282
- range.collapse(true);
283
- sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
284
- sel === null || sel === void 0 ? void 0 : sel.addRange(range);
285
- }
286
- }
287
335
  };
288
336
 
289
337
  var onInput = null;
@@ -297,7 +345,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
297
345
 
298
346
  var target = e.target;
299
347
 
300
- if (e.isComposing || !(target instanceof HTMLElement)) {
348
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
301
349
  return;
302
350
  }
303
351
 
@@ -326,12 +374,13 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
326
374
  element.removeEventListener('input', onInput);
327
375
  }
328
376
  };
329
- }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
377
+ }, [triggerQueryPrefix, ref.current.value, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
330
378
  useLayoutEffect(function () {
331
379
  var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
332
380
 
333
381
  if (ref.current && forceFocus) {
334
- ref.current.textContent = hasReopenQuery ? reopenQuery : ZERO_WIDTH_SPACE;
382
+ ref.current.value = hasReopenQuery ? reopenQuery : '';
383
+ sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
335
384
  requestAnimationFrame(function () {
336
385
  if (!(ref !== null && ref !== void 0 && ref.current)) {
337
386
  return;
@@ -362,10 +411,20 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
362
411
  */
363
412
 
364
413
  return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
365
- css: querySpan,
366
- contentEditable: true,
414
+ style: {
415
+ position: 'relative'
416
+ }
417
+ }, jsx("span", {
418
+ ref: sizeSpanRef,
419
+ "aria-hidden": true,
420
+ style: {
421
+ marginLeft: '1px',
422
+ visibility: 'hidden'
423
+ }
424
+ }), jsx("input", {
425
+ css: queryStyle,
367
426
  ref: ref,
368
- onKeyUp: onKeyUp,
427
+ onChange: onChange,
369
428
  onClick: onClick,
370
429
  role: "combobox",
371
430
  "aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
@@ -373,8 +432,9 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
373
432
  "aria-expanded": items.length !== 0,
374
433
  "aria-labelledby": assistiveHintID,
375
434
  suppressContentEditableWarning: true,
376
- "data-query-prefix": triggerQueryPrefix
377
- }), jsx("span", {
435
+ "data-query-prefix": triggerQueryPrefix,
436
+ value: query
437
+ })), jsx("span", {
378
438
  id: assistiveHintID,
379
439
  style: {
380
440
  display: 'none'
@@ -145,7 +145,16 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
145
145
  setCache(new CellMeasurerCache({
146
146
  fixedWidth: true,
147
147
  defaultHeight: LIST_ITEM_ESTIMATED_HEIGHT
148
- }));
148
+ })); // When query is updated, sometimes the scroll position of the menu is not at the top
149
+ // Scrolling back to top for consistency
150
+
151
+ requestAnimationFrame(function () {
152
+ var _listContainerRef$cur;
153
+
154
+ if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
155
+ listContainerRef.current.firstChild.scrollTo(0, 0);
156
+ }
157
+ });
149
158
  }, [items]);
150
159
  useLayoutEffect(function () {
151
160
  var height = Math.min(items.reduce(function (prevValue, currentValue, index) {
@@ -170,23 +179,12 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
170
179
  if (isNavigationKey(event)) {
171
180
  switch (event.key) {
172
181
  case 'ArrowDown':
173
- if (selectedIndex === items.length - 1) {
174
- event.stopPropagation();
175
- } else {
176
- selectNextItem();
177
- }
178
-
182
+ selectNextItem();
179
183
  event.preventDefault();
180
184
  break;
181
185
 
182
186
  case 'ArrowUp':
183
- if (selectedIndex === 0) {
184
- //To set focus on target element when up arrow is pressed on first option of list
185
- focusTargetElement();
186
- } else {
187
- selectPreviousItem();
188
- }
189
-
187
+ selectPreviousItem();
190
188
  event.preventDefault();
191
189
  break;
192
190
 
@@ -14,17 +14,19 @@ import IconFallback from '../../quick-insert/assets/fallback';
14
14
  import { shortcutStyle } from '../../../ui/styles';
15
15
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
16
16
  import { token } from '@atlaskit/tokens';
17
+ import { useIntl } from 'react-intl-next';
18
+ import { typeAheadListMessages } from '../messages';
17
19
  export var ICON_HEIGHT = 40;
18
20
  export var ICON_WIDTH = 40;
19
21
  export var ITEM_PADDING = 12;
20
22
  export var itemIcon = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n overflow: hidden;\n border: 1px solid ", "; /* N60 at 50% */\n border-radius: ", "px;\n box-sizing: border-box;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n div {\n width: ", "px;\n height: ", "px;\n }\n"])), ICON_WIDTH, ICON_HEIGHT, token('color.border', 'rgba(223, 225, 229, 0.5)'), borderRadius(), ICON_WIDTH, ICON_HEIGHT);
21
- var itemBody = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n"])));
23
+ var itemBody = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n"])));
22
24
 
23
25
  var itemText = function itemText(theme) {
24
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n white-space: initial;\n color: ", ";\n .item-description {\n font-size: ", ";\n color: ", ";\n margin-top: 4px;\n }\n"])), themed({
26
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n white-space: initial;\n color: ", ";\n .item-title {\n line-height: 1.4;\n }\n .item-description {\n font-size: ", ";\n color: ", ";\n margin-top: 3px;\n }\n"])), themed({
25
27
  light: token('color.text', N800),
26
28
  dark: token('color.text', DN600)
27
- })(theme), relativeFontSizeToBase16(11.67), token('color.text.subtlest', N200));
29
+ })(theme), relativeFontSizeToBase16(12), token('color.text.subtlest', N200));
28
30
  };
29
31
 
30
32
  var itemAfter = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
@@ -52,12 +54,24 @@ var FallbackIcon = /*#__PURE__*/React.memo(function (_ref) {
52
54
 
53
55
  var noop = function noop() {};
54
56
 
55
- export var TypeAheadListItem = function TypeAheadListItem(_ref2) {
56
- var item = _ref2.item,
57
- itemsLength = _ref2.itemsLength,
58
- selectedIndex = _ref2.selectedIndex,
59
- onItemClick = _ref2.onItemClick,
60
- itemIndex = _ref2.itemIndex;
57
+ var AssistiveText = function AssistiveText(_ref2) {
58
+ var title = _ref2.title,
59
+ description = _ref2.description,
60
+ shortcut = _ref2.shortcut;
61
+ var intl = useIntl();
62
+ var descriptionText = description ? " ".concat(intl.formatMessage(typeAheadListMessages.descriptionLabel), " ").concat(description, ".") : '';
63
+ var shortcutText = shortcut ? " ".concat(intl.formatMessage(typeAheadListMessages.shortcutLabel), " ").concat(shortcut, ".") : '';
64
+ return jsx("span", {
65
+ className: "assistive"
66
+ }, "".concat(title, ". ").concat(descriptionText, " ").concat(shortcutText));
67
+ };
68
+
69
+ export var TypeAheadListItem = function TypeAheadListItem(_ref3) {
70
+ var item = _ref3.item,
71
+ itemsLength = _ref3.itemsLength,
72
+ selectedIndex = _ref3.selectedIndex,
73
+ onItemClick = _ref3.onItemClick,
74
+ itemIndex = _ref3.itemIndex;
61
75
 
62
76
  /**
63
77
  * To select and highlight the first Item when no item is selected
@@ -133,17 +147,24 @@ export var TypeAheadListItem = function TypeAheadListItem(_ref2) {
133
147
  "aria-label": item.title,
134
148
  "aria-setsize": itemsLength,
135
149
  role: "option",
136
- ref: buttonItemRef,
137
- description: item.description
150
+ ref: buttonItemRef
138
151
  }, jsx("div", {
139
- css: itemBody
152
+ "aria-hidden": true
140
153
  }, jsx("div", {
141
154
  css: itemText
155
+ }, jsx("div", {
156
+ css: itemBody
142
157
  }, jsx("div", {
143
158
  className: "item-title"
144
- }, item.title)), jsx("div", {
159
+ }, item.title), jsx("div", {
145
160
  css: itemAfter
146
161
  }, item.keyshortcut && jsx("div", {
147
162
  css: shortcutStyle
148
- }, item.keyshortcut)))));
163
+ }, item.keyshortcut))), jsx("div", {
164
+ className: "item-description"
165
+ }, item.description))), jsx(AssistiveText, {
166
+ title: item.title,
167
+ description: item.description,
168
+ shortcut: item.keyshortcut
169
+ })));
149
170
  };
@@ -4,15 +4,15 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
4
4
  var _templateObject;
5
5
 
6
6
  /** @jsx jsx */
7
- import React, { useCallback, useEffect, useMemo, useState, useLayoutEffect } from 'react';
7
+ import React, { useCallback, useEffect, useMemo, useState, useLayoutEffect, useRef } from 'react';
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import rafSchedule from 'raf-schd';
10
10
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
11
11
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
12
12
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
13
13
  import { N0, N60A, N50A } from '@atlaskit/theme/colors';
14
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
15
- import { TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
14
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
15
+ import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
16
16
  import { TypeAheadList } from './TypeAheadList';
17
17
  import { ITEM_PADDING } from './TypeAheadListItem';
18
18
  import { token } from '@atlaskit/tokens';
@@ -27,8 +27,7 @@ var Highlight = function Highlight(_ref) {
27
27
  return null;
28
28
  }
29
29
 
30
- var highlight = triggerHandler.getHighlight(state);
31
- return highlight;
30
+ return triggerHandler.getHighlight(state);
32
31
  };
33
32
 
34
33
  var OFFSET = [0, 8];
@@ -43,7 +42,9 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
43
42
  selectedIndex = props.selectedIndex,
44
43
  onItemInsert = props.onItemInsert,
45
44
  fireAnalyticsCallback = props.fireAnalyticsCallback,
46
- isEmptyQuery = props.isEmptyQuery;
45
+ isEmptyQuery = props.isEmptyQuery,
46
+ cancel = props.cancel;
47
+ var ref = useRef(null);
47
48
  var startTime = useMemo(function () {
48
49
  return performance.now();
49
50
  }, // In case those props changes
@@ -155,6 +156,35 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
155
156
  }
156
157
  };
157
158
  }, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
159
+ useLayoutEffect(function () {
160
+ var focusOut = function focusOut(event) {
161
+ var _window$getSelection;
162
+
163
+ var relatedTarget = event.relatedTarget; // Given the user is changing the focus
164
+ // When the target is inside the TypeAhead Popup
165
+ // Then the popup should stay open
166
+
167
+ if (relatedTarget instanceof HTMLElement && relatedTarget.closest && (relatedTarget.closest(".".concat(TYPE_AHEAD_POPUP_CONTENT_CLASS)) || relatedTarget.closest("[data-type-ahead=\"".concat(TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "\"]")))) {
168
+ return;
169
+ }
170
+
171
+ if (!(((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range')) {
172
+ return;
173
+ }
174
+
175
+ cancel({
176
+ addPrefixTrigger: true,
177
+ setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
178
+ forceFocusOnEditor: false
179
+ });
180
+ };
181
+
182
+ var element = ref.current;
183
+ element === null || element === void 0 ? void 0 : element.addEventListener('focusout', focusOut);
184
+ return function () {
185
+ element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
186
+ };
187
+ }, [ref, cancel]);
158
188
  return jsx(Popup, {
159
189
  zIndex: akEditorFloatingDialogZIndex,
160
190
  target: anchorElement,
@@ -167,7 +197,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
167
197
  }, jsx("div", {
168
198
  css: typeAheadContent,
169
199
  tabIndex: 0,
170
- className: TYPE_AHEAD_POPUP_CONTENT_CLASS
200
+ className: TYPE_AHEAD_POPUP_CONTENT_CLASS,
201
+ ref: ref
171
202
  }, jsx(Highlight, {
172
203
  state: editorView.state,
173
204
  triggerHandler: triggerHandler
@@ -28,6 +28,8 @@ export var findTypeAheadDecorations = function findTypeAheadDecorations(state) {
28
28
  export var isTypeAheadHandler = function isTypeAheadHandler(handler) {
29
29
  return handler && Object.values(TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
30
30
  };
31
+ /** Is a typeahead plugin open? */
32
+
31
33
  export var isTypeAheadOpen = function isTypeAheadOpen(editorState) {
32
34
  var _typeAheadPluginKey$g2, _typeAheadPluginKey$g3;
33
35
 
@@ -94,7 +96,7 @@ export var moveSelectedIndex = function moveSelectedIndex(_ref2) {
94
96
  nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
95
97
  } else {
96
98
  stats.increaseArrowUp();
97
- nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
99
+ nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
98
100
  }
99
101
 
100
102
  updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
@@ -16,7 +16,7 @@ import { IconMap } from '../../plugins/alignment/ui/ToolbarAlignment/icon-map';
16
16
  import AlignmentButton from './AlignmentButton';
17
17
  import { alignmentMessages } from './messages';
18
18
  import { alignmentWrapper } from './styles';
19
- import { alignLeft, alignRight } from '../../keymaps';
19
+ import { alignLeft } from '../../keymaps';
20
20
  var alignmentOptions = [{
21
21
  title: alignmentMessages.alignLeft,
22
22
  shortcut: alignLeft,
@@ -26,7 +26,6 @@ var alignmentOptions = [{
26
26
  value: 'center'
27
27
  }, {
28
28
  title: alignmentMessages.alignRight,
29
- shortcut: alignRight,
30
29
  value: 'end'
31
30
  }];
32
31
 
@@ -22,7 +22,7 @@ import { createEditorContentStyle } from '../ContentStyles';
22
22
  import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
23
23
  import { scrollbarStyles } from '../styles';
24
24
  import WithFlash from '../WithFlash';
25
- var chromelessEditor = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 20px;\n height: auto;\n\n overflow-x: hidden;\n overflow-y: auto;\n ", ";\n max-width: inherit;\n box-sizing: border-box;\n word-wrap: break-word;\n\n div > .ProseMirror {\n outline: none;\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n }\n"])), scrollbarStyles);
25
+ var chromelessEditor = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 20px;\n height: auto;\n\n overflow-x: hidden;\n overflow-y: auto;\n ", ";\n max-width: inherit;\n box-sizing: border-box;\n word-wrap: break-word;\n\n div > .ProseMirror {\n outline: none;\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n\n & > :last-child {\n padding-bottom: 0.5em;\n }\n }\n"])), scrollbarStyles);
26
26
  var ContentArea = createEditorContentStyle();
27
27
  ContentArea.displayName = 'ContentArea';
28
28
 
@@ -26,7 +26,7 @@ var StickyToolbar = function StickyToolbar(props) {
26
26
  setTop(((_props$externalToolba = props.externalToolbarRef) === null || _props$externalToolba === void 0 ? void 0 : (_props$externalToolba2 = _props$externalToolba.current) === null || _props$externalToolba2 === void 0 ? void 0 : _props$externalToolba2.clientHeight) || 0);
27
27
  }, [setTop, props.externalToolbarRef]);
28
28
  return jsx("div", {
29
- css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n top: ", ";\n "])), top)],
29
+ css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n top: ", "px;\n "])), top)],
30
30
  "data-testid": "ak-editor-main-toolbar",
31
31
  className: 'show-keyline'
32
32
  }, props.children);
@@ -11,6 +11,7 @@ import Toolbar from '../../Toolbar';
11
11
  import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyle, mainToolbarSecondChildStyle, nonCustomToolbarWrapperStyle, customToolbarWrapperStyle, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
12
12
  import { ContextPanelConsumer } from '../../ContextPanel/context';
13
13
  import messages from './messages';
14
+ import { ToolbarArrowKeyNavigationProvider } from '../../ToolbarArrowKeyNavigationProvider';
14
15
  export var EditorToolbar = /*#__PURE__*/React.memo(function (props) {
15
16
  var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _props$featureFlags5, _props$featureFlags6;
16
17
 
@@ -76,7 +77,9 @@ export var EditorToolbar = /*#__PURE__*/React.memo(function (props) {
76
77
  var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
77
78
 
78
79
  var contextPanelWidth = _ref.width;
79
- return jsx("div", {
80
+ return jsx(ToolbarArrowKeyNavigationProvider, {
81
+ editorView: props.editorView
82
+ }, jsx("div", {
80
83
  css: mainToolbarStyle(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
81
84
  "data-testid": "ak-editor-main-toolbar"
82
85
  }, jsx("div", {
@@ -88,7 +91,7 @@ export var EditorToolbar = /*#__PURE__*/React.memo(function (props) {
88
91
  "data-testid": 'avatar-group-outside-plugin',
89
92
  role: "region",
90
93
  "aria-label": props.intl.formatMessage(messages.pageActionsLabel)
91
- }, shouldSplitToolbar ? nonCustomToolbar : customToolbar));
94
+ }, shouldSplitToolbar ? nonCustomToolbar : customToolbar)));
92
95
  });
93
96
  });
94
97
  export var FullPageToolbar = injectIntl(EditorToolbar);
@@ -18,8 +18,12 @@ import { editorAnalyticsChannel } from '../../plugins/analytics/consts';
18
18
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics/types'; // helps adjusts position of popup
19
19
 
20
20
  var colorPickerButtonWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"]))); // Control the size of color picker buttons and preview
21
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
22
+
23
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
21
24
 
22
25
  var colorPickerWrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-radius: ", "px;\n background-color: white;\n box-shadow: 0 4px 8px -2px ", ", 0 0 1px ", ";\n padding: 8px 0px;\n"])), borderRadius(), N60A, N60A);
26
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
23
27
 
24
28
  var ColorPickerButton = function ColorPickerButton(props) {
25
29
  var _props$size, _props$size2;
@@ -178,14 +178,12 @@ function CustomSelect(_ref2) {
178
178
  // for isDirty
179
179
 
180
180
  onFieldChange(name, true);
181
- } // @see DST-2386 & ED-12503
182
- ,
183
- enableAnimation: false // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
181
+ } // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
184
182
  ,
185
183
  isMulti: isMultiple || false,
186
184
  isClearable: true,
187
185
  isValidNewOption: function isValidNewOption(value) {
188
- return isCreatable && value;
186
+ return !!(isCreatable && value);
189
187
  },
190
188
  validationState: error ? 'error' : 'default',
191
189
  defaultOptions: defaultOptions,