@atlaskit/editor-common 114.8.1 → 114.10.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 +34 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +12 -7
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +24 -18
- package/dist/cjs/extensibility/Extension.js +1 -1
- package/dist/cjs/extensions/UnknownMacroPlaceholder.js +37 -15
- package/dist/cjs/messages/insert-block.js +15 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Popup/index.js +45 -9
- package/dist/es2019/extensibility/Extension/Extension/index.js +10 -7
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +8 -4
- package/dist/es2019/extensibility/Extension.js +1 -1
- package/dist/es2019/extensions/UnknownMacroPlaceholder.js +18 -7
- package/dist/es2019/messages/insert-block.js +15 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Popup/index.js +41 -6
- package/dist/esm/extensibility/Extension/Extension/index.js +12 -7
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +10 -4
- package/dist/esm/extensibility/Extension.js +1 -1
- package/dist/esm/extensions/UnknownMacroPlaceholder.js +36 -14
- package/dist/esm/messages/insert-block.js +15 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Popup/index.js +45 -9
- package/dist/types/block-menu/rank.d.ts +11 -58
- package/dist/types/extensibility/Extension/Lozenge/ExtensionLabel.d.ts +1 -1
- package/dist/types/messages/insert-block.d.ts +103 -88
- package/dist/types/provider-factory/quick-insert-provider.d.ts +1 -1
- package/dist/types/ui/Popup/index.d.ts +6 -0
- package/dist/types-ts4.5/block-menu/rank.d.ts +11 -58
- package/dist/types-ts4.5/extensibility/Extension/Lozenge/ExtensionLabel.d.ts +1 -1
- package/dist/types-ts4.5/messages/insert-block.d.ts +103 -88
- package/dist/types-ts4.5/provider-factory/quick-insert-provider.d.ts +1 -1
- package/dist/types-ts4.5/ui/Popup/index.d.ts +6 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 114.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4b61b018db494`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4b61b018db494) -
|
|
8
|
+
[ux] Adds AI image generation to the editor by introducing a new plugin for image generation in
|
|
9
|
+
the editor with the functionalities to create AI images with a prompt and style choice. The plugin
|
|
10
|
+
is gated behind a feature experiment.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`edc25b2fd6660`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/edc25b2fd6660) -
|
|
15
|
+
Fix editor popup not respecting scrollableElement changes when editor is re-parented.
|
|
16
|
+
|
|
17
|
+
When the `platform_editor_fix_scrolling_popup_position` experiment is enabled, the Popup component
|
|
18
|
+
now detects when the `scrollableElement` prop changes (e.g. the editor instance is moved into a
|
|
19
|
+
different container) and re-initialises the scroll event listener and ResizeObserver to track the
|
|
20
|
+
new scroll parent. Previously, the scroll element was resolved only once on mount, so subsequent
|
|
21
|
+
changes were silently ignored and popups would lose scroll tracking.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
25
|
+
## 114.9.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`46c5125fd06d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/46c5125fd06d8) -
|
|
30
|
+
Perf-linting cleanup: fix performance linting violations in editor-common, gated behind
|
|
31
|
+
platform_editor_perf_lint_cleanup experiment
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 114.8.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -236,15 +236,20 @@ var Extension = function Extension(props) {
|
|
|
236
236
|
}),
|
|
237
237
|
lineLength = _useSharedPluginState.lineLength,
|
|
238
238
|
width = _useSharedPluginState.width;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return (0, _react2.jsx)(ExtensionWithPluginState
|
|
242
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
243
|
-
, (0, _extends2.default)({
|
|
244
|
-
widthState: {
|
|
239
|
+
var memoizedWidthState = _react.default.useMemo(function () {
|
|
240
|
+
return {
|
|
245
241
|
width: width !== null && width !== void 0 ? width : 0,
|
|
246
242
|
lineLength: lineLength
|
|
247
|
-
}
|
|
243
|
+
};
|
|
244
|
+
}, [width, lineLength]);
|
|
245
|
+
var widthState = (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedWidthState : {
|
|
246
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
247
|
+
lineLength: lineLength
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// Ignored via go/ees005
|
|
251
|
+
return (0, _react2.jsx)(ExtensionWithPluginState, (0, _extends2.default)({
|
|
252
|
+
widthState: widthState
|
|
248
253
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
249
254
|
}, props));
|
|
250
255
|
};
|
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getShouldShowBodiedMacroLabel = exports.ExtensionLabel = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _react = require("
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
11
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
13
|
var _reactIntl = require("react-intl");
|
|
13
14
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
@@ -23,7 +24,7 @@ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
|
23
24
|
|
|
24
25
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
25
26
|
|
|
26
|
-
var containerStyles = (0,
|
|
27
|
+
var containerStyles = (0, _react2.css)({
|
|
27
28
|
textAlign: 'left',
|
|
28
29
|
zIndex: 1,
|
|
29
30
|
position: 'relative',
|
|
@@ -32,13 +33,13 @@ var containerStyles = (0, _react.css)({
|
|
|
32
33
|
marginTop: "var(--ds-space-300, 24px)"
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
|
-
var showLabelStyles = (0,
|
|
36
|
+
var showLabelStyles = (0, _react2.css)({
|
|
36
37
|
opacity: 1
|
|
37
38
|
});
|
|
38
|
-
var hideLabelStyles = (0,
|
|
39
|
+
var hideLabelStyles = (0, _react2.css)({
|
|
39
40
|
opacity: 0
|
|
40
41
|
});
|
|
41
|
-
var labelStyles = (0,
|
|
42
|
+
var labelStyles = (0, _react2.css)({
|
|
42
43
|
opacity: 0,
|
|
43
44
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
44
45
|
lineHeight: 1,
|
|
@@ -100,14 +101,14 @@ var spacerStyles = (0, _primitives.xcss)({
|
|
|
100
101
|
position: 'absolute',
|
|
101
102
|
width: '100%'
|
|
102
103
|
});
|
|
103
|
-
var iconStyles = (0,
|
|
104
|
+
var iconStyles = (0, _react2.css)({
|
|
104
105
|
marginLeft: "var(--ds-space-075, 6px)",
|
|
105
106
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
106
107
|
'&.hide-icon': {
|
|
107
108
|
display: 'none'
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
|
-
var bodiedMacroIconStyles = (0,
|
|
111
|
+
var bodiedMacroIconStyles = (0, _react2.css)({
|
|
111
112
|
display: 'none'
|
|
112
113
|
});
|
|
113
114
|
var i18n = (0, _reactIntl.defineMessages)({
|
|
@@ -162,9 +163,17 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
162
163
|
'hide-icon': (0, _expValEquals.expValEquals)('cc_editor_ttvc_release_bundle_one', 'extensionHoverRefactor', true) ? false : isBodiedMacro && !isNodeHovered,
|
|
163
164
|
'extension-icon': (0, _expValEquals.expValEquals)('cc_editor_ttvc_release_bundle_one', 'extensionHoverRefactor', true)
|
|
164
165
|
});
|
|
166
|
+
var memoizedTooltipValues = (0, _react.useMemo)(function () {
|
|
167
|
+
return {
|
|
168
|
+
macroName: text
|
|
169
|
+
};
|
|
170
|
+
}, [text]);
|
|
171
|
+
var tooltipValues = (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedTooltipValues : {
|
|
172
|
+
macroName: text
|
|
173
|
+
};
|
|
165
174
|
return (
|
|
166
175
|
// 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,
|
|
176
|
+
(0, _react2.jsx)("div", {
|
|
168
177
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
169
178
|
css: containerStyles
|
|
170
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -187,19 +196,16 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
187
196
|
onBlur: (0, _expValEquals.expValEquals)('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined,
|
|
188
197
|
"data-testid": "new-lozenge-container",
|
|
189
198
|
contentEditable: false
|
|
190
|
-
}, (0,
|
|
191
|
-
content: (0,
|
|
199
|
+
}, (0, _react2.jsx)(_tooltip.default, {
|
|
200
|
+
content: (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
192
201
|
// Ignored via go/ees005
|
|
193
202
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
194
203
|
, (0, _extends2.default)({}, i18n.configure, {
|
|
195
|
-
|
|
196
|
-
values: {
|
|
197
|
-
macroName: text
|
|
198
|
-
}
|
|
204
|
+
values: tooltipValues
|
|
199
205
|
})),
|
|
200
206
|
position: "top"
|
|
201
207
|
}, function (tooltipProps) {
|
|
202
|
-
return (0,
|
|
208
|
+
return (0, _react2.jsx)("span", (0, _extends2.default)({
|
|
203
209
|
"data-testid": "new-lozenge-button"
|
|
204
210
|
// Ignored via go/ees005
|
|
205
211
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -208,16 +214,16 @@ var ExtensionLabel = exports.ExtensionLabel = function ExtensionLabel(_ref) {
|
|
|
208
214
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
209
215
|
,
|
|
210
216
|
className: labelClassNames
|
|
211
|
-
}), text, (0,
|
|
217
|
+
}), text, (0, _react2.jsx)("span", {
|
|
212
218
|
css: [iconStyles, isBodiedMacro && (0, _expValEquals.expValEquals)('cc_editor_ttvc_release_bundle_one', 'extensionHoverRefactor', true) && bodiedMacroIconStyles]
|
|
213
219
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
214
220
|
,
|
|
215
221
|
className: iconClassNames,
|
|
216
222
|
"data-testid": "config-icon"
|
|
217
|
-
}, (0,
|
|
223
|
+
}, (0, _react2.jsx)(_customize.default, {
|
|
218
224
|
label: ""
|
|
219
225
|
})));
|
|
220
|
-
}), (0,
|
|
226
|
+
}), (0, _react2.jsx)(_primitives.Box, {
|
|
221
227
|
xcss: spacerStyles
|
|
222
228
|
}))
|
|
223
229
|
);
|
|
@@ -86,7 +86,7 @@ var Extension = exports.Extension = /*#__PURE__*/function (_Component) {
|
|
|
86
86
|
key: "render",
|
|
87
87
|
value: function render() {
|
|
88
88
|
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders
|
|
89
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props --
|
|
89
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- there seems to be an existing bug where the Extension component can't be resized if this is memoised because it doesn't rerender so this can't be memoised without a larger refactor
|
|
90
90
|
, {
|
|
91
91
|
providers: ['extensionProvider'],
|
|
92
92
|
providerFactory: this.providerFactory,
|
|
@@ -8,10 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.UnknownMacroPlaceholder = UnknownMacroPlaceholder;
|
|
10
10
|
require("./UnknownMacroPlaceholder.compiled.css");
|
|
11
|
-
var
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
12
13
|
var _runtime = require("@compiled/react/runtime");
|
|
13
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
15
|
var _reactIntl = require("react-intl");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
17
|
var _messages = require("./messages");
|
|
16
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
19
|
// Unknown macro placeholder styling aligned with Legacy Content Macro (LCM) for consistent look
|
|
@@ -24,28 +26,48 @@ var unknownMacroHeaderStyles = null;
|
|
|
24
26
|
// Match LCM content area: white surface, text color inherits
|
|
25
27
|
var unknownMacroBodyStyles = null;
|
|
26
28
|
var unknownMacroPreStyles = null;
|
|
29
|
+
var formatParam = function formatParam(key, param) {
|
|
30
|
+
var _param$value;
|
|
31
|
+
var value = String((_param$value = param === null || param === void 0 ? void 0 : param.value) !== null && _param$value !== void 0 ? _param$value : '').trim();
|
|
32
|
+
return "".concat(key, " = ").concat(value);
|
|
33
|
+
};
|
|
34
|
+
var EMPTY_MACRO_PARAMS = {};
|
|
27
35
|
function UnknownMacroPlaceholder(_ref) {
|
|
28
|
-
var _extensionNode$parame, _extensionNode$parame2, _extensionNode$parame3, _extensionNode$parame4;
|
|
36
|
+
var _extensionNode$parame, _extensionNode$parame2, _extensionNode$parame3, _extensionNode$parame4, _extensionNode$parame5, _extensionNode$parame6;
|
|
29
37
|
var extensionNode = _ref.extensionNode;
|
|
30
38
|
var intl = (0, _reactIntl.useIntl)();
|
|
31
39
|
var macroTitle = ((_extensionNode$parame = extensionNode.parameters) === null || _extensionNode$parame === void 0 || (_extensionNode$parame = _extensionNode$parame.macroMetadata) === null || _extensionNode$parame === void 0 ? void 0 : _extensionNode$parame.title) || extensionNode.extensionKey;
|
|
32
40
|
var bodyContent = (_extensionNode$parame2 = extensionNode.parameters) === null || _extensionNode$parame2 === void 0 || (_extensionNode$parame2 = _extensionNode$parame2.macroParams) === null || _extensionNode$parame2 === void 0 || (_extensionNode$parame2 = _extensionNode$parame2.__bodyContent) === null || _extensionNode$parame2 === void 0 ? void 0 : _extensionNode$parame2.value;
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var
|
|
41
|
+
var macroParamsOld = (_extensionNode$parame3 = (_extensionNode$parame4 = extensionNode.parameters) === null || _extensionNode$parame4 === void 0 ? void 0 : _extensionNode$parame4.macroParams) !== null && _extensionNode$parame3 !== void 0 ? _extensionNode$parame3 : {};
|
|
42
|
+
var macroParams = (_extensionNode$parame5 = (_extensionNode$parame6 = extensionNode.parameters) === null || _extensionNode$parame6 === void 0 ? void 0 : _extensionNode$parame6.macroParams) !== null && _extensionNode$parame5 !== void 0 ? _extensionNode$parame5 : EMPTY_MACRO_PARAMS;
|
|
43
|
+
var formatParamInline = function formatParamInline(key, param) {
|
|
44
|
+
var _param$value2;
|
|
45
|
+
var value = String((_param$value2 = param === null || param === void 0 ? void 0 : param.value) !== null && _param$value2 !== void 0 ? _param$value2 : '').trim();
|
|
37
46
|
return "".concat(key, " = ").concat(value);
|
|
38
47
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
var memoizedVisibleParams = (0, _react.useMemo)(function () {
|
|
49
|
+
return Object.entries(macroParams).filter(function (_ref2) {
|
|
50
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
51
|
+
key = _ref3[0];
|
|
52
|
+
return !key.startsWith('_');
|
|
53
|
+
}).map(function (_ref4) {
|
|
54
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
55
|
+
key = _ref5[0],
|
|
56
|
+
param = _ref5[1];
|
|
57
|
+
return formatParam(key, param);
|
|
58
|
+
}).join(' | ');
|
|
59
|
+
}, [macroParams]);
|
|
60
|
+
var visibleParams = (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedVisibleParams :
|
|
61
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- intentional fallback for experiment off path
|
|
62
|
+
Object.entries(macroParamsOld).filter(function (_ref6) {
|
|
63
|
+
var _ref7 = (0, _slicedToArray2.default)(_ref6, 1),
|
|
64
|
+
key = _ref7[0];
|
|
43
65
|
return !key.startsWith('_');
|
|
44
|
-
}).map(function (
|
|
45
|
-
var
|
|
46
|
-
key =
|
|
47
|
-
param =
|
|
48
|
-
return
|
|
66
|
+
}).map(function (_ref8) {
|
|
67
|
+
var _ref9 = (0, _slicedToArray2.default)(_ref8, 2),
|
|
68
|
+
key = _ref9[0],
|
|
69
|
+
param = _ref9[1];
|
|
70
|
+
return formatParamInline(key, param);
|
|
49
71
|
}).join(' | ');
|
|
50
72
|
var headerText = visibleParams ? "".concat(intl.formatMessage(_messages.messages.unknownMacroHeader, {
|
|
51
73
|
macroTitle: macroTitle
|
|
@@ -56,6 +56,21 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
|
|
|
56
56
|
defaultMessage: 'Image',
|
|
57
57
|
description: 'Shown as a menu item label in the editor insert menu, used to insert an image into the document.'
|
|
58
58
|
},
|
|
59
|
+
aiImageGeneration: {
|
|
60
|
+
id: 'fabric.editor.aiImageGeneration',
|
|
61
|
+
defaultMessage: 'Generate image',
|
|
62
|
+
description: 'Shown as a menu item label in the editor insert menu, used to open a popup for generating an image with AI.'
|
|
63
|
+
},
|
|
64
|
+
aiImageGenerationDescription: {
|
|
65
|
+
id: 'fabric.editor.aiImageGeneration.description',
|
|
66
|
+
defaultMessage: 'Generate an image with AI',
|
|
67
|
+
description: 'Displayed as a description text for the AI image generation option in the editor insert menu.'
|
|
68
|
+
},
|
|
69
|
+
aiImageGenerationPopupAriaLabel: {
|
|
70
|
+
id: 'fabric.editor.aiImageGeneration.popupAriaLabel',
|
|
71
|
+
defaultMessage: 'Generate image with AI',
|
|
72
|
+
description: 'Accessible label announced by screen readers when the AI image generation popup opens.'
|
|
73
|
+
},
|
|
59
74
|
mention: {
|
|
60
75
|
id: 'fabric.editor.mention',
|
|
61
76
|
defaultMessage: 'Mention',
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
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 = "114.
|
|
22
|
+
var packageVersion = "114.9.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "114.
|
|
27
|
+
var packageVersion = "114.9.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -12,6 +12,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _bindEventListener = require("bind-event-listener");
|
|
15
16
|
var _focusTrap = _interopRequireDefault(require("focus-trap"));
|
|
16
17
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
17
18
|
var _reactDom = require("react-dom");
|
|
@@ -252,10 +253,44 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
252
253
|
return this.initFocusTrap();
|
|
253
254
|
}
|
|
254
255
|
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Idempotent scroll element setup — tears down any previous listener/observer
|
|
259
|
+
* then attaches to the current scroll parent.
|
|
260
|
+
*/
|
|
261
|
+
}, {
|
|
262
|
+
key: "initScrollElement",
|
|
263
|
+
value: function initScrollElement() {
|
|
264
|
+
var _this$unbindScroll;
|
|
265
|
+
var _this$props = this.props,
|
|
266
|
+
stick = _this$props.stick,
|
|
267
|
+
target = _this$props.target,
|
|
268
|
+
scrollableElement = _this$props.scrollableElement;
|
|
269
|
+
(_this$unbindScroll = this.unbindScroll) === null || _this$unbindScroll === void 0 || _this$unbindScroll.call(this);
|
|
270
|
+
if (this.scrollElement && this.resizeObserver) {
|
|
271
|
+
this.resizeObserver.unobserve(this.scrollElement);
|
|
272
|
+
}
|
|
273
|
+
this.scrollElement = scrollableElement;
|
|
274
|
+
if (stick && !this.scrollElement && target) {
|
|
275
|
+
this.scrollElement = (0, _utils.findOverflowScrollParent)(target);
|
|
276
|
+
}
|
|
277
|
+
if (this.scrollElement) {
|
|
278
|
+
if (this.resizeObserver) {
|
|
279
|
+
this.resizeObserver.observe(this.scrollElement);
|
|
280
|
+
}
|
|
281
|
+
this.unbindScroll = (0, _bindEventListener.bind)(this.scrollElement, {
|
|
282
|
+
type: 'scroll',
|
|
283
|
+
listener: this.onResize
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
255
287
|
}, {
|
|
256
288
|
key: "componentDidUpdate",
|
|
257
289
|
value: function componentDidUpdate(prevProps) {
|
|
258
290
|
this.handleChangedFocusTrapProp(prevProps);
|
|
291
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) && prevProps.scrollableElement !== this.props.scrollableElement) {
|
|
292
|
+
this.initScrollElement();
|
|
293
|
+
}
|
|
259
294
|
if (this.props !== prevProps) {
|
|
260
295
|
this.scheduledUpdatePosition(prevProps);
|
|
261
296
|
}
|
|
@@ -266,16 +301,16 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
266
301
|
// Ignored via go/ees005
|
|
267
302
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
268
303
|
window.addEventListener('resize', this.onResize);
|
|
304
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true)) {
|
|
305
|
+
this.initScrollElement();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
269
308
|
var stick = this.props.stick;
|
|
270
309
|
|
|
271
310
|
// Ignored via go/ees005
|
|
272
311
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
273
312
|
var target = this.props.target;
|
|
274
|
-
|
|
275
|
-
// Resolve the effective scroll parent: prefer the explicitly provided scrollableElement
|
|
276
|
-
// prop over the auto-detected ancestor. Allows product consumers to provide the correct
|
|
277
|
-
// scroll container (e.g. a modal body) when auto-detection can't find it.
|
|
278
|
-
var scrollParentElement = (0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) ? this.props.scrollableElement || (0, _utils.findOverflowScrollParent)(target) : (0, _utils.findOverflowScrollParent)(target);
|
|
313
|
+
var scrollParentElement = (0, _utils.findOverflowScrollParent)(target);
|
|
279
314
|
if (scrollParentElement && this.resizeObserver) {
|
|
280
315
|
this.resizeObserver.observe(scrollParentElement);
|
|
281
316
|
}
|
|
@@ -293,10 +328,11 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
293
328
|
}, {
|
|
294
329
|
key: "componentWillUnmount",
|
|
295
330
|
value: function componentWillUnmount() {
|
|
296
|
-
var _this$resizeObserver3;
|
|
331
|
+
var _this$unbindScroll2, _this$resizeObserver3;
|
|
297
332
|
// Ignored via go/ees005
|
|
298
333
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
299
334
|
window.removeEventListener('resize', this.onResize);
|
|
335
|
+
(_this$unbindScroll2 = this.unbindScroll) === null || _this$unbindScroll2 === void 0 || _this$unbindScroll2.call(this);
|
|
300
336
|
if (this.scrollElement) {
|
|
301
337
|
// Ignored via go/ees005
|
|
302
338
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -355,9 +391,9 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
355
391
|
}, {
|
|
356
392
|
key: "render",
|
|
357
393
|
value: function render() {
|
|
358
|
-
var _this$
|
|
359
|
-
target = _this$
|
|
360
|
-
mountTo = _this$
|
|
394
|
+
var _this$props2 = this.props,
|
|
395
|
+
target = _this$props2.target,
|
|
396
|
+
mountTo = _this$props2.mountTo;
|
|
361
397
|
var validPosition = this.state.validPosition;
|
|
362
398
|
if (!target || !validPosition) {
|
|
363
399
|
return null;
|
|
@@ -235,15 +235,18 @@ const Extension = props => {
|
|
|
235
235
|
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength
|
|
236
236
|
};
|
|
237
237
|
});
|
|
238
|
+
const memoizedWidthState = React.useMemo(() => ({
|
|
239
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
240
|
+
lineLength
|
|
241
|
+
}), [width, lineLength]);
|
|
242
|
+
const widthState = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedWidthState : {
|
|
243
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
244
|
+
lineLength
|
|
245
|
+
};
|
|
238
246
|
|
|
239
247
|
// Ignored via go/ees005
|
|
240
|
-
return jsx(ExtensionWithPluginState
|
|
241
|
-
|
|
242
|
-
, _extends({
|
|
243
|
-
widthState: {
|
|
244
|
-
width: width !== null && width !== void 0 ? width : 0,
|
|
245
|
-
lineLength
|
|
246
|
-
}
|
|
248
|
+
return jsx(ExtensionWithPluginState, _extends({
|
|
249
|
+
widthState: widthState
|
|
247
250
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
248
251
|
}, props));
|
|
249
252
|
};
|
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
+
import { useMemo } from 'react';
|
|
6
7
|
|
|
7
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
|
|
8
9
|
import { css, jsx } from '@emotion/react';
|
|
@@ -153,6 +154,12 @@ export const ExtensionLabel = ({
|
|
|
153
154
|
'hide-icon': expValEquals('cc_editor_ttvc_release_bundle_one', 'extensionHoverRefactor', true) ? false : isBodiedMacro && !isNodeHovered,
|
|
154
155
|
'extension-icon': expValEquals('cc_editor_ttvc_release_bundle_one', 'extensionHoverRefactor', true)
|
|
155
156
|
});
|
|
157
|
+
const memoizedTooltipValues = useMemo(() => ({
|
|
158
|
+
macroName: text
|
|
159
|
+
}), [text]);
|
|
160
|
+
const tooltipValues = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedTooltipValues : {
|
|
161
|
+
macroName: text
|
|
162
|
+
};
|
|
156
163
|
return (
|
|
157
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
|
|
158
165
|
jsx("div", {
|
|
@@ -183,10 +190,7 @@ export const ExtensionLabel = ({
|
|
|
183
190
|
// Ignored via go/ees005
|
|
184
191
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
185
192
|
, _extends({}, i18n.configure, {
|
|
186
|
-
|
|
187
|
-
values: {
|
|
188
|
-
macroName: text
|
|
189
|
-
}
|
|
193
|
+
values: tooltipValues
|
|
190
194
|
})),
|
|
191
195
|
position: "top"
|
|
192
196
|
}, tooltipProps => jsx("span", _extends({
|
|
@@ -65,7 +65,7 @@ export class Extension extends Component {
|
|
|
65
65
|
}
|
|
66
66
|
render() {
|
|
67
67
|
return /*#__PURE__*/React.createElement(WithProviders
|
|
68
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props --
|
|
68
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- there seems to be an existing bug where the Extension component can't be resized if this is memoised because it doesn't rerender so this can't be memoised without a larger refactor
|
|
69
69
|
, {
|
|
70
70
|
providers: ['extensionProvider'],
|
|
71
71
|
providerFactory: this.providerFactory,
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import "./UnknownMacroPlaceholder.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useMemo } from 'react';
|
|
5
6
|
import { useIntl } from 'react-intl';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
8
|
import { messages } from './messages';
|
|
7
9
|
// Unknown macro placeholder styling aligned with Legacy Content Macro (LCM) for consistent look
|
|
8
10
|
const neutralBorder = "var(--ds-background-neutral, #0515240F)";
|
|
@@ -14,21 +16,30 @@ const unknownMacroHeaderStyles = null;
|
|
|
14
16
|
// Match LCM content area: white surface, text color inherits
|
|
15
17
|
const unknownMacroBodyStyles = null;
|
|
16
18
|
const unknownMacroPreStyles = null;
|
|
19
|
+
const formatParam = (key, param) => {
|
|
20
|
+
var _param$value;
|
|
21
|
+
const value = String((_param$value = param === null || param === void 0 ? void 0 : param.value) !== null && _param$value !== void 0 ? _param$value : '').trim();
|
|
22
|
+
return `${key} = ${value}`;
|
|
23
|
+
};
|
|
24
|
+
const EMPTY_MACRO_PARAMS = {};
|
|
17
25
|
export function UnknownMacroPlaceholder({
|
|
18
26
|
extensionNode
|
|
19
27
|
}) {
|
|
20
|
-
var _extensionNode$parame, _extensionNode$parame2, _extensionNode$parame3, _extensionNode$parame4, _extensionNode$parame5, _extensionNode$parame6, _extensionNode$parame7;
|
|
28
|
+
var _extensionNode$parame, _extensionNode$parame2, _extensionNode$parame3, _extensionNode$parame4, _extensionNode$parame5, _extensionNode$parame6, _extensionNode$parame7, _extensionNode$parame8, _extensionNode$parame9;
|
|
21
29
|
const intl = useIntl();
|
|
22
30
|
const macroTitle = ((_extensionNode$parame = extensionNode.parameters) === null || _extensionNode$parame === void 0 ? void 0 : (_extensionNode$parame2 = _extensionNode$parame.macroMetadata) === null || _extensionNode$parame2 === void 0 ? void 0 : _extensionNode$parame2.title) || extensionNode.extensionKey;
|
|
23
31
|
const bodyContent = (_extensionNode$parame3 = extensionNode.parameters) === null || _extensionNode$parame3 === void 0 ? void 0 : (_extensionNode$parame4 = _extensionNode$parame3.macroParams) === null || _extensionNode$parame4 === void 0 ? void 0 : (_extensionNode$parame5 = _extensionNode$parame4.__bodyContent) === null || _extensionNode$parame5 === void 0 ? void 0 : _extensionNode$parame5.value;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const macroParamsOld = (_extensionNode$parame6 = (_extensionNode$parame7 = extensionNode.parameters) === null || _extensionNode$parame7 === void 0 ? void 0 : _extensionNode$parame7.macroParams) !== null && _extensionNode$parame6 !== void 0 ? _extensionNode$parame6 : {};
|
|
33
|
+
const macroParams = (_extensionNode$parame8 = (_extensionNode$parame9 = extensionNode.parameters) === null || _extensionNode$parame9 === void 0 ? void 0 : _extensionNode$parame9.macroParams) !== null && _extensionNode$parame8 !== void 0 ? _extensionNode$parame8 : EMPTY_MACRO_PARAMS;
|
|
34
|
+
const formatParamInline = (key, param) => {
|
|
35
|
+
var _param$value2;
|
|
36
|
+
const value = String((_param$value2 = param === null || param === void 0 ? void 0 : param.value) !== null && _param$value2 !== void 0 ? _param$value2 : '').trim();
|
|
28
37
|
return `${key} = ${value}`;
|
|
29
38
|
};
|
|
30
|
-
|
|
31
|
-
const visibleParams =
|
|
39
|
+
const memoizedVisibleParams = useMemo(() => Object.entries(macroParams).filter(([key]) => !key.startsWith('_')).map(([key, param]) => formatParam(key, param)).join(' | '), [macroParams]);
|
|
40
|
+
const visibleParams = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedVisibleParams :
|
|
41
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- intentional fallback for experiment off path
|
|
42
|
+
Object.entries(macroParamsOld).filter(([key]) => !key.startsWith('_')).map(([key, param]) => formatParamInline(key, param)).join(' | ');
|
|
32
43
|
const headerText = visibleParams ? `${intl.formatMessage(messages.unknownMacroHeader, {
|
|
33
44
|
macroTitle
|
|
34
45
|
})} | ${visibleParams}` : intl.formatMessage(messages.unknownMacroHeader, {
|
|
@@ -50,6 +50,21 @@ export const toolbarInsertBlockMessages = defineMessages({
|
|
|
50
50
|
defaultMessage: 'Image',
|
|
51
51
|
description: 'Shown as a menu item label in the editor insert menu, used to insert an image into the document.'
|
|
52
52
|
},
|
|
53
|
+
aiImageGeneration: {
|
|
54
|
+
id: 'fabric.editor.aiImageGeneration',
|
|
55
|
+
defaultMessage: 'Generate image',
|
|
56
|
+
description: 'Shown as a menu item label in the editor insert menu, used to open a popup for generating an image with AI.'
|
|
57
|
+
},
|
|
58
|
+
aiImageGenerationDescription: {
|
|
59
|
+
id: 'fabric.editor.aiImageGeneration.description',
|
|
60
|
+
defaultMessage: 'Generate an image with AI',
|
|
61
|
+
description: 'Displayed as a description text for the AI image generation option in the editor insert menu.'
|
|
62
|
+
},
|
|
63
|
+
aiImageGenerationPopupAriaLabel: {
|
|
64
|
+
id: 'fabric.editor.aiImageGeneration.popupAriaLabel',
|
|
65
|
+
defaultMessage: 'Generate image with AI',
|
|
66
|
+
description: 'Accessible label announced by screen readers when the AI image generation popup opens.'
|
|
67
|
+
},
|
|
53
68
|
mention: {
|
|
54
69
|
id: 'fabric.editor.mention',
|
|
55
70
|
defaultMessage: 'Mention',
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "114.
|
|
7
|
+
const packageVersion = "114.9.0";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "114.
|
|
17
|
+
const packageVersion = "114.9.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|