@atlaskit/editor-common 94.7.0 → 94.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 (36) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/messages/annotation.js +10 -0
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +5 -0
  6. package/dist/cjs/ui/DropList/index.js +1 -1
  7. package/dist/cjs/ui/FloatingToolbar/Button.js +29 -8
  8. package/dist/cjs/ui/FloatingToolbar/ButtonSpotlightCard.js +39 -0
  9. package/dist/cjs/ui-menu/DropdownMenu/index.js +0 -3
  10. package/dist/es2019/messages/annotation.js +10 -0
  11. package/dist/es2019/monitoring/error.js +1 -1
  12. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +5 -0
  13. package/dist/es2019/ui/DropList/index.js +1 -1
  14. package/dist/es2019/ui/FloatingToolbar/Button.js +22 -9
  15. package/dist/es2019/ui/FloatingToolbar/ButtonSpotlightCard.js +29 -0
  16. package/dist/es2019/ui-menu/DropdownMenu/index.js +0 -3
  17. package/dist/esm/messages/annotation.js +10 -0
  18. package/dist/esm/monitoring/error.js +1 -1
  19. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +5 -0
  20. package/dist/esm/ui/DropList/index.js +1 -1
  21. package/dist/esm/ui/FloatingToolbar/Button.js +30 -9
  22. package/dist/esm/ui/FloatingToolbar/ButtonSpotlightCard.js +32 -0
  23. package/dist/esm/ui-menu/DropdownMenu/index.js +0 -3
  24. package/dist/types/messages/annotation.d.ts +10 -0
  25. package/dist/types/types/floating-toolbar.d.ts +12 -0
  26. package/dist/types/types/index.d.ts +1 -1
  27. package/dist/types/ui/DropList/index.d.ts +1 -4
  28. package/dist/types/ui/FloatingToolbar/Button.d.ts +4 -1
  29. package/dist/types/ui/FloatingToolbar/ButtonSpotlightCard.d.ts +10 -0
  30. package/dist/types-ts4.5/messages/annotation.d.ts +10 -0
  31. package/dist/types-ts4.5/types/floating-toolbar.d.ts +12 -0
  32. package/dist/types-ts4.5/types/index.d.ts +1 -1
  33. package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -4
  34. package/dist/types-ts4.5/ui/FloatingToolbar/Button.d.ts +4 -1
  35. package/dist/types-ts4.5/ui/FloatingToolbar/ButtonSpotlightCard.d.ts +10 -0
  36. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 94.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#157867](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157867)
8
+ [`8398a1f0013fc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8398a1f0013fc) -
9
+ [ux] ED-25331-add-spotlight-to-inline-comment-button
10
+
11
+ ### Patch Changes
12
+
13
+ - [`ae4b01915f647`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ae4b01915f647) -
14
+ Fix emoji XSS
15
+ - [#157905](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157905)
16
+ [`f02486a915690`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f02486a915690) -
17
+ NO-ISSUE Cleanup unused props and components
18
+ - Updated dependencies
19
+
3
20
  ## 94.7.0
4
21
 
5
22
  ### Minor Changes
@@ -113,6 +113,9 @@
113
113
  {
114
114
  "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
115
115
  },
116
+ {
117
+ "path": "../../../design-system/popper/afm-cc/tsconfig.json"
118
+ },
116
119
  {
117
120
  "path": "../../../design-system/primitives/afm-cc/tsconfig.json"
118
121
  },
@@ -26,5 +26,15 @@ var annotationMessages = exports.annotationMessages = (0, _reactIntlNext.defineM
26
26
  id: 'fabric.editor.annotationToolbar',
27
27
  defaultMessage: 'Annotation toolbar',
28
28
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
29
+ },
30
+ createCommentOnInlineNodeSpotlightBody: {
31
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.body',
32
+ defaultMessage: 'You can now leave comments on inline elements like links, dates, statuses and mentions.',
33
+ description: 'The body content of the spotlight message that appears when the user can leave comments on inline nodes'
34
+ },
35
+ createCommentOnInlineNodeSpotlightAction: {
36
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.action',
37
+ defaultMessage: 'Got it',
38
+ description: 'The content of the action button that closes the spotlight'
29
39
  }
30
40
  });
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "94.7.0";
20
+ var packageVersion = "94.8.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -11,6 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _analytics = require("../analytics");
14
+ var _isSsr = require("../core-utils/is-ssr");
14
15
  var _ErrorBoundary = require("../ui/ErrorBoundary");
15
16
  var _utils = require("../utils");
16
17
  var _whitespace = require("../whitespace");
@@ -139,6 +140,10 @@ function createNodeView(_ref) {
139
140
  * @param node The Prosemirror Node from which to source the attributes
140
141
  */
141
142
  function setDomAttrs(node, element) {
143
+ // prevent potential XSS attacks since attributes may contain user input
144
+ if ((0, _isSsr.isSSR)()) {
145
+ return;
146
+ }
142
147
  Object.keys(node.attrs || {}).forEach(function (attr) {
143
148
  element.setAttribute(attr, node.attrs[attr]);
144
149
  });
@@ -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 = "94.7.0";
27
+ var packageVersion = "94.8.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
13
  var _react = _interopRequireWildcard(require("react"));
12
14
  var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
13
15
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
14
16
  var _Pulse = require("../Pulse/Pulse");
17
+ var _ButtonSpotlightCard = require("./ButtonSpotlightCard");
15
18
  var _styles = require("./styles");
16
19
  var _excluded = ["buttonStyles"];
17
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -29,6 +32,7 @@ var _default = exports.default = function _default(_ref) {
29
32
  onFocus = _ref.onFocus,
30
33
  onBlur = _ref.onBlur,
31
34
  onMount = _ref.onMount,
35
+ onUnmount = _ref.onUnmount,
32
36
  selected = _ref.selected,
33
37
  disabled = _ref.disabled,
34
38
  href = _ref.href,
@@ -47,20 +51,32 @@ var _default = exports.default = function _default(_ref) {
47
51
  areaControls = _ref.areaControls,
48
52
  ariaLabel = _ref.ariaLabel,
49
53
  isRadioButton = _ref.isRadioButton,
50
- pulse = _ref.pulse;
54
+ pulse = _ref.pulse,
55
+ spotlightConfig = _ref.spotlightConfig;
51
56
  // Check if there's only an icon and add additional styles
52
57
  var iconOnly = (icon || iconAfter) && !children;
53
58
  var customSpacing = iconOnly ? _styles.iconOnlySpacing : {};
54
59
  var isButtonPressed = ariaHasPopup ? undefined : selected;
55
60
  var ariaChecked = isRadioButton ? isButtonPressed : undefined;
56
61
  var ariaPressed = isRadioButton ? undefined : isButtonPressed;
62
+ var _useState = (0, _react.useState)(null),
63
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
+ spotlightReferenceElement = _useState2[0],
65
+ setSpotlightReferenceElement = _useState2[1];
57
66
  (0, _react.useEffect)(function () {
58
- if (onMount) {
59
- onMount();
60
- }
67
+ onMount === null || onMount === void 0 || onMount();
68
+ return function () {
69
+ return onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
70
+ };
61
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
62
72
  }, []);
63
- return /*#__PURE__*/_react.default.createElement(_tooltip.default
73
+ var onSpotlightTargetClick = spotlightConfig !== null && spotlightConfig !== void 0 && spotlightConfig.isSpotlightOpen ? spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.onTargetClick : undefined;
74
+ var handleOnClick = (0, _react.useCallback)(function (event) {
75
+ // fire the spotlight onTargetClick callback if a spotlight is rendered and callback is provided
76
+ onSpotlightTargetClick === null || onSpotlightTargetClick === void 0 || onSpotlightTargetClick();
77
+ onClick === null || onClick === void 0 || onClick(event);
78
+ }, [onClick, onSpotlightTargetClick]);
79
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_tooltip.default
64
80
  // Only fallback to title for tooltip if title is not shown
65
81
  , {
66
82
  content: tooltipContent || (iconOnly ? title : undefined),
@@ -71,11 +87,14 @@ var _default = exports.default = function _default(_ref) {
71
87
  onMouseEnter: onMouseEnter,
72
88
  onMouseLeave: onMouseLeave
73
89
  }, /*#__PURE__*/_react.default.createElement(_Pulse.Pulse, {
74
- pulse: pulse
90
+ pulse: pulse || (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.pulse)
75
91
  }, /*#__PURE__*/_react.default.createElement(_customThemeButton.default
76
92
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
77
93
  , {
78
94
  className: className,
95
+ ref: function ref(buttonElement) {
96
+ return setSpotlightReferenceElement(buttonElement);
97
+ },
79
98
  theme: function theme(adgTheme, themeProps) {
80
99
  var _adgTheme = adgTheme(themeProps),
81
100
  buttonStyles = _adgTheme.buttonStyles,
@@ -101,7 +120,7 @@ var _default = exports.default = function _default(_ref) {
101
120
  "aria-haspopup": ariaHasPopup,
102
121
  iconBefore: icon || undefined,
103
122
  iconAfter: iconAfter,
104
- onClick: onClick,
123
+ onClick: handleOnClick,
105
124
  onKeyDown: onKeyDown,
106
125
  isSelected: selected,
107
126
  isDisabled: disabled,
@@ -114,5 +133,7 @@ var _default = exports.default = function _default(_ref) {
114
133
  // should be fixed here https://a11y-internal.atlassian.net/browse/DST-287
115
134
  ,
116
135
  tabIndex: tabIndex
117
- }, children))));
136
+ }, children)))), (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.isSpotlightOpen) && spotlightReferenceElement && /*#__PURE__*/_react.default.createElement(_ButtonSpotlightCard.ButtonSpotlightCard, (0, _extends2.default)({
137
+ referenceElement: spotlightReferenceElement
138
+ }, spotlightConfig.spotlightCardOptions)));
118
139
  };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ButtonSpotlightCard = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _onboarding = require("@atlaskit/onboarding");
11
+ var _popper = require("@atlaskit/popper");
12
+ var _excluded = ["referenceElement", "placement"];
13
+ /*
14
+ * ButtonSpotlightCard is an editor custom spotlight that renders next to a floating toolbar button.
15
+ * It is built on top of the SpotlightCard component from @atlaskit/onboarding.
16
+ * It avoids the issue of the native atlaskit Spotlight component rendering outside the editor bounds and takes focus away from the editor.
17
+ */
18
+ var ButtonSpotlightCard = exports.ButtonSpotlightCard = function ButtonSpotlightCard(props) {
19
+ var referenceElement = props.referenceElement,
20
+ _props$placement = props.placement,
21
+ placement = _props$placement === void 0 ? 'top-start' : _props$placement,
22
+ spotlightCardProps = (0, _objectWithoutProperties2.default)(props, _excluded);
23
+ return /*#__PURE__*/_react.default.createElement(_popper.Popper, {
24
+ referenceElement: referenceElement,
25
+ placement: placement,
26
+ strategy: "absolute"
27
+ }, function (_ref) {
28
+ var ref = _ref.ref,
29
+ style = _ref.style;
30
+ return (
31
+ /*#__PURE__*/
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
33
+ _react.default.createElement("div", {
34
+ ref: ref,
35
+ style: style
36
+ }, /*#__PURE__*/_react.default.createElement(_onboarding.SpotlightCard, spotlightCardProps))
37
+ );
38
+ });
39
+ };
@@ -182,11 +182,8 @@ var DropdownMenuWrapper = exports.default = /*#__PURE__*/function (_PureComponen
182
182
  closeOnTab: true
183
183
  }), (0, _react2.jsx)(DropListWithOutsideListeners, {
184
184
  isOpen: true,
185
- appearance: "tall",
186
185
  position: popupPlacement.join(' '),
187
- shouldFlip: false,
188
186
  shouldFitContainer: true,
189
- isTriggerNotTabbable: true,
190
187
  handleClickOutside: this.handleClose,
191
188
  handleEscapeKeydown: handleEscapeKeydown || this.handleCloseAndFocus,
192
189
  handleEnterKeydown: function handleEnterKeydown(e) {
@@ -20,5 +20,15 @@ export const annotationMessages = defineMessages({
20
20
  id: 'fabric.editor.annotationToolbar',
21
21
  defaultMessage: 'Annotation toolbar',
22
22
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
23
+ },
24
+ createCommentOnInlineNodeSpotlightBody: {
25
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.body',
26
+ defaultMessage: 'You can now leave comments on inline elements like links, dates, statuses and mentions.',
27
+ description: 'The body content of the spotlight message that appears when the user can leave comments on inline nodes'
28
+ },
29
+ createCommentOnInlineNodeSpotlightAction: {
30
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.action',
31
+ defaultMessage: 'Got it',
32
+ description: 'The content of the action button that closes the spotlight'
23
33
  }
24
34
  });
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "94.7.0";
4
+ const packageVersion = "94.8.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -8,6 +8,7 @@ import React from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
10
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
11
+ import { isSSR } from '../core-utils/is-ssr';
11
12
  import { ErrorBoundary } from '../ui/ErrorBoundary';
12
13
  import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
13
14
  import { ZERO_WIDTH_SPACE } from '../whitespace';
@@ -134,6 +135,10 @@ function createNodeView({
134
135
  * @param node The Prosemirror Node from which to source the attributes
135
136
  */
136
137
  function setDomAttrs(node, element) {
138
+ // prevent potential XSS attacks since attributes may contain user input
139
+ if (isSSR()) {
140
+ return;
141
+ }
137
142
  Object.keys(node.attrs || {}).forEach(attr => {
138
143
  element.setAttribute(attr, node.attrs[attr]);
139
144
  });
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "94.7.0";
16
+ const packageVersion = "94.8.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,7 +1,9 @@
1
- import React, { useEffect } from 'react';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback, useEffect, useState } from 'react';
2
3
  import Button from '@atlaskit/button/custom-theme-button';
3
4
  import Tooltip from '@atlaskit/tooltip';
4
5
  import { Pulse } from '../Pulse/Pulse';
6
+ import { ButtonSpotlightCard } from './ButtonSpotlightCard';
5
7
  import { getButtonStyles, iconOnlySpacing } from './styles';
6
8
  export default (({
7
9
  title,
@@ -14,6 +16,7 @@ export default (({
14
16
  onFocus,
15
17
  onBlur,
16
18
  onMount,
19
+ onUnmount,
17
20
  selected,
18
21
  disabled,
19
22
  href,
@@ -30,7 +33,8 @@ export default (({
30
33
  areaControls,
31
34
  ariaLabel,
32
35
  isRadioButton,
33
- pulse
36
+ pulse,
37
+ spotlightConfig
34
38
  }) => {
35
39
  // Check if there's only an icon and add additional styles
36
40
  const iconOnly = (icon || iconAfter) && !children;
@@ -38,13 +42,19 @@ export default (({
38
42
  const isButtonPressed = ariaHasPopup ? undefined : selected;
39
43
  const ariaChecked = isRadioButton ? isButtonPressed : undefined;
40
44
  const ariaPressed = isRadioButton ? undefined : isButtonPressed;
45
+ const [spotlightReferenceElement, setSpotlightReferenceElement] = useState(null);
41
46
  useEffect(() => {
42
- if (onMount) {
43
- onMount();
44
- }
47
+ onMount === null || onMount === void 0 ? void 0 : onMount();
48
+ return () => onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
45
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
46
50
  }, []);
47
- return /*#__PURE__*/React.createElement(Tooltip
51
+ const onSpotlightTargetClick = spotlightConfig !== null && spotlightConfig !== void 0 && spotlightConfig.isSpotlightOpen ? spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.onTargetClick : undefined;
52
+ const handleOnClick = useCallback(event => {
53
+ // fire the spotlight onTargetClick callback if a spotlight is rendered and callback is provided
54
+ onSpotlightTargetClick === null || onSpotlightTargetClick === void 0 ? void 0 : onSpotlightTargetClick();
55
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
56
+ }, [onClick, onSpotlightTargetClick]);
57
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip
48
58
  // Only fallback to title for tooltip if title is not shown
49
59
  , {
50
60
  content: tooltipContent || (iconOnly ? title : undefined),
@@ -55,11 +65,12 @@ export default (({
55
65
  onMouseEnter: onMouseEnter,
56
66
  onMouseLeave: onMouseLeave
57
67
  }, /*#__PURE__*/React.createElement(Pulse, {
58
- pulse: pulse
68
+ pulse: pulse || (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.pulse)
59
69
  }, /*#__PURE__*/React.createElement(Button
60
70
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
61
71
  , {
62
72
  className: className,
73
+ ref: buttonElement => setSpotlightReferenceElement(buttonElement),
63
74
  theme: (adgTheme, themeProps) => {
64
75
  const {
65
76
  buttonStyles,
@@ -91,7 +102,7 @@ export default (({
91
102
  "aria-haspopup": ariaHasPopup,
92
103
  iconBefore: icon || undefined,
93
104
  iconAfter: iconAfter,
94
- onClick: onClick,
105
+ onClick: handleOnClick,
95
106
  onKeyDown: onKeyDown,
96
107
  isSelected: selected,
97
108
  isDisabled: disabled,
@@ -104,5 +115,7 @@ export default (({
104
115
  // should be fixed here https://a11y-internal.atlassian.net/browse/DST-287
105
116
  ,
106
117
  tabIndex: tabIndex
107
- }, children))));
118
+ }, children)))), (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.isSpotlightOpen) && spotlightReferenceElement && /*#__PURE__*/React.createElement(ButtonSpotlightCard, _extends({
119
+ referenceElement: spotlightReferenceElement
120
+ }, spotlightConfig.spotlightCardOptions)));
108
121
  });
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { SpotlightCard } from '@atlaskit/onboarding';
3
+ import { Popper } from '@atlaskit/popper';
4
+ /*
5
+ * ButtonSpotlightCard is an editor custom spotlight that renders next to a floating toolbar button.
6
+ * It is built on top of the SpotlightCard component from @atlaskit/onboarding.
7
+ * It avoids the issue of the native atlaskit Spotlight component rendering outside the editor bounds and takes focus away from the editor.
8
+ */
9
+ export const ButtonSpotlightCard = props => {
10
+ const {
11
+ referenceElement,
12
+ placement = 'top-start',
13
+ ...spotlightCardProps
14
+ } = props;
15
+ return /*#__PURE__*/React.createElement(Popper, {
16
+ referenceElement: referenceElement,
17
+ placement: placement,
18
+ strategy: "absolute"
19
+ }, ({
20
+ ref,
21
+ style
22
+ }) =>
23
+ /*#__PURE__*/
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
25
+ React.createElement("div", {
26
+ ref: ref,
27
+ style: style
28
+ }, /*#__PURE__*/React.createElement(SpotlightCard, spotlightCardProps)));
29
+ };
@@ -184,11 +184,8 @@ export default class DropdownMenuWrapper extends PureComponent {
184
184
  closeOnTab: true
185
185
  }), jsx(DropListWithOutsideListeners, {
186
186
  isOpen: true,
187
- appearance: "tall",
188
187
  position: popupPlacement.join(' '),
189
- shouldFlip: false,
190
188
  shouldFitContainer: true,
191
- isTriggerNotTabbable: true,
192
189
  handleClickOutside: this.handleClose,
193
190
  handleEscapeKeydown: handleEscapeKeydown || this.handleCloseAndFocus,
194
191
  handleEnterKeydown: e => {
@@ -20,5 +20,15 @@ export var annotationMessages = defineMessages({
20
20
  id: 'fabric.editor.annotationToolbar',
21
21
  defaultMessage: 'Annotation toolbar',
22
22
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
23
+ },
24
+ createCommentOnInlineNodeSpotlightBody: {
25
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.body',
26
+ defaultMessage: 'You can now leave comments on inline elements like links, dates, statuses and mentions.',
27
+ description: 'The body content of the spotlight message that appears when the user can leave comments on inline nodes'
28
+ },
29
+ createCommentOnInlineNodeSpotlightAction: {
30
+ id: 'fabric.editor.createCommentOnInlineNodeSpotlight.action',
31
+ defaultMessage: 'Got it',
32
+ description: 'The content of the action button that closes the spotlight'
23
33
  }
24
34
  });
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.7.0";
10
+ var packageVersion = "94.8.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -11,6 +11,7 @@ import React from 'react';
11
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
12
  import { jsx } from '@emotion/react';
13
13
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
14
+ import { isSSR } from '../core-utils/is-ssr';
14
15
  import { ErrorBoundary } from '../ui/ErrorBoundary';
15
16
  import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
16
17
  import { ZERO_WIDTH_SPACE } from '../whitespace';
@@ -134,6 +135,10 @@ function createNodeView(_ref) {
134
135
  * @param node The Prosemirror Node from which to source the attributes
135
136
  */
136
137
  function setDomAttrs(node, element) {
138
+ // prevent potential XSS attacks since attributes may contain user input
139
+ if (isSSR()) {
140
+ return;
141
+ }
137
142
  Object.keys(node.attrs || {}).forEach(function (attr) {
138
143
  element.setAttribute(attr, node.attrs[attr]);
139
144
  });
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.7.0";
24
+ var packageVersion = "94.8.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,12 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
5
  var _excluded = ["buttonStyles"];
4
6
  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; }
5
7
  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; }
6
- import React, { useEffect } from 'react';
8
+ import React, { useCallback, useEffect, useState } from 'react';
7
9
  import Button from '@atlaskit/button/custom-theme-button';
8
10
  import Tooltip from '@atlaskit/tooltip';
9
11
  import { Pulse } from '../Pulse/Pulse';
12
+ import { ButtonSpotlightCard } from './ButtonSpotlightCard';
10
13
  import { getButtonStyles, iconOnlySpacing } from './styles';
11
14
  export default (function (_ref) {
12
15
  var title = _ref.title,
@@ -19,6 +22,7 @@ export default (function (_ref) {
19
22
  onFocus = _ref.onFocus,
20
23
  onBlur = _ref.onBlur,
21
24
  onMount = _ref.onMount,
25
+ onUnmount = _ref.onUnmount,
22
26
  selected = _ref.selected,
23
27
  disabled = _ref.disabled,
24
28
  href = _ref.href,
@@ -37,20 +41,32 @@ export default (function (_ref) {
37
41
  areaControls = _ref.areaControls,
38
42
  ariaLabel = _ref.ariaLabel,
39
43
  isRadioButton = _ref.isRadioButton,
40
- pulse = _ref.pulse;
44
+ pulse = _ref.pulse,
45
+ spotlightConfig = _ref.spotlightConfig;
41
46
  // Check if there's only an icon and add additional styles
42
47
  var iconOnly = (icon || iconAfter) && !children;
43
48
  var customSpacing = iconOnly ? iconOnlySpacing : {};
44
49
  var isButtonPressed = ariaHasPopup ? undefined : selected;
45
50
  var ariaChecked = isRadioButton ? isButtonPressed : undefined;
46
51
  var ariaPressed = isRadioButton ? undefined : isButtonPressed;
52
+ var _useState = useState(null),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ spotlightReferenceElement = _useState2[0],
55
+ setSpotlightReferenceElement = _useState2[1];
47
56
  useEffect(function () {
48
- if (onMount) {
49
- onMount();
50
- }
57
+ onMount === null || onMount === void 0 || onMount();
58
+ return function () {
59
+ return onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
60
+ };
51
61
  // eslint-disable-next-line react-hooks/exhaustive-deps
52
62
  }, []);
53
- return /*#__PURE__*/React.createElement(Tooltip
63
+ var onSpotlightTargetClick = spotlightConfig !== null && spotlightConfig !== void 0 && spotlightConfig.isSpotlightOpen ? spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.onTargetClick : undefined;
64
+ var handleOnClick = useCallback(function (event) {
65
+ // fire the spotlight onTargetClick callback if a spotlight is rendered and callback is provided
66
+ onSpotlightTargetClick === null || onSpotlightTargetClick === void 0 || onSpotlightTargetClick();
67
+ onClick === null || onClick === void 0 || onClick(event);
68
+ }, [onClick, onSpotlightTargetClick]);
69
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip
54
70
  // Only fallback to title for tooltip if title is not shown
55
71
  , {
56
72
  content: tooltipContent || (iconOnly ? title : undefined),
@@ -61,11 +77,14 @@ export default (function (_ref) {
61
77
  onMouseEnter: onMouseEnter,
62
78
  onMouseLeave: onMouseLeave
63
79
  }, /*#__PURE__*/React.createElement(Pulse, {
64
- pulse: pulse
80
+ pulse: pulse || (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.pulse)
65
81
  }, /*#__PURE__*/React.createElement(Button
66
82
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
67
83
  , {
68
84
  className: className,
85
+ ref: function ref(buttonElement) {
86
+ return setSpotlightReferenceElement(buttonElement);
87
+ },
69
88
  theme: function theme(adgTheme, themeProps) {
70
89
  var _adgTheme = adgTheme(themeProps),
71
90
  buttonStyles = _adgTheme.buttonStyles,
@@ -91,7 +110,7 @@ export default (function (_ref) {
91
110
  "aria-haspopup": ariaHasPopup,
92
111
  iconBefore: icon || undefined,
93
112
  iconAfter: iconAfter,
94
- onClick: onClick,
113
+ onClick: handleOnClick,
95
114
  onKeyDown: onKeyDown,
96
115
  isSelected: selected,
97
116
  isDisabled: disabled,
@@ -104,5 +123,7 @@ export default (function (_ref) {
104
123
  // should be fixed here https://a11y-internal.atlassian.net/browse/DST-287
105
124
  ,
106
125
  tabIndex: tabIndex
107
- }, children))));
126
+ }, children)))), (spotlightConfig === null || spotlightConfig === void 0 ? void 0 : spotlightConfig.isSpotlightOpen) && spotlightReferenceElement && /*#__PURE__*/React.createElement(ButtonSpotlightCard, _extends({
127
+ referenceElement: spotlightReferenceElement
128
+ }, spotlightConfig.spotlightCardOptions)));
108
129
  });
@@ -0,0 +1,32 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["referenceElement", "placement"];
3
+ import React from 'react';
4
+ import { SpotlightCard } from '@atlaskit/onboarding';
5
+ import { Popper } from '@atlaskit/popper';
6
+ /*
7
+ * ButtonSpotlightCard is an editor custom spotlight that renders next to a floating toolbar button.
8
+ * It is built on top of the SpotlightCard component from @atlaskit/onboarding.
9
+ * It avoids the issue of the native atlaskit Spotlight component rendering outside the editor bounds and takes focus away from the editor.
10
+ */
11
+ export var ButtonSpotlightCard = function ButtonSpotlightCard(props) {
12
+ var referenceElement = props.referenceElement,
13
+ _props$placement = props.placement,
14
+ placement = _props$placement === void 0 ? 'top-start' : _props$placement,
15
+ spotlightCardProps = _objectWithoutProperties(props, _excluded);
16
+ return /*#__PURE__*/React.createElement(Popper, {
17
+ referenceElement: referenceElement,
18
+ placement: placement,
19
+ strategy: "absolute"
20
+ }, function (_ref) {
21
+ var ref = _ref.ref,
22
+ style = _ref.style;
23
+ return (
24
+ /*#__PURE__*/
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
26
+ React.createElement("div", {
27
+ ref: ref,
28
+ style: style
29
+ }, /*#__PURE__*/React.createElement(SpotlightCard, spotlightCardProps))
30
+ );
31
+ });
32
+ };
@@ -171,11 +171,8 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
171
171
  closeOnTab: true
172
172
  }), jsx(DropListWithOutsideListeners, {
173
173
  isOpen: true,
174
- appearance: "tall",
175
174
  position: popupPlacement.join(' '),
176
- shouldFlip: false,
177
175
  shouldFitContainer: true,
178
- isTriggerNotTabbable: true,
179
176
  handleClickOutside: this.handleClose,
180
177
  handleEscapeKeydown: handleEscapeKeydown || this.handleCloseAndFocus,
181
178
  handleEnterKeydown: function handleEnterKeydown(e) {
@@ -19,4 +19,14 @@ export declare const annotationMessages: {
19
19
  defaultMessage: string;
20
20
  description: string;
21
21
  };
22
+ createCommentOnInlineNodeSpotlightBody: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ createCommentOnInlineNodeSpotlightAction: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
22
32
  };
@@ -4,6 +4,8 @@ import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { EmojiId } from '@atlaskit/emoji/types';
7
+ import type { SpotlightCard } from '@atlaskit/onboarding';
8
+ import type { Placement } from '@atlaskit/popper';
7
9
  import type { TooltipProps } from '@atlaskit/tooltip';
8
10
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
9
11
  import type { ProviderFactory } from '../provider-factory';
@@ -94,6 +96,14 @@ export type ConfirmationDialogProps = {
94
96
  options?: ConfirmDialogOptions;
95
97
  testId?: string;
96
98
  };
99
+ export type FloatingToolbarButtonSpotlightConfig = {
100
+ isSpotlightOpen: boolean;
101
+ pulse?: boolean;
102
+ onTargetClick?: () => void;
103
+ spotlightCardOptions: React.ComponentProps<typeof SpotlightCard> & {
104
+ placement?: Placement;
105
+ };
106
+ };
97
107
  export type FloatingToolbarCopyButton = {
98
108
  type: 'copy-button';
99
109
  items: Array<FloatingToolbarSeparator | MarkOptions | NodeOptions>;
@@ -112,6 +122,7 @@ export type FloatingToolbarButton<T extends {}> = {
112
122
  onFocus?: T;
113
123
  onBlur?: T;
114
124
  onMount?: () => void;
125
+ onUnmount?: () => void;
115
126
  icon?: Icon;
116
127
  iconFallback?: Icon;
117
128
  selected?: boolean;
@@ -134,6 +145,7 @@ export type FloatingToolbarButton<T extends {}> = {
134
145
  supportsViewMode?: boolean;
135
146
  /** If true, the component will have pulse onboarding effect around it. */
136
147
  pulse?: boolean;
148
+ spotlightConfig?: FloatingToolbarButtonSpotlightConfig;
137
149
  };
138
150
  export type FloatingToolbarInput<T extends {}> = {
139
151
  id: string;
@@ -12,7 +12,7 @@ export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags } from './feat
12
12
  export type { Browsers, Range, DisableSpellcheckByBrowser } from './supported-browsers';
13
13
  export type { EditorContainerWidth, GetEditorContainerWidth } from './editor-container-width';
14
14
  export type { EmptyStateHandler, EmptyStateHandlerParams } from './empty-state-handler';
15
- export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, } from './floating-toolbar';
15
+ export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, FloatingToolbarButtonSpotlightConfig, } from './floating-toolbar';
16
16
  export type { MarkOptions, NodeOptions } from './copy-button';
17
17
  export type { ContextPanelHandler } from './context-panel';
18
18
  export type { EditorAppearance } from './editor-appearance';
@@ -6,9 +6,6 @@ import type { ReactNode } from 'react';
6
6
  import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
7
7
  export interface Props extends WithAnalyticsEventsProps {
8
8
  isOpen?: boolean;
9
- appearance?: string;
10
- shouldFlip?: boolean;
11
- isTriggerNotTabbable?: boolean;
12
9
  trigger?: React.ReactNode;
13
10
  position: string;
14
11
  onOpenChange?: (event: OpenChangedEvent) => void;
@@ -23,5 +20,5 @@ export type OpenChangedEvent = {
23
20
  isOpen: boolean;
24
21
  event: MouseEvent | KeyboardEvent;
25
22
  };
26
- declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "appearance" | "position" | "key" | "id" | "children" | "testId" | "analyticsContext" | "shouldFitContainer" | "onPositioned" | "isOpen" | "shouldFlip" | "isTriggerNotTabbable" | "trigger" | "onOpenChange" | "onDroplistRef"> & import("react").RefAttributes<any>>;
23
+ declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "position" | "key" | "id" | "children" | "testId" | "analyticsContext" | "shouldFitContainer" | "onPositioned" | "isOpen" | "trigger" | "onOpenChange" | "onDroplistRef"> & import("react").RefAttributes<any>>;
27
24
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type TooltipProps } from '@atlaskit/tooltip';
3
3
  import type { ButtonAppearance } from '../../types';
4
+ import type { FloatingToolbarButtonSpotlightConfig } from '../../types/floating-toolbar';
4
5
  export type { ButtonAppearance };
5
6
  export interface Props {
6
7
  title?: string;
@@ -13,6 +14,7 @@ export interface Props {
13
14
  onFocus?: <T>(event: React.FocusEvent<T>) => void;
14
15
  onBlur?: <T>(event: React.FocusEvent<T>) => void;
15
16
  onMount?: () => void;
17
+ onUnmount?: () => void;
16
18
  selected?: boolean;
17
19
  disabled?: boolean;
18
20
  appearance?: ButtonAppearance;
@@ -31,6 +33,7 @@ export interface Props {
31
33
  isRadioButton?: boolean;
32
34
  /** If true, the component will have pulse onboarding effect around it. */
33
35
  pulse?: boolean;
36
+ spotlightConfig?: FloatingToolbarButtonSpotlightConfig;
34
37
  }
35
- declare const _default: ({ title, icon, iconAfter, onClick, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onMount, selected, disabled, href, target, appearance, children, className, tooltipContent, tooltipStyle, testId, hideTooltipOnClick, ariaHasPopup, tabIndex, areaControls, ariaLabel, isRadioButton, pulse, }: Props) => JSX.Element;
38
+ declare const _default: ({ title, icon, iconAfter, onClick, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onMount, onUnmount, selected, disabled, href, target, appearance, children, className, tooltipContent, tooltipStyle, testId, hideTooltipOnClick, ariaHasPopup, tabIndex, areaControls, ariaLabel, isRadioButton, pulse, spotlightConfig, }: Props) => JSX.Element;
36
39
  export default _default;
@@ -0,0 +1,10 @@
1
+ import { type ComponentProps } from 'react';
2
+ import { SpotlightCard } from '@atlaskit/onboarding';
3
+ import { type Placement } from '@atlaskit/popper';
4
+ type PropsFromSpotlightCard = ComponentProps<typeof SpotlightCard>;
5
+ export type ButtonSpotlightCardProps = PropsFromSpotlightCard & {
6
+ referenceElement: HTMLElement;
7
+ placement?: Placement;
8
+ };
9
+ export declare const ButtonSpotlightCard: (props: ButtonSpotlightCardProps) => JSX.Element;
10
+ export {};
@@ -19,4 +19,14 @@ export declare const annotationMessages: {
19
19
  defaultMessage: string;
20
20
  description: string;
21
21
  };
22
+ createCommentOnInlineNodeSpotlightBody: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ createCommentOnInlineNodeSpotlightAction: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
22
32
  };
@@ -4,6 +4,8 @@ import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { EmojiId } from '@atlaskit/emoji/types';
7
+ import type { SpotlightCard } from '@atlaskit/onboarding';
8
+ import type { Placement } from '@atlaskit/popper';
7
9
  import type { TooltipProps } from '@atlaskit/tooltip';
8
10
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
9
11
  import type { ProviderFactory } from '../provider-factory';
@@ -94,6 +96,14 @@ export type ConfirmationDialogProps = {
94
96
  options?: ConfirmDialogOptions;
95
97
  testId?: string;
96
98
  };
99
+ export type FloatingToolbarButtonSpotlightConfig = {
100
+ isSpotlightOpen: boolean;
101
+ pulse?: boolean;
102
+ onTargetClick?: () => void;
103
+ spotlightCardOptions: React.ComponentProps<typeof SpotlightCard> & {
104
+ placement?: Placement;
105
+ };
106
+ };
97
107
  export type FloatingToolbarCopyButton = {
98
108
  type: 'copy-button';
99
109
  items: Array<FloatingToolbarSeparator | MarkOptions | NodeOptions>;
@@ -112,6 +122,7 @@ export type FloatingToolbarButton<T extends {}> = {
112
122
  onFocus?: T;
113
123
  onBlur?: T;
114
124
  onMount?: () => void;
125
+ onUnmount?: () => void;
115
126
  icon?: Icon;
116
127
  iconFallback?: Icon;
117
128
  selected?: boolean;
@@ -134,6 +145,7 @@ export type FloatingToolbarButton<T extends {}> = {
134
145
  supportsViewMode?: boolean;
135
146
  /** If true, the component will have pulse onboarding effect around it. */
136
147
  pulse?: boolean;
148
+ spotlightConfig?: FloatingToolbarButtonSpotlightConfig;
137
149
  };
138
150
  export type FloatingToolbarInput<T extends {}> = {
139
151
  id: string;
@@ -12,7 +12,7 @@ export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags } from './feat
12
12
  export type { Browsers, Range, DisableSpellcheckByBrowser } from './supported-browsers';
13
13
  export type { EditorContainerWidth, GetEditorContainerWidth } from './editor-container-width';
14
14
  export type { EmptyStateHandler, EmptyStateHandlerParams } from './empty-state-handler';
15
- export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, } from './floating-toolbar';
15
+ export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, FloatingToolbarButtonSpotlightConfig, } from './floating-toolbar';
16
16
  export type { MarkOptions, NodeOptions } from './copy-button';
17
17
  export type { ContextPanelHandler } from './context-panel';
18
18
  export type { EditorAppearance } from './editor-appearance';
@@ -6,9 +6,6 @@ import type { ReactNode } from 'react';
6
6
  import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
7
7
  export interface Props extends WithAnalyticsEventsProps {
8
8
  isOpen?: boolean;
9
- appearance?: string;
10
- shouldFlip?: boolean;
11
- isTriggerNotTabbable?: boolean;
12
9
  trigger?: React.ReactNode;
13
10
  position: string;
14
11
  onOpenChange?: (event: OpenChangedEvent) => void;
@@ -23,5 +20,5 @@ export type OpenChangedEvent = {
23
20
  isOpen: boolean;
24
21
  event: MouseEvent | KeyboardEvent;
25
22
  };
26
- declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "appearance" | "position" | "key" | "id" | "children" | "testId" | "analyticsContext" | "shouldFitContainer" | "onPositioned" | "isOpen" | "shouldFlip" | "isTriggerNotTabbable" | "trigger" | "onOpenChange" | "onDroplistRef"> & import("react").RefAttributes<any>>;
23
+ declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "position" | "key" | "id" | "children" | "testId" | "analyticsContext" | "shouldFitContainer" | "onPositioned" | "isOpen" | "trigger" | "onOpenChange" | "onDroplistRef"> & import("react").RefAttributes<any>>;
27
24
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type TooltipProps } from '@atlaskit/tooltip';
3
3
  import type { ButtonAppearance } from '../../types';
4
+ import type { FloatingToolbarButtonSpotlightConfig } from '../../types/floating-toolbar';
4
5
  export type { ButtonAppearance };
5
6
  export interface Props {
6
7
  title?: string;
@@ -13,6 +14,7 @@ export interface Props {
13
14
  onFocus?: <T>(event: React.FocusEvent<T>) => void;
14
15
  onBlur?: <T>(event: React.FocusEvent<T>) => void;
15
16
  onMount?: () => void;
17
+ onUnmount?: () => void;
16
18
  selected?: boolean;
17
19
  disabled?: boolean;
18
20
  appearance?: ButtonAppearance;
@@ -31,6 +33,7 @@ export interface Props {
31
33
  isRadioButton?: boolean;
32
34
  /** If true, the component will have pulse onboarding effect around it. */
33
35
  pulse?: boolean;
36
+ spotlightConfig?: FloatingToolbarButtonSpotlightConfig;
34
37
  }
35
- declare const _default: ({ title, icon, iconAfter, onClick, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onMount, selected, disabled, href, target, appearance, children, className, tooltipContent, tooltipStyle, testId, hideTooltipOnClick, ariaHasPopup, tabIndex, areaControls, ariaLabel, isRadioButton, pulse, }: Props) => JSX.Element;
38
+ declare const _default: ({ title, icon, iconAfter, onClick, onKeyDown, onMouseEnter, onMouseLeave, onFocus, onBlur, onMount, onUnmount, selected, disabled, href, target, appearance, children, className, tooltipContent, tooltipStyle, testId, hideTooltipOnClick, ariaHasPopup, tabIndex, areaControls, ariaLabel, isRadioButton, pulse, spotlightConfig, }: Props) => JSX.Element;
36
39
  export default _default;
@@ -0,0 +1,10 @@
1
+ import { type ComponentProps } from 'react';
2
+ import { SpotlightCard } from '@atlaskit/onboarding';
3
+ import { type Placement } from '@atlaskit/popper';
4
+ type PropsFromSpotlightCard = ComponentProps<typeof SpotlightCard>;
5
+ export type ButtonSpotlightCardProps = PropsFromSpotlightCard & {
6
+ referenceElement: HTMLElement;
7
+ placement?: Placement;
8
+ };
9
+ export declare const ButtonSpotlightCard: (props: ButtonSpotlightCardProps) => JSX.Element;
10
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "94.7.0",
3
+ "version": "94.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/"
@@ -135,13 +135,14 @@
135
135
  "@atlaskit/media-client-react": "^2.2.0",
136
136
  "@atlaskit/media-common": "^11.7.0",
137
137
  "@atlaskit/media-file-preview": "^0.9.0",
138
- "@atlaskit/media-picker": "^66.7.0",
138
+ "@atlaskit/media-picker": "^67.0.0",
139
139
  "@atlaskit/media-ui": "^26.0.0",
140
140
  "@atlaskit/media-viewer": "49.2.3",
141
141
  "@atlaskit/mention": "^23.3.0",
142
142
  "@atlaskit/menu": "^2.13.0",
143
143
  "@atlaskit/onboarding": "^11.16.0",
144
144
  "@atlaskit/platform-feature-flags": "^0.3.0",
145
+ "@atlaskit/popper": "^6.3.0",
145
146
  "@atlaskit/primitives": "^12.2.0",
146
147
  "@atlaskit/profilecard": "^20.8.0",
147
148
  "@atlaskit/section-message": "^6.6.0",