@atlaskit/editor-core 205.4.0 → 205.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 +26 -0
- package/dist/cjs/composable-editor/core-editor.js +2 -1
- package/dist/cjs/composable-editor/editor-inp-metrics.js +71 -0
- package/dist/cjs/ui/ContentStyles/index.js +1 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/core-editor.js +2 -1
- package/dist/es2019/composable-editor/editor-inp-metrics.js +61 -0
- package/dist/es2019/ui/ContentStyles/index.js +1 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/core-editor.js +2 -1
- package/dist/esm/composable-editor/editor-inp-metrics.js +64 -0
- package/dist/esm/ui/ContentStyles/index.js +1 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/editor-inp-metrics.d.ts +1 -0
- package/dist/types/create-editor/create-universal-preset.d.ts +192 -7
- package/dist/types/presets/universal.d.ts +192 -7
- package/dist/types/presets/useUniversalPreset.d.ts +192 -7
- package/dist/types/ui/ContentStyles/index.d.ts +1 -1
- package/dist/types-ts4.5/composable-editor/editor-inp-metrics.d.ts +1 -0
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +220 -7
- package/dist/types-ts4.5/presets/universal.d.ts +220 -7
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +220 -7
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
- package/package.json +25 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 205.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#137929](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137929)
|
|
8
|
+
[`fafc821856dba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fafc821856dba) -
|
|
9
|
+
Introduced INP metrics collector behind feature flag
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#140231](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140231)
|
|
14
|
+
[`c00bd6c36816f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c00bd6c36816f) -
|
|
15
|
+
Editor annotation plugin will now hook into the annotation manager and disable standard behaviour
|
|
16
|
+
when the FG platform_editor_comments_api_manager is enabled.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 205.4.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#142098](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142098)
|
|
24
|
+
[`e84b542ba2d44`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e84b542ba2d44) -
|
|
25
|
+
[ED-27614] Put quick insert placeholder behind a separate
|
|
26
|
+
FGplatform_editor_quick_insert_placeholder
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 205.4.0
|
|
4
30
|
|
|
5
31
|
### Minor 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
|
}
|
|
@@ -156,7 +153,7 @@ var akEditorBreakpointForSmallDevice = "1266px";
|
|
|
156
153
|
var contentStyles = function contentStyles(props) {
|
|
157
154
|
return (0, _react2.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n\t--ak-editor--default-gutter-padding: ", "px;\n\t/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */\n\t--ak-editor--large-gutter-padding: ", "px;\n\t--ak-editor--default-layout-width: ", "px;\n\t--ak-editor--full-width-layout-width: ", "px;\n\t/* calculate editor line length, 100cqw is the editor container width */\n\t--ak-editor--line-length: min(\n\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\tvar(--ak-editor--default-layout-width)\n\t);\n\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t--ak-editor--breakout-full-page-guttering-padding: calc(\n\t\tvar(--ak-editor--large-gutter-padding) * 2 + var(--ak-editor--default-gutter-padding)\n\t);\n\n\t.fabric-editor--full-width-mode {\n\t\t--ak-editor--line-length: min(\n\t\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\t\tvar(--ak-editor--full-width-layout-width)\n\t\t);\n\t}\n\n\t.ProseMirror {\n\t\t--ak-editor-max-container-width: calc(100cqw - var(--ak-editor--large-gutter-padding));\n\t}\n\n\t/* We can't allow nodes that are inside other nodes to bleed from the parent container */\n\t.ProseMirror > div[data-prosemirror-node-block] [data-prosemirror-node-block] {\n\t\t--ak-editor-max-container-width: 100%;\n\t}\n\n\t/* container editor-area is defined in platform/packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts */\n\t@container editor-area (width >= ", ") {\n\t\t.ProseMirror {\n\t\t\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t\t}\n\t}\n\n\t.ProseMirror {\n\t\toutline: none;\n\t\tfont-size: ", "px;\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n\n\t.ProseMirror-hideselection *::selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-hideselection *::-moz-selection {\n\t\tbackground: transparent;\n\t}\n\n\t/**\n\t * This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24\n\t *\n\t * 1. Merge and Release platform_editor_hide_cursor_when_pm_hideselection\n\t * 2. Cleanup duplicated style from platform_editor_advanced_code_blocks\n\t * https://product-fabric.atlassian.net/browse/ED-26331\n\t */\n\t", "\n\n\t/* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24 */\n\t", "\n\n\t.ProseMirror-selectednode {\n\t\toutline: none;\n\t}\n\n\t.ProseMirror-selectednode:empty {\n\t\toutline: 2px solid ", ";\n\t}\n\n\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\tcaret-color: transparent;\n\t}\n\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\tdisplay: none;\n\t}\n\n\t", "\n\t", "\n\t", "\n\t", "\n\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\t", "\n\t", "\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n // Switch between the two icons based on the visual refresh feature gate\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n\t\tbox-sizing: border-box;\n\t}\n\n\t.mediaGroupView-content-wrap ul {\n\t\tpadding: 0;\n\t}\n\n\t/** Needed to override any cleared floats, e.g. image wrapping */\n\n\tdiv.fabric-editor-block-mark[class^='fabric-editor-align'] {\n\t\tclear: none !important;\n\t}\n\n\t.fabric-editor-align-end {\n\t\ttext-align: right;\n\t}\n\n\t.fabric-editor-align-start {\n\t\ttext-align: left;\n\t}\n\n\t.fabric-editor-align-center {\n\t\ttext-align: center;\n\t}\n\n\t// For FullPage only when inside a table\n\t// Related code all lives inside: packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts\n\t// In the \"editorContentAreaContainerStyle\" function\n\t.fabric-editor--full-width-mode {\n\t\t.pm-table-container {\n\t\t\t.code-block,\n\t\t\t.extension-container,\n\t\t\t.multiBodiedExtension--container {\n\t\t\t\tmax-width: 100%;\n\t\t\t}\n\t\t}\n\t}\n\n\t.pm-table-header-content-wrap :not(.fabric-editor-alignment),\n\t.pm-table-header-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark,\n\t.pm-table-cell-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark {\n\t\tp:first-of-type {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.pm-table-cell-content-wrap .mediaGroupView-content-wrap {\n\t\tclear: both;\n\t}\n\n\t.hyperlink-floating-toolbar,\n\t.", " {\n\t\tpadding: 0;\n\t}\n\n\t/* Legacy Link icon in the Atlaskit package\n is bigger than the others, new ADS icon does not have this issue\n */\n\t", "\n"])), _editorSharedStyles.akEditorGutterPadding, (0, _editorSharedStyles.akEditorGutterPaddingDynamic)(), _editorSharedStyles.akEditorDefaultLayoutWidth, _editorSharedStyles.akEditorFullWidthLayoutWidth, _editorSharedStyles.akEditorCalculatedWideLayoutWidthSmallViewport, akEditorBreakpointForSmallDevice, _editorSharedStyles.akEditorCalculatedWideLayoutWidth, (0, _editorSharedStyles.editorFontSize)({
|
|
158
155
|
theme: props.theme
|
|
159
|
-
}), _styles.whitespaceSharedStyles, (0, _styles.paragraphSharedStyles)(props.typographyTheme), _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _platformFeatureFlags.fg)('editor_request_to_edit_task') ? null : (0, _react2.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), (0, _platformFeatureFlags.fg)('platform_editor_hide_cursor_when_pm_hideselection') ? (0, _react2.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, (0, _experiments.editorExperiment)('platform_editor_advanced_code_blocks', true) ? (0, _react2.css)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('
|
|
156
|
+
}), _styles.whitespaceSharedStyles, (0, _styles.paragraphSharedStyles)(props.typographyTheme), _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, (0, _platformFeatureFlags.fg)('editor_request_to_edit_task') ? null : (0, _react2.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), (0, _platformFeatureFlags.fg)('platform_editor_hide_cursor_when_pm_hideselection') ? (0, _react2.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, (0, _experiments.editorExperiment)('platform_editor_advanced_code_blocks', true) ? (0, _react2.css)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_quick_insert_placeholder') ? placeholderWrapStyles : null, (0, _codeBlock.codeBlockStyles)(), (0, _styles2.blocktypeStyles)(props.typographyTheme), (0, _styles.codeMarkSharedStyles)(), _styles.textColorStyles, (0, _styles.backgroundColorStyles)(), listsStyles, ruleStyles(), (0, _media.mediaStyles)(), (0, _layout.layoutStyles)(props.viewMode), _collab.telepointerStyle, _selection.gapCursorStyles, (0, _panel2.panelStyles)(), mentionsStyles, (0, _experiments.editorExperiment)('platform_editor_vanilla_dom', true, {
|
|
160
157
|
exposure: false
|
|
161
158
|
}) && vanillaMentionsStyles, (0, _experiments.editorExperiment)('platform_editor_vanilla_dom', true, {
|
|
162
159
|
exposure: false
|
|
@@ -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
|
}
|
|
@@ -407,7 +404,7 @@ const contentStyles = props => css`
|
|
|
407
404
|
${placeholderTextStyles}
|
|
408
405
|
${placeholderStyles}
|
|
409
406
|
${editorExperiment('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null}
|
|
410
|
-
${editorExperiment('platform_editor_controls', 'variant1') && fg('
|
|
407
|
+
${editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_quick_insert_placeholder') ? placeholderWrapStyles : null}
|
|
411
408
|
|
|
412
409
|
${codeBlockStyles()}
|
|
413
410
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "205.
|
|
2
|
+
export const version = "205.5.0";
|
|
@@ -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
|
}
|
|
@@ -148,7 +145,7 @@ var akEditorBreakpointForSmallDevice = "1266px";
|
|
|
148
145
|
var contentStyles = function contentStyles(props) {
|
|
149
146
|
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n\t--ak-editor--default-gutter-padding: ", "px;\n\t/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */\n\t--ak-editor--large-gutter-padding: ", "px;\n\t--ak-editor--default-layout-width: ", "px;\n\t--ak-editor--full-width-layout-width: ", "px;\n\t/* calculate editor line length, 100cqw is the editor container width */\n\t--ak-editor--line-length: min(\n\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\tvar(--ak-editor--default-layout-width)\n\t);\n\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t--ak-editor--breakout-full-page-guttering-padding: calc(\n\t\tvar(--ak-editor--large-gutter-padding) * 2 + var(--ak-editor--default-gutter-padding)\n\t);\n\n\t.fabric-editor--full-width-mode {\n\t\t--ak-editor--line-length: min(\n\t\t\tcalc(100cqw - var(--ak-editor--large-gutter-padding) * 2),\n\t\t\tvar(--ak-editor--full-width-layout-width)\n\t\t);\n\t}\n\n\t.ProseMirror {\n\t\t--ak-editor-max-container-width: calc(100cqw - var(--ak-editor--large-gutter-padding));\n\t}\n\n\t/* We can't allow nodes that are inside other nodes to bleed from the parent container */\n\t.ProseMirror > div[data-prosemirror-node-block] [data-prosemirror-node-block] {\n\t\t--ak-editor-max-container-width: 100%;\n\t}\n\n\t/* container editor-area is defined in platform/packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts */\n\t@container editor-area (width >= ", ") {\n\t\t.ProseMirror {\n\t\t\t--ak-editor--breakout-wide-layout-width: ", "px;\n\t\t}\n\t}\n\n\t.ProseMirror {\n\t\toutline: none;\n\t\tfont-size: ", "px;\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t}\n\n\t", "\n\n\t.ProseMirror-hideselection *::selection {\n\t\tbackground: transparent;\n\t}\n\n\t.ProseMirror-hideselection *::-moz-selection {\n\t\tbackground: transparent;\n\t}\n\n\t/**\n\t * This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24\n\t *\n\t * 1. Merge and Release platform_editor_hide_cursor_when_pm_hideselection\n\t * 2. Cleanup duplicated style from platform_editor_advanced_code_blocks\n\t * https://product-fabric.atlassian.net/browse/ED-26331\n\t */\n\t", "\n\n\t/* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24 */\n\t", "\n\n\t.ProseMirror-selectednode {\n\t\toutline: none;\n\t}\n\n\t.ProseMirror-selectednode:empty {\n\t\toutline: 2px solid ", ";\n\t}\n\n\t.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {\n\t\tcaret-color: transparent;\n\t}\n\t.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {\n\t\tdisplay: none;\n\t}\n\n\t", "\n\t", "\n\t", "\n\t", "\n\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\t", "\n\t", "\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n // Switch between the two icons based on the visual refresh feature gate\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\t", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n\t\tbox-sizing: border-box;\n\t}\n\n\t.mediaGroupView-content-wrap ul {\n\t\tpadding: 0;\n\t}\n\n\t/** Needed to override any cleared floats, e.g. image wrapping */\n\n\tdiv.fabric-editor-block-mark[class^='fabric-editor-align'] {\n\t\tclear: none !important;\n\t}\n\n\t.fabric-editor-align-end {\n\t\ttext-align: right;\n\t}\n\n\t.fabric-editor-align-start {\n\t\ttext-align: left;\n\t}\n\n\t.fabric-editor-align-center {\n\t\ttext-align: center;\n\t}\n\n\t// For FullPage only when inside a table\n\t// Related code all lives inside: packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts\n\t// In the \"editorContentAreaContainerStyle\" function\n\t.fabric-editor--full-width-mode {\n\t\t.pm-table-container {\n\t\t\t.code-block,\n\t\t\t.extension-container,\n\t\t\t.multiBodiedExtension--container {\n\t\t\t\tmax-width: 100%;\n\t\t\t}\n\t\t}\n\t}\n\n\t.pm-table-header-content-wrap :not(.fabric-editor-alignment),\n\t.pm-table-header-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark,\n\t.pm-table-cell-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark {\n\t\tp:first-of-type {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.pm-table-cell-content-wrap .mediaGroupView-content-wrap {\n\t\tclear: both;\n\t}\n\n\t.hyperlink-floating-toolbar,\n\t.", " {\n\t\tpadding: 0;\n\t}\n\n\t/* Legacy Link icon in the Atlaskit package\n is bigger than the others, new ADS icon does not have this issue\n */\n\t", "\n"])), akEditorGutterPadding, akEditorGutterPaddingDynamic(), akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorBreakpointForSmallDevice, akEditorCalculatedWideLayoutWidth, editorFontSize({
|
|
150
147
|
theme: props.theme
|
|
151
|
-
}), whitespaceSharedStyles, paragraphSharedStyles(props.typographyTheme), listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, fg('editor_request_to_edit_task') ? null : css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), fg('platform_editor_hide_cursor_when_pm_hideselection') ? css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, editorExperiment('platform_editor_advanced_code_blocks', true) ? css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, editorExperiment('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null, editorExperiment('platform_editor_controls', 'variant1') && fg('
|
|
148
|
+
}), whitespaceSharedStyles, paragraphSharedStyles(props.typographyTheme), listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, fg('editor_request_to_edit_task') ? null : css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\t\t\t"]))), fg('platform_editor_hide_cursor_when_pm_hideselection') ? css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, editorExperiment('platform_editor_advanced_code_blocks', true) ? css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n\t\t\t\t.ProseMirror-hideselection {\n\t\t\t\t\tcaret-color: transparent;\n\t\t\t\t}\n\t\t\t"]))) : null, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, editorExperiment('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null, editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_quick_insert_placeholder') ? placeholderWrapStyles : null, codeBlockStyles(), blocktypeStyles(props.typographyTheme), codeMarkSharedStyles(), textColorStyles, backgroundColorStyles(), listsStyles, ruleStyles(), mediaStyles(), layoutStyles(props.viewMode), telepointerStyle, gapCursorStyles, panelStyles(), mentionsStyles, editorExperiment('platform_editor_vanilla_dom', true, {
|
|
152
149
|
exposure: false
|
|
153
150
|
}) && vanillaMentionsStyles, editorExperiment('platform_editor_vanilla_dom', true, {
|
|
154
151
|
exposure: false
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "205.
|
|
2
|
+
export var version = "205.5.0";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EditorINPMetrics: () => null;
|