@atlaskit/editor-core 226.4.3 → 226.6.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/afm-cc/tsconfig.json +0 -3
  3. package/afm-products/tsconfig.json +0 -3
  4. package/dist/cjs/composable-editor/core-editor.js +2 -9
  5. package/dist/cjs/presets/universal.js +7 -5
  6. package/dist/cjs/ui/Appearance/Comment/Comment-compiled.compiled.css +0 -1
  7. package/dist/cjs/ui/Appearance/Comment/Comment-compiled.js +1 -3
  8. package/dist/cjs/ui/Appearance/Comment/Comment-emotion.js +1 -21
  9. package/dist/cjs/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +1 -2
  10. package/dist/cjs/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -4
  11. package/dist/cjs/ui/Appearance/Comment/FixedToolbar-emotion.js +1 -6
  12. package/dist/cjs/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +0 -1
  13. package/dist/cjs/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -4
  14. package/dist/cjs/ui/Appearance/Comment/StickyToolbar-emotion.js +1 -6
  15. package/dist/cjs/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
  16. package/dist/cjs/version-wrapper.js +1 -1
  17. package/dist/es2019/composable-editor/core-editor.js +3 -10
  18. package/dist/es2019/presets/universal.js +10 -4
  19. package/dist/es2019/ui/Appearance/Comment/Comment-compiled.compiled.css +0 -1
  20. package/dist/es2019/ui/Appearance/Comment/Comment-compiled.js +1 -3
  21. package/dist/es2019/ui/Appearance/Comment/Comment-emotion.js +1 -21
  22. package/dist/es2019/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +1 -2
  23. package/dist/es2019/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -4
  24. package/dist/es2019/ui/Appearance/Comment/FixedToolbar-emotion.js +1 -6
  25. package/dist/es2019/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +0 -1
  26. package/dist/es2019/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -4
  27. package/dist/es2019/ui/Appearance/Comment/StickyToolbar-emotion.js +1 -6
  28. package/dist/es2019/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
  29. package/dist/es2019/version-wrapper.js +1 -1
  30. package/dist/esm/composable-editor/core-editor.js +3 -10
  31. package/dist/esm/presets/universal.js +7 -5
  32. package/dist/esm/ui/Appearance/Comment/Comment-compiled.compiled.css +0 -1
  33. package/dist/esm/ui/Appearance/Comment/Comment-compiled.js +1 -3
  34. package/dist/esm/ui/Appearance/Comment/Comment-emotion.js +1 -21
  35. package/dist/esm/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +1 -2
  36. package/dist/esm/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -4
  37. package/dist/esm/ui/Appearance/Comment/FixedToolbar-emotion.js +1 -6
  38. package/dist/esm/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +0 -1
  39. package/dist/esm/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -4
  40. package/dist/esm/ui/Appearance/Comment/StickyToolbar-emotion.js +1 -6
  41. package/dist/esm/ui/EditorContentContainer/styles/vanillaTooltipStyles.js +2 -1
  42. package/dist/esm/version-wrapper.js +1 -1
  43. package/dist/types/presets/universal.d.ts +4 -0
  44. package/dist/types/ui/EditorContentContainer/styles/vanillaTooltipStyles.d.ts +2 -1
  45. package/package.json +6 -7
  46. package/dist/cjs/composable-editor/editor-inp-metrics.js +0 -76
  47. package/dist/es2019/composable-editor/editor-inp-metrics.js +0 -67
  48. package/dist/esm/composable-editor/editor-inp-metrics.js +0 -69
  49. package/dist/types/composable-editor/editor-inp-metrics.d.ts +0 -7
@@ -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 {};