@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
@@ -2,7 +2,7 @@
2
2
  import React, { useRef, useCallback, Fragment, useLayoutEffect, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { keyName as keyNameNormalized } from 'w3c-keyname';
5
- import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
5
+ import { browser } from '@atlaskit/editor-common/utils';
6
6
  import { getPluginState } from '../utils';
7
7
  import { CloseSelectionOptions, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
8
8
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
@@ -10,9 +10,8 @@ import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../constants';
10
10
  import { AssistiveText } from './AssistiveText';
11
11
  import { typeAheadListMessages } from '../messages';
12
12
  import { useIntl } from 'react-intl-next';
13
- const querySpan = css`
14
- outline: none;
15
- `;
13
+ import { token } from '@atlaskit/tokens';
14
+ import * as colors from '@atlaskit/theme/colors';
16
15
 
17
16
  const isNavigationKey = event => {
18
17
  return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
@@ -36,6 +35,11 @@ const isUndoRedoShortcut = event => {
36
35
  return false;
37
36
  };
38
37
 
38
+ const isSelectAllShortcut = event => {
39
+ const key = keyNameNormalized(event);
40
+ return (event.ctrlKey || event.metaKey) && key === 'a';
41
+ };
42
+
39
43
  export const InputQuery = /*#__PURE__*/React.memo(({
40
44
  triggerQueryPrefix,
41
45
  cancel,
@@ -50,25 +54,20 @@ export const InputQuery = /*#__PURE__*/React.memo(({
50
54
  editorView,
51
55
  items
52
56
  }) => {
53
- const ref = useRef(document.createElement('span'));
54
- const cleanedInputContent = useCallback(() => {
55
- var _ref$current;
56
-
57
- const raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
58
- return raw.replace(ZERO_WIDTH_SPACE, '');
59
- }, []);
60
- const onKeyUp = useCallback(event => {
61
- const text = cleanedInputContent();
57
+ const ref = useRef(document.createElement('input'));
58
+ const sizeSpanRef = useRef(document.createElement('span'));
59
+ const [redoBuffer, setRedoBuffer] = useState([]);
60
+ const [query, setQuery] = useState(reopenQuery);
61
+ const onChange = useCallback(event => {
62
+ const text = event.currentTarget.value;
63
+ sizeSpanRef.current.textContent = text;
64
+ setQuery(text);
62
65
  onQueryChange(text);
63
- }, [onQueryChange, cleanedInputContent]);
66
+ }, [onQueryChange]);
64
67
  const [isInFocus, setInFocus] = useState(false);
65
68
  const checkKeyEvent = useCallback(event => {
66
- var _ref$current2;
67
-
68
69
  const key = keyNameNormalized(event);
69
- const sel = document.getSelection();
70
- const raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
71
- const text = cleanedInputContent();
70
+ const text = ref.current.value;
72
71
  let stopDefault = false;
73
72
  const {
74
73
  selectedIndex
@@ -91,6 +90,9 @@ export const InputQuery = /*#__PURE__*/React.memo(({
91
90
  break;
92
91
 
93
92
  case 'Escape':
93
+ case 'PageUp':
94
+ case 'PageDown':
95
+ case 'Home':
94
96
  cancel({
95
97
  text,
96
98
  forceFocusOnEditor: true,
@@ -101,7 +103,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
101
103
  break;
102
104
 
103
105
  case 'Backspace':
104
- if (raw === ZERO_WIDTH_SPACE || raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
106
+ if (text.length === 0 || ref.current.selectionStart === 0) {
105
107
  event.stopPropagation();
106
108
  event.preventDefault();
107
109
  cancel({
@@ -141,13 +143,45 @@ export const InputQuery = /*#__PURE__*/React.memo(({
141
143
  selectNextItem();
142
144
  }
143
145
 
146
+ break;
147
+
148
+ case 'ArrowUp':
149
+ if (selectedIndex === -1) {
150
+ selectPreviousItem();
151
+ }
152
+
144
153
  break;
145
154
  }
146
155
 
147
- const undoRedoType = isUndoRedoShortcut(event);
156
+ if (isSelectAllShortcut(event)) {
157
+ cancel({
158
+ forceFocusOnEditor: true,
159
+ addPrefixTrigger: true,
160
+ text: ref.current.value,
161
+ setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED
162
+ });
163
+ return true;
164
+ }
148
165
 
149
- if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
150
- stopDefault = true;
166
+ const undoRedoType = isUndoRedoShortcut(event);
167
+ const hasReopenQuery = reopenQuery && reopenQuery.length > 0;
168
+
169
+ if (onUndoRedo && undoRedoType) {
170
+ if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
171
+ setRedoBuffer(buffer => [ref.current.value, ...buffer]);
172
+ const undoValue = text.substring(0, text.length - 1);
173
+ ref.current.value = undoValue;
174
+ sizeSpanRef.current.textContent = undoValue;
175
+ stopDefault = true;
176
+ } else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
177
+ const redoValue = redoBuffer[0];
178
+ ref.current.value = redoValue;
179
+ sizeSpanRef.current.textContent = redoValue;
180
+ setRedoBuffer(buffer => buffer.slice(1));
181
+ stopDefault = true;
182
+ } else {
183
+ stopDefault = onUndoRedo(undoRedoType);
184
+ }
151
185
  }
152
186
 
153
187
  if (isNavigationKey(event) || stopDefault) {
@@ -155,16 +189,34 @@ export const InputQuery = /*#__PURE__*/React.memo(({
155
189
  event.preventDefault();
156
190
  return false;
157
191
  }
158
- }, [onUndoRedo, onItemSelect, selectNextItem, cancel, cleanedInputContent, editorView.state]);
192
+ }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state, redoBuffer, reopenQuery]);
159
193
  const onClick = useCallback(event => {
160
- var _ref$current3;
194
+ var _ref$current;
161
195
 
162
196
  event.stopPropagation();
163
197
  event.preventDefault();
164
198
  onQueryFocus();
165
- (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.focus();
199
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
166
200
  return false;
167
201
  }, [onQueryFocus]);
202
+ const queryStyle = css({
203
+ outline: 'none',
204
+ position: 'absolute',
205
+ fontFamily: 'inherit',
206
+ fontSize: 'inherit',
207
+ fontWeight: 'inherit',
208
+ letterSpacing: 'inherit',
209
+ padding: 0,
210
+ height: '100%',
211
+ width: '100%',
212
+ top: 0,
213
+ left: 0,
214
+ background: 'transparent',
215
+ border: 'none',
216
+ '&&': {
217
+ color: `${token('color.link', colors.B400)}`
218
+ }
219
+ });
168
220
  useLayoutEffect(() => {
169
221
  if (!ref.current) {
170
222
  return;
@@ -182,12 +234,12 @@ export const InputQuery = /*#__PURE__*/React.memo(({
182
234
  const key = keyNameNormalized(event);
183
235
 
184
236
  if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
185
- var _ref$current4;
237
+ var _ref$current2, _ref$current3;
186
238
 
187
- const q = ((_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.textContent) || '';
188
- const sel = document.getSelection();
189
- const isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
190
- const isMovingLeft = sel && 'ArrowLeft' === key && sel.anchorOffset === 0;
239
+ const q = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.value) || '';
240
+ const anchorOffset = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.selectionStart;
241
+ const isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
242
+ const isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
191
243
 
192
244
  if (!isMovingRight && !isMovingLeft) {
193
245
  return;
@@ -196,7 +248,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
196
248
  cancel({
197
249
  forceFocusOnEditor: true,
198
250
  addPrefixTrigger: true,
199
- text: cleanedInputContent(),
251
+ text: ref.current.value,
200
252
  setSelectionAt: isMovingRight ? CloseSelectionOptions.AFTER_TEXT_INSERTED : CloseSelectionOptions.BEFORE_TEXT_INSERTED
201
253
  });
202
254
  event.preventDefault();
@@ -232,8 +284,8 @@ export const InputQuery = /*#__PURE__*/React.memo(({
232
284
 
233
285
  cancel({
234
286
  addPrefixTrigger: true,
235
- text: cleanedInputContent(),
236
- setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED,
287
+ text: ref.current.value,
288
+ setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
237
289
  forceFocusOnEditor: false
238
290
  });
239
291
  };
@@ -255,33 +307,16 @@ export const InputQuery = /*#__PURE__*/React.memo(({
255
307
  target
256
308
  } = e;
257
309
 
258
- if (e.isComposing || !(target instanceof HTMLElement)) {
310
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
259
311
  return;
260
312
  }
261
313
 
262
- if (e.inputType === 'historyUndo' && (((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0 || target.textContent === ZERO_WIDTH_SPACE)) {
314
+ if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
263
315
  e.preventDefault();
264
316
  e.stopPropagation();
265
317
  close();
266
318
  return;
267
319
  }
268
-
269
- if (e.data != null && target.textContent === ZERO_WIDTH_SPACE) {
270
- element.textContent = ''; // We need to change the content on Safari
271
- // and set the cursor at the right place
272
-
273
- if (browser.safari) {
274
- e.preventDefault();
275
- const dataElement = document.createTextNode(e.data);
276
- element.appendChild(dataElement);
277
- const sel = window.getSelection();
278
- const range = document.createRange();
279
- range.setStart(dataElement, dataElement.length);
280
- range.collapse(true);
281
- sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
282
- sel === null || sel === void 0 ? void 0 : sel.addRange(range);
283
- }
284
- }
285
320
  };
286
321
 
287
322
  let onInput = null;
@@ -297,7 +332,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
297
332
  target
298
333
  } = e;
299
334
 
300
- if (e.isComposing || !(target instanceof HTMLElement)) {
335
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
301
336
  return;
302
337
  }
303
338
 
@@ -326,12 +361,13 @@ export const InputQuery = /*#__PURE__*/React.memo(({
326
361
  element.removeEventListener('input', onInput);
327
362
  }
328
363
  };
329
- }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
364
+ }, [triggerQueryPrefix, ref.current.value, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
330
365
  useLayoutEffect(() => {
331
366
  const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
332
367
 
333
368
  if (ref.current && forceFocus) {
334
- ref.current.textContent = hasReopenQuery ? reopenQuery : ZERO_WIDTH_SPACE;
369
+ ref.current.value = hasReopenQuery ? reopenQuery : '';
370
+ sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
335
371
  requestAnimationFrame(() => {
336
372
  if (!(ref !== null && ref !== void 0 && ref.current)) {
337
373
  return;
@@ -362,10 +398,20 @@ export const InputQuery = /*#__PURE__*/React.memo(({
362
398
  */
363
399
 
364
400
  return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
365
- css: querySpan,
366
- contentEditable: true,
401
+ style: {
402
+ position: 'relative'
403
+ }
404
+ }, jsx("span", {
405
+ ref: sizeSpanRef,
406
+ "aria-hidden": true,
407
+ style: {
408
+ marginLeft: '1px',
409
+ visibility: 'hidden'
410
+ }
411
+ }), jsx("input", {
412
+ css: queryStyle,
367
413
  ref: ref,
368
- onKeyUp: onKeyUp,
414
+ onChange: onChange,
369
415
  onClick: onClick,
370
416
  role: "combobox",
371
417
  "aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
@@ -373,8 +419,9 @@ export const InputQuery = /*#__PURE__*/React.memo(({
373
419
  "aria-expanded": items.length !== 0,
374
420
  "aria-labelledby": assistiveHintID,
375
421
  suppressContentEditableWarning: true,
376
- "data-query-prefix": triggerQueryPrefix
377
- }), jsx("span", {
422
+ "data-query-prefix": triggerQueryPrefix,
423
+ value: query
424
+ })), jsx("span", {
378
425
  id: assistiveHintID,
379
426
  style: {
380
427
  display: 'none'
@@ -127,7 +127,16 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
127
127
  setCache(new CellMeasurerCache({
128
128
  fixedWidth: true,
129
129
  defaultHeight: LIST_ITEM_ESTIMATED_HEIGHT
130
- }));
130
+ })); // When query is updated, sometimes the scroll position of the menu is not at the top
131
+ // Scrolling back to top for consistency
132
+
133
+ requestAnimationFrame(() => {
134
+ var _listContainerRef$cur;
135
+
136
+ if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
137
+ listContainerRef.current.firstChild.scrollTo(0, 0);
138
+ }
139
+ });
131
140
  }, [items]);
132
141
  useLayoutEffect(() => {
133
142
  const height = Math.min(items.reduce((prevValue, currentValue, index) => {
@@ -154,23 +163,12 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
154
163
  if (isNavigationKey(event)) {
155
164
  switch (event.key) {
156
165
  case 'ArrowDown':
157
- if (selectedIndex === items.length - 1) {
158
- event.stopPropagation();
159
- } else {
160
- selectNextItem();
161
- }
162
-
166
+ selectNextItem();
163
167
  event.preventDefault();
164
168
  break;
165
169
 
166
170
  case 'ArrowUp':
167
- if (selectedIndex === 0) {
168
- //To set focus on target element when up arrow is pressed on first option of list
169
- focusTargetElement();
170
- } else {
171
- selectPreviousItem();
172
- }
173
-
171
+ selectPreviousItem();
174
172
  event.preventDefault();
175
173
  break;
176
174
 
@@ -10,6 +10,8 @@ import IconFallback from '../../quick-insert/assets/fallback';
10
10
  import { shortcutStyle } from '../../../ui/styles';
11
11
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
12
12
  import { token } from '@atlaskit/tokens';
13
+ import { useIntl } from 'react-intl-next';
14
+ import { typeAheadListMessages } from '../messages';
13
15
  export const ICON_HEIGHT = 40;
14
16
  export const ICON_WIDTH = 40;
15
17
  export const ITEM_PADDING = 12;
@@ -35,7 +37,6 @@ const itemBody = css`
35
37
  flex-direction: row;
36
38
  flex-wrap: nowrap;
37
39
  justify-content: space-between;
38
- line-height: 1.4;
39
40
  `;
40
41
 
41
42
  const itemText = theme => css`
@@ -44,10 +45,13 @@ const itemText = theme => css`
44
45
  light: token('color.text', N800),
45
46
  dark: token('color.text', DN600)
46
47
  })(theme)};
48
+ .item-title {
49
+ line-height: 1.4;
50
+ }
47
51
  .item-description {
48
- font-size: ${relativeFontSizeToBase16(11.67)};
52
+ font-size: ${relativeFontSizeToBase16(12)};
49
53
  color: ${token('color.text.subtlest', N200)};
50
- margin-top: 4px;
54
+ margin-top: 3px;
51
55
  }
52
56
  `;
53
57
 
@@ -90,6 +94,19 @@ const FallbackIcon = /*#__PURE__*/React.memo(({
90
94
 
91
95
  const noop = () => {};
92
96
 
97
+ const AssistiveText = ({
98
+ title,
99
+ description,
100
+ shortcut
101
+ }) => {
102
+ const intl = useIntl();
103
+ const descriptionText = description ? ` ${intl.formatMessage(typeAheadListMessages.descriptionLabel)} ${description}.` : '';
104
+ const shortcutText = shortcut ? ` ${intl.formatMessage(typeAheadListMessages.shortcutLabel)} ${shortcut}.` : '';
105
+ return jsx("span", {
106
+ className: "assistive"
107
+ }, `${title}. ${descriptionText} ${shortcutText}`);
108
+ };
109
+
93
110
  export const TypeAheadListItem = ({
94
111
  item,
95
112
  itemsLength,
@@ -173,17 +190,24 @@ export const TypeAheadListItem = ({
173
190
  "aria-label": item.title,
174
191
  "aria-setsize": itemsLength,
175
192
  role: "option",
176
- ref: buttonItemRef,
177
- description: item.description
193
+ ref: buttonItemRef
178
194
  }, jsx("div", {
179
- css: itemBody
195
+ "aria-hidden": true
180
196
  }, jsx("div", {
181
197
  css: itemText
198
+ }, jsx("div", {
199
+ css: itemBody
182
200
  }, jsx("div", {
183
201
  className: "item-title"
184
- }, item.title)), jsx("div", {
202
+ }, item.title), jsx("div", {
185
203
  css: itemAfter
186
204
  }, item.keyshortcut && jsx("div", {
187
205
  css: shortcutStyle
188
- }, item.keyshortcut)))));
206
+ }, item.keyshortcut))), jsx("div", {
207
+ className: "item-description"
208
+ }, item.description))), jsx(AssistiveText, {
209
+ title: item.title,
210
+ description: item.description,
211
+ shortcut: item.keyshortcut
212
+ })));
189
213
  };
@@ -1,13 +1,13 @@
1
1
  /** @jsx jsx */
2
- import React, { useCallback, useEffect, useMemo, useState, useLayoutEffect } from 'react';
2
+ import React, { useCallback, useEffect, useMemo, useState, useLayoutEffect, useRef } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import rafSchedule from 'raf-schd';
5
5
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
6
6
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
7
7
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
8
8
  import { N0, N60A, N50A } from '@atlaskit/theme/colors';
9
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
10
- import { TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
9
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
10
+ import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../constants';
11
11
  import { TypeAheadList } from './TypeAheadList';
12
12
  import { ITEM_PADDING } from './TypeAheadListItem';
13
13
  import { token } from '@atlaskit/tokens';
@@ -32,8 +32,7 @@ const Highlight = ({
32
32
  return null;
33
33
  }
34
34
 
35
- const highlight = triggerHandler.getHighlight(state);
36
- return highlight;
35
+ return triggerHandler.getHighlight(state);
37
36
  };
38
37
 
39
38
  const OFFSET = [0, 8];
@@ -49,8 +48,10 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
49
48
  selectedIndex,
50
49
  onItemInsert,
51
50
  fireAnalyticsCallback,
52
- isEmptyQuery
51
+ isEmptyQuery,
52
+ cancel
53
53
  } = props;
54
+ const ref = useRef(null);
54
55
  const startTime = useMemo(() => performance.now(), // In case those props changes
55
56
  // we need to recreate the startTime
56
57
  [items, isEmptyQuery, fireAnalyticsCallback, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
@@ -153,6 +154,39 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
153
154
  }
154
155
  };
155
156
  }, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
157
+ useLayoutEffect(() => {
158
+ const focusOut = event => {
159
+ var _window$getSelection;
160
+
161
+ const {
162
+ relatedTarget
163
+ } = event; // 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(`.${TYPE_AHEAD_POPUP_CONTENT_CLASS}`) || relatedTarget.closest(`[data-type-ahead="${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
+ const {
183
+ current: element
184
+ } = ref;
185
+ element === null || element === void 0 ? void 0 : element.addEventListener('focusout', focusOut);
186
+ return () => {
187
+ element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
188
+ };
189
+ }, [ref, cancel]);
156
190
  return jsx(Popup, {
157
191
  zIndex: akEditorFloatingDialogZIndex,
158
192
  target: anchorElement,
@@ -165,7 +199,8 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
165
199
  }, jsx("div", {
166
200
  css: typeAheadContent,
167
201
  tabIndex: 0,
168
- className: TYPE_AHEAD_POPUP_CONTENT_CLASS
202
+ className: TYPE_AHEAD_POPUP_CONTENT_CLASS,
203
+ ref: ref
169
204
  }, jsx(Highlight, {
170
205
  state: editorView.state,
171
206
  triggerHandler: triggerHandler
@@ -32,6 +32,8 @@ export const findTypeAheadDecorations = state => {
32
32
  export const isTypeAheadHandler = handler => {
33
33
  return handler && Object.values(TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
34
34
  };
35
+ /** Is a typeahead plugin open? */
36
+
35
37
  export const isTypeAheadOpen = editorState => {
36
38
  var _typeAheadPluginKey$g, _typeAheadPluginKey$g2;
37
39
 
@@ -101,7 +103,7 @@ export const moveSelectedIndex = ({
101
103
  nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
102
104
  } else {
103
105
  stats.increaseArrowUp();
104
- nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
106
+ nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
105
107
  }
106
108
 
107
109
  updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
@@ -6,7 +6,7 @@ import { IconMap } from '../../plugins/alignment/ui/ToolbarAlignment/icon-map';
6
6
  import AlignmentButton from './AlignmentButton';
7
7
  import { alignmentMessages } from './messages';
8
8
  import { alignmentWrapper } from './styles';
9
- import { alignLeft, alignRight } from '../../keymaps';
9
+ import { alignLeft } from '../../keymaps';
10
10
  const alignmentOptions = [{
11
11
  title: alignmentMessages.alignLeft,
12
12
  shortcut: alignLeft,
@@ -16,7 +16,6 @@ const alignmentOptions = [{
16
16
  value: 'center'
17
17
  }, {
18
18
  title: alignmentMessages.alignRight,
19
- shortcut: alignRight,
20
19
  value: 'end'
21
20
  }];
22
21
 
@@ -25,6 +25,10 @@ const chromelessEditor = css`
25
25
  white-space: pre-wrap;
26
26
  padding: 0;
27
27
  margin: 0;
28
+
29
+ & > :last-child {
30
+ padding-bottom: 0.5em;
31
+ }
28
32
  }
29
33
  `;
30
34
  const ContentArea = createEditorContentStyle();
@@ -50,7 +50,7 @@ const StickyToolbar = props => {
50
50
  }, [setTop, props.externalToolbarRef]);
51
51
  return jsx("div", {
52
52
  css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, css`
53
- top: ${top};
53
+ top: ${top}px;
54
54
  `],
55
55
  "data-testid": "ak-editor-main-toolbar",
56
56
  className: 'show-keyline'
@@ -9,6 +9,7 @@ import Toolbar from '../../Toolbar';
9
9
  import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyle, mainToolbarSecondChildStyle, nonCustomToolbarWrapperStyle, customToolbarWrapperStyle, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
10
10
  import { ContextPanelConsumer } from '../../ContextPanel/context';
11
11
  import messages from './messages';
12
+ import { ToolbarArrowKeyNavigationProvider } from '../../ToolbarArrowKeyNavigationProvider';
12
13
  export const EditorToolbar = /*#__PURE__*/React.memo(props => {
13
14
  var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _props$featureFlags5, _props$featureFlags6;
14
15
 
@@ -69,7 +70,9 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
69
70
  }) => {
70
71
  var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
71
72
 
72
- return jsx("div", {
73
+ return jsx(ToolbarArrowKeyNavigationProvider, {
74
+ editorView: props.editorView
75
+ }, jsx("div", {
73
76
  css: mainToolbarStyle(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
74
77
  "data-testid": "ak-editor-main-toolbar"
75
78
  }, jsx("div", {
@@ -81,7 +84,7 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
81
84
  "data-testid": 'avatar-group-outside-plugin',
82
85
  role: "region",
83
86
  "aria-label": props.intl.formatMessage(messages.pageActionsLabel)
84
- }, shouldSplitToolbar ? nonCustomToolbar : customToolbar));
87
+ }, shouldSplitToolbar ? nonCustomToolbar : customToolbar)));
85
88
  });
86
89
  });
87
90
  export const FullPageToolbar = injectIntl(EditorToolbar);
@@ -15,6 +15,9 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plu
15
15
  const colorPickerButtonWrapper = css`
16
16
  position: relative;
17
17
  `; // Control the size of color picker buttons and preview
18
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
19
+
20
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
18
21
 
19
22
  const colorPickerWrapper = css`
20
23
  border-radius: ${borderRadius()}px;
@@ -22,6 +25,7 @@ const colorPickerWrapper = css`
22
25
  box-shadow: 0 4px 8px -2px ${N60A}, 0 0 1px ${N60A};
23
26
  padding: 8px 0px;
24
27
  `;
28
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
25
29
 
26
30
  const ColorPickerButton = props => {
27
31
  var _props$size, _props$size2;
@@ -117,13 +117,11 @@ function CustomSelect({
117
117
  // for isDirty
118
118
 
119
119
  onFieldChange(name, true);
120
- } // @see DST-2386 & ED-12503
121
- ,
122
- enableAnimation: false // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
120
+ } // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
123
121
  ,
124
122
  isMulti: isMultiple || false,
125
123
  isClearable: true,
126
- isValidNewOption: value => isCreatable && value,
124
+ isValidNewOption: value => !!(isCreatable && value),
127
125
  validationState: error ? 'error' : 'default',
128
126
  defaultOptions: defaultOptions,
129
127
  formatCreateLabel: value => formatCreateLabel(value),
@@ -31,9 +31,7 @@ export default function SelectField({
31
31
  onChange: value => {
32
32
  fieldProps.onChange(value);
33
33
  onFieldChange(name, true);
34
- } // @see DST-2386 & ED-12503
35
- ,
36
- enableAnimation: false // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
34
+ } // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
37
35
  ,
38
36
  isMulti: field.isMultiple || false,
39
37
  options: field.items || [],
@@ -1,2 +1,17 @@
1
- import { Dropdown } from '@atlaskit/editor-common/ui-menu';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import { Dropdown as DropdownComponent } from '@atlaskit/editor-common/ui-menu';
3
+ import React, { useContext } from 'react';
4
+ import { KeyDownHandlerContext } from '../ToolbarArrowKeyNavigationProvider';
5
+ const Dropdown = /*#__PURE__*/React.memo(({ ...props
6
+ }) => {
7
+ const keydownHandlerContext = useContext(KeyDownHandlerContext);
8
+ return (
9
+ /*#__PURE__*/
10
+ //This context is to handle the tab, Arrow Right/Left key events for dropdown.
11
+ //Default context has the void callbacks for above key events
12
+ React.createElement(DropdownComponent, _extends({
13
+ keyDownHandlerContext: keydownHandlerContext
14
+ }, props))
15
+ );
16
+ });
2
17
  export default Dropdown;