@atlaskit/editor-core 150.0.3 → 151.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 (195) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cjs/actions/index.js +5 -23
  3. package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
  4. package/dist/cjs/create-editor/ReactEditorView.js +145 -31
  5. package/dist/cjs/create-editor/create-plugins-list.js +4 -2
  6. package/dist/cjs/editor.js +101 -40
  7. package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
  8. package/dist/cjs/plugins/analytics/types/enums.js +3 -1
  9. package/dist/cjs/plugins/base/index.js +4 -3
  10. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
  11. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  12. package/dist/cjs/plugins/card/index.js +13 -2
  13. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
  14. package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
  15. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
  16. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  17. package/dist/cjs/plugins/emoji/styles.js +1 -1
  18. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  19. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  20. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
  21. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  22. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  23. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  24. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  25. package/dist/cjs/plugins/media/index.js +14 -3
  26. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  27. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  28. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  29. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  30. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  31. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  32. package/dist/cjs/plugins/panel/index.js +2 -3
  33. package/dist/cjs/plugins/panel/message.js +47 -0
  34. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  35. package/dist/cjs/plugins/panel/utils.js +2 -2
  36. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  37. package/dist/cjs/plugins/status/styles.js +1 -1
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  39. package/dist/cjs/profiler/render-count.js +82 -0
  40. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  41. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  42. package/dist/cjs/version-wrapper.js +1 -1
  43. package/dist/cjs/version.json +1 -1
  44. package/dist/es2019/actions/index.js +6 -28
  45. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  46. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  47. package/dist/es2019/create-editor/create-plugins-list.js +4 -2
  48. package/dist/es2019/editor.js +74 -35
  49. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  50. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  51. package/dist/es2019/plugins/base/index.js +4 -3
  52. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  53. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  54. package/dist/es2019/plugins/card/index.js +7 -2
  55. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  56. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  57. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  58. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  59. package/dist/es2019/plugins/emoji/styles.js +2 -0
  60. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  61. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  62. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  63. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  64. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  65. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  66. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  67. package/dist/es2019/plugins/media/index.js +13 -4
  68. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  69. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  70. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  71. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  72. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  73. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  74. package/dist/es2019/plugins/panel/index.js +3 -4
  75. package/dist/es2019/plugins/panel/message.js +38 -0
  76. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  77. package/dist/es2019/plugins/panel/utils.js +2 -2
  78. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  79. package/dist/es2019/plugins/status/styles.js +2 -0
  80. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  81. package/dist/es2019/profiler/render-count.js +60 -0
  82. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  83. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  84. package/dist/es2019/version-wrapper.js +1 -1
  85. package/dist/es2019/version.json +1 -1
  86. package/dist/esm/actions/index.js +6 -24
  87. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  88. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  89. package/dist/esm/create-editor/create-plugins-list.js +4 -2
  90. package/dist/esm/editor.js +100 -40
  91. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  92. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  93. package/dist/esm/plugins/base/index.js +4 -3
  94. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  95. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  96. package/dist/esm/plugins/card/index.js +13 -2
  97. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  98. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  99. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  100. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  101. package/dist/esm/plugins/emoji/styles.js +1 -1
  102. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  103. package/dist/esm/plugins/extension/toolbar.js +28 -23
  104. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  105. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  106. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  107. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  108. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  109. package/dist/esm/plugins/media/index.js +14 -4
  110. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  111. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  112. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  113. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  114. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  115. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  116. package/dist/esm/plugins/panel/index.js +3 -4
  117. package/dist/esm/plugins/panel/message.js +38 -0
  118. package/dist/esm/plugins/panel/toolbar.js +57 -77
  119. package/dist/esm/plugins/panel/utils.js +2 -2
  120. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  121. package/dist/esm/plugins/status/styles.js +1 -1
  122. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  123. package/dist/esm/profiler/render-count.js +57 -0
  124. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  125. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  126. package/dist/esm/version-wrapper.js +1 -1
  127. package/dist/esm/version.json +1 -1
  128. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  129. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  130. package/dist/types/editor.d.ts +2 -0
  131. package/dist/types/plugins/analytics/index.d.ts +1 -1
  132. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  133. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  134. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  135. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  136. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  137. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  138. package/dist/types/plugins/base/index.d.ts +1 -0
  139. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  140. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  141. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  142. package/dist/types/plugins/card/types.d.ts +6 -0
  143. package/dist/types/plugins/extension/types.d.ts +0 -2
  144. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  145. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  146. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  147. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  148. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  149. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  150. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  151. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  152. package/dist/types/plugins/panel/message.d.ts +37 -0
  153. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  154. package/dist/types/plugins/panel/types.d.ts +1 -0
  155. package/dist/types/profiler/render-count.d.ts +14 -0
  156. package/dist/types/types/feature-flags.d.ts +8 -0
  157. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  158. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  159. package/package.json +19 -16
  160. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  161. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  162. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  163. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  164. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  165. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  166. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  167. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  168. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  169. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  170. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  171. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  172. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  173. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  174. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  175. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  176. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  177. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  178. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  179. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  180. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  181. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  182. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  183. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  184. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  185. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  186. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  187. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  188. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  189. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  190. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  191. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  192. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  193. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  194. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  195. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -22,6 +22,7 @@ import { EditorState, Selection } from 'prosemirror-state';
22
22
  import { EditorView } from 'prosemirror-view';
23
23
  import { intlShape } from 'react-intl';
24
24
  import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common';
25
+ import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
25
26
  import { createDispatch, EventDispatcher } from '../event-dispatcher';
26
27
  import { processRawValue } from '../utils';
27
28
  import { RenderTracking } from '../utils/react-hooks/use-component-renderer-tracking';
@@ -111,7 +112,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
111
112
  return FULL_WIDTH_MODE.FIXED_WIDTH;
112
113
  });
113
114
 
114
- _defineProperty(_assertThisInitialized(_this), "reconfigureState", function (props) {
115
+ _defineProperty(_assertThisInitialized(_this), "resetEditorState", function (_ref) {
116
+ var _this$props$editorPro, _this$props$editorPro2;
117
+
118
+ var doc = _ref.doc,
119
+ shouldScrollToBottom = _ref.shouldScrollToBottom;
120
+
115
121
  if (!_this.view) {
116
122
  return;
117
123
  } // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
@@ -119,9 +125,51 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
119
125
  // nodes that haven't been re-rendered to the document yet.
120
126
 
121
127
 
128
+ _this.blur();
129
+
130
+ _this.featureFlags = createFeatureFlagsFromProps(_this.props.editorProps);
131
+ _this.editorState = _this.createEditorState({
132
+ props: _this.props,
133
+ context: _this.context,
134
+ doc: doc,
135
+ resetting: true,
136
+ selectionAtStart: !shouldScrollToBottom
137
+ });
138
+
139
+ _this.view.updateState(_this.editorState);
140
+
141
+ (_this$props$editorPro = (_this$props$editorPro2 = _this.props.editorProps).onChange) === null || _this$props$editorPro === void 0 ? void 0 : _this$props$editorPro.call(_this$props$editorPro2, _this.view, {
142
+ source: 'local'
143
+ });
144
+ });
145
+
146
+ _defineProperty(_assertThisInitialized(_this), "blur", function () {
147
+ if (!_this.view) {
148
+ return;
149
+ }
150
+
122
151
  if (_this.view.dom instanceof HTMLElement && _this.view.hasFocus()) {
123
152
  _this.view.dom.blur();
153
+ } // The selectionToDOM method uses the document selection to determine currently selected node
154
+ // We need to mimic blurring this as it seems doing the above is not enough.
155
+
156
+
157
+ var sel = _this.view.root.getSelection();
158
+
159
+ if (sel) {
160
+ sel.removeAllRanges();
124
161
  }
162
+ });
163
+
164
+ _defineProperty(_assertThisInitialized(_this), "reconfigureState", function (props) {
165
+ if (!_this.view) {
166
+ return;
167
+ } // We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
168
+ // so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
169
+ // nodes that haven't been re-rendered to the document yet.
170
+
171
+
172
+ _this.blur();
125
173
 
126
174
  _this.config = processPluginsList(_this.getPlugins(props.editorProps, _this.props.editorProps, _this.props.createAnalyticsEvent));
127
175
  var state = _this.editorState;
@@ -162,7 +210,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
162
210
  });
163
211
 
164
212
  _defineProperty(_assertThisInitialized(_this), "createEditorState", function (options) {
165
- if (_this.view) {
213
+ if (_this.view && !options.resetting) {
166
214
  /**
167
215
  * There's presently a number of issues with changing the schema of a
168
216
  * editor inflight. A significant issue is that we lose the ability
@@ -177,9 +225,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
177
225
 
178
226
  _this.config = processPluginsList(_this.getPlugins(options.props.editorProps, undefined, options.props.createAnalyticsEvent));
179
227
  var schema = createSchema(_this.config);
180
- var _options$props$editor = options.props.editorProps,
181
- contentTransformerProvider = _options$props$editor.contentTransformerProvider,
182
- defaultValue = _options$props$editor.defaultValue;
228
+ var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
183
229
  var plugins = createPMPlugins({
184
230
  schema: schema,
185
231
  dispatch: _this.dispatch,
@@ -199,15 +245,14 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
199
245
  _this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
200
246
  var doc;
201
247
 
202
- if (options.replaceDoc) {
203
- doc = processRawValue(schema, defaultValue, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, _this.contentTransformer, _this.dispatchAnalyticsEvent);
248
+ if (options.doc) {
249
+ doc = processRawValue(schema, options.doc, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, _this.contentTransformer, _this.dispatchAnalyticsEvent);
204
250
  }
205
251
 
206
252
  var selection;
207
253
 
208
254
  if (doc) {
209
- // ED-4759: Don't set selection at end for full-page editor - should be at start.
210
- selection = isFullPage(options.props.editorProps.appearance) ? Selection.atStart(doc) : Selection.atEnd(doc);
255
+ selection = options.selectionAtStart ? Selection.atStart(doc) : Selection.atEnd(doc);
211
256
  } // Workaround for ED-3507: When media node is the last element, scrollIntoView throws an error
212
257
 
213
258
 
@@ -220,11 +265,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
220
265
  });
221
266
  });
222
267
 
223
- _defineProperty(_assertThisInitialized(_this), "onEditorViewStateUpdated", function (_ref) {
224
- var originalTransaction = _ref.originalTransaction,
225
- transactions = _ref.transactions,
226
- oldEditorState = _ref.oldEditorState,
227
- newEditorState = _ref.newEditorState;
268
+ _defineProperty(_assertThisInitialized(_this), "onEditorViewStateUpdated", function (_ref2) {
269
+ var originalTransaction = _ref2.originalTransaction,
270
+ transactions = _ref2.transactions,
271
+ oldEditorState = _ref2.oldEditorState,
272
+ newEditorState = _ref2.newEditorState;
228
273
  var trackinEnabled = _this.transactionTracking.enabled;
229
274
 
230
275
  _this.config.onEditorViewStateUpdatedCallbacks.forEach(function (entry) {
@@ -270,6 +315,13 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
270
315
  stopMeasure = _this$transactionTrac.stopMeasure;
271
316
 
272
317
  startMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
318
+
319
+ if (_this.transactionTracker.shouldTrackTransaction(_this.transactionTracking)) {
320
+ var _this$experienceStore;
321
+
322
+ (_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.start(EditorExperience.interaction);
323
+ }
324
+
273
325
  var nodes = findChangedNodesFromTransaction(transaction);
274
326
  var changedNodesValid = validateNodes(nodes);
275
327
 
@@ -282,7 +334,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
282
334
  editorState = _this$view$state$appl.state,
283
335
  transactions = _this$view$state$appl.transactions;
284
336
 
285
- stopMeasure(EVENT_NAME_STATE_APPLY);
337
+ stopMeasure(EVENT_NAME_STATE_APPLY, function (duration, startTime) {
338
+ var _this$experienceStore2;
339
+
340
+ (_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.mark(EditorExperience.interaction, 'stateApply', startTime + duration);
341
+ });
286
342
 
287
343
  _this.trackValidTransactions();
288
344
 
@@ -294,7 +350,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
294
350
 
295
351
  _this.view.updateState(editorState);
296
352
 
297
- stopMeasure(EVENT_NAME_UPDATE_STATE);
353
+ stopMeasure(EVENT_NAME_UPDATE_STATE, function (duration, startTime) {
354
+ var _this$experienceStore3;
355
+
356
+ (_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
357
+ });
298
358
  startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
299
359
 
300
360
  _this.onEditorViewStateUpdated({
@@ -304,7 +364,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
304
364
  newEditorState: editorState
305
365
  });
306
366
 
307
- stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
367
+ stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED, function (duration, startTime) {
368
+ var _this$experienceStore4;
369
+
370
+ (_this$experienceStore4 = _this.experienceStore) === null || _this$experienceStore4 === void 0 ? void 0 : _this$experienceStore4.mark(EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
371
+ });
308
372
 
309
373
  if (_this.props.editorProps.onChange && transaction.docChanged) {
310
374
  var source = transaction.getMeta('isRemote') ? 'remote' : 'local';
@@ -315,9 +379,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
315
379
  });
316
380
 
317
381
  stopMeasure(EVENT_NAME_ON_CHANGE, function (duration, startTime) {
318
- var _this$props$editorPro, _this$props$editorPro2;
382
+ var _this$experienceStore5, _this$props$editorPro3, _this$props$editorPro4;
383
+
384
+ (_this$experienceStore5 = _this.experienceStore) === null || _this$experienceStore5 === void 0 ? void 0 : _this$experienceStore5.mark(EditorExperience.interaction, 'onChange', startTime + duration);
319
385
 
320
- if (((_this$props$editorPro = _this.props.editorProps.performanceTracking) === null || _this$props$editorPro === void 0 ? void 0 : (_this$props$editorPro2 = _this$props$editorPro.onChangeCallbackTracking) === null || _this$props$editorPro2 === void 0 ? void 0 : _this$props$editorPro2.enabled) !== true) {
386
+ if (((_this$props$editorPro3 = _this.props.editorProps.performanceTracking) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.onChangeCallbackTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.enabled) !== true) {
321
387
  return;
322
388
  }
323
389
 
@@ -334,7 +400,15 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
334
400
  }
335
401
 
336
402
  _this.editorState = editorState;
403
+ stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION, function (duration, startTime) {
404
+ var _this$experienceStore6, _this$experienceStore7;
405
+
406
+ (_this$experienceStore6 = _this.experienceStore) === null || _this$experienceStore6 === void 0 ? void 0 : _this$experienceStore6.mark(EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
407
+ (_this$experienceStore7 = _this.experienceStore) === null || _this$experienceStore7 === void 0 ? void 0 : _this$experienceStore7.success(EditorExperience.interaction);
408
+ });
337
409
  } else {
410
+ var _this$experienceStore8;
411
+
338
412
  var invalidNodes = nodes.filter(function (node) {
339
413
  return !validNode(node);
340
414
  }).map(function (node) {
@@ -352,9 +426,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
352
426
  invalidNodes: invalidNodes
353
427
  }
354
428
  });
355
- }
356
429
 
357
- stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
430
+ (_this$experienceStore8 = _this.experienceStore) === null || _this$experienceStore8 === void 0 ? void 0 : _this$experienceStore8.fail(EditorExperience.interaction, {
431
+ reason: 'invalid transaction',
432
+ invalidNodes: invalidNodes.toString()
433
+ });
434
+ }
358
435
  });
359
436
 
360
437
  _defineProperty(_assertThisInitialized(_this), "getDirectEditorProps", function (state) {
@@ -380,14 +457,17 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
380
457
 
381
458
  _defineProperty(_assertThisInitialized(_this), "createEditorView", function (node) {
382
459
  measureRender(measurements.PROSEMIRROR_RENDERED, function (duration, startTime) {
383
- var _this$props$editorPro3, _this$props$editorPro4, _proseMirrorRenderedT, _proseMirrorRenderedT2;
460
+ var _this$props$editorPro5, _this$props$editorPro6, _proseMirrorRenderedT, _proseMirrorRenderedT2;
384
461
 
385
- var proseMirrorRenderedTracking = (_this$props$editorPro3 = _this.props.editorProps) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.proseMirrorRenderedTracking;
462
+ var proseMirrorRenderedTracking = (_this$props$editorPro5 = _this.props.editorProps) === null || _this$props$editorPro5 === void 0 ? void 0 : (_this$props$editorPro6 = _this$props$editorPro5.performanceTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.proseMirrorRenderedTracking;
386
463
  var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
387
464
  _this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
388
465
 
389
466
  if (_this.view) {
390
- var _getContextIdentifier;
467
+ var _getContextIdentifier, _this$experienceStore9, _this$experienceStore10;
468
+
469
+ var nodes = getNodesCount(_this.view.state.doc);
470
+ var ttfb = getResponseEndTime();
391
471
 
392
472
  _this.dispatchAnalyticsEvent({
393
473
  action: ACTION.PROSEMIRROR_RENDERED,
@@ -395,13 +475,19 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
395
475
  attributes: {
396
476
  duration: duration,
397
477
  startTime: startTime,
398
- nodes: getNodesCount(_this.view.state.doc),
399
- ttfb: getResponseEndTime(),
478
+ nodes: nodes,
479
+ ttfb: ttfb,
400
480
  severity: _this.proseMirrorRenderedSeverity,
401
481
  objectId: (_getContextIdentifier = getContextIdentifier(_this.editorState)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId
402
482
  },
403
483
  eventType: EVENT_TYPE.OPERATIONAL
404
484
  });
485
+
486
+ (_this$experienceStore9 = _this.experienceStore) === null || _this$experienceStore9 === void 0 ? void 0 : _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
487
+ (_this$experienceStore10 = _this.experienceStore) === null || _this$experienceStore10 === void 0 ? void 0 : _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
488
+ nodes: nodes,
489
+ ttfb: ttfb
490
+ });
405
491
  }
406
492
  }); // Creates the editor-view from this.editorState. If an editor has been mounted
407
493
  // previously, this will contain the previous state of the editor.
@@ -424,8 +510,27 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
424
510
  transformer: _this.contentTransformer
425
511
  });
426
512
 
513
+ if (_this.featureFlags.ufo) {
514
+ _this.reliabilityInterval = window.setInterval(function () {
515
+ var reliabilityEvent = {
516
+ action: ACTION.UFO_SESSION_COMPLETE,
517
+ actionSubject: ACTION_SUBJECT.EDITOR,
518
+ attributes: {
519
+ interval: RELIABILITY_INTERVAL
520
+ },
521
+ eventType: EVENT_TYPE.OPERATIONAL
522
+ };
523
+
524
+ _this.dispatchAnalyticsEvent(reliabilityEvent);
525
+ }, RELIABILITY_INTERVAL);
526
+ }
527
+
427
528
  if (_this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
428
529
  _this.focusTimeoutId = handleEditorFocus(view);
530
+ }
531
+
532
+ if (_this.featureFlags.ufo) {
533
+ _this.experienceStore = ExperienceStore.getInstance(view);
429
534
  } // Force React to re-render so consumers get a reference to the editor view
430
535
 
431
536
 
@@ -493,10 +598,14 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
493
598
 
494
599
  _this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
495
600
 
601
+ _this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
602
+
496
603
  _this.editorState = _this.createEditorState({
497
604
  props: _props,
498
605
  context: context,
499
- replaceDoc: true
606
+ doc: _props.editorProps.defaultValue,
607
+ // ED-4759: Don't set selection at end for full-page editor - should be at start.
608
+ selectionAtStart: isFullPage(_props.editorProps.appearance)
500
609
  });
501
610
 
502
611
  _this.dispatchAnalyticsEvent({
@@ -517,9 +626,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
517
626
  get: // ProseMirror is instantiated prior to the initial React render cycle,
518
627
  // so we allow transactions by default, to avoid discarding the initial one.
519
628
  function get() {
520
- var _this$props$editorPro5, _this$props$editorPro6;
629
+ var _this$props$editorPro7, _this$props$editorPro8;
521
630
 
522
- return (_this$props$editorPro5 = (_this$props$editorPro6 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.transactionTracking) !== null && _this$props$editorPro5 !== void 0 ? _this$props$editorPro5 : {
631
+ return (_this$props$editorPro7 = (_this$props$editorPro8 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.transactionTracking) !== null && _this$props$editorPro7 !== void 0 ? _this$props$editorPro7 : {
523
632
  enabled: false
524
633
  };
525
634
  }
@@ -612,6 +721,11 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
612
721
  this.canDispatchTransactions = false;
613
722
  this.eventDispatcher.destroy();
614
723
  clearTimeout(this.focusTimeoutId);
724
+
725
+ if (this.reliabilityInterval) {
726
+ clearInterval(this.reliabilityInterval);
727
+ }
728
+
615
729
  this.pluginPerformanceObserver.disconnect();
616
730
 
617
731
  if (this.view) {
@@ -628,6 +742,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
628
742
 
629
743
 
630
744
  this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
745
+ this.eventDispatcher.off('resetEditorState', this.resetEditorState);
631
746
  } // Helper to allow tests to inject plugins directly
632
747
 
633
748
  }, {
@@ -647,9 +762,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
647
762
  }, {
648
763
  key: "render",
649
764
  value: function render() {
650
- var _this$props$editorPro7, _this$props$editorPro8;
765
+ var _this$props$editorPro9, _this$props$editorPro10;
651
766
 
652
- var renderTracking = (_this$props$editorPro7 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro7 === void 0 ? void 0 : (_this$props$editorPro8 = _this$props$editorPro7.renderTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.reactEditorView;
767
+ var renderTracking = (_this$props$editorPro9 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro9 === void 0 ? void 0 : (_this$props$editorPro10 = _this$props$editorPro9.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
653
768
  var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
654
769
  var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
655
770
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
@@ -66,7 +66,8 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
66
66
  allowInlineCursorTarget: !isMobile,
67
67
  allowScrollGutter: getScrollGutterOptions(props),
68
68
  inputTracking: inputTracking,
69
- browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking
69
+ browserFreezeTracking: (_props$performanceTra2 = props.performanceTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.bFreezeTracking,
70
+ ufo: createFeatureFlagsFromProps(props).ufo
70
71
  },
71
72
  blockType: {
72
73
  lastNodeMustBeParagraph: appearance === 'comment' || appearance === 'chromeless',
@@ -276,7 +277,8 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
276
277
  if (props.allowPanel) {
277
278
  preset.add([panelPlugin, {
278
279
  useLongPressSelection: false,
279
- UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel
280
+ UNSAFE_allowCustomPanel: props.allowPanel.UNSAFE_allowCustomPanel,
281
+ UNSAFE_allowCustomPanelEdit: props.allowPanel.UNSAFE_allowCustomPanelEdit
280
282
  }]);
281
283
  }
282
284
 
@@ -27,6 +27,7 @@ import memoizeOne from 'memoize-one';
27
27
  import uuid from 'uuid/v4';
28
28
  import { name, version } from './version-wrapper';
29
29
  import { ProviderFactory, BaseTheme, getAnalyticsAppearance, WithCreateAnalyticsEvent, startMeasure, stopMeasure, clearMeasure, measureTTI, getTTISeverity, combineExtensionProviders, WidthProvider } from '@atlaskit/editor-common';
30
+ import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
30
31
  import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
31
32
  import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
32
33
  import { getUiComponent } from './create-editor';
@@ -50,6 +51,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
50
51
  var _super = _createSuper(Editor);
51
52
 
52
53
  function Editor(props, context) {
54
+ var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
55
+
53
56
  var _this;
54
57
 
55
58
  _classCallCheck(this, Editor);
@@ -97,11 +100,16 @@ var Editor = /*#__PURE__*/function (_React$Component) {
97
100
  _this.trackEditorActions(_this.editorActions, props);
98
101
 
99
102
  _this.editorSessionId = uuid();
103
+ _this.startTime = performance.now();
100
104
  startMeasure(measurements.EDITOR_MOUNTED);
101
105
 
102
- if (props.performanceTracking && props.performanceTracking.ttiTracking && props.performanceTracking.ttiTracking.enabled) {
106
+ 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) {
107
+ var _props$performanceTra5, _props$performanceTra6, _props$performanceTra7, _props$performanceTra8;
108
+
103
109
  measureTTI(function (tti, ttiFromInvocation, canceled) {
104
- if (_this.createAnalyticsEvent) {
110
+ var _props$performanceTra3, _props$performanceTra4, _props$featureFlags2;
111
+
112
+ 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) {
105
113
  var _ttiTracking;
106
114
 
107
115
  var ttiEvent = {
@@ -134,7 +142,14 @@ var Editor = /*#__PURE__*/function (_React$Component) {
134
142
 
135
143
  fireAnalyticsEvent(_this.createAnalyticsEvent)(ttiEvent);
136
144
  }
137
- }, props.performanceTracking.ttiTracking.ttiIdleThreshold, props.performanceTracking.ttiTracking.ttiCancelTimeout);
145
+
146
+ if ((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.ufo) {
147
+ var _this$experienceStore, _this$experienceStore2;
148
+
149
+ (_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.mark(EditorExperience.loadEditor, ACTION.EDITOR_TTI, tti);
150
+ (_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 ? void 0 : _this$experienceStore2.success(EditorExperience.loadEditor);
151
+ }
152
+ }, (_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);
138
153
  }
139
154
 
140
155
  var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
@@ -180,21 +195,29 @@ var Editor = /*#__PURE__*/function (_React$Component) {
180
195
  }, {
181
196
  key: "componentWillUnmount",
182
197
  value: function componentWillUnmount() {
183
- var _this$props2, _this$props2$performa, _this$props2$performa2;
198
+ var _this$props2, _this$props2$performa, _this$props2$performa2, _this$props$featureFl;
184
199
 
185
200
  this.unregisterEditorFromActions();
186
201
  this.providerFactory.destroy();
187
202
  clearMeasure(measurements.EDITOR_MOUNTED);
188
203
  ((_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);
204
+
205
+ if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
206
+ var _this$experienceStore3;
207
+
208
+ (_this$experienceStore3 = this.experienceStore) === null || _this$experienceStore3 === void 0 ? void 0 : _this$experienceStore3.abortAll({
209
+ reason: 'editor component unmounted'
210
+ });
211
+ }
189
212
  }
190
213
  }, {
191
214
  key: "trackEditorActions",
192
215
  value: function trackEditorActions(editorActions, props) {
193
- var _props$performanceTra,
194
- _props$performanceTra2,
216
+ var _props$performanceTra9,
217
+ _props$performanceTra10,
195
218
  _this3 = this;
196
219
 
197
- if (props !== null && props !== void 0 && (_props$performanceTra = props.performanceTracking) !== null && _props$performanceTra !== void 0 && (_props$performanceTra2 = _props$performanceTra.contentRetrievalTracking) !== null && _props$performanceTra2 !== void 0 && _props$performanceTra2.enabled) {
220
+ 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) {
198
221
  var DEFAULT_SAMPLING_RATE = 100;
199
222
  var getValue = editorActions.getValue.bind(editorActions);
200
223
 
@@ -215,7 +238,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
215
238
  if (!getValueTracked) {
216
239
  var getValueWithTracking = /*#__PURE__*/function () {
217
240
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
218
- var _props$performanceTra3, _props$performanceTra4, _props$performanceTra5, value, _props$performanceTra6, _props$performanceTra7, _props$performanceTra8, _props$performanceTra9, _props$performanceTra10;
241
+ var _props$performanceTra11, _props$performanceTra12, _props$performanceTra13, value, _props$performanceTra14, _props$performanceTra15, _props$performanceTra16, _props$performanceTra17, _props$performanceTra18;
219
242
 
220
243
  return _regeneratorRuntime.wrap(function _callee$(_context) {
221
244
  while (1) {
@@ -228,7 +251,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
228
251
  case 3:
229
252
  value = _context.sent;
230
253
 
231
- if (samplingCounters.success === ((_props$performanceTra3 = props === null || props === void 0 ? void 0 : (_props$performanceTra4 = props.performanceTracking) === null || _props$performanceTra4 === void 0 ? void 0 : (_props$performanceTra5 = _props$performanceTra4.contentRetrievalTracking) === null || _props$performanceTra5 === void 0 ? void 0 : _props$performanceTra5.successSamplingRate) !== null && _props$performanceTra3 !== void 0 ? _props$performanceTra3 : DEFAULT_SAMPLING_RATE)) {
254
+ 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)) {
232
255
  _this3.handleAnalyticsEvent({
233
256
  payload: {
234
257
  action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
@@ -250,7 +273,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
250
273
  _context.prev = 9;
251
274
  _context.t0 = _context["catch"](0);
252
275
 
253
- if (samplingCounters.failure === ((_props$performanceTra6 = props === null || props === void 0 ? void 0 : (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.contentRetrievalTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.failureSamplingRate) !== null && _props$performanceTra6 !== void 0 ? _props$performanceTra6 : DEFAULT_SAMPLING_RATE)) {
276
+ 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)) {
254
277
  _this3.handleAnalyticsEvent({
255
278
  payload: {
256
279
  action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
@@ -258,7 +281,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
258
281
  attributes: {
259
282
  success: false,
260
283
  errorInfo: _context.t0.toString(),
261
- errorStack: 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.reportErrorStack ? _context.t0.stack : undefined
284
+ 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
262
285
  },
263
286
  eventType: EVENT_TYPE.OPERATIONAL
264
287
  }
@@ -293,14 +316,22 @@ var Editor = /*#__PURE__*/function (_React$Component) {
293
316
  }, {
294
317
  key: "onEditorCreated",
295
318
  value: function onEditorCreated(instance) {
319
+ var _this$props$featureFl2;
320
+
296
321
  this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
297
322
 
323
+ if ((_this$props$featureFl2 = this.props.featureFlags) !== null && _this$props$featureFl2 !== void 0 && _this$props$featureFl2.ufo) {
324
+ this.experienceStore = ExperienceStore.getInstance(instance.view);
325
+ this.experienceStore.start(EditorExperience.loadEditor, this.startTime);
326
+ }
327
+
298
328
  if (this.props.onEditorReady) {
299
- var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props4, _this$props4$performa, _this$props4$performa2;
329
+ var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props$featureFl3;
300
330
 
301
- ((_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) && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
331
+ 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);
332
+ measureEditorReady && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
302
333
  this.props.onEditorReady(this.editorActions);
303
- ((_this$props4 = this.props) === null || _this$props4 === void 0 ? void 0 : (_this$props4$performa = _this$props4.performanceTracking) === null || _this$props4$performa === void 0 ? void 0 : (_this$props4$performa2 = _this$props4$performa.onEditorReadyCallbackTracking) === null || _this$props4$performa2 === void 0 ? void 0 : _this$props4$performa2.enabled) && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, this.sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK));
334
+ measureEditorReady && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, this.sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK));
304
335
  }
305
336
  }
306
337
  }, {
@@ -308,28 +339,57 @@ var Editor = /*#__PURE__*/function (_React$Component) {
308
339
  value: function sendDurationAnalytics(action) {
309
340
  var _this4 = this;
310
341
 
311
- return function (duration, startTime) {
312
- if (_this4.createAnalyticsEvent) {
313
- var fireMounted = function fireMounted(objectId) {
314
- fireAnalyticsEvent(_this4.createAnalyticsEvent)({
315
- payload: {
316
- action: action,
317
- actionSubject: ACTION_SUBJECT.EDITOR,
318
- attributes: {
319
- duration: duration,
320
- startTime: startTime,
321
- objectId: objectId
322
- },
323
- eventType: EVENT_TYPE.OPERATIONAL
342
+ return /*#__PURE__*/function () {
343
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(duration, startTime) {
344
+ var _this4$props$featureF;
345
+
346
+ var contextIdentifier, objectId, _this4$experienceStor, _this4$experienceStor2;
347
+
348
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
349
+ while (1) {
350
+ switch (_context2.prev = _context2.next) {
351
+ case 0:
352
+ _context2.next = 2;
353
+ return _this4.props.contextIdentifierProvider;
354
+
355
+ case 2:
356
+ contextIdentifier = _context2.sent;
357
+ objectId = contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId;
358
+
359
+ if (_this4.createAnalyticsEvent) {
360
+ fireAnalyticsEvent(_this4.createAnalyticsEvent)({
361
+ payload: {
362
+ action: action,
363
+ actionSubject: ACTION_SUBJECT.EDITOR,
364
+ attributes: {
365
+ duration: duration,
366
+ startTime: startTime,
367
+ objectId: objectId
368
+ },
369
+ eventType: EVENT_TYPE.OPERATIONAL
370
+ }
371
+ });
372
+ }
373
+
374
+ if ((_this4$props$featureF = _this4.props.featureFlags) !== null && _this4$props$featureF !== void 0 && _this4$props$featureF.ufo) {
375
+ (_this4$experienceStor = _this4.experienceStore) === null || _this4$experienceStor === void 0 ? void 0 : _this4$experienceStor.mark(EditorExperience.loadEditor, action, startTime + duration);
376
+ (_this4$experienceStor2 = _this4.experienceStore) === null || _this4$experienceStor2 === void 0 ? void 0 : _this4$experienceStor2.addMetadata(EditorExperience.loadEditor, {
377
+ objectId: objectId
378
+ });
379
+ }
380
+
381
+ case 6:
382
+ case "end":
383
+ return _context2.stop();
324
384
  }
325
- });
326
- };
385
+ }
386
+ }, _callee2);
387
+ }));
327
388
 
328
- Promise.resolve(_this4.props.contextIdentifierProvider).then(function (p) {
329
- fireMounted(p === null || p === void 0 ? void 0 : p.objectId);
330
- }, fireMounted);
331
- }
332
- };
389
+ return function (_x, _x2) {
390
+ return _ref2.apply(this, arguments);
391
+ };
392
+ }();
333
393
  }
334
394
  }, {
335
395
  key: "deprecationWarnings",
@@ -487,14 +547,14 @@ var Editor = /*#__PURE__*/function (_React$Component) {
487
547
  onEditorDestroyed: _this5.onEditorDestroyed,
488
548
  allowAnalyticsGASV3: _this5.props.allowAnalyticsGASV3,
489
549
  disabled: _this5.props.disabled,
490
- render: function render(_ref2) {
550
+ render: function render(_ref3) {
491
551
  var _this5$props$featureF, _this5$props$featureF2;
492
552
 
493
- var editor = _ref2.editor,
494
- view = _ref2.view,
495
- eventDispatcher = _ref2.eventDispatcher,
496
- config = _ref2.config,
497
- dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
553
+ var editor = _ref3.editor,
554
+ view = _ref3.view,
555
+ eventDispatcher = _ref3.eventDispatcher,
556
+ config = _ref3.config,
557
+ dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
498
558
  return /*#__PURE__*/React.createElement(BaseTheme, {
499
559
  dynamicTextSizing: _this5.props.allowDynamicTextSizing && _this5.props.appearance !== 'full-width',
500
560
  baseFontSize: _this5.getBaseFontSize()
@@ -32,7 +32,8 @@ export function useCXHTMLPreset(_ref) {
32
32
  }
33
33
  }]);
34
34
  preset.add([panelPlugin, {
35
- UNSAFE_allowCustomPanel: true
35
+ UNSAFE_allowCustomPanel: true,
36
+ UNSAFE_allowCustomPanelEdit: true
36
37
  }]);
37
38
  preset.add(listPlugin);
38
39
  preset.add(textColorPlugin);