@atlaskit/editor-core 150.0.2 → 151.1.1

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 (244) hide show
  1. package/CHANGELOG.md +69 -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 +8 -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-bidi-warning/index.js +25 -0
  17. package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
  18. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
  19. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
  20. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
  21. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
  22. package/dist/cjs/plugins/code-block/index.js +10 -6
  23. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  24. package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
  25. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  26. package/dist/cjs/plugins/emoji/styles.js +1 -1
  27. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  28. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  29. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
  30. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  31. package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  32. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  34. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  35. package/dist/cjs/plugins/index.js +8 -0
  36. package/dist/cjs/plugins/media/index.js +14 -3
  37. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  38. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  39. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  40. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  41. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  42. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  43. package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
  44. package/dist/cjs/plugins/panel/index.js +2 -3
  45. package/dist/cjs/plugins/panel/message.js +47 -0
  46. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  47. package/dist/cjs/plugins/panel/utils.js +2 -2
  48. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  49. package/dist/cjs/plugins/rank.js +1 -1
  50. package/dist/cjs/plugins/status/styles.js +1 -1
  51. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  52. package/dist/cjs/profiler/render-count.js +82 -0
  53. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  54. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  55. package/dist/cjs/version-wrapper.js +1 -1
  56. package/dist/cjs/version.json +1 -1
  57. package/dist/es2019/actions/index.js +6 -28
  58. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  59. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  60. package/dist/es2019/create-editor/create-plugins-list.js +9 -3
  61. package/dist/es2019/editor.js +74 -35
  62. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  63. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  64. package/dist/es2019/plugins/base/index.js +4 -3
  65. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  66. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  67. package/dist/es2019/plugins/card/index.js +7 -2
  68. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  69. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  70. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  71. package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
  72. package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
  73. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
  74. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
  75. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  76. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  77. package/dist/es2019/plugins/code-block/index.js +6 -1
  78. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
  79. package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
  80. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  81. package/dist/es2019/plugins/emoji/styles.js +2 -0
  82. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  83. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  84. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  85. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  86. package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  87. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  88. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  89. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  90. package/dist/es2019/plugins/index.js +2 -1
  91. package/dist/es2019/plugins/media/index.js +13 -4
  92. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  93. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  94. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  95. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  96. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  97. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  98. package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
  99. package/dist/es2019/plugins/panel/index.js +3 -4
  100. package/dist/es2019/plugins/panel/message.js +38 -0
  101. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  102. package/dist/es2019/plugins/panel/utils.js +2 -2
  103. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  104. package/dist/es2019/plugins/rank.js +1 -1
  105. package/dist/es2019/plugins/status/styles.js +2 -0
  106. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  107. package/dist/es2019/profiler/render-count.js +60 -0
  108. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  109. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  110. package/dist/es2019/version-wrapper.js +1 -1
  111. package/dist/es2019/version.json +1 -1
  112. package/dist/esm/actions/index.js +6 -24
  113. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  114. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  115. package/dist/esm/create-editor/create-plugins-list.js +9 -3
  116. package/dist/esm/editor.js +100 -40
  117. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  118. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  119. package/dist/esm/plugins/base/index.js +4 -3
  120. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  121. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  122. package/dist/esm/plugins/card/index.js +13 -2
  123. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  124. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  125. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  126. package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
  127. package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
  128. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
  129. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
  130. package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  131. package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  132. package/dist/esm/plugins/code-block/index.js +10 -6
  133. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  134. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  135. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  136. package/dist/esm/plugins/emoji/styles.js +1 -1
  137. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  138. package/dist/esm/plugins/extension/toolbar.js +28 -23
  139. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  140. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  141. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  142. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  143. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  144. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  145. package/dist/esm/plugins/index.js +2 -1
  146. package/dist/esm/plugins/media/index.js +14 -4
  147. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  148. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  149. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  150. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  151. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  152. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  153. package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
  154. package/dist/esm/plugins/panel/index.js +3 -4
  155. package/dist/esm/plugins/panel/message.js +38 -0
  156. package/dist/esm/plugins/panel/toolbar.js +57 -77
  157. package/dist/esm/plugins/panel/utils.js +2 -2
  158. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  159. package/dist/esm/plugins/rank.js +1 -1
  160. package/dist/esm/plugins/status/styles.js +1 -1
  161. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  162. package/dist/esm/profiler/render-count.js +57 -0
  163. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  164. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  165. package/dist/esm/version-wrapper.js +1 -1
  166. package/dist/esm/version.json +1 -1
  167. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  168. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  169. package/dist/types/editor.d.ts +2 -0
  170. package/dist/types/plugins/analytics/index.d.ts +1 -1
  171. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  172. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  173. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  174. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  175. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  176. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  177. package/dist/types/plugins/base/index.d.ts +1 -0
  178. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  179. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  180. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  181. package/dist/types/plugins/card/types.d.ts +6 -0
  182. package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
  183. package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
  184. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
  185. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
  186. package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
  187. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
  188. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
  189. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
  190. package/dist/types/plugins/extension/types.d.ts +0 -2
  191. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  192. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  193. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  194. package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +1 -1
  195. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  196. package/dist/types/plugins/index.d.ts +1 -0
  197. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  198. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  199. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  200. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  201. package/dist/types/plugins/panel/message.d.ts +37 -0
  202. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  203. package/dist/types/plugins/panel/types.d.ts +1 -0
  204. package/dist/types/profiler/render-count.d.ts +14 -0
  205. package/dist/types/types/feature-flags.d.ts +17 -0
  206. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  207. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  208. package/package.json +21 -18
  209. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  210. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  211. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  212. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  213. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  214. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  215. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  216. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  217. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  218. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  219. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  220. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  221. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  222. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  223. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  224. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  225. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  226. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  227. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  228. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  229. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  230. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  231. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  232. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  233. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  234. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  235. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  236. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  237. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  238. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  239. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  240. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  241. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  242. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  243. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  244. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -8,6 +8,10 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
 
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
+
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
+
11
15
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
16
 
13
17
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -16,6 +20,7 @@ import React from 'react';
16
20
  import uuid from 'uuid';
17
21
  import memoizeOne from 'memoize-one';
18
22
  import { sniffUserBrowserExtensions } from '@atlaskit/editor-common';
23
+ import { ExperienceStore } from '@atlaskit/editor-common/ufo';
19
24
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics';
20
25
  import { editorAnalyticsChannel } from '../plugins/analytics/consts';
21
26
  import { getFeatureFlags } from '../plugins/feature-flags-context';
@@ -26,16 +31,12 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
26
31
 
27
32
  var _super = _createSuper(ErrorBoundaryWithEditorView);
28
33
 
29
- function ErrorBoundaryWithEditorView() {
34
+ function ErrorBoundaryWithEditorView(props) {
30
35
  var _this;
31
36
 
32
37
  _classCallCheck(this, ErrorBoundaryWithEditorView);
33
38
 
34
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
35
- args[_key] = arguments[_key];
36
- }
37
-
38
- _this = _super.call.apply(_super, [this].concat(args));
39
+ _this = _super.call(this, props);
39
40
 
40
41
  _defineProperty(_assertThisInitialized(_this), "browserExtensions", undefined);
41
42
 
@@ -51,102 +52,138 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
51
52
  return getFeatureFlags(editorView.state);
52
53
  }));
53
54
 
54
- _defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (analyticsErrorPayload) {
55
- var createAnalyticsEvent = _this.props.createAnalyticsEvent;
56
-
57
- _this.getProductName().then(function (product) {
58
- if (createAnalyticsEvent) {
59
- var error = analyticsErrorPayload.error,
60
- errorInfo = analyticsErrorPayload.errorInfo,
61
- errorStack = analyticsErrorPayload.errorStack;
62
- var sharedId = uuid();
63
- var event = {
64
- action: ACTION.EDITOR_CRASHED,
65
- actionSubject: ACTION_SUBJECT.EDITOR,
66
- eventType: EVENT_TYPE.OPERATIONAL,
67
- attributes: {
68
- product: product,
69
- browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
70
- error: error,
71
- errorInfo: errorInfo,
72
- errorId: sharedId,
73
- browserExtensions: _this.browserExtensions
74
- }
75
- }; // Add doc structure if the feature flag is on
55
+ _defineProperty(_assertThisInitialized(_this), "sendErrorData", /*#__PURE__*/function () {
56
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(analyticsErrorPayload) {
57
+ var product, error, errorInfo, errorStack, sharedId, attributes, _this$experienceStore;
76
58
 
77
- if (_this.featureFlags.errorBoundaryDocStructure && _this.props.editorView) {
78
- event.attributes.docStructure = getDocStructure(_this.props.editorView.state.doc, {
79
- compact: true
80
- });
81
- }
59
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
60
+ while (1) {
61
+ switch (_context.prev = _context.next) {
62
+ case 0:
63
+ _context.next = 2;
64
+ return _this.getProductName();
65
+
66
+ case 2:
67
+ product = _context.sent;
68
+ error = analyticsErrorPayload.error, errorInfo = analyticsErrorPayload.errorInfo, errorStack = analyticsErrorPayload.errorStack;
69
+ sharedId = uuid();
70
+ attributes = {
71
+ product: product,
72
+ browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
73
+ error: error,
74
+ errorInfo: errorInfo,
75
+ errorId: sharedId,
76
+ browserExtensions: _this.browserExtensions,
77
+ docStructure: _this.featureFlags.errorBoundaryDocStructure && _this.props.editorView ? getDocStructure(_this.props.editorView.state.doc, {
78
+ compact: true
79
+ }) : undefined
80
+ };
81
+
82
+ _this.fireAnalyticsEvent({
83
+ action: ACTION.EDITOR_CRASHED,
84
+ actionSubject: ACTION_SUBJECT.EDITOR,
85
+ eventType: EVENT_TYPE.OPERATIONAL,
86
+ attributes: attributes
87
+ });
88
+
89
+ _this.fireAnalyticsEvent({
90
+ action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
91
+ actionSubject: ACTION_SUBJECT.EDITOR,
92
+ eventType: EVENT_TYPE.OPERATIONAL,
93
+ attributes: {
94
+ errorStack: errorStack,
95
+ errorId: sharedId
96
+ }
97
+ });
98
+
99
+ if (_this.featureFlags.ufo && _this.props.editorView) {
100
+ (_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll(_objectSpread(_objectSpread({}, _this.getExperienceMetadata(attributes)), {}, {
101
+ errorStack: errorStack
102
+ }));
103
+ }
82
104
 
83
- createAnalyticsEvent(event).fire(editorAnalyticsChannel);
84
- createAnalyticsEvent({
85
- action: ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
86
- actionSubject: ACTION_SUBJECT.EDITOR,
87
- eventType: EVENT_TYPE.OPERATIONAL,
88
- attributes: {
89
- errorStack: errorStack,
90
- errorId: sharedId
105
+ case 9:
106
+ case "end":
107
+ return _context.stop();
91
108
  }
92
- }).fire(editorAnalyticsChannel);
93
- } else {
94
- // eslint-disable-next-line no-console
95
- console.error('Editor Error Boundary: Missing `createAnalyticsEvent` prop.', {
96
- channel: editorAnalyticsChannel,
97
- product: product,
98
- error: analyticsErrorPayload
99
- });
100
- }
101
- }).catch(function (e) {
102
- // eslint-disable-next-line no-console
103
- console.error('Failed to resolve product name from contextIdentifierProvider.', e);
104
- });
105
- });
109
+ }
110
+ }, _callee);
111
+ }));
112
+
113
+ return function (_x) {
114
+ return _ref.apply(this, arguments);
115
+ };
116
+ }());
106
117
 
107
- _defineProperty(_assertThisInitialized(_this), "getProductName", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
118
+ _defineProperty(_assertThisInitialized(_this), "getProductName", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
108
119
  var contextIdentifierProvider, context;
109
- return _regeneratorRuntime.wrap(function _callee$(_context) {
120
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
110
121
  while (1) {
111
- switch (_context.prev = _context.next) {
122
+ switch (_context2.prev = _context2.next) {
112
123
  case 0:
113
124
  contextIdentifierProvider = _this.props.contextIdentifierProvider;
114
125
 
115
126
  if (!contextIdentifierProvider) {
116
- _context.next = 7;
127
+ _context2.next = 7;
117
128
  break;
118
129
  }
119
130
 
120
- _context.next = 4;
131
+ _context2.next = 4;
121
132
  return contextIdentifierProvider;
122
133
 
123
134
  case 4:
124
- context = _context.sent;
135
+ context = _context2.sent;
125
136
 
126
137
  if (!context.product) {
127
- _context.next = 7;
138
+ _context2.next = 7;
128
139
  break;
129
140
  }
130
141
 
131
- return _context.abrupt("return", context.product);
142
+ return _context2.abrupt("return", context.product);
132
143
 
133
144
  case 7:
134
- return _context.abrupt("return", 'atlaskit');
145
+ return _context2.abrupt("return", 'atlaskit');
135
146
 
136
147
  case 8:
137
148
  case "end":
138
- return _context.stop();
149
+ return _context2.stop();
139
150
  }
140
151
  }
141
- }, _callee);
152
+ }, _callee2);
142
153
  })));
143
154
 
155
+ _defineProperty(_assertThisInitialized(_this), "fireAnalyticsEvent", function (event) {
156
+ var _this$props$createAna, _this$props;
157
+
158
+ (_this$props$createAna = (_this$props = _this.props).createAnalyticsEvent) === null || _this$props$createAna === void 0 ? void 0 : _this$props$createAna.call(_this$props, event).fire(editorAnalyticsChannel);
159
+ });
160
+
161
+ _defineProperty(_assertThisInitialized(_this), "getExperienceMetadata", function (attributes) {
162
+ var _attributes$browserEx;
163
+
164
+ return {
165
+ browserInfo: attributes.browserInfo,
166
+ error: attributes.error.toString(),
167
+ errorInfo: {
168
+ componentStack: attributes.errorInfo.componentStack
169
+ },
170
+ errorId: attributes.errorId,
171
+ browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
172
+ docStructure: attributes.docStructure
173
+ };
174
+ });
175
+
176
+ if (props.editorView) {
177
+ _this.experienceStore = ExperienceStore.getInstance(props.editorView);
178
+ }
179
+
144
180
  return _this;
145
181
  }
146
182
 
147
183
  _createClass(ErrorBoundaryWithEditorView, [{
148
184
  key: "featureFlags",
149
- get: function get() {
185
+ get: // Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
186
+ function get() {
150
187
  return this.getFeatureFlags(this.props.editorView);
151
188
  }
152
189
  }, {
@@ -154,13 +191,11 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
154
191
  value: function componentDidCatch(error, errorInfo) {
155
192
  var _this2 = this;
156
193
 
157
- // Log the error
158
- this.fireAnalytics({
194
+ this.sendErrorData({
159
195
  error: error.toString(),
160
196
  errorInfo: errorInfo,
161
197
  errorStack: error.stack
162
- }); //
163
- // // Update state to allow a re-render to attempt graceful recovery (in the event that
198
+ }); // // Update state to allow a re-render to attempt graceful recovery (in the event that
164
199
  // // the error was caused by a race condition or is intermittent)
165
200
 
166
201
  this.setState({
@@ -180,12 +215,12 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
180
215
  }, {
181
216
  key: "componentDidMount",
182
217
  value: function () {
183
- var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
184
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
218
+ var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
219
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
185
220
  while (1) {
186
- switch (_context2.prev = _context2.next) {
221
+ switch (_context3.prev = _context3.next) {
187
222
  case 0:
188
- _context2.next = 2;
223
+ _context3.next = 2;
189
224
  return sniffUserBrowserExtensions({
190
225
  extensions: ['grammarly'],
191
226
  async: true,
@@ -193,14 +228,14 @@ export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component
193
228
  });
194
229
 
195
230
  case 2:
196
- this.browserExtensions = _context2.sent;
231
+ this.browserExtensions = _context3.sent;
197
232
 
198
233
  case 3:
199
234
  case "end":
200
- return _context2.stop();
235
+ return _context3.stop();
201
236
  }
202
237
  }
203
- }, _callee2, this);
238
+ }, _callee3, this);
204
239
  }));
205
240
 
206
241
  function componentDidMount() {
@@ -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, {