@atlaskit/editor-core 184.0.0 → 185.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/.eslintrc.js +7 -3
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
  4. package/dist/cjs/editor-next/index.js +41 -34
  5. package/dist/cjs/editor.js +30 -269
  6. package/dist/cjs/i18n/en_ZZ.js +32 -6
  7. package/dist/cjs/index.js +0 -7
  8. package/dist/cjs/labs/next/presets/default.js +2 -1
  9. package/dist/cjs/plugins/base/index.js +0 -12
  10. package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
  11. package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
  12. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
  13. package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
  14. package/dist/cjs/plugins/card/toolbar.js +11 -9
  15. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
  16. package/dist/cjs/plugins/code-block/index.js +7 -5
  17. package/dist/cjs/plugins/code-block/toolbar.js +5 -5
  18. package/dist/cjs/plugins/copy-button/commands.js +2 -3
  19. package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
  20. package/dist/cjs/plugins/expand/index.js +1 -1
  21. package/dist/cjs/plugins/expand/toolbar.js +40 -39
  22. package/dist/cjs/plugins/extension/index.js +1 -1
  23. package/dist/cjs/plugins/extension/toolbar.js +5 -5
  24. package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
  25. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  26. package/dist/cjs/plugins/layout/index.js +8 -4
  27. package/dist/cjs/plugins/layout/toolbar.js +5 -6
  28. package/dist/cjs/plugins/media/toolbar/index.js +31 -24
  29. package/dist/cjs/plugins/panel/index.js +2 -1
  30. package/dist/cjs/plugins/panel/toolbar.js +7 -7
  31. package/dist/cjs/plugins/placeholder-text/index.js +7 -5
  32. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  33. package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
  34. package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
  35. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
  36. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  37. package/dist/cjs/ui/styles.js +6 -0
  38. package/dist/cjs/version-wrapper.js +1 -1
  39. package/dist/cjs/version.json +1 -1
  40. package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
  41. package/dist/es2019/editor-next/index.js +39 -30
  42. package/dist/es2019/editor.js +29 -232
  43. package/dist/es2019/i18n/en_ZZ.js +32 -6
  44. package/dist/es2019/index.js +1 -2
  45. package/dist/es2019/labs/next/presets/default.js +2 -1
  46. package/dist/es2019/plugins/base/index.js +0 -7
  47. package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
  48. package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
  49. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
  50. package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
  51. package/dist/es2019/plugins/card/toolbar.js +8 -6
  52. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  53. package/dist/es2019/plugins/code-block/index.js +7 -5
  54. package/dist/es2019/plugins/code-block/toolbar.js +5 -6
  55. package/dist/es2019/plugins/copy-button/commands.js +2 -3
  56. package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
  57. package/dist/es2019/plugins/expand/index.js +1 -1
  58. package/dist/es2019/plugins/expand/toolbar.js +5 -6
  59. package/dist/es2019/plugins/extension/index.js +1 -1
  60. package/dist/es2019/plugins/extension/toolbar.js +5 -6
  61. package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
  62. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  63. package/dist/es2019/plugins/layout/index.js +8 -5
  64. package/dist/es2019/plugins/layout/toolbar.js +5 -6
  65. package/dist/es2019/plugins/media/toolbar/index.js +35 -24
  66. package/dist/es2019/plugins/panel/index.js +2 -2
  67. package/dist/es2019/plugins/panel/toolbar.js +7 -8
  68. package/dist/es2019/plugins/placeholder-text/index.js +7 -5
  69. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
  70. package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
  71. package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
  72. package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
  73. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  74. package/dist/es2019/ui/styles.js +6 -0
  75. package/dist/es2019/version-wrapper.js +1 -1
  76. package/dist/es2019/version.json +1 -1
  77. package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
  78. package/dist/esm/editor-next/index.js +42 -33
  79. package/dist/esm/editor.js +29 -270
  80. package/dist/esm/i18n/en_ZZ.js +32 -6
  81. package/dist/esm/index.js +1 -2
  82. package/dist/esm/labs/next/presets/default.js +2 -1
  83. package/dist/esm/plugins/base/index.js +0 -9
  84. package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
  85. package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
  86. package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
  87. package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
  88. package/dist/esm/plugins/card/toolbar.js +7 -6
  89. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  90. package/dist/esm/plugins/code-block/index.js +7 -5
  91. package/dist/esm/plugins/code-block/toolbar.js +5 -5
  92. package/dist/esm/plugins/copy-button/commands.js +2 -3
  93. package/dist/esm/plugins/copy-button/toolbar.js +7 -8
  94. package/dist/esm/plugins/expand/index.js +1 -1
  95. package/dist/esm/plugins/expand/toolbar.js +40 -39
  96. package/dist/esm/plugins/extension/index.js +1 -1
  97. package/dist/esm/plugins/extension/toolbar.js +5 -5
  98. package/dist/esm/plugins/floating-toolbar/index.js +3 -2
  99. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  100. package/dist/esm/plugins/layout/index.js +8 -4
  101. package/dist/esm/plugins/layout/toolbar.js +5 -6
  102. package/dist/esm/plugins/media/toolbar/index.js +31 -24
  103. package/dist/esm/plugins/panel/index.js +2 -1
  104. package/dist/esm/plugins/panel/toolbar.js +7 -7
  105. package/dist/esm/plugins/placeholder-text/index.js +7 -5
  106. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  107. package/dist/esm/ui/CollapsedEditor/index.js +1 -2
  108. package/dist/esm/ui/ColorPickerButton/index.js +2 -2
  109. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
  110. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  111. package/dist/esm/ui/styles.js +6 -0
  112. package/dist/esm/version-wrapper.js +1 -1
  113. package/dist/esm/version.json +1 -1
  114. package/dist/types/editor-next/index.d.ts +0 -6
  115. package/dist/types/editor.d.ts +1 -137
  116. package/dist/types/i18n/en_ZZ.d.ts +28 -2
  117. package/dist/types/index.d.ts +0 -1
  118. package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
  119. package/dist/types/labs/next/presets/default.d.ts +212 -0
  120. package/dist/types/labs/next/presets/mobile.d.ts +106 -0
  121. package/dist/types/plugins/base/index.d.ts +0 -4
  122. package/dist/types/plugins/card/index.d.ts +2 -2
  123. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
  124. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
  125. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  126. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
  127. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
  128. package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
  129. package/dist/types/plugins/card/toolbar.d.ts +1 -2
  130. package/dist/types/plugins/card/types.d.ts +1 -1
  131. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  132. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  133. package/dist/types/plugins/card/ui/types.d.ts +1 -1
  134. package/dist/types/plugins/code-block/index.d.ts +7 -1
  135. package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
  136. package/dist/types/plugins/copy-button/commands.d.ts +2 -1
  137. package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
  138. package/dist/types/plugins/expand/index.d.ts +2 -1
  139. package/dist/types/plugins/expand/toolbar.d.ts +2 -1
  140. package/dist/types/plugins/extension/index.d.ts +7 -2
  141. package/dist/types/plugins/extension/toolbar.d.ts +2 -1
  142. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
  143. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  144. package/dist/types/plugins/layout/index.d.ts +7 -1
  145. package/dist/types/plugins/layout/toolbar.d.ts +2 -1
  146. package/dist/types/plugins/media/index.d.ts +3 -1
  147. package/dist/types/plugins/panel/index.d.ts +2 -0
  148. package/dist/types/plugins/panel/toolbar.d.ts +3 -2
  149. package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
  150. package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
  151. package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
  152. package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
  153. package/dist/types-ts4.5/editor.d.ts +1 -137
  154. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
  155. package/dist/types-ts4.5/index.d.ts +0 -1
  156. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
  157. package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
  158. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
  159. package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
  160. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  161. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
  162. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
  163. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  164. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
  165. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
  166. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
  167. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
  168. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
  169. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  170. package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  171. package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
  172. package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
  173. package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
  174. package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
  175. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
  176. package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
  177. package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
  178. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  179. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
  180. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  181. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  182. package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
  183. package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
  184. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  185. package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
  186. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
  187. package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
  188. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
  189. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
  190. package/package.json +23 -18
  191. package/report.api.md +5 -93
  192. package/dist/cjs/editor-next/editor-migration-component.js +0 -54
  193. package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
  194. package/dist/es2019/editor-next/editor-migration-component.js +0 -30
  195. package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
  196. package/dist/esm/editor-next/editor-migration-component.js +0 -47
  197. package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
  198. package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
  199. package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
  200. package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
  201. package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
package/.eslintrc.js CHANGED
@@ -8,13 +8,13 @@ module.exports = {
8
8
  target: 'packages/editor/editor-core/src/**/*',
9
9
  from: `packages/editor/editor-core/src/plugins/*/!(types)*`,
10
10
  message:
11
- '[ELR101] Avoid importing dependencies from editor plugins. Move shared code to a common location. go/elr101',
11
+ '[ELR101] Avoid importing dependencies from editor plugins. Type-only imports are an exception. Move shared code to a common location. go/elr101',
12
12
  },
13
13
  {
14
14
  target: 'packages/editor/editor-core/src/**/*',
15
15
  from: `packages/editor/editor-core/src/plugins/*/!(types)**/*`,
16
16
  message:
17
- '[ELR101] Avoid importing dependencies from editor plugins. Move shared code to a common location. go/elr101',
17
+ '[ELR101] Avoid importing dependencies from editor plugins. Type-only imports are an exception. Move shared code to a common location. go/elr101',
18
18
  },
19
19
  ],
20
20
  },
@@ -23,7 +23,11 @@ module.exports = {
23
23
  },
24
24
  overrides: [
25
25
  {
26
- files: ['**/__tests__/**/*.{js,ts,tsx}', 'examples/**/*.{js,ts,tsx}'],
26
+ files: [
27
+ '**/__tests__/**/*.{js,ts,tsx}',
28
+ 'examples/**/*.{js,ts,tsx}',
29
+ '**/*.{test,spec}.{js,ts,tsx}',
30
+ ],
27
31
  rules: {
28
32
  'import/no-restricted-paths': ['off'],
29
33
  'react/no-danger': 'off',
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 185.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`741b3acd455`](https://bitbucket.org/atlassian/atlassian-frontend/commits/741b3acd455) - This major change includes:
8
+
9
+ - `EditorMigrationComponent` being renamed to `Editor`. This includes making component methods which should never be used private (which should never be used in normal operation and have been deprecated for several releases).
10
+ - `EditorMigrationComponent` is now removed
11
+ - Removing `useEditorNext` feature flag
12
+
13
+ This change was made as part of our strategy to move to a new architecture with `EditorMigrationComponent`, now that the component has served its purpose it is no longer required.
14
+
15
+ Any references to this component can be updated like so:
16
+
17
+ Before:
18
+
19
+ ```ts
20
+ import { EditorMigrationComponent } from '@atlaskit/editor-core';
21
+ ```
22
+
23
+ After:
24
+
25
+ ```ts
26
+ import { Editor } from '@atlaskit/editor-core';
27
+ ```
28
+
29
+ ### Minor Changes
30
+
31
+ - [`26d9c8cb4b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/26d9c8cb4b1) - Extract decorations plugin from editor-core to its own package.
32
+
33
+ ### Patch Changes
34
+
35
+ - [`4fe16193baa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4fe16193baa) - [ux] fix element browser adding component twice
36
+ - [`6f5276b3eb1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6f5276b3eb1) - ED-17921 updated placeholder text analytics event to use new analyticsAPI
37
+ - [`1df016865b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1df016865b3) - [ED-17443] Update escape key behaviour when typeahead is open
38
+ - [`65ff31a2ad4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/65ff31a2ad4) - use onError prop on smart card to handle errors
39
+ - Updated dependencies
40
+
41
+ ## 184.0.4
42
+
43
+ ### Patch Changes
44
+
45
+ - [`42486e5e512`](https://bitbucket.org/atlassian/atlassian-frontend/commits/42486e5e512) - Updated `ColorPickerButton`'s size prop type from number to string for width and height, allowing use of space tokens.
46
+
3
47
  ## 184.0.0
4
48
 
5
49
  ### Major Changes
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
32
32
  * which is used by both current and archv3 editors.
33
33
  */
34
34
  function createFeatureFlagsFromProps(props) {
35
- var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44, _props$featureFlags45, _props$featureFlags46, _props$featureFlags47;
35
+ var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44, _props$featureFlags45, _props$featureFlags46;
36
36
  var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
37
37
  var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
38
38
 
@@ -79,7 +79,6 @@ function createFeatureFlagsFromProps(props) {
79
79
  useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44.useSomewhatSemanticTextColorNames) : false)),
80
80
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
81
81
  preventPopupOverflow: Boolean(typeof ((_props$featureFlags45 = props.featureFlags) === null || _props$featureFlags45 === void 0 ? void 0 : _props$featureFlags45['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags46 = props.featureFlags) !== null && _props$featureFlags46 !== void 0 && _props$featureFlags46['prevent-popup-overflow']) : false),
82
- useEditorNext: normalizedFeatureFlags.useEditorNext === true || ((_props$featureFlags47 = props.featureFlags) === null || _props$featureFlags47 === void 0 ? void 0 : _props$featureFlags47.useEditorNext) === true,
83
82
  // duplicated logic from `create-plugins-list.ts` due to presets not being finalised
84
83
  useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
85
84
  });
@@ -13,13 +13,9 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _ui = require("@atlaskit/editor-common/ui");
16
- var _utils = require("@atlaskit/editor-common/utils");
17
16
  var _react = require("@emotion/react");
18
17
  var _propTypes = _interopRequireDefault(require("prop-types"));
19
18
  var _react2 = _interopRequireDefault(require("react"));
20
- var _versionWrapper = require("../version-wrapper");
21
- var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
22
- var _v = _interopRequireDefault(require("uuid/v4"));
23
19
  var _actions = _interopRequireDefault(require("../actions"));
24
20
  var _analytics = require("@atlaskit/editor-common/analytics");
25
21
  var _editorInternal = _interopRequireDefault(require("./editor-internal"));
@@ -32,10 +28,15 @@ var _plugins = require("../plugins");
32
28
  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; }
33
29
  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) { (0, _defineProperty2.default)(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; }
34
30
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
35
- 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; } } /** @jsx jsx */
31
+ 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; } } /** @jsx jsx */ // import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
32
+ // import { name, version } from '../version-wrapper';
33
+ // import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
34
+ // import uuid from 'uuid/v4';
36
35
  var EditorNext = /*#__PURE__*/function (_React$Component) {
37
36
  (0, _inherits2.default)(EditorNext, _React$Component);
38
37
  var _super = _createSuper(EditorNext);
38
+ // private editorSessionId: string;
39
+
39
40
  function EditorNext(props, context) {
40
41
  var _this;
41
42
  (0, _classCallCheck2.default)(this, EditorNext);
@@ -55,7 +56,7 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
55
56
  });
56
57
  (0, _deprecationWarnings.default)(props);
57
58
  _this.editorActions = (context || {}).editorActions || new _actions.default();
58
- _this.editorSessionId = (0, _v.default)();
59
+ // this.editorSessionId = uuid();
59
60
  _this.startTime = performance.now();
60
61
  _this.onEditorCreated = _this.onEditorCreated.bind((0, _assertThisInitialized2.default)(_this));
61
62
  _this.onEditorDestroyed = _this.onEditorDestroyed.bind((0, _assertThisInitialized2.default)(_this));
@@ -98,39 +99,45 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
98
99
  key: "render",
99
100
  value: function render() {
100
101
  var _this3 = this;
101
- return (0, _react.jsx)(_analyticsNamespacedContext.FabricEditorAnalyticsContext, {
102
- data: {
103
- packageName: _versionWrapper.name,
104
- packageVersion: _versionWrapper.version,
105
- componentName: 'editorCore',
106
- appearance: (0, _utils.getAnalyticsAppearance)(this.props.appearance),
107
- editorSessionId: this.editorSessionId
108
- }
109
- }, (0, _react.jsx)(_ui.WithCreateAnalyticsEvent, {
110
- render: function render(createAnalyticsEvent) {
111
- return (_this3.createAnalyticsEvent = createAnalyticsEvent) && (0, _react.jsx)(_editorInternal.default, {
112
- props: _this3.props,
113
- handleAnalyticsEvent: _this3.handleAnalyticsEvent,
114
- createAnalyticsEvent: _this3.createAnalyticsEvent,
115
- preset: _this3.props.preset,
116
- handleSave: _this3.handleSave,
117
- editorActions: _this3.editorActions,
118
- getExperienceStore: _this3.getExperienceStore,
119
- onEditorCreated: _this3.onEditorCreated,
120
- onEditorDestroyed: _this3.onEditorDestroyed
121
- });
122
- }
123
- }));
102
+ // TODO: https://product-fabric.atlassian.net/browse/ED-16979
103
+ // Move `FabricEditorAnalyticsContext` back into `EditorNext`
104
+ // This was moved out here to workaround the issue that the analytics
105
+ // context does not wrap the Preset (and therefore does not pass this context
106
+ // information to analytics calls within plugins). After this cleanup task ^ we will
107
+ // not have to generate the `createAnalyticsEvent` outside the Preset
108
+ // and we can move this back into `EditorNext`.
109
+ return (
110
+ // <FabricEditorAnalyticsContext
111
+ // data={{
112
+ // packageName: name,
113
+ // packageVersion: version,
114
+ // componentName: 'editorCore',
115
+ // appearance: getAnalyticsAppearance(this.props.appearance),
116
+ // editorSessionId: this.editorSessionId,
117
+ // }}
118
+ // >
119
+ (0, _react.jsx)(_ui.WithCreateAnalyticsEvent, {
120
+ render: function render(createAnalyticsEvent) {
121
+ return (_this3.createAnalyticsEvent = createAnalyticsEvent) && (0, _react.jsx)(_editorInternal.default, {
122
+ props: _this3.props,
123
+ handleAnalyticsEvent: _this3.handleAnalyticsEvent,
124
+ createAnalyticsEvent: _this3.createAnalyticsEvent,
125
+ preset: _this3.props.preset,
126
+ handleSave: _this3.handleSave,
127
+ editorActions: _this3.editorActions,
128
+ getExperienceStore: _this3.getExperienceStore,
129
+ onEditorCreated: _this3.onEditorCreated,
130
+ onEditorDestroyed: _this3.onEditorDestroyed
131
+ });
132
+ }
133
+ })
134
+ // </FabricEditorAnalyticsContext>
135
+ );
124
136
  }
125
137
  }]);
126
138
  return EditorNext;
127
139
  }(_react2.default.Component);
128
140
  exports.default = EditorNext;
129
- /**
130
- * WARNING: Code should be shared between Editor + EditorNext
131
- * If you are making changes that affect both, consider making them
132
- * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
133
- */
134
141
  (0, _defineProperty2.default)(EditorNext, "defaultProps", _editorPropTypes.defaultProps);
135
142
  (0, _defineProperty2.default)(EditorNext, "contextTypes", {
136
143
  editorActions: _propTypes.default.object
@@ -12,268 +12,50 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
12
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
16
  var _react = require("@emotion/react");
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
  var _react2 = _interopRequireDefault(require("react"));
18
- var _providerFactory = require("@atlaskit/editor-common/provider-factory");
19
- var _ui = require("@atlaskit/editor-common/ui");
20
- var _utils = require("@atlaskit/editor-common/utils");
21
- var _versionWrapper = require("./version-wrapper");
18
+ var _editorPropTypes = require("./editor-next/utils/editorPropTypes");
19
+ var _editorNext = _interopRequireDefault(require("./editor-next"));
20
+ var _useUniversalPreset = _interopRequireDefault(require("./labs/next/presets/useUniversalPreset"));
22
21
  var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
22
+ var _versionWrapper = require("./version-wrapper");
23
+ var _utils = require("@atlaskit/editor-common/utils");
23
24
  var _v = _interopRequireDefault(require("uuid/v4"));
24
- var _actions = _interopRequireDefault(require("./actions"));
25
- var _editorInternal = require("./editor-next/editor-internal");
26
- var _editorPropTypes = require("./editor-next/utils/editorPropTypes");
27
- var _trackEditorActions2 = _interopRequireDefault(require("./editor-next/utils/trackEditorActions"));
28
- var _onEditorCreated2 = _interopRequireDefault(require("./editor-next/utils/onEditorCreated"));
29
- var _deprecationWarnings = _interopRequireDefault(require("./editor-next/utils/deprecationWarnings"));
30
- var _featureFlagsFromProps = require("./create-editor/feature-flags-from-props");
31
- var _analytics = require("@atlaskit/editor-common/analytics");
32
- var _prepareQuickInsertProvider = _interopRequireDefault(require("./utils/prepare-quick-insert-provider"));
33
- var _prepareExtensionProvider = _interopRequireDefault(require("./utils/prepare-extension-provider"));
34
- var _handleProviders = _interopRequireDefault(require("./editor-next/utils/handleProviders"));
35
- var _getProvidersFromEditorProps = _interopRequireDefault(require("./editor-next/utils/getProvidersFromEditorProps"));
36
- var _measureEnum = _interopRequireDefault(require("./utils/performance/measure-enum"));
37
- var _editorMeasureTTICallback = _interopRequireDefault(require("./editor-next/utils/editorMeasureTTICallback"));
38
- var _sendDurationAnalytics = _interopRequireDefault(require("./editor-next/utils/sendDurationAnalytics"));
39
- var _createPluginsList = require("./create-editor/create-plugins-list");
40
- var _presetUtils = require("./create-editor/preset-utils");
41
25
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
42
26
  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; } } /** @jsx jsx */
27
+ var EditorNextWrapper = function EditorNextWrapper(_ref) {
28
+ var props = _ref.props;
29
+ var preset = (0, _useUniversalPreset.default)({
30
+ props: props
31
+ });
32
+ return (0, _react.jsx)(_editorNext.default, (0, _extends2.default)({
33
+ preset: preset
34
+ }, props));
35
+ };
43
36
  var Editor = /*#__PURE__*/function (_React$Component) {
44
37
  (0, _inherits2.default)(Editor, _React$Component);
45
38
  var _super = _createSuper(Editor);
46
- function Editor(props, context) {
47
- var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
39
+ function Editor() {
48
40
  var _this;
49
41
  (0, _classCallCheck2.default)(this, Editor);
50
- _this = _super.call(this, props);
51
- /**
52
- * @private
53
- * @deprecated - Do not override this at all, this is an antipattern.
54
- * Please reach out to the Editor team if you were previously using this
55
- * and need to find a workaround.
56
- */
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "prepareExtensionProvider", (0, _prepareExtensionProvider.default)(function () {
58
- return _this.editorActions;
59
- }));
60
- /**
61
- * @private
62
- * @deprecated - Do not override this at all, this is an antipattern.
63
- * Please reach out to the Editor team if you were previously using this
64
- * and need to find a workaround.
65
- */
66
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "prepareQuickInsertProvider", function (extensionProvider, quickInsert) {
67
- return (0, _prepareQuickInsertProvider.default)(_this.editorActions, extensionProvider, quickInsert, _this.createAnalyticsEvent);
68
- });
69
- /**
70
- * @private
71
- * @deprecated - Do not override this at all, this is an antipattern.
72
- * Please reach out to the Editor team if you were previously using this
73
- * and need to find a workaround.
74
- */
75
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSave", function (view) {
76
- var _this$props$onSave, _this$props;
77
- return (_this$props$onSave = (_this$props = _this.props).onSave) === null || _this$props$onSave === void 0 ? void 0 : _this$props$onSave.call(_this$props, view);
78
- });
79
- /**
80
- * @private
81
- * @deprecated - Do not override this at all, this is an antipattern.
82
- * Please reach out to the Editor team if you were previously using this
83
- * and need to find a workaround.
84
- */
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleAnalyticsEvent", function (data) {
86
- return (0, _analytics.fireAnalyticsEvent)(_this.createAnalyticsEvent)(data);
87
- });
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFeatureFlags", function () {
89
- return (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(_this.props);
90
- });
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getExperienceStore", function () {
92
- return _this.experienceStore;
93
- });
94
- _this.providerFactory = new _providerFactory.ProviderFactory();
95
- (0, _deprecationWarnings.default)(props);
96
- _this.editorActions = (context || {}).editorActions || new _actions.default();
97
- _this.editorSessionId = (0, _v.default)();
98
- _this.startTime = performance.now();
99
- _this.onEditorCreated = _this.onEditorCreated.bind((0, _assertThisInitialized2.default)(_this));
100
- _this.onEditorDestroyed = _this.onEditorDestroyed.bind((0, _assertThisInitialized2.default)(_this));
101
- _this.getExperienceStore = _this.getExperienceStore.bind((0, _assertThisInitialized2.default)(_this));
102
- _this.trackEditorActions(_this.editorActions, props);
103
-
104
- /**
105
- * Consider any changes here to corresponding file for `EditorNext` in
106
- * `useEditorConstructor` (editor-next/hooks/useEditorMeasuresConstructor.ts)
107
- */
108
- (0, _utils.startMeasure)(_measureEnum.default.EDITOR_MOUNTED);
109
- 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) {
110
- var _props$performanceTra3, _props$performanceTra4, _props$performanceTra5, _props$performanceTra6;
111
- (0, _utils.measureTTI)(function (tti, ttiFromInvocation, canceled) {
112
- (0, _editorMeasureTTICallback.default)(tti, ttiFromInvocation, canceled, _this.props.performanceTracking, _this.props.featureFlags, _this.createAnalyticsEvent, _this.experienceStore);
113
- }, (_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);
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
114
44
  }
115
-
116
- /**
117
- * Consider any changes here to corresponding file for `EditorNext` in
118
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
119
- */
120
- var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
121
- var quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
122
- var preset = (0, _createPluginsList.createPreset)(props, undefined, _this.createAnalyticsEvent);
123
- _this.state = {
124
- extensionProvider: _extensionProvider,
125
- quickInsertProvider: quickInsertProvider,
126
- preset: preset
127
- };
45
+ _this = _super.call.apply(_super, [this].concat(args));
46
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorSessionId", (0, _v.default)());
128
47
  return _this;
129
48
  }
130
-
131
- /**
132
- * Consider any changes here to corresponding file for `EditorNext` in
133
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
134
- * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
135
- */
136
49
  (0, _createClass2.default)(Editor, [{
137
- key: "componentDidMount",
138
- value: function componentDidMount() {
139
- (0, _utils.stopMeasure)(_measureEnum.default.EDITOR_MOUNTED, (0, _sendDurationAnalytics.default)(_analytics.ACTION.EDITOR_MOUNTED, this.props, this.getExperienceStore, this.createAnalyticsEvent));
140
- (0, _handleProviders.default)(this.providerFactory, (0, _getProvidersFromEditorProps.default)(this.props), this.state.extensionProvider, this.state.quickInsertProvider);
141
- }
142
-
143
- /**
144
- * Consider any changes here to corresponding file for `EditorNext` in
145
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
146
- */
147
- }, {
148
- key: "componentDidUpdate",
149
- value: function componentDidUpdate(prevProps) {
150
- var _this2 = this;
151
- var needsANewPreset = (0, _presetUtils.shouldRecreatePreset)(prevProps, this.props);
152
- var preset = needsANewPreset ? (0, _createPluginsList.createPreset)(this.props, prevProps, this.createAnalyticsEvent) : this.state.preset;
153
- var _this$props2 = this.props,
154
- extensionProviders = _this$props2.extensionProviders,
155
- quickInsert = _this$props2.quickInsert;
156
- if (extensionProviders && extensionProviders !== prevProps.extensionProviders ||
157
- // Though this will introduce some performance regression related to quick insert
158
- // loading but we can remove it soon when Forge will move to new API.
159
- // quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
160
- quickInsert && quickInsert !== prevProps.quickInsert) {
161
- var extensionProvider = this.prepareExtensionProvider(extensionProviders);
162
- var quickInsertProvider = this.prepareQuickInsertProvider(extensionProvider, quickInsert);
163
- this.setState({
164
- extensionProvider: extensionProvider,
165
- quickInsertProvider: quickInsertProvider,
166
- preset: preset
167
- }, function () {
168
- return (0, _handleProviders.default)(_this2.providerFactory, (0, _getProvidersFromEditorProps.default)(_this2.props), _this2.state.extensionProvider, _this2.state.quickInsertProvider);
169
- });
170
- return;
171
- }
172
- if (needsANewPreset) {
173
- this.setState({
174
- preset: preset
175
- });
176
- return;
177
- }
178
- (0, _handleProviders.default)(this.providerFactory, (0, _getProvidersFromEditorProps.default)(this.props), this.state.extensionProvider, this.state.quickInsertProvider);
179
- }
180
-
181
- /**
182
- * Consider any changes here to corresponding file for `EditorNext` in
183
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
184
- * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
185
- */
186
- }, {
187
- key: "componentWillUnmount",
188
- value: function componentWillUnmount() {
189
- var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props$featureFl;
190
- this.unregisterEditorFromActions();
191
- this.providerFactory.destroy();
192
- (0, _utils.clearMeasure)(_measureEnum.default.EDITOR_MOUNTED);
193
- ((_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) && (0, _utils.clearMeasure)(_measureEnum.default.ON_EDITOR_READY_CALLBACK);
194
- if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
195
- var _this$experienceStore;
196
- (_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.abortAll({
197
- reason: 'editor component unmounted'
198
- });
199
- }
200
- }
201
-
202
- /**
203
- * @private
204
- * @deprecated - Do not override this at all, this is an anti-pattern.
205
- * Please reach out to the Editor team if you were previously using this
206
- * and need to find a workaround.
207
- */
208
- }, {
209
- key: "trackEditorActions",
210
- value: function trackEditorActions(editorActions, props) {
211
- var _this3 = this;
212
- return (0, _trackEditorActions2.default)(editorActions, props.performanceTracking, function (value) {
213
- return _this3.handleAnalyticsEvent(value);
214
- });
215
- }
216
- }, {
217
- key: "onEditorCreated",
218
- value:
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
- */
225
- function onEditorCreated(instance) {
226
- var _this4 = this;
227
- (0, _onEditorCreated2.default)(instance, this.props, function (experienceStore) {
228
- return _this4.experienceStore = experienceStore;
229
- }, this.getExperienceStore, function () {
230
- return _this4.createAnalyticsEvent;
231
- }, this.editorActions, this.startTime, function (view, dispatcher, transformerForActions) {
232
- return _this4.registerEditorForActions(view, dispatcher, transformerForActions);
233
- });
234
- }
235
-
236
- /**
237
- * @private
238
- * @deprecated - Do not override this at all, this is an antipattern.
239
- * Please reach out to the Editor team if you were previously using this
240
- * and need to find a workaround.
241
- */
242
- }, {
243
- key: "onEditorDestroyed",
244
- value: function onEditorDestroyed(_instance) {
245
- var _this$props$onDestroy, _this$props4;
246
- this.unregisterEditorFromActions();
247
- (_this$props$onDestroy = (_this$props4 = this.props).onDestroy) === null || _this$props$onDestroy === void 0 ? void 0 : _this$props$onDestroy.call(_this$props4);
248
- }
249
- }, {
250
- key: "registerEditorForActions",
251
- value:
252
- /**
253
- * @private
254
- * @deprecated - Do not override this at all, this is an antipattern.
255
- * Please reach out to the Editor team if you were previously using this
256
- * and need to find a workaround.
257
- */
258
- function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
259
- this.editorActions._privateRegisterEditor(editorView, eventDispatcher, contentTransformer, this.getFeatureFlags);
260
- }
261
- }, {
262
- key: "unregisterEditorFromActions",
263
- value:
264
- /**
265
- * @private
266
- * @deprecated - Do not override this at all, this is an antipattern.
267
- * Please reach out to the Editor team if you were previously using this
268
- * and need to find a workaround.
269
- */
270
- function unregisterEditorFromActions() {
271
- this.editorActions._privateUnregisterEditor();
272
- }
273
- }, {
274
50
  key: "render",
275
51
  value: function render() {
276
- var _this5 = this;
52
+ // TODO: https://product-fabric.atlassian.net/browse/ED-16979
53
+ // Move `FabricEditorAnalyticsContext` back into `EditorNext`
54
+ // This was moved out here to workaround the issue that the analytics
55
+ // context does not wrap the Preset (and therefore does not pass this context
56
+ // information to analytics calls within plugins). After this cleanup task ^ we will
57
+ // not have to generate the `createAnalyticsEvent` outside the Preset
58
+ // and we can move this back into `EditorNext`.
277
59
  return (0, _react.jsx)(_analyticsNamespacedContext.FabricEditorAnalyticsContext, {
278
60
  data: {
279
61
  packageName: _versionWrapper.name,
@@ -282,33 +64,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
282
64
  appearance: (0, _utils.getAnalyticsAppearance)(this.props.appearance),
283
65
  editorSessionId: this.editorSessionId
284
66
  }
285
- }, (0, _react.jsx)(_ui.WithCreateAnalyticsEvent, {
286
- render: function render(createAnalyticsEvent) {
287
- return (_this5.createAnalyticsEvent = createAnalyticsEvent) && (0, _react.jsx)(_editorInternal.EditorInternalWithoutHooks, {
288
- props: _this5.props,
289
- handleAnalyticsEvent: _this5.handleAnalyticsEvent,
290
- createAnalyticsEvent: _this5.createAnalyticsEvent,
291
- preset: _this5.state.preset,
292
- handleSave: _this5.handleSave,
293
- editorActions: _this5.editorActions,
294
- providerFactory: _this5.providerFactory,
295
- onEditorCreated: _this5.onEditorCreated,
296
- onEditorDestroyed: _this5.onEditorDestroyed
297
- });
298
- }
67
+ }, (0, _react.jsx)(EditorNextWrapper, {
68
+ props: this.props
299
69
  }));
300
70
  }
301
71
  }]);
302
72
  return Editor;
303
73
  }(_react2.default.Component);
304
74
  exports.default = Editor;
305
- /**
306
- * WARNING: Code should be shared between Editor + EditorNext
307
- * If you are making changes that affect both, consider making them
308
- * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
309
- */
310
- (0, _defineProperty2.default)(Editor, "defaultProps", _editorPropTypes.defaultProps);
311
- (0, _defineProperty2.default)(Editor, "contextTypes", {
312
- editorActions: _propTypes.default.object
313
- });
314
- (0, _defineProperty2.default)(Editor, "propTypes", (0, _editorPropTypes.propTypes)('minHeight only supports editor appearance chromeless and comment for Editor'));
75
+ (0, _defineProperty2.default)(Editor, "defaultProps", _editorPropTypes.defaultProps);