@atlaskit/editor-common 134.19.0 → 134.20.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 +29 -0
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +15 -5
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
- package/dist/cjs/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
- package/dist/cjs/media/messages/caption.js +5 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/table/normalize-column-widths.js +68 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/OverflowShadow/index.js +31 -1
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +15 -5
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
- package/dist/es2019/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
- package/dist/es2019/media/messages/caption.js +5 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/table/normalize-column-widths.js +46 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/OverflowShadow/index.js +29 -1
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +15 -5
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
- package/dist/esm/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
- package/dist/esm/media/messages/caption.js +5 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/table/normalize-column-widths.js +63 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/OverflowShadow/index.js +31 -1
- package/dist/types/media/messages/caption.d.ts +5 -0
- package/dist/types/table/normalize-column-widths.d.ts +10 -0
- package/dist/types/ui/OverflowShadow/index.d.ts +2 -0
- package/package.json +3 -3
- package/table/normalize-column-widths/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2828e9853e1d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2828e9853e1d1) -
|
|
8
|
+
Disable table sticky headers, overflow shadow tracking, and automatic table scaling when
|
|
9
|
+
Confluence View Page Performance Mode is active, controlled by
|
|
10
|
+
`confluence_view_page_performance_mode`. Preserve authored widths, horizontal scrolling, and
|
|
11
|
+
existing behavior outside Performance Mode. Share saved-width column normalization between full
|
|
12
|
+
and light tables, including number-column space, and preserve fit-to-content sizing in light
|
|
13
|
+
tables. Preserve inherited comment table sizing when no numeric table width is available.
|
|
14
|
+
- [`1d1b39fac5db6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1d1b39fac5db6) -
|
|
15
|
+
With the `cc_comments_media_viewer_sidebar` experiment and `cc_comments_inset_media_viewer`
|
|
16
|
+
feature gate on, clicking an image that is already selected opens the Media Viewer, and the first
|
|
17
|
+
click on an annotated image only selects it instead of also opening its comment. The caption
|
|
18
|
+
placeholder for an image then says "Add a caption - click again to preview".
|
|
19
|
+
|
|
20
|
+
`@atlaskit/editor-common` adds the `captionMessages.placeholderWithClickAgainPrompt` message.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`04d5009a56c68`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04d5009a56c68) -
|
|
25
|
+
Render an inline extension's edit-mode label container, wrapper and overlay as span elements
|
|
26
|
+
behind the `platform_editor_inline_extension_spans` experiment, so server-rendered inline
|
|
27
|
+
extensions stay inside their paragraph. With the experiment on, the inline extension label styles
|
|
28
|
+
target the span container, and task-item height styles apply only to the checkbox and placeholder
|
|
29
|
+
so inline extensions inside tasks keep their own height.
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
3
32
|
## 134.19.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
14
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var _hooks = require("../../../hooks");
|
|
@@ -87,6 +88,9 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
87
88
|
hideConfigureLabel = props.hideConfigureLabel;
|
|
88
89
|
var _ref3 = macroInteractionDesignFeatureFlags || {},
|
|
89
90
|
showMacroInteractionDesignUpdates = _ref3.showMacroInteractionDesignUpdates;
|
|
91
|
+
// The HTML parser closes an open `<p>` at a `<div>`, so server-rendered inline
|
|
92
|
+
// extensions need span elements to stay inside their paragraph.
|
|
93
|
+
var WrapperElement = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
90
94
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width'], function (states) {
|
|
91
95
|
var _states$widthState;
|
|
92
96
|
return {
|
|
@@ -123,26 +127,32 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
123
127
|
setIsNodeHovered: setIsNodeHovered,
|
|
124
128
|
pluginInjectionApi: pluginInjectionApi,
|
|
125
129
|
hideConfigureLabel: hideConfigureLabel
|
|
126
|
-
}), (0, _react2.jsx)(
|
|
127
|
-
"data-testid": "inline-extension-wrapper"
|
|
130
|
+
}), (0, _react2.jsx)(WrapperElement, {
|
|
131
|
+
"data-testid": "inline-extension-wrapper"
|
|
132
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
133
|
+
,
|
|
128
134
|
css: [
|
|
129
135
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
130
136
|
_styles2.wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, flowingInlineWrapperStyles]
|
|
131
137
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
132
138
|
,
|
|
133
|
-
className: classNames
|
|
139
|
+
className: classNames
|
|
140
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
141
|
+
,
|
|
134
142
|
onMouseEnter: function onMouseEnter() {
|
|
135
143
|
return handleMouseEvent(true);
|
|
136
144
|
}
|
|
137
145
|
// @atlassian/a11y/mouse-events-have-key-events: hover border is also accessible via keyboard selection.
|
|
138
146
|
// No-ops here satisfy the rule without duplicating state updates.
|
|
139
147
|
,
|
|
140
|
-
onFocus: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
148
|
+
onFocus: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
149
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
150
|
+
,
|
|
141
151
|
onMouseLeave: function onMouseLeave() {
|
|
142
152
|
return handleMouseEvent(false);
|
|
143
153
|
},
|
|
144
154
|
onBlur: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
145
|
-
}, (0, _react2.jsx)(
|
|
155
|
+
}, (0, _react2.jsx)(WrapperElement, {
|
|
146
156
|
css: _styles.overlay,
|
|
147
157
|
className: "extension-overlay"
|
|
148
158
|
}), children ? children : (0, _react2.jsx)(_Lozenge.default, {
|
|
@@ -36,6 +36,11 @@ var containerStyles = (0, _react2.css)({
|
|
|
36
36
|
marginTop: "var(--ds-space-300, 24px)"
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
// Keeps a span container laid out like the div it replaces.
|
|
41
|
+
var blockContainerStyles = (0, _react2.css)({
|
|
42
|
+
display: 'block'
|
|
43
|
+
});
|
|
39
44
|
var showLabelStyles = (0, _react2.css)({
|
|
40
45
|
opacity: 1
|
|
41
46
|
});
|
|
@@ -135,6 +140,9 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
135
140
|
showBodiedExtensionRendererView = _ref.showBodiedExtensionRendererView,
|
|
136
141
|
_pluginInjectionApi = _ref.pluginInjectionApi;
|
|
137
142
|
var isInlineExtension = extensionName === 'inlineExtension';
|
|
143
|
+
// Inside a paragraph, a div container would close the paragraph in server-rendered HTML.
|
|
144
|
+
var useSpanElements = isInlineExtension && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_inline_extension_spans');
|
|
145
|
+
var ContainerElement = useSpanElements ? 'span' : 'div';
|
|
138
146
|
var showDefaultBodiedStyles = isBodiedMacro;
|
|
139
147
|
var containerClassNames = (0, _classnames.default)({
|
|
140
148
|
bodied: isBodiedMacro
|
|
@@ -164,15 +172,18 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
164
172
|
};
|
|
165
173
|
return (
|
|
166
174
|
// eslint-disable-next-line @atlassian/a11y/no-static-element-interactions, @atlassian/a11y/click-events-have-key-events, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
167
|
-
(0, _react2.jsx)(
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
(0, _react2.jsx)(ContainerElement
|
|
176
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
177
|
+
, {
|
|
178
|
+
css: [containerStyles, useSpanElements && blockContainerStyles]
|
|
170
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
171
180
|
,
|
|
172
181
|
className: containerClassNames
|
|
173
182
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
174
183
|
,
|
|
175
|
-
style: customContainerStyles
|
|
184
|
+
style: customContainerStyles
|
|
185
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
186
|
+
,
|
|
176
187
|
onMouseOver: function onMouseOver() {
|
|
177
188
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(true);
|
|
178
189
|
}
|
|
@@ -180,7 +191,9 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
180
191
|
// handled via the .ak-editor-selected-node CSS class applied by ProseMirror on node selection.
|
|
181
192
|
// No-ops here satisfy the rule.
|
|
182
193
|
,
|
|
183
|
-
onFocus: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
194
|
+
onFocus: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
195
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
196
|
+
,
|
|
184
197
|
onMouseLeave: function onMouseLeave() {
|
|
185
198
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(false);
|
|
186
199
|
},
|
|
@@ -215,6 +228,7 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
215
228
|
label: ""
|
|
216
229
|
})));
|
|
217
230
|
}), (0, _react2.jsx)(_box.Box, {
|
|
231
|
+
as: useSpanElements ? 'span' : 'div',
|
|
218
232
|
xcss: spacerStyles
|
|
219
233
|
}))
|
|
220
234
|
);
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _file = _interopRequireDefault(require("@atlaskit/icon/core/file"));
|
|
12
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
13
|
var _styles = require("../styles");
|
|
13
14
|
var _EditToggle = require("./EditToggle");
|
|
14
15
|
var _ExtensionLabel = require("./ExtensionLabel");
|
|
@@ -64,9 +65,11 @@ var LozengeComponent = exports.LozengeComponent = function LozengeComponent(_ref
|
|
|
64
65
|
}));
|
|
65
66
|
}
|
|
66
67
|
var isBlockExtension = extensionName === 'extension';
|
|
68
|
+
// A div inside an inline extension would close its paragraph in server-rendered HTML.
|
|
69
|
+
var FallbackElement = extensionName === 'inlineExtension' && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
67
70
|
return (
|
|
68
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
69
|
-
(0, _react2.jsx)(
|
|
72
|
+
(0, _react2.jsx)(FallbackElement, {
|
|
70
73
|
"data-testid": "lozenge-fallback",
|
|
71
74
|
css: _styles.placeholderFallback
|
|
72
75
|
}, lozengeData && !isBlockExtension ? renderImage(_objectSpread({
|
|
@@ -11,6 +11,11 @@ var captionMessages = exports.captionMessages = (0, _reactIntl.defineMessages)({
|
|
|
11
11
|
defaultMessage: 'Add a caption',
|
|
12
12
|
description: 'Placeholder description for an empty (new) caption in the editor'
|
|
13
13
|
},
|
|
14
|
+
placeholderWithClickAgainPrompt: {
|
|
15
|
+
id: 'fabric.editor.captionPlaceholderWithClickAgainPrompt',
|
|
16
|
+
defaultMessage: 'Add a caption - click again to preview',
|
|
17
|
+
description: 'Placeholder description to prompt users to add a caption and click already selected media again to preview'
|
|
18
|
+
},
|
|
14
19
|
placeholderWithDoubleClickPrompt: {
|
|
15
20
|
id: 'fabric.editor.captionPlaceholderWithDoubleClickPrompt',
|
|
16
21
|
defaultMessage: 'Add a caption - double-click to preview',
|
|
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
27
27
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
28
28
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
29
29
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
30
|
-
var packageVersion = "134.
|
|
30
|
+
var packageVersion = "134.19.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.normalizeTableColumnWidths = void 0;
|
|
7
|
+
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
8
|
+
var _table = require("../styles/shared/table");
|
|
9
|
+
/**
|
|
10
|
+
* Fits columns to a saved table width, independently of the viewport. Zero widths share the
|
|
11
|
+
* remaining space; minimum widths can require overflow when the saved table is too narrow.
|
|
12
|
+
*/
|
|
13
|
+
var normalizeTableColumnWidths = exports.normalizeTableColumnWidths = function normalizeTableColumnWidths(_ref) {
|
|
14
|
+
var columnWidths = _ref.columnWidths,
|
|
15
|
+
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
16
|
+
_ref$skipMinWidth = _ref.skipMinWidth,
|
|
17
|
+
skipMinWidth = _ref$skipMinWidth === void 0 ? false : _ref$skipMinWidth,
|
|
18
|
+
tableWidth = _ref.tableWidth;
|
|
19
|
+
var unsizedCount = columnWidths.filter(function (width) {
|
|
20
|
+
return width === 0;
|
|
21
|
+
}).length;
|
|
22
|
+
var minWidth = skipMinWidth ? 0 : unsizedCount && unsizedCount < columnWidths.length ? _constants.akEditorTableLegacyCellMinWidth : _table.tableCellMinWidth;
|
|
23
|
+
var availableWidth = Math.max(tableWidth - _table.tableCellBorderWidth - (isNumberColumnEnabled ? _constants.akEditorTableNumberColumnWidth : 0), columnWidths.length * minWidth);
|
|
24
|
+
var widths = columnWidths.map(function (width) {
|
|
25
|
+
return width ? Math.max(width - _table.tableCellBorderWidth, minWidth) : 0;
|
|
26
|
+
});
|
|
27
|
+
var remaining = columnWidths.flatMap(function (width, index) {
|
|
28
|
+
return width ? [index] : [];
|
|
29
|
+
});
|
|
30
|
+
if (unsizedCount) {
|
|
31
|
+
var sizedTotal = widths.reduce(function (sum, width) {
|
|
32
|
+
return sum + width;
|
|
33
|
+
}, 0);
|
|
34
|
+
var unsizedWidth = Math.max((availableWidth - sizedTotal) / unsizedCount, minWidth);
|
|
35
|
+
columnWidths.forEach(function (width, index) {
|
|
36
|
+
if (!width) {
|
|
37
|
+
widths[index] = unsizedWidth;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
availableWidth -= unsizedWidth * unsizedCount;
|
|
41
|
+
}
|
|
42
|
+
var _loop = function _loop() {
|
|
43
|
+
var total = remaining.reduce(function (sum, index) {
|
|
44
|
+
return sum + widths[index];
|
|
45
|
+
}, 0);
|
|
46
|
+
var scale = total ? availableWidth / total : 0;
|
|
47
|
+
var constrained = remaining.filter(function (index) {
|
|
48
|
+
return widths[index] * scale < minWidth;
|
|
49
|
+
});
|
|
50
|
+
if (!constrained.length) {
|
|
51
|
+
remaining.forEach(function (index) {
|
|
52
|
+
widths[index] = total ? widths[index] * scale : availableWidth / remaining.length;
|
|
53
|
+
});
|
|
54
|
+
return 1; // break
|
|
55
|
+
}
|
|
56
|
+
constrained.forEach(function (index) {
|
|
57
|
+
widths[index] = minWidth;
|
|
58
|
+
availableWidth -= minWidth;
|
|
59
|
+
});
|
|
60
|
+
remaining = remaining.filter(function (index) {
|
|
61
|
+
return !constrained.includes(index);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
while (remaining.length) {
|
|
65
|
+
if (_loop()) break;
|
|
66
|
+
}
|
|
67
|
+
return widths;
|
|
68
|
+
};
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "134.
|
|
26
|
+
var packageVersion = "134.19.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -116,6 +116,9 @@ function overflowShadow(Component, options) {
|
|
|
116
116
|
return (0, _createClass2.default)(OverflowShadow, [{
|
|
117
117
|
key: "isDisabled",
|
|
118
118
|
get: function get() {
|
|
119
|
+
if (this.props.disableShadowTracking) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
119
122
|
if (this.disabled === undefined) {
|
|
120
123
|
var _options$isDisabled, _options$isDisabled2;
|
|
121
124
|
this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
|
|
@@ -137,7 +140,20 @@ function overflowShadow(Component, options) {
|
|
|
137
140
|
}
|
|
138
141
|
}, {
|
|
139
142
|
key: "componentDidUpdate",
|
|
140
|
-
value: function componentDidUpdate() {
|
|
143
|
+
value: function componentDidUpdate(prevProps) {
|
|
144
|
+
if (this.props.disableShadowTracking !== prevProps.disableShadowTracking) {
|
|
145
|
+
if (this.props.disableShadowTracking) {
|
|
146
|
+
var _this$shadowObserver, _this$overflowContain;
|
|
147
|
+
(_this$shadowObserver = this.shadowObserver) === null || _this$shadowObserver === void 0 || _this$shadowObserver.dispose();
|
|
148
|
+
this.shadowObserver = undefined;
|
|
149
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
150
|
+
(_this$overflowContain = this.overflowContainer) === null || _this$overflowContain === void 0 || _this$overflowContain.removeEventListener('scroll', this.handleScroll);
|
|
151
|
+
} else if (prevProps.disableShadowTracking && this.container) {
|
|
152
|
+
var container = this.container;
|
|
153
|
+
this.container = undefined;
|
|
154
|
+
this.handleContainer(container);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
141
157
|
if (!options.useShadowObserver) {
|
|
142
158
|
this.updateShadows();
|
|
143
159
|
}
|
|
@@ -152,6 +168,9 @@ function overflowShadow(Component, options) {
|
|
|
152
168
|
this.shadowObserver = new _shadowObserver.ShadowObserver({
|
|
153
169
|
scrollContainer: this.overflowContainer,
|
|
154
170
|
onUpdateShadows: function onUpdateShadows(shadowStates) {
|
|
171
|
+
if (_this2.props.disableShadowTracking) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
155
174
|
_this2.setState(function (prevState) {
|
|
156
175
|
var showLeftShadow = shadowStates.showLeftShadow,
|
|
157
176
|
showRightShadow = shadowStates.showRightShadow;
|
|
@@ -190,6 +209,17 @@ function overflowShadow(Component, options) {
|
|
|
190
209
|
// eslint-disable-next-line react/jsx-props-no-spreading -- Spreading props to pass all component props through to wrapped generic component
|
|
191
210
|
}, this.props));
|
|
192
211
|
}
|
|
212
|
+
}], [{
|
|
213
|
+
key: "getDerivedStateFromProps",
|
|
214
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
215
|
+
if (props.disableShadowTracking && (state.showLeftShadow || state.showRightShadow)) {
|
|
216
|
+
return {
|
|
217
|
+
showLeftShadow: false,
|
|
218
|
+
showRightShadow: false
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
193
223
|
}]);
|
|
194
224
|
}(_react.default.Component);
|
|
195
225
|
}
|
|
@@ -8,6 +8,7 @@ import React, { Fragment, useMemo } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles/constants';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
12
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
14
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
@@ -80,6 +81,9 @@ const InlineExtension = props => {
|
|
|
80
81
|
const {
|
|
81
82
|
showMacroInteractionDesignUpdates
|
|
82
83
|
} = macroInteractionDesignFeatureFlags || {};
|
|
84
|
+
// The HTML parser closes an open `<p>` at a `<div>`, so server-rendered inline
|
|
85
|
+
// extensions need span elements to stay inside their paragraph.
|
|
86
|
+
const WrapperElement = isExperimentEnabled('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
83
87
|
const {
|
|
84
88
|
width
|
|
85
89
|
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], states => {
|
|
@@ -117,22 +121,28 @@ const InlineExtension = props => {
|
|
|
117
121
|
setIsNodeHovered: setIsNodeHovered,
|
|
118
122
|
pluginInjectionApi: pluginInjectionApi,
|
|
119
123
|
hideConfigureLabel: hideConfigureLabel
|
|
120
|
-
}), jsx(
|
|
121
|
-
"data-testid": "inline-extension-wrapper"
|
|
124
|
+
}), jsx(WrapperElement, {
|
|
125
|
+
"data-testid": "inline-extension-wrapper"
|
|
126
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
127
|
+
,
|
|
122
128
|
css: [
|
|
123
129
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
124
130
|
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, flowingInlineWrapperStyles]
|
|
125
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
126
132
|
,
|
|
127
|
-
className: classNames
|
|
133
|
+
className: classNames
|
|
134
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
135
|
+
,
|
|
128
136
|
onMouseEnter: () => handleMouseEvent(true)
|
|
129
137
|
// @atlassian/a11y/mouse-events-have-key-events: hover border is also accessible via keyboard selection.
|
|
130
138
|
// No-ops here satisfy the rule without duplicating state updates.
|
|
131
139
|
,
|
|
132
|
-
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
140
|
+
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
141
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
142
|
+
,
|
|
133
143
|
onMouseLeave: () => handleMouseEvent(false),
|
|
134
144
|
onBlur: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
135
|
-
}, jsx(
|
|
145
|
+
}, jsx(WrapperElement, {
|
|
136
146
|
css: overlay,
|
|
137
147
|
className: "extension-overlay"
|
|
138
148
|
}), children ? children : jsx(ExtensionLozenge, {
|
|
@@ -26,6 +26,11 @@ const containerStyles = css({
|
|
|
26
26
|
marginTop: "var(--ds-space-300, 24px)"
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
// Keeps a span container laid out like the div it replaces.
|
|
31
|
+
const blockContainerStyles = css({
|
|
32
|
+
display: 'block'
|
|
33
|
+
});
|
|
29
34
|
const showLabelStyles = css({
|
|
30
35
|
opacity: 1
|
|
31
36
|
});
|
|
@@ -126,6 +131,9 @@ export const ExtensionLabel = ({
|
|
|
126
131
|
pluginInjectionApi: _pluginInjectionApi
|
|
127
132
|
}) => {
|
|
128
133
|
const isInlineExtension = extensionName === 'inlineExtension';
|
|
134
|
+
// Inside a paragraph, a div container would close the paragraph in server-rendered HTML.
|
|
135
|
+
const useSpanElements = isInlineExtension && isExperimentEnabled('platform_editor_inline_extension_spans');
|
|
136
|
+
const ContainerElement = useSpanElements ? 'span' : 'div';
|
|
129
137
|
const showDefaultBodiedStyles = isBodiedMacro;
|
|
130
138
|
const containerClassNames = classnames({
|
|
131
139
|
bodied: isBodiedMacro
|
|
@@ -153,15 +161,18 @@ export const ExtensionLabel = ({
|
|
|
153
161
|
};
|
|
154
162
|
return (
|
|
155
163
|
// eslint-disable-next-line @atlassian/a11y/no-static-element-interactions, @atlassian/a11y/click-events-have-key-events, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
156
|
-
jsx(
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
jsx(ContainerElement
|
|
165
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
166
|
+
, {
|
|
167
|
+
css: [containerStyles, useSpanElements && blockContainerStyles]
|
|
159
168
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
160
169
|
,
|
|
161
170
|
className: containerClassNames
|
|
162
171
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
163
172
|
,
|
|
164
|
-
style: customContainerStyles
|
|
173
|
+
style: customContainerStyles
|
|
174
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
175
|
+
,
|
|
165
176
|
onMouseOver: () => {
|
|
166
177
|
setIsNodeHovered === null || setIsNodeHovered === void 0 ? void 0 : setIsNodeHovered(true);
|
|
167
178
|
}
|
|
@@ -169,7 +180,9 @@ export const ExtensionLabel = ({
|
|
|
169
180
|
// handled via the .ak-editor-selected-node CSS class applied by ProseMirror on node selection.
|
|
170
181
|
// No-ops here satisfy the rule.
|
|
171
182
|
,
|
|
172
|
-
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
183
|
+
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? () => {} : undefined
|
|
184
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
185
|
+
,
|
|
173
186
|
onMouseLeave: () => {
|
|
174
187
|
setIsNodeHovered === null || setIsNodeHovered === void 0 ? void 0 : setIsNodeHovered(false);
|
|
175
188
|
},
|
|
@@ -202,6 +215,7 @@ export const ExtensionLabel = ({
|
|
|
202
215
|
}, jsx(CustomizeIcon, {
|
|
203
216
|
label: ""
|
|
204
217
|
})))), jsx(Box, {
|
|
218
|
+
as: useSpanElements ? 'span' : 'div',
|
|
205
219
|
xcss: spacerStyles
|
|
206
220
|
}))
|
|
207
221
|
);
|
|
@@ -8,6 +8,7 @@ import { Fragment } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import EditorFileIcon from '@atlaskit/icon/core/file';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { placeholderFallback, placeholderFallbackParams } from '../styles';
|
|
12
13
|
import { EditToggle } from './EditToggle';
|
|
13
14
|
import { ExtensionLabel } from './ExtensionLabel';
|
|
@@ -59,9 +60,11 @@ export const LozengeComponent = ({
|
|
|
59
60
|
}));
|
|
60
61
|
}
|
|
61
62
|
const isBlockExtension = extensionName === 'extension';
|
|
63
|
+
// A div inside an inline extension would close its paragraph in server-rendered HTML.
|
|
64
|
+
const FallbackElement = extensionName === 'inlineExtension' && isExperimentEnabled('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
62
65
|
return (
|
|
63
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
64
|
-
jsx(
|
|
67
|
+
jsx(FallbackElement, {
|
|
65
68
|
"data-testid": "lozenge-fallback",
|
|
66
69
|
css: placeholderFallback
|
|
67
70
|
}, lozengeData && !isBlockExtension ? renderImage({
|
|
@@ -5,6 +5,11 @@ export const captionMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Add a caption',
|
|
6
6
|
description: 'Placeholder description for an empty (new) caption in the editor'
|
|
7
7
|
},
|
|
8
|
+
placeholderWithClickAgainPrompt: {
|
|
9
|
+
id: 'fabric.editor.captionPlaceholderWithClickAgainPrompt',
|
|
10
|
+
defaultMessage: 'Add a caption - click again to preview',
|
|
11
|
+
description: 'Placeholder description to prompt users to add a caption and click already selected media again to preview'
|
|
12
|
+
},
|
|
8
13
|
placeholderWithDoubleClickPrompt: {
|
|
9
14
|
id: 'fabric.editor.captionPlaceholderWithDoubleClickPrompt',
|
|
10
15
|
defaultMessage: 'Add a caption - double-click to preview',
|
|
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
13
13
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
14
14
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
15
15
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.19.0";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles/constants';
|
|
2
|
+
import { tableCellBorderWidth, tableCellMinWidth } from '../styles/shared/table';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fits columns to a saved table width, independently of the viewport. Zero widths share the
|
|
6
|
+
* remaining space; minimum widths can require overflow when the saved table is too narrow.
|
|
7
|
+
*/
|
|
8
|
+
export const normalizeTableColumnWidths = ({
|
|
9
|
+
columnWidths,
|
|
10
|
+
isNumberColumnEnabled,
|
|
11
|
+
skipMinWidth = false,
|
|
12
|
+
tableWidth
|
|
13
|
+
}) => {
|
|
14
|
+
const unsizedCount = columnWidths.filter(width => width === 0).length;
|
|
15
|
+
const minWidth = skipMinWidth ? 0 : unsizedCount && unsizedCount < columnWidths.length ? akEditorTableLegacyCellMinWidth : tableCellMinWidth;
|
|
16
|
+
let availableWidth = Math.max(tableWidth - tableCellBorderWidth - (isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0), columnWidths.length * minWidth);
|
|
17
|
+
const widths = columnWidths.map(width => width ? Math.max(width - tableCellBorderWidth, minWidth) : 0);
|
|
18
|
+
let remaining = columnWidths.flatMap((width, index) => width ? [index] : []);
|
|
19
|
+
if (unsizedCount) {
|
|
20
|
+
const sizedTotal = widths.reduce((sum, width) => sum + width, 0);
|
|
21
|
+
const unsizedWidth = Math.max((availableWidth - sizedTotal) / unsizedCount, minWidth);
|
|
22
|
+
columnWidths.forEach((width, index) => {
|
|
23
|
+
if (!width) {
|
|
24
|
+
widths[index] = unsizedWidth;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
availableWidth -= unsizedWidth * unsizedCount;
|
|
28
|
+
}
|
|
29
|
+
while (remaining.length) {
|
|
30
|
+
const total = remaining.reduce((sum, index) => sum + widths[index], 0);
|
|
31
|
+
const scale = total ? availableWidth / total : 0;
|
|
32
|
+
const constrained = remaining.filter(index => widths[index] * scale < minWidth);
|
|
33
|
+
if (!constrained.length) {
|
|
34
|
+
remaining.forEach(index => {
|
|
35
|
+
widths[index] = total ? widths[index] * scale : availableWidth / remaining.length;
|
|
36
|
+
});
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
constrained.forEach(index => {
|
|
40
|
+
widths[index] = minWidth;
|
|
41
|
+
availableWidth -= minWidth;
|
|
42
|
+
});
|
|
43
|
+
remaining = remaining.filter(index => !constrained.includes(index));
|
|
44
|
+
}
|
|
45
|
+
return widths;
|
|
46
|
+
};
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.19.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -91,7 +91,19 @@ export default function overflowShadow(Component, options) {
|
|
|
91
91
|
this.overflowContainer.addEventListener('scroll', this.handleScroll);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
static getDerivedStateFromProps(props, state) {
|
|
95
|
+
if (props.disableShadowTracking && (state.showLeftShadow || state.showRightShadow)) {
|
|
96
|
+
return {
|
|
97
|
+
showLeftShadow: false,
|
|
98
|
+
showRightShadow: false
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
94
103
|
get isDisabled() {
|
|
104
|
+
if (this.props.disableShadowTracking) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
95
107
|
if (this.disabled === undefined) {
|
|
96
108
|
var _options$isDisabled, _options$isDisabled2;
|
|
97
109
|
this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
|
|
@@ -109,7 +121,20 @@ export default function overflowShadow(Component, options) {
|
|
|
109
121
|
}
|
|
110
122
|
this.updateShadows();
|
|
111
123
|
}
|
|
112
|
-
componentDidUpdate() {
|
|
124
|
+
componentDidUpdate(prevProps) {
|
|
125
|
+
if (this.props.disableShadowTracking !== prevProps.disableShadowTracking) {
|
|
126
|
+
if (this.props.disableShadowTracking) {
|
|
127
|
+
var _this$shadowObserver, _this$overflowContain;
|
|
128
|
+
(_this$shadowObserver = this.shadowObserver) === null || _this$shadowObserver === void 0 ? void 0 : _this$shadowObserver.dispose();
|
|
129
|
+
this.shadowObserver = undefined;
|
|
130
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
131
|
+
(_this$overflowContain = this.overflowContainer) === null || _this$overflowContain === void 0 ? void 0 : _this$overflowContain.removeEventListener('scroll', this.handleScroll);
|
|
132
|
+
} else if (prevProps.disableShadowTracking && this.container) {
|
|
133
|
+
const container = this.container;
|
|
134
|
+
this.container = undefined;
|
|
135
|
+
this.handleContainer(container);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
113
138
|
if (!options.useShadowObserver) {
|
|
114
139
|
this.updateShadows();
|
|
115
140
|
}
|
|
@@ -121,6 +146,9 @@ export default function overflowShadow(Component, options) {
|
|
|
121
146
|
this.shadowObserver = new ShadowObserver({
|
|
122
147
|
scrollContainer: this.overflowContainer,
|
|
123
148
|
onUpdateShadows: shadowStates => {
|
|
149
|
+
if (this.props.disableShadowTracking) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
124
152
|
this.setState(prevState => {
|
|
125
153
|
const {
|
|
126
154
|
showLeftShadow,
|
|
@@ -8,6 +8,7 @@ import React, { Fragment, useMemo } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
10
|
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles/constants';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
12
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
14
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
@@ -77,6 +78,9 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
77
78
|
hideConfigureLabel = props.hideConfigureLabel;
|
|
78
79
|
var _ref3 = macroInteractionDesignFeatureFlags || {},
|
|
79
80
|
showMacroInteractionDesignUpdates = _ref3.showMacroInteractionDesignUpdates;
|
|
81
|
+
// The HTML parser closes an open `<p>` at a `<div>`, so server-rendered inline
|
|
82
|
+
// extensions need span elements to stay inside their paragraph.
|
|
83
|
+
var WrapperElement = isExperimentEnabled('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
80
84
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width'], function (states) {
|
|
81
85
|
var _states$widthState;
|
|
82
86
|
return {
|
|
@@ -113,26 +117,32 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
113
117
|
setIsNodeHovered: setIsNodeHovered,
|
|
114
118
|
pluginInjectionApi: pluginInjectionApi,
|
|
115
119
|
hideConfigureLabel: hideConfigureLabel
|
|
116
|
-
}), jsx(
|
|
117
|
-
"data-testid": "inline-extension-wrapper"
|
|
120
|
+
}), jsx(WrapperElement, {
|
|
121
|
+
"data-testid": "inline-extension-wrapper"
|
|
122
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
123
|
+
,
|
|
118
124
|
css: [
|
|
119
125
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
120
126
|
wrapperStyle, inlineWrapperStyles, showMacroInteractionDesignUpdates && !isLivePageViewMode && hoverStyles, flowingInlineWrapperStyles]
|
|
121
127
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
122
128
|
,
|
|
123
|
-
className: classNames
|
|
129
|
+
className: classNames
|
|
130
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
131
|
+
,
|
|
124
132
|
onMouseEnter: function onMouseEnter() {
|
|
125
133
|
return handleMouseEvent(true);
|
|
126
134
|
}
|
|
127
135
|
// @atlassian/a11y/mouse-events-have-key-events: hover border is also accessible via keyboard selection.
|
|
128
136
|
// No-ops here satisfy the rule without duplicating state updates.
|
|
129
137
|
,
|
|
130
|
-
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
138
|
+
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
139
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- WrapperElement is a 'span' or 'div' tag, not a component
|
|
140
|
+
,
|
|
131
141
|
onMouseLeave: function onMouseLeave() {
|
|
132
142
|
return handleMouseEvent(false);
|
|
133
143
|
},
|
|
134
144
|
onBlur: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
135
|
-
}, jsx(
|
|
145
|
+
}, jsx(WrapperElement, {
|
|
136
146
|
css: overlay,
|
|
137
147
|
className: "extension-overlay"
|
|
138
148
|
}), children ? children : jsx(ExtensionLozenge, {
|
|
@@ -26,6 +26,11 @@ var containerStyles = css({
|
|
|
26
26
|
marginTop: "var(--ds-space-300, 24px)"
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
// Keeps a span container laid out like the div it replaces.
|
|
31
|
+
var blockContainerStyles = css({
|
|
32
|
+
display: 'block'
|
|
33
|
+
});
|
|
29
34
|
var showLabelStyles = css({
|
|
30
35
|
opacity: 1
|
|
31
36
|
});
|
|
@@ -125,6 +130,9 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
125
130
|
showBodiedExtensionRendererView = _ref.showBodiedExtensionRendererView,
|
|
126
131
|
_pluginInjectionApi = _ref.pluginInjectionApi;
|
|
127
132
|
var isInlineExtension = extensionName === 'inlineExtension';
|
|
133
|
+
// Inside a paragraph, a div container would close the paragraph in server-rendered HTML.
|
|
134
|
+
var useSpanElements = isInlineExtension && isExperimentEnabled('platform_editor_inline_extension_spans');
|
|
135
|
+
var ContainerElement = useSpanElements ? 'span' : 'div';
|
|
128
136
|
var showDefaultBodiedStyles = isBodiedMacro;
|
|
129
137
|
var containerClassNames = classnames({
|
|
130
138
|
bodied: isBodiedMacro
|
|
@@ -154,15 +162,18 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
154
162
|
};
|
|
155
163
|
return (
|
|
156
164
|
// eslint-disable-next-line @atlassian/a11y/no-static-element-interactions, @atlassian/a11y/click-events-have-key-events, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
157
|
-
jsx(
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
jsx(ContainerElement
|
|
166
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
167
|
+
, {
|
|
168
|
+
css: [containerStyles, useSpanElements && blockContainerStyles]
|
|
160
169
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
161
170
|
,
|
|
162
171
|
className: containerClassNames
|
|
163
172
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
164
173
|
,
|
|
165
|
-
style: customContainerStyles
|
|
174
|
+
style: customContainerStyles
|
|
175
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
176
|
+
,
|
|
166
177
|
onMouseOver: function onMouseOver() {
|
|
167
178
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(true);
|
|
168
179
|
}
|
|
@@ -170,7 +181,9 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
170
181
|
// handled via the .ak-editor-selected-node CSS class applied by ProseMirror on node selection.
|
|
171
182
|
// No-ops here satisfy the rule.
|
|
172
183
|
,
|
|
173
|
-
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
184
|
+
onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
|
|
185
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- ContainerElement is a 'span' or 'div' tag, not a component
|
|
186
|
+
,
|
|
174
187
|
onMouseLeave: function onMouseLeave() {
|
|
175
188
|
setIsNodeHovered === null || setIsNodeHovered === void 0 || setIsNodeHovered(false);
|
|
176
189
|
},
|
|
@@ -205,6 +218,7 @@ export var ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
205
218
|
label: ""
|
|
206
219
|
})));
|
|
207
220
|
}), jsx(Box, {
|
|
221
|
+
as: useSpanElements ? 'span' : 'div',
|
|
208
222
|
xcss: spacerStyles
|
|
209
223
|
}))
|
|
210
224
|
);
|
|
@@ -11,6 +11,7 @@ import { Fragment } from 'react';
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
13
|
import EditorFileIcon from '@atlaskit/icon/core/file';
|
|
14
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
15
|
import { placeholderFallback, placeholderFallbackParams } from '../styles';
|
|
15
16
|
import { EditToggle } from './EditToggle';
|
|
16
17
|
import { ExtensionLabel } from './ExtensionLabel';
|
|
@@ -61,9 +62,11 @@ export var LozengeComponent = function LozengeComponent(_ref) {
|
|
|
61
62
|
}));
|
|
62
63
|
}
|
|
63
64
|
var isBlockExtension = extensionName === 'extension';
|
|
65
|
+
// A div inside an inline extension would close its paragraph in server-rendered HTML.
|
|
66
|
+
var FallbackElement = extensionName === 'inlineExtension' && isExperimentEnabled('platform_editor_inline_extension_spans') ? 'span' : 'div';
|
|
64
67
|
return (
|
|
65
68
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
66
|
-
jsx(
|
|
69
|
+
jsx(FallbackElement, {
|
|
67
70
|
"data-testid": "lozenge-fallback",
|
|
68
71
|
css: placeholderFallback
|
|
69
72
|
}, lozengeData && !isBlockExtension ? renderImage(_objectSpread({
|
|
@@ -5,6 +5,11 @@ export var captionMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Add a caption',
|
|
6
6
|
description: 'Placeholder description for an empty (new) caption in the editor'
|
|
7
7
|
},
|
|
8
|
+
placeholderWithClickAgainPrompt: {
|
|
9
|
+
id: 'fabric.editor.captionPlaceholderWithClickAgainPrompt',
|
|
10
|
+
defaultMessage: 'Add a caption - click again to preview',
|
|
11
|
+
description: 'Placeholder description to prompt users to add a caption and click already selected media again to preview'
|
|
12
|
+
},
|
|
8
13
|
placeholderWithDoubleClickPrompt: {
|
|
9
14
|
id: 'fabric.editor.captionPlaceholderWithDoubleClickPrompt',
|
|
10
15
|
defaultMessage: 'Add a caption - double-click to preview',
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "134.
|
|
22
|
+
var packageVersion = "134.19.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles/constants';
|
|
2
|
+
import { tableCellBorderWidth, tableCellMinWidth } from '../styles/shared/table';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fits columns to a saved table width, independently of the viewport. Zero widths share the
|
|
6
|
+
* remaining space; minimum widths can require overflow when the saved table is too narrow.
|
|
7
|
+
*/
|
|
8
|
+
export var normalizeTableColumnWidths = function normalizeTableColumnWidths(_ref) {
|
|
9
|
+
var columnWidths = _ref.columnWidths,
|
|
10
|
+
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
11
|
+
_ref$skipMinWidth = _ref.skipMinWidth,
|
|
12
|
+
skipMinWidth = _ref$skipMinWidth === void 0 ? false : _ref$skipMinWidth,
|
|
13
|
+
tableWidth = _ref.tableWidth;
|
|
14
|
+
var unsizedCount = columnWidths.filter(function (width) {
|
|
15
|
+
return width === 0;
|
|
16
|
+
}).length;
|
|
17
|
+
var minWidth = skipMinWidth ? 0 : unsizedCount && unsizedCount < columnWidths.length ? akEditorTableLegacyCellMinWidth : tableCellMinWidth;
|
|
18
|
+
var availableWidth = Math.max(tableWidth - tableCellBorderWidth - (isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0), columnWidths.length * minWidth);
|
|
19
|
+
var widths = columnWidths.map(function (width) {
|
|
20
|
+
return width ? Math.max(width - tableCellBorderWidth, minWidth) : 0;
|
|
21
|
+
});
|
|
22
|
+
var remaining = columnWidths.flatMap(function (width, index) {
|
|
23
|
+
return width ? [index] : [];
|
|
24
|
+
});
|
|
25
|
+
if (unsizedCount) {
|
|
26
|
+
var sizedTotal = widths.reduce(function (sum, width) {
|
|
27
|
+
return sum + width;
|
|
28
|
+
}, 0);
|
|
29
|
+
var unsizedWidth = Math.max((availableWidth - sizedTotal) / unsizedCount, minWidth);
|
|
30
|
+
columnWidths.forEach(function (width, index) {
|
|
31
|
+
if (!width) {
|
|
32
|
+
widths[index] = unsizedWidth;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
availableWidth -= unsizedWidth * unsizedCount;
|
|
36
|
+
}
|
|
37
|
+
var _loop = function _loop() {
|
|
38
|
+
var total = remaining.reduce(function (sum, index) {
|
|
39
|
+
return sum + widths[index];
|
|
40
|
+
}, 0);
|
|
41
|
+
var scale = total ? availableWidth / total : 0;
|
|
42
|
+
var constrained = remaining.filter(function (index) {
|
|
43
|
+
return widths[index] * scale < minWidth;
|
|
44
|
+
});
|
|
45
|
+
if (!constrained.length) {
|
|
46
|
+
remaining.forEach(function (index) {
|
|
47
|
+
widths[index] = total ? widths[index] * scale : availableWidth / remaining.length;
|
|
48
|
+
});
|
|
49
|
+
return 1; // break
|
|
50
|
+
}
|
|
51
|
+
constrained.forEach(function (index) {
|
|
52
|
+
widths[index] = minWidth;
|
|
53
|
+
availableWidth -= minWidth;
|
|
54
|
+
});
|
|
55
|
+
remaining = remaining.filter(function (index) {
|
|
56
|
+
return !constrained.includes(index);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
while (remaining.length) {
|
|
60
|
+
if (_loop()) break;
|
|
61
|
+
}
|
|
62
|
+
return widths;
|
|
63
|
+
};
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "134.
|
|
23
|
+
var packageVersion = "134.19.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -108,6 +108,9 @@ export default function overflowShadow(Component, options) {
|
|
|
108
108
|
return _createClass(OverflowShadow, [{
|
|
109
109
|
key: "isDisabled",
|
|
110
110
|
get: function get() {
|
|
111
|
+
if (this.props.disableShadowTracking) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
111
114
|
if (this.disabled === undefined) {
|
|
112
115
|
var _options$isDisabled, _options$isDisabled2;
|
|
113
116
|
this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
|
|
@@ -129,7 +132,20 @@ export default function overflowShadow(Component, options) {
|
|
|
129
132
|
}
|
|
130
133
|
}, {
|
|
131
134
|
key: "componentDidUpdate",
|
|
132
|
-
value: function componentDidUpdate() {
|
|
135
|
+
value: function componentDidUpdate(prevProps) {
|
|
136
|
+
if (this.props.disableShadowTracking !== prevProps.disableShadowTracking) {
|
|
137
|
+
if (this.props.disableShadowTracking) {
|
|
138
|
+
var _this$shadowObserver, _this$overflowContain;
|
|
139
|
+
(_this$shadowObserver = this.shadowObserver) === null || _this$shadowObserver === void 0 || _this$shadowObserver.dispose();
|
|
140
|
+
this.shadowObserver = undefined;
|
|
141
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
142
|
+
(_this$overflowContain = this.overflowContainer) === null || _this$overflowContain === void 0 || _this$overflowContain.removeEventListener('scroll', this.handleScroll);
|
|
143
|
+
} else if (prevProps.disableShadowTracking && this.container) {
|
|
144
|
+
var container = this.container;
|
|
145
|
+
this.container = undefined;
|
|
146
|
+
this.handleContainer(container);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
133
149
|
if (!options.useShadowObserver) {
|
|
134
150
|
this.updateShadows();
|
|
135
151
|
}
|
|
@@ -144,6 +160,9 @@ export default function overflowShadow(Component, options) {
|
|
|
144
160
|
this.shadowObserver = new ShadowObserver({
|
|
145
161
|
scrollContainer: this.overflowContainer,
|
|
146
162
|
onUpdateShadows: function onUpdateShadows(shadowStates) {
|
|
163
|
+
if (_this2.props.disableShadowTracking) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
147
166
|
_this2.setState(function (prevState) {
|
|
148
167
|
var showLeftShadow = shadowStates.showLeftShadow,
|
|
149
168
|
showRightShadow = shadowStates.showRightShadow;
|
|
@@ -182,6 +201,17 @@ export default function overflowShadow(Component, options) {
|
|
|
182
201
|
// eslint-disable-next-line react/jsx-props-no-spreading -- Spreading props to pass all component props through to wrapped generic component
|
|
183
202
|
}, this.props));
|
|
184
203
|
}
|
|
204
|
+
}], [{
|
|
205
|
+
key: "getDerivedStateFromProps",
|
|
206
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
207
|
+
if (props.disableShadowTracking && (state.showLeftShadow || state.showRightShadow)) {
|
|
208
|
+
return {
|
|
209
|
+
showLeftShadow: false,
|
|
210
|
+
showRightShadow: false
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
185
215
|
}]);
|
|
186
216
|
}(React.Component);
|
|
187
217
|
}
|
|
@@ -4,6 +4,11 @@ export declare const captionMessages: {
|
|
|
4
4
|
defaultMessage: string;
|
|
5
5
|
description: string;
|
|
6
6
|
};
|
|
7
|
+
placeholderWithClickAgainPrompt: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
7
12
|
placeholderWithDoubleClickPrompt: {
|
|
8
13
|
id: string;
|
|
9
14
|
defaultMessage: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fits columns to a saved table width, independently of the viewport. Zero widths share the
|
|
3
|
+
* remaining space; minimum widths can require overflow when the saved table is too narrow.
|
|
4
|
+
*/
|
|
5
|
+
export declare const normalizeTableColumnWidths: ({ columnWidths, isNumberColumnEnabled, skipMinWidth, tableWidth, }: {
|
|
6
|
+
columnWidths: number[];
|
|
7
|
+
isNumberColumnEnabled: boolean;
|
|
8
|
+
skipMinWidth?: boolean;
|
|
9
|
+
tableWidth: number;
|
|
10
|
+
}) => number[];
|
|
@@ -4,6 +4,8 @@ export declare const shadowClassNames: {
|
|
|
4
4
|
LEFT_SHADOW: string;
|
|
5
5
|
};
|
|
6
6
|
export interface OverflowShadowProps {
|
|
7
|
+
/** Skip shadow observers and listeners, rather than only hiding their output. */
|
|
8
|
+
disableShadowTracking?: boolean;
|
|
7
9
|
disableTableOverflowShadow?: boolean;
|
|
8
10
|
handleRef?: (ref: HTMLElement | null) => void;
|
|
9
11
|
shadowClassNames?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "134.
|
|
3
|
+
"version": "134.20.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@atlaskit/media-picker": "^73.3.0",
|
|
66
66
|
"@atlaskit/media-ui": "^31.10.0",
|
|
67
67
|
"@atlaskit/media-viewer": "^54.12.0",
|
|
68
|
-
"@atlaskit/mention": "^30.
|
|
68
|
+
"@atlaskit/mention": "^30.10.0",
|
|
69
69
|
"@atlaskit/menu": "^11.0.0",
|
|
70
70
|
"@atlaskit/object": "^2.3.0",
|
|
71
71
|
"@atlaskit/onboarding": "^15.4.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@atlaskit/task-decision": "^21.16.0",
|
|
87
87
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
88
88
|
"@atlaskit/textfield": "^10.3.0",
|
|
89
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
89
|
+
"@atlaskit/tmp-editor-statsig": "^263.0.0",
|
|
90
90
|
"@atlaskit/tokens": "^20.12.0",
|
|
91
91
|
"@atlaskit/tooltip": "^24.4.0",
|
|
92
92
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/table/normalize-column-widths",
|
|
3
|
+
"main": "../../dist/cjs/table/normalize-column-widths.js",
|
|
4
|
+
"module": "../../dist/esm/table/normalize-column-widths.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/table/normalize-column-widths.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/table/normalize-column-widths.d.ts"
|
|
10
|
+
}
|