@atlaskit/editor-core 198.7.1 → 199.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cjs/composable-editor/core-editor.js +3 -14
- package/dist/cjs/composable-editor/hooks/useMeasureEditorMountTime.js +2 -10
- package/dist/cjs/composable-editor/utils/sendDurationAnalytics.js +3 -13
- package/dist/cjs/create-editor/ErrorBoundary.js +3 -27
- package/dist/cjs/create-editor/ReactEditorView.js +1 -59
- package/dist/cjs/create-editor/create-plugins-list.js +4 -3
- package/dist/cjs/create-editor/feature-flags-from-props.js +2 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/core-editor.js +3 -14
- package/dist/es2019/composable-editor/hooks/useMeasureEditorMountTime.js +2 -10
- package/dist/es2019/composable-editor/utils/sendDurationAnalytics.js +1 -11
- package/dist/es2019/create-editor/ErrorBoundary.js +1 -26
- package/dist/es2019/create-editor/ReactEditorView.js +2 -60
- package/dist/es2019/create-editor/create-plugins-list.js +4 -3
- package/dist/es2019/create-editor/feature-flags-from-props.js +2 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/core-editor.js +3 -14
- package/dist/esm/composable-editor/hooks/useMeasureEditorMountTime.js +2 -10
- package/dist/esm/composable-editor/utils/sendDurationAnalytics.js +3 -13
- package/dist/esm/create-editor/ErrorBoundary.js +3 -27
- package/dist/esm/create-editor/ReactEditorView.js +2 -60
- package/dist/esm/create-editor/create-plugins-list.js +4 -3
- package/dist/esm/create-editor/feature-flags-from-props.js +2 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/hooks/useMeasureEditorMountTime.d.ts +1 -3
- package/dist/types/composable-editor/utils/sendDurationAnalytics.d.ts +1 -3
- package/dist/types/create-editor/ErrorBoundary.d.ts +0 -3
- package/dist/types/create-editor/ReactEditorView.d.ts +0 -3
- package/dist/types/create-editor/create-universal-preset.d.ts +13 -0
- package/dist/types/presets/default.d.ts +12 -0
- package/dist/types/presets/universal.d.ts +13 -0
- package/dist/types/presets/useUniversalPreset.d.ts +13 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/composable-editor/hooks/useMeasureEditorMountTime.d.ts +1 -3
- package/dist/types-ts4.5/composable-editor/utils/sendDurationAnalytics.d.ts +1 -3
- package/dist/types-ts4.5/create-editor/ErrorBoundary.d.ts +0 -3
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +0 -3
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +13 -0
- package/dist/types-ts4.5/presets/default.d.ts +12 -0
- package/dist/types-ts4.5/presets/universal.d.ts +13 -0
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +13 -0
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 199.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#154398](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154398)
|
|
8
|
+
[`ca1591355d790`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ca1591355d790) -
|
|
9
|
+
[ux] Allows for passing functions to the quickInsert plugin that allow for capturing element
|
|
10
|
+
insertion metrics and then using that data to change the element sort order
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 199.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- [#154731](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154731)
|
|
21
|
+
[`c07d9c6cecf8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c07d9c6cecf8e) -
|
|
22
|
+
EDF-1411 Removed UFO experience events from Editor.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#154186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154186)
|
|
27
|
+
[`5c316170d29dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c316170d29dd) -
|
|
28
|
+
Bump @atlaskit/adf-schema to 42.3.1
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
|
|
3
31
|
## 198.7.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -15,7 +15,6 @@ var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-contex
|
|
|
15
15
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
16
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
17
17
|
var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
|
|
18
|
-
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
19
18
|
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
20
19
|
var _actions = _interopRequireDefault(require("../actions"));
|
|
21
20
|
var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
|
|
@@ -48,16 +47,11 @@ function Editor(passedProps) {
|
|
|
48
47
|
return new _actions.default();
|
|
49
48
|
}, []);
|
|
50
49
|
var editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
51
|
-
var startTime = (0, _react.useRef)(performance.now());
|
|
52
50
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
53
51
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
54
|
-
var experienceStore = (0, _react.useRef)();
|
|
55
52
|
var handleAnalyticsEvent = (0, _react.useCallback)(function (data) {
|
|
56
53
|
(0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)(data);
|
|
57
54
|
}, [createAnalyticsEvent]);
|
|
58
|
-
var getExperienceStore = (0, _react.useCallback)(function () {
|
|
59
|
-
return experienceStore.current;
|
|
60
|
-
}, []);
|
|
61
55
|
var getFeatureFlagsFromRef = (0, _react.useCallback)(function () {
|
|
62
56
|
return (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(propsRef.current);
|
|
63
57
|
}, []);
|
|
@@ -67,20 +61,15 @@ function Editor(passedProps) {
|
|
|
67
61
|
onEditorReady = _propsRef$current.onEditorReady,
|
|
68
62
|
featureFlags = _propsRef$current.featureFlags;
|
|
69
63
|
editorActions._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, getFeatureFlagsFromRef);
|
|
70
|
-
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
71
|
-
var _experienceStore$curr;
|
|
72
|
-
experienceStore.current = _ufo.ExperienceStore.getInstance(instance.view);
|
|
73
|
-
(_experienceStore$curr = experienceStore.current) === null || _experienceStore$curr === void 0 || _experienceStore$curr.start(_ufo.EditorExperience.loadEditor, startTime.current);
|
|
74
|
-
}
|
|
75
64
|
if (onEditorReady) {
|
|
76
65
|
(0, _performanceMeasures.startMeasure)(_measureEnum.default.ON_EDITOR_READY_CALLBACK);
|
|
77
66
|
onEditorReady(editorActions);
|
|
78
67
|
(0, _performanceMeasures.stopMeasure)(_measureEnum.default.ON_EDITOR_READY_CALLBACK, (0, _sendDurationAnalytics.default)(_analytics.ACTION.ON_EDITOR_READY_CALLBACK, {
|
|
79
68
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
80
69
|
featureFlags: featureFlags
|
|
81
|
-
},
|
|
70
|
+
}, createAnalyticsEvent));
|
|
82
71
|
}
|
|
83
|
-
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef
|
|
72
|
+
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef]);
|
|
84
73
|
var onEditorDestroyed = (0, _react.useCallback)(function (_instance) {
|
|
85
74
|
var onDestroy = propsRef.current.onDestroy;
|
|
86
75
|
editorActions._privateUnregisterEditor();
|
|
@@ -88,7 +77,7 @@ function Editor(passedProps) {
|
|
|
88
77
|
onDestroy();
|
|
89
78
|
}
|
|
90
79
|
}, [editorActions, propsRef]);
|
|
91
|
-
(0, _useMeasureEditorMountTime.default)(props,
|
|
80
|
+
(0, _useMeasureEditorMountTime.default)(props, createAnalyticsEvent);
|
|
92
81
|
var providerFactory = (0, _useProviderFactory.default)(props, editorActions, createAnalyticsEvent);
|
|
93
82
|
var onSaveFromProps = props.onSave;
|
|
94
83
|
var handleSave = (0, _react.useCallback)(function (view) {
|
|
@@ -22,23 +22,15 @@ var _useEditorMeasuresConstructor = _interopRequireDefault(require("./useEditorM
|
|
|
22
22
|
* WARNING: Consider any changes to also make to `src/editor.tsx`
|
|
23
23
|
*
|
|
24
24
|
* @param props EditorProps
|
|
25
|
-
* @param getExperienceStore function to retrieve the Editor's current ExperienceStore
|
|
26
25
|
* @param createAnalyticsEvent
|
|
27
26
|
*/
|
|
28
|
-
function useMeasureEditorMountTime(props,
|
|
27
|
+
function useMeasureEditorMountTime(props, createAnalyticsEvent) {
|
|
29
28
|
(0, _useEditorMeasuresConstructor.default)();
|
|
30
29
|
(0, _react.useEffect)(function () {
|
|
31
|
-
(0, _performanceMeasures.stopMeasure)(_measureEnum.default.EDITOR_MOUNTED, (0, _sendDurationAnalytics.default)(_analytics.ACTION.EDITOR_MOUNTED, props,
|
|
30
|
+
(0, _performanceMeasures.stopMeasure)(_measureEnum.default.EDITOR_MOUNTED, (0, _sendDurationAnalytics.default)(_analytics.ACTION.EDITOR_MOUNTED, props, createAnalyticsEvent));
|
|
32
31
|
return function () {
|
|
33
|
-
var _props$featureFlags;
|
|
34
32
|
(0, _performanceMeasures.clearMeasure)(_measureEnum.default.EDITOR_MOUNTED);
|
|
35
33
|
(0, _performanceMeasures.clearMeasure)(_measureEnum.default.ON_EDITOR_READY_CALLBACK);
|
|
36
|
-
if ((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
37
|
-
var _getExperienceStore;
|
|
38
|
-
(_getExperienceStore = getExperienceStore()) === null || _getExperienceStore === void 0 || _getExperienceStore.abortAll({
|
|
39
|
-
reason: 'editor component unmounted'
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
34
|
};
|
|
43
35
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
44
36
|
// Disable Exhaustive Deps here since we only want to stop the measure on mount.
|
|
@@ -8,22 +8,19 @@ exports.default = sendDurationAnalytics;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
-
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
12
11
|
/**
|
|
13
12
|
*
|
|
14
13
|
* Util function to be used with the Editor component to send duration analytics
|
|
15
14
|
*
|
|
16
15
|
* @param action
|
|
17
16
|
* @param props
|
|
18
|
-
* @param getExperienceStore return the ExperienceStore of the Editor
|
|
19
17
|
* @param getCreateAnalyticsEvent return the CreateUIAnalyticsEvent of the Editor
|
|
20
18
|
* @returns
|
|
21
19
|
*/
|
|
22
|
-
function sendDurationAnalytics(action, props,
|
|
20
|
+
function sendDurationAnalytics(action, props, createAnalyticsEvent) {
|
|
23
21
|
return /*#__PURE__*/function () {
|
|
24
22
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(duration, startTime) {
|
|
25
|
-
var
|
|
26
|
-
var contextIdentifier, objectId, experienceStore;
|
|
23
|
+
var contextIdentifier, objectId;
|
|
27
24
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
28
25
|
while (1) switch (_context.prev = _context.next) {
|
|
29
26
|
case 0:
|
|
@@ -46,14 +43,7 @@ function sendDurationAnalytics(action, props, getExperienceStore, createAnalytic
|
|
|
46
43
|
}
|
|
47
44
|
});
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
experienceStore = getExperienceStore();
|
|
51
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.mark(_ufo.EditorExperience.loadEditor, action, startTime + duration);
|
|
52
|
-
experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(_ufo.EditorExperience.loadEditor, {
|
|
53
|
-
objectId: objectId
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
case 6:
|
|
46
|
+
case 5:
|
|
57
47
|
case "end":
|
|
58
48
|
return _context.stop();
|
|
59
49
|
}
|
|
@@ -20,11 +20,8 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
20
20
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
21
21
|
var _intlErrorBoundary = require("@atlaskit/editor-common/intl-error-boundary");
|
|
22
22
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
23
|
-
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
24
23
|
var _outdatedBrowsers = require("../utils/outdatedBrowsers");
|
|
25
24
|
var _WithEditorView = require("./WithEditorView");
|
|
26
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
25
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
29
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
27
|
var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
|
|
@@ -41,7 +38,7 @@ var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PUR
|
|
|
41
38
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sendErrorData", /*#__PURE__*/function () {
|
|
42
39
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(analyticsErrorPayload) {
|
|
43
40
|
var _window;
|
|
44
|
-
var product, error, errorInfo,
|
|
41
|
+
var product, error, errorInfo, sharedId, browserInfo, attributes;
|
|
45
42
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
46
43
|
while (1) switch (_context.prev = _context.next) {
|
|
47
44
|
case 0:
|
|
@@ -49,7 +46,7 @@ var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PUR
|
|
|
49
46
|
return _this.getProductName();
|
|
50
47
|
case 2:
|
|
51
48
|
product = _context.sent;
|
|
52
|
-
error = analyticsErrorPayload.error, errorInfo = analyticsErrorPayload.errorInfo
|
|
49
|
+
error = analyticsErrorPayload.error, errorInfo = analyticsErrorPayload.errorInfo;
|
|
53
50
|
sharedId = (0, _uuid.default)();
|
|
54
51
|
browserInfo = ((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) || 'unknown';
|
|
55
52
|
attributes = {
|
|
@@ -78,16 +75,11 @@ var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PUR
|
|
|
78
75
|
errorId: sharedId
|
|
79
76
|
}
|
|
80
77
|
});
|
|
81
|
-
if (_this.featureFlags.ufo && _this.props.editorView) {
|
|
82
|
-
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 || _this$experienceStore.failAll(_objectSpread(_objectSpread({}, _this.getExperienceMetadata(attributes)), {}, {
|
|
83
|
-
errorStack: errorStack
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
78
|
(0, _monitoring.logException)(error, {
|
|
87
79
|
location: 'editor-core/create-editor',
|
|
88
80
|
product: product
|
|
89
81
|
});
|
|
90
|
-
case
|
|
82
|
+
case 10:
|
|
91
83
|
case "end":
|
|
92
84
|
return _context.stop();
|
|
93
85
|
}
|
|
@@ -128,23 +120,7 @@ var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PUR
|
|
|
128
120
|
var _this$props$createAna, _this$props;
|
|
129
121
|
(_this$props$createAna = (_this$props = _this.props).createAnalyticsEvent) === null || _this$props$createAna === void 0 || _this$props$createAna.call(_this$props, event).fire(_analytics.editorAnalyticsChannel);
|
|
130
122
|
});
|
|
131
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getExperienceMetadata", function (attributes) {
|
|
132
|
-
var _attributes$browserEx;
|
|
133
|
-
return {
|
|
134
|
-
browserInfo: attributes.browserInfo,
|
|
135
|
-
error: attributes.error.toString(),
|
|
136
|
-
errorInfo: {
|
|
137
|
-
componentStack: attributes.errorInfo.componentStack || undefined
|
|
138
|
-
},
|
|
139
|
-
errorId: attributes.errorId,
|
|
140
|
-
browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
|
|
141
|
-
docStructure: attributes.docStructure
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
123
|
_this.featureFlags = props.featureFlags;
|
|
145
|
-
if (props.editorView) {
|
|
146
|
-
_this.experienceStore = _ufo.ExperienceStore.getInstance(props.editorView);
|
|
147
|
-
}
|
|
148
124
|
return _this;
|
|
149
125
|
}
|
|
150
126
|
(0, _createClass2.default)(ErrorBoundaryWithEditorView, [{
|
|
@@ -25,7 +25,6 @@ var _measureRender = require("@atlaskit/editor-common/performance/measure-render
|
|
|
25
25
|
var _navigation = require("@atlaskit/editor-common/performance/navigation");
|
|
26
26
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
27
27
|
var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
|
|
28
|
-
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
29
28
|
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
30
29
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
31
30
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
@@ -268,7 +267,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
268
267
|
if (!_this.view) {
|
|
269
268
|
return;
|
|
270
269
|
}
|
|
271
|
-
(0, _performanceMeasures.startMeasure)(_trackTransactions.EVENT_NAME_DISPATCH_TRANSACTION);
|
|
272
270
|
var nodes = (0, _findChangedNodesFromTransaction.findChangedNodesFromTransaction)(unsafeTransaction);
|
|
273
271
|
var changedNodesValid = (0, _validateNodes.validateNodes)(nodes);
|
|
274
272
|
var transaction = new Proxy(unsafeTransaction, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
@@ -279,38 +277,23 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
279
277
|
var oldEditorState = _this.view.state;
|
|
280
278
|
|
|
281
279
|
// go ahead and update the state now we know the transaction is good
|
|
282
|
-
(0, _performanceMeasures.startMeasure)(_trackTransactions.EVENT_NAME_STATE_APPLY);
|
|
283
280
|
var _this$view$state$appl = _this.view.state.applyTransaction(transaction),
|
|
284
281
|
editorState = _this$view$state$appl.state,
|
|
285
282
|
transactions = _this$view$state$appl.transactions;
|
|
286
|
-
(0, _performanceMeasures.stopMeasure)(_trackTransactions.EVENT_NAME_STATE_APPLY, function (duration, startTime) {
|
|
287
|
-
var _this$experienceStore;
|
|
288
|
-
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 || _this$experienceStore.mark(_ufo.EditorExperience.interaction, 'stateApply', startTime + duration);
|
|
289
|
-
});
|
|
290
283
|
if (editorState === oldEditorState) {
|
|
291
284
|
return;
|
|
292
285
|
}
|
|
293
|
-
(0, _performanceMeasures.startMeasure)(_trackTransactions.EVENT_NAME_UPDATE_STATE);
|
|
294
286
|
_this.view.updateState(editorState);
|
|
295
|
-
(0, _performanceMeasures.stopMeasure)(_trackTransactions.EVENT_NAME_UPDATE_STATE, function (duration, startTime) {
|
|
296
|
-
var _this$experienceStore2;
|
|
297
|
-
(_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 || _this$experienceStore2.mark(_ufo.EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
298
|
-
});
|
|
299
287
|
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
300
288
|
newEditorState: editorState,
|
|
301
289
|
oldEditorState: oldEditorState
|
|
302
290
|
});
|
|
303
|
-
(0, _performanceMeasures.startMeasure)(_trackTransactions.EVENT_NAME_VIEW_STATE_UPDATED);
|
|
304
291
|
_this.onEditorViewStateUpdated({
|
|
305
292
|
originalTransaction: transaction,
|
|
306
293
|
transactions: transactions,
|
|
307
294
|
oldEditorState: oldEditorState,
|
|
308
295
|
newEditorState: editorState
|
|
309
296
|
});
|
|
310
|
-
(0, _performanceMeasures.stopMeasure)(_trackTransactions.EVENT_NAME_VIEW_STATE_UPDATED, function (duration, startTime) {
|
|
311
|
-
var _this$experienceStore3;
|
|
312
|
-
(_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 || _this$experienceStore3.mark(_ufo.EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
|
|
313
|
-
});
|
|
314
297
|
if (_this.props.editorProps.onChange && transaction.docChanged) {
|
|
315
298
|
var source = transaction.getMeta('isRemote') ? 'remote' : 'local';
|
|
316
299
|
(0, _performanceMeasures.startMeasure)(_trackTransactions.EVENT_NAME_ON_CHANGE);
|
|
@@ -318,8 +301,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
318
301
|
source: source
|
|
319
302
|
});
|
|
320
303
|
(0, _performanceMeasures.stopMeasure)(_trackTransactions.EVENT_NAME_ON_CHANGE, function (duration, startTime) {
|
|
321
|
-
var _this$experienceStore4;
|
|
322
|
-
(_this$experienceStore4 = _this.experienceStore) === null || _this$experienceStore4 === void 0 || _this$experienceStore4.mark(_ufo.EditorExperience.interaction, 'onChange', startTime + duration);
|
|
323
304
|
_this.dispatchAnalyticsEvent({
|
|
324
305
|
action: _analytics.ACTION.ON_CHANGE_CALLBACK,
|
|
325
306
|
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
@@ -332,11 +313,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
332
313
|
});
|
|
333
314
|
}
|
|
334
315
|
_this.editorState = editorState;
|
|
335
|
-
(0, _performanceMeasures.stopMeasure)(_trackTransactions.EVENT_NAME_DISPATCH_TRANSACTION, function (duration, startTime) {
|
|
336
|
-
var _this$experienceStore5, _this$experienceStore6;
|
|
337
|
-
(_this$experienceStore5 = _this.experienceStore) === null || _this$experienceStore5 === void 0 || _this$experienceStore5.mark(_ufo.EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
|
|
338
|
-
(_this$experienceStore6 = _this.experienceStore) === null || _this$experienceStore6 === void 0 || _this$experienceStore6.success(_ufo.EditorExperience.interaction);
|
|
339
|
-
});
|
|
340
316
|
} else {
|
|
341
317
|
var invalidNodes = nodes.filter(function (node) {
|
|
342
318
|
return !(0, _validateNodes.validNode)(node);
|
|
@@ -383,7 +359,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
383
359
|
distortedDuration = _ref3.distortedDuration;
|
|
384
360
|
_this.proseMirrorRenderedSeverity = (0, _analytics2.getAnalyticsEventSeverity)(duration, _consts.PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, _consts.PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD);
|
|
385
361
|
if (_this.view) {
|
|
386
|
-
var _this$pluginInjection2
|
|
362
|
+
var _this$pluginInjection2;
|
|
387
363
|
var nodes = (0, _getNodesCount.getNodesCount)(_this.view.state.doc);
|
|
388
364
|
var ttfb = (0, _navigation.getResponseEndTime)();
|
|
389
365
|
var contextIdentifier = (_this$pluginInjection2 = _this.pluginInjectionAPI.api().base) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.sharedState.currentState();
|
|
@@ -401,14 +377,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
401
377
|
},
|
|
402
378
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
403
379
|
});
|
|
404
|
-
if (!distortedDuration) {
|
|
405
|
-
var _this$experienceStore7;
|
|
406
|
-
(_this$experienceStore7 = _this.experienceStore) === null || _this$experienceStore7 === void 0 || _this$experienceStore7.mark(_ufo.EditorExperience.loadEditor, _analytics.ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
407
|
-
}
|
|
408
|
-
(_this$experienceStore8 = _this.experienceStore) === null || _this$experienceStore8 === void 0 || _this$experienceStore8.addMetadata(_ufo.EditorExperience.loadEditor, {
|
|
409
|
-
nodes: nodes,
|
|
410
|
-
ttfb: ttfb
|
|
411
|
-
});
|
|
412
380
|
}
|
|
413
381
|
});
|
|
414
382
|
|
|
@@ -435,32 +403,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
435
403
|
if (_this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
|
|
436
404
|
_this.focusTimeoutId = handleEditorFocus(view);
|
|
437
405
|
}
|
|
438
|
-
if (_this.featureFlags.ufo) {
|
|
439
|
-
_this.experienceStore = _ufo.ExperienceStore.getInstance(view);
|
|
440
|
-
_this.experienceStore.start(_ufo.EditorExperience.editSession);
|
|
441
|
-
_this.experienceStore.addMetadata(_ufo.EditorExperience.editSession, {
|
|
442
|
-
reliabilityInterval: _ufo.RELIABILITY_INTERVAL
|
|
443
|
-
});
|
|
444
|
-
_this.reliabilityInterval = window.setInterval(function () {
|
|
445
|
-
var _this$experienceStore9;
|
|
446
|
-
(_this$experienceStore9 = _this.experienceStore) === null || _this$experienceStore9 === void 0 || (_this$experienceStore9 = _this$experienceStore9.success(_ufo.EditorExperience.editSession)) === null || _this$experienceStore9 === void 0 || _this$experienceStore9.finally(function () {
|
|
447
|
-
var _this$experienceStore10, _this$experienceStore11;
|
|
448
|
-
(_this$experienceStore10 = _this.experienceStore) === null || _this$experienceStore10 === void 0 || _this$experienceStore10.start(_ufo.EditorExperience.editSession);
|
|
449
|
-
(_this$experienceStore11 = _this.experienceStore) === null || _this$experienceStore11 === void 0 || _this$experienceStore11.addMetadata(_ufo.EditorExperience.editSession, {
|
|
450
|
-
reliabilityInterval: _ufo.RELIABILITY_INTERVAL
|
|
451
|
-
});
|
|
452
|
-
});
|
|
453
|
-
var reliabilityEvent = {
|
|
454
|
-
action: _analytics.ACTION.UFO_SESSION_COMPLETE,
|
|
455
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
456
|
-
attributes: {
|
|
457
|
-
interval: _ufo.RELIABILITY_INTERVAL
|
|
458
|
-
},
|
|
459
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
460
|
-
};
|
|
461
|
-
_this.dispatchAnalyticsEvent(reliabilityEvent);
|
|
462
|
-
}, _ufo.RELIABILITY_INTERVAL);
|
|
463
|
-
}
|
|
464
406
|
|
|
465
407
|
// Force React to re-render so consumers get a reference to the editor view
|
|
466
408
|
_this.forceUpdate();
|
|
@@ -46,8 +46,7 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent
|
|
|
46
46
|
},
|
|
47
47
|
base: {
|
|
48
48
|
allowInlineCursorTarget: true,
|
|
49
|
-
allowScrollGutter: getScrollGutterOptions(props)
|
|
50
|
-
ufo: (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props).ufo
|
|
49
|
+
allowScrollGutter: getScrollGutterOptions(props)
|
|
51
50
|
},
|
|
52
51
|
blockType: {
|
|
53
52
|
lastNodeMustBeParagraph: appearance === 'comment' || appearance === 'chromeless',
|
|
@@ -67,7 +66,9 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent
|
|
|
67
66
|
elementBrowserHelpUrl: props.elementBrowser && props.elementBrowser.helpUrl,
|
|
68
67
|
disableDefaultItems: false,
|
|
69
68
|
headless: false,
|
|
70
|
-
emptyStateHandler: props.elementBrowser && props.elementBrowser.emptyStateHandler
|
|
69
|
+
emptyStateHandler: props.elementBrowser && props.elementBrowser.emptyStateHandler,
|
|
70
|
+
prioritySortingFn: props.quickInsert && typeof props.quickInsert !== 'boolean' && props.quickInsert.prioritySortingFn || undefined,
|
|
71
|
+
onInsert: props.quickInsert && typeof props.quickInsert !== 'boolean' && props.quickInsert.onInsert || undefined
|
|
71
72
|
},
|
|
72
73
|
selection: {
|
|
73
74
|
useLongPressSelection: false
|
|
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
|
|
|
32
32
|
* which is used by both current and archv3 editors.
|
|
33
33
|
*/
|
|
34
34
|
function createFeatureFlagsFromProps(props) {
|
|
35
|
-
var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$
|
|
35
|
+
var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$collabEdit, _props$collabEdit2;
|
|
36
36
|
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
37
37
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
38
38
|
catchAllTracking: false,
|
|
@@ -41,8 +41,7 @@ function createFeatureFlagsFromProps(props) {
|
|
|
41
41
|
synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags5 = props.featureFlags) === null || _props$featureFlags5 === void 0 ? void 0 : _props$featureFlags5.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags6 = props.featureFlags) !== null && _props$featureFlags6 !== void 0 && _props$featureFlags6.synchronyErrorDocStructure) : false),
|
|
42
42
|
enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags7 = props.featureFlags) === null || _props$featureFlags7 === void 0 ? void 0 : _props$featureFlags7.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.enableViewUpdateSubscription) : false),
|
|
43
43
|
collabAvatarScroll: Boolean(typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.collabAvatarScroll) : false),
|
|
44
|
-
|
|
45
|
-
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
|
|
44
|
+
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.twoLineEditorToolbar) : false),
|
|
46
45
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
47
46
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags)
|
|
48
47
|
});
|
|
@@ -13,7 +13,6 @@ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-con
|
|
|
13
13
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
14
14
|
import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
16
|
-
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
17
16
|
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
|
|
18
17
|
import EditorActions from '../actions';
|
|
19
18
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
@@ -38,17 +37,12 @@ function Editor(passedProps) {
|
|
|
38
37
|
const editorContext = useEditorContext();
|
|
39
38
|
const editorActionsPlaceholderInstance = useMemo(() => new EditorActions(), []);
|
|
40
39
|
const editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
41
|
-
const startTime = useRef(performance.now());
|
|
42
40
|
const {
|
|
43
41
|
createAnalyticsEvent
|
|
44
42
|
} = useAnalyticsEvents();
|
|
45
|
-
const experienceStore = useRef();
|
|
46
43
|
const handleAnalyticsEvent = useCallback(data => {
|
|
47
44
|
fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
48
45
|
}, [createAnalyticsEvent]);
|
|
49
|
-
const getExperienceStore = useCallback(() => {
|
|
50
|
-
return experienceStore.current;
|
|
51
|
-
}, []);
|
|
52
46
|
const getFeatureFlagsFromRef = useCallback(() => {
|
|
53
47
|
return createFeatureFlagsFromProps(propsRef.current);
|
|
54
48
|
}, []);
|
|
@@ -59,20 +53,15 @@ function Editor(passedProps) {
|
|
|
59
53
|
featureFlags
|
|
60
54
|
} = propsRef.current;
|
|
61
55
|
editorActions._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, getFeatureFlagsFromRef);
|
|
62
|
-
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
63
|
-
var _experienceStore$curr;
|
|
64
|
-
experienceStore.current = ExperienceStore.getInstance(instance.view);
|
|
65
|
-
(_experienceStore$curr = experienceStore.current) === null || _experienceStore$curr === void 0 ? void 0 : _experienceStore$curr.start(EditorExperience.loadEditor, startTime.current);
|
|
66
|
-
}
|
|
67
56
|
if (onEditorReady) {
|
|
68
57
|
startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
69
58
|
onEditorReady(editorActions);
|
|
70
59
|
stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK, {
|
|
71
60
|
contextIdentifierProvider,
|
|
72
61
|
featureFlags
|
|
73
|
-
},
|
|
62
|
+
}, createAnalyticsEvent));
|
|
74
63
|
}
|
|
75
|
-
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef
|
|
64
|
+
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef]);
|
|
76
65
|
const onEditorDestroyed = useCallback(_instance => {
|
|
77
66
|
const {
|
|
78
67
|
onDestroy
|
|
@@ -82,7 +71,7 @@ function Editor(passedProps) {
|
|
|
82
71
|
onDestroy();
|
|
83
72
|
}
|
|
84
73
|
}, [editorActions, propsRef]);
|
|
85
|
-
useMeasureEditorMountTime(props,
|
|
74
|
+
useMeasureEditorMountTime(props, createAnalyticsEvent);
|
|
86
75
|
const providerFactory = useProviderFactory(props, editorActions, createAnalyticsEvent);
|
|
87
76
|
const {
|
|
88
77
|
onSave: onSaveFromProps
|
|
@@ -15,23 +15,15 @@ import useEditorConstructor from './useEditorMeasuresConstructor';
|
|
|
15
15
|
* WARNING: Consider any changes to also make to `src/editor.tsx`
|
|
16
16
|
*
|
|
17
17
|
* @param props EditorProps
|
|
18
|
-
* @param getExperienceStore function to retrieve the Editor's current ExperienceStore
|
|
19
18
|
* @param createAnalyticsEvent
|
|
20
19
|
*/
|
|
21
|
-
export default function useMeasureEditorMountTime(props,
|
|
20
|
+
export default function useMeasureEditorMountTime(props, createAnalyticsEvent) {
|
|
22
21
|
useEditorConstructor();
|
|
23
22
|
useEffect(() => {
|
|
24
|
-
stopMeasure(measurements.EDITOR_MOUNTED, sendDurationAnalytics(ACTION.EDITOR_MOUNTED, props,
|
|
23
|
+
stopMeasure(measurements.EDITOR_MOUNTED, sendDurationAnalytics(ACTION.EDITOR_MOUNTED, props, createAnalyticsEvent));
|
|
25
24
|
return () => {
|
|
26
|
-
var _props$featureFlags;
|
|
27
25
|
clearMeasure(measurements.EDITOR_MOUNTED);
|
|
28
26
|
clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
29
|
-
if ((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
30
|
-
var _getExperienceStore;
|
|
31
|
-
(_getExperienceStore = getExperienceStore()) === null || _getExperienceStore === void 0 ? void 0 : _getExperienceStore.abortAll({
|
|
32
|
-
reason: 'editor component unmounted'
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
27
|
};
|
|
36
28
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37
29
|
// Disable Exhaustive Deps here since we only want to stop the measure on mount.
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { EditorExperience } from '@atlaskit/editor-common/ufo';
|
|
3
2
|
/**
|
|
4
3
|
*
|
|
5
4
|
* Util function to be used with the Editor component to send duration analytics
|
|
6
5
|
*
|
|
7
6
|
* @param action
|
|
8
7
|
* @param props
|
|
9
|
-
* @param getExperienceStore return the ExperienceStore of the Editor
|
|
10
8
|
* @param getCreateAnalyticsEvent return the CreateUIAnalyticsEvent of the Editor
|
|
11
9
|
* @returns
|
|
12
10
|
*/
|
|
13
|
-
export default function sendDurationAnalytics(action, props,
|
|
11
|
+
export default function sendDurationAnalytics(action, props, createAnalyticsEvent) {
|
|
14
12
|
return async (duration, startTime) => {
|
|
15
|
-
var _props$featureFlags;
|
|
16
13
|
const contextIdentifier = await props.contextIdentifierProvider;
|
|
17
14
|
const objectId = contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId;
|
|
18
15
|
if (createAnalyticsEvent) {
|
|
@@ -29,12 +26,5 @@ export default function sendDurationAnalytics(action, props, getExperienceStore,
|
|
|
29
26
|
}
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
|
-
if ((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
33
|
-
const experienceStore = getExperienceStore();
|
|
34
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.mark(EditorExperience.loadEditor, action, startTime + duration);
|
|
35
|
-
experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.loadEditor, {
|
|
36
|
-
objectId
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
29
|
};
|
|
40
30
|
}
|
|
@@ -5,7 +5,6 @@ import { ACTION, ACTION_SUBJECT, editorAnalyticsChannel, EVENT_TYPE } from '@atl
|
|
|
5
5
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
6
6
|
import { IntlErrorBoundary } from '@atlaskit/editor-common/intl-error-boundary';
|
|
7
7
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
8
|
-
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
9
8
|
import { isOutdatedBrowser } from '../utils/outdatedBrowsers';
|
|
10
9
|
import { WithEditorView } from './WithEditorView';
|
|
11
10
|
export class ErrorBoundaryWithEditorView extends React.Component {
|
|
@@ -20,8 +19,7 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
20
19
|
const product = await this.getProductName();
|
|
21
20
|
const {
|
|
22
21
|
error,
|
|
23
|
-
errorInfo
|
|
24
|
-
errorStack
|
|
22
|
+
errorInfo
|
|
25
23
|
} = analyticsErrorPayload;
|
|
26
24
|
const sharedId = uuid();
|
|
27
25
|
const browserInfo = ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) || 'unknown';
|
|
@@ -51,13 +49,6 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
51
49
|
errorId: sharedId
|
|
52
50
|
}
|
|
53
51
|
});
|
|
54
|
-
if (this.featureFlags.ufo && this.props.editorView) {
|
|
55
|
-
var _this$experienceStore;
|
|
56
|
-
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.failAll({
|
|
57
|
-
...this.getExperienceMetadata(attributes),
|
|
58
|
-
errorStack
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
52
|
logException(error, {
|
|
62
53
|
location: 'editor-core/create-editor',
|
|
63
54
|
product
|
|
@@ -79,23 +70,7 @@ export class ErrorBoundaryWithEditorView extends React.Component {
|
|
|
79
70
|
var _this$props$createAna, _this$props;
|
|
80
71
|
(_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);
|
|
81
72
|
});
|
|
82
|
-
_defineProperty(this, "getExperienceMetadata", attributes => {
|
|
83
|
-
var _attributes$browserEx;
|
|
84
|
-
return {
|
|
85
|
-
browserInfo: attributes.browserInfo,
|
|
86
|
-
error: attributes.error.toString(),
|
|
87
|
-
errorInfo: {
|
|
88
|
-
componentStack: attributes.errorInfo.componentStack || undefined
|
|
89
|
-
},
|
|
90
|
-
errorId: attributes.errorId,
|
|
91
|
-
browserExtensions: (_attributes$browserEx = attributes.browserExtensions) === null || _attributes$browserEx === void 0 ? void 0 : _attributes$browserEx.toString(),
|
|
92
|
-
docStructure: attributes.docStructure
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
73
|
this.featureFlags = props.featureFlags;
|
|
96
|
-
if (props.editorView) {
|
|
97
|
-
this.experienceStore = ExperienceStore.getInstance(props.editorView);
|
|
98
|
-
}
|
|
99
74
|
}
|
|
100
75
|
componentDidCatch(error, errorInfo) {
|
|
101
76
|
// Only report and re-render once, to avoid over-reporting errors and infinite rerendering
|