@atlaskit/renderer 118.2.0 → 118.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 118.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#160385](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160385)
8
+ [`48d95956a007a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/48d95956a007a) -
9
+ EDITOR-788 - Renderer comment creation process is broken
10
+ - Updated dependencies
11
+
12
+ ## 118.2.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#158353](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158353)
17
+ [`f2bde4220539c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2bde4220539c) -
18
+ Fix smart card avatar override with padding and margin
19
+ - [#148691](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148691)
20
+ [`8c8fad20db912`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c8fad20db912) -
21
+ Cleanup FG platform_editor_accessible_heading_copy_link
22
+ - Updated dependencies
23
+
3
24
  ## 118.2.0
4
25
 
5
26
  ### Minor Changes
@@ -59,6 +59,9 @@
59
59
  {
60
60
  "path": "../../../design-system/icon/afm-jira/tsconfig.json"
61
61
  },
62
+ {
63
+ "path": "../../../design-system/link/afm-jira/tsconfig.json"
64
+ },
62
65
  {
63
66
  "path": "../../../linking-platform/link-datasource/afm-jira/tsconfig.json"
64
67
  },
@@ -17,11 +17,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
17
17
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
18
18
  var _react = _interopRequireDefault(require("react"));
19
19
  var _react2 = require("@emotion/react");
20
- var _colors = require("@atlaskit/theme/colors");
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
+ var _reactIntlNext = require("react-intl-next");
22
21
  var _link = _interopRequireDefault(require("@atlaskit/icon/core/migration/link"));
23
22
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
24
- var _reactIntlNext = require("react-intl-next");
25
23
  var _messages = require("../../messages");
26
24
  var _excluded = ["children"];
27
25
  /**
@@ -46,7 +44,7 @@ var copyAnchorButtonStyles = (0, _react2.css)({
46
44
  outline: 'none',
47
45
  backgroundColor: 'transparent',
48
46
  border: 'none',
49
- color: "var(--ds-icon, ".concat(_colors.N500, ")"),
47
+ color: "var(--ds-icon, #44546F)",
50
48
  cursor: 'pointer',
51
49
  right: 0
52
50
  });
@@ -121,12 +119,12 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
121
119
  "aria-hidden": hideFromScreenReader,
122
120
  tabIndex: hideFromScreenReader ? undefined : -1,
123
121
  "aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
124
- "aria-labelledby": (0, _platformFeatureFlags.fg)('platform_editor_accessible_heading_copy_link') ? hideFromScreenReader ? undefined : headingId : undefined,
122
+ "aria-labelledby": hideFromScreenReader ? undefined : headingId,
125
123
  type: "button"
126
124
  }, (0, _react2.jsx)(_link.default, {
127
125
  label: _this.getCopyAriaLabel(),
128
126
  LEGACY_size: _this.props.level > 3 ? 'small' : 'medium',
129
- color: _this.state.isClicked ? "var(--ds-icon-selected, ".concat(_colors.B400, ")") : "var(--ds-icon-subtle, ".concat(_colors.N200, ")")
127
+ color: _this.state.isClicked ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon-subtle, #626F86)"
130
128
  }));
131
129
  });
132
130
  return _this;
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
10
  var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
12
- var _headingAnchor = _interopRequireDefault(require("./heading-anchor"));
13
11
  var _analytics = require("@atlaskit/editor-common/analytics");
14
12
  var _analyticsContext = _interopRequireDefault(require("../../analytics/analyticsContext"));
15
13
  var _clipboard = require("../utils/clipboard");
14
+ var _headingAnchor = _interopRequireDefault(require("./heading-anchor"));
16
15
  var getCurrentUrlWithHash = function getCurrentUrlWithHash() {
17
16
  var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
18
17
  var url = new URL(window.location.href);
@@ -81,13 +80,13 @@ function Heading(props) {
81
80
  level: props.level,
82
81
  enableNestedHeaderLinks: enableNestedHeaderLinks,
83
82
  headingId: headingId,
84
- hideFromScreenReader: (0, _platformFeatureFlags.fg)('platform_editor_accessible_heading_copy_link')
83
+ hideFromScreenReader: true
85
84
  }), props.children, showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/_react.default.createElement(WrappedHeadingAnchor, {
86
85
  level: props.level,
87
86
  enableNestedHeaderLinks: enableNestedHeaderLinks,
88
87
  headingId: headingId,
89
- hideFromScreenReader: (0, _platformFeatureFlags.fg)('platform_editor_accessible_heading_copy_link')
90
- }))), (0, _platformFeatureFlags.fg)('platform_editor_accessible_heading_copy_link') && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
88
+ hideFromScreenReader: true
89
+ }))), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
91
90
  testId: "visually-hidden-heading-anchor"
92
91
  }, showAnchorLink && headingId && /*#__PURE__*/_react.default.createElement(WrappedHeadingAnchor, {
93
92
  level: props.level,
@@ -716,14 +716,14 @@ var smartCardStyles = (0, _react.css)((0, _defineProperty2.default)({}, ".".conc
716
716
  margin: "".concat(_editorSharedStyles.blockNodesVerticalMargin, " 0 0"),
717
717
  maxWidth: "".concat(8 * 95, "px")
718
718
  }));
719
- var smartCardStylesAvatarFix = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.SmartCardSharedCssClassName.LOADER_WRAPPER), {
719
+ var smartCardStylesAvatarFix = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER), {
720
720
  /* EDM-11991: Fix list plugin adding padding to ADS AvatarGroup start */
721
721
  'ul, ol': {
722
722
  paddingLeft: 'inherit'
723
723
  }
724
724
  /* EDM-11991: Fix list plugin add padding to ADS AvatarGroup end */
725
725
  }));
726
- var smartCardStylesAvatarMarginFix = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.SmartCardSharedCssClassName.LOADER_WRAPPER), {
726
+ var smartCardStylesAvatarMarginFix = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER), {
727
727
  'ul, ol': {
728
728
  marginRight: 'inherit'
729
729
  }
@@ -63,7 +63,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
63
63
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
64
64
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
65
65
  var packageName = "@atlaskit/renderer";
66
- var packageVersion = "118.2.0";
66
+ var packageVersion = "118.2.2";
67
67
  var setAsQueryContainerStyles = (0, _react2.css)({
68
68
  containerName: 'ak-renderer-wrapper',
69
69
  containerType: 'inline-size'
@@ -13,6 +13,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
14
  var _reactIntlNext = require("react-intl-next");
15
15
  var _messages = require("../../../messages");
16
+ var _AnnotationManagerContext = require("../contexts/AnnotationManagerContext");
16
17
  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; }
17
18
  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; } /**
18
19
  * @jsxRuntime classic
@@ -126,6 +127,22 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
126
127
  var annotationIds = (0, _react.useMemo)(function () {
127
128
  return (0, _toConsumableArray2.default)(new Set([].concat((0, _toConsumableArray2.default)(annotationParentIds), [id])));
128
129
  }, [id, annotationParentIds]);
130
+ var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
131
+ dispatch = _useAnnotationManager.dispatch;
132
+ var _useAnnotationManager2 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
133
+ currentSelectedAnnotationId = _useAnnotationManager2.currentSelectedAnnotationId;
134
+
135
+ // after creating a new annotation, we need to set the markRef to the new mark
136
+ var markRef = (0, _react.useCallback)(function (node) {
137
+ if (id === currentSelectedAnnotationId && node) {
138
+ dispatch({
139
+ type: 'setSelectedMarkRef',
140
+ data: {
141
+ markRef: node
142
+ }
143
+ });
144
+ }
145
+ }, [dispatch, id, currentSelectedAnnotationId]);
129
146
  var onMarkClick = (0, _react.useCallback)(function (event) {
130
147
  // prevent inline mark logic for media block marks
131
148
  if (event.currentTarget instanceof HTMLElement && event.currentTarget.getAttribute('data-block-mark')) {
@@ -193,6 +210,7 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
193
210
  'aria-details': annotationIds.join(', ')
194
211
  }, desktopAccessibilityAttributes);
195
212
  return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
213
+ ref: id === currentSelectedAnnotationId ? markRef : undefined,
196
214
  id: id
197
215
  }, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
198
216
  css: [markStyles, (0, _platformFeatureFlags.fg)('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && markStylesWithInlineComments, (0, _platformFeatureFlags.fg)('confluence-frontend-comments-panel') && markStylesWithCommentsPanel, !isMobile() && accessibilityStyles, markStylesWithUpdatedShadow],
@@ -124,6 +124,10 @@ var useHasFocusEvent = exports.useHasFocusEvent = function useHasFocusEvent(_ref
124
124
  };
125
125
  }
126
126
  };
127
+ var NO_ANNOTATION_SELECTED = {
128
+ annotations: [],
129
+ clickElementTarget: undefined
130
+ };
127
131
  var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnnotationClickEvent(props) {
128
132
  var _useState7 = (0, _react.useState)(null),
129
133
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
@@ -142,10 +146,11 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
142
146
  type: _adfSchema.AnnotationTypes.INLINE_COMMENT
143
147
  }],
144
148
  clickElementTarget: currentSelectedMarkRef
145
- } : {
146
- annotations: [],
147
- clickElementTarget: undefined
148
- };
149
+ } :
150
+ // This is a constant to represent the case when no annotation is selected.
151
+ // When creating a new annotation, currentSelectedAnnotationId and currentSelectedMarkRef will be set one after another,
152
+ // if this isn't a const, it will cause useMemo to return two different "empty" objects and causes infinite re-renders.
153
+ NO_ANNOTATION_SELECTED;
149
154
  }, [currentSelectedAnnotationId, currentSelectedMarkRef]);
150
155
  (0, _react.useLayoutEffect)(function () {
151
156
  if (!updateSubscriber || isNestedRender) {
@@ -8,11 +8,9 @@ import _extends from "@babel/runtime/helpers/extends";
8
8
  import React from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
11
- import { N200, N500, B400 } from '@atlaskit/theme/colors';
12
- import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { injectIntl } from 'react-intl-next';
13
12
  import LinkIcon from '@atlaskit/icon/core/migration/link';
14
13
  import Tooltip from '@atlaskit/tooltip';
15
- import { injectIntl } from 'react-intl-next';
16
14
  import { headingAnchorLinkMessages } from '../../messages';
17
15
  export const HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
18
16
  const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
@@ -31,7 +29,7 @@ const copyAnchorButtonStyles = css({
31
29
  outline: 'none',
32
30
  backgroundColor: 'transparent',
33
31
  border: 'none',
34
- color: `var(--ds-icon, ${N500})`,
32
+ color: "var(--ds-icon, #44546F)",
35
33
  cursor: 'pointer',
36
34
  right: 0
37
35
  });
@@ -86,12 +84,12 @@ class HeadingAnchor extends React.PureComponent {
86
84
  "aria-hidden": hideFromScreenReader,
87
85
  tabIndex: hideFromScreenReader ? undefined : -1,
88
86
  "aria-label": hideFromScreenReader ? undefined : this.state.tooltipMessage,
89
- "aria-labelledby": fg('platform_editor_accessible_heading_copy_link') ? hideFromScreenReader ? undefined : headingId : undefined,
87
+ "aria-labelledby": hideFromScreenReader ? undefined : headingId,
90
88
  type: "button"
91
89
  }, jsx(LinkIcon, {
92
90
  label: this.getCopyAriaLabel(),
93
91
  LEGACY_size: this.props.level > 3 ? 'small' : 'medium',
94
- color: this.state.isClicked ? `var(--ds-icon-selected, ${B400})` : `var(--ds-icon-subtle, ${N200})`
92
+ color: this.state.isClicked ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon-subtle, #626F86)"
95
93
  }));
96
94
  });
97
95
  }
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import VisuallyHidden from '@atlaskit/visually-hidden';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { abortAll } from '@atlaskit/react-ufo/interaction-metrics';
5
- import HeadingAnchor from './heading-anchor';
6
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
5
  import AnalyticsContext from '../../analytics/analyticsContext';
8
6
  import { copyTextToClipboard } from '../utils/clipboard';
7
+ import HeadingAnchor from './heading-anchor';
9
8
  const getCurrentUrlWithHash = (hash = '') => {
10
9
  const url = new URL(window.location.href);
11
10
  url.search = ''; // clear any query params so that the page will correctly scroll to the anchor
@@ -73,13 +72,13 @@ function Heading(props) {
73
72
  level: props.level,
74
73
  enableNestedHeaderLinks: enableNestedHeaderLinks,
75
74
  headingId: headingId,
76
- hideFromScreenReader: fg('platform_editor_accessible_heading_copy_link')
75
+ hideFromScreenReader: true
77
76
  }), props.children, showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
78
77
  level: props.level,
79
78
  enableNestedHeaderLinks: enableNestedHeaderLinks,
80
79
  headingId: headingId,
81
- hideFromScreenReader: fg('platform_editor_accessible_heading_copy_link')
82
- }))), fg('platform_editor_accessible_heading_copy_link') && /*#__PURE__*/React.createElement(VisuallyHidden, {
80
+ hideFromScreenReader: true
81
+ }))), /*#__PURE__*/React.createElement(VisuallyHidden, {
83
82
  testId: "visually-hidden-heading-anchor"
84
83
  }, showAnchorLink && headingId && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
85
84
  level: props.level,
@@ -841,7 +841,7 @@ const smartCardStyles = css({
841
841
  }
842
842
  });
843
843
  const smartCardStylesAvatarFix = css({
844
- [`.${SmartCardSharedCssClassName.LOADER_WRAPPER}`]: {
844
+ [`.${SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER}`]: {
845
845
  /* EDM-11991: Fix list plugin adding padding to ADS AvatarGroup start */
846
846
  'ul, ol': {
847
847
  paddingLeft: 'inherit'
@@ -850,7 +850,7 @@ const smartCardStylesAvatarFix = css({
850
850
  }
851
851
  });
852
852
  const smartCardStylesAvatarMarginFix = css({
853
- [`.${SmartCardSharedCssClassName.LOADER_WRAPPER}`]: {
853
+ [`.${SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER}`]: {
854
854
  'ul, ol': {
855
855
  marginRight: 'inherit'
856
856
  }
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
48
48
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
49
49
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
50
50
  const packageName = "@atlaskit/renderer";
51
- const packageVersion = "118.2.0";
51
+ const packageVersion = "118.2.2";
52
52
  const setAsQueryContainerStyles = css({
53
53
  containerName: 'ak-renderer-wrapper',
54
54
  containerType: 'inline-size'
@@ -10,6 +10,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import { useIntl } from 'react-intl-next';
12
12
  import { inlineCommentMessages } from '../../../messages';
13
+ import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
13
14
  const markStyles = css({
14
15
  color: 'inherit',
15
16
  backgroundColor: 'unset',
@@ -131,6 +132,24 @@ export const MarkComponent = ({
131
132
  }) => {
132
133
  const intl = useIntl();
133
134
  const annotationIds = useMemo(() => [...new Set([...annotationParentIds, id])], [id, annotationParentIds]);
135
+ const {
136
+ dispatch
137
+ } = useAnnotationManagerDispatch();
138
+ const {
139
+ currentSelectedAnnotationId
140
+ } = useAnnotationManagerState();
141
+
142
+ // after creating a new annotation, we need to set the markRef to the new mark
143
+ const markRef = useCallback(node => {
144
+ if (id === currentSelectedAnnotationId && node) {
145
+ dispatch({
146
+ type: 'setSelectedMarkRef',
147
+ data: {
148
+ markRef: node
149
+ }
150
+ });
151
+ }
152
+ }, [dispatch, id, currentSelectedAnnotationId]);
134
153
  const onMarkClick = useCallback(event => {
135
154
  // prevent inline mark logic for media block marks
136
155
  if (event.currentTarget instanceof HTMLElement && event.currentTarget.getAttribute('data-block-mark')) {
@@ -200,6 +219,7 @@ export const MarkComponent = ({
200
219
  ...desktopAccessibilityAttributes
201
220
  };
202
221
  return jsx(useBlockLevel ? 'div' : 'mark', {
222
+ ref: id === currentSelectedAnnotationId ? markRef : undefined,
203
223
  id,
204
224
  [fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick']: onMarkClick,
205
225
  ...accessibility,
@@ -118,6 +118,10 @@ export const useHasFocusEvent = ({
118
118
  };
119
119
  }
120
120
  };
121
+ const NO_ANNOTATION_SELECTED = {
122
+ annotations: [],
123
+ clickElementTarget: undefined
124
+ };
121
125
  export const useAnnotationClickEvent = props => {
122
126
  const [annotationClickEvent, setAnnotationClickEvent] = useState(null);
123
127
  const {
@@ -136,10 +140,11 @@ export const useAnnotationClickEvent = props => {
136
140
  type: AnnotationTypes.INLINE_COMMENT
137
141
  }],
138
142
  clickElementTarget: currentSelectedMarkRef
139
- } : {
140
- annotations: [],
141
- clickElementTarget: undefined
142
- };
143
+ } :
144
+ // This is a constant to represent the case when no annotation is selected.
145
+ // When creating a new annotation, currentSelectedAnnotationId and currentSelectedMarkRef will be set one after another,
146
+ // if this isn't a const, it will cause useMemo to return two different "empty" objects and causes infinite re-renders.
147
+ NO_ANNOTATION_SELECTED;
143
148
  }, [currentSelectedAnnotationId, currentSelectedMarkRef]);
144
149
  useLayoutEffect(() => {
145
150
  if (!updateSubscriber || isNestedRender) {
@@ -19,11 +19,9 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
19
19
  import React from 'react';
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
21
  import { css, jsx } from '@emotion/react';
22
- import { N200, N500, B400 } from '@atlaskit/theme/colors';
23
- import { fg } from '@atlaskit/platform-feature-flags';
22
+ import { injectIntl } from 'react-intl-next';
24
23
  import LinkIcon from '@atlaskit/icon/core/migration/link';
25
24
  import Tooltip from '@atlaskit/tooltip';
26
- import { injectIntl } from 'react-intl-next';
27
25
  import { headingAnchorLinkMessages } from '../../messages';
28
26
  export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
29
27
  var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -40,7 +38,7 @@ var copyAnchorButtonStyles = css({
40
38
  outline: 'none',
41
39
  backgroundColor: 'transparent',
42
40
  border: 'none',
43
- color: "var(--ds-icon, ".concat(N500, ")"),
41
+ color: "var(--ds-icon, #44546F)",
44
42
  cursor: 'pointer',
45
43
  right: 0
46
44
  });
@@ -115,12 +113,12 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
115
113
  "aria-hidden": hideFromScreenReader,
116
114
  tabIndex: hideFromScreenReader ? undefined : -1,
117
115
  "aria-label": hideFromScreenReader ? undefined : _this.state.tooltipMessage,
118
- "aria-labelledby": fg('platform_editor_accessible_heading_copy_link') ? hideFromScreenReader ? undefined : headingId : undefined,
116
+ "aria-labelledby": hideFromScreenReader ? undefined : headingId,
119
117
  type: "button"
120
118
  }, jsx(LinkIcon, {
121
119
  label: _this.getCopyAriaLabel(),
122
120
  LEGACY_size: _this.props.level > 3 ? 'small' : 'medium',
123
- color: _this.state.isClicked ? "var(--ds-icon-selected, ".concat(B400, ")") : "var(--ds-icon-subtle, ".concat(N200, ")")
121
+ color: _this.state.isClicked ? "var(--ds-icon-selected, #0C66E4)" : "var(--ds-icon-subtle, #626F86)"
124
122
  }));
125
123
  });
126
124
  return _this;
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import VisuallyHidden from '@atlaskit/visually-hidden';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { abortAll } from '@atlaskit/react-ufo/interaction-metrics';
5
- import HeadingAnchor from './heading-anchor';
6
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
5
  import AnalyticsContext from '../../analytics/analyticsContext';
8
6
  import { copyTextToClipboard } from '../utils/clipboard';
7
+ import HeadingAnchor from './heading-anchor';
9
8
  var getCurrentUrlWithHash = function getCurrentUrlWithHash() {
10
9
  var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11
10
  var url = new URL(window.location.href);
@@ -74,13 +73,13 @@ function Heading(props) {
74
73
  level: props.level,
75
74
  enableNestedHeaderLinks: enableNestedHeaderLinks,
76
75
  headingId: headingId,
77
- hideFromScreenReader: fg('platform_editor_accessible_heading_copy_link')
76
+ hideFromScreenReader: true
78
77
  }), props.children, showAnchorLink && headingId && !isRightAligned && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
79
78
  level: props.level,
80
79
  enableNestedHeaderLinks: enableNestedHeaderLinks,
81
80
  headingId: headingId,
82
- hideFromScreenReader: fg('platform_editor_accessible_heading_copy_link')
83
- }))), fg('platform_editor_accessible_heading_copy_link') && /*#__PURE__*/React.createElement(VisuallyHidden, {
81
+ hideFromScreenReader: true
82
+ }))), /*#__PURE__*/React.createElement(VisuallyHidden, {
84
83
  testId: "visually-hidden-heading-anchor"
85
84
  }, showAnchorLink && headingId && /*#__PURE__*/React.createElement(WrappedHeadingAnchor, {
86
85
  level: props.level,
@@ -709,14 +709,14 @@ var smartCardStyles = css(_defineProperty({}, ".".concat(SmartCardSharedCssClass
709
709
  margin: "".concat(blockNodesVerticalMargin, " 0 0"),
710
710
  maxWidth: "".concat(8 * 95, "px")
711
711
  }));
712
- var smartCardStylesAvatarFix = css(_defineProperty({}, ".".concat(SmartCardSharedCssClassName.LOADER_WRAPPER), {
712
+ var smartCardStylesAvatarFix = css(_defineProperty({}, ".".concat(SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER), {
713
713
  /* EDM-11991: Fix list plugin adding padding to ADS AvatarGroup start */
714
714
  'ul, ol': {
715
715
  paddingLeft: 'inherit'
716
716
  }
717
717
  /* EDM-11991: Fix list plugin add padding to ADS AvatarGroup end */
718
718
  }));
719
- var smartCardStylesAvatarMarginFix = css(_defineProperty({}, ".".concat(SmartCardSharedCssClassName.LOADER_WRAPPER), {
719
+ var smartCardStylesAvatarMarginFix = css(_defineProperty({}, ".".concat(SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER), {
720
720
  'ul, ol': {
721
721
  marginRight: 'inherit'
722
722
  }
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
53
53
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
54
54
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
55
55
  var packageName = "@atlaskit/renderer";
56
- var packageVersion = "118.2.0";
56
+ var packageVersion = "118.2.2";
57
57
  var setAsQueryContainerStyles = css({
58
58
  containerName: 'ak-renderer-wrapper',
59
59
  containerType: 'inline-size'
@@ -14,6 +14,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import { useIntl } from 'react-intl-next';
16
16
  import { inlineCommentMessages } from '../../../messages';
17
+ import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
17
18
  var markStyles = css(_defineProperty({
18
19
  color: 'inherit',
19
20
  backgroundColor: 'unset',
@@ -122,6 +123,22 @@ export var MarkComponent = function MarkComponent(_ref) {
122
123
  var annotationIds = useMemo(function () {
123
124
  return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
124
125
  }, [id, annotationParentIds]);
126
+ var _useAnnotationManager = useAnnotationManagerDispatch(),
127
+ dispatch = _useAnnotationManager.dispatch;
128
+ var _useAnnotationManager2 = useAnnotationManagerState(),
129
+ currentSelectedAnnotationId = _useAnnotationManager2.currentSelectedAnnotationId;
130
+
131
+ // after creating a new annotation, we need to set the markRef to the new mark
132
+ var markRef = useCallback(function (node) {
133
+ if (id === currentSelectedAnnotationId && node) {
134
+ dispatch({
135
+ type: 'setSelectedMarkRef',
136
+ data: {
137
+ markRef: node
138
+ }
139
+ });
140
+ }
141
+ }, [dispatch, id, currentSelectedAnnotationId]);
125
142
  var onMarkClick = useCallback(function (event) {
126
143
  // prevent inline mark logic for media block marks
127
144
  if (event.currentTarget instanceof HTMLElement && event.currentTarget.getAttribute('data-block-mark')) {
@@ -189,6 +206,7 @@ export var MarkComponent = function MarkComponent(_ref) {
189
206
  'aria-details': annotationIds.join(', ')
190
207
  }, desktopAccessibilityAttributes);
191
208
  return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
209
+ ref: id === currentSelectedAnnotationId ? markRef : undefined,
192
210
  id: id
193
211
  }, fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
194
212
  css: [markStyles, fg('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, fg('editor_inline_comments_on_inline_nodes') && markStylesWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesWithCommentsPanel, !isMobile() && accessibilityStyles, markStylesWithUpdatedShadow],
@@ -117,6 +117,10 @@ export var useHasFocusEvent = function useHasFocusEvent(_ref2) {
117
117
  };
118
118
  }
119
119
  };
120
+ var NO_ANNOTATION_SELECTED = {
121
+ annotations: [],
122
+ clickElementTarget: undefined
123
+ };
120
124
  export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
121
125
  var _useState7 = useState(null),
122
126
  _useState8 = _slicedToArray(_useState7, 2),
@@ -135,10 +139,11 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
135
139
  type: AnnotationTypes.INLINE_COMMENT
136
140
  }],
137
141
  clickElementTarget: currentSelectedMarkRef
138
- } : {
139
- annotations: [],
140
- clickElementTarget: undefined
141
- };
142
+ } :
143
+ // This is a constant to represent the case when no annotation is selected.
144
+ // When creating a new annotation, currentSelectedAnnotationId and currentSelectedMarkRef will be set one after another,
145
+ // if this isn't a const, it will cause useMemo to return two different "empty" objects and causes infinite re-renders.
146
+ NO_ANNOTATION_SELECTED;
142
147
  }, [currentSelectedAnnotationId, currentSelectedMarkRef]);
143
148
  useLayoutEffect(function () {
144
149
  if (!updateSubscriber || isNestedRender) {
@@ -27,6 +27,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
27
27
  'data-id': string;
28
28
  'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
29
29
  'aria-disabled': boolean;
30
+ ref: ((node: HTMLElement | null) => void) | undefined;
30
31
  id: string;
31
32
  } | {
32
33
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -41,6 +42,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
41
42
  'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
42
43
  'data-id': string;
43
44
  'aria-disabled': boolean;
45
+ ref: ((node: HTMLElement | null) => void) | undefined;
44
46
  id: string;
45
47
  } | {
46
48
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -58,6 +60,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
58
60
  'aria-expanded'?: undefined;
59
61
  'aria-details': string;
60
62
  'aria-disabled'?: undefined;
63
+ ref: ((node: HTMLElement | null) => void) | undefined;
61
64
  id: string;
62
65
  } | {
63
66
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -77,6 +80,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
77
80
  'aria-expanded'?: undefined;
78
81
  'aria-details': string;
79
82
  'aria-disabled'?: undefined;
83
+ ref: ((node: HTMLElement | null) => void) | undefined;
80
84
  id: string;
81
85
  } | {
82
86
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -94,6 +98,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
94
98
  'aria-expanded': boolean;
95
99
  'aria-details': string;
96
100
  'aria-disabled'?: undefined;
101
+ ref: ((node: HTMLElement | null) => void) | undefined;
97
102
  id: string;
98
103
  } | {
99
104
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -113,6 +118,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
113
118
  'aria-expanded': boolean;
114
119
  'aria-details': string;
115
120
  'aria-disabled'?: undefined;
121
+ ref: ((node: HTMLElement | null) => void) | undefined;
116
122
  id: string;
117
123
  }, string | React.JSXElementConstructor<any>>;
118
124
  export {};
@@ -27,6 +27,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
27
27
  'data-id': string;
28
28
  'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
29
29
  'aria-disabled': boolean;
30
+ ref: ((node: HTMLElement | null) => void) | undefined;
30
31
  id: string;
31
32
  } | {
32
33
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -41,6 +42,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
41
42
  'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
42
43
  'data-id': string;
43
44
  'aria-disabled': boolean;
45
+ ref: ((node: HTMLElement | null) => void) | undefined;
44
46
  id: string;
45
47
  } | {
46
48
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -58,6 +60,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
58
60
  'aria-expanded'?: undefined;
59
61
  'aria-details': string;
60
62
  'aria-disabled'?: undefined;
63
+ ref: ((node: HTMLElement | null) => void) | undefined;
61
64
  id: string;
62
65
  } | {
63
66
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -77,6 +80,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
77
80
  'aria-expanded'?: undefined;
78
81
  'aria-details': string;
79
82
  'aria-disabled'?: undefined;
83
+ ref: ((node: HTMLElement | null) => void) | undefined;
80
84
  id: string;
81
85
  } | {
82
86
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -94,6 +98,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
94
98
  'aria-expanded': boolean;
95
99
  'aria-details': string;
96
100
  'aria-disabled'?: undefined;
101
+ ref: ((node: HTMLElement | null) => void) | undefined;
97
102
  id: string;
98
103
  } | {
99
104
  css?: (false | import("@emotion/react").SerializedStyles)[] | undefined;
@@ -113,6 +118,7 @@ export declare const MarkComponent: ({ annotationParentIds, children, dataAttrib
113
118
  'aria-expanded': boolean;
114
119
  'aria-details': string;
115
120
  'aria-disabled'?: undefined;
121
+ ref: ((node: HTMLElement | null) => void) | undefined;
116
122
  id: string;
117
123
  }, string | React.JSXElementConstructor<any>>;
118
124
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "118.2.0",
3
+ "version": "118.2.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/analytics-next": "^11.0.0",
32
32
  "@atlaskit/button": "^23.2.0",
33
33
  "@atlaskit/code": "^17.2.0",
34
- "@atlaskit/editor-common": "^105.7.0",
34
+ "@atlaskit/editor-common": "^105.8.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.24.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -48,15 +48,15 @@
48
48
  "@atlaskit/media-common": "^12.1.0",
49
49
  "@atlaskit/media-filmstrip": "^50.1.0",
50
50
  "@atlaskit/media-ui": "^28.2.0",
51
- "@atlaskit/media-viewer": "^52.1.0",
51
+ "@atlaskit/media-viewer": "^52.2.0",
52
52
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
53
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
54
54
  "@atlaskit/react-ufo": "^3.13.0",
55
- "@atlaskit/smart-card": "^38.3.0",
55
+ "@atlaskit/smart-card": "^38.5.0",
56
56
  "@atlaskit/status": "^3.0.0",
57
57
  "@atlaskit/task-decision": "^19.2.0",
58
58
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^4.22.0",
59
+ "@atlaskit/tmp-editor-statsig": "^4.25.0",
60
60
  "@atlaskit/tokens": "^4.9.0",
61
61
  "@atlaskit/tooltip": "^20.0.0",
62
62
  "@atlaskit/visually-hidden": "^3.0.0",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/link-provider": "^3.0.0",
73
+ "@atlaskit/link-provider": "^3.1.0",
74
74
  "@atlaskit/media-core": "^36.1.0",
75
75
  "react": "^18.2.0",
76
76
  "react-dom": "^18.2.0"
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/analytics-gas-types": "^5.1.0",
82
82
  "@atlaskit/checkbox": "^17.1.0",
83
83
  "@atlaskit/css-reset": "^7.3.0",
84
- "@atlaskit/link-provider": "^3.0.0",
84
+ "@atlaskit/link-provider": "^3.1.0",
85
85
  "@atlaskit/link-test-helpers": "^8.0.0",
86
86
  "@atlaskit/linking-common": "^9.0.0",
87
87
  "@atlaskit/media-core": "^36.1.0",
@@ -177,9 +177,6 @@
177
177
  "type": "boolean",
178
178
  "referenceOnly": true
179
179
  },
180
- "platform_editor_accessible_heading_copy_link": {
181
- "type": "boolean"
182
- },
183
180
  "platform_editor_fix_vc90_bug_with_files": {
184
181
  "type": "boolean"
185
182
  },