@atlaskit/editor-core 234.0.0 → 234.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 +17 -0
- package/dist/cjs/composable-editor/core-editor.js +4 -0
- package/dist/cjs/composable-editor/editor-internal.js +16 -1
- package/dist/cjs/create-editor/ReactEditorView.js +9 -1
- package/dist/cjs/utils/performance/components/RenderTracking.js +44 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/core-editor.js +5 -1
- package/dist/es2019/composable-editor/editor-internal.js +16 -1
- package/dist/es2019/create-editor/ReactEditorView.js +9 -1
- package/dist/es2019/utils/performance/components/RenderTracking.js +36 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/core-editor.js +5 -1
- package/dist/esm/composable-editor/editor-internal.js +16 -1
- package/dist/esm/create-editor/ReactEditorView.js +9 -1
- package/dist/esm/utils/performance/components/RenderTracking.js +37 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/editor-internal.d.ts +2 -0
- package/dist/types/presets/universal.d.ts +2 -3
- package/dist/types/utils/performance/components/RenderTracking.d.ts +13 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 234.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`efadf6d4a1214`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/efadf6d4a1214) -
|
|
8
|
+
The universal preset's initialPluginConfiguration.quickInsertPlugin now accepts isRecommendedItem,
|
|
9
|
+
so consumers can curate or hide the Recommended section of the slash command menu (behind
|
|
10
|
+
platform_editor_slash_command).
|
|
11
|
+
|
|
12
|
+
## 234.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`b31a1d76b3076`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b31a1d76b3076) -
|
|
17
|
+
Restore render tracking behind the opt-in platform_editor_enable_rerender_tracking experiment.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 234.0.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -50,6 +50,9 @@ function Editor(passedProps) {
|
|
|
50
50
|
var editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
51
51
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
52
52
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
53
|
+
var handleAnalyticsEvent = (0, _react.useCallback)(function (data) {
|
|
54
|
+
(0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)(data);
|
|
55
|
+
}, [createAnalyticsEvent]);
|
|
53
56
|
var getFeatureFlagsFromRef = (0, _react.useCallback)(function () {
|
|
54
57
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
55
58
|
return _objectSpread(_objectSpread({}, (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(propsRef.current.featureFlags)), {}, {
|
|
@@ -88,6 +91,7 @@ function Editor(passedProps) {
|
|
|
88
91
|
}, [onSaveFromProps]);
|
|
89
92
|
return /*#__PURE__*/_react.default.createElement(_editorInternal.EditorInternal, {
|
|
90
93
|
props: props,
|
|
94
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
91
95
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
92
96
|
preset: props.preset,
|
|
93
97
|
handleSave: handleSave,
|
|
@@ -9,8 +9,10 @@ exports.EditorInternal = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
13
|
var _portal = require("@atlaskit/editor-common/portal");
|
|
13
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
16
|
var _componentWithCondition = require("@atlaskit/platform-feature-flags-react/component-with-condition");
|
|
15
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
18
|
var _ErrorBoundary = _interopRequireDefault(require("../create-editor/ErrorBoundary"));
|
|
@@ -18,6 +20,7 @@ var _ReactEditorView = _interopRequireDefault(require("../create-editor/ReactEdi
|
|
|
18
20
|
var _EditorContext = _interopRequireDefault(require("../ui/EditorContext"));
|
|
19
21
|
var _IntlProviderIfMissingWrapper = require("../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper");
|
|
20
22
|
var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
|
|
23
|
+
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
21
24
|
var _BaseThemeWrapper = require("./BaseThemeWrapper");
|
|
22
25
|
var _editorInternalCompiled = require("./editor-internal-compiled");
|
|
23
26
|
var _editorInternalEmotion = require("./editor-internal-emotion");
|
|
@@ -28,12 +31,15 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
31
|
var EditorInternalContainerMigration = (0, _componentWithCondition.componentWithCondition)(function () {
|
|
29
32
|
return (0, _expValEquals.expValEquals)('platform_editor_core_non_ecc_static_css', 'isEnabled', true);
|
|
30
33
|
}, _editorInternalCompiled.EditorInternalContainerCompiled, _editorInternalEmotion.EditorInternalContainerEmotion);
|
|
34
|
+
var DEFAULT_VALUE_PROP_TO_IGNORE = ['defaultValue'];
|
|
35
|
+
|
|
31
36
|
/**
|
|
32
37
|
* EditorInternalComponent is used to capture the common component
|
|
33
38
|
* from the `render` method of `Editor` and share it with `EditorNext`.
|
|
34
39
|
*/
|
|
35
40
|
var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
36
41
|
var props = _ref.props,
|
|
42
|
+
handleAnalyticsEvent = _ref.handleAnalyticsEvent,
|
|
37
43
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
38
44
|
handleSave = _ref.handleSave,
|
|
39
45
|
editorActions = _ref.editorActions,
|
|
@@ -48,6 +54,7 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
|
|
|
48
54
|
analyticsHandler: undefined
|
|
49
55
|
});
|
|
50
56
|
var featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props.featureFlags);
|
|
57
|
+
var renderTrackingEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
51
58
|
var _usePortalProvider = (0, _portal.usePortalProvider)(),
|
|
52
59
|
_usePortalProvider2 = (0, _slicedToArray2.default)(_usePortalProvider, 2),
|
|
53
60
|
portalProviderAPI = _usePortalProvider2[0],
|
|
@@ -56,13 +63,21 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
|
|
|
56
63
|
_usePortalProvider4 = (0, _slicedToArray2.default)(_usePortalProvider3, 2),
|
|
57
64
|
nodeViewPortalProviderAPI = _usePortalProvider4[0],
|
|
58
65
|
NodeViewPortalRenderer = _usePortalProvider4[1];
|
|
66
|
+
var propsToIgnore = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? DEFAULT_VALUE_PROP_TO_IGNORE : ['defaultValue'];
|
|
59
67
|
var baseFontSize = (0, _getBaseFontSize.getBaseFontSize)(props.appearance, props.contentMode);
|
|
60
68
|
var fontSize = (0, _editorSharedStyles.editorFontSize)({
|
|
61
69
|
theme: {
|
|
62
70
|
baseFontSize: baseFontSize
|
|
63
71
|
}
|
|
64
72
|
});
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, renderTrackingEnabled && /*#__PURE__*/_react.default.createElement(_RenderTracking.RenderTracking, {
|
|
74
|
+
componentProps: props,
|
|
75
|
+
action: _analytics.ACTION.RE_RENDERED,
|
|
76
|
+
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
77
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
78
|
+
propsToIgnore: propsToIgnore,
|
|
79
|
+
useShallow: false
|
|
80
|
+
}), /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, {
|
|
66
81
|
errorTracking: true,
|
|
67
82
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
68
83
|
contextIdentifierProvider: props.contextIdentifierProvider,
|
|
@@ -48,6 +48,7 @@ var _getNodesCountWithExtensionKeys = require("../utils/getNodesCountWithExtensi
|
|
|
48
48
|
var _getNodesVisibleInViewport = require("../utils/getNodesVisibleInViewport");
|
|
49
49
|
var _isChromeless = require("../utils/is-chromeless");
|
|
50
50
|
var _isFullPage = require("../utils/is-full-page");
|
|
51
|
+
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
51
52
|
var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
|
|
52
53
|
var _consts = require("./consts");
|
|
53
54
|
var _createEditor = require("./create-editor");
|
|
@@ -1193,13 +1194,20 @@ function ReactEditorView(props) {
|
|
|
1193
1194
|
// We should follow-up
|
|
1194
1195
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1195
1196
|
[props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy, ssrEditor]);
|
|
1197
|
+
var renderTrackingEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
1196
1198
|
return /*#__PURE__*/_react.default.createElement(_ssrMeasures.SSRRenderMeasure, {
|
|
1197
1199
|
segmentName: SSR_TRACE_SEGMENT_NAME,
|
|
1198
1200
|
startTimestampRef: firstRenderStartTimestampRef,
|
|
1199
1201
|
onSSRMeasure: onSSRMeasure
|
|
1200
1202
|
}, /*#__PURE__*/_react.default.createElement(_uiReact.ReactEditorViewContext.Provider, {
|
|
1201
1203
|
value: reactEditorViewContext
|
|
1202
|
-
},
|
|
1204
|
+
}, renderTrackingEnabled && /*#__PURE__*/_react.default.createElement(_RenderTracking.RenderTracking, {
|
|
1205
|
+
componentProps: props,
|
|
1206
|
+
action: _analytics.ACTION.RE_RENDERED,
|
|
1207
|
+
actionSubject: _analytics.ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
1208
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
1209
|
+
useShallow: true
|
|
1210
|
+
}), props.render ? (_props$render = (_props$render2 = props.render) === null || _props$render2 === void 0 ? void 0 : _props$render2.call(props, {
|
|
1203
1211
|
editor: editor,
|
|
1204
1212
|
view: viewRef.current,
|
|
1205
1213
|
config: config.current,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.RenderTracking = RenderTracking;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _useComponentRenderTracking = require("@atlaskit/editor-common/use-component-render-tracking");
|
|
12
|
+
function RenderTracking(props) {
|
|
13
|
+
var debouncedHandleAnalyticsEvent = (0, _react.useMemo)(function () {
|
|
14
|
+
return (0, _debounce.default)(props.handleAnalyticsEvent, 500);
|
|
15
|
+
}, [props.handleAnalyticsEvent]);
|
|
16
|
+
(0, _useComponentRenderTracking.useComponentRenderTracking)({
|
|
17
|
+
onRender: function onRender(_ref) {
|
|
18
|
+
var renderCount = _ref.renderCount,
|
|
19
|
+
propsDifference = _ref.propsDifference;
|
|
20
|
+
if (!renderCount) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
debouncedHandleAnalyticsEvent({
|
|
24
|
+
payload: {
|
|
25
|
+
action: props.action,
|
|
26
|
+
actionSubject: props.actionSubject,
|
|
27
|
+
attributes: {
|
|
28
|
+
count: renderCount,
|
|
29
|
+
propsDifference: propsDifference
|
|
30
|
+
},
|
|
31
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
propsDiffingOptions: {
|
|
36
|
+
enabled: true,
|
|
37
|
+
props: props.componentProps,
|
|
38
|
+
propsToIgnore: props.propsToIgnore,
|
|
39
|
+
useShallow: props.useShallow
|
|
40
|
+
},
|
|
41
|
+
zeroBasedCount: true
|
|
42
|
+
});
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
8
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
|
-
var version = exports.version = "
|
|
9
|
+
var version = exports.version = "234.0.1";
|
|
@@ -5,7 +5,7 @@ import isEqual from 'lodash/isEqual';
|
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
6
6
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
|
|
7
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
8
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
10
10
|
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
|
|
11
11
|
import EditorActions from '../actions';
|
|
@@ -38,6 +38,9 @@ function Editor(passedProps) {
|
|
|
38
38
|
const {
|
|
39
39
|
createAnalyticsEvent
|
|
40
40
|
} = useAnalyticsEvents();
|
|
41
|
+
const handleAnalyticsEvent = useCallback(data => {
|
|
42
|
+
fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
43
|
+
}, [createAnalyticsEvent]);
|
|
41
44
|
const getFeatureFlagsFromRef = useCallback(() => {
|
|
42
45
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
43
46
|
return {
|
|
@@ -82,6 +85,7 @@ function Editor(passedProps) {
|
|
|
82
85
|
}, [onSaveFromProps]);
|
|
83
86
|
return /*#__PURE__*/React.createElement(EditorInternal, {
|
|
84
87
|
props: props,
|
|
88
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
85
89
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
86
90
|
preset: props.preset,
|
|
87
91
|
handleSave: handleSave,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { Fragment, memo } from 'react';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { usePortalProvider } from '@atlaskit/editor-common/portal';
|
|
3
4
|
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
6
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
5
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
8
|
import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
@@ -8,17 +10,21 @@ import ReactEditorViewNext from '../create-editor/ReactEditorView';
|
|
|
8
10
|
import EditorContext from '../ui/EditorContext';
|
|
9
11
|
import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
|
|
10
12
|
import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
|
|
13
|
+
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
11
14
|
import { BaseThemeWrapper } from './BaseThemeWrapper';
|
|
12
15
|
import { EditorInternalContainerCompiled } from './editor-internal-compiled';
|
|
13
16
|
import { EditorInternalContainerEmotion } from './editor-internal-emotion';
|
|
14
17
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
15
18
|
const EditorInternalContainerMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), EditorInternalContainerCompiled, EditorInternalContainerEmotion);
|
|
19
|
+
const DEFAULT_VALUE_PROP_TO_IGNORE = ['defaultValue'];
|
|
20
|
+
|
|
16
21
|
/**
|
|
17
22
|
* EditorInternalComponent is used to capture the common component
|
|
18
23
|
* from the `render` method of `Editor` and share it with `EditorNext`.
|
|
19
24
|
*/
|
|
20
25
|
export const EditorInternal = /*#__PURE__*/memo(({
|
|
21
26
|
props,
|
|
27
|
+
handleAnalyticsEvent,
|
|
22
28
|
createAnalyticsEvent,
|
|
23
29
|
handleSave,
|
|
24
30
|
editorActions,
|
|
@@ -35,15 +41,24 @@ export const EditorInternal = /*#__PURE__*/memo(({
|
|
|
35
41
|
analyticsHandler: undefined
|
|
36
42
|
};
|
|
37
43
|
const featureFlags = createFeatureFlagsFromProps(props.featureFlags);
|
|
44
|
+
const renderTrackingEnabled = isExperimentEnabled('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
38
45
|
const [portalProviderAPI, PortalRenderer] = usePortalProvider();
|
|
39
46
|
const [nodeViewPortalProviderAPI, NodeViewPortalRenderer] = usePortalProvider();
|
|
47
|
+
const propsToIgnore = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? DEFAULT_VALUE_PROP_TO_IGNORE : ['defaultValue'];
|
|
40
48
|
const baseFontSize = getBaseFontSize(props.appearance, props.contentMode);
|
|
41
49
|
const fontSize = editorFontSize({
|
|
42
50
|
theme: {
|
|
43
51
|
baseFontSize
|
|
44
52
|
}
|
|
45
53
|
});
|
|
46
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
54
|
+
return /*#__PURE__*/React.createElement(Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
55
|
+
componentProps: props,
|
|
56
|
+
action: ACTION.RE_RENDERED,
|
|
57
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
58
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
59
|
+
propsToIgnore: propsToIgnore,
|
|
60
|
+
useShallow: false
|
|
61
|
+
}), /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
47
62
|
errorTracking: true,
|
|
48
63
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
49
64
|
contextIdentifierProvider: props.contextIdentifierProvider,
|
|
@@ -37,6 +37,7 @@ import { getNodesCountWithExtensionKeys } from '../utils/getNodesCountWithExtens
|
|
|
37
37
|
import { getNodesVisibleInViewport } from '../utils/getNodesVisibleInViewport';
|
|
38
38
|
import { isChromeless } from '../utils/is-chromeless';
|
|
39
39
|
import { isFullPage } from '../utils/is-full-page';
|
|
40
|
+
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
40
41
|
import measurements from '../utils/performance/measure-enum';
|
|
41
42
|
import { PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD } from './consts';
|
|
42
43
|
import { processPluginsList } from './create-editor';
|
|
@@ -1109,13 +1110,20 @@ export function ReactEditorView(props) {
|
|
|
1109
1110
|
// We should follow-up
|
|
1110
1111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1111
1112
|
[props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy, ssrEditor]);
|
|
1113
|
+
const renderTrackingEnabled = isExperimentEnabled('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
1112
1114
|
return /*#__PURE__*/React.createElement(SSRRenderMeasure, {
|
|
1113
1115
|
segmentName: SSR_TRACE_SEGMENT_NAME,
|
|
1114
1116
|
startTimestampRef: firstRenderStartTimestampRef,
|
|
1115
1117
|
onSSRMeasure: onSSRMeasure
|
|
1116
1118
|
}, /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
1117
1119
|
value: reactEditorViewContext
|
|
1118
|
-
},
|
|
1120
|
+
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
1121
|
+
componentProps: props,
|
|
1122
|
+
action: ACTION.RE_RENDERED,
|
|
1123
|
+
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
1124
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
1125
|
+
useShallow: true
|
|
1126
|
+
}), props.render ? (_props$render = (_props$render2 = props.render) === null || _props$render2 === void 0 ? void 0 : _props$render2.call(props, {
|
|
1119
1127
|
editor,
|
|
1120
1128
|
view: viewRef.current,
|
|
1121
1129
|
config: config.current,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
|
+
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useComponentRenderTracking } from '@atlaskit/editor-common/use-component-render-tracking';
|
|
5
|
+
export function RenderTracking(props) {
|
|
6
|
+
const debouncedHandleAnalyticsEvent = useMemo(() => debounce(props.handleAnalyticsEvent, 500), [props.handleAnalyticsEvent]);
|
|
7
|
+
useComponentRenderTracking({
|
|
8
|
+
onRender: ({
|
|
9
|
+
renderCount,
|
|
10
|
+
propsDifference
|
|
11
|
+
}) => {
|
|
12
|
+
if (!renderCount) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
debouncedHandleAnalyticsEvent({
|
|
16
|
+
payload: {
|
|
17
|
+
action: props.action,
|
|
18
|
+
actionSubject: props.actionSubject,
|
|
19
|
+
attributes: {
|
|
20
|
+
count: renderCount,
|
|
21
|
+
propsDifference: propsDifference
|
|
22
|
+
},
|
|
23
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
propsDiffingOptions: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
props: props.componentProps,
|
|
30
|
+
propsToIgnore: props.propsToIgnore,
|
|
31
|
+
useShallow: props.useShallow
|
|
32
|
+
},
|
|
33
|
+
zeroBasedCount: true
|
|
34
|
+
});
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
@@ -8,7 +8,7 @@ import isEqual from 'lodash/isEqual';
|
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
9
9
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext';
|
|
10
10
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
11
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
11
|
+
import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
13
13
|
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
|
|
14
14
|
import EditorActions from '../actions';
|
|
@@ -42,6 +42,9 @@ function Editor(passedProps) {
|
|
|
42
42
|
var editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
43
43
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
44
44
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
45
|
+
var handleAnalyticsEvent = useCallback(function (data) {
|
|
46
|
+
fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
47
|
+
}, [createAnalyticsEvent]);
|
|
45
48
|
var getFeatureFlagsFromRef = useCallback(function () {
|
|
46
49
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
47
50
|
return _objectSpread(_objectSpread({}, createFeatureFlagsFromProps(propsRef.current.featureFlags)), {}, {
|
|
@@ -80,6 +83,7 @@ function Editor(passedProps) {
|
|
|
80
83
|
}, [onSaveFromProps]);
|
|
81
84
|
return /*#__PURE__*/React.createElement(EditorInternal, {
|
|
82
85
|
props: props,
|
|
86
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
83
87
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
84
88
|
preset: props.preset,
|
|
85
89
|
handleSave: handleSave,
|
|
@@ -3,8 +3,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
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; }
|
|
4
4
|
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) { _defineProperty(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; }
|
|
5
5
|
import React, { Fragment, memo } from 'react';
|
|
6
|
+
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import { usePortalProvider } from '@atlaskit/editor-common/portal';
|
|
7
8
|
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
9
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
10
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
9
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
12
|
import ErrorBoundary from '../create-editor/ErrorBoundary';
|
|
@@ -12,6 +14,7 @@ import ReactEditorViewNext from '../create-editor/ReactEditorView';
|
|
|
12
14
|
import EditorContext from '../ui/EditorContext';
|
|
13
15
|
import { IntlProviderIfMissingWrapper } from '../ui/IntlProviderIfMissingWrapper/IntlProviderIfMissingWrapper';
|
|
14
16
|
import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
|
|
17
|
+
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
15
18
|
import { BaseThemeWrapper } from './BaseThemeWrapper';
|
|
16
19
|
import { EditorInternalContainerCompiled } from './editor-internal-compiled';
|
|
17
20
|
import { EditorInternalContainerEmotion } from './editor-internal-emotion';
|
|
@@ -19,12 +22,15 @@ import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
|
19
22
|
var EditorInternalContainerMigration = componentWithCondition(function () {
|
|
20
23
|
return expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true);
|
|
21
24
|
}, EditorInternalContainerCompiled, EditorInternalContainerEmotion);
|
|
25
|
+
var DEFAULT_VALUE_PROP_TO_IGNORE = ['defaultValue'];
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* EditorInternalComponent is used to capture the common component
|
|
24
29
|
* from the `render` method of `Editor` and share it with `EditorNext`.
|
|
25
30
|
*/
|
|
26
31
|
export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
27
32
|
var props = _ref.props,
|
|
33
|
+
handleAnalyticsEvent = _ref.handleAnalyticsEvent,
|
|
28
34
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
29
35
|
handleSave = _ref.handleSave,
|
|
30
36
|
editorActions = _ref.editorActions,
|
|
@@ -39,6 +45,7 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
45
|
analyticsHandler: undefined
|
|
40
46
|
});
|
|
41
47
|
var featureFlags = createFeatureFlagsFromProps(props.featureFlags);
|
|
48
|
+
var renderTrackingEnabled = isExperimentEnabled('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
42
49
|
var _usePortalProvider = usePortalProvider(),
|
|
43
50
|
_usePortalProvider2 = _slicedToArray(_usePortalProvider, 2),
|
|
44
51
|
portalProviderAPI = _usePortalProvider2[0],
|
|
@@ -47,13 +54,21 @@ export var EditorInternal = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
54
|
_usePortalProvider4 = _slicedToArray(_usePortalProvider3, 2),
|
|
48
55
|
nodeViewPortalProviderAPI = _usePortalProvider4[0],
|
|
49
56
|
NodeViewPortalRenderer = _usePortalProvider4[1];
|
|
57
|
+
var propsToIgnore = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? DEFAULT_VALUE_PROP_TO_IGNORE : ['defaultValue'];
|
|
50
58
|
var baseFontSize = getBaseFontSize(props.appearance, props.contentMode);
|
|
51
59
|
var fontSize = editorFontSize({
|
|
52
60
|
theme: {
|
|
53
61
|
baseFontSize: baseFontSize
|
|
54
62
|
}
|
|
55
63
|
});
|
|
56
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
64
|
+
return /*#__PURE__*/React.createElement(Fragment, null, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
65
|
+
componentProps: props,
|
|
66
|
+
action: ACTION.RE_RENDERED,
|
|
67
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
68
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
69
|
+
propsToIgnore: propsToIgnore,
|
|
70
|
+
useShallow: false
|
|
71
|
+
}), /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
57
72
|
errorTracking: true,
|
|
58
73
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
59
74
|
contextIdentifierProvider: props.contextIdentifierProvider,
|
|
@@ -45,6 +45,7 @@ import { getNodesCountWithExtensionKeys } from '../utils/getNodesCountWithExtens
|
|
|
45
45
|
import { getNodesVisibleInViewport } from '../utils/getNodesVisibleInViewport';
|
|
46
46
|
import { isChromeless } from '../utils/is-chromeless';
|
|
47
47
|
import { isFullPage } from '../utils/is-full-page';
|
|
48
|
+
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
48
49
|
import measurements from '../utils/performance/measure-enum';
|
|
49
50
|
import { PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD } from './consts';
|
|
50
51
|
import { processPluginsList } from './create-editor';
|
|
@@ -1184,13 +1185,20 @@ export function ReactEditorView(props) {
|
|
|
1184
1185
|
// We should follow-up
|
|
1185
1186
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1186
1187
|
[props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy, ssrEditor]);
|
|
1188
|
+
var renderTrackingEnabled = isExperimentEnabled('platform_editor_enable_rerender_tracking') && !featureFlags.lcmPreventRenderTracking;
|
|
1187
1189
|
return /*#__PURE__*/React.createElement(SSRRenderMeasure, {
|
|
1188
1190
|
segmentName: SSR_TRACE_SEGMENT_NAME,
|
|
1189
1191
|
startTimestampRef: firstRenderStartTimestampRef,
|
|
1190
1192
|
onSSRMeasure: onSSRMeasure
|
|
1191
1193
|
}, /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
1192
1194
|
value: reactEditorViewContext
|
|
1193
|
-
},
|
|
1195
|
+
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
1196
|
+
componentProps: props,
|
|
1197
|
+
action: ACTION.RE_RENDERED,
|
|
1198
|
+
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
1199
|
+
handleAnalyticsEvent: handleAnalyticsEvent,
|
|
1200
|
+
useShallow: true
|
|
1201
|
+
}), props.render ? (_props$render = (_props$render2 = props.render) === null || _props$render2 === void 0 ? void 0 : _props$render2.call(props, {
|
|
1194
1202
|
editor: editor,
|
|
1195
1203
|
view: viewRef.current,
|
|
1196
1204
|
config: config.current,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
|
+
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useComponentRenderTracking } from '@atlaskit/editor-common/use-component-render-tracking';
|
|
5
|
+
export function RenderTracking(props) {
|
|
6
|
+
var debouncedHandleAnalyticsEvent = useMemo(function () {
|
|
7
|
+
return debounce(props.handleAnalyticsEvent, 500);
|
|
8
|
+
}, [props.handleAnalyticsEvent]);
|
|
9
|
+
useComponentRenderTracking({
|
|
10
|
+
onRender: function onRender(_ref) {
|
|
11
|
+
var renderCount = _ref.renderCount,
|
|
12
|
+
propsDifference = _ref.propsDifference;
|
|
13
|
+
if (!renderCount) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
debouncedHandleAnalyticsEvent({
|
|
17
|
+
payload: {
|
|
18
|
+
action: props.action,
|
|
19
|
+
actionSubject: props.actionSubject,
|
|
20
|
+
attributes: {
|
|
21
|
+
count: renderCount,
|
|
22
|
+
propsDifference: propsDifference
|
|
23
|
+
},
|
|
24
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
propsDiffingOptions: {
|
|
29
|
+
enabled: true,
|
|
30
|
+
props: props.componentProps,
|
|
31
|
+
propsToIgnore: props.propsToIgnore,
|
|
32
|
+
useShallow: props.useShallow
|
|
33
|
+
},
|
|
34
|
+
zeroBasedCount: true
|
|
35
|
+
});
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { MemoExoticComponent } from 'react';
|
|
3
3
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
4
|
+
import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
6
|
import type { AllEditorPresetPluginTypes, EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
6
7
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -13,6 +14,7 @@ interface InternalProps {
|
|
|
13
14
|
AppearanceComponent: React.ComponentType<React.PropsWithChildren<EditorAppearanceComponentProps<[]>>>;
|
|
14
15
|
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
15
16
|
editorActions: EditorActions;
|
|
17
|
+
handleAnalyticsEvent: FireAnalyticsCallback;
|
|
16
18
|
handleSave: (view: EditorView) => void;
|
|
17
19
|
onEditorCreated: (instance: {
|
|
18
20
|
eventDispatcher: EventDispatcher;
|
|
@@ -2,6 +2,7 @@ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
|
2
2
|
import type { ContextualFormattingEnabledOptions } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import type { EditorAppearance, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { ToolbarInsertBlockButtonsConfig } from '@atlaskit/editor-plugin-insert-block';
|
|
5
|
+
import type { QuickInsertPluginOptions } from '@atlaskit/editor-plugin-quick-insert/quick-insert-plugin-type';
|
|
5
6
|
import type { ExtensionPluginOptions } from '@atlaskit/editor-plugins/extension';
|
|
6
7
|
import type { BreakpointPreset } from '@atlaskit/editor-toolbar';
|
|
7
8
|
import type { EditorPluginFeatureProps, EditorProps, EditorProviderProps, EditorSharedPropsWithPlugins } from '../types/editor-props';
|
|
@@ -47,9 +48,7 @@ export type InitialPluginConfiguration = {
|
|
|
47
48
|
type: 'added' | 'deleted';
|
|
48
49
|
}[]) => void;
|
|
49
50
|
};
|
|
50
|
-
quickInsertPlugin?:
|
|
51
|
-
blockControlButtonEnabled?: boolean;
|
|
52
|
-
};
|
|
51
|
+
quickInsertPlugin?: Pick<QuickInsertPluginOptions, 'blockControlButtonEnabled' | 'isRecommendedItem'>;
|
|
53
52
|
tasksAndDecisionsPlugin?: {
|
|
54
53
|
allowBlockTaskItem?: boolean;
|
|
55
54
|
hasEditPermission?: boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ACTION, ACTION_SUBJECT, FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
type RenderActions = ACTION.RE_RENDERED;
|
|
3
|
+
type RenderActionSubjects = ACTION_SUBJECT.EDITOR | ACTION_SUBJECT.REACT_EDITOR_VIEW;
|
|
4
|
+
export type RenderTrackingProps<ComponentProps> = {
|
|
5
|
+
action: RenderActions;
|
|
6
|
+
actionSubject: RenderActionSubjects;
|
|
7
|
+
componentProps: ComponentProps;
|
|
8
|
+
handleAnalyticsEvent: FireAnalyticsCallback;
|
|
9
|
+
propsToIgnore?: Array<keyof ComponentProps>;
|
|
10
|
+
useShallow?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function RenderTracking<Props>(props: RenderTrackingProps<Props>): null;
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "234.
|
|
3
|
+
"version": "234.1.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
78
78
|
"@atlaskit/react-ufo": "^8.0.0",
|
|
79
79
|
"@atlaskit/task-decision": "^21.11.0",
|
|
80
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
80
|
+
"@atlaskit/tmp-editor-statsig": "^221.0.0",
|
|
81
81
|
"@atlaskit/tokens": "^20.1.0",
|
|
82
82
|
"@atlaskit/tooltip": "^24.4.0",
|
|
83
83
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"uuid": "^11.1.1"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@atlaskit/editor-common": "^128.
|
|
99
|
+
"@atlaskit/editor-common": "^128.1.0",
|
|
100
100
|
"@atlaskit/link-provider": "^6.0.0",
|
|
101
101
|
"@atlaskit/media-core": "^39.0.0",
|
|
102
102
|
"react": "^18.2.0 || ^19.2.0",
|