@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
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.InputQuery = void 0;
11
11
 
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
 
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
@@ -33,14 +33,15 @@ var _messages = require("../messages");
33
33
 
34
34
  var _reactIntlNext = require("react-intl-next");
35
35
 
36
- var _templateObject;
36
+ var _tokens = require("@atlaskit/tokens");
37
+
38
+ var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
37
39
 
38
40
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
41
 
40
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
43
 
42
- var querySpan = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n outline: none;\n"])));
43
-
44
+ /** @jsx jsx */
44
45
  var isNavigationKey = function isNavigationKey(event) {
45
46
  return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
46
47
  };
@@ -63,6 +64,11 @@ var isUndoRedoShortcut = function isUndoRedoShortcut(event) {
63
64
  return false;
64
65
  };
65
66
 
67
+ var isSelectAllShortcut = function isSelectAllShortcut(event) {
68
+ var key = (0, _w3cKeyname.keyName)(event);
69
+ return (event.ctrlKey || event.metaKey) && key === 'a';
70
+ };
71
+
66
72
  var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
67
73
  var triggerQueryPrefix = _ref.triggerQueryPrefix,
68
74
  cancel = _ref.cancel,
@@ -76,30 +82,34 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
76
82
  onUndoRedo = _ref.onUndoRedo,
77
83
  editorView = _ref.editorView,
78
84
  items = _ref.items;
79
- var ref = (0, _react.useRef)(document.createElement('span'));
80
- var cleanedInputContent = (0, _react.useCallback)(function () {
81
- var _ref$current;
85
+ var ref = (0, _react.useRef)(document.createElement('input'));
86
+ var sizeSpanRef = (0, _react.useRef)(document.createElement('span'));
82
87
 
83
- var raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
84
- return raw.replace(_utils.ZERO_WIDTH_SPACE, '');
85
- }, []);
86
- var onKeyUp = (0, _react.useCallback)(function (event) {
87
- var text = cleanedInputContent();
88
+ var _useState = (0, _react.useState)([]),
89
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
90
+ redoBuffer = _useState2[0],
91
+ setRedoBuffer = _useState2[1];
92
+
93
+ var _useState3 = (0, _react.useState)(reopenQuery),
94
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
95
+ query = _useState4[0],
96
+ setQuery = _useState4[1];
97
+
98
+ var onChange = (0, _react.useCallback)(function (event) {
99
+ var text = event.currentTarget.value;
100
+ sizeSpanRef.current.textContent = text;
101
+ setQuery(text);
88
102
  onQueryChange(text);
89
- }, [onQueryChange, cleanedInputContent]);
103
+ }, [onQueryChange]);
90
104
 
91
- var _useState = (0, _react.useState)(false),
92
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
93
- isInFocus = _useState2[0],
94
- setInFocus = _useState2[1];
105
+ var _useState5 = (0, _react.useState)(false),
106
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
107
+ isInFocus = _useState6[0],
108
+ setInFocus = _useState6[1];
95
109
 
96
110
  var checkKeyEvent = (0, _react.useCallback)(function (event) {
97
- var _ref$current2;
98
-
99
111
  var key = (0, _w3cKeyname.keyName)(event);
100
- var sel = document.getSelection();
101
- var raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
102
- var text = cleanedInputContent();
112
+ var text = ref.current.value;
103
113
  var stopDefault = false;
104
114
 
105
115
  var _getPluginState = (0, _utils2.getPluginState)(editorView.state),
@@ -123,6 +133,9 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
123
133
  break;
124
134
 
125
135
  case 'Escape':
136
+ case 'PageUp':
137
+ case 'PageDown':
138
+ case 'Home':
126
139
  cancel({
127
140
  text: text,
128
141
  forceFocusOnEditor: true,
@@ -133,7 +146,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
133
146
  break;
134
147
 
135
148
  case 'Backspace':
136
- if (raw === _utils.ZERO_WIDTH_SPACE || raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
149
+ if (text.length === 0 || ref.current.selectionStart === 0) {
137
150
  event.stopPropagation();
138
151
  event.preventDefault();
139
152
  cancel({
@@ -173,13 +186,49 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
173
186
  selectNextItem();
174
187
  }
175
188
 
189
+ break;
190
+
191
+ case 'ArrowUp':
192
+ if (selectedIndex === -1) {
193
+ selectPreviousItem();
194
+ }
195
+
176
196
  break;
177
197
  }
178
198
 
199
+ if (isSelectAllShortcut(event)) {
200
+ cancel({
201
+ forceFocusOnEditor: true,
202
+ addPrefixTrigger: true,
203
+ text: ref.current.value,
204
+ setSelectionAt: _constants.CloseSelectionOptions.BEFORE_TEXT_INSERTED
205
+ });
206
+ return true;
207
+ }
208
+
179
209
  var undoRedoType = isUndoRedoShortcut(event);
210
+ var hasReopenQuery = reopenQuery && reopenQuery.length > 0;
180
211
 
181
- if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
182
- stopDefault = true;
212
+ if (onUndoRedo && undoRedoType) {
213
+ if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
214
+ setRedoBuffer(function (buffer) {
215
+ return [ref.current.value].concat((0, _toConsumableArray2.default)(buffer));
216
+ });
217
+ var undoValue = text.substring(0, text.length - 1);
218
+ ref.current.value = undoValue;
219
+ sizeSpanRef.current.textContent = undoValue;
220
+ stopDefault = true;
221
+ } else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
222
+ var redoValue = redoBuffer[0];
223
+ ref.current.value = redoValue;
224
+ sizeSpanRef.current.textContent = redoValue;
225
+ setRedoBuffer(function (buffer) {
226
+ return buffer.slice(1);
227
+ });
228
+ stopDefault = true;
229
+ } else {
230
+ stopDefault = onUndoRedo(undoRedoType);
231
+ }
183
232
  }
184
233
 
185
234
  if (isNavigationKey(event) || stopDefault) {
@@ -187,16 +236,34 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
187
236
  event.preventDefault();
188
237
  return false;
189
238
  }
190
- }, [onUndoRedo, onItemSelect, selectNextItem, cancel, cleanedInputContent, editorView.state]);
239
+ }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state, redoBuffer, reopenQuery]);
191
240
  var onClick = (0, _react.useCallback)(function (event) {
192
- var _ref$current3;
241
+ var _ref$current;
193
242
 
194
243
  event.stopPropagation();
195
244
  event.preventDefault();
196
245
  onQueryFocus();
197
- (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.focus();
246
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
198
247
  return false;
199
248
  }, [onQueryFocus]);
249
+ var queryStyle = (0, _react2.css)({
250
+ outline: 'none',
251
+ position: 'absolute',
252
+ fontFamily: 'inherit',
253
+ fontSize: 'inherit',
254
+ fontWeight: 'inherit',
255
+ letterSpacing: 'inherit',
256
+ padding: 0,
257
+ height: '100%',
258
+ width: '100%',
259
+ top: 0,
260
+ left: 0,
261
+ background: 'transparent',
262
+ border: 'none',
263
+ '&&': {
264
+ color: "".concat((0, _tokens.token)('color.link', colors.B400))
265
+ }
266
+ });
200
267
  (0, _react.useLayoutEffect)(function () {
201
268
  if (!ref.current) {
202
269
  return;
@@ -212,12 +279,12 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
212
279
  var key = (0, _w3cKeyname.keyName)(event);
213
280
 
214
281
  if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
215
- var _ref$current4;
282
+ var _ref$current2, _ref$current3;
216
283
 
217
- var q = ((_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.textContent) || '';
218
- var sel = document.getSelection();
219
- var isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
220
- var isMovingLeft = sel && 'ArrowLeft' === key && sel.anchorOffset === 0;
284
+ var q = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.value) || '';
285
+ var anchorOffset = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.selectionStart;
286
+ var isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
287
+ var isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
221
288
 
222
289
  if (!isMovingRight && !isMovingLeft) {
223
290
  return;
@@ -226,7 +293,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
226
293
  cancel({
227
294
  forceFocusOnEditor: true,
228
295
  addPrefixTrigger: true,
229
- text: cleanedInputContent(),
296
+ text: ref.current.value,
230
297
  setSelectionAt: isMovingRight ? _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED : _constants.CloseSelectionOptions.BEFORE_TEXT_INSERTED
231
298
  });
232
299
  event.preventDefault();
@@ -260,8 +327,8 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
260
327
 
261
328
  cancel({
262
329
  addPrefixTrigger: true,
263
- text: cleanedInputContent(),
264
- setSelectionAt: _constants.CloseSelectionOptions.BEFORE_TEXT_INSERTED,
330
+ text: ref.current.value,
331
+ setSelectionAt: _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED,
265
332
  forceFocusOnEditor: false
266
333
  });
267
334
  };
@@ -281,33 +348,16 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
281
348
  setInFocus(false);
282
349
  var target = e.target;
283
350
 
284
- if (e.isComposing || !(target instanceof HTMLElement)) {
351
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
285
352
  return;
286
353
  }
287
354
 
288
- if (e.inputType === 'historyUndo' && (((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0 || target.textContent === _utils.ZERO_WIDTH_SPACE)) {
355
+ if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
289
356
  e.preventDefault();
290
357
  e.stopPropagation();
291
358
  close();
292
359
  return;
293
360
  }
294
-
295
- if (e.data != null && target.textContent === _utils.ZERO_WIDTH_SPACE) {
296
- element.textContent = ''; // We need to change the content on Safari
297
- // and set the cursor at the right place
298
-
299
- if (_utils.browser.safari) {
300
- e.preventDefault();
301
- var dataElement = document.createTextNode(e.data);
302
- element.appendChild(dataElement);
303
- var sel = window.getSelection();
304
- var range = document.createRange();
305
- range.setStart(dataElement, dataElement.length);
306
- range.collapse(true);
307
- sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
308
- sel === null || sel === void 0 ? void 0 : sel.addRange(range);
309
- }
310
- }
311
361
  };
312
362
 
313
363
  var onInput = null;
@@ -321,7 +371,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
321
371
 
322
372
  var target = e.target;
323
373
 
324
- if (e.isComposing || !(target instanceof HTMLElement)) {
374
+ if (e.isComposing || !(target instanceof HTMLInputElement)) {
325
375
  return;
326
376
  }
327
377
 
@@ -350,12 +400,13 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
350
400
  element.removeEventListener('input', onInput);
351
401
  }
352
402
  };
353
- }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
403
+ }, [triggerQueryPrefix, ref.current.value, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
354
404
  (0, _react.useLayoutEffect)(function () {
355
405
  var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
356
406
 
357
407
  if (ref.current && forceFocus) {
358
- ref.current.textContent = hasReopenQuery ? reopenQuery : _utils.ZERO_WIDTH_SPACE;
408
+ ref.current.value = hasReopenQuery ? reopenQuery : '';
409
+ sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
359
410
  requestAnimationFrame(function () {
360
411
  if (!(ref !== null && ref !== void 0 && ref.current)) {
361
412
  return;
@@ -386,10 +437,20 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
386
437
  */
387
438
 
388
439
  return (0, _react2.jsx)(_react.Fragment, null, triggerQueryPrefix, (0, _react2.jsx)("span", {
389
- css: querySpan,
390
- contentEditable: true,
440
+ style: {
441
+ position: 'relative'
442
+ }
443
+ }, (0, _react2.jsx)("span", {
444
+ ref: sizeSpanRef,
445
+ "aria-hidden": true,
446
+ style: {
447
+ marginLeft: '1px',
448
+ visibility: 'hidden'
449
+ }
450
+ }), (0, _react2.jsx)("input", {
451
+ css: queryStyle,
391
452
  ref: ref,
392
- onKeyUp: onKeyUp,
453
+ onChange: onChange,
393
454
  onClick: onClick,
394
455
  role: "combobox",
395
456
  "aria-controls": _constants.TYPE_AHEAD_DECORATION_ELEMENT_ID,
@@ -397,8 +458,9 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
397
458
  "aria-expanded": items.length !== 0,
398
459
  "aria-labelledby": assistiveHintID,
399
460
  suppressContentEditableWarning: true,
400
- "data-query-prefix": triggerQueryPrefix
401
- }), (0, _react2.jsx)("span", {
461
+ "data-query-prefix": triggerQueryPrefix,
462
+ value: query
463
+ })), (0, _react2.jsx)("span", {
402
464
  id: assistiveHintID,
403
465
  style: {
404
466
  display: 'none'
@@ -175,7 +175,16 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
175
175
  setCache(new _CellMeasurer.CellMeasurerCache({
176
176
  fixedWidth: true,
177
177
  defaultHeight: LIST_ITEM_ESTIMATED_HEIGHT
178
- }));
178
+ })); // When query is updated, sometimes the scroll position of the menu is not at the top
179
+ // Scrolling back to top for consistency
180
+
181
+ requestAnimationFrame(function () {
182
+ var _listContainerRef$cur;
183
+
184
+ if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
185
+ listContainerRef.current.firstChild.scrollTo(0, 0);
186
+ }
187
+ });
179
188
  }, [items]);
180
189
  (0, _react.useLayoutEffect)(function () {
181
190
  var height = Math.min(items.reduce(function (prevValue, currentValue, index) {
@@ -200,23 +209,12 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
200
209
  if (isNavigationKey(event)) {
201
210
  switch (event.key) {
202
211
  case 'ArrowDown':
203
- if (selectedIndex === items.length - 1) {
204
- event.stopPropagation();
205
- } else {
206
- selectNextItem();
207
- }
208
-
212
+ selectNextItem();
209
213
  event.preventDefault();
210
214
  break;
211
215
 
212
216
  case 'ArrowUp':
213
- if (selectedIndex === 0) {
214
- //To set focus on target element when up arrow is pressed on first option of list
215
- focusTargetElement();
216
- } else {
217
- selectPreviousItem();
218
- }
219
-
217
+ selectPreviousItem();
220
218
  event.preventDefault();
221
219
  break;
222
220
 
@@ -33,6 +33,10 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
33
33
 
34
34
  var _tokens = require("@atlaskit/tokens");
35
35
 
36
+ var _reactIntlNext = require("react-intl-next");
37
+
38
+ var _messages = require("../messages");
39
+
36
40
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
37
41
 
38
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -47,13 +51,13 @@ var ITEM_PADDING = 12;
47
51
  exports.ITEM_PADDING = ITEM_PADDING;
48
52
  var itemIcon = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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, (0, _tokens.token)('color.border', 'rgba(223, 225, 229, 0.5)'), (0, _constants.borderRadius)(), ICON_WIDTH, ICON_HEIGHT);
49
53
  exports.itemIcon = itemIcon;
50
- var itemBody = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n"])));
54
+ var itemBody = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n"])));
51
55
 
52
56
  var itemText = function itemText(theme) {
53
- return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n white-space: initial;\n color: ", ";\n .item-description {\n font-size: ", ";\n color: ", ";\n margin-top: 4px;\n }\n"])), (0, _components.themed)({
57
+ return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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"])), (0, _components.themed)({
54
58
  light: (0, _tokens.token)('color.text', _colors.N800),
55
59
  dark: (0, _tokens.token)('color.text', _colors.DN600)
56
- })(theme), (0, _editorSharedStyles.relativeFontSizeToBase16)(11.67), (0, _tokens.token)('color.text.subtlest', _colors.N200));
60
+ })(theme), (0, _editorSharedStyles.relativeFontSizeToBase16)(12), (0, _tokens.token)('color.text.subtlest', _colors.N200));
57
61
  };
58
62
 
59
63
  var itemAfter = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
@@ -82,12 +86,24 @@ var FallbackIcon = /*#__PURE__*/_react.default.memo(function (_ref) {
82
86
 
83
87
  var noop = function noop() {};
84
88
 
85
- var TypeAheadListItem = function TypeAheadListItem(_ref2) {
86
- var item = _ref2.item,
87
- itemsLength = _ref2.itemsLength,
88
- selectedIndex = _ref2.selectedIndex,
89
- onItemClick = _ref2.onItemClick,
90
- itemIndex = _ref2.itemIndex;
89
+ var AssistiveText = function AssistiveText(_ref2) {
90
+ var title = _ref2.title,
91
+ description = _ref2.description,
92
+ shortcut = _ref2.shortcut;
93
+ var intl = (0, _reactIntlNext.useIntl)();
94
+ var descriptionText = description ? " ".concat(intl.formatMessage(_messages.typeAheadListMessages.descriptionLabel), " ").concat(description, ".") : '';
95
+ var shortcutText = shortcut ? " ".concat(intl.formatMessage(_messages.typeAheadListMessages.shortcutLabel), " ").concat(shortcut, ".") : '';
96
+ return (0, _react2.jsx)("span", {
97
+ className: "assistive"
98
+ }, "".concat(title, ". ").concat(descriptionText, " ").concat(shortcutText));
99
+ };
100
+
101
+ var TypeAheadListItem = function TypeAheadListItem(_ref3) {
102
+ var item = _ref3.item,
103
+ itemsLength = _ref3.itemsLength,
104
+ selectedIndex = _ref3.selectedIndex,
105
+ onItemClick = _ref3.onItemClick,
106
+ itemIndex = _ref3.itemIndex;
91
107
 
92
108
  /**
93
109
  * To select and highlight the first Item when no item is selected
@@ -166,19 +182,26 @@ var TypeAheadListItem = function TypeAheadListItem(_ref2) {
166
182
  "aria-label": item.title,
167
183
  "aria-setsize": itemsLength,
168
184
  role: "option",
169
- ref: buttonItemRef,
170
- description: item.description
185
+ ref: buttonItemRef
171
186
  }, (0, _react2.jsx)("div", {
172
- css: itemBody
187
+ "aria-hidden": true
173
188
  }, (0, _react2.jsx)("div", {
174
189
  css: itemText
190
+ }, (0, _react2.jsx)("div", {
191
+ css: itemBody
175
192
  }, (0, _react2.jsx)("div", {
176
193
  className: "item-title"
177
- }, item.title)), (0, _react2.jsx)("div", {
194
+ }, item.title), (0, _react2.jsx)("div", {
178
195
  css: itemAfter
179
196
  }, item.keyshortcut && (0, _react2.jsx)("div", {
180
197
  css: _styles.shortcutStyle
181
- }, item.keyshortcut)))));
198
+ }, item.keyshortcut))), (0, _react2.jsx)("div", {
199
+ className: "item-description"
200
+ }, item.description))), (0, _react2.jsx)(AssistiveText, {
201
+ title: item.title,
202
+ description: item.description,
203
+ shortcut: item.keyshortcut
204
+ })));
182
205
  };
183
206
 
184
207
  exports.TypeAheadListItem = TypeAheadListItem;
@@ -27,7 +27,7 @@ var _constants = require("@atlaskit/theme/constants");
27
27
 
28
28
  var _colors = require("@atlaskit/theme/colors");
29
29
 
30
- var _analytics = require("../../analytics");
30
+ var _analytics = require("@atlaskit/editor-common/analytics");
31
31
 
32
32
  var _constants2 = require("../constants");
33
33
 
@@ -54,8 +54,7 @@ var Highlight = function Highlight(_ref) {
54
54
  return null;
55
55
  }
56
56
 
57
- var highlight = triggerHandler.getHighlight(state);
58
- return highlight;
57
+ return triggerHandler.getHighlight(state);
59
58
  };
60
59
 
61
60
  var OFFSET = [0, 8];
@@ -71,7 +70,9 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
71
70
  selectedIndex = props.selectedIndex,
72
71
  onItemInsert = props.onItemInsert,
73
72
  fireAnalyticsCallback = props.fireAnalyticsCallback,
74
- isEmptyQuery = props.isEmptyQuery;
73
+ isEmptyQuery = props.isEmptyQuery,
74
+ cancel = props.cancel;
75
+ var ref = (0, _react.useRef)(null);
75
76
  var startTime = (0, _react.useMemo)(function () {
76
77
  return performance.now();
77
78
  }, // In case those props changes
@@ -183,6 +184,35 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
183
184
  }
184
185
  };
185
186
  }, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
187
+ (0, _react.useLayoutEffect)(function () {
188
+ var focusOut = function focusOut(event) {
189
+ var _window$getSelection;
190
+
191
+ var relatedTarget = event.relatedTarget; // Given the user is changing the focus
192
+ // When the target is inside the TypeAhead Popup
193
+ // Then the popup should stay open
194
+
195
+ if (relatedTarget instanceof HTMLElement && relatedTarget.closest && (relatedTarget.closest(".".concat(_constants2.TYPE_AHEAD_POPUP_CONTENT_CLASS)) || relatedTarget.closest("[data-type-ahead=\"".concat(_constants2.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "\"]")))) {
196
+ return;
197
+ }
198
+
199
+ if (!(((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range')) {
200
+ return;
201
+ }
202
+
203
+ cancel({
204
+ addPrefixTrigger: true,
205
+ setSelectionAt: _constants2.CloseSelectionOptions.AFTER_TEXT_INSERTED,
206
+ forceFocusOnEditor: false
207
+ });
208
+ };
209
+
210
+ var element = ref.current;
211
+ element === null || element === void 0 ? void 0 : element.addEventListener('focusout', focusOut);
212
+ return function () {
213
+ element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
214
+ };
215
+ }, [ref, cancel]);
186
216
  return (0, _react2.jsx)(_ui.Popup, {
187
217
  zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
188
218
  target: anchorElement,
@@ -195,7 +225,8 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
195
225
  }, (0, _react2.jsx)("div", {
196
226
  css: typeAheadContent,
197
227
  tabIndex: 0,
198
- className: _constants2.TYPE_AHEAD_POPUP_CONTENT_CLASS
228
+ className: _constants2.TYPE_AHEAD_POPUP_CONTENT_CLASS,
229
+ ref: ref
199
230
  }, (0, _react2.jsx)(Highlight, {
200
231
  state: editorView.state,
201
232
  triggerHandler: triggerHandler
@@ -44,6 +44,8 @@ exports.findTypeAheadDecorations = findTypeAheadDecorations;
44
44
  var isTypeAheadHandler = function isTypeAheadHandler(handler) {
45
45
  return handler && Object.values(_typeAhead.TypeAheadAvailableNodes).includes(handler.id) && typeof handler.trigger === 'string' && typeof handler.selectItem === 'function' && typeof handler.getItems === 'function';
46
46
  };
47
+ /** Is a typeahead plugin open? */
48
+
47
49
 
48
50
  exports.isTypeAheadHandler = isTypeAheadHandler;
49
51
 
@@ -135,7 +137,7 @@ var moveSelectedIndex = function moveSelectedIndex(_ref2) {
135
137
  nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
136
138
  } else {
137
139
  stats.increaseArrowUp();
138
- nextIndex = selectedIndex === 0 ? items.length - 1 : selectedIndex - 1;
140
+ nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
139
141
  }
140
142
 
141
143
  (0, _updateSelectedIndex.updateSelectedIndex)(nextIndex)(editorView.state, editorView.dispatch);
@@ -46,7 +46,6 @@ var alignmentOptions = [{
46
46
  value: 'center'
47
47
  }, {
48
48
  title: _messages.alignmentMessages.alignRight,
49
- shortcut: _keymaps.alignRight,
50
49
  value: 'end'
51
50
  }];
52
51
 
@@ -45,7 +45,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
45
45
 
46
46
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
47
 
48
- var chromelessEditor = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _styles.scrollbarStyles);
48
+ var chromelessEditor = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _styles.scrollbarStyles);
49
49
  var ContentArea = (0, _ContentStyles.createEditorContentStyle)();
50
50
  ContentArea.displayName = 'ContentArea';
51
51
 
@@ -48,7 +48,7 @@ var StickyToolbar = function StickyToolbar(props) {
48
48
  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);
49
49
  }, [setTop, props.externalToolbarRef]);
50
50
  return (0, _react2.jsx)("div", {
51
- css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n top: ", ";\n "])), top)],
51
+ css: [mainToolbarWrapperStyle, stickyToolbarWrapperStyle, (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n top: ", "px;\n "])), top)],
52
52
  "data-testid": "ak-editor-main-toolbar",
53
53
  className: 'show-keyline'
54
54
  }, props.children);
@@ -31,6 +31,8 @@ var _context = require("../../ContextPanel/context");
31
31
 
32
32
  var _messages = _interopRequireDefault(require("./messages"));
33
33
 
34
+ var _ToolbarArrowKeyNavigationProvider = require("../../ToolbarArrowKeyNavigationProvider");
35
+
34
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
37
 
36
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -101,7 +103,9 @@ var EditorToolbar = /*#__PURE__*/_react.default.memo(function (props) {
101
103
  var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
102
104
 
103
105
  var contextPanelWidth = _ref.width;
104
- return (0, _react2.jsx)("div", {
106
+ return (0, _react2.jsx)(_ToolbarArrowKeyNavigationProvider.ToolbarArrowKeyNavigationProvider, {
107
+ editorView: props.editorView
108
+ }, (0, _react2.jsx)("div", {
105
109
  css: (0, _MainToolbar.mainToolbarStyle)(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
106
110
  "data-testid": "ak-editor-main-toolbar"
107
111
  }, (0, _react2.jsx)("div", {
@@ -113,7 +117,7 @@ var EditorToolbar = /*#__PURE__*/_react.default.memo(function (props) {
113
117
  "data-testid": 'avatar-group-outside-plugin',
114
118
  role: "region",
115
119
  "aria-label": props.intl.formatMessage(_messages.default.pageActionsLabel)
116
- }, shouldSplitToolbar ? nonCustomToolbar : customToolbar));
120
+ }, shouldSplitToolbar ? nonCustomToolbar : customToolbar)));
117
121
  });
118
122
  });
119
123
 
@@ -39,8 +39,12 @@ var _templateObject, _templateObject2;
39
39
 
40
40
  // helps adjusts position of popup
41
41
  var colorPickerButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n"]))); // Control the size of color picker buttons and preview
42
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
43
+
44
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
42
45
 
43
46
  var colorPickerWrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n background-color: white;\n box-shadow: 0 4px 8px -2px ", ", 0 0 1px ", ";\n padding: 8px 0px;\n"])), (0, _constants.borderRadius)(), _colors.N60A, _colors.N60A);
47
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
44
48
 
45
49
  var ColorPickerButton = function ColorPickerButton(props) {
46
50
  var _props$size, _props$size2;
@@ -206,14 +206,12 @@ function CustomSelect(_ref2) {
206
206
  // for isDirty
207
207
 
208
208
  onFieldChange(name, true);
209
- } // @see DST-2386 & ED-12503
210
- ,
211
- enableAnimation: false // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
209
+ } // add type cast to avoid adding a "IsMulti" generic prop (TODO: ED-12072)
212
210
  ,
213
211
  isMulti: isMultiple || false,
214
212
  isClearable: true,
215
213
  isValidNewOption: function isValidNewOption(value) {
216
- return isCreatable && value;
214
+ return !!(isCreatable && value);
217
215
  },
218
216
  validationState: error ? 'error' : 'default',
219
217
  defaultOptions: defaultOptions,