@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 151.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`b3606652fa1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3606652fa1) - [ux] Editor integration for Media Inline component
8
+
9
+ ### Minor Changes
10
+
11
+ - [`93da0afefce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/93da0afefce) - CETI-78 Change panel nodeSpec to handle paste when feature flag is off
12
+ - [`53d2eac387d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/53d2eac387d) - ED-12705 Fail all active editor UFO experiences from the editor error boundary
13
+ - [`b58f3c24179`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b58f3c24179) - ED-13643 Instrument editor interaction UFO experience
14
+ - [`971845eac0d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/971845eac0d) - CETI-96 Added new rule to emoji to solve the duplicate icon issue when we copy from renderer
15
+ - [`7024003c42e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7024003c42e) - ED-13213 Base work to set up UFO in the editor & implement editor load UFO experience
16
+
17
+ UFO experiences are hidden behind a feature flag, to enable set
18
+
19
+ ```jsx
20
+ <Editor featureFlags={{ ufo: true }} />
21
+ ```
22
+
23
+ - [`eab5cc4f8bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eab5cc4f8bc) - CETI-21 User should be able to see the panel Icon when user changes the background color of a predefined panel
24
+ - [`04fdcc4a097`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04fdcc4a097) - Quick insert ability for Media Inline component
25
+ - [`a9e8fe41756`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a9e8fe41756) - Internationalisation for static label of Beautiful Panels Web
26
+ - [`0d8132a260a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0d8132a260a) - Fix Slack link default to block card view when editor has allowBlockCards disabled
27
+ - [`b53d0d54ac2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b53d0d54ac2) - ED-12887 Add render count profiler utilities
28
+ - [`f235d19dcdb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f235d19dcdb) - Added an api for creating a brand new editor state when replacing the document using editorActions
29
+ - [`7fc265976b2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7fc265976b2) - ED-13214 Instrument typing in editor UFO experience
30
+
31
+ ### Patch Changes
32
+
33
+ - [`53cfa98d9f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/53cfa98d9f6) - [ux] Cursors can now be placed after emojis and statuses without trailing spaces
34
+ - [`540988ac12b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/540988ac12b) - Debounce editor and reactEditorView reRendered analytics
35
+ - [`cbde8994bd4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cbde8994bd4) - ED-12846: Fix disappearing table borders in Chrome
36
+ - [`d7b4aa7c019`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7b4aa7c019) - ED-13878: Force block-type selected menu items to be white font color
37
+ - [`25393b5c63b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/25393b5c63b) - Add prefetch proper ty analytic event to tell if the result is selected from prefetch list
38
+ - [`e9658042982`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9658042982) - [ux] ED-7545 Fix selected language in one code snippet visually populating to other code snippets on the page
39
+ - [`99757fa97fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/99757fa97fb) - ED-13642 added ufo session complete analytics event
40
+ - [`8c68b14866f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8c68b14866f) - ED-12700 Fix for compositions in the find input not being supported.
41
+ - [`e856b56fd31`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e856b56fd31) - ED-13669 reuse same links normalization method in plugin and adf schema
42
+ - [`e731664ad62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e731664ad62) - [ux][ed-13588] move max-height CSS from akEditor root to ak-editor-content-area so that the editor maxHeight prop actually enforces a maximum height
43
+ - [`05c9526a999`](https://bitbucket.org/atlassian/atlassian-frontend/commits/05c9526a999) - CETI-123 Web: Feature flag for editing custom panels
44
+ - [`125c6ed9212`](https://bitbucket.org/atlassian/atlassian-frontend/commits/125c6ed9212) - ED-13458 Fix for foreign input causing tables to break
45
+ - [`a113abe23e1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a113abe23e1) - [ux] The selected width of an extension is correctly highlighted in its floating toolbar when toolbar actions are un-done/re-done
46
+ - [`3fde369f5d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fde369f5d4) - Fix a bug where sometimes the embed link will get states from other embed link
47
+ - [`a92e1f67411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a92e1f67411) - ED-13633 Disabled editor code highting in safari
48
+ - Updated dependencies
49
+
3
50
  ## 150.0.3
4
51
 
5
52
  ### Patch Changes
@@ -264,31 +264,13 @@ var EditorActions = /*#__PURE__*/function () {
264
264
  return false;
265
265
  }
266
266
 
267
- var state = this.editorView.state;
268
- var schema = state.schema;
269
- var content = (0, _document.processRawValue)(schema, rawValue, undefined, undefined, this.contentTransformer, this.dispatchAnalyticsEvent);
270
-
271
- if (!content) {
272
- return false;
273
- } // In case of replacing a whole document, we only need a content of a top level node e.g. document.
274
-
275
-
276
- var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content.content);
277
-
278
- if (!shouldScrollToBottom && !tr.selectionSet) {
279
- // Restore selection at start of document instead of the end.
280
- tr.setSelection(_prosemirrorState.Selection.atStart(tr.doc));
281
- }
282
-
283
- if (shouldScrollToBottom) {
284
- tr = tr.scrollIntoView();
285
- }
286
-
287
- if (!shouldAddToHistory) {
288
- tr.setMeta('addToHistory', false);
267
+ if (this.eventDispatcher) {
268
+ this.eventDispatcher.emit('resetEditorState', {
269
+ doc: rawValue,
270
+ shouldScrollToBottom: shouldScrollToBottom
271
+ });
289
272
  }
290
273
 
291
- this.editorView.dispatch(tr);
292
274
  return true;
293
275
  }
294
276
  }, {
@@ -33,6 +33,8 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
33
33
 
34
34
  var _editorCommon = require("@atlaskit/editor-common");
35
35
 
36
+ var _ufo = require("@atlaskit/editor-common/ufo");
37
+
36
38
  var _analytics = require("../plugins/analytics");
37
39
 
38
40
  var _consts = require("../plugins/analytics/consts");
@@ -43,6 +45,10 @@ var _documentLogger = require("../utils/document-logger");
43
45
 
44
46
  var _WithEditorView = require("./WithEditorView");
45
47
 
48
+ 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; }
49
+
50
+ 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) { (0, _defineProperty2.default)(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; }
51
+
46
52
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
47
53
 
48
54
  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; } }
@@ -52,16 +58,11 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
52
58
 
53
59
  var _super = _createSuper(ErrorBoundaryWithEditorView);
54
60
 
55
- function ErrorBoundaryWithEditorView() {
61
+ function ErrorBoundaryWithEditorView(props) {
56
62
  var _this;
57
63
 
58
64
  (0, _classCallCheck2.default)(this, ErrorBoundaryWithEditorView);
59
-
60
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
- args[_key] = arguments[_key];
62
- }
63
-
64
- _this = _super.call.apply(_super, [this].concat(args));
65
+ _this = _super.call(this, props);
65
66
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "browserExtensions", undefined);
66
67
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
67
68
  error: undefined
@@ -73,100 +74,135 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
73
74
 
74
75
  return (0, _featureFlagsContext.getFeatureFlags)(editorView.state);
75
76
  }));
76
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireAnalytics", function (analyticsErrorPayload) {
77
- var createAnalyticsEvent = _this.props.createAnalyticsEvent;
78
-
79
- _this.getProductName().then(function (product) {
80
- if (createAnalyticsEvent) {
81
- var error = analyticsErrorPayload.error,
82
- errorInfo = analyticsErrorPayload.errorInfo,
83
- errorStack = analyticsErrorPayload.errorStack;
84
- var sharedId = (0, _uuid.default)();
85
- var event = {
86
- action: _analytics.ACTION.EDITOR_CRASHED,
87
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
88
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
89
- attributes: {
90
- product: product,
91
- browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
92
- error: error,
93
- errorInfo: errorInfo,
94
- errorId: sharedId,
95
- browserExtensions: _this.browserExtensions
96
- }
97
- }; // Add doc structure if the feature flag is on
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sendErrorData", /*#__PURE__*/function () {
78
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(analyticsErrorPayload) {
79
+ var product, error, errorInfo, errorStack, sharedId, attributes, _this$experienceStore;
98
80
 
99
- if (_this.featureFlags.errorBoundaryDocStructure && _this.props.editorView) {
100
- event.attributes.docStructure = (0, _documentLogger.getDocStructure)(_this.props.editorView.state.doc, {
101
- compact: true
102
- });
103
- }
81
+ return _regenerator.default.wrap(function _callee$(_context) {
82
+ while (1) {
83
+ switch (_context.prev = _context.next) {
84
+ case 0:
85
+ _context.next = 2;
86
+ return _this.getProductName();
87
+
88
+ case 2:
89
+ product = _context.sent;
90
+ error = analyticsErrorPayload.error, errorInfo = analyticsErrorPayload.errorInfo, errorStack = analyticsErrorPayload.errorStack;
91
+ sharedId = (0, _uuid.default)();
92
+ attributes = {
93
+ product: product,
94
+ browserInfo: window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : 'unknown',
95
+ error: error,
96
+ errorInfo: errorInfo,
97
+ errorId: sharedId,
98
+ browserExtensions: _this.browserExtensions,
99
+ docStructure: _this.featureFlags.errorBoundaryDocStructure && _this.props.editorView ? (0, _documentLogger.getDocStructure)(_this.props.editorView.state.doc, {
100
+ compact: true
101
+ }) : undefined
102
+ };
103
+
104
+ _this.fireAnalyticsEvent({
105
+ action: _analytics.ACTION.EDITOR_CRASHED,
106
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
107
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
108
+ attributes: attributes
109
+ });
110
+
111
+ _this.fireAnalyticsEvent({
112
+ action: _analytics.ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
113
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
114
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
115
+ attributes: {
116
+ errorStack: errorStack,
117
+ errorId: sharedId
118
+ }
119
+ });
104
120
 
105
- createAnalyticsEvent(event).fire(_consts.editorAnalyticsChannel);
106
- createAnalyticsEvent({
107
- action: _analytics.ACTION.EDITOR_CRASHED_ADDITIONAL_INFORMATION,
108
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
109
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
110
- attributes: {
111
- errorStack: errorStack,
112
- errorId: sharedId
121
+ if (_this.featureFlags.ufo && _this.props.editorView) {
122
+ (_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll(_objectSpread(_objectSpread({}, _this.getExperienceMetadata(attributes)), {}, {
123
+ errorStack: errorStack
124
+ }));
125
+ }
126
+
127
+ case 9:
128
+ case "end":
129
+ return _context.stop();
113
130
  }
114
- }).fire(_consts.editorAnalyticsChannel);
115
- } else {
116
- // eslint-disable-next-line no-console
117
- console.error('Editor Error Boundary: Missing `createAnalyticsEvent` prop.', {
118
- channel: _consts.editorAnalyticsChannel,
119
- product: product,
120
- error: analyticsErrorPayload
121
- });
122
- }
123
- }).catch(function (e) {
124
- // eslint-disable-next-line no-console
125
- console.error('Failed to resolve product name from contextIdentifierProvider.', e);
126
- });
127
- });
128
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getProductName", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
131
+ }
132
+ }, _callee);
133
+ }));
134
+
135
+ return function (_x) {
136
+ return _ref.apply(this, arguments);
137
+ };
138
+ }());
139
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getProductName", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
129
140
  var contextIdentifierProvider, context;
130
- return _regenerator.default.wrap(function _callee$(_context) {
141
+ return _regenerator.default.wrap(function _callee2$(_context2) {
131
142
  while (1) {
132
- switch (_context.prev = _context.next) {
143
+ switch (_context2.prev = _context2.next) {
133
144
  case 0:
134
145
  contextIdentifierProvider = _this.props.contextIdentifierProvider;
135
146
 
136
147
  if (!contextIdentifierProvider) {
137
- _context.next = 7;
148
+ _context2.next = 7;
138
149
  break;
139
150
  }
140
151
 
141
- _context.next = 4;
152
+ _context2.next = 4;
142
153
  return contextIdentifierProvider;
143
154
 
144
155
  case 4:
145
- context = _context.sent;
156
+ context = _context2.sent;
146
157
 
147
158
  if (!context.product) {
148
- _context.next = 7;
159
+ _context2.next = 7;
149
160
  break;
150
161
  }
151
162
 
152
- return _context.abrupt("return", context.product);
163
+ return _context2.abrupt("return", context.product);
153
164
 
154
165
  case 7:
155
- return _context.abrupt("return", 'atlaskit');
166
+ return _context2.abrupt("return", 'atlaskit');
156
167
 
157
168
  case 8:
158
169
  case "end":
159
- return _context.stop();
170
+ return _context2.stop();
160
171
  }
161
172
  }
162
- }, _callee);
173
+ }, _callee2);
163
174
  })));
175
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireAnalyticsEvent", function (event) {
176
+ var _this$props$createAna, _this$props;
177
+
178
+ (_this$props$createAna = (_this$props = _this.props).createAnalyticsEvent) === null || _this$props$createAna === void 0 ? void 0 : _this$props$createAna.call(_this$props, event).fire(_consts.editorAnalyticsChannel);
179
+ });
180
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getExperienceMetadata", function (attributes) {
181
+ var _attributes$browserEx;
182
+
183
+ return {
184
+ browserInfo: attributes.browserInfo,
185
+ error: attributes.error.toString(),
186
+ errorInfo: {
187
+ componentStack: attributes.errorInfo.componentStack
188
+ },
189
+ errorId: attributes.errorId,
190
+ browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
191
+ docStructure: attributes.docStructure
192
+ };
193
+ });
194
+
195
+ if (props.editorView) {
196
+ _this.experienceStore = _ufo.ExperienceStore.getInstance(props.editorView);
197
+ }
198
+
164
199
  return _this;
165
200
  }
166
201
 
167
202
  (0, _createClass2.default)(ErrorBoundaryWithEditorView, [{
168
203
  key: "featureFlags",
169
- get: function get() {
204
+ get: // Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
205
+ function get() {
170
206
  return this.getFeatureFlags(this.props.editorView);
171
207
  }
172
208
  }, {
@@ -174,13 +210,11 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
174
210
  value: function componentDidCatch(error, errorInfo) {
175
211
  var _this2 = this;
176
212
 
177
- // Log the error
178
- this.fireAnalytics({
213
+ this.sendErrorData({
179
214
  error: error.toString(),
180
215
  errorInfo: errorInfo,
181
216
  errorStack: error.stack
182
- }); //
183
- // // Update state to allow a re-render to attempt graceful recovery (in the event that
217
+ }); // // Update state to allow a re-render to attempt graceful recovery (in the event that
184
218
  // // the error was caused by a race condition or is intermittent)
185
219
 
186
220
  this.setState({
@@ -200,12 +234,12 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
200
234
  }, {
201
235
  key: "componentDidMount",
202
236
  value: function () {
203
- var _componentDidMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
204
- return _regenerator.default.wrap(function _callee2$(_context2) {
237
+ var _componentDidMount = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
238
+ return _regenerator.default.wrap(function _callee3$(_context3) {
205
239
  while (1) {
206
- switch (_context2.prev = _context2.next) {
240
+ switch (_context3.prev = _context3.next) {
207
241
  case 0:
208
- _context2.next = 2;
242
+ _context3.next = 2;
209
243
  return (0, _editorCommon.sniffUserBrowserExtensions)({
210
244
  extensions: ['grammarly'],
211
245
  async: true,
@@ -213,14 +247,14 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
213
247
  });
214
248
 
215
249
  case 2:
216
- this.browserExtensions = _context2.sent;
250
+ this.browserExtensions = _context3.sent;
217
251
 
218
252
  case 3:
219
253
  case "end":
220
- return _context2.stop();
254
+ return _context3.stop();
221
255
  }
222
256
  }
223
- }, _callee2, this);
257
+ }, _callee3, this);
224
258
  }));
225
259
 
226
260
  function componentDidMount() {