@atlaskit/editor-common 134.18.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/alignment-icon-map/package.json +10 -0
  3. package/credit-guard/check-ai-credit-status/package.json +10 -0
  4. package/credit-guard/popup/package.json +10 -0
  5. package/credit-guard/types/package.json +10 -0
  6. package/credit-guard/use-ai-credit-guard/package.json +10 -0
  7. package/credit-guard/use-ai-credit-status/package.json +10 -0
  8. package/credit-guard/use-credit-checked-action/package.json +10 -0
  9. package/dist/cjs/credit-guard/useAICreditStatus.js +40 -0
  10. package/dist/cjs/credit-guard/useCreditCheckedAction.js +19 -0
  11. package/dist/cjs/extensibility/Extension/InlineExtension/index.js +15 -5
  12. package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  13. package/dist/cjs/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  14. package/dist/cjs/media/messages/caption.js +5 -0
  15. package/dist/cjs/messages/rule.js +10 -0
  16. package/dist/cjs/monitoring/error.js +1 -1
  17. package/dist/cjs/table/normalize-column-widths.js +68 -0
  18. package/dist/cjs/ui/DropList/index.js +1 -1
  19. package/dist/cjs/ui/OverflowShadow/index.js +31 -1
  20. package/dist/cjs/ui/alignment-icon-map.js +40 -0
  21. package/dist/es2019/credit-guard/useAICreditStatus.js +26 -0
  22. package/dist/es2019/credit-guard/useCreditCheckedAction.js +13 -0
  23. package/dist/es2019/extensibility/Extension/InlineExtension/index.js +15 -5
  24. package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  25. package/dist/es2019/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  26. package/dist/es2019/media/messages/caption.js +5 -0
  27. package/dist/es2019/messages/rule.js +10 -0
  28. package/dist/es2019/monitoring/error.js +1 -1
  29. package/dist/es2019/table/normalize-column-widths.js +46 -0
  30. package/dist/es2019/ui/DropList/index.js +1 -1
  31. package/dist/es2019/ui/OverflowShadow/index.js +29 -1
  32. package/dist/es2019/ui/alignment-icon-map.js +34 -0
  33. package/dist/esm/credit-guard/useAICreditStatus.js +33 -0
  34. package/dist/esm/credit-guard/useCreditCheckedAction.js +13 -0
  35. package/dist/esm/extensibility/Extension/InlineExtension/index.js +15 -5
  36. package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  37. package/dist/esm/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  38. package/dist/esm/media/messages/caption.js +5 -0
  39. package/dist/esm/messages/rule.js +10 -0
  40. package/dist/esm/monitoring/error.js +1 -1
  41. package/dist/esm/table/normalize-column-widths.js +63 -0
  42. package/dist/esm/ui/DropList/index.js +1 -1
  43. package/dist/esm/ui/OverflowShadow/index.js +31 -1
  44. package/dist/esm/ui/alignment-icon-map.js +33 -0
  45. package/dist/types/credit-guard/types.d.ts +16 -1
  46. package/dist/types/credit-guard/useAICreditStatus.d.ts +3 -0
  47. package/dist/types/credit-guard/useCreditCheckedAction.d.ts +3 -0
  48. package/dist/types/media/messages/caption.d.ts +5 -0
  49. package/dist/types/messages/rule.d.ts +10 -0
  50. package/dist/types/table/normalize-column-widths.d.ts +10 -0
  51. package/dist/types/ui/OverflowShadow/index.d.ts +2 -0
  52. package/dist/types/ui/alignment-icon-map.d.ts +8 -0
  53. package/package.json +10 -10
  54. package/table/normalize-column-widths/package.json +10 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
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
+
32
+ ## 134.19.0
33
+
34
+ ### Minor Changes
35
+
36
+ - [`86477de71b158`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/86477de71b158) -
37
+ Converge Editor block Remix and image-generation credit guards on product-owned credit decisions.
38
+ Use the shared synchronous cached check with an optional invalidation subscription for mounted
39
+ surfaces, preserve host-owned content and Editor-owned visibility, and remove direct
40
+ credit-package dependencies from the shared consumers.
41
+
42
+ Preserve `featureName` and `touchPoint` analytics attribution for product-owned popup content,
43
+ including block-menu Ask Rovo impressions and credit requests. Existing
44
+ `rovo_credits_degradation_ui`, `confluence_ubp_remix`, and `confluence_ubp_ai_credits` rollout
45
+ controls remain in place.
46
+
47
+ Keep the reusable reactive credit hooks and provider contract in
48
+ `@atlaskit/editor-common/credit-guard`, alongside the existing check and popup. Image generation
49
+ and malleable-ui consume these shared foundations without importing credit helpers from the AI
50
+ plugin.
51
+
52
+ Expose the existing popup and synchronous guard helpers through granular public entrypoints and
53
+ migrate every credit-guard barrel consumer to its owning export.
54
+
55
+ - [`85d826388ed61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85d826388ed61) -
56
+ [EDITOR-8341] export a shared AlignmentIconMap from editor-common and use it in the text alignment
57
+ and divider toolbars
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies
62
+
3
63
  ## 134.18.0
4
64
 
5
65
  ### Minor Changes
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/alignment-icon-map",
3
+ "main": "../dist/cjs/ui/alignment-icon-map.js",
4
+ "module": "../dist/esm/ui/alignment-icon-map.js",
5
+ "module:es2019": "../dist/es2019/ui/alignment-icon-map.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/ui/alignment-icon-map.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/check-ai-credit-status",
3
+ "main": "../../dist/cjs/credit-guard/checkAICreditStatus.js",
4
+ "module": "../../dist/esm/credit-guard/checkAICreditStatus.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/checkAICreditStatus.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/checkAICreditStatus.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/popup",
3
+ "main": "../../dist/cjs/credit-guard/CreditCheckedPopup.js",
4
+ "module": "../../dist/esm/credit-guard/CreditCheckedPopup.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/CreditCheckedPopup.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/CreditCheckedPopup.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/types",
3
+ "main": "../../dist/cjs/credit-guard/types.js",
4
+ "module": "../../dist/esm/credit-guard/types.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/types.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/types.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/use-ai-credit-guard",
3
+ "main": "../../dist/cjs/credit-guard/useAICreditGuard.js",
4
+ "module": "../../dist/esm/credit-guard/useAICreditGuard.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/useAICreditGuard.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/useAICreditGuard.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/use-ai-credit-status",
3
+ "main": "../../dist/cjs/credit-guard/useAICreditStatus.js",
4
+ "module": "../../dist/esm/credit-guard/useAICreditStatus.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/useAICreditStatus.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/useAICreditStatus.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/credit-guard/use-credit-checked-action",
3
+ "main": "../../dist/cjs/credit-guard/useCreditCheckedAction.js",
4
+ "module": "../../dist/esm/credit-guard/useCreditCheckedAction.js",
5
+ "module:es2019": "../../dist/es2019/credit-guard/useCreditCheckedAction.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/credit-guard/useCreditCheckedAction.d.ts"
10
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useAICreditStatus = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _checkAICreditStatus = require("./checkAICreditStatus");
11
+ var available = {
12
+ isBlocked: false
13
+ };
14
+
15
+ /** Reuses cached product decisions; notifications preserve live depletion and recovery. */
16
+ var useAICreditStatus = exports.useAICreditStatus = function useAICreditStatus(provider, featureName) {
17
+ var isActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
18
+ var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
19
+ var subscribe = provider === null || provider === void 0 ? void 0 : provider.subscribeToAICreditStatus;
20
+ var _useState = (0, _react.useState)(function () {
21
+ return isActive && getAICreditStatus ? (0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
22
+ featureName: featureName
23
+ }) : available;
24
+ }),
25
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
26
+ status = _useState2[0],
27
+ setStatus = _useState2[1];
28
+ (0, _react.useEffect)(function () {
29
+ if (!isActive) return;
30
+ var refresh = function refresh() {
31
+ setStatus(getAICreditStatus ? (0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
32
+ featureName: featureName
33
+ }) : available);
34
+ };
35
+ var unsubscribe = subscribe === null || subscribe === void 0 ? void 0 : subscribe(refresh);
36
+ refresh();
37
+ return unsubscribe;
38
+ }, [featureName, getAICreditStatus, subscribe, isActive]);
39
+ return isActive && getAICreditStatus ? status : available;
40
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCreditCheckedAction = void 0;
7
+ var _react = require("react");
8
+ var _checkAICreditStatus = require("./checkAICreditStatus");
9
+ /** Recheck synchronously at activation using the same shared guard as other Editor actions. */
10
+ var useCreditCheckedAction = exports.useCreditCheckedAction = function useCreditCheckedAction(provider, featureName) {
11
+ var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
12
+ return (0, _react.useCallback)(function (action) {
13
+ if (!getAICreditStatus || !(0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
14
+ featureName: featureName
15
+ }).isBlocked) {
16
+ action();
17
+ }
18
+ }, [getAICreditStatus, featureName]);
19
+ };
@@ -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)("div", {
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)("div", {
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)("div", {
168
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
169
- css: containerStyles
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)("div", {
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',
@@ -6,6 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ruleMessages = void 0;
7
7
  var _reactIntl = require("react-intl");
8
8
  var ruleMessages = exports.ruleMessages = (0, _reactIntl.defineMessages)({
9
+ addText: {
10
+ id: 'editor-common.messages.rule.addText',
11
+ defaultMessage: 'Add text',
12
+ description: 'Button for adding a text label to a divider.'
13
+ },
14
+ alignText: {
15
+ id: 'editor-common.messages.rule.alignText',
16
+ defaultMessage: 'Align text',
17
+ description: 'Button for aligning the text label of a divider.'
18
+ },
9
19
  customDividerColor: {
10
20
  id: 'editor-common.messages.rule.customDividerColor',
11
21
  defaultMessage: 'Custom',
@@ -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.17.0";
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.17.0";
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
  }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AlignmentIconMap = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntl = require("react-intl");
10
+ var _alignTextCenter = _interopRequireDefault(require("@atlaskit/icon/core/align-text-center"));
11
+ var _alignTextLeft = _interopRequireDefault(require("@atlaskit/icon/core/align-text-left"));
12
+ var _alignTextRight = _interopRequireDefault(require("@atlaskit/icon/core/align-text-right"));
13
+ var _alignment = require("../messages/alignment");
14
+ var iconAndMessageMap = {
15
+ start: {
16
+ Component: _alignTextLeft.default,
17
+ label: _alignment.alignmentMessages.alignLeft
18
+ },
19
+ end: {
20
+ Component: _alignTextRight.default,
21
+ label: _alignment.alignmentMessages.alignRight
22
+ },
23
+ center: {
24
+ Component: _alignTextCenter.default,
25
+ label: _alignment.alignmentMessages.alignCenter
26
+ }
27
+ };
28
+ var AlignmentIconMap = exports.AlignmentIconMap = function AlignmentIconMap(props) {
29
+ var _iconAndMessageMap$pr, _props$size;
30
+ var _ref = (_iconAndMessageMap$pr = iconAndMessageMap[props.alignment]) !== null && _iconAndMessageMap$pr !== void 0 ? _iconAndMessageMap$pr : iconAndMessageMap.center,
31
+ Component = _ref.Component,
32
+ label = _ref.label;
33
+ var intl = (0, _reactIntl.useIntl)();
34
+ return /*#__PURE__*/_react.default.createElement(Component, {
35
+ label: intl.formatMessage(label),
36
+ color: "currentColor",
37
+ spacing: "spacious",
38
+ size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 'medium'
39
+ });
40
+ };
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { checkAICreditStatus } from './checkAICreditStatus';
3
+ const available = {
4
+ isBlocked: false
5
+ };
6
+
7
+ /** Reuses cached product decisions; notifications preserve live depletion and recovery. */
8
+ export const useAICreditStatus = (provider, featureName, isActive = true) => {
9
+ const getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
10
+ const subscribe = provider === null || provider === void 0 ? void 0 : provider.subscribeToAICreditStatus;
11
+ const [status, setStatus] = useState(() => isActive && getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
12
+ featureName
13
+ }) : available);
14
+ useEffect(() => {
15
+ if (!isActive) return;
16
+ const refresh = () => {
17
+ setStatus(getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
18
+ featureName
19
+ }) : available);
20
+ };
21
+ const unsubscribe = subscribe === null || subscribe === void 0 ? void 0 : subscribe(refresh);
22
+ refresh();
23
+ return unsubscribe;
24
+ }, [featureName, getAICreditStatus, subscribe, isActive]);
25
+ return isActive && getAICreditStatus ? status : available;
26
+ };
@@ -0,0 +1,13 @@
1
+ import { useCallback } from 'react';
2
+ import { checkAICreditStatus } from './checkAICreditStatus';
3
+ /** Recheck synchronously at activation using the same shared guard as other Editor actions. */
4
+ export const useCreditCheckedAction = (provider, featureName) => {
5
+ const getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
6
+ return useCallback(action => {
7
+ if (!getAICreditStatus || !checkAICreditStatus(getAICreditStatus, {
8
+ featureName
9
+ }).isBlocked) {
10
+ action();
11
+ }
12
+ }, [getAICreditStatus, featureName]);
13
+ };