@atlaskit/renderer 109.42.4 → 109.42.6

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,34 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.42.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#121678](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121678)
8
+ [`9ca02c9c7c5ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ca02c9c7c5ce) -
9
+ created new entrypoint for startMeasure,stopMeasure,clearMeasure, deprecated those functions in
10
+ editor-common/utils
11
+ - Updated dependencies
12
+
13
+ ## 109.42.5
14
+
15
+ ### Patch Changes
16
+
17
+ - [#121315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121315)
18
+ [`f550b1a0c6e85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f550b1a0c6e85) -
19
+ [ux] ED-24237 Fix comment appearances in renderer to match editor
20
+ - [#121452](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121452)
21
+ [`9696ad7f5108a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9696ad7f5108a) -
22
+ ensure nested tables don't have left alignment styles
23
+ - [#120992](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120992)
24
+ [`a61cfb5567823`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a61cfb5567823) -
25
+ ED-23357 Update annotation node name calculations to avoid crashes on invalid ranges
26
+ - [#121315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121315)
27
+ [`f550b1a0c6e85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f550b1a0c6e85) -
28
+ ED-24236 fix missing underline for draft annotations in renderer (when annotations on inline nodes
29
+ fg is on)
30
+ - Updated dependencies
31
+
3
32
  ## 109.42.4
4
33
 
5
34
  ### Patch Changes
@@ -177,6 +177,37 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
177
177
  }
178
178
  return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
179
179
  }
180
+ }, {
181
+ key: "isRangeAnnotatable",
182
+ value: function isRangeAnnotatable(range) {
183
+ try {
184
+ var _startContainer$paren, _endContainer$parentE;
185
+ if (!range) {
186
+ return false;
187
+ }
188
+ var startContainer = range.startContainer,
189
+ endContainer = range.endContainer;
190
+ if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
191
+ return false;
192
+ }
193
+ return this.isValidAnnotationRange(range);
194
+ } catch (_unused) {
195
+ // isValidAnnotationRange can fail when called inside nested renderers.
196
+ // while isRendererWithinRange guards against this to some degree -- the classnames
197
+ // are controlled by product -- and we don't have platform guarantees on them.
198
+ //
199
+ // Currently there is a mix of logic across the platform and confluence on determining
200
+ // positions that are annotatable. This is a defensive check to ensure we don't throw an error
201
+ // in cases where the range is not valid.
202
+ return false;
203
+ }
204
+ }
205
+
206
+ /**
207
+ * This is replaced by `isRangeAnnotatable`.
208
+ *
209
+ * @deprecated
210
+ **/
180
211
  }, {
181
212
  key: "isRendererWithinRange",
182
213
  value: function isRendererWithinRange(range) {
@@ -321,7 +321,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
321
321
  var isTableAlignStart = (0, _appearance.isFullWidthOrFullPageAppearance)(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && (0, _platformFeatureFlags.fg)('platform.editor.table.allow-table-alignment');
322
322
  var fullWidthLineLength = isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
323
323
  var lineLength = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
324
- var shouldCalculateLeftForAlignment = isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidth <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance));
324
+ var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidth <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance));
325
325
  if (shouldCalculateLeftForAlignment) {
326
326
  left = (tableWidth - lineLength) / 2;
327
327
  }
@@ -20,6 +20,7 @@ var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
20
20
  var _traverse = require("@atlaskit/adf-utils/traverse");
21
21
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
22
22
  var _ui = require("@atlaskit/editor-common/ui");
23
+ var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
23
24
  var _utils = require("@atlaskit/editor-common/utils");
24
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
26
  var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
@@ -56,7 +57,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
56
57
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
57
58
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
58
59
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "109.42.4";
60
+ var packageVersion = "109.42.6";
60
61
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
61
62
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
62
63
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -146,7 +147,7 @@ var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
146
147
  _this.serializer = new _.ReactSerializer(_this.deriveSerializerProps(props));
147
148
  _this.editorRef = props.innerRef || /*#__PURE__*/_react.default.createRef();
148
149
  _this.id = (0, _v.default)();
149
- (0, _utils.startMeasure)("Renderer Render Time: ".concat(_this.id));
150
+ (0, _performanceMeasures.startMeasure)("Renderer Render Time: ".concat(_this.id));
150
151
  var _featureFlags = _this.featureFlags(_this.props.featureFlags).featureFlags;
151
152
  if (_featureFlags !== null && _featureFlags !== void 0 && _featureFlags.rendererTtiTracking) {
152
153
  (0, _utils.measureTTI)(function (tti, ttiFromInvocation, canceled) {
@@ -199,7 +200,7 @@ var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
199
200
  eventType: _analytics.EVENT_TYPE.UI
200
201
  });
201
202
  this.rafID = requestAnimationFrame(function () {
202
- (0, _utils.stopMeasure)("Renderer Render Time: ".concat(_this2.id), function (duration) {
203
+ (0, _performanceMeasures.stopMeasure)("Renderer Render Time: ".concat(_this2.id), function (duration) {
203
204
  var _analyticsEventSeveri, _analyticsEventSeveri2, _this2$props;
204
205
  var analyticsEventSeverityTracking = _this2.props.analyticsEventSeverityTracking;
205
206
  var forceSeverityTracking = typeof analyticsEventSeverityTracking === 'undefined' && (0, _utils.shouldForceTracking)();
@@ -283,7 +284,7 @@ var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
283
284
  nodeComponents: props.nodeComponents,
284
285
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
285
286
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
286
- isInsideOfInlineExtension: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
287
+ isInsideOfInlineExtension: (0, _platformFeatureFlags.fg)('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
287
288
  textHighlighter: props.UNSTABLE_textHighlighter,
288
289
  isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
289
290
  };
@@ -540,7 +541,7 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
540
541
  , {
541
542
  className: "ak-renderer-wrapper is-".concat(appearance),
542
543
  "data-appearance": appearance,
543
- shouldCheckExistingValue: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
544
+ shouldCheckExistingValue: (0, _platformFeatureFlags.fg)('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
544
545
  }, (0, _react2.jsx)(_ui.BaseTheme, {
545
546
  baseFontSize: appearance && appearance !== 'comment' ? _editorSharedStyles.akEditorFullPageDefaultFontSize : undefined
546
547
  }, (0, _react2.jsx)(_EditorMediaClientProvider.EditorMediaClientProvider, {
@@ -112,6 +112,27 @@ function getAnnotationStyles(_ref6) {
112
112
  if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
113
113
  return '';
114
114
  }
115
+ if ((0, _platformFeatureFlags.fg)('annotations_align_editor_and_renderer_styles')) {
116
+ return (0, _react.css)({
117
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
118
+ '& [data-annotation-draft-mark][data-annotation-inline-node]': {
119
+ borderBottom: '2px solid transparent',
120
+ cursor: 'pointer',
121
+ padding: '1px 0 2px',
122
+ background: "var(--ds-background-accent-yellow-subtler, ".concat(_colors.Y75, ")"),
123
+ borderBottomColor: "var(--ds-border-accent-yellow, ".concat(_colors.Y300, ")"),
124
+ boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(_colors.N60A, ", -1px 2px 3px ").concat(_colors.N60A), ")")
125
+ },
126
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
127
+ '& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
128
+ padding: '5px 0 3px 0'
129
+ },
130
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
131
+ '& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
132
+ paddingTop: "var(--ds-space-025, 2px)"
133
+ }
134
+ });
135
+ }
115
136
  return (0, _react.css)({
116
137
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
117
138
  "& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
@@ -39,16 +39,26 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
39
39
  var providers = (0, _react.useContext)(_context.ProvidersContext);
40
40
  var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
41
41
  var inlineNodeTypes = (0, _react.useMemo)(function () {
42
- if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
43
- return undefined;
44
- }
45
- if (actions.isValidAnnotationRange(range)) {
42
+ if ((0, _platformFeatureFlags.fg)('annotations_defensive_node_name_calculations')) {
43
+ if (!actions.isRangeAnnotatable(range)) {
44
+ return undefined;
45
+ }
46
46
  return (0, _getRendererRangeInlineNodeNames.getRendererRangeInlineNodeNames)({
47
47
  pos: documentPosition,
48
48
  actions: actions
49
49
  });
50
50
  } else {
51
- return undefined;
51
+ if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
52
+ return undefined;
53
+ }
54
+ if (actions.isValidAnnotationRange(range)) {
55
+ return (0, _getRendererRangeInlineNodeNames.getRendererRangeInlineNodeNames)({
56
+ pos: documentPosition,
57
+ actions: actions
58
+ });
59
+ } else {
60
+ return undefined;
61
+ }
52
62
  }
53
63
  }, [documentPosition, actions, range]);
54
64
  var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
@@ -155,6 +155,37 @@ export default class RendererActions {
155
155
  }
156
156
  return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
157
157
  }
158
+ isRangeAnnotatable(range) {
159
+ try {
160
+ var _startContainer$paren, _endContainer$parentE;
161
+ if (!range) {
162
+ return false;
163
+ }
164
+ const {
165
+ startContainer,
166
+ endContainer
167
+ } = range;
168
+ if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
169
+ return false;
170
+ }
171
+ return this.isValidAnnotationRange(range);
172
+ } catch {
173
+ // isValidAnnotationRange can fail when called inside nested renderers.
174
+ // while isRendererWithinRange guards against this to some degree -- the classnames
175
+ // are controlled by product -- and we don't have platform guarantees on them.
176
+ //
177
+ // Currently there is a mix of logic across the platform and confluence on determining
178
+ // positions that are annotatable. This is a defensive check to ensure we don't throw an error
179
+ // in cases where the range is not valid.
180
+ return false;
181
+ }
182
+ }
183
+
184
+ /**
185
+ * This is replaced by `isRangeAnnotatable`.
186
+ *
187
+ * @deprecated
188
+ **/
158
189
  isRendererWithinRange(range) {
159
190
  const {
160
191
  startContainer,
@@ -268,7 +268,7 @@ export class TableContainer extends React.Component {
268
268
  const isTableAlignStart = isFullWidthOrFullPageAppearance(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && fg('platform.editor.table.allow-table-alignment');
269
269
  const fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
270
270
  const lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
271
- const shouldCalculateLeftForAlignment = isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
271
+ const shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
272
272
  if (shouldCalculateLeftForAlignment) {
273
273
  left = (tableWidth - lineLength) / 2;
274
274
  }
@@ -8,8 +8,9 @@ import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
8
8
  import { reduce } from '@atlaskit/adf-utils/traverse';
9
9
  import { ProviderFactory, ProviderFactoryProvider } from '@atlaskit/editor-common/provider-factory';
10
10
  import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
11
- import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI, getDistortedDurationMonitor, browser } from '@atlaskit/editor-common/utils';
12
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
+ import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
12
+ import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, shouldForceTracking, measureTTI, getDistortedDurationMonitor, browser } from '@atlaskit/editor-common/utils';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
14
15
  import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
15
16
  import { FabricChannel } from '@atlaskit/analytics-listeners';
@@ -38,7 +39,7 @@ import { nodeToReact } from '../../react/nodes';
38
39
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
39
40
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
40
41
  const packageName = "@atlaskit/renderer";
41
- const packageVersion = "109.42.4";
42
+ const packageVersion = "109.42.6";
42
43
  export const defaultNodeComponents = nodeToReact;
43
44
  export class Renderer extends PureComponent {
44
45
  constructor(props) {
@@ -263,7 +264,7 @@ export class Renderer extends PureComponent {
263
264
  nodeComponents: props.nodeComponents,
264
265
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
265
266
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
266
- isInsideOfInlineExtension: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
267
+ isInsideOfInlineExtension: fg('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
267
268
  textHighlighter: props.UNSTABLE_textHighlighter,
268
269
  isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
269
270
  };
@@ -513,7 +514,7 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
513
514
  , {
514
515
  className: `ak-renderer-wrapper is-${appearance}`,
515
516
  "data-appearance": appearance,
516
- shouldCheckExistingValue: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
517
+ shouldCheckExistingValue: fg('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
517
518
  }, jsx(BaseTheme, {
518
519
  baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
519
520
  }, jsx(EditorMediaClientProvider, {
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
-
5
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
5
  import { css } from '@emotion/react';
7
6
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -371,6 +370,27 @@ function getAnnotationStyles({
371
370
  if (!fg('editor_inline_comments_on_inline_nodes')) {
372
371
  return '';
373
372
  }
373
+ if (fg('annotations_align_editor_and_renderer_styles')) {
374
+ return css({
375
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
376
+ '& [data-annotation-draft-mark][data-annotation-inline-node]': {
377
+ borderBottom: '2px solid transparent',
378
+ cursor: 'pointer',
379
+ padding: '1px 0 2px',
380
+ background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
381
+ borderBottomColor: `var(--ds-border-accent-yellow, ${Y300})`,
382
+ boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`
383
+ },
384
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
385
+ '& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
386
+ padding: '5px 0 3px 0'
387
+ },
388
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
389
+ '& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
390
+ paddingTop: "var(--ds-space-025, 2px)"
391
+ }
392
+ });
393
+ }
374
394
  return css({
375
395
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
376
396
  "& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
@@ -27,16 +27,26 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
27
27
  const providers = useContext(ProvidersContext);
28
28
  const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
29
29
  const inlineNodeTypes = useMemo(() => {
30
- if (!fg('editor_inline_comments_on_inline_nodes')) {
31
- return undefined;
32
- }
33
- if (actions.isValidAnnotationRange(range)) {
30
+ if (fg('annotations_defensive_node_name_calculations')) {
31
+ if (!actions.isRangeAnnotatable(range)) {
32
+ return undefined;
33
+ }
34
34
  return getRendererRangeInlineNodeNames({
35
35
  pos: documentPosition,
36
36
  actions
37
37
  });
38
38
  } else {
39
- return undefined;
39
+ if (!fg('editor_inline_comments_on_inline_nodes')) {
40
+ return undefined;
41
+ }
42
+ if (actions.isValidAnnotationRange(range)) {
43
+ return getRendererRangeInlineNodeNames({
44
+ pos: documentPosition,
45
+ actions
46
+ });
47
+ } else {
48
+ return undefined;
49
+ }
40
50
  }
41
51
  }, [documentPosition, actions, range]);
42
52
  const onCreateCallback = useCallback(annotationId => {
@@ -170,6 +170,37 @@ var RendererActions = /*#__PURE__*/function () {
170
170
  }
171
171
  return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
172
172
  }
173
+ }, {
174
+ key: "isRangeAnnotatable",
175
+ value: function isRangeAnnotatable(range) {
176
+ try {
177
+ var _startContainer$paren, _endContainer$parentE;
178
+ if (!range) {
179
+ return false;
180
+ }
181
+ var startContainer = range.startContainer,
182
+ endContainer = range.endContainer;
183
+ if ((_startContainer$paren = startContainer.parentElement) !== null && _startContainer$paren !== void 0 && _startContainer$paren.closest('.ak-renderer-extension') || (_endContainer$parentE = endContainer.parentElement) !== null && _endContainer$parentE !== void 0 && _endContainer$parentE.closest('.ak-renderer-extension')) {
184
+ return false;
185
+ }
186
+ return this.isValidAnnotationRange(range);
187
+ } catch (_unused) {
188
+ // isValidAnnotationRange can fail when called inside nested renderers.
189
+ // while isRendererWithinRange guards against this to some degree -- the classnames
190
+ // are controlled by product -- and we don't have platform guarantees on them.
191
+ //
192
+ // Currently there is a mix of logic across the platform and confluence on determining
193
+ // positions that are annotatable. This is a defensive check to ensure we don't throw an error
194
+ // in cases where the range is not valid.
195
+ return false;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * This is replaced by `isRangeAnnotatable`.
201
+ *
202
+ * @deprecated
203
+ **/
173
204
  }, {
174
205
  key: "isRendererWithinRange",
175
206
  value: function isRendererWithinRange(range) {
@@ -314,7 +314,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
314
314
  var isTableAlignStart = isFullWidthOrFullPageAppearance(rendererAppearance) && tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && fg('platform.editor.table.allow-table-alignment');
315
315
  var fullWidthLineLength = isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
316
316
  var lineLength = isFullWidthAppearance(rendererAppearance) ? fullWidthLineLength : lineLengthFixedWidth;
317
- var shouldCalculateLeftForAlignment = isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
317
+ var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && isTableAlignStart && (isFullPageAppearance(rendererAppearance) && tableWidth <= lineLengthFixedWidth || isFullWidthAppearance(rendererAppearance));
318
318
  if (shouldCalculateLeftForAlignment) {
319
319
  left = (tableWidth - lineLength) / 2;
320
320
  }
@@ -18,8 +18,9 @@ import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
18
18
  import { reduce } from '@atlaskit/adf-utils/traverse';
19
19
  import { ProviderFactory, ProviderFactoryProvider } from '@atlaskit/editor-common/provider-factory';
20
20
  import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
21
- import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI, getDistortedDurationMonitor, browser } from '@atlaskit/editor-common/utils';
22
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
+ import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
22
+ import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, shouldForceTracking, measureTTI, getDistortedDurationMonitor, browser } from '@atlaskit/editor-common/utils';
23
+ import { fg } from '@atlaskit/platform-feature-flags';
23
24
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
24
25
  import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
25
26
  import { FabricChannel } from '@atlaskit/analytics-listeners';
@@ -48,7 +49,7 @@ import { nodeToReact } from '../../react/nodes';
48
49
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
49
50
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
50
51
  var packageName = "@atlaskit/renderer";
51
- var packageVersion = "109.42.4";
52
+ var packageVersion = "109.42.6";
52
53
  export var defaultNodeComponents = nodeToReact;
53
54
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
54
55
  _inherits(Renderer, _PureComponent);
@@ -275,7 +276,7 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
275
276
  nodeComponents: props.nodeComponents,
276
277
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
277
278
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
278
- isInsideOfInlineExtension: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
279
+ isInsideOfInlineExtension: fg('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
279
280
  textHighlighter: props.UNSTABLE_textHighlighter,
280
281
  isCommentsOnMediaMediaInlineBugFixEnabled: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.commentsOnMediaMediaInlineBugFix
281
282
  };
@@ -532,7 +533,7 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
532
533
  , {
533
534
  className: "ak-renderer-wrapper is-".concat(appearance),
534
535
  "data-appearance": appearance,
535
- shouldCheckExistingValue: getBooleanFF('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
536
+ shouldCheckExistingValue: fg('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
536
537
  }, jsx(BaseTheme, {
537
538
  baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
538
539
  }, jsx(EditorMediaClientProvider, {
@@ -3,7 +3,6 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
3
3
  /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */
4
4
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
-
7
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
7
  import { css } from '@emotion/react';
9
8
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -104,6 +103,27 @@ function getAnnotationStyles(_ref6) {
104
103
  if (!fg('editor_inline_comments_on_inline_nodes')) {
105
104
  return '';
106
105
  }
106
+ if (fg('annotations_align_editor_and_renderer_styles')) {
107
+ return css({
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
109
+ '& [data-annotation-draft-mark][data-annotation-inline-node]': {
110
+ borderBottom: '2px solid transparent',
111
+ cursor: 'pointer',
112
+ padding: '1px 0 2px',
113
+ background: "var(--ds-background-accent-yellow-subtler, ".concat(Y75, ")"),
114
+ borderBottomColor: "var(--ds-border-accent-yellow, ".concat(Y300, ")"),
115
+ boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A), ")")
116
+ },
117
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
118
+ '& [data-annotation-draft-mark][data-annotation-inline-node][data-inline-card]': {
119
+ padding: '5px 0 3px 0'
120
+ },
121
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
122
+ '& [data-annotation-draft-mark][data-annotation-inline-node].date-lozenger-container': {
123
+ paddingTop: "var(--ds-space-025, 2px)"
124
+ }
125
+ });
126
+ }
107
127
  return css({
108
128
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
109
129
  "& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
@@ -29,16 +29,26 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
29
29
  var providers = useContext(ProvidersContext);
30
30
  var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
31
31
  var inlineNodeTypes = useMemo(function () {
32
- if (!fg('editor_inline_comments_on_inline_nodes')) {
33
- return undefined;
34
- }
35
- if (actions.isValidAnnotationRange(range)) {
32
+ if (fg('annotations_defensive_node_name_calculations')) {
33
+ if (!actions.isRangeAnnotatable(range)) {
34
+ return undefined;
35
+ }
36
36
  return getRendererRangeInlineNodeNames({
37
37
  pos: documentPosition,
38
38
  actions: actions
39
39
  });
40
40
  } else {
41
- return undefined;
41
+ if (!fg('editor_inline_comments_on_inline_nodes')) {
42
+ return undefined;
43
+ }
44
+ if (actions.isValidAnnotationRange(range)) {
45
+ return getRendererRangeInlineNodeNames({
46
+ pos: documentPosition,
47
+ actions: actions
48
+ });
49
+ } else {
50
+ return undefined;
51
+ }
42
52
  }
43
53
  }, [documentPosition, actions, range]);
44
54
  var onCreateCallback = useCallback(function (annotationId) {
@@ -51,6 +51,12 @@ export default class RendererActions implements RendererActionsOptions, Annotati
51
51
  };
52
52
  annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
53
53
  isValidAnnotationRange(range: Range | null): boolean;
54
+ isRangeAnnotatable(range: Range | null): boolean;
55
+ /**
56
+ * This is replaced by `isRangeAnnotatable`.
57
+ *
58
+ * @deprecated
59
+ **/
54
60
  isRendererWithinRange(range: Range): boolean;
55
61
  isValidAnnotationPosition(pos: Position): boolean;
56
62
  /**
@@ -1,4 +1,3 @@
1
- import type { Theme } from '@emotion/react';
2
1
  import type { RendererAppearance } from './types';
3
2
  export declare const FullPagePadding = 32;
4
3
  export type RendererWrapperProps = {
@@ -14,4 +13,4 @@ export declare const headingSizes: {
14
13
  [key: string]: number;
15
14
  };
16
15
  };
17
- export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: Theme) => import("@emotion/react").SerializedStyles;
16
+ export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: any) => import("@emotion/react").SerializedStyles;
@@ -51,6 +51,12 @@ export default class RendererActions implements RendererActionsOptions, Annotati
51
51
  };
52
52
  annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
53
53
  isValidAnnotationRange(range: Range | null): boolean;
54
+ isRangeAnnotatable(range: Range | null): boolean;
55
+ /**
56
+ * This is replaced by `isRangeAnnotatable`.
57
+ *
58
+ * @deprecated
59
+ **/
54
60
  isRendererWithinRange(range: Range): boolean;
55
61
  isValidAnnotationPosition(pos: Position): boolean;
56
62
  /**
@@ -1,4 +1,3 @@
1
- import type { Theme } from '@emotion/react';
2
1
  import type { RendererAppearance } from './types';
3
2
  export declare const FullPagePadding = 32;
4
3
  export type RendererWrapperProps = {
@@ -14,4 +13,4 @@ export declare const headingSizes: {
14
13
  [key: string]: number;
15
14
  };
16
15
  };
17
- export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: Theme) => import("@emotion/react").SerializedStyles;
16
+ export declare const rendererStyles: (wrapperProps: RendererWrapperProps) => (theme: any) => import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.42.4",
3
+ "version": "109.42.6",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,9 +29,9 @@
29
29
  "@atlaskit/analytics-listeners": "^8.10.0",
30
30
  "@atlaskit/analytics-namespaced-context": "^6.10.0",
31
31
  "@atlaskit/analytics-next": "^9.3.0",
32
- "@atlaskit/button": "^18.4.0",
32
+ "@atlaskit/button": "^19.0.0",
33
33
  "@atlaskit/code": "^15.4.0",
34
- "@atlaskit/editor-common": "^86.2.0",
34
+ "@atlaskit/editor-common": "^86.3.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.15.0",
36
36
  "@atlaskit/editor-palette": "1.6.0",
37
37
  "@atlaskit/editor-prosemirror": "4.0.1",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/status": "^1.4.0",
53
53
  "@atlaskit/task-decision": "^17.10.0",
54
54
  "@atlaskit/theme": "^12.11.0",
55
- "@atlaskit/tokens": "^1.55.0",
55
+ "@atlaskit/tokens": "^1.56.0",
56
56
  "@atlaskit/tooltip": "^18.5.0",
57
57
  "@babel/runtime": "^7.0.0",
58
58
  "@emotion/react": "^11.7.1",
@@ -79,7 +79,7 @@
79
79
  "@atlaskit/linking-common": "^5.7.0",
80
80
  "@atlaskit/media-core": "^34.2.0",
81
81
  "@atlaskit/media-integration-test-helpers": "^3.0.0",
82
- "@atlaskit/media-test-helpers": "^33.0.0",
82
+ "@atlaskit/media-test-helpers": "^34.0.0",
83
83
  "@atlaskit/mention": "^23.2.0",
84
84
  "@atlaskit/navigation-next": "^9.0.0",
85
85
  "@atlaskit/util-data-test": "^17.9.0",
@@ -118,6 +118,9 @@
118
118
  }
119
119
  },
120
120
  "platform-feature-flags": {
121
+ "annotations_defensive_node_name_calculations": {
122
+ "type": "boolean"
123
+ },
121
124
  "platform.media-experience.media-viewer-v2_hgsii": {
122
125
  "type": "boolean",
123
126
  "referenceOnly": "true"
@@ -140,6 +143,9 @@
140
143
  "platform.editor.table.allow-table-alignment": {
141
144
  "type": "boolean"
142
145
  },
146
+ "annotations_align_editor_and_renderer_styles": {
147
+ "type": "boolean"
148
+ },
143
149
  "platform.comments-on-media.bug.incorrect-badge-highlight": {
144
150
  "type": "boolean"
145
151
  }