@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
@@ -1,4 +1,3 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -6,118 +5,91 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
- var _templateObject;
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
- import _regeneratorRuntime from "@babel/runtime/regenerator";
14
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
9
  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; } }
16
10
  /** @jsx jsx */
17
- import React, { Fragment } from 'react';
18
- import { css, jsx } from '@emotion/react';
11
+ import { jsx } from '@emotion/react';
19
12
  import PropTypes from 'prop-types';
20
- import memoizeOne from 'memoize-one';
21
- import uuid from 'uuid/v4';
22
- import { name, version } from './version-wrapper';
23
- import { combineExtensionProviders } from '@atlaskit/editor-common/extensions';
13
+ import React from 'react';
24
14
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
25
- import { BaseTheme, WithCreateAnalyticsEvent, WidthProvider } from '@atlaskit/editor-common/ui';
26
- import { getAnalyticsAppearance, startMeasure, stopMeasure, clearMeasure, measureTTI, getTTISeverity } from '@atlaskit/editor-common/utils';
27
- import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
28
- import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
15
+ import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
16
+ import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
17
+ import { name, version } from './version-wrapper';
29
18
  import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
30
- import { getUiComponent } from './create-editor';
19
+ import uuid from 'uuid/v4';
31
20
  import EditorActions from './actions';
32
- import { ReactEditorView } from './create-editor';
33
- import EditorContext from './ui/EditorContext';
34
- import { PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalProvider';
35
- import { nextMajorVersion } from './version-wrapper';
36
- import { ContextAdapter } from './nodeviews/context-adapter';
37
- import measurements from './utils/performance/measure-enum';
21
+ import { EditorInternalWithoutHooks as EditorInternal } from './editor-next/editor-internal';
22
+ import { defaultProps, propTypes } from './editor-next/utils/editorPropTypes';
23
+ import _trackEditorActions from './editor-next/utils/trackEditorActions';
24
+ import _onEditorCreated from './editor-next/utils/onEditorCreated';
25
+ import deprecationWarnings from './editor-next/utils/deprecationWarnings';
26
+ import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
38
27
  import prepareQuickInsertProvider from './utils/prepare-quick-insert-provider';
39
- import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugins/analytics';
40
- import ErrorBoundary from './create-editor/ErrorBoundary';
41
- import { createFeatureFlagsFromProps } from './create-editor/feature-flags-from-props';
42
- import { RenderTracking } from './utils/performance/components/RenderTracking';
43
- var fullHeight = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n"])));
28
+ import prepareExtensionProvider from './utils/prepare-extension-provider';
29
+ import handleProviders from './editor-next/utils/handleProviders';
30
+ import { startMeasure, clearMeasure, stopMeasure, measureTTI } from '@atlaskit/editor-common/utils';
31
+ import measurements from './utils/performance/measure-enum';
32
+ import editorMeasureTTICallback from './editor-next/utils/editorMeasureTTICallback';
33
+ import { ACTION } from '@atlaskit/editor-common/analytics';
34
+ import sendDurationAnalytics from './editor-next/utils/sendDurationAnalytics';
35
+ import _getEditorPlugins from './utils/get-editor-plugins';
44
36
  var Editor = /*#__PURE__*/function (_React$Component) {
45
37
  _inherits(Editor, _React$Component);
46
38
  var _super = _createSuper(Editor);
39
+ /**
40
+ * WARNING: Code should be shared between Editor + EditorNext
41
+ * If you are making changes that affect both, consider making them
42
+ * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
43
+ */
44
+
47
45
  function Editor(props, context) {
48
46
  var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
49
47
  var _this;
50
48
  _classCallCheck(this, Editor);
51
49
  _this = _super.call(this, props);
52
- _defineProperty(_assertThisInitialized(_this), "prepareExtensionProvider", memoizeOne(function (extensionProviders) {
53
- if (!extensionProviders) {
54
- return;
55
- }
56
- if (typeof extensionProviders === 'function') {
57
- return combineExtensionProviders(extensionProviders(_this.editorActions));
58
- }
59
- return combineExtensionProviders(extensionProviders);
50
+ _defineProperty(_assertThisInitialized(_this), "prepareExtensionProvider", prepareExtensionProvider(function () {
51
+ return _this.editorActions;
60
52
  }));
61
53
  _defineProperty(_assertThisInitialized(_this), "prepareQuickInsertProvider", function (extensionProvider, quickInsert) {
62
54
  return prepareQuickInsertProvider(_this.editorActions, extensionProvider, quickInsert, _this.createAnalyticsEvent);
63
55
  });
64
56
  _defineProperty(_assertThisInitialized(_this), "handleSave", function (view) {
65
- if (!_this.props.onSave) {
66
- return;
67
- }
68
- return _this.props.onSave(view);
57
+ var _this$props$onSave, _this$props;
58
+ return (_this$props$onSave = (_this$props = _this.props).onSave) === null || _this$props$onSave === void 0 ? void 0 : _this$props$onSave.call(_this$props, view);
69
59
  });
70
60
  _defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (data) {
71
61
  return fireAnalyticsEvent(_this.createAnalyticsEvent)(data);
72
62
  });
63
+ _defineProperty(_assertThisInitialized(_this), "getExperienceStore", function () {
64
+ return _this.experienceStore;
65
+ });
73
66
  _this.providerFactory = new ProviderFactory();
74
- _this.deprecationWarnings(props);
75
- _this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
76
- _this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
67
+ deprecationWarnings(props);
77
68
  _this.editorActions = (context || {}).editorActions || new EditorActions();
78
- _this.trackEditorActions(_this.editorActions, props);
79
69
  _this.editorSessionId = uuid();
80
70
  _this.startTime = performance.now();
71
+ _this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
72
+ _this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
73
+ _this.getEditorPlugins = _this.getEditorPlugins.bind(_assertThisInitialized(_this));
74
+ _this.getExperienceStore = _this.getExperienceStore.bind(_assertThisInitialized(_this));
75
+ _this.trackEditorActions(_this.editorActions, props);
76
+
77
+ /**
78
+ * Consider any changes here to corresponding file for `EditorNext` in
79
+ * `useEditorConstructor` (editor-next/hooks/useEditorMeasuresConstructor.ts)
80
+ */
81
81
  startMeasure(measurements.EDITOR_MOUNTED);
82
82
  if ((_props$performanceTra = props.performanceTracking) !== null && _props$performanceTra !== void 0 && (_props$performanceTra2 = _props$performanceTra.ttiTracking) !== null && _props$performanceTra2 !== void 0 && _props$performanceTra2.enabled || (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
83
- var _props$performanceTra5, _props$performanceTra6, _props$performanceTra7, _props$performanceTra8;
83
+ var _props$performanceTra3, _props$performanceTra4, _props$performanceTra5, _props$performanceTra6;
84
84
  measureTTI(function (tti, ttiFromInvocation, canceled) {
85
- var _props$performanceTra3, _props$performanceTra4, _props$featureFlags2;
86
- if ((_props$performanceTra3 = props.performanceTracking) !== null && _props$performanceTra3 !== void 0 && (_props$performanceTra4 = _props$performanceTra3.ttiTracking) !== null && _props$performanceTra4 !== void 0 && _props$performanceTra4.enabled && _this.createAnalyticsEvent) {
87
- var _ttiTracking;
88
- var ttiEvent = {
89
- payload: {
90
- action: ACTION.EDITOR_TTI,
91
- actionSubject: ACTION_SUBJECT.EDITOR,
92
- attributes: {
93
- tti: tti,
94
- ttiFromInvocation: ttiFromInvocation,
95
- canceled: canceled
96
- },
97
- eventType: EVENT_TYPE.OPERATIONAL
98
- }
99
- };
100
- if ((_ttiTracking = props.performanceTracking.ttiTracking) !== null && _ttiTracking !== void 0 && _ttiTracking.trackSeverity) {
101
- var _ttiTracking2 = props.performanceTracking.ttiTracking,
102
- ttiSeverityNormalThreshold = _ttiTracking2.ttiSeverityNormalThreshold,
103
- ttiSeverityDegradedThreshold = _ttiTracking2.ttiSeverityDegradedThreshold,
104
- ttiFromInvocationSeverityNormalThreshold = _ttiTracking2.ttiFromInvocationSeverityNormalThreshold,
105
- ttiFromInvocationSeverityDegradedThreshold = _ttiTracking2.ttiFromInvocationSeverityDegradedThreshold;
106
- var _getTTISeverity = getTTISeverity(tti, ttiFromInvocation, ttiSeverityNormalThreshold, ttiSeverityDegradedThreshold, ttiFromInvocationSeverityNormalThreshold, ttiFromInvocationSeverityDegradedThreshold),
107
- ttiSeverity = _getTTISeverity.ttiSeverity,
108
- ttiFromInvocationSeverity = _getTTISeverity.ttiFromInvocationSeverity;
109
- ttiEvent.payload.attributes.ttiSeverity = ttiSeverity;
110
- ttiEvent.payload.attributes.ttiFromInvocationSeverity = ttiFromInvocationSeverity;
111
- }
112
- fireAnalyticsEvent(_this.createAnalyticsEvent)(ttiEvent);
113
- }
114
- if ((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.ufo) {
115
- var _this$experienceStore, _this$experienceStore2;
116
- (_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.mark(EditorExperience.loadEditor, ACTION.EDITOR_TTI, tti);
117
- (_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.success(EditorExperience.loadEditor);
118
- }
119
- }, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiIdleThreshold, (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.ttiTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.ttiCancelTimeout);
85
+ editorMeasureTTICallback(tti, ttiFromInvocation, canceled, _this.props.performanceTracking, _this.props.featureFlags, _this.createAnalyticsEvent, _this.experienceStore);
86
+ }, (_props$performanceTra3 = props.performanceTracking) === null || _props$performanceTra3 === void 0 ? void 0 : (_props$performanceTra4 = _props$performanceTra3.ttiTracking) === null || _props$performanceTra4 === void 0 ? void 0 : _props$performanceTra4.ttiIdleThreshold, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiCancelTimeout);
120
87
  }
88
+
89
+ /**
90
+ * Consider any changes here to corresponding file for `EditorNext` in
91
+ * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
92
+ */
121
93
  var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
122
94
  var quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
123
95
  _this.state = {
@@ -126,19 +98,30 @@ var Editor = /*#__PURE__*/function (_React$Component) {
126
98
  };
127
99
  return _this;
128
100
  }
101
+
102
+ /**
103
+ * Consider any changes here to corresponding file for `EditorNext` in
104
+ * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
105
+ * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
106
+ */
129
107
  _createClass(Editor, [{
130
108
  key: "componentDidMount",
131
109
  value: function componentDidMount() {
132
- stopMeasure(measurements.EDITOR_MOUNTED, this.sendDurationAnalytics(ACTION.EDITOR_MOUNTED));
133
- this.handleProviders(this.props);
110
+ stopMeasure(measurements.EDITOR_MOUNTED, sendDurationAnalytics(ACTION.EDITOR_MOUNTED, this.props, this.getExperienceStore, this.createAnalyticsEvent));
111
+ handleProviders(this.providerFactory, this.props, this.state.extensionProvider, this.state.quickInsertProvider);
134
112
  }
113
+
114
+ /**
115
+ * Consider any changes here to corresponding file for `EditorNext` in
116
+ * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
117
+ */
135
118
  }, {
136
119
  key: "componentDidUpdate",
137
120
  value: function componentDidUpdate(prevProps) {
138
121
  var _this2 = this;
139
- var _this$props = this.props,
140
- extensionProviders = _this$props.extensionProviders,
141
- quickInsert = _this$props.quickInsert;
122
+ var _this$props2 = this.props,
123
+ extensionProviders = _this$props2.extensionProviders,
124
+ quickInsert = _this$props2.quickInsert;
142
125
  if (extensionProviders && extensionProviders !== prevProps.extensionProviders ||
143
126
  // Though this will introduce some performance regression related to quick insert
144
127
  // loading but we can remove it soon when Forge will move to new API.
@@ -150,23 +133,29 @@ var Editor = /*#__PURE__*/function (_React$Component) {
150
133
  extensionProvider: extensionProvider,
151
134
  quickInsertProvider: quickInsertProvider
152
135
  }, function () {
153
- return _this2.handleProviders(_this2.props);
136
+ return handleProviders(_this2.providerFactory, _this2.props, _this2.state.extensionProvider, _this2.state.quickInsertProvider);
154
137
  });
155
138
  return;
156
139
  }
157
- this.handleProviders(this.props);
140
+ handleProviders(this.providerFactory, this.props, this.state.extensionProvider, this.state.quickInsertProvider);
158
141
  }
142
+
143
+ /**
144
+ * Consider any changes here to corresponding file for `EditorNext` in
145
+ * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
146
+ * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
147
+ */
159
148
  }, {
160
149
  key: "componentWillUnmount",
161
150
  value: function componentWillUnmount() {
162
- var _this$props2, _this$props2$performa, _this$props2$performa2, _this$props$featureFl;
151
+ var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props$featureFl;
163
152
  this.unregisterEditorFromActions();
164
153
  this.providerFactory.destroy();
165
154
  clearMeasure(measurements.EDITOR_MOUNTED);
166
- ((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$performa = _this$props2.performanceTracking) === null || _this$props2$performa === void 0 ? void 0 : (_this$props2$performa2 = _this$props2$performa.onEditorReadyCallbackTracking) === null || _this$props2$performa2 === void 0 ? void 0 : _this$props2$performa2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
155
+ ((_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$performa = _this$props3.performanceTracking) === null || _this$props3$performa === void 0 ? void 0 : (_this$props3$performa2 = _this$props3$performa.onEditorReadyCallbackTracking) === null || _this$props3$performa2 === void 0 ? void 0 : _this$props3$performa2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
167
156
  if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
168
- var _this$experienceStore3;
169
- (_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.abortAll({
157
+ var _this$experienceStore;
158
+ (_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.abortAll({
170
159
  reason: 'editor component unmounted'
171
160
  });
172
161
  }
@@ -181,88 +170,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
181
170
  }, {
182
171
  key: "trackEditorActions",
183
172
  value: function trackEditorActions(editorActions, props) {
184
- var _props$performanceTra9,
185
- _props$performanceTra10,
186
- _this3 = this;
187
- if (props !== null && props !== void 0 && (_props$performanceTra9 = props.performanceTracking) !== null && _props$performanceTra9 !== void 0 && (_props$performanceTra10 = _props$performanceTra9.contentRetrievalTracking) !== null && _props$performanceTra10 !== void 0 && _props$performanceTra10.enabled) {
188
- var DEFAULT_SAMPLING_RATE = 100;
189
- var getValue = editorActions.getValue.bind(editorActions);
190
- if (!editorActions._contentRetrievalTracking) {
191
- editorActions._contentRetrievalTracking = {
192
- samplingCounters: {
193
- success: 1,
194
- failure: 1
195
- },
196
- getValueTracked: false
197
- };
198
- }
199
- var _editorActions$_conte = editorActions._contentRetrievalTracking,
200
- samplingCounters = _editorActions$_conte.samplingCounters,
201
- getValueTracked = _editorActions$_conte.getValueTracked;
202
- if (!getValueTracked) {
203
- var getValueWithTracking = /*#__PURE__*/function () {
204
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
205
- var _props$performanceTra11, _props$performanceTra12, _props$performanceTra13, value, _props$performanceTra14, _props$performanceTra15, _props$performanceTra16, _props$performanceTra17, _props$performanceTra18;
206
- return _regeneratorRuntime.wrap(function _callee$(_context) {
207
- while (1) {
208
- switch (_context.prev = _context.next) {
209
- case 0:
210
- _context.prev = 0;
211
- _context.next = 3;
212
- return getValue();
213
- case 3:
214
- value = _context.sent;
215
- if (samplingCounters.success === ((_props$performanceTra11 = props === null || props === void 0 ? void 0 : (_props$performanceTra12 = props.performanceTracking) === null || _props$performanceTra12 === void 0 ? void 0 : (_props$performanceTra13 = _props$performanceTra12.contentRetrievalTracking) === null || _props$performanceTra13 === void 0 ? void 0 : _props$performanceTra13.successSamplingRate) !== null && _props$performanceTra11 !== void 0 ? _props$performanceTra11 : DEFAULT_SAMPLING_RATE)) {
216
- _this3.handleAnalyticsEvent({
217
- payload: {
218
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
219
- actionSubject: ACTION_SUBJECT.EDITOR,
220
- attributes: {
221
- success: true
222
- },
223
- eventType: EVENT_TYPE.OPERATIONAL
224
- }
225
- });
226
- samplingCounters.success = 0;
227
- }
228
- samplingCounters.success++;
229
- return _context.abrupt("return", value);
230
- case 9:
231
- _context.prev = 9;
232
- _context.t0 = _context["catch"](0);
233
- if (samplingCounters.failure === ((_props$performanceTra14 = props === null || props === void 0 ? void 0 : (_props$performanceTra15 = props.performanceTracking) === null || _props$performanceTra15 === void 0 ? void 0 : (_props$performanceTra16 = _props$performanceTra15.contentRetrievalTracking) === null || _props$performanceTra16 === void 0 ? void 0 : _props$performanceTra16.failureSamplingRate) !== null && _props$performanceTra14 !== void 0 ? _props$performanceTra14 : DEFAULT_SAMPLING_RATE)) {
234
- _this3.handleAnalyticsEvent({
235
- payload: {
236
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
237
- actionSubject: ACTION_SUBJECT.EDITOR,
238
- attributes: {
239
- success: false,
240
- errorInfo: _context.t0.toString(),
241
- errorStack: props !== null && props !== void 0 && (_props$performanceTra17 = props.performanceTracking) !== null && _props$performanceTra17 !== void 0 && (_props$performanceTra18 = _props$performanceTra17.contentRetrievalTracking) !== null && _props$performanceTra18 !== void 0 && _props$performanceTra18.reportErrorStack ? _context.t0.stack : undefined
242
- },
243
- eventType: EVENT_TYPE.OPERATIONAL
244
- }
245
- });
246
- samplingCounters.failure = 0;
247
- }
248
- samplingCounters.failure++;
249
- throw _context.t0;
250
- case 14:
251
- case "end":
252
- return _context.stop();
253
- }
254
- }
255
- }, _callee, null, [[0, 9]]);
256
- }));
257
- return function getValueWithTracking() {
258
- return _ref.apply(this, arguments);
259
- };
260
- }();
261
- editorActions.getValue = getValueWithTracking;
262
- editorActions._contentRetrievalTracking.getValueTracked = true;
263
- }
264
- }
265
- return editorActions;
173
+ var _this3 = this;
174
+ return _trackEditorActions(editorActions, props.performanceTracking, function (value) {
175
+ return _this3.handleAnalyticsEvent(value);
176
+ });
266
177
  }
267
178
 
268
179
  /**
@@ -281,108 +192,14 @@ var Editor = /*#__PURE__*/function (_React$Component) {
281
192
  * and need to find a workaround.
282
193
  */
283
194
  function onEditorCreated(instance) {
284
- var _this$props$featureFl2;
285
- this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
286
- if ((_this$props$featureFl2 = this.props.featureFlags) !== null && _this$props$featureFl2 !== void 0 && _this$props$featureFl2.ufo) {
287
- this.experienceStore = ExperienceStore.getInstance(instance.view);
288
- this.experienceStore.start(EditorExperience.loadEditor, this.startTime);
289
- }
290
- if (this.props.onEditorReady) {
291
- var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props$featureFl3;
292
- var measureEditorReady = ((_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$performa = _this$props3.performanceTracking) === null || _this$props3$performa === void 0 ? void 0 : (_this$props3$performa2 = _this$props3$performa.onEditorReadyCallbackTracking) === null || _this$props3$performa2 === void 0 ? void 0 : _this$props3$performa2.enabled) || ((_this$props$featureFl3 = this.props.featureFlags) === null || _this$props$featureFl3 === void 0 ? void 0 : _this$props$featureFl3.ufo);
293
- measureEditorReady && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
294
- this.props.onEditorReady(this.editorActions);
295
- measureEditorReady && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, this.sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK));
296
- }
297
- }
298
- }, {
299
- key: "sendDurationAnalytics",
300
- value: function sendDurationAnalytics(action) {
301
195
  var _this4 = this;
302
- return /*#__PURE__*/function () {
303
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(duration, startTime) {
304
- var _this4$props$featureF;
305
- var contextIdentifier, objectId, _this4$experienceStor, _this4$experienceStor2;
306
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
307
- while (1) {
308
- switch (_context2.prev = _context2.next) {
309
- case 0:
310
- _context2.next = 2;
311
- return _this4.props.contextIdentifierProvider;
312
- case 2:
313
- contextIdentifier = _context2.sent;
314
- objectId = contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId;
315
- if (_this4.createAnalyticsEvent) {
316
- fireAnalyticsEvent(_this4.createAnalyticsEvent)({
317
- payload: {
318
- action: action,
319
- actionSubject: ACTION_SUBJECT.EDITOR,
320
- attributes: {
321
- duration: duration,
322
- startTime: startTime,
323
- objectId: objectId
324
- },
325
- eventType: EVENT_TYPE.OPERATIONAL
326
- }
327
- });
328
- }
329
- if ((_this4$props$featureF = _this4.props.featureFlags) !== null && _this4$props$featureF !== void 0 && _this4$props$featureF.ufo) {
330
- (_this4$experienceStor = _this4.experienceStore) === null || _this4$experienceStor === void 0 ? void 0 : _this4$experienceStor.mark(EditorExperience.loadEditor, action, startTime + duration);
331
- (_this4$experienceStor2 = _this4.experienceStore) === null || _this4$experienceStor2 === void 0 ? void 0 : _this4$experienceStor2.addMetadata(EditorExperience.loadEditor, {
332
- objectId: objectId
333
- });
334
- }
335
- case 6:
336
- case "end":
337
- return _context2.stop();
338
- }
339
- }
340
- }, _callee2);
341
- }));
342
- return function (_x, _x2) {
343
- return _ref2.apply(this, arguments);
344
- };
345
- }();
346
- }
347
- }, {
348
- key: "deprecationWarnings",
349
- value: function deprecationWarnings(props) {
350
- var _props$allowTextColor;
351
- if (process.env.NODE_ENV === 'production') {
352
- return;
353
- }
354
- var nextVersion = nextMajorVersion();
355
- var deprecatedProperties = {
356
- allowTasksAndDecisions: {
357
- message: 'To allow tasks and decisions use taskDecisionProvider – <Editor taskDecisionProvider={{ provider }} />',
358
- type: 'removed'
359
- },
360
- allowConfluenceInlineComment: {
361
- message: 'To integrate inline comments use experimental annotationProvider – <Editor annotationProviders={{ provider }} />',
362
- type: 'removed'
363
- },
364
- smartLinks: {
365
- message: 'To use smartLinks, pass the same object into the smartlinks key of linking - <Editor linking={{ smartLinks: {existing object} }}.',
366
- type: 'removed'
367
- }
368
- };
369
- Object.keys(deprecatedProperties).forEach(function (property) {
370
- if (props.hasOwnProperty(property)) {
371
- var meta = deprecatedProperties[property];
372
- var type = meta.type || 'enabled by default';
373
-
374
- // eslint-disable-next-line no-console
375
- console.warn("".concat(property, " property is deprecated. ").concat(meta.message || '', " [Will be ").concat(type, " in editor-core@").concat(nextVersion, "]"));
376
- }
196
+ _onEditorCreated(instance, this.props, function (experienceStore) {
197
+ return _this4.experienceStore = experienceStore;
198
+ }, this.getExperienceStore, function () {
199
+ return _this4.createAnalyticsEvent;
200
+ }, this.editorActions, this.startTime, function (view, dispatcher, transformerForActions) {
201
+ return _this4.registerEditorForActions(view, dispatcher, transformerForActions);
377
202
  });
378
- if (props.hasOwnProperty('allowTables') && typeof props.allowTables !== 'boolean' && (!props.allowTables || !props.allowTables.advanced)) {
379
- // eslint-disable-next-line no-console
380
- console.warn("Advanced table options are deprecated (except isHeaderRowRequired) to continue using advanced table features use - <Editor allowTables={{ advanced: true }} /> [Will be changed in editor-core@".concat(nextVersion, "]"));
381
- }
382
- if (props.hasOwnProperty('allowTextColor') && typeof props.allowTextColor !== 'boolean' && (props === null || props === void 0 ? void 0 : (_props$allowTextColor = props.allowTextColor) === null || _props$allowTextColor === void 0 ? void 0 : _props$allowTextColor.allowMoreTextColors) !== undefined) {
383
- // eslint-disable-next-line no-console
384
- console.warn("\"allowMoreTextColors\" field of \"allowTextColor\" property is deprecated. It will be removedin editor-core@".concat(nextVersion, ". The color palette now shows more colors by default."));
385
- }
386
203
  }
387
204
 
388
205
  /**
@@ -394,74 +211,29 @@ var Editor = /*#__PURE__*/function (_React$Component) {
394
211
  }, {
395
212
  key: "onEditorDestroyed",
396
213
  value: function onEditorDestroyed(_instance) {
214
+ var _this$props$onDestroy, _this$props4;
397
215
  this.unregisterEditorFromActions();
398
- if (this.props.onDestroy) {
399
- this.props.onDestroy();
400
- }
216
+ (_this$props$onDestroy = (_this$props4 = this.props).onDestroy) === null || _this$props$onDestroy === void 0 ? void 0 : _this$props$onDestroy.call(_this$props4);
401
217
  }
218
+
219
+ /**
220
+ * @private
221
+ * @deprecated - Do not override this at all, this is an antipattern.
222
+ * Please reach out to the Editor team if you were previously using this
223
+ * and need to find a workaround.
224
+ */
402
225
  }, {
403
226
  key: "registerEditorForActions",
404
- value: function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
227
+ value:
228
+ /**
229
+ * @private
230
+ * @deprecated - Do not override this at all, this is an antipattern.
231
+ * Please reach out to the Editor team if you were previously using this
232
+ * and need to find a workaround.
233
+ */
234
+ function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
405
235
  this.editorActions._privateRegisterEditor(editorView, eventDispatcher, contentTransformer);
406
236
  }
407
- }, {
408
- key: "unregisterEditorFromActions",
409
- value: function unregisterEditorFromActions() {
410
- if (this.editorActions) {
411
- this.editorActions._privateUnregisterEditor();
412
- }
413
- }
414
- }, {
415
- key: "handleProviders",
416
- value: function handleProviders(props) {
417
- var _linking$smartLinks;
418
- var emojiProvider = props.emojiProvider,
419
- mentionProvider = props.mentionProvider,
420
- taskDecisionProvider = props.taskDecisionProvider,
421
- contextIdentifierProvider = props.contextIdentifierProvider,
422
- collabEditProvider = props.collabEditProvider,
423
- activityProvider = props.activityProvider,
424
- presenceProvider = props.presenceProvider,
425
- macroProvider = props.macroProvider,
426
- legacyImageUploadProvider = props.legacyImageUploadProvider,
427
- media = props.media,
428
- collabEdit = props.collabEdit,
429
- autoformattingProvider = props.autoformattingProvider,
430
- searchProvider = props.searchProvider,
431
- UNSAFE_cards = props.UNSAFE_cards,
432
- smartLinks = props.smartLinks,
433
- linking = props.linking;
434
- var _this$state = this.state,
435
- extensionProvider = _this$state.extensionProvider,
436
- quickInsertProvider = _this$state.quickInsertProvider;
437
- this.providerFactory.setProvider('emojiProvider', emojiProvider);
438
- this.providerFactory.setProvider('mentionProvider', mentionProvider);
439
- this.providerFactory.setProvider('taskDecisionProvider', taskDecisionProvider);
440
- this.providerFactory.setProvider('contextIdentifierProvider', contextIdentifierProvider);
441
- this.providerFactory.setProvider('mediaProvider', media && media.provider);
442
- this.providerFactory.setProvider('imageUploadProvider', legacyImageUploadProvider);
443
- this.providerFactory.setProvider('collabEditProvider', collabEdit && collabEdit.provider ? collabEdit.provider : collabEditProvider);
444
- this.providerFactory.setProvider('activityProvider', activityProvider);
445
- this.providerFactory.setProvider('searchProvider', searchProvider);
446
- this.providerFactory.setProvider('presenceProvider', presenceProvider);
447
- this.providerFactory.setProvider('macroProvider', macroProvider);
448
- var cardProvider = (linking === null || linking === void 0 ? void 0 : (_linking$smartLinks = linking.smartLinks) === null || _linking$smartLinks === void 0 ? void 0 : _linking$smartLinks.provider) || smartLinks && smartLinks.provider || UNSAFE_cards && UNSAFE_cards.provider;
449
- if (cardProvider) {
450
- this.providerFactory.setProvider('cardProvider', cardProvider);
451
- }
452
- this.providerFactory.setProvider('autoformattingProvider', autoformattingProvider);
453
- if (extensionProvider) {
454
- this.providerFactory.setProvider('extensionProvider', Promise.resolve(extensionProvider));
455
- }
456
- if (quickInsertProvider) {
457
- this.providerFactory.setProvider('quickInsertProvider', quickInsertProvider);
458
- }
459
- }
460
- }, {
461
- key: "getBaseFontSize",
462
- value: function getBaseFontSize() {
463
- return !['comment', 'chromeless', 'mobile'].includes(this.props.appearance) ? akEditorFullPageDefaultFontSize : undefined;
464
- }
465
237
 
466
238
  /**
467
239
  * @private
@@ -469,22 +241,15 @@ var Editor = /*#__PURE__*/function (_React$Component) {
469
241
  * Please reach out to the Editor team if you were previously using this
470
242
  * and need to find a workaround.
471
243
  */
244
+ }, {
245
+ key: "unregisterEditorFromActions",
246
+ value: function unregisterEditorFromActions() {
247
+ this.editorActions._privateUnregisterEditor();
248
+ }
472
249
  }, {
473
250
  key: "render",
474
251
  value: function render() {
475
- var _this$props$performan,
476
- _this$props$performan2,
477
- _this5 = this;
478
- var Component = getUiComponent(this.props.appearance);
479
- var overriddenEditorProps = _objectSpread(_objectSpread({}, this.props), {}, {
480
- onSave: this.props.onSave ? this.handleSave : undefined,
481
- // noop all analytic events, even if a handler is still passed.
482
- analyticsHandler: undefined
483
- });
484
- var featureFlags = createFeatureFlagsFromProps(this.props);
485
- var renderTracking = (_this$props$performan = this.props.performanceTracking) === null || _this$props$performan === void 0 ? void 0 : (_this$props$performan2 = _this$props$performan.renderTracking) === null || _this$props$performan2 === void 0 ? void 0 : _this$props$performan2.editor;
486
- var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
487
- var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
252
+ var _this5 = this;
488
253
  return jsx(FabricEditorAnalyticsContext, {
489
254
  data: {
490
255
  packageName: name,
@@ -495,106 +260,31 @@ var Editor = /*#__PURE__*/function (_React$Component) {
495
260
  }
496
261
  }, jsx(WithCreateAnalyticsEvent, {
497
262
  render: function render(createAnalyticsEvent) {
498
- return (_this5.createAnalyticsEvent = createAnalyticsEvent) && jsx(Fragment, null, renderTrackingEnabled && jsx(RenderTracking, {
499
- componentProps: _this5.props,
500
- action: ACTION.RE_RENDERED,
501
- actionSubject: ACTION_SUBJECT.EDITOR,
263
+ return (_this5.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
264
+ props: _this5.props,
502
265
  handleAnalyticsEvent: _this5.handleAnalyticsEvent,
503
- propsToIgnore: ['defaultValue'],
504
- useShallow: useShallow
505
- }), jsx(ErrorBoundary, {
506
- createAnalyticsEvent: createAnalyticsEvent,
507
- contextIdentifierProvider: _this5.props.contextIdentifierProvider
508
- }, jsx(WidthProvider, {
509
- css: fullHeight
510
- }, jsx(EditorContext, {
511
- editorActions: _this5.editorActions
512
- }, jsx(ContextAdapter, null, jsx(PortalProviderWithThemeProviders, {
513
- onAnalyticsEvent: _this5.handleAnalyticsEvent,
514
- useAnalyticsContext: _this5.props.UNSAFE_useAnalyticsContext,
515
- render: function render(portalProviderAPI) {
516
- return jsx(Fragment, null, jsx(ReactEditorView, {
517
- editorProps: overriddenEditorProps,
518
- createAnalyticsEvent: createAnalyticsEvent,
519
- portalProviderAPI: portalProviderAPI,
520
- providerFactory: _this5.providerFactory,
521
- onEditorCreated: _this5.onEditorCreated,
522
- onEditorDestroyed: _this5.onEditorDestroyed,
523
- allowAnalyticsGASV3: _this5.props.allowAnalyticsGASV3,
524
- disabled: _this5.props.disabled,
525
- render: function render(_ref3) {
526
- var _this5$props$featureF, _this5$props$featureF2;
527
- var editor = _ref3.editor,
528
- view = _ref3.view,
529
- eventDispatcher = _ref3.eventDispatcher,
530
- config = _ref3.config,
531
- dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
532
- editorRef = _ref3.editorRef;
533
- return jsx(BaseTheme, {
534
- baseFontSize: _this5.getBaseFontSize()
535
- }, jsx(Component, {
536
- innerRef: editorRef,
537
- appearance: _this5.props.appearance,
538
- disabled: _this5.props.disabled,
539
- editorActions: _this5.editorActions,
540
- editorDOMElement: editor,
541
- editorView: view,
542
- providerFactory: _this5.providerFactory,
543
- eventDispatcher: eventDispatcher,
544
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
545
- maxHeight: _this5.props.maxHeight,
546
- minHeight: _this5.props.minHeight,
547
- onSave: _this5.props.onSave ? _this5.handleSave : undefined,
548
- onCancel: _this5.props.onCancel,
549
- popupsMountPoint: _this5.props.popupsMountPoint,
550
- popupsBoundariesElement: _this5.props.popupsBoundariesElement,
551
- popupsScrollableElement: _this5.props.popupsScrollableElement,
552
- contentComponents: config.contentComponents,
553
- primaryToolbarComponents: config.primaryToolbarComponents,
554
- primaryToolbarIconBefore: _this5.props.primaryToolbarIconBefore,
555
- secondaryToolbarComponents: config.secondaryToolbarComponents,
556
- insertMenuItems: _this5.props.insertMenuItems,
557
- customContentComponents: _this5.props.contentComponents,
558
- customPrimaryToolbarComponents: _this5.props.primaryToolbarComponents,
559
- customSecondaryToolbarComponents: _this5.props.secondaryToolbarComponents,
560
- contextPanel: _this5.props.contextPanel,
561
- collabEdit: _this5.props.collabEdit,
562
- persistScrollGutter: _this5.props.persistScrollGutter,
563
- enableToolbarMinWidth: ((_this5$props$featureF = _this5.props.featureFlags) === null || _this5$props$featureF === void 0 ? void 0 : _this5$props$featureF.toolbarMinWidthOverflow) != null ? !!((_this5$props$featureF2 = _this5.props.featureFlags) !== null && _this5$props$featureF2 !== void 0 && _this5$props$featureF2.toolbarMinWidthOverflow) : _this5.props.allowUndoRedoButtons,
564
- useStickyToolbar: _this5.props.useStickyToolbar,
565
- featureFlags: featureFlags
566
- }));
567
- }
568
- }), jsx(PortalRenderer, {
569
- portalProviderAPI: portalProviderAPI
570
- }));
571
- }
572
- }))))));
266
+ createAnalyticsEvent: _this5.createAnalyticsEvent,
267
+ getEditorPlugins: _this5.getEditorPlugins,
268
+ handleSave: _this5.handleSave,
269
+ editorActions: _this5.editorActions,
270
+ providerFactory: _this5.providerFactory,
271
+ onEditorCreated: _this5.onEditorCreated,
272
+ onEditorDestroyed: _this5.onEditorDestroyed
273
+ });
573
274
  }
574
275
  }));
575
276
  }
277
+ }, {
278
+ key: "getEditorPlugins",
279
+ value: function getEditorPlugins(props) {
280
+ return _getEditorPlugins(props);
281
+ }
576
282
  }]);
577
283
  return Editor;
578
284
  }(React.Component);
579
- _defineProperty(Editor, "defaultProps", {
580
- appearance: 'comment',
581
- disabled: false,
582
- extensionHandlers: {},
583
- allowHelpDialog: true,
584
- allowNewInsertionBehaviour: true,
585
- quickInsert: true
586
- });
587
- _defineProperty(Editor, "propTypes", {
588
- minHeight: function minHeight(_ref4) {
589
- var appearance = _ref4.appearance,
590
- _minHeight = _ref4.minHeight;
591
- if (_minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
592
- return new Error('minHeight only supports editor appearance chromeless and comment');
593
- }
594
- return null;
595
- }
596
- });
285
+ _defineProperty(Editor, "defaultProps", defaultProps);
597
286
  _defineProperty(Editor, "contextTypes", {
598
287
  editorActions: PropTypes.object
599
288
  });
289
+ _defineProperty(Editor, "propTypes", propTypes('minHeight only supports editor appearance chromeless and comment for Editor'));
600
290
  export { Editor as default };