@atlaskit/editor-core 226.4.2 → 226.5.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 +24 -0
- package/dist/cjs/composable-editor/core-editor.js +2 -9
- package/dist/cjs/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/core-editor.js +3 -10
- package/dist/es2019/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/core-editor.js +3 -10
- package/dist/esm/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/EditorContentContainer/styles/vanillaTooltipStyles.d.ts +2 -1
- package/package.json +4 -5
- package/dist/cjs/composable-editor/editor-inp-metrics.js +0 -76
- package/dist/es2019/composable-editor/editor-inp-metrics.js +0 -67
- package/dist/esm/composable-editor/editor-inp-metrics.js +0 -69
- package/dist/types/composable-editor/editor-inp-metrics.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 226.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a70e1af6e4130`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a70e1af6e4130) -
|
|
8
|
+
EDITOR-8867 Remove the `editor inp` implementation: the `EditorINPMetrics` component in
|
|
9
|
+
`@atlaskit/editor-core` and the `inp` entry point (`setupINPTracking`) with its vendored `onINP`
|
|
10
|
+
internals in `@atlaskit/editor-performance-metrics`. Interaction latency is reported by the
|
|
11
|
+
`editor interactivity` event from `@atlaskit/editor-plugin-interactivity`, which should be used
|
|
12
|
+
instead.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 226.4.3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`5a0128690a065`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a0128690a065) -
|
|
23
|
+
Add mention avatars to Rovo editor and renderer surfaces behind
|
|
24
|
+
platform_editor_rovo_editor_mention_node_avatar
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 226.4.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -22,7 +22,6 @@ var _EditorContext = require("../ui/EditorContext");
|
|
|
22
22
|
var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
|
|
23
23
|
var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
|
|
24
24
|
var _versionWrapper = require("../version-wrapper");
|
|
25
|
-
var _editorInpMetrics = require("./editor-inp-metrics");
|
|
26
25
|
var _editorInternal = require("./editor-internal");
|
|
27
26
|
var _useMeasureEditorMountTime = _interopRequireDefault(require("./hooks/useMeasureEditorMountTime"));
|
|
28
27
|
var _useMemoEditorProps = _interopRequireDefault(require("./hooks/useMemoEditorProps"));
|
|
@@ -51,7 +50,6 @@ function Editor(passedProps) {
|
|
|
51
50
|
var editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
52
51
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
53
52
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
54
|
-
var editorViewRef = (0, _react.useRef)(null);
|
|
55
53
|
var getFeatureFlagsFromRef = (0, _react.useCallback)(function () {
|
|
56
54
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
57
55
|
return _objectSpread(_objectSpread({}, (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(propsRef.current.featureFlags)), {}, {
|
|
@@ -63,7 +61,6 @@ function Editor(passedProps) {
|
|
|
63
61
|
contextIdentifierProvider = _propsRef$current.contextIdentifierProvider,
|
|
64
62
|
onEditorReady = _propsRef$current.onEditorReady,
|
|
65
63
|
featureFlags = _propsRef$current.featureFlags;
|
|
66
|
-
editorViewRef.current = instance.view;
|
|
67
64
|
editorActions._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, getFeatureFlagsFromRef);
|
|
68
65
|
if (onEditorReady) {
|
|
69
66
|
(0, _performanceMeasures.startMeasure)(_measureEnum.default.ON_EDITOR_READY_CALLBACK);
|
|
@@ -76,7 +73,6 @@ function Editor(passedProps) {
|
|
|
76
73
|
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef]);
|
|
77
74
|
var onEditorDestroyed = (0, _react.useCallback)(function (_instance) {
|
|
78
75
|
var onDestroy = propsRef.current.onDestroy;
|
|
79
|
-
editorViewRef.current = null;
|
|
80
76
|
editorActions._privateUnregisterEditor();
|
|
81
77
|
if (onDestroy) {
|
|
82
78
|
onDestroy();
|
|
@@ -90,10 +86,7 @@ function Editor(passedProps) {
|
|
|
90
86
|
onSaveFromProps(view);
|
|
91
87
|
}
|
|
92
88
|
}, [onSaveFromProps]);
|
|
93
|
-
|
|
94
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, isFullPageAppearance ? /*#__PURE__*/_react.default.createElement(_editorInpMetrics.EditorINPMetrics, {
|
|
95
|
-
editorViewRef: editorViewRef
|
|
96
|
-
}) : null, /*#__PURE__*/_react.default.createElement(_editorInternal.EditorInternal, {
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_editorInternal.EditorInternal, {
|
|
97
90
|
props: props,
|
|
98
91
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
99
92
|
preset: props.preset,
|
|
@@ -103,7 +96,7 @@ function Editor(passedProps) {
|
|
|
103
96
|
onEditorDestroyed: onEditorDestroyed,
|
|
104
97
|
providerFactory: providerFactory,
|
|
105
98
|
AppearanceComponent: props.AppearanceComponent
|
|
106
|
-
})
|
|
99
|
+
});
|
|
107
100
|
}
|
|
108
101
|
var useMemoEditorFeatureFlags = function useMemoEditorFeatureFlags(featureFlags) {
|
|
109
102
|
var ffRef = (0, _react.useRef)(featureFlags);
|
|
@@ -11,7 +11,8 @@ var _react = require("@emotion/react");
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Default look for tooltips created by `VanillaTooltip` (`editor-common/vanilla-tooltip`).
|
|
14
|
-
* Opt in
|
|
14
|
+
* Opt in with `VANILLA_TOOLTIP_DEFAULT_CLASS`. Spelt out here because the selector has to stay
|
|
15
|
+
* statically analysable, so rename in step with that constant.
|
|
15
16
|
*
|
|
16
17
|
* The tooltip is a `[popover]`: the browser paints it in the top layer but leaves it in the
|
|
17
18
|
* DOM, so this descendant selector still matches. `VanillaTooltip` sets `opacity`,
|
|
@@ -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 = "226.4.
|
|
9
|
+
var version = exports.version = "226.4.3";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useMemo, useRef
|
|
2
|
+
import React, { useCallback, useMemo, useRef } from 'react';
|
|
3
3
|
import isEqual from 'lodash/isEqual';
|
|
4
4
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
@@ -13,7 +13,6 @@ import { useEditorContext } from '../ui/EditorContext';
|
|
|
13
13
|
import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
|
|
14
14
|
import measurements from '../utils/performance/measure-enum';
|
|
15
15
|
import { name, version } from '../version-wrapper';
|
|
16
|
-
import { EditorINPMetrics } from './editor-inp-metrics';
|
|
17
16
|
import { EditorInternal } from './editor-internal';
|
|
18
17
|
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
19
18
|
// Ignored via go/ees005
|
|
@@ -39,7 +38,6 @@ function Editor(passedProps) {
|
|
|
39
38
|
const {
|
|
40
39
|
createAnalyticsEvent
|
|
41
40
|
} = useAnalyticsEvents();
|
|
42
|
-
const editorViewRef = useRef(null);
|
|
43
41
|
const getFeatureFlagsFromRef = useCallback(() => {
|
|
44
42
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
45
43
|
return {
|
|
@@ -53,7 +51,6 @@ function Editor(passedProps) {
|
|
|
53
51
|
onEditorReady,
|
|
54
52
|
featureFlags
|
|
55
53
|
} = propsRef.current;
|
|
56
|
-
editorViewRef.current = instance.view;
|
|
57
54
|
editorActions._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, getFeatureFlagsFromRef);
|
|
58
55
|
if (onEditorReady) {
|
|
59
56
|
startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
@@ -68,7 +65,6 @@ function Editor(passedProps) {
|
|
|
68
65
|
const {
|
|
69
66
|
onDestroy
|
|
70
67
|
} = propsRef.current;
|
|
71
|
-
editorViewRef.current = null;
|
|
72
68
|
editorActions._privateUnregisterEditor();
|
|
73
69
|
if (onDestroy) {
|
|
74
70
|
onDestroy();
|
|
@@ -84,10 +80,7 @@ function Editor(passedProps) {
|
|
|
84
80
|
onSaveFromProps(view);
|
|
85
81
|
}
|
|
86
82
|
}, [onSaveFromProps]);
|
|
87
|
-
|
|
88
|
-
return /*#__PURE__*/React.createElement(Fragment, null, isFullPageAppearance ? /*#__PURE__*/React.createElement(EditorINPMetrics, {
|
|
89
|
-
editorViewRef: editorViewRef
|
|
90
|
-
}) : null, /*#__PURE__*/React.createElement(EditorInternal, {
|
|
83
|
+
return /*#__PURE__*/React.createElement(EditorInternal, {
|
|
91
84
|
props: props,
|
|
92
85
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
93
86
|
preset: props.preset,
|
|
@@ -97,7 +90,7 @@ function Editor(passedProps) {
|
|
|
97
90
|
onEditorDestroyed: onEditorDestroyed,
|
|
98
91
|
providerFactory: providerFactory,
|
|
99
92
|
AppearanceComponent: props.AppearanceComponent
|
|
100
|
-
})
|
|
93
|
+
});
|
|
101
94
|
}
|
|
102
95
|
const useMemoEditorFeatureFlags = featureFlags => {
|
|
103
96
|
const ffRef = useRef(featureFlags);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
/**
|
|
6
6
|
* Default look for tooltips created by `VanillaTooltip` (`editor-common/vanilla-tooltip`).
|
|
7
|
-
* Opt in
|
|
7
|
+
* Opt in with `VANILLA_TOOLTIP_DEFAULT_CLASS`. Spelt out here because the selector has to stay
|
|
8
|
+
* statically analysable, so rename in step with that constant.
|
|
8
9
|
*
|
|
9
10
|
* The tooltip is a `[popover]`: the browser paints it in the top layer but leaves it in the
|
|
10
11
|
* DOM, so this descendant selector still matches. `VanillaTooltip` sets `opacity`,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
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
|
-
import React, { useCallback, useMemo, useRef
|
|
5
|
+
import React, { useCallback, useMemo, useRef } from 'react';
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
@@ -16,7 +16,6 @@ import { useEditorContext } from '../ui/EditorContext';
|
|
|
16
16
|
import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
|
|
17
17
|
import measurements from '../utils/performance/measure-enum';
|
|
18
18
|
import { name, version } from '../version-wrapper';
|
|
19
|
-
import { EditorINPMetrics } from './editor-inp-metrics';
|
|
20
19
|
import { EditorInternal } from './editor-internal';
|
|
21
20
|
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
22
21
|
// Ignored via go/ees005
|
|
@@ -43,7 +42,6 @@ function Editor(passedProps) {
|
|
|
43
42
|
var editorActions = editorContext.editorActions || editorActionsPlaceholderInstance;
|
|
44
43
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
45
44
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
46
|
-
var editorViewRef = useRef(null);
|
|
47
45
|
var getFeatureFlagsFromRef = useCallback(function () {
|
|
48
46
|
var _propsRef$current$col, _propsRef$current$col2;
|
|
49
47
|
return _objectSpread(_objectSpread({}, createFeatureFlagsFromProps(propsRef.current.featureFlags)), {}, {
|
|
@@ -55,7 +53,6 @@ function Editor(passedProps) {
|
|
|
55
53
|
contextIdentifierProvider = _propsRef$current.contextIdentifierProvider,
|
|
56
54
|
onEditorReady = _propsRef$current.onEditorReady,
|
|
57
55
|
featureFlags = _propsRef$current.featureFlags;
|
|
58
|
-
editorViewRef.current = instance.view;
|
|
59
56
|
editorActions._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, getFeatureFlagsFromRef);
|
|
60
57
|
if (onEditorReady) {
|
|
61
58
|
startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
@@ -68,7 +65,6 @@ function Editor(passedProps) {
|
|
|
68
65
|
}, [editorActions, createAnalyticsEvent, getFeatureFlagsFromRef, propsRef]);
|
|
69
66
|
var onEditorDestroyed = useCallback(function (_instance) {
|
|
70
67
|
var onDestroy = propsRef.current.onDestroy;
|
|
71
|
-
editorViewRef.current = null;
|
|
72
68
|
editorActions._privateUnregisterEditor();
|
|
73
69
|
if (onDestroy) {
|
|
74
70
|
onDestroy();
|
|
@@ -82,10 +78,7 @@ function Editor(passedProps) {
|
|
|
82
78
|
onSaveFromProps(view);
|
|
83
79
|
}
|
|
84
80
|
}, [onSaveFromProps]);
|
|
85
|
-
|
|
86
|
-
return /*#__PURE__*/React.createElement(Fragment, null, isFullPageAppearance ? /*#__PURE__*/React.createElement(EditorINPMetrics, {
|
|
87
|
-
editorViewRef: editorViewRef
|
|
88
|
-
}) : null, /*#__PURE__*/React.createElement(EditorInternal, {
|
|
81
|
+
return /*#__PURE__*/React.createElement(EditorInternal, {
|
|
89
82
|
props: props,
|
|
90
83
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
91
84
|
preset: props.preset,
|
|
@@ -95,7 +88,7 @@ function Editor(passedProps) {
|
|
|
95
88
|
onEditorDestroyed: onEditorDestroyed,
|
|
96
89
|
providerFactory: providerFactory,
|
|
97
90
|
AppearanceComponent: props.AppearanceComponent
|
|
98
|
-
})
|
|
91
|
+
});
|
|
99
92
|
}
|
|
100
93
|
var useMemoEditorFeatureFlags = function useMemoEditorFeatureFlags(featureFlags) {
|
|
101
94
|
var ffRef = useRef(featureFlags);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
/**
|
|
6
6
|
* Default look for tooltips created by `VanillaTooltip` (`editor-common/vanilla-tooltip`).
|
|
7
|
-
* Opt in
|
|
7
|
+
* Opt in with `VANILLA_TOOLTIP_DEFAULT_CLASS`. Spelt out here because the selector has to stay
|
|
8
|
+
* statically analysable, so rename in step with that constant.
|
|
8
9
|
*
|
|
9
10
|
* The tooltip is a `[popover]`: the browser paints it in the top layer but leaves it in the
|
|
10
11
|
* DOM, so this descendant selector still matches. `VanillaTooltip` sets `opacity`,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SerializedStyles } from '@emotion/react';
|
|
2
2
|
/**
|
|
3
3
|
* Default look for tooltips created by `VanillaTooltip` (`editor-common/vanilla-tooltip`).
|
|
4
|
-
* Opt in
|
|
4
|
+
* Opt in with `VANILLA_TOOLTIP_DEFAULT_CLASS`. Spelt out here because the selector has to stay
|
|
5
|
+
* statically analysable, so rename in step with that constant.
|
|
5
6
|
*
|
|
6
7
|
* The tooltip is a `[popover]`: the browser paints it in the top layer but leaves it in the
|
|
7
8
|
* DOM, so this descendant selector still matches. `VanillaTooltip` sets `opacity`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "226.
|
|
3
|
+
"version": "226.5.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"@atlaskit/button": "^25.3.0",
|
|
47
47
|
"@atlaskit/css": "^1.1.0",
|
|
48
48
|
"@atlaskit/editor-json-transformer": "^9.8.0",
|
|
49
|
-
"@atlaskit/editor-performance-metrics": "^3.2.0",
|
|
50
49
|
"@atlaskit/editor-plugin-block-menu": "^15.1.0",
|
|
51
50
|
"@atlaskit/editor-plugin-connectivity": "^16.0.0",
|
|
52
51
|
"@atlaskit/editor-plugin-quick-insert": "^16.2.0",
|
|
@@ -92,7 +91,7 @@
|
|
|
92
91
|
"uuid": "^11.1.1"
|
|
93
92
|
},
|
|
94
93
|
"peerDependencies": {
|
|
95
|
-
"@atlaskit/editor-common": "^120.
|
|
94
|
+
"@atlaskit/editor-common": "^120.15.0",
|
|
96
95
|
"@atlaskit/link-provider": "^5.5.0",
|
|
97
96
|
"@atlaskit/media-core": "^38.2.0",
|
|
98
97
|
"react": "^18.2.0",
|
|
@@ -108,7 +107,7 @@
|
|
|
108
107
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
109
108
|
"@atlaskit/analytics-listeners": "^11.3.0",
|
|
110
109
|
"@atlaskit/code": "^19.2.0",
|
|
111
|
-
"@atlaskit/collab-provider": "^25.
|
|
110
|
+
"@atlaskit/collab-provider": "^25.2.0",
|
|
112
111
|
"@atlaskit/docs": "^12.2.0",
|
|
113
112
|
"@atlaskit/drawer": "^14.3.0",
|
|
114
113
|
"@atlaskit/editor-plugin-alignment": "^17.0.0",
|
|
@@ -168,7 +167,7 @@
|
|
|
168
167
|
"@atlassian/editor-rovo-bridge": "^14.1.0",
|
|
169
168
|
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
170
169
|
"@atlassian/feature-flags-test-utils": "^1.3.0",
|
|
171
|
-
"@atlassian/search-client": "^2.
|
|
170
|
+
"@atlassian/search-client": "^2.21.0",
|
|
172
171
|
"@atlassian/search-provider": "^17.1.0",
|
|
173
172
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
174
173
|
"@atlassian/testing-library": "^0.11.0",
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.EditorINPMetrics = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
10
|
-
var _useAnalyticsEvents = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
11
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _inp = require("@atlaskit/editor-performance-metrics/inp");
|
|
13
|
-
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
14
|
-
var _getEditorDomSize = require("../utils/getEditorDomSize");
|
|
15
|
-
var EditorINPMetrics = exports.EditorINPMetrics = function EditorINPMetrics(_ref) {
|
|
16
|
-
var editorViewRef = _ref.editorViewRef;
|
|
17
|
-
var analyticsEvents = (0, _useAnalyticsEvents.useAnalyticsEvents)();
|
|
18
|
-
|
|
19
|
-
// onMount lifecycle hook
|
|
20
|
-
(0, _react.useEffect)(function () {
|
|
21
|
-
var cleanupFn;
|
|
22
|
-
var cleanupIdleCallback = createIdleCallback(function () {
|
|
23
|
-
cleanupFn = (0, _inp.setupINPTracking)(function (_ref2) {
|
|
24
|
-
var value = _ref2.value;
|
|
25
|
-
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
26
|
-
var ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
|
|
27
|
-
var editorView = editorViewRef.current;
|
|
28
|
-
var editorDomSize = editorView ? (0, _getEditorDomSize.getEditorDomSize)(editorView) : undefined;
|
|
29
|
-
sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName, editorDomSize);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Cleanup function that will be called when the component unmounts
|
|
34
|
-
return function () {
|
|
35
|
-
var _cleanupFn;
|
|
36
|
-
cleanupIdleCallback();
|
|
37
|
-
(_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 || _cleanupFn();
|
|
38
|
-
};
|
|
39
|
-
// Using hook as mount lifecycle hook.
|
|
40
|
-
// We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
|
|
41
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
|
-
// This component doesn't render anything
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
var sendAnalytics = (0, _debounce.default)(function (createAnalyticsEvent, value, ufoName, editorDomSize) {
|
|
48
|
-
(0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)({
|
|
49
|
-
payload: {
|
|
50
|
-
// @ts-expect-error Temporary data
|
|
51
|
-
action: 'inp',
|
|
52
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
53
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
54
|
-
attributes: {
|
|
55
|
-
inp: value,
|
|
56
|
-
ufoName: ufoName,
|
|
57
|
-
editorDomSize: editorDomSize
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}, 1000, {
|
|
62
|
-
trailing: true
|
|
63
|
-
});
|
|
64
|
-
var createIdleCallback = function createIdleCallback(callback) {
|
|
65
|
-
if (typeof window.requestIdleCallback === 'function') {
|
|
66
|
-
var _id = window.requestIdleCallback(callback);
|
|
67
|
-
return function () {
|
|
68
|
-
return window.cancelIdleCallback(_id);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// Fallback to setTimeout with 0 delay if requestIdleCallback is not available
|
|
72
|
-
var id = window.setTimeout(callback, 0);
|
|
73
|
-
return function () {
|
|
74
|
-
return window.clearTimeout(id);
|
|
75
|
-
};
|
|
76
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import debounce from 'lodash/debounce';
|
|
3
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
4
|
-
import { ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { setupINPTracking } from '@atlaskit/editor-performance-metrics/inp';
|
|
6
|
-
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
7
|
-
import { getEditorDomSize } from '../utils/getEditorDomSize';
|
|
8
|
-
export const EditorINPMetrics = ({
|
|
9
|
-
editorViewRef
|
|
10
|
-
}) => {
|
|
11
|
-
const analyticsEvents = useAnalyticsEvents();
|
|
12
|
-
|
|
13
|
-
// onMount lifecycle hook
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
let cleanupFn;
|
|
16
|
-
const cleanupIdleCallback = createIdleCallback(() => {
|
|
17
|
-
cleanupFn = setupINPTracking(({
|
|
18
|
-
value
|
|
19
|
-
}) => {
|
|
20
|
-
const interaction = getActiveInteraction();
|
|
21
|
-
const ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
|
|
22
|
-
const editorView = editorViewRef.current;
|
|
23
|
-
const editorDomSize = editorView ? getEditorDomSize(editorView) : undefined;
|
|
24
|
-
sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName, editorDomSize);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// Cleanup function that will be called when the component unmounts
|
|
29
|
-
return () => {
|
|
30
|
-
var _cleanupFn;
|
|
31
|
-
cleanupIdleCallback();
|
|
32
|
-
(_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 ? void 0 : _cleanupFn();
|
|
33
|
-
};
|
|
34
|
-
// Using hook as mount lifecycle hook.
|
|
35
|
-
// We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
-
}, []);
|
|
38
|
-
|
|
39
|
-
// This component doesn't render anything
|
|
40
|
-
return null;
|
|
41
|
-
};
|
|
42
|
-
const sendAnalytics = debounce((createAnalyticsEvent, value, ufoName, editorDomSize) => {
|
|
43
|
-
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
44
|
-
payload: {
|
|
45
|
-
// @ts-expect-error Temporary data
|
|
46
|
-
action: 'inp',
|
|
47
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
48
|
-
eventType: EVENT_TYPE.TRACK,
|
|
49
|
-
attributes: {
|
|
50
|
-
inp: value,
|
|
51
|
-
ufoName,
|
|
52
|
-
editorDomSize
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, 1_000, {
|
|
57
|
-
trailing: true
|
|
58
|
-
});
|
|
59
|
-
const createIdleCallback = callback => {
|
|
60
|
-
if (typeof window.requestIdleCallback === 'function') {
|
|
61
|
-
const id = window.requestIdleCallback(callback);
|
|
62
|
-
return () => window.cancelIdleCallback(id);
|
|
63
|
-
}
|
|
64
|
-
// Fallback to setTimeout with 0 delay if requestIdleCallback is not available
|
|
65
|
-
const id = window.setTimeout(callback, 0);
|
|
66
|
-
return () => window.clearTimeout(id);
|
|
67
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import debounce from 'lodash/debounce';
|
|
3
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
4
|
-
import { ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { setupINPTracking } from '@atlaskit/editor-performance-metrics/inp';
|
|
6
|
-
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
7
|
-
import { getEditorDomSize } from '../utils/getEditorDomSize';
|
|
8
|
-
export var EditorINPMetrics = function EditorINPMetrics(_ref) {
|
|
9
|
-
var editorViewRef = _ref.editorViewRef;
|
|
10
|
-
var analyticsEvents = useAnalyticsEvents();
|
|
11
|
-
|
|
12
|
-
// onMount lifecycle hook
|
|
13
|
-
useEffect(function () {
|
|
14
|
-
var cleanupFn;
|
|
15
|
-
var cleanupIdleCallback = createIdleCallback(function () {
|
|
16
|
-
cleanupFn = setupINPTracking(function (_ref2) {
|
|
17
|
-
var value = _ref2.value;
|
|
18
|
-
var interaction = getActiveInteraction();
|
|
19
|
-
var ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
|
|
20
|
-
var editorView = editorViewRef.current;
|
|
21
|
-
var editorDomSize = editorView ? getEditorDomSize(editorView) : undefined;
|
|
22
|
-
sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName, editorDomSize);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Cleanup function that will be called when the component unmounts
|
|
27
|
-
return function () {
|
|
28
|
-
var _cleanupFn;
|
|
29
|
-
cleanupIdleCallback();
|
|
30
|
-
(_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 || _cleanupFn();
|
|
31
|
-
};
|
|
32
|
-
// Using hook as mount lifecycle hook.
|
|
33
|
-
// We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
// This component doesn't render anything
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
var sendAnalytics = debounce(function (createAnalyticsEvent, value, ufoName, editorDomSize) {
|
|
41
|
-
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
42
|
-
payload: {
|
|
43
|
-
// @ts-expect-error Temporary data
|
|
44
|
-
action: 'inp',
|
|
45
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
46
|
-
eventType: EVENT_TYPE.TRACK,
|
|
47
|
-
attributes: {
|
|
48
|
-
inp: value,
|
|
49
|
-
ufoName: ufoName,
|
|
50
|
-
editorDomSize: editorDomSize
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}, 1000, {
|
|
55
|
-
trailing: true
|
|
56
|
-
});
|
|
57
|
-
var createIdleCallback = function createIdleCallback(callback) {
|
|
58
|
-
if (typeof window.requestIdleCallback === 'function') {
|
|
59
|
-
var _id = window.requestIdleCallback(callback);
|
|
60
|
-
return function () {
|
|
61
|
-
return window.cancelIdleCallback(_id);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
// Fallback to setTimeout with 0 delay if requestIdleCallback is not available
|
|
65
|
-
var id = window.setTimeout(callback, 0);
|
|
66
|
-
return function () {
|
|
67
|
-
return window.clearTimeout(id);
|
|
68
|
-
};
|
|
69
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
type EditorINPMetricsProps = {
|
|
4
|
-
editorViewRef: RefObject<EditorView | null>;
|
|
5
|
-
};
|
|
6
|
-
export declare const EditorINPMetrics: ({ editorViewRef }: EditorINPMetricsProps) => null;
|
|
7
|
-
export {};
|