@atlaskit/editor-core 205.4.1 → 205.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 205.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#138479](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138479)
8
+ [`058e8050f1a78`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/058e8050f1a78) -
9
+ [A11Y-9995] Popup aria label removed fallback and added aria label where it fits in places that
10
+ uses the component
11
+ - Updated dependencies
12
+
13
+ ## 205.5.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#137929](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137929)
18
+ [`fafc821856dba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fafc821856dba) -
19
+ Introduced INP metrics collector behind feature flag
20
+
21
+ ### Patch Changes
22
+
23
+ - [#140231](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140231)
24
+ [`c00bd6c36816f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c00bd6c36816f) -
25
+ Editor annotation plugin will now hook into the annotation manager and disable standard behaviour
26
+ when the FG platform_editor_comments_api_manager is enabled.
27
+ - Updated dependencies
28
+
3
29
  ## 205.4.1
4
30
 
5
31
  ### Patch Changes
@@ -25,6 +25,7 @@ var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
25
25
  var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
26
26
  var _versionWrapper = require("../version-wrapper");
27
27
  var _corePerformanceMetrics = require("./core-performance-metrics");
28
+ var _editorInpMetrics = require("./editor-inp-metrics");
28
29
  var _editorInternal = require("./editor-internal");
29
30
  var _useMeasureEditorMountTime = _interopRequireDefault(require("./hooks/useMeasureEditorMountTime"));
30
31
  var _useMemoEditorProps = _interopRequireDefault(require("./hooks/useMemoEditorProps"));
@@ -93,7 +94,7 @@ function Editor(passedProps) {
93
94
  }
94
95
  }, [onSaveFromProps]);
95
96
  var isFullPageApperance = Boolean(props.appearance && ['full-page', 'full-width'].includes(props.appearance));
96
- return (0, _react2.jsx)(_react.Fragment, null, isFullPageApperance && (0, _platformFeatureFlags.fg)('platform_editor_fe--ufo-bridge') ? (0, _react2.jsx)(_corePerformanceMetrics.EditorUFOBridge, null) : null, isFullPageApperance && (0, _platformFeatureFlags.fg)('platform_editor_fe--performance_metrics') ? (0, _react2.jsx)(_corePerformanceMetrics.EditorPerformanceMetrics, null) : null, (0, _react2.jsx)(_editorInternal.EditorInternal, {
97
+ return (0, _react2.jsx)(_react.Fragment, null, isFullPageApperance && (0, _platformFeatureFlags.fg)('platform_editor_fe--ufo-bridge') ? (0, _react2.jsx)(_corePerformanceMetrics.EditorUFOBridge, null) : null, isFullPageApperance && (0, _platformFeatureFlags.fg)('platform_editor_fe--performance_metrics') ? (0, _react2.jsx)(_corePerformanceMetrics.EditorPerformanceMetrics, null) : null, isFullPageApperance && (0, _platformFeatureFlags.fg)('platform_editor_fe--inp-metrics') ? (0, _react2.jsx)(_editorInpMetrics.EditorINPMetrics, null) : null, (0, _react2.jsx)(_editorInternal.EditorInternal, {
97
98
  props: props,
98
99
  handleAnalyticsEvent: handleAnalyticsEvent,
99
100
  createAnalyticsEvent: createAnalyticsEvent,
@@ -0,0 +1,71 @@
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 EditorINPMetrics = exports.EditorINPMetrics = function EditorINPMetrics() {
15
+ var analyticsEvents = (0, _useAnalyticsEvents.useAnalyticsEvents)();
16
+
17
+ // onMount lifecycle hook
18
+ (0, _react.useEffect)(function () {
19
+ var cleanupFn;
20
+ var cleanupIdleCallback = createIdleCallback(function () {
21
+ cleanupFn = (0, _inp.setupINPTracking)(function (_ref) {
22
+ var value = _ref.value;
23
+ var interaction = (0, _interactionMetrics.getActiveInteraction)();
24
+ var ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
25
+ sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName);
26
+ });
27
+ });
28
+
29
+ // Cleanup function that will be called when the component unmounts
30
+ return function () {
31
+ var _cleanupFn;
32
+ cleanupIdleCallback();
33
+ (_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 || _cleanupFn();
34
+ };
35
+ // Using hook as mount lifecycle hook.
36
+ // We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
+ }, []);
39
+
40
+ // This component doesn't render anything
41
+ return null;
42
+ };
43
+ var sendAnalytics = (0, _debounce.default)(function (createAnalyticsEvent, value, ufoName) {
44
+ (0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)({
45
+ payload: {
46
+ // @ts-expect-error Temporary data
47
+ action: 'inp',
48
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
49
+ eventType: _analytics.EVENT_TYPE.TRACK,
50
+ attributes: {
51
+ inp: value,
52
+ ufoName: ufoName
53
+ }
54
+ }
55
+ });
56
+ }, 1000, {
57
+ trailing: true
58
+ });
59
+ var createIdleCallback = function createIdleCallback(callback) {
60
+ if (typeof window.requestIdleCallback === 'function') {
61
+ var _id = window.requestIdleCallback(callback);
62
+ return function () {
63
+ return window.cancelIdleCallback(_id);
64
+ };
65
+ }
66
+ // Fallback to setTimeout with 0 delay if requestIdleCallback is not available
67
+ var id = window.setTimeout(callback, 0);
68
+ return function () {
69
+ return window.clearTimeout(id);
70
+ };
71
+ };
@@ -142,9 +142,6 @@ var firstBlockNodeStylesNew = (0, _react2.css)(_templateObject9 || (_templateObj
142
142
  * fix layout issue of first block node
143
143
  */
144
144
  var fixBlockControlStylesSSR = exports.fixBlockControlStylesSSR = function fixBlockControlStylesSSR() {
145
- if (!(0, _platformFeatureFlags.fg)('platform_editor_ssr_fix_block_controls')) {
146
- return null;
147
- }
148
145
  if ((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_6')) {
149
146
  return firstBlockNodeStylesNew;
150
147
  }
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "205.4.1";
8
+ var version = exports.version = "205.5.1";
@@ -22,6 +22,7 @@ import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
22
22
  import measurements from '../utils/performance/measure-enum';
23
23
  import { name, version } from '../version-wrapper';
24
24
  import { EditorUFOBridge, EditorPerformanceMetrics } from './core-performance-metrics';
25
+ import { EditorINPMetrics } from './editor-inp-metrics';
25
26
  import { EditorInternal } from './editor-internal';
26
27
  import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
27
28
  // Ignored via go/ees005
@@ -91,7 +92,7 @@ function Editor(passedProps) {
91
92
  }
92
93
  }, [onSaveFromProps]);
93
94
  const isFullPageApperance = Boolean(props.appearance && ['full-page', 'full-width'].includes(props.appearance));
94
- return jsx(Fragment, null, isFullPageApperance && fg('platform_editor_fe--ufo-bridge') ? jsx(EditorUFOBridge, null) : null, isFullPageApperance && fg('platform_editor_fe--performance_metrics') ? jsx(EditorPerformanceMetrics, null) : null, jsx(EditorInternal, {
95
+ return jsx(Fragment, null, isFullPageApperance && fg('platform_editor_fe--ufo-bridge') ? jsx(EditorUFOBridge, null) : null, isFullPageApperance && fg('platform_editor_fe--performance_metrics') ? jsx(EditorPerformanceMetrics, null) : null, isFullPageApperance && fg('platform_editor_fe--inp-metrics') ? jsx(EditorINPMetrics, null) : null, jsx(EditorInternal, {
95
96
  props: props,
96
97
  handleAnalyticsEvent: handleAnalyticsEvent,
97
98
  createAnalyticsEvent: createAnalyticsEvent,
@@ -0,0 +1,61 @@
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
+ export const EditorINPMetrics = () => {
8
+ const analyticsEvents = useAnalyticsEvents();
9
+
10
+ // onMount lifecycle hook
11
+ useEffect(() => {
12
+ let cleanupFn;
13
+ const cleanupIdleCallback = createIdleCallback(() => {
14
+ cleanupFn = setupINPTracking(({
15
+ value
16
+ }) => {
17
+ const interaction = getActiveInteraction();
18
+ const ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
19
+ sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName);
20
+ });
21
+ });
22
+
23
+ // Cleanup function that will be called when the component unmounts
24
+ return () => {
25
+ var _cleanupFn;
26
+ cleanupIdleCallback();
27
+ (_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 ? void 0 : _cleanupFn();
28
+ };
29
+ // Using hook as mount lifecycle hook.
30
+ // We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
31
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
+ }, []);
33
+
34
+ // This component doesn't render anything
35
+ return null;
36
+ };
37
+ const sendAnalytics = debounce((createAnalyticsEvent, value, ufoName) => {
38
+ fireAnalyticsEvent(createAnalyticsEvent)({
39
+ payload: {
40
+ // @ts-expect-error Temporary data
41
+ action: 'inp',
42
+ actionSubject: ACTION_SUBJECT.EDITOR,
43
+ eventType: EVENT_TYPE.TRACK,
44
+ attributes: {
45
+ inp: value,
46
+ ufoName
47
+ }
48
+ }
49
+ });
50
+ }, 1_000, {
51
+ trailing: true
52
+ });
53
+ const createIdleCallback = callback => {
54
+ if (typeof window.requestIdleCallback === 'function') {
55
+ const id = window.requestIdleCallback(callback);
56
+ return () => window.cancelIdleCallback(id);
57
+ }
58
+ // Fallback to setTimeout with 0 delay if requestIdleCallback is not available
59
+ const id = window.setTimeout(callback, 0);
60
+ return () => window.clearTimeout(id);
61
+ };
@@ -291,9 +291,6 @@ const firstBlockNodeStylesNew = css`
291
291
  * fix layout issue of first block node
292
292
  */
293
293
  export const fixBlockControlStylesSSR = () => {
294
- if (!fg('platform_editor_ssr_fix_block_controls')) {
295
- return null;
296
- }
297
294
  if (fg('platform_editor_element_dnd_nested_fix_patch_6')) {
298
295
  return firstBlockNodeStylesNew;
299
296
  }
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "205.4.1";
2
+ export const version = "205.5.1";
@@ -25,6 +25,7 @@ import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
25
25
  import measurements from '../utils/performance/measure-enum';
26
26
  import { name, version } from '../version-wrapper';
27
27
  import { EditorUFOBridge, EditorPerformanceMetrics } from './core-performance-metrics';
28
+ import { EditorINPMetrics } from './editor-inp-metrics';
28
29
  import { EditorInternal } from './editor-internal';
29
30
  import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
30
31
  // Ignored via go/ees005
@@ -89,7 +90,7 @@ function Editor(passedProps) {
89
90
  }
90
91
  }, [onSaveFromProps]);
91
92
  var isFullPageApperance = Boolean(props.appearance && ['full-page', 'full-width'].includes(props.appearance));
92
- return jsx(Fragment, null, isFullPageApperance && fg('platform_editor_fe--ufo-bridge') ? jsx(EditorUFOBridge, null) : null, isFullPageApperance && fg('platform_editor_fe--performance_metrics') ? jsx(EditorPerformanceMetrics, null) : null, jsx(EditorInternal, {
93
+ return jsx(Fragment, null, isFullPageApperance && fg('platform_editor_fe--ufo-bridge') ? jsx(EditorUFOBridge, null) : null, isFullPageApperance && fg('platform_editor_fe--performance_metrics') ? jsx(EditorPerformanceMetrics, null) : null, isFullPageApperance && fg('platform_editor_fe--inp-metrics') ? jsx(EditorINPMetrics, null) : null, jsx(EditorInternal, {
93
94
  props: props,
94
95
  handleAnalyticsEvent: handleAnalyticsEvent,
95
96
  createAnalyticsEvent: createAnalyticsEvent,
@@ -0,0 +1,64 @@
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
+ export var EditorINPMetrics = function EditorINPMetrics() {
8
+ var analyticsEvents = useAnalyticsEvents();
9
+
10
+ // onMount lifecycle hook
11
+ useEffect(function () {
12
+ var cleanupFn;
13
+ var cleanupIdleCallback = createIdleCallback(function () {
14
+ cleanupFn = setupINPTracking(function (_ref) {
15
+ var value = _ref.value;
16
+ var interaction = getActiveInteraction();
17
+ var ufoName = interaction === null || interaction === void 0 ? void 0 : interaction.ufoName;
18
+ sendAnalytics(analyticsEvents.createAnalyticsEvent, value, ufoName);
19
+ });
20
+ });
21
+
22
+ // Cleanup function that will be called when the component unmounts
23
+ return function () {
24
+ var _cleanupFn;
25
+ cleanupIdleCallback();
26
+ (_cleanupFn = cleanupFn) === null || _cleanupFn === void 0 || _cleanupFn();
27
+ };
28
+ // Using hook as mount lifecycle hook.
29
+ // We do not need to set dependency on analyticsEvents since we are using the analyticsEvents object reference
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ }, []);
32
+
33
+ // This component doesn't render anything
34
+ return null;
35
+ };
36
+ var sendAnalytics = debounce(function (createAnalyticsEvent, value, ufoName) {
37
+ fireAnalyticsEvent(createAnalyticsEvent)({
38
+ payload: {
39
+ // @ts-expect-error Temporary data
40
+ action: 'inp',
41
+ actionSubject: ACTION_SUBJECT.EDITOR,
42
+ eventType: EVENT_TYPE.TRACK,
43
+ attributes: {
44
+ inp: value,
45
+ ufoName: ufoName
46
+ }
47
+ }
48
+ });
49
+ }, 1000, {
50
+ trailing: true
51
+ });
52
+ var createIdleCallback = function createIdleCallback(callback) {
53
+ if (typeof window.requestIdleCallback === 'function') {
54
+ var _id = window.requestIdleCallback(callback);
55
+ return function () {
56
+ return window.cancelIdleCallback(_id);
57
+ };
58
+ }
59
+ // Fallback to setTimeout with 0 delay if requestIdleCallback is not available
60
+ var id = window.setTimeout(callback, 0);
61
+ return function () {
62
+ return window.clearTimeout(id);
63
+ };
64
+ };
@@ -134,9 +134,6 @@ var firstBlockNodeStylesNew = css(_templateObject9 || (_templateObject9 = _tagge
134
134
  * fix layout issue of first block node
135
135
  */
136
136
  export var fixBlockControlStylesSSR = function fixBlockControlStylesSSR() {
137
- if (!fg('platform_editor_ssr_fix_block_controls')) {
138
- return null;
139
- }
140
137
  if (fg('platform_editor_element_dnd_nested_fix_patch_6')) {
141
138
  return firstBlockNodeStylesNew;
142
139
  }
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "205.4.1";
2
+ export var version = "205.5.1";
@@ -0,0 +1 @@
1
+ export declare const EditorINPMetrics: () => null;