@atlaskit/editor-core 179.1.2 → 180.1.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 (457) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/codemods/180.1.0-update-to-editor-migration-component.ts +8 -0
  3. package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +156 -0
  4. package/codemods/migrates/rename-editor-to-editor-migration-component.ts +34 -0
  5. package/dist/cjs/actions/index.js +1 -1
  6. package/dist/cjs/create-editor/ReactEditorView.js +12 -762
  7. package/dist/cjs/create-editor/ReactEditorViewInternal.js +783 -0
  8. package/dist/cjs/create-editor/ReactEditorViewNext.js +16 -0
  9. package/dist/cjs/create-editor/create-plugins-list.js +1 -0
  10. package/dist/cjs/create-editor/feature-flags-from-props.js +3 -2
  11. package/dist/cjs/editor-next/editor-internal.js +147 -0
  12. package/dist/cjs/editor-next/editor-migration-component.js +35 -0
  13. package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +36 -0
  14. package/dist/cjs/editor-next/hooks/useMeasureEditorMountTime.js +42 -0
  15. package/dist/cjs/editor-next/hooks/useProviderFactory.js +72 -0
  16. package/dist/cjs/editor-next/index.js +139 -0
  17. package/dist/cjs/editor-next/utils/deprecationWarnings.js +45 -0
  18. package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +44 -0
  19. package/dist/cjs/editor-next/utils/editorPropTypes.js +36 -0
  20. package/dist/cjs/editor-next/utils/getBaseFontSize.js +17 -0
  21. package/dist/cjs/editor-next/utils/handleProviders.js +56 -0
  22. package/dist/cjs/editor-next/utils/onEditorCreated.js +28 -0
  23. package/dist/cjs/editor-next/utils/sendDurationAnalytics.js +68 -0
  24. package/dist/cjs/editor-next/utils/trackEditorActions.js +101 -0
  25. package/dist/cjs/editor.js +130 -443
  26. package/dist/cjs/index.js +7 -0
  27. package/dist/cjs/labs/next/internal/hooks/use-analytics/index.js +4 -4
  28. package/dist/cjs/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +6 -6
  29. package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +117 -0
  30. package/dist/cjs/labs/next/presets/preset.js +0 -5
  31. package/dist/cjs/labs/next/presets/universal.js +11 -2
  32. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
  33. package/dist/cjs/plugins/analytics/index.js +2 -3
  34. package/dist/cjs/plugins/analytics/plugin.js +5 -6
  35. package/dist/cjs/plugins/analytics/utils.js +0 -11
  36. package/dist/cjs/plugins/base/pm-plugins/filter-steps.js +1 -1
  37. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +98 -56
  38. package/dist/cjs/plugins/base/utils/input-latency-tracking.js +24 -25
  39. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
  40. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
  41. package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -1
  42. package/dist/cjs/plugins/card/nodeviews/genericCard.js +16 -2
  43. package/dist/cjs/plugins/card/pm-plugins/main.js +4 -2
  44. package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -1
  45. package/dist/cjs/plugins/collab-edit/plugin.js +2 -3
  46. package/dist/cjs/plugins/extension/toolbar.js +7 -1
  47. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
  48. package/dist/cjs/plugins/floating-toolbar/ui/Button.js +2 -0
  49. package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
  50. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +38 -9
  51. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
  52. package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
  53. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +11 -0
  54. package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
  55. package/dist/cjs/plugins/hyperlink/analytics.js +5 -5
  56. package/dist/cjs/plugins/hyperlink/index.js +1 -1
  57. package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +9 -5
  58. package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
  59. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  60. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +4 -3
  61. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
  62. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
  63. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
  64. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
  65. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
  66. package/dist/cjs/plugins/media/commands/helpers.js +12 -40
  67. package/dist/cjs/plugins/media/commands/index.js +4 -4
  68. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -12
  69. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +1 -1
  70. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +310 -205
  71. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
  72. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  73. package/dist/cjs/plugins/media/pm-plugins/main.js +2 -27
  74. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +1 -4
  75. package/dist/cjs/plugins/panel/utils.js +4 -1
  76. package/dist/cjs/plugins/paste/handlers.js +128 -13
  77. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +15 -6
  78. package/dist/cjs/plugins/paste/pm-plugins/main.js +12 -3
  79. package/dist/cjs/plugins/placeholder-text/index.js +2 -2
  80. package/dist/cjs/plugins/status/index.js +9 -3
  81. package/dist/cjs/plugins/status/ui/statusPicker.js +8 -2
  82. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
  83. package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +22 -2
  84. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +3 -1
  85. package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
  86. package/dist/cjs/plugins/text-formatting/utils.js +1 -10
  87. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
  88. package/dist/cjs/plugins/type-ahead/index.js +1 -1
  89. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +79 -106
  90. package/dist/cjs/types/get-editor-props.js +5 -0
  91. package/dist/cjs/ui/ChromeCollapsed/index.js +1 -0
  92. package/dist/cjs/ui/CollapsedEditor/index.js +7 -13
  93. package/dist/cjs/ui/ColorPickerButton/index.js +68 -6
  94. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +1 -1
  95. package/dist/cjs/ui/ContextPanel/context.js +13 -12
  96. package/dist/cjs/ui/Dropdown/index.js +7 -2
  97. package/dist/cjs/ui/DropdownMenu/index.js +7 -2
  98. package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +1 -1
  99. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
  100. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
  101. package/dist/cjs/ui/PanelTextInput/index.js +4 -4
  102. package/dist/cjs/ui/PortalProvider/index.js +5 -5
  103. package/dist/cjs/ui/WidthEmitter/index.js +29 -35
  104. package/dist/cjs/utils/document.js +15 -0
  105. package/dist/cjs/utils/extensions.js +6 -7
  106. package/dist/cjs/utils/get-editor-plugins.js +32 -0
  107. package/dist/cjs/utils/linking-utils.js +1 -1
  108. package/dist/cjs/utils/performance/components/RenderTracking.js +1 -1
  109. package/dist/cjs/utils/performance/safer-transactions.js +1 -1
  110. package/dist/cjs/utils/prepare-extension-provider.js +25 -0
  111. package/dist/cjs/version-wrapper.js +1 -1
  112. package/dist/cjs/version.json +1 -1
  113. package/dist/es2019/actions/index.js +2 -2
  114. package/dist/es2019/create-editor/ReactEditorView.js +6 -708
  115. package/dist/es2019/create-editor/ReactEditorViewInternal.js +712 -0
  116. package/dist/es2019/create-editor/ReactEditorViewNext.js +7 -0
  117. package/dist/es2019/create-editor/create-plugins-list.js +1 -0
  118. package/dist/es2019/create-editor/feature-flags-from-props.js +3 -2
  119. package/dist/es2019/editor-next/editor-internal.js +142 -0
  120. package/dist/es2019/editor-next/editor-migration-component.js +10 -0
  121. package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
  122. package/dist/es2019/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
  123. package/dist/es2019/editor-next/hooks/useProviderFactory.js +61 -0
  124. package/dist/es2019/editor-next/index.js +90 -0
  125. package/dist/es2019/editor-next/utils/deprecationWarnings.js +39 -0
  126. package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +40 -0
  127. package/dist/es2019/editor-next/utils/editorPropTypes.js +29 -0
  128. package/dist/es2019/editor-next/utils/getBaseFontSize.js +11 -0
  129. package/dist/es2019/editor-next/utils/handleProviders.js +52 -0
  130. package/dist/es2019/editor-next/utils/onEditorCreated.js +21 -0
  131. package/dist/es2019/editor-next/utils/sendDurationAnalytics.js +40 -0
  132. package/dist/es2019/editor-next/utils/trackEditorActions.js +78 -0
  133. package/dist/es2019/editor.js +111 -396
  134. package/dist/es2019/index.js +2 -1
  135. package/dist/es2019/labs/next/internal/hooks/use-analytics/index.js +2 -2
  136. package/dist/es2019/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
  137. package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +105 -0
  138. package/dist/es2019/labs/next/presets/preset.js +0 -3
  139. package/dist/es2019/labs/next/presets/universal.js +13 -2
  140. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +41 -12
  141. package/dist/es2019/plugins/analytics/index.js +3 -4
  142. package/dist/es2019/plugins/analytics/plugin.js +1 -2
  143. package/dist/es2019/plugins/analytics/utils.js +0 -4
  144. package/dist/es2019/plugins/base/pm-plugins/filter-steps.js +1 -1
  145. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +96 -58
  146. package/dist/es2019/plugins/base/utils/input-latency-tracking.js +23 -23
  147. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
  148. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +31 -5
  149. package/dist/es2019/plugins/card/nodeviews/blockCard.js +4 -1
  150. package/dist/es2019/plugins/card/nodeviews/genericCard.js +16 -2
  151. package/dist/es2019/plugins/card/pm-plugins/main.js +3 -1
  152. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -1
  153. package/dist/es2019/plugins/collab-edit/plugin.js +1 -2
  154. package/dist/es2019/plugins/extension/toolbar.js +7 -1
  155. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
  156. package/dist/es2019/plugins/floating-toolbar/ui/Button.js +2 -0
  157. package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
  158. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +35 -7
  159. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
  160. package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
  161. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +11 -0
  162. package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
  163. package/dist/es2019/plugins/hyperlink/analytics.js +1 -1
  164. package/dist/es2019/plugins/hyperlink/index.js +1 -1
  165. package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +8 -4
  166. package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +9 -3
  167. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  168. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
  169. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
  170. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
  171. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
  172. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
  173. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +24 -0
  174. package/dist/es2019/plugins/media/commands/helpers.js +9 -35
  175. package/dist/es2019/plugins/media/commands/index.js +1 -1
  176. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +3 -3
  177. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +1 -1
  178. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +70 -37
  179. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
  180. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  181. package/dist/es2019/plugins/media/pm-plugins/main.js +3 -30
  182. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -4
  183. package/dist/es2019/plugins/panel/utils.js +4 -1
  184. package/dist/es2019/plugins/paste/handlers.js +127 -5
  185. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +10 -4
  186. package/dist/es2019/plugins/paste/pm-plugins/main.js +13 -4
  187. package/dist/es2019/plugins/placeholder-text/index.js +1 -1
  188. package/dist/es2019/plugins/status/index.js +8 -2
  189. package/dist/es2019/plugins/status/ui/statusPicker.js +8 -2
  190. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
  191. package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +20 -3
  192. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +4 -2
  193. package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
  194. package/dist/es2019/plugins/text-formatting/utils.js +0 -8
  195. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +16 -1
  196. package/dist/es2019/plugins/type-ahead/index.js +1 -1
  197. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +73 -92
  198. package/dist/es2019/types/get-editor-props.js +1 -0
  199. package/dist/es2019/ui/ChromeCollapsed/index.js +1 -0
  200. package/dist/es2019/ui/CollapsedEditor/index.js +7 -11
  201. package/dist/es2019/ui/ColorPickerButton/index.js +61 -8
  202. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -1
  203. package/dist/es2019/ui/ContextPanel/context.js +5 -4
  204. package/dist/es2019/ui/Dropdown/index.js +5 -2
  205. package/dist/es2019/ui/DropdownMenu/index.js +5 -2
  206. package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +1 -1
  207. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
  208. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
  209. package/dist/es2019/ui/PanelTextInput/index.js +3 -3
  210. package/dist/es2019/ui/PortalProvider/index.js +1 -1
  211. package/dist/es2019/ui/WidthEmitter/index.js +25 -29
  212. package/dist/es2019/utils/document.js +11 -1
  213. package/dist/es2019/utils/extensions.js +1 -3
  214. package/dist/es2019/utils/get-editor-plugins.js +25 -0
  215. package/dist/es2019/utils/linking-utils.js +1 -1
  216. package/dist/es2019/utils/performance/components/RenderTracking.js +1 -1
  217. package/dist/es2019/utils/performance/safer-transactions.js +1 -1
  218. package/dist/es2019/utils/prepare-extension-provider.js +13 -0
  219. package/dist/es2019/version-wrapper.js +1 -1
  220. package/dist/es2019/version.json +1 -1
  221. package/dist/esm/actions/index.js +2 -2
  222. package/dist/esm/create-editor/ReactEditorView.js +12 -763
  223. package/dist/esm/create-editor/ReactEditorViewInternal.js +776 -0
  224. package/dist/esm/create-editor/ReactEditorViewNext.js +7 -0
  225. package/dist/esm/create-editor/create-plugins-list.js +1 -0
  226. package/dist/esm/create-editor/feature-flags-from-props.js +3 -2
  227. package/dist/esm/editor-next/editor-internal.js +141 -0
  228. package/dist/esm/editor-next/editor-migration-component.js +28 -0
  229. package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +30 -0
  230. package/dist/esm/editor-next/hooks/useMeasureEditorMountTime.js +35 -0
  231. package/dist/esm/editor-next/hooks/useProviderFactory.js +65 -0
  232. package/dist/esm/editor-next/index.js +134 -0
  233. package/dist/esm/editor-next/utils/deprecationWarnings.js +39 -0
  234. package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +38 -0
  235. package/dist/esm/editor-next/utils/editorPropTypes.js +28 -0
  236. package/dist/esm/editor-next/utils/getBaseFontSize.js +11 -0
  237. package/dist/esm/editor-next/utils/handleProviders.js +50 -0
  238. package/dist/esm/editor-next/utils/onEditorCreated.js +21 -0
  239. package/dist/esm/editor-next/utils/sendDurationAnalytics.js +61 -0
  240. package/dist/esm/editor-next/utils/trackEditorActions.js +94 -0
  241. package/dist/esm/editor.js +130 -440
  242. package/dist/esm/index.js +2 -1
  243. package/dist/esm/labs/next/internal/hooks/use-analytics/index.js +2 -2
  244. package/dist/esm/labs/next/internal/hooks/use-editor/create-dispatch-transaction.js +2 -3
  245. package/dist/esm/labs/next/presets/create-stub-internal-apis.js +110 -0
  246. package/dist/esm/labs/next/presets/preset.js +0 -5
  247. package/dist/esm/labs/next/presets/universal.js +11 -2
  248. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +48 -13
  249. package/dist/esm/plugins/analytics/index.js +3 -4
  250. package/dist/esm/plugins/analytics/plugin.js +1 -2
  251. package/dist/esm/plugins/analytics/utils.js +0 -9
  252. package/dist/esm/plugins/base/pm-plugins/filter-steps.js +1 -1
  253. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +98 -56
  254. package/dist/esm/plugins/base/utils/input-latency-tracking.js +24 -25
  255. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -0
  256. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +36 -9
  257. package/dist/esm/plugins/card/nodeviews/blockCard.js +2 -1
  258. package/dist/esm/plugins/card/nodeviews/genericCard.js +16 -2
  259. package/dist/esm/plugins/card/pm-plugins/main.js +4 -2
  260. package/dist/esm/plugins/clipboard/pm-plugins/main.js +4 -1
  261. package/dist/esm/plugins/collab-edit/plugin.js +1 -2
  262. package/dist/esm/plugins/extension/toolbar.js +7 -1
  263. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +5 -1
  264. package/dist/esm/plugins/floating-toolbar/ui/Button.js +2 -0
  265. package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +5 -3
  266. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +38 -9
  267. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +23 -21
  268. package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +12 -7
  269. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +11 -0
  270. package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +1 -0
  271. package/dist/esm/plugins/hyperlink/analytics.js +1 -1
  272. package/dist/esm/plugins/hyperlink/index.js +1 -1
  273. package/dist/esm/plugins/hyperlink/pm-plugins/main.js +9 -5
  274. package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +10 -4
  275. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  276. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -2
  277. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -0
  278. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -0
  279. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +3 -0
  280. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -0
  281. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -0
  282. package/dist/esm/plugins/media/commands/helpers.js +9 -35
  283. package/dist/esm/plugins/media/commands/index.js +1 -1
  284. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -12
  285. package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -1
  286. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +311 -206
  287. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  288. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  289. package/dist/esm/plugins/media/pm-plugins/main.js +3 -28
  290. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -4
  291. package/dist/esm/plugins/panel/utils.js +4 -1
  292. package/dist/esm/plugins/paste/handlers.js +127 -13
  293. package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -5
  294. package/dist/esm/plugins/paste/pm-plugins/main.js +13 -4
  295. package/dist/esm/plugins/placeholder-text/index.js +2 -2
  296. package/dist/esm/plugins/status/index.js +9 -3
  297. package/dist/esm/plugins/status/ui/statusPicker.js +8 -2
  298. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +42 -8
  299. package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +23 -3
  300. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +4 -2
  301. package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +3 -1
  302. package/dist/esm/plugins/text-formatting/utils.js +0 -8
  303. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +19 -1
  304. package/dist/esm/plugins/type-ahead/index.js +1 -1
  305. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +79 -106
  306. package/dist/esm/types/get-editor-props.js +1 -0
  307. package/dist/esm/ui/ChromeCollapsed/index.js +1 -0
  308. package/dist/esm/ui/CollapsedEditor/index.js +7 -13
  309. package/dist/esm/ui/ColorPickerButton/index.js +69 -7
  310. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
  311. package/dist/esm/ui/ContextPanel/context.js +8 -8
  312. package/dist/esm/ui/Dropdown/index.js +7 -2
  313. package/dist/esm/ui/DropdownMenu/index.js +7 -2
  314. package/dist/esm/ui/ElementBrowser/components/CategoryList.js +1 -1
  315. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
  316. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +1 -1
  317. package/dist/esm/ui/PanelTextInput/index.js +4 -4
  318. package/dist/esm/ui/PortalProvider/index.js +1 -1
  319. package/dist/esm/ui/WidthEmitter/index.js +28 -37
  320. package/dist/esm/utils/document.js +15 -1
  321. package/dist/esm/utils/extensions.js +1 -3
  322. package/dist/esm/utils/get-editor-plugins.js +25 -0
  323. package/dist/esm/utils/linking-utils.js +1 -1
  324. package/dist/esm/utils/performance/components/RenderTracking.js +1 -1
  325. package/dist/esm/utils/performance/safer-transactions.js +1 -1
  326. package/dist/esm/utils/prepare-extension-provider.js +17 -0
  327. package/dist/esm/version-wrapper.js +1 -1
  328. package/dist/esm/version.json +1 -1
  329. package/dist/types/actions/index.d.ts +2 -2
  330. package/dist/types/create-editor/ReactEditorView.d.ts +7 -109
  331. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +112 -0
  332. package/dist/types/create-editor/ReactEditorViewNext.d.ts +9 -0
  333. package/dist/types/editor-next/editor-internal.d.ts +44 -0
  334. package/dist/types/editor-next/editor-migration-component.d.ts +5 -0
  335. package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +17 -0
  336. package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +13 -0
  337. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +21 -0
  338. package/dist/types/editor-next/index.d.ts +34 -0
  339. package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -0
  340. package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -0
  341. package/dist/types/editor-next/utils/editorPropTypes.d.ts +19 -0
  342. package/dist/types/editor-next/utils/getBaseFontSize.d.ts +6 -0
  343. package/dist/types/editor-next/utils/handleProviders.d.ts +14 -0
  344. package/dist/types/editor-next/utils/onEditorCreated.d.ts +12 -0
  345. package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +15 -0
  346. package/dist/types/editor-next/utils/trackEditorActions.d.ts +29 -0
  347. package/dist/types/editor.d.ts +47 -25
  348. package/dist/types/index.d.ts +1 -0
  349. package/dist/types/labs/next/internal/hooks/use-analytics/index.d.ts +1 -1
  350. package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +16 -0
  351. package/dist/types/labs/next/presets/preset.d.ts +6 -6
  352. package/dist/types/labs/next/presets/universal.d.ts +1 -1
  353. package/dist/types/plugins/alignment/index.d.ts +1 -1
  354. package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +3 -1
  355. package/dist/types/plugins/analytics/index.d.ts +3 -6
  356. package/dist/types/plugins/analytics/plugin.d.ts +3 -1
  357. package/dist/types/plugins/analytics/utils.d.ts +2 -3
  358. package/dist/types/plugins/annotation/index.d.ts +3 -1
  359. package/dist/types/plugins/avatar-group/index.d.ts +3 -1
  360. package/dist/types/plugins/base/index.d.ts +3 -1
  361. package/dist/types/plugins/base/pm-plugins/filter-steps.d.ts +1 -1
  362. package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +1 -3
  363. package/dist/types/plugins/before-primaryToolbar/index.d.ts +3 -1
  364. package/dist/types/plugins/block-type/index.d.ts +3 -1
  365. package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -0
  366. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
  367. package/dist/types/plugins/breakout/index.d.ts +3 -1
  368. package/dist/types/plugins/card/index.d.ts +3 -1
  369. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -1
  370. package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
  371. package/dist/types/plugins/card/types.d.ts +3 -0
  372. package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -1
  373. package/dist/types/plugins/code-block/index.d.ts +3 -1
  374. package/dist/types/plugins/collab-edit/index.d.ts +3 -1
  375. package/dist/types/plugins/context-panel/index.d.ts +1 -1
  376. package/dist/types/plugins/emoji/index.d.ts +3 -1
  377. package/dist/types/plugins/expand/index.d.ts +3 -1
  378. package/dist/types/plugins/extension/index.d.ts +3 -1
  379. package/dist/types/plugins/extension/toolbar.d.ts +5 -0
  380. package/dist/types/plugins/feature-flags-context/index.d.ts +3 -1
  381. package/dist/types/plugins/feedback-dialog/index.d.ts +3 -1
  382. package/dist/types/plugins/find-replace/index.d.ts +3 -1
  383. package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
  384. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +5 -2
  385. package/dist/types/plugins/grid/index.d.ts +3 -1
  386. package/dist/types/plugins/help-dialog/index.d.ts +3 -1
  387. package/dist/types/plugins/hyperlink/analytics.d.ts +1 -1
  388. package/dist/types/plugins/hyperlink/index.d.ts +3 -1
  389. package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +4 -2
  390. package/dist/types/plugins/hyperlink/types.d.ts +3 -1
  391. package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +3 -1
  392. package/dist/types/plugins/insert-block/index.d.ts +3 -1
  393. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
  394. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -0
  395. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
  396. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -0
  397. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +1 -0
  398. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -0
  399. package/dist/types/plugins/layout/index.d.ts +3 -1
  400. package/dist/types/plugins/list/index.d.ts +3 -1
  401. package/dist/types/plugins/max-content-size/index.d.ts +3 -1
  402. package/dist/types/plugins/media/commands/helpers.d.ts +5 -12
  403. package/dist/types/plugins/media/commands/index.d.ts +1 -1
  404. package/dist/types/plugins/media/index.d.ts +3 -1
  405. package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +3 -1
  406. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +4 -1
  407. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -4
  408. package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -4
  409. package/dist/types/plugins/mentions/index.d.ts +3 -1
  410. package/dist/types/plugins/panel/index.d.ts +3 -1
  411. package/dist/types/plugins/paste/handlers.d.ts +2 -1
  412. package/dist/types/plugins/paste/index.d.ts +3 -1
  413. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +4 -1
  414. package/dist/types/plugins/placeholder/index.d.ts +3 -1
  415. package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
  416. package/dist/types/plugins/quick-insert/index.d.ts +3 -1
  417. package/dist/types/plugins/save-on-enter/index.d.ts +3 -1
  418. package/dist/types/plugins/selection/index.d.ts +3 -1
  419. package/dist/types/plugins/status/index.d.ts +3 -1
  420. package/dist/types/plugins/status/ui/statusPicker.d.ts +3 -0
  421. package/dist/types/plugins/submit-editor/index.d.ts +3 -1
  422. package/dist/types/plugins/tasks-and-decisions/index.d.ts +3 -1
  423. package/dist/types/plugins/text-color/index.d.ts +3 -1
  424. package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
  425. package/dist/types/plugins/text-formatting/index.d.ts +3 -1
  426. package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +2 -1
  427. package/dist/types/plugins/text-formatting/utils.d.ts +0 -1
  428. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +3 -1
  429. package/dist/types/plugins/type-ahead/index.d.ts +3 -1
  430. package/dist/types/types/get-editor-props.d.ts +12 -0
  431. package/dist/types/types/performance-tracking.d.ts +10 -0
  432. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +29 -29
  433. package/dist/types/ui/CollapsedEditor/index.d.ts +4 -3
  434. package/dist/types/ui/ColorPickerButton/index.d.ts +2 -1
  435. package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
  436. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  437. package/dist/types/ui/ContextPanel/context.d.ts +2 -1
  438. package/dist/types/ui/PanelTextInput/index.d.ts +1 -1
  439. package/dist/types/ui/PortalProvider/index.d.ts +1 -1
  440. package/dist/types/utils/document.d.ts +4 -3
  441. package/dist/types/utils/get-editor-plugins.d.ts +10 -0
  442. package/dist/types/utils/linking-utils.d.ts +1 -1
  443. package/dist/types/utils/performance/components/RenderTracking.d.ts +1 -1
  444. package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -1
  445. package/dist/types/utils/performance/safer-transactions.d.ts +1 -1
  446. package/dist/types/utils/prepare-extension-provider.d.ts +5 -0
  447. package/docs/0-intro.tsx +0 -1
  448. package/package.json +27 -26
  449. package/report.api.md +193 -139
  450. package/dist/cjs/plugins/analytics/analytics-queue.js +0 -79
  451. package/dist/cjs/plugins/analytics/fire-analytics-event.js +0 -35
  452. package/dist/es2019/plugins/analytics/analytics-queue.js +0 -53
  453. package/dist/es2019/plugins/analytics/fire-analytics-event.js +0 -26
  454. package/dist/esm/plugins/analytics/analytics-queue.js +0 -71
  455. package/dist/esm/plugins/analytics/fire-analytics-event.js +0 -28
  456. package/dist/types/plugins/analytics/analytics-queue.d.ts +0 -10
  457. package/dist/types/plugins/analytics/fire-analytics-event.d.ts +0 -9
@@ -210,5 +210,5 @@ const decorateWithPluginOptions = (plugin, options) => {
210
210
  };
211
211
  return plugin;
212
212
  };
213
- const placeholderTextPlugin = options => decorateWithPluginOptions(basePlaceholderTextPlugin(options), options);
213
+ const placeholderTextPlugin = (options, api) => decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
214
214
  export default placeholderTextPlugin;
@@ -28,7 +28,10 @@ const baseStatusPlugin = options => ({
28
28
  }];
29
29
  },
30
30
  contentComponent({
31
- editorView
31
+ editorView,
32
+ popupsMountPoint,
33
+ popupsBoundariesElement,
34
+ popupsScrollableElement
32
35
  }) {
33
36
  const domAtPos = editorView.domAtPos.bind(editorView);
34
37
  return /*#__PURE__*/React.createElement(WithPluginState, {
@@ -60,6 +63,9 @@ const baseStatusPlugin = options => ({
60
63
  defaultText: text,
61
64
  defaultColor: color,
62
65
  defaultLocalId: localId,
66
+ mountTo: popupsMountPoint,
67
+ boundariesElement: popupsBoundariesElement,
68
+ scrollableElement: popupsScrollableElement,
63
69
  onSelect: status => {
64
70
  updateStatus(status)(editorView.state, editorView.dispatch);
65
71
  },
@@ -106,5 +112,5 @@ const decorateWithPluginOptions = (plugin, options) => {
106
112
  };
107
113
  return plugin;
108
114
  };
109
- const statusPlugin = options => decorateWithPluginOptions(baseStatusPlugin(options), options);
115
+ const statusPlugin = (options, api) => decorateWithPluginOptions(baseStatusPlugin(options, api), options);
110
116
  export default statusPlugin;
@@ -182,7 +182,10 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
182
182
  render() {
183
183
  const {
184
184
  isNew,
185
- target
185
+ target,
186
+ mountTo,
187
+ boundariesElement,
188
+ scrollableElement
186
189
  } = this.props;
187
190
  const {
188
191
  color,
@@ -194,7 +197,10 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
194
197
  handleClickOutside: this.handleClickOutside,
195
198
  handleEscapeKeydown: this.handleEscapeKeydown,
196
199
  zIndex: akEditorFloatingDialogZIndex,
197
- fitHeight: 40
200
+ fitHeight: 40,
201
+ mountTo: mountTo,
202
+ boundariesElement: boundariesElement,
203
+ scrollableElement: scrollableElement
198
204
  }, jsx("div", {
199
205
  css: pickerContainer,
200
206
  onClick: this.handlePopupClick
@@ -3,6 +3,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import { defineMessages, injectIntl } from 'react-intl-next';
6
+ import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
7
+ import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
8
+ import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
6
9
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
7
10
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
8
11
  import ColorPalette from '../../../../ui/ColorPalette';
@@ -27,7 +30,8 @@ export class ToolbarTextColor extends React.Component {
27
30
  constructor(...args) {
28
31
  super(...args);
29
32
  _defineProperty(this, "state", {
30
- isOpen: false
33
+ isOpen: false,
34
+ isOpenedByKeyboard: false
31
35
  });
32
36
  _defineProperty(this, "toolbarItemRef", /*#__PURE__*/React.createRef());
33
37
  _defineProperty(this, "changeColor", color => commands.changeColor(color)(this.props.editorView.state, this.props.editorView.dispatch));
@@ -39,6 +43,7 @@ export class ToolbarTextColor extends React.Component {
39
43
  });
40
44
  });
41
45
  _defineProperty(this, "changeTextColor", (color, disabled) => {
46
+ var _this$toolbarItemRef, _this$toolbarItemRef$;
42
47
  if (!disabled) {
43
48
  var _this$props$editorVie;
44
49
  const {
@@ -60,6 +65,7 @@ export class ToolbarTextColor extends React.Component {
60
65
  //To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
61
66
  (_this$props$editorVie = this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
62
67
  }
68
+ (_this$toolbarItemRef = this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 ? void 0 : (_this$toolbarItemRef$ = _this$toolbarItemRef.current) === null || _this$toolbarItemRef$ === void 0 ? void 0 : _this$toolbarItemRef$.focus();
63
69
  return false;
64
70
  });
65
71
  _defineProperty(this, "toggleOpen", () => {
@@ -68,6 +74,15 @@ export class ToolbarTextColor extends React.Component {
68
74
  logCloseEvent: true
69
75
  });
70
76
  });
77
+ _defineProperty(this, "onKeyDown", event => {
78
+ if (event.key === 'Enter' || event.key === ' ') {
79
+ event.preventDefault();
80
+ this.setState({
81
+ isOpenedByKeyboard: true
82
+ });
83
+ this.toggleOpen();
84
+ }
85
+ });
71
86
  _defineProperty(this, "handleOpenChange", ({
72
87
  isOpen,
73
88
  logCloseEvent,
@@ -76,14 +91,19 @@ export class ToolbarTextColor extends React.Component {
76
91
  this.setState({
77
92
  isOpen
78
93
  });
94
+ if (!isOpen) {
95
+ this.setState({
96
+ isOpenedByKeyboard: false
97
+ });
98
+ }
79
99
  if (logCloseEvent) {
80
100
  this.dispatchAnalyticsEvent(this.buildAnalyticsPalette(isOpen ? ACTION.OPENED : ACTION.CLOSED, {
81
101
  noSelect: isOpen === false
82
102
  }));
83
103
  }
84
104
  if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
85
- var _this$toolbarItemRef, _this$toolbarItemRef$;
86
- (_this$toolbarItemRef = this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 ? void 0 : (_this$toolbarItemRef$ = _this$toolbarItemRef.current) === null || _this$toolbarItemRef$ === void 0 ? void 0 : _this$toolbarItemRef$.focus();
105
+ var _this$toolbarItemRef2, _this$toolbarItemRef3;
106
+ (_this$toolbarItemRef2 = this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 ? void 0 : (_this$toolbarItemRef3 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef3 === void 0 ? void 0 : _this$toolbarItemRef3.focus();
87
107
  }
88
108
  });
89
109
  _defineProperty(this, "hide", e => {
@@ -98,20 +118,21 @@ export class ToolbarTextColor extends React.Component {
98
118
  isOpen: false
99
119
  });
100
120
  if (e instanceof KeyboardEvent && e.key === 'Escape') {
101
- var _this$toolbarItemRef2, _this$toolbarItemRef3;
102
- (_this$toolbarItemRef2 = this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 ? void 0 : (_this$toolbarItemRef3 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef3 === void 0 ? void 0 : _this$toolbarItemRef3.focus();
121
+ var _this$toolbarItemRef4, _this$toolbarItemRef5;
122
+ (_this$toolbarItemRef4 = this.toolbarItemRef) === null || _this$toolbarItemRef4 === void 0 ? void 0 : (_this$toolbarItemRef5 = _this$toolbarItemRef4.current) === null || _this$toolbarItemRef5 === void 0 ? void 0 : _this$toolbarItemRef5.focus();
103
123
  }
104
124
  }
105
125
  });
106
126
  _defineProperty(this, "hideonEsc", e => {
107
- var _this$toolbarItemRef4, _this$toolbarItemRef5;
127
+ var _this$toolbarItemRef6, _this$toolbarItemRef7;
108
128
  this.hide(e);
109
- (_this$toolbarItemRef4 = this.toolbarItemRef) === null || _this$toolbarItemRef4 === void 0 ? void 0 : (_this$toolbarItemRef5 = _this$toolbarItemRef4.current) === null || _this$toolbarItemRef5 === void 0 ? void 0 : _this$toolbarItemRef5.focus();
129
+ (_this$toolbarItemRef6 = this.toolbarItemRef) === null || _this$toolbarItemRef6 === void 0 ? void 0 : (_this$toolbarItemRef7 = _this$toolbarItemRef6.current) === null || _this$toolbarItemRef7 === void 0 ? void 0 : _this$toolbarItemRef7.focus();
110
130
  });
111
131
  }
112
132
  render() {
113
133
  const {
114
- isOpen
134
+ isOpen,
135
+ isOpenedByKeyboard
115
136
  } = this.state;
116
137
  const {
117
138
  popupsMountPoint,
@@ -138,6 +159,10 @@ export class ToolbarTextColor extends React.Component {
138
159
  fitWidth = 242;
139
160
  }
140
161
  const selectedColor = pluginState.color !== pluginState.defaultColor && pluginState.color;
162
+ const {
163
+ selectedRowIndex,
164
+ selectedColumnIndex
165
+ } = getSelectedRowAndColumnFromPalette(palette, pluginState.color);
141
166
  return jsx("span", {
142
167
  css: wrapperStyle
143
168
  }, jsx(Dropdown, {
@@ -151,6 +176,13 @@ export class ToolbarTextColor extends React.Component {
151
176
  fitWidth: fitWidth,
152
177
  onOpenChange: this.onOpenChange,
153
178
  closeOnTab: true,
179
+ arrowKeyNavigationProviderOptions: {
180
+ type: ArrowKeyNavigationType.COLOR,
181
+ selectedRowIndex,
182
+ selectedColumnIndex,
183
+ isOpenedByKeyboard,
184
+ isPopupPositioned: true
185
+ },
154
186
  trigger: jsx(ToolbarButton, {
155
187
  buttonId: TOOLBAR_BUTTON.TEXT_COLOR,
156
188
  spacing: isReducedSpacing ? 'none' : 'default',
@@ -161,6 +193,7 @@ export class ToolbarTextColor extends React.Component {
161
193
  "aria-haspopup": true,
162
194
  title: labelTextColor,
163
195
  onClick: this.toggleOpen,
196
+ onKeyDown: this.onKeyDown,
164
197
  ref: this.toolbarItemRef,
165
198
  iconBefore: jsx("div", {
166
199
  css: triggerWrapperStyles
@@ -181,6 +214,7 @@ export class ToolbarTextColor extends React.Component {
181
214
  onClick: color => this.changeTextColor(color, pluginState.disabled),
182
215
  selectedColor: pluginState.color,
183
216
  textPalette: true,
217
+ hexToPaletteColor: hexToEditorTextPaletteColor,
184
218
  useSomewhatSemanticTextColorNames: useSomewhatSemanticTextColorNames
185
219
  }))), jsx("span", {
186
220
  css: separatorStyles
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useMemo } from 'react';
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
3
3
  import DropdownMenu from '../../../../ui/DropdownMenu';
4
4
  import { useMenuState } from './hooks/menu-state';
@@ -14,6 +14,7 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
14
14
  popupsScrollableElement
15
15
  }) => {
16
16
  const [isMenuOpen, toggleMenu, closeMenu] = useMenuState();
17
+ const [isOpenedByKeyboard, setIsOpenedByKeyboard] = useState(false);
17
18
  const group = useMemo(() => [{
18
19
  items
19
20
  }], [items]);
@@ -37,13 +38,29 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
37
38
  zIndex: akEditorMenuZIndex,
38
39
  fitHeight: 188,
39
40
  fitWidth: 136,
40
- shouldUseDefaultRole: true
41
+ shouldUseDefaultRole: true,
42
+ shouldFocusFirstItem: () => {
43
+ if (isOpenedByKeyboard) {
44
+ setIsOpenedByKeyboard(false);
45
+ }
46
+ return isOpenedByKeyboard;
47
+ }
41
48
  }, /*#__PURE__*/React.createElement(MoreButton, {
42
49
  isSelected: isMenuOpen || hasFormattingActive,
43
50
  label: moreButtonLabel,
44
51
  isReducedSpacing: isReducedSpacing,
45
52
  isDisabled: false,
46
- onClick: toggleMenu,
53
+ onClick: () => {
54
+ toggleMenu();
55
+ setIsOpenedByKeyboard(false);
56
+ },
57
+ onKeyDown: event => {
58
+ if (event.key === 'Enter' || event.key === ' ') {
59
+ event.preventDefault();
60
+ toggleMenu();
61
+ setIsOpenedByKeyboard(true);
62
+ }
63
+ },
47
64
  "aria-expanded": isMenuOpen
48
65
  }));
49
66
  });
@@ -10,8 +10,9 @@ import { SingleToolbarButtons } from './single-toolbar-buttons';
10
10
  import { MoreButton } from './more-button';
11
11
  import { FormattingTextDropdownMenu } from './dropdown-menu';
12
12
  import { toolbarMessages } from './toolbar-messages';
13
- import { usePreviousObjectState, compareItemsArrays, isArrayContainsContent } from '../../utils';
13
+ import { compareItemsArrays, isArrayContainsContent } from '../../utils';
14
14
  import Announcer from '../../../../utils/announcer/announcer';
15
+ import { usePreviousState } from '@atlaskit/editor-common/hooks';
15
16
  const ToolbarFormatting = ({
16
17
  shouldUseResponsiveToolbar,
17
18
  popupsMountPoint,
@@ -23,6 +24,7 @@ const ToolbarFormatting = ({
23
24
  isToolbarDisabled,
24
25
  intl
25
26
  }) => {
27
+ var _usePreviousState;
26
28
  const editorState = useMemo(() => editorView.state, [editorView.state]);
27
29
  const [message, setMessage] = useState('');
28
30
  const defaultIcons = useFormattingIcons({
@@ -54,7 +56,7 @@ const ToolbarFormatting = ({
54
56
  const superscriptOffSubscriptOnStatus = intl.formatMessage(toolbarMessages.superscriptOffSubscriptOn);
55
57
  const subscriptOffSuperscriptOnStatus = intl.formatMessage(toolbarMessages.subscriptOffSuperscriptOn);
56
58
  const activeItems = [...dropdownItems, ...singleItems].filter(item => item.isActive);
57
- const prevActiveItems = usePreviousObjectState(activeItems);
59
+ const prevActiveItems = (_usePreviousState = usePreviousState(activeItems)) !== null && _usePreviousState !== void 0 ? _usePreviousState : [];
58
60
  const fromSuperscriptToSubscript = isArrayContainsContent(activeItems, 'Subscript') && isArrayContainsContent(prevActiveItems, 'Superscript');
59
61
  const fromSubscriptToSuperscript = isArrayContainsContent(activeItems, 'Superscript') && isArrayContainsContent(prevActiveItems, 'Subscript');
60
62
  let comparedItems;
@@ -10,12 +10,14 @@ export const MoreButton = /*#__PURE__*/React.memo(({
10
10
  isReducedSpacing,
11
11
  isSelected,
12
12
  isDisabled,
13
- onClick
13
+ onClick,
14
+ onKeyDown
14
15
  }) => {
15
16
  return jsx(ToolbarButton, {
16
17
  disabled: isDisabled,
17
18
  selected: isSelected,
18
19
  onClick: onClick,
20
+ onKeyDown: onKeyDown,
19
21
  spacing: isReducedSpacing ? 'none' : 'default',
20
22
  title: label,
21
23
  iconBefore: jsx("div", {
@@ -1,4 +1,3 @@
1
- import { useRef, useEffect } from 'react';
2
1
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
2
  import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
4
3
  export const nodeLen = node => {
@@ -116,13 +115,6 @@ const marksArePresent = state => {
116
115
  export const checkFormattingIsPresent = state => {
117
116
  return marksArePresent(state) || blockStylingIsPresent(state);
118
117
  };
119
- export const usePreviousObjectState = value => {
120
- const ref = useRef([]);
121
- useEffect(() => {
122
- ref.current = value;
123
- });
124
- return ref.current;
125
- };
126
118
  export const compareItemsArrays = (items, prevItems) => {
127
119
  return items && items.filter(item => !prevItems.includes(item));
128
120
  };
@@ -25,6 +25,7 @@ export function ToolbarDropdown(props) {
25
25
  onItemActivated
26
26
  } = props;
27
27
  const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
28
+ const [isOpenedByKeyboard, setOpenedByKeyboard] = React.useState(false);
28
29
  const labelLists = formatMessage(listMessages.lists);
29
30
  const onOpenChange = attrs => {
30
31
  setIsDropdownOpen(attrs.isDropdownOpen);
@@ -34,6 +35,13 @@ export function ToolbarDropdown(props) {
34
35
  isDropdownOpen: !isDropdownOpen
35
36
  });
36
37
  };
38
+ const handleOnKeyDown = event => {
39
+ if (event.key === 'Enter' || event.key === ' ') {
40
+ event.preventDefault();
41
+ setIsDropdownOpen(!isDropdownOpen);
42
+ setOpenedByKeyboard(true);
43
+ }
44
+ };
37
45
  const items = useItems(props);
38
46
  const handleOnItemActivated = ({
39
47
  item,
@@ -57,7 +65,13 @@ export function ToolbarDropdown(props) {
57
65
  onOpenChange: onOpenChange,
58
66
  fitHeight: 188,
59
67
  fitWidth: 175,
60
- shouldUseDefaultRole: true
68
+ shouldUseDefaultRole: true,
69
+ shouldFocusFirstItem: () => {
70
+ if (isOpenedByKeyboard) {
71
+ setOpenedByKeyboard(false);
72
+ }
73
+ return isOpenedByKeyboard;
74
+ }
61
75
  }, jsx(ToolbarButton, {
62
76
  spacing: isReducedSpacing ? 'none' : 'default',
63
77
  selected: bulletListActive || orderedListActive,
@@ -66,6 +80,7 @@ export function ToolbarDropdown(props) {
66
80
  "aria-label": labelLists,
67
81
  disabled: disabled,
68
82
  onClick: handleTriggerClick,
83
+ onKeyDown: handleOnKeyDown,
69
84
  title: labelLists,
70
85
  iconBefore: jsx("span", {
71
86
  css: wrapperStyle
@@ -19,7 +19,7 @@ import { getPluginState } from './utils';
19
19
  import { useItemInsert } from './ui/hooks/use-item-insert';
20
20
  import { updateSelectedIndex } from './commands/update-selected-index';
21
21
  import { StatsModifier } from './stats-modifier';
22
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '../analytics';
22
+ import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
23
23
  const TypeAheadMenu = /*#__PURE__*/React.memo(({
24
24
  editorView,
25
25
  popupMountRef,
@@ -10,7 +10,21 @@ 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
- import * as colors from '@atlaskit/theme/colors';
13
+ import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
14
+ const querySpan = css({
15
+ outline: 'none',
16
+ '& input': {
17
+ width: '5px',
18
+ border: 'none',
19
+ background: 'transparent',
20
+ padding: 0,
21
+ margin: 0,
22
+ // ED-17022 Fixes firefox caret position
23
+ fontSize: '1em',
24
+ height: blockNodesVerticalMargin,
25
+ caretColor: "var(--ds-text-accent-blue, #0052CC)"
26
+ }
27
+ });
14
28
  const isNavigationKey = event => {
15
29
  return ['Enter', 'Tab', 'ArrowDown', 'ArrowUp'].includes(event.key);
16
30
  };
@@ -27,10 +41,6 @@ const isUndoRedoShortcut = event => {
27
41
  }
28
42
  return false;
29
43
  };
30
- const isSelectAllShortcut = event => {
31
- const key = keyNameNormalized(event);
32
- return (event.ctrlKey || event.metaKey) && key === 'a';
33
- };
34
44
  const getAriaLabel = (triggerPrefix, intl) => {
35
45
  switch (triggerPrefix) {
36
46
  case '@':
@@ -57,20 +67,25 @@ export const InputQuery = /*#__PURE__*/React.memo(({
57
67
  editorView,
58
68
  items
59
69
  }) => {
60
- const ref = useRef(document.createElement('input'));
61
- const sizeSpanRef = useRef(document.createElement('span'));
62
- const [redoBuffer, setRedoBuffer] = useState([]);
63
- const [query, setQuery] = useState(reopenQuery);
64
- const onChange = useCallback(event => {
65
- const text = event.currentTarget.value;
66
- sizeSpanRef.current.textContent = text;
67
- setQuery(text);
70
+ const ref = useRef(document.createElement('span'));
71
+ const inputRef = useRef(null);
72
+ const [query, setQuery] = useState(null);
73
+ const cleanedInputContent = useCallback(() => {
74
+ var _ref$current;
75
+ const raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
76
+ return raw;
77
+ }, []);
78
+ const onKeyUp = useCallback(event => {
79
+ const text = cleanedInputContent();
68
80
  onQueryChange(text);
69
- }, [onQueryChange]);
81
+ }, [onQueryChange, cleanedInputContent]);
70
82
  const [isInFocus, setInFocus] = useState(false);
71
83
  const checkKeyEvent = useCallback(event => {
84
+ var _ref$current2;
72
85
  const key = keyNameNormalized(event);
73
- const text = ref.current.value;
86
+ const sel = document.getSelection();
87
+ const raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
88
+ const text = cleanedInputContent();
74
89
  let stopDefault = false;
75
90
  const {
76
91
  selectedIndex
@@ -102,7 +117,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
102
117
  stopDefault = true;
103
118
  break;
104
119
  case 'Backspace':
105
- if (text.length === 0 || ref.current.selectionStart === 0) {
120
+ if (raw.length === 0 || (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
106
121
  event.stopPropagation();
107
122
  event.preventDefault();
108
123
  cancel({
@@ -141,66 +156,24 @@ export const InputQuery = /*#__PURE__*/React.memo(({
141
156
  }
142
157
  break;
143
158
  }
144
- if (isSelectAllShortcut(event)) {
145
- cancel({
146
- forceFocusOnEditor: true,
147
- addPrefixTrigger: true,
148
- text: ref.current.value,
149
- setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED
150
- });
151
- return true;
152
- }
153
159
  const undoRedoType = isUndoRedoShortcut(event);
154
- const hasReopenQuery = reopenQuery && reopenQuery.length > 0;
155
- if (onUndoRedo && undoRedoType) {
156
- if (!hasReopenQuery && undoRedoType === 'historyUndo' && text.length > 0) {
157
- setRedoBuffer(buffer => [ref.current.value, ...buffer]);
158
- const undoValue = text.substring(0, text.length - 1);
159
- ref.current.value = undoValue;
160
- sizeSpanRef.current.textContent = undoValue;
161
- stopDefault = true;
162
- } else if (undoRedoType === 'historyRedo' && redoBuffer.length > 0) {
163
- const redoValue = redoBuffer[0];
164
- ref.current.value = redoValue;
165
- sizeSpanRef.current.textContent = redoValue;
166
- setRedoBuffer(buffer => buffer.slice(1));
167
- stopDefault = true;
168
- } else {
169
- stopDefault = onUndoRedo(undoRedoType);
170
- }
160
+ if (onUndoRedo && undoRedoType && onUndoRedo(undoRedoType)) {
161
+ stopDefault = true;
171
162
  }
172
163
  if (isNavigationKey(event) || stopDefault) {
173
164
  event.stopPropagation();
174
165
  event.preventDefault();
175
166
  return false;
176
167
  }
177
- }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, editorView.state, redoBuffer, reopenQuery]);
168
+ }, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
178
169
  const onClick = useCallback(event => {
179
- var _ref$current;
170
+ var _inputRef$current;
180
171
  event.stopPropagation();
181
172
  event.preventDefault();
182
173
  onQueryFocus();
183
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
174
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
184
175
  return false;
185
176
  }, [onQueryFocus]);
186
- const queryStyle = css({
187
- '&&': {
188
- outline: 'none',
189
- position: 'absolute',
190
- fontFamily: 'inherit',
191
- fontSize: 'inherit',
192
- fontWeight: 'inherit',
193
- letterSpacing: 'inherit',
194
- padding: 0,
195
- height: '100%',
196
- width: '100%',
197
- top: 0,
198
- left: 0,
199
- background: 'transparent',
200
- border: 'none',
201
- color: `${`var(--ds-link, ${colors.B400})`}`
202
- }
203
- });
204
177
  useLayoutEffect(() => {
205
178
  if (!ref.current) {
206
179
  return;
@@ -214,18 +187,18 @@ export const InputQuery = /*#__PURE__*/React.memo(({
214
187
  const keyDown = event => {
215
188
  const key = keyNameNormalized(event);
216
189
  if (['ArrowLeft', 'ArrowRight'].includes(key) && document.getSelection && document.getSelection()) {
217
- var _ref$current2, _ref$current3;
218
- const q = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.value) || '';
219
- const anchorOffset = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.selectionStart;
220
- const isMovingRight = 'ArrowRight' === key && anchorOffset === q.length;
221
- const isMovingLeft = 'ArrowLeft' === key && (anchorOffset === 0 || event.metaKey);
190
+ var _ref$current3;
191
+ const q = ((_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.textContent) || '';
192
+ const sel = document.getSelection();
193
+ const isMovingRight = sel && 'ArrowRight' === key && sel.anchorOffset === q.length;
194
+ const isMovingLeft = sel && 'ArrowLeft' === key && (sel.anchorOffset === 0 || event.metaKey);
222
195
  if (!isMovingRight && !isMovingLeft) {
223
196
  return;
224
197
  }
225
198
  cancel({
226
199
  forceFocusOnEditor: true,
227
200
  addPrefixTrigger: true,
228
- text: ref.current.value,
201
+ text: cleanedInputContent(),
229
202
  setSelectionAt: isMovingRight ? CloseSelectionOptions.AFTER_TEXT_INSERTED : CloseSelectionOptions.BEFORE_TEXT_INSERTED
230
203
  });
231
204
  event.preventDefault();
@@ -258,8 +231,8 @@ export const InputQuery = /*#__PURE__*/React.memo(({
258
231
  }
259
232
  cancel({
260
233
  addPrefixTrigger: true,
261
- text: ref.current.value,
262
- setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
234
+ text: cleanedInputContent(),
235
+ setSelectionAt: CloseSelectionOptions.BEFORE_TEXT_INSERTED,
263
236
  forceFocusOnEditor: false
264
237
  });
265
238
  };
@@ -277,7 +250,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
277
250
  const {
278
251
  target
279
252
  } = e;
280
- if (e.isComposing || !(target instanceof HTMLInputElement)) {
253
+ if (e.isComposing || !(target instanceof HTMLElement)) {
281
254
  return;
282
255
  }
283
256
  if (e.inputType === 'historyUndo' && ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.length) === 0) {
@@ -286,6 +259,23 @@ export const InputQuery = /*#__PURE__*/React.memo(({
286
259
  close();
287
260
  return;
288
261
  }
262
+ if (e.data != null && inputRef.current === null) {
263
+ setQuery('');
264
+
265
+ // We need to change the content on Safari
266
+ // and set the cursor at the right place
267
+ if (browser.safari) {
268
+ e.preventDefault();
269
+ const dataElement = document.createTextNode(e.data);
270
+ element.appendChild(dataElement);
271
+ const sel = window.getSelection();
272
+ const range = document.createRange();
273
+ range.setStart(dataElement, dataElement.length);
274
+ range.collapse(true);
275
+ sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
276
+ sel === null || sel === void 0 ? void 0 : sel.addRange(range);
277
+ }
278
+ }
289
279
  };
290
280
  let onInput = null;
291
281
  if (browser.safari) {
@@ -297,7 +287,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
297
287
  const {
298
288
  target
299
289
  } = e;
300
- if (e.isComposing || !(target instanceof HTMLInputElement)) {
290
+ if (e.isComposing || !(target instanceof HTMLElement)) {
301
291
  return;
302
292
  }
303
293
  if (e.inputType === 'historyUndo' && ((_target$textContent2 = target.textContent) === null || _target$textContent2 === void 0 ? void 0 : _target$textContent2.length) === 1) {
@@ -322,12 +312,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
322
312
  element.removeEventListener('input', onInput);
323
313
  }
324
314
  };
325
- }, [triggerQueryPrefix, ref.current.value, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
315
+ }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent, editorView.state]);
326
316
  useLayoutEffect(() => {
327
317
  const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
328
318
  if (ref.current && forceFocus) {
329
- ref.current.value = hasReopenQuery ? reopenQuery : '';
330
- sizeSpanRef.current.textContent = hasReopenQuery ? reopenQuery : '';
319
+ setQuery(hasReopenQuery ? reopenQuery : null);
331
320
  requestAnimationFrame(() => {
332
321
  if (!(ref !== null && ref !== void 0 && ref.current)) {
333
322
  return;
@@ -355,20 +344,10 @@ export const InputQuery = /*#__PURE__*/React.memo(({
355
344
  Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
356
345
  */
357
346
  return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
358
- style: {
359
- position: 'relative'
360
- }
361
- }, jsx("span", {
362
- ref: sizeSpanRef,
363
- "aria-hidden": true,
364
- style: {
365
- marginLeft: '1px',
366
- visibility: 'hidden'
367
- }
368
- }), jsx("input", {
369
- css: queryStyle,
347
+ css: querySpan,
348
+ contentEditable: true,
370
349
  ref: ref,
371
- onChange: onChange,
350
+ onKeyUp: onKeyUp,
372
351
  onClick: onClick,
373
352
  role: "combobox",
374
353
  "aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
@@ -376,9 +355,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
376
355
  "aria-expanded": items.length !== 0,
377
356
  "aria-labelledby": assistiveHintID,
378
357
  suppressContentEditableWarning: true,
379
- "data-query-prefix": triggerQueryPrefix,
380
- value: query
381
- })), jsx("span", {
358
+ "data-query-prefix": triggerQueryPrefix
359
+ }, query === null ? jsx("input", {
360
+ ref: inputRef,
361
+ type: "text"
362
+ }) : query), jsx("span", {
382
363
  id: assistiveHintID,
383
364
  style: {
384
365
  display: 'none'
@@ -0,0 +1 @@
1
+ export {};
@@ -30,6 +30,7 @@ class ChromeCollapsed extends PureComponent {
30
30
  render() {
31
31
  const placeholder = this.props.text || this.props.intl.formatMessage(messages.chromeCollapsedPlaceholder);
32
32
  return jsx("input", {
33
+ "data-testid": "chrome-collapsed",
33
34
  css: inputStyle,
34
35
  ref: this.handleInputRef,
35
36
  onFocus: this.focusHandler,