@atlaskit/editor-common 122.6.1 → 122.8.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 (46) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/media/messages/imageBorder.js +10 -0
  3. package/dist/cjs/media-inline/media-inline-image-card.js +9 -7
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +17 -3
  6. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +4 -0
  7. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +103 -0
  8. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -0
  9. package/dist/cjs/ui/DropList/index.js +1 -1
  10. package/dist/cjs/ui/Mention/mention-with-profilecard.js +2 -2
  11. package/dist/cjs/ui/Mention/mention-with-providers.js +3 -3
  12. package/dist/cjs/ui-color/ColorPalette/index.js +4 -2
  13. package/dist/cjs/utils/compareNodes.js +2 -5
  14. package/dist/es2019/media/messages/imageBorder.js +10 -0
  15. package/dist/es2019/media-inline/media-inline-image-card.js +3 -1
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +11 -3
  18. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +4 -0
  19. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +87 -0
  20. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -0
  21. package/dist/es2019/ui/DropList/index.js +1 -1
  22. package/dist/es2019/ui/Mention/mention-with-profilecard.js +1 -1
  23. package/dist/es2019/ui/Mention/mention-with-providers.js +1 -1
  24. package/dist/es2019/ui-color/ColorPalette/index.js +4 -2
  25. package/dist/es2019/utils/compareNodes.js +2 -5
  26. package/dist/esm/media/messages/imageBorder.js +10 -0
  27. package/dist/esm/media-inline/media-inline-image-card.js +3 -1
  28. package/dist/esm/monitoring/error.js +1 -1
  29. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +15 -3
  30. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +4 -0
  31. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +94 -0
  32. package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -0
  33. package/dist/esm/ui/DropList/index.js +1 -1
  34. package/dist/esm/ui/Mention/mention-with-profilecard.js +1 -1
  35. package/dist/esm/ui/Mention/mention-with-providers.js +1 -1
  36. package/dist/esm/ui-color/ColorPalette/index.js +4 -2
  37. package/dist/esm/utils/compareNodes.js +2 -5
  38. package/dist/types/media/messages/imageBorder.d.ts +27 -17
  39. package/dist/types/quick-insert/CompactQuickInsertMenuItem.d.ts +1 -1
  40. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +8 -0
  41. package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +6 -1
  42. package/dist/types/ui/EventHandlers/index.d.ts +1 -1
  43. package/dist/types/ui/Mention/mention-with-profilecard.d.ts +1 -1
  44. package/dist/types/ui/Mention/mention-with-providers.d.ts +1 -2
  45. package/dist/types/ui-color/ColorPalette/index.d.ts +4 -0
  46. package/package.json +2 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 122.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c942b90687404`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c942b90687404) -
8
+ Add an optional `ariaLabel` prop to `ColorPalette` so consumers can give its radio group an
9
+ accessible name, and add image border color and size radio group labels to the image border
10
+ messages. Consumed behind `platform_editor_a11y_border_radiogroup_label`.
11
+
12
+ ## 122.7.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`a6ea70b003713`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a6ea70b003713) -
17
+ Improve the slash-command menu behind `platform_editor_slash_command`: add optional light and dark
18
+ preview image URLs, show theme-aware previews for headings, quote, and list commands, and set the
19
+ registered menu to 320px wide and up to 480px tall while allowing short menus to hug their
20
+ contents. Previews fall back to the light image when no dark image is supplied and are not shown
21
+ when no URLs are supplied.
22
+
23
+ ### Patch Changes
24
+
25
+ - [`588770a1c455e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/588770a1c455e) -
26
+ [FFCLEANUP-82019] clean up FG `platform_editor_fix_mixed_types_column_sort`
27
+ - Updated dependencies
28
+
3
29
  ## 122.6.1
4
30
 
5
31
  ### Patch Changes
@@ -16,6 +16,11 @@ var imageBorderMessages = exports.imageBorderMessages = (0, _reactIntl.defineMes
16
16
  defaultMessage: 'Image border options Color dropdown',
17
17
  description: 'ARIA label for the dropdown to change the border color of an image.'
18
18
  },
19
+ borderColorRadioGroupAriaLabel: {
20
+ id: 'fabric.editor.imageBorderColor.radioGroupAriaLabel',
21
+ defaultMessage: 'Color options',
22
+ description: 'ARIA label for the group of selectable border colors in the image border options panel.'
23
+ },
19
24
  borderSize: {
20
25
  id: 'fabric.editor.imageBorderSize',
21
26
  defaultMessage: 'Size',
@@ -26,6 +31,11 @@ var imageBorderMessages = exports.imageBorderMessages = (0, _reactIntl.defineMes
26
31
  defaultMessage: 'Image border options Size dropdown',
27
32
  description: 'ARIA label for the dropdown to change the border size of an image.'
28
33
  },
34
+ borderSizeRadioGroupAriaLabel: {
35
+ id: 'fabric.editor.imageBorderSize.radioGroupAriaLabel',
36
+ defaultMessage: 'Size options',
37
+ description: 'ARIA label for the group of selectable border sizes in the image border options panel.'
38
+ },
29
39
  addBorder: {
30
40
  id: 'fabric.editor.addImageBorder',
31
41
  defaultMessage: 'Add border',
@@ -12,7 +12,9 @@ var _react2 = require("@emotion/react");
12
12
  var _reactDom = _interopRequireDefault(require("react-dom"));
13
13
  var _reactIntl = require("react-intl");
14
14
  var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
15
- var _mediaCard = require("@atlaskit/media-card");
15
+ var _fireFailedOperationalEvent = require("@atlaskit/media-card/inline/fire-failed-operational-event");
16
+ var _fireSucceededOperationalEvent = require("@atlaskit/media-card/inline/fire-succeeded-operational-event");
17
+ var _mediaCardError = require("@atlaskit/media-card/media-card-error");
16
18
  var _mediaClient = require("@atlaskit/media-client");
17
19
  var _mediaClientProvider = require("@atlaskit/media-client-react/media-client-provider");
18
20
  var _mediaViewer = require("@atlaskit/media-viewer");
@@ -70,17 +72,17 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
70
72
  var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
71
73
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
72
74
  var fireFailedOperationalEvent = function fireFailedOperationalEvent() {
73
- var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _mediaCard.MediaCardError('missing-error-data');
75
+ var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _mediaCardError.MediaCardError('missing-error-data');
74
76
  var failReason = arguments.length > 1 ? arguments[1] : undefined;
75
77
  if (!isFailedEventSent && fileState) {
76
78
  setIsFailedEventSent(true);
77
- (0, _mediaCard.fireFailedMediaInlineEvent)(fileState, error, failReason, createAnalyticsEvent);
79
+ (0, _fireFailedOperationalEvent.fireFailedOperationalEvent)(fileState, error, failReason, createAnalyticsEvent);
78
80
  }
79
81
  };
80
82
  var fireSucceededOperationalEvent = function fireSucceededOperationalEvent() {
81
83
  if (!isSucceededEventSent && fileState) {
82
84
  setIsSucceededEventSent(true);
83
- (0, _mediaCard.fireSucceededMediaInlineEvent)(fileState, createAnalyticsEvent);
85
+ (0, _fireSucceededOperationalEvent.fireSucceededOperationalEvent)(fileState, createAnalyticsEvent);
84
86
  }
85
87
  };
86
88
  (0, _react.useEffect)(function () {
@@ -115,7 +117,7 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
115
117
  var isUploading = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading';
116
118
  var errorMessage = isUploading ? _mediaInlineCard.messages.failedToUpload : _mediaInlineCard.messages.unableToLoadContent;
117
119
  var errorReason = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading' ? 'upload' : 'metadata-fetch';
118
- fireFailedOperationalEvent(new _mediaCard.MediaCardError(errorReason, subscribeError));
120
+ fireFailedOperationalEvent(new _mediaCardError.MediaCardError(errorReason, subscribeError));
119
121
  return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
120
122
  message: formatMessage(errorMessage)
121
123
  });
@@ -124,7 +126,7 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
124
126
  return (0, _react2.jsx)(_loadingView.InlineImageCardLoadingView, null);
125
127
  }
126
128
  if (fileState.status === 'error') {
127
- fireFailedOperationalEvent(new _mediaCard.MediaCardError('error-file-state', new Error(fileState.message)));
129
+ fireFailedOperationalEvent(new _mediaCardError.MediaCardError('error-file-state', new Error(fileState.message)));
128
130
  return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
129
131
  message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
130
132
  });
@@ -134,7 +136,7 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
134
136
  message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
135
137
  });
136
138
  } else if (!fileState.name) {
137
- fireFailedOperationalEvent(new _mediaCard.MediaCardError('metadata-fetch', new _mediaClient.FileFetcherError('emptyFileName', {
139
+ fireFailedOperationalEvent(new _mediaCardError.MediaCardError('metadata-fetch', new _mediaClient.FileFetcherError('emptyFileName', {
138
140
  id: fileState.id
139
141
  })));
140
142
  return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
@@ -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 = "122.6.0";
30
+ var packageVersion = "122.7.0";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -2,19 +2,23 @@
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
7
8
  });
8
9
  exports.CompactQuickInsertMenuItem = void 0;
9
10
  require("./CompactQuickInsertMenuItem.compiled.css");
10
11
  var _runtime = require("@compiled/react/runtime");
11
- var _react = _interopRequireDefault(require("react"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+ var _react = _interopRequireWildcard(require("react"));
12
14
  var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
13
15
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
14
16
  var _primitives = require("@atlaskit/primitives");
15
17
  var _compiled = require("@atlaskit/primitives/compiled");
18
+ var _QuickInsertHoverPreview = require("./QuickInsertHoverPreview");
16
19
  var _quickInsertMenuItemUtils = require("./quickInsertMenuItemUtils");
17
20
  var _useQuickInsertContext = require("./useQuickInsertContext");
21
+ 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); }
18
22
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
19
23
  var styles = {
20
24
  iconContainer: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o _1tke1tcg _1ul91tcg",
@@ -81,6 +85,7 @@ var CompactQuickInsertMenuItem = exports.CompactQuickInsertMenuItem = function C
81
85
  iconBefore = _ref.iconBefore,
82
86
  isDisabled = _ref.isDisabled,
83
87
  onSelect = _ref.onSelect,
88
+ previewImageUrls = _ref.previewImageUrls,
84
89
  shortcut = _ref.shortcut,
85
90
  _ref$shouldWrapIcon = _ref.shouldWrapIcon,
86
91
  shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
@@ -94,6 +99,10 @@ var CompactQuickInsertMenuItem = exports.CompactQuickInsertMenuItem = function C
94
99
  id = _ref2.id,
95
100
  isSelected = _ref2.isSelected;
96
101
  var handleClick = (0, _quickInsertMenuItemUtils.useQuickInsertMenuItemSelection)(onSelect);
102
+ var _useState = (0, _react.useState)(null),
103
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
104
+ referenceElement = _useState2[0],
105
+ setReferenceElement = _useState2[1];
97
106
  if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command')) {
98
107
  var _wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
99
108
  xcss: styles.icon
@@ -118,7 +127,8 @@ var CompactQuickInsertMenuItem = exports.CompactQuickInsertMenuItem = function C
118
127
  var wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
119
128
  xcss: styles.iconLarge
120
129
  }, iconBefore) : iconBefore;
121
- return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
130
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
131
+ ref: setReferenceElement,
122
132
  "aria-label": ariaLabel,
123
133
  "aria-selected": isSelected,
124
134
  id: id,
@@ -135,5 +145,9 @@ var CompactQuickInsertMenuItem = exports.CompactQuickInsertMenuItem = function C
135
145
  }, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, title), shortcut && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
136
146
  as: "span",
137
147
  xcss: styles.shortcut
138
- }, shortcut)));
148
+ }, shortcut))), isSelected && !isDisabled && (previewImageUrls === null || previewImageUrls === void 0 ? void 0 : previewImageUrls.light) && referenceElement && /*#__PURE__*/_react.default.createElement(_QuickInsertHoverPreview.QuickInsertHoverPreview, {
149
+ key: previewImageUrls.light,
150
+ previewImageUrls: previewImageUrls,
151
+ referenceElement: referenceElement
152
+ }));
139
153
  };
@@ -0,0 +1,4 @@
1
+ ._1e0c1ule{display:block}
2
+ ._1pby16oo{z-index:510}
3
+ ._3um015vq{visibility:hidden}
4
+ ._3um0ewfl{visibility:visible}
@@ -0,0 +1,103 @@
1
+ /* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.1 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.QuickInsertHoverPreview = void 0;
10
+ require("./QuickInsertHoverPreview.compiled.css");
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
13
+ var _runtime = require("@compiled/react/runtime");
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+ var _reactDom = require("react-dom");
17
+ var _main = require("@atlaskit/popper/main");
18
+ var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
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
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ var PREVIEW_WIDTH = 294;
23
+ var PREVIEW_OFFSET = [-4, 4];
24
+ var PREVIEW_MODIFIERS = [{
25
+ name: 'preventOverflow',
26
+ options: {
27
+ mainAxis: false
28
+ }
29
+ }];
30
+ var styles = {
31
+ image: "_1e0c1ule _1pby16oo",
32
+ hidden: "_3um015vq",
33
+ visible: "_3um0ewfl"
34
+ };
35
+
36
+ /** A non-interactive visual preview: keep focus and keyboard handling in the editor. */
37
+ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
38
+ var previewImageUrls = _ref.previewImageUrls,
39
+ referenceElement = _ref.referenceElement;
40
+ var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
41
+ colorMode = _useThemeObserver.colorMode;
42
+ var previewImageUrl = colorMode === 'dark' && previewImageUrls.dark ? previewImageUrls.dark : previewImageUrls.light;
43
+ return /*#__PURE__*/React.createElement(QuickInsertHoverPreviewImage, {
44
+ key: previewImageUrl,
45
+ previewImageUrl: previewImageUrl,
46
+ referenceElement: referenceElement
47
+ });
48
+ };
49
+ var QuickInsertHoverPreviewImage = function QuickInsertHoverPreviewImage(_ref2) {
50
+ var previewImageUrl = _ref2.previewImageUrl,
51
+ referenceElement = _ref2.referenceElement;
52
+ var _useState = (0, _react.useState)(false),
53
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
54
+ hasFailed = _useState2[0],
55
+ setHasFailed = _useState2[1];
56
+ var _useState3 = (0, _react.useState)(),
57
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
58
+ dimensions = _useState4[0],
59
+ setDimensions = _useState4[1];
60
+ if (hasFailed) {
61
+ return null;
62
+ }
63
+
64
+ // Unlike a dialog popup, this decorative preview must not introduce focus or ARIA ownership.
65
+ return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/React.createElement(_main.Popper, {
66
+ offset: PREVIEW_OFFSET,
67
+ placement: "right-start",
68
+ referenceElement: referenceElement,
69
+ strategy: "fixed",
70
+ shouldFitViewport: true,
71
+ modifiers: PREVIEW_MODIFIERS
72
+ }, function (_ref3) {
73
+ var ref = _ref3.ref,
74
+ style = _ref3.style;
75
+ return /*#__PURE__*/React.createElement("img", {
76
+ ref: ref,
77
+ style: _objectSpread(_objectSpread({}, style), {}, {
78
+ height: dimensions === null || dimensions === void 0 ? void 0 : dimensions.height,
79
+ width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width
80
+ }),
81
+ "aria-hidden": "true",
82
+ "data-testid": "quick-insert-hover-preview",
83
+ src: previewImageUrl,
84
+ alt: "",
85
+ onLoad: function onLoad(event) {
86
+ var _event$currentTarget = event.currentTarget,
87
+ naturalHeight = _event$currentTarget.naturalHeight,
88
+ naturalWidth = _event$currentTarget.naturalWidth;
89
+ if (naturalWidth === 0) {
90
+ return;
91
+ }
92
+ setDimensions({
93
+ height: naturalHeight / naturalWidth * PREVIEW_WIDTH,
94
+ width: PREVIEW_WIDTH
95
+ });
96
+ },
97
+ onError: function onError() {
98
+ return setHasFailed(true);
99
+ },
100
+ className: (0, _runtime.ax)([styles.image, dimensions ? styles.visible : styles.hidden])
101
+ });
102
+ }), referenceElement.ownerDocument.body);
103
+ };
@@ -15,6 +15,7 @@ var QuickInsertMenuItem = exports.QuickInsertMenuItem = function QuickInsertMenu
15
15
  iconBefore = _ref.iconBefore,
16
16
  isDisabled = _ref.isDisabled,
17
17
  onSelect = _ref.onSelect,
18
+ previewImageUrls = _ref.previewImageUrls,
18
19
  shortcut = _ref.shortcut,
19
20
  shouldWrapIcon = _ref.shouldWrapIcon,
20
21
  title = _ref.title;
@@ -35,6 +36,7 @@ var QuickInsertMenuItem = exports.QuickInsertMenuItem = function QuickInsertMenu
35
36
  iconBefore: iconBefore,
36
37
  isDisabled: isDisabled,
37
38
  onSelect: onSelect,
39
+ previewImageUrls: previewImageUrls,
38
40
  shortcut: shortcut,
39
41
  shouldWrapIcon: shouldWrapIcon,
40
42
  title: title
@@ -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 = "122.6.0";
27
+ var packageVersion = "122.7.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -8,7 +8,7 @@ exports.default = MentionWithProfileCard;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactLoadable = _interopRequireDefault(require("react-loadable"));
11
- var _mention = require("@atlaskit/mention");
11
+ var _resourcedMention = _interopRequireDefault(require("@atlaskit/mention/resourced-mention"));
12
12
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
13
13
  var _fg = require("@atlaskit/platform-feature-flags/fg");
14
14
  var _anchor = require("@atlaskit/primitives/anchor");
@@ -65,7 +65,7 @@ function MentionWithProfileCard(_ref) {
65
65
  var actions = (0, _react.useMemo)(function () {
66
66
  return profilecardProvider.getActions(id, text, accessLevel);
67
67
  }, [accessLevel, id, profilecardProvider, text]);
68
- var mention = /*#__PURE__*/_react.default.createElement(_mention.ResourcedMention, {
68
+ var mention = /*#__PURE__*/_react.default.createElement(_resourcedMention.default, {
69
69
  id: id,
70
70
  text: text,
71
71
  accessLevel: accessLevel,
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
- var _element = require("@atlaskit/mention/element");
13
+ var _resourcedMention = _interopRequireDefault(require("@atlaskit/mention/resourced-mention"));
14
14
  var _mentionWithProfilecard = _interopRequireDefault(require("./mention-with-profilecard"));
15
15
  var _excluded = ["id", "mentionNodeDataProvider", "userType"];
16
16
  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); }
@@ -99,13 +99,13 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
99
99
  }
100
100
  });
101
101
  }, [profilecardProviderResolver]);
102
- var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? _mentionWithProfilecard.default : _element.ResourcedMention;
102
+ var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? _mentionWithProfilecard.default : _resourcedMention.default;
103
103
  var ssrPlaceholderId = "mention-".concat(id);
104
104
 
105
105
  // A disabled mention is non-interactive, so it bypasses the profile-card
106
106
  // wrapper and renders the disabled resourced mention directly.
107
107
  if (isDisabled) {
108
- return /*#__PURE__*/_react.default.createElement(_element.ResourcedMention, {
108
+ return /*#__PURE__*/_react.default.createElement(_resourcedMention.default, {
109
109
  id: id,
110
110
  text: text,
111
111
  accessLevel: accessLevel,
@@ -55,7 +55,8 @@ var ColorPalette = function ColorPalette(props) {
55
55
  selectedColor = props.selectedColor,
56
56
  className = props.className,
57
57
  formatMessage = props.intl.formatMessage,
58
- paletteOptions = props.paletteOptions;
58
+ paletteOptions = props.paletteOptions,
59
+ ariaLabel = props.ariaLabel;
59
60
  var palette = paletteOptions.palette,
60
61
  hexToPaletteColor = paletteOptions.hexToPaletteColor,
61
62
  paletteColorTooltipMessages = paletteOptions.paletteColorTooltipMessages;
@@ -73,7 +74,8 @@ var ColorPalette = function ColorPalette(props) {
73
74
  ,
74
75
  className: className,
75
76
  key: "row-first-color-".concat(row[0].value),
76
- role: "radiogroup"
77
+ role: "radiogroup",
78
+ "aria-label": ariaLabel
77
79
  }, row.map(function (_ref) {
78
80
  var value = _ref.value,
79
81
  label = _ref.label,
@@ -14,7 +14,6 @@ exports.createCompareNodes = void 0;
14
14
  exports.createNormalizeTextParser = createNormalizeTextParser;
15
15
  exports.extractMetaFromTextNode = extractMetaFromTextNode;
16
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
- var _fg = require("@atlaskit/platform-feature-flags/fg");
18
17
  var _types = require("../types");
19
18
  var _ContentType = require("./ContentType");
20
19
  function getLinkMark(node) {
@@ -238,10 +237,8 @@ function compareMetaFromNode(metaNodeA, metaNodeB) {
238
237
  if (metaNodeA === null || metaNodeB === null) {
239
238
  return metaNodeB === null ? -1 : 1;
240
239
  }
241
- if ((0, _fg.fg)('platform_editor_fix_mixed_types_column_sort')) {
242
- if (metaNodeA.type === _ContentType.ContentType.TEXT && metaNodeB.type === _ContentType.ContentType.NUMBER || metaNodeA.type === _ContentType.ContentType.NUMBER && metaNodeB.type === _ContentType.ContentType.TEXT) {
243
- return compareValue(String(metaNodeA.value), String(metaNodeB.value));
244
- }
240
+ if (metaNodeA.type === _ContentType.ContentType.TEXT && metaNodeB.type === _ContentType.ContentType.NUMBER || metaNodeA.type === _ContentType.ContentType.NUMBER && metaNodeB.type === _ContentType.ContentType.TEXT) {
241
+ return compareValue(String(metaNodeA.value), String(metaNodeB.value));
245
242
  }
246
243
  if (metaNodeA.type !== metaNodeB.type) {
247
244
  return metaNodeA.type > metaNodeB.type ? 1 : -1;
@@ -10,6 +10,11 @@ export const imageBorderMessages = defineMessages({
10
10
  defaultMessage: 'Image border options Color dropdown',
11
11
  description: 'ARIA label for the dropdown to change the border color of an image.'
12
12
  },
13
+ borderColorRadioGroupAriaLabel: {
14
+ id: 'fabric.editor.imageBorderColor.radioGroupAriaLabel',
15
+ defaultMessage: 'Color options',
16
+ description: 'ARIA label for the group of selectable border colors in the image border options panel.'
17
+ },
13
18
  borderSize: {
14
19
  id: 'fabric.editor.imageBorderSize',
15
20
  defaultMessage: 'Size',
@@ -20,6 +25,11 @@ export const imageBorderMessages = defineMessages({
20
25
  defaultMessage: 'Image border options Size dropdown',
21
26
  description: 'ARIA label for the dropdown to change the border size of an image.'
22
27
  },
28
+ borderSizeRadioGroupAriaLabel: {
29
+ id: 'fabric.editor.imageBorderSize.radioGroupAriaLabel',
30
+ defaultMessage: 'Size options',
31
+ description: 'ARIA label for the group of selectable border sizes in the image border options panel.'
32
+ },
23
33
  addBorder: {
24
34
  id: 'fabric.editor.addImageBorder',
25
35
  defaultMessage: 'Add border',
@@ -9,7 +9,9 @@ import { jsx } from '@emotion/react';
9
9
  import ReactDOM from 'react-dom';
10
10
  import { createIntl, injectIntl } from 'react-intl';
11
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
12
- import { fireFailedMediaInlineEvent, fireSucceededMediaInlineEvent, MediaCardError } from '@atlaskit/media-card';
12
+ import { fireFailedOperationalEvent as fireFailedMediaInlineEvent } from '@atlaskit/media-card/inline/fire-failed-operational-event';
13
+ import { fireSucceededOperationalEvent as fireSucceededMediaInlineEvent } from '@atlaskit/media-card/inline/fire-succeeded-operational-event';
14
+ import { MediaCardError } from '@atlaskit/media-card/media-card-error';
13
15
  import { FileFetcherError } from '@atlaskit/media-client';
14
16
  import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
15
17
  import { MediaViewer } from '@atlaskit/media-viewer';
@@ -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 = "122.6.0";
16
+ const packageVersion = "122.7.0";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -1,12 +1,13 @@
1
1
  /* CompactQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./CompactQuickInsertMenuItem.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React from 'react';
4
+ import React, { useState } from 'react';
5
5
  import ButtonItem from '@atlaskit/menu/button-item';
6
6
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
7
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
8
8
  import { Pressable, xcss } from '@atlaskit/primitives';
9
9
  import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
10
+ import { QuickInsertHoverPreview } from './QuickInsertHoverPreview';
10
11
  import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
11
12
  import { useQuickInsertContext } from './useQuickInsertContext';
12
13
  const styles = {
@@ -74,6 +75,7 @@ export const CompactQuickInsertMenuItem = ({
74
75
  iconBefore,
75
76
  isDisabled,
76
77
  onSelect,
78
+ previewImageUrls,
77
79
  shortcut,
78
80
  shouldWrapIcon = true,
79
81
  title
@@ -89,6 +91,7 @@ export const CompactQuickInsertMenuItem = ({
89
91
  isSelected: false
90
92
  };
91
93
  const handleClick = useQuickInsertMenuItemSelection(onSelect);
94
+ const [referenceElement, setReferenceElement] = useState(null);
92
95
  if (!isExperimentEnabled('platform_editor_slash_command')) {
93
96
  const wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
94
97
  xcss: styles.icon
@@ -113,7 +116,8 @@ export const CompactQuickInsertMenuItem = ({
113
116
  const wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
114
117
  xcss: styles.iconLarge
115
118
  }, iconBefore) : iconBefore;
116
- return /*#__PURE__*/React.createElement(Pressable, {
119
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pressable, {
120
+ ref: setReferenceElement,
117
121
  "aria-label": ariaLabel,
118
122
  "aria-selected": isSelected,
119
123
  id: id,
@@ -130,5 +134,9 @@ export const CompactQuickInsertMenuItem = ({
130
134
  }, /*#__PURE__*/React.createElement(Text, null, title), shortcut && /*#__PURE__*/React.createElement(Box, {
131
135
  as: "span",
132
136
  xcss: styles.shortcut
133
- }, shortcut)));
137
+ }, shortcut))), isSelected && !isDisabled && (previewImageUrls === null || previewImageUrls === void 0 ? void 0 : previewImageUrls.light) && referenceElement && /*#__PURE__*/React.createElement(QuickInsertHoverPreview, {
138
+ key: previewImageUrls.light,
139
+ previewImageUrls: previewImageUrls,
140
+ referenceElement: referenceElement
141
+ }));
134
142
  };
@@ -0,0 +1,4 @@
1
+ ._1e0c1ule{display:block}
2
+ ._1pby16oo{z-index:510}
3
+ ._3um015vq{visibility:hidden}
4
+ ._3um0ewfl{visibility:visible}
@@ -0,0 +1,87 @@
1
+ /* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.1 */
2
+ import "./QuickInsertHoverPreview.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { useState } from 'react';
6
+ import { createPortal } from 'react-dom';
7
+ import { Popper } from '@atlaskit/popper/main';
8
+ import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
9
+ const PREVIEW_WIDTH = 294;
10
+ const PREVIEW_OFFSET = [-4, 4];
11
+ const PREVIEW_MODIFIERS = [{
12
+ name: 'preventOverflow',
13
+ options: {
14
+ mainAxis: false
15
+ }
16
+ }];
17
+ const styles = {
18
+ image: "_1e0c1ule _1pby16oo",
19
+ hidden: "_3um015vq",
20
+ visible: "_3um0ewfl"
21
+ };
22
+
23
+ /** A non-interactive visual preview: keep focus and keyboard handling in the editor. */
24
+ export const QuickInsertHoverPreview = ({
25
+ previewImageUrls,
26
+ referenceElement
27
+ }) => {
28
+ const {
29
+ colorMode
30
+ } = useThemeObserver();
31
+ const previewImageUrl = colorMode === 'dark' && previewImageUrls.dark ? previewImageUrls.dark : previewImageUrls.light;
32
+ return /*#__PURE__*/React.createElement(QuickInsertHoverPreviewImage, {
33
+ key: previewImageUrl,
34
+ previewImageUrl: previewImageUrl,
35
+ referenceElement: referenceElement
36
+ });
37
+ };
38
+ const QuickInsertHoverPreviewImage = ({
39
+ previewImageUrl,
40
+ referenceElement
41
+ }) => {
42
+ const [hasFailed, setHasFailed] = useState(false);
43
+ const [dimensions, setDimensions] = useState();
44
+ if (hasFailed) {
45
+ return null;
46
+ }
47
+
48
+ // Unlike a dialog popup, this decorative preview must not introduce focus or ARIA ownership.
49
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
50
+ offset: PREVIEW_OFFSET,
51
+ placement: "right-start",
52
+ referenceElement: referenceElement,
53
+ strategy: "fixed",
54
+ shouldFitViewport: true,
55
+ modifiers: PREVIEW_MODIFIERS
56
+ }, ({
57
+ ref,
58
+ style
59
+ }) => /*#__PURE__*/React.createElement("img", {
60
+ ref: ref,
61
+ style: {
62
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Popper positioning and intrinsic image dimensions are runtime values.
63
+ ...style,
64
+ height: dimensions === null || dimensions === void 0 ? void 0 : dimensions.height,
65
+ width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width
66
+ },
67
+ "aria-hidden": "true",
68
+ "data-testid": "quick-insert-hover-preview",
69
+ src: previewImageUrl,
70
+ alt: "",
71
+ onLoad: event => {
72
+ const {
73
+ naturalHeight,
74
+ naturalWidth
75
+ } = event.currentTarget;
76
+ if (naturalWidth === 0) {
77
+ return;
78
+ }
79
+ setDimensions({
80
+ height: naturalHeight / naturalWidth * PREVIEW_WIDTH,
81
+ width: PREVIEW_WIDTH
82
+ });
83
+ },
84
+ onError: () => setHasFailed(true),
85
+ className: ax([styles.image, dimensions ? styles.visible : styles.hidden])
86
+ })), referenceElement.ownerDocument.body);
87
+ };
@@ -8,6 +8,7 @@ export const QuickInsertMenuItem = ({
8
8
  iconBefore,
9
9
  isDisabled,
10
10
  onSelect,
11
+ previewImageUrls,
11
12
  shortcut,
12
13
  shouldWrapIcon,
13
14
  title
@@ -30,6 +31,7 @@ export const QuickInsertMenuItem = ({
30
31
  iconBefore: iconBefore,
31
32
  isDisabled: isDisabled,
32
33
  onSelect: onSelect,
34
+ previewImageUrls: previewImageUrls,
33
35
  shortcut: shortcut,
34
36
  shouldWrapIcon: shouldWrapIcon,
35
37
  title: title
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "122.6.0";
17
+ const packageVersion = "122.7.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import Loadable from 'react-loadable';
3
- import { ResourcedMention } from '@atlaskit/mention';
3
+ import ResourcedMention from '@atlaskit/mention/resourced-mention';
4
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
6
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- TODO: migrate to @atlaskit/primitives/compiled
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
- import { ResourcedMention } from '@atlaskit/mention/element';
3
+ import ResourcedMention from '@atlaskit/mention/resourced-mention';
4
4
  import ResourcedMentionWithProfilecard from './mention-with-profilecard';
5
5
  const GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
6
6
  const useMentionNodeData = ({
@@ -47,7 +47,8 @@ const ColorPalette = props => {
47
47
  intl: {
48
48
  formatMessage
49
49
  },
50
- paletteOptions
50
+ paletteOptions,
51
+ ariaLabel
51
52
  } = props;
52
53
  const {
53
54
  palette,
@@ -68,7 +69,8 @@ const ColorPalette = props => {
68
69
  ,
69
70
  className: className,
70
71
  key: `row-first-color-${row[0].value}`,
71
- role: "radiogroup"
72
+ role: "radiogroup",
73
+ "aria-label": ariaLabel
72
74
  }, row.map(({
73
75
  value,
74
76
  label,
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags/fg';
2
1
  import { SortOrder } from '../types';
3
2
  import { ContentType } from './ContentType';
4
3
  function getLinkMark(node) {
@@ -217,10 +216,8 @@ function compareMetaFromNode(metaNodeA, metaNodeB) {
217
216
  if (metaNodeA === null || metaNodeB === null) {
218
217
  return metaNodeB === null ? -1 : 1;
219
218
  }
220
- if (fg('platform_editor_fix_mixed_types_column_sort')) {
221
- if (metaNodeA.type === ContentType.TEXT && metaNodeB.type === ContentType.NUMBER || metaNodeA.type === ContentType.NUMBER && metaNodeB.type === ContentType.TEXT) {
222
- return compareValue(String(metaNodeA.value), String(metaNodeB.value));
223
- }
219
+ if (metaNodeA.type === ContentType.TEXT && metaNodeB.type === ContentType.NUMBER || metaNodeA.type === ContentType.NUMBER && metaNodeB.type === ContentType.TEXT) {
220
+ return compareValue(String(metaNodeA.value), String(metaNodeB.value));
224
221
  }
225
222
  if (metaNodeA.type !== metaNodeB.type) {
226
223
  return metaNodeA.type > metaNodeB.type ? 1 : -1;
@@ -10,6 +10,11 @@ export var imageBorderMessages = defineMessages({
10
10
  defaultMessage: 'Image border options Color dropdown',
11
11
  description: 'ARIA label for the dropdown to change the border color of an image.'
12
12
  },
13
+ borderColorRadioGroupAriaLabel: {
14
+ id: 'fabric.editor.imageBorderColor.radioGroupAriaLabel',
15
+ defaultMessage: 'Color options',
16
+ description: 'ARIA label for the group of selectable border colors in the image border options panel.'
17
+ },
13
18
  borderSize: {
14
19
  id: 'fabric.editor.imageBorderSize',
15
20
  defaultMessage: 'Size',
@@ -20,6 +25,11 @@ export var imageBorderMessages = defineMessages({
20
25
  defaultMessage: 'Image border options Size dropdown',
21
26
  description: 'ARIA label for the dropdown to change the border size of an image.'
22
27
  },
28
+ borderSizeRadioGroupAriaLabel: {
29
+ id: 'fabric.editor.imageBorderSize.radioGroupAriaLabel',
30
+ defaultMessage: 'Size options',
31
+ description: 'ARIA label for the group of selectable border sizes in the image border options panel.'
32
+ },
23
33
  addBorder: {
24
34
  id: 'fabric.editor.addImageBorder',
25
35
  defaultMessage: 'Add border',
@@ -13,7 +13,9 @@ import { jsx } from '@emotion/react';
13
13
  import ReactDOM from 'react-dom';
14
14
  import { createIntl, injectIntl } from 'react-intl';
15
15
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
16
- import { fireFailedMediaInlineEvent, fireSucceededMediaInlineEvent, MediaCardError } from '@atlaskit/media-card';
16
+ import { fireFailedOperationalEvent as fireFailedMediaInlineEvent } from '@atlaskit/media-card/inline/fire-failed-operational-event';
17
+ import { fireSucceededOperationalEvent as fireSucceededMediaInlineEvent } from '@atlaskit/media-card/inline/fire-succeeded-operational-event';
18
+ import { MediaCardError } from '@atlaskit/media-card/media-card-error';
17
19
  import { FileFetcherError } from '@atlaskit/media-client';
18
20
  import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
19
21
  import { MediaViewer } from '@atlaskit/media-viewer';
@@ -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 = "122.6.0";
22
+ var packageVersion = "122.7.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -1,12 +1,14 @@
1
1
  /* CompactQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.1 */
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import "./CompactQuickInsertMenuItem.compiled.css";
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
- import React from 'react';
5
+ import React, { useState } from 'react';
5
6
  import ButtonItem from '@atlaskit/menu/button-item';
6
7
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
8
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
8
9
  import { Pressable, xcss } from '@atlaskit/primitives';
9
10
  import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
11
+ import { QuickInsertHoverPreview } from './QuickInsertHoverPreview';
10
12
  import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
11
13
  import { useQuickInsertContext } from './useQuickInsertContext';
12
14
  var styles = {
@@ -74,6 +76,7 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
74
76
  iconBefore = _ref.iconBefore,
75
77
  isDisabled = _ref.isDisabled,
76
78
  onSelect = _ref.onSelect,
79
+ previewImageUrls = _ref.previewImageUrls,
77
80
  shortcut = _ref.shortcut,
78
81
  _ref$shouldWrapIcon = _ref.shouldWrapIcon,
79
82
  shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
@@ -87,6 +90,10 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
87
90
  id = _ref2.id,
88
91
  isSelected = _ref2.isSelected;
89
92
  var handleClick = useQuickInsertMenuItemSelection(onSelect);
93
+ var _useState = useState(null),
94
+ _useState2 = _slicedToArray(_useState, 2),
95
+ referenceElement = _useState2[0],
96
+ setReferenceElement = _useState2[1];
90
97
  if (!isExperimentEnabled('platform_editor_slash_command')) {
91
98
  var _wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
92
99
  xcss: styles.icon
@@ -111,7 +118,8 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
111
118
  var wrappedIcon = iconBefore && shouldWrapIcon ? /*#__PURE__*/React.createElement(Box, {
112
119
  xcss: styles.iconLarge
113
120
  }, iconBefore) : iconBefore;
114
- return /*#__PURE__*/React.createElement(Pressable, {
121
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pressable, {
122
+ ref: setReferenceElement,
115
123
  "aria-label": ariaLabel,
116
124
  "aria-selected": isSelected,
117
125
  id: id,
@@ -128,5 +136,9 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
128
136
  }, /*#__PURE__*/React.createElement(Text, null, title), shortcut && /*#__PURE__*/React.createElement(Box, {
129
137
  as: "span",
130
138
  xcss: styles.shortcut
131
- }, shortcut)));
139
+ }, shortcut))), isSelected && !isDisabled && (previewImageUrls === null || previewImageUrls === void 0 ? void 0 : previewImageUrls.light) && referenceElement && /*#__PURE__*/React.createElement(QuickInsertHoverPreview, {
140
+ key: previewImageUrls.light,
141
+ previewImageUrls: previewImageUrls,
142
+ referenceElement: referenceElement
143
+ }));
132
144
  };
@@ -0,0 +1,4 @@
1
+ ._1e0c1ule{display:block}
2
+ ._1pby16oo{z-index:510}
3
+ ._3um015vq{visibility:hidden}
4
+ ._3um0ewfl{visibility:visible}
@@ -0,0 +1,94 @@
1
+ /* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import "./QuickInsertHoverPreview.compiled.css";
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ import { useState } from 'react';
10
+ import { createPortal } from 'react-dom';
11
+ import { Popper } from '@atlaskit/popper/main';
12
+ import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
13
+ var PREVIEW_WIDTH = 294;
14
+ var PREVIEW_OFFSET = [-4, 4];
15
+ var PREVIEW_MODIFIERS = [{
16
+ name: 'preventOverflow',
17
+ options: {
18
+ mainAxis: false
19
+ }
20
+ }];
21
+ var styles = {
22
+ image: "_1e0c1ule _1pby16oo",
23
+ hidden: "_3um015vq",
24
+ visible: "_3um0ewfl"
25
+ };
26
+
27
+ /** A non-interactive visual preview: keep focus and keyboard handling in the editor. */
28
+ export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
29
+ var previewImageUrls = _ref.previewImageUrls,
30
+ referenceElement = _ref.referenceElement;
31
+ var _useThemeObserver = useThemeObserver(),
32
+ colorMode = _useThemeObserver.colorMode;
33
+ var previewImageUrl = colorMode === 'dark' && previewImageUrls.dark ? previewImageUrls.dark : previewImageUrls.light;
34
+ return /*#__PURE__*/React.createElement(QuickInsertHoverPreviewImage, {
35
+ key: previewImageUrl,
36
+ previewImageUrl: previewImageUrl,
37
+ referenceElement: referenceElement
38
+ });
39
+ };
40
+ var QuickInsertHoverPreviewImage = function QuickInsertHoverPreviewImage(_ref2) {
41
+ var previewImageUrl = _ref2.previewImageUrl,
42
+ referenceElement = _ref2.referenceElement;
43
+ var _useState = useState(false),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ hasFailed = _useState2[0],
46
+ setHasFailed = _useState2[1];
47
+ var _useState3 = useState(),
48
+ _useState4 = _slicedToArray(_useState3, 2),
49
+ dimensions = _useState4[0],
50
+ setDimensions = _useState4[1];
51
+ if (hasFailed) {
52
+ return null;
53
+ }
54
+
55
+ // Unlike a dialog popup, this decorative preview must not introduce focus or ARIA ownership.
56
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
57
+ offset: PREVIEW_OFFSET,
58
+ placement: "right-start",
59
+ referenceElement: referenceElement,
60
+ strategy: "fixed",
61
+ shouldFitViewport: true,
62
+ modifiers: PREVIEW_MODIFIERS
63
+ }, function (_ref3) {
64
+ var ref = _ref3.ref,
65
+ style = _ref3.style;
66
+ return /*#__PURE__*/React.createElement("img", {
67
+ ref: ref,
68
+ style: _objectSpread(_objectSpread({}, style), {}, {
69
+ height: dimensions === null || dimensions === void 0 ? void 0 : dimensions.height,
70
+ width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width
71
+ }),
72
+ "aria-hidden": "true",
73
+ "data-testid": "quick-insert-hover-preview",
74
+ src: previewImageUrl,
75
+ alt: "",
76
+ onLoad: function onLoad(event) {
77
+ var _event$currentTarget = event.currentTarget,
78
+ naturalHeight = _event$currentTarget.naturalHeight,
79
+ naturalWidth = _event$currentTarget.naturalWidth;
80
+ if (naturalWidth === 0) {
81
+ return;
82
+ }
83
+ setDimensions({
84
+ height: naturalHeight / naturalWidth * PREVIEW_WIDTH,
85
+ width: PREVIEW_WIDTH
86
+ });
87
+ },
88
+ onError: function onError() {
89
+ return setHasFailed(true);
90
+ },
91
+ className: ax([styles.image, dimensions ? styles.visible : styles.hidden])
92
+ });
93
+ }), referenceElement.ownerDocument.body);
94
+ };
@@ -8,6 +8,7 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
8
8
  iconBefore = _ref.iconBefore,
9
9
  isDisabled = _ref.isDisabled,
10
10
  onSelect = _ref.onSelect,
11
+ previewImageUrls = _ref.previewImageUrls,
11
12
  shortcut = _ref.shortcut,
12
13
  shouldWrapIcon = _ref.shouldWrapIcon,
13
14
  title = _ref.title;
@@ -28,6 +29,7 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
28
29
  iconBefore: iconBefore,
29
30
  isDisabled: isDisabled,
30
31
  onSelect: onSelect,
32
+ previewImageUrls: previewImageUrls,
31
33
  shortcut: shortcut,
32
34
  shouldWrapIcon: shouldWrapIcon,
33
35
  title: title
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "122.6.0";
24
+ var packageVersion = "122.7.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import Loadable from 'react-loadable';
3
- import { ResourcedMention } from '@atlaskit/mention';
3
+ import ResourcedMention from '@atlaskit/mention/resourced-mention';
4
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
6
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- TODO: migrate to @atlaskit/primitives/compiled
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  var _excluded = ["id", "mentionNodeDataProvider", "userType"];
5
5
  import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
6
- import { ResourcedMention } from '@atlaskit/mention/element';
6
+ import ResourcedMention from '@atlaskit/mention/resourced-mention';
7
7
  import ResourcedMentionWithProfilecard from './mention-with-profilecard';
8
8
  var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
9
9
  var useMentionNodeData = function useMentionNodeData(_ref) {
@@ -47,7 +47,8 @@ var ColorPalette = function ColorPalette(props) {
47
47
  selectedColor = props.selectedColor,
48
48
  className = props.className,
49
49
  formatMessage = props.intl.formatMessage,
50
- paletteOptions = props.paletteOptions;
50
+ paletteOptions = props.paletteOptions,
51
+ ariaLabel = props.ariaLabel;
51
52
  var palette = paletteOptions.palette,
52
53
  hexToPaletteColor = paletteOptions.hexToPaletteColor,
53
54
  paletteColorTooltipMessages = paletteOptions.paletteColorTooltipMessages;
@@ -65,7 +66,8 @@ var ColorPalette = function ColorPalette(props) {
65
66
  ,
66
67
  className: className,
67
68
  key: "row-first-color-".concat(row[0].value),
68
- role: "radiogroup"
69
+ role: "radiogroup",
70
+ "aria-label": ariaLabel
69
71
  }, row.map(function (_ref) {
70
72
  var value = _ref.value,
71
73
  label = _ref.label,
@@ -1,5 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
2
  import { SortOrder } from '../types';
4
3
  import { ContentType } from './ContentType';
5
4
  function getLinkMark(node) {
@@ -223,10 +222,8 @@ function compareMetaFromNode(metaNodeA, metaNodeB) {
223
222
  if (metaNodeA === null || metaNodeB === null) {
224
223
  return metaNodeB === null ? -1 : 1;
225
224
  }
226
- if (fg('platform_editor_fix_mixed_types_column_sort')) {
227
- if (metaNodeA.type === ContentType.TEXT && metaNodeB.type === ContentType.NUMBER || metaNodeA.type === ContentType.NUMBER && metaNodeB.type === ContentType.TEXT) {
228
- return compareValue(String(metaNodeA.value), String(metaNodeB.value));
229
- }
225
+ if (metaNodeA.type === ContentType.TEXT && metaNodeB.type === ContentType.NUMBER || metaNodeA.type === ContentType.NUMBER && metaNodeB.type === ContentType.TEXT) {
226
+ return compareValue(String(metaNodeA.value), String(metaNodeB.value));
230
227
  }
231
228
  if (metaNodeA.type !== metaNodeB.type) {
232
229
  return metaNodeA.type > metaNodeB.type ? 1 : -1;
@@ -1,52 +1,62 @@
1
1
  export declare const imageBorderMessages: {
2
- borderColor: {
3
- id: string;
2
+ addBorder: {
4
3
  defaultMessage: string;
5
4
  description: string;
6
- };
7
- borderColorDropdownAriaLabel: {
8
5
  id: string;
6
+ };
7
+ borderColor: {
9
8
  defaultMessage: string;
10
9
  description: string;
11
- };
12
- borderSize: {
13
10
  id: string;
11
+ };
12
+ borderColorDropdownAriaLabel: {
14
13
  defaultMessage: string;
15
14
  description: string;
16
- };
17
- borderSizeDropdownAriaLabel: {
18
15
  id: string;
16
+ };
17
+ borderColorRadioGroupAriaLabel: {
19
18
  defaultMessage: string;
20
19
  description: string;
21
- };
22
- addBorder: {
23
20
  id: string;
21
+ };
22
+ borderOptions: {
24
23
  defaultMessage: string;
25
24
  description: string;
26
- };
27
- removeBorder: {
28
25
  id: string;
26
+ };
27
+ borderSize: {
29
28
  defaultMessage: string;
30
29
  description: string;
31
- };
32
- borderOptions: {
33
30
  id: string;
31
+ };
32
+ borderSizeBold: {
34
33
  defaultMessage: string;
35
34
  description: string;
36
- };
37
- borderSizeSubtle: {
38
35
  id: string;
36
+ };
37
+ borderSizeDropdownAriaLabel: {
39
38
  defaultMessage: string;
40
39
  description: string;
40
+ id: string;
41
41
  };
42
42
  borderSizeMedium: {
43
+ defaultMessage: string;
44
+ description: string;
43
45
  id: string;
46
+ };
47
+ borderSizeRadioGroupAriaLabel: {
44
48
  defaultMessage: string;
45
49
  description: string;
50
+ id: string;
46
51
  };
47
- borderSizeBold: {
52
+ borderSizeSubtle: {
53
+ defaultMessage: string;
54
+ description: string;
48
55
  id: string;
56
+ };
57
+ removeBorder: {
49
58
  defaultMessage: string;
50
59
  description: string;
60
+ id: string;
51
61
  };
52
62
  };
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { QuickInsertMenuItemProps } from './QuickInsertMenuItem';
3
- export declare const CompactQuickInsertMenuItem: ({ ariaLabel, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
3
+ export declare const CompactQuickInsertMenuItem: ({ ariaLabel, iconBefore, isDisabled, onSelect, previewImageUrls, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ /** A non-interactive visual preview: keep focus and keyboard handling in the editor. */
2
+ export declare const QuickInsertHoverPreview: ({ previewImageUrls, referenceElement, }: {
3
+ previewImageUrls: {
4
+ dark?: string;
5
+ light: string;
6
+ };
7
+ referenceElement: HTMLElement;
8
+ }) => React.JSX.Element;
@@ -14,8 +14,13 @@ export type QuickInsertMenuItemProps = {
14
14
  iconBefore?: React.ReactNode;
15
15
  isDisabled?: boolean;
16
16
  onSelect: (context: OnSelectContext) => Transaction | false | void;
17
+ /** Approved preview images, loaded only while this slash-command item is selected. */
18
+ previewImageUrls?: {
19
+ dark?: string;
20
+ light: string;
21
+ } | null;
17
22
  shortcut?: string;
18
23
  shouldWrapIcon?: boolean;
19
24
  title: string;
20
25
  };
21
- export declare const QuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, onSelect, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
26
+ export declare const QuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, onSelect, previewImageUrls, shortcut, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { SyntheticEvent } from 'react';
2
- import type { CardEvent, InlineCardEvent } from '@atlaskit/media-card';
2
+ import type { CardEvent, InlineCardEvent } from '@atlaskit/media-card/types';
3
3
  import type { Identifier } from '@atlaskit/media-client';
4
4
  export interface CardSurroundings {
5
5
  collectionName: string;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { UserType as MentionUserType } from '@atlaskit/adf-schema/mention';
3
- import type { MentionProvider } from '@atlaskit/mention';
3
+ import type { MentionProvider } from '@atlaskit/mention/types';
4
4
  import type { ProfilecardProvider } from '../../provider-factory/profile-card-provider';
5
5
  import type { MentionEventHandler } from '../EventHandlers';
6
6
  export interface Props {
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { UserType as MentionUserType } from '@atlaskit/adf-schema/mention';
3
- import type { MentionProvider } from '@atlaskit/mention/resource';
4
- import type { MentionNodeData } from '@atlaskit/mention/types';
3
+ import type { MentionNodeData, MentionProvider } from '@atlaskit/mention/types';
5
4
  import type { ProfilecardProvider } from '../../provider-factory/profile-card-provider';
6
5
  import type { MentionEventHandlers } from '../EventHandlers';
7
6
  import type { MentionNodeDataProvider } from './mention-node-data-provider';
@@ -6,6 +6,10 @@ import React from 'react';
6
6
  import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
7
7
  import type { PaletteColor, PaletteTooltipMessages } from './Palettes/type';
8
8
  interface Props {
9
+ /**
10
+ * Accessible name for the radio group each row of colors is rendered as.
11
+ */
12
+ ariaLabel?: string;
9
13
  className?: string;
10
14
  cols?: number;
11
15
  onClick: (value: string, label: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "122.6.1",
3
+ "version": "122.8.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/"
@@ -84,7 +84,7 @@
84
84
  "@atlaskit/task-decision": "^21.10.0",
85
85
  "@atlaskit/teams-app-config": "^3.1.0",
86
86
  "@atlaskit/textfield": "^10.2.0",
87
- "@atlaskit/tmp-editor-statsig": "^195.0.0",
87
+ "@atlaskit/tmp-editor-statsig": "^196.0.0",
88
88
  "@atlaskit/tokens": "^17.0.0",
89
89
  "@atlaskit/tooltip": "^24.3.0",
90
90
  "@atlaskit/width-detector": "^7.2.0",
@@ -215,9 +215,6 @@
215
215
  "platform_editor_content_mode_button_mvp": {
216
216
  "type": "boolean"
217
217
  },
218
- "platform_editor_fix_mixed_types_column_sort": {
219
- "type": "boolean"
220
- },
221
218
  "jim-lower-ranking-in-jira-macro-search": {
222
219
  "type": "boolean"
223
220
  },