@atlaskit/renderer 114.10.2 → 114.11.1

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,25 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 114.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147372](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147372)
8
+ [`9a77b2e8909a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9a77b2e8909a2) -
9
+ Adding anlytics to help identify root cause of why annotaiton are not applied on some ranges
10
+ - [#147400](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147400)
11
+ [`800ff50276ed7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/800ff50276ed7) -
12
+ Clean up experiment platform_editor_nested_non_bodied_macros
13
+ - Updated dependencies
14
+
15
+ ## 114.11.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#143555](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143555)
20
+ [`2827fa6f5b8d9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2827fa6f5b8d9) -
21
+ Updated embed card to support SSR
22
+
3
23
  ## 114.10.2
4
24
 
5
25
  ### Patch Changes
@@ -33,6 +33,54 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
33
33
  // This module can only be used when wrapped with
34
34
  // the <RendererContext> component for now.
35
35
  (0, _defineProperty2.default)(this, "initFromContext", false);
36
+ // TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
37
+ // has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
38
+ // This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
39
+ // the annotation cannot be applied to the range.
40
+ (0, _defineProperty2.default)(this, "_privateWhyCannotApplyAnnotationOnRange", function (pos, doc, schema) {
41
+ var from = pos.from,
42
+ to = pos.to;
43
+ if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
44
+ return 'position invalid';
45
+ }
46
+ var reasons = [];
47
+ doc.nodesBetween(from, to, function (node, _pos, parent) {
48
+ // Special exception for hardBreak nodes
49
+ if (schema.nodes.hardBreak === node.type) {
50
+ return false;
51
+ }
52
+
53
+ // For block elements or text nodes, we want to check
54
+ // if annotations are allowed inside this tree
55
+ // or if we're leaf and not text
56
+ if ((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
57
+ var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
58
+ if (node.isInline && !node.isText && !isAllowedInlineNode) {
59
+ reasons.push("Err 1 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
60
+ return false;
61
+ } else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
62
+ reasons.push("Err 2 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
63
+ return false;
64
+ } else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
65
+ reasons.push("Err 3 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf, ", parent: ").concat(parent === null || parent === void 0 ? void 0 : parent.type.name));
66
+ return false;
67
+ }
68
+ } else {
69
+ if (node.isInline && !node.isText) {
70
+ reasons.push("Err 4 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
71
+ return false;
72
+ } else if (node.isLeaf && !node.isText) {
73
+ reasons.push("Err 5 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
74
+ return false;
75
+ } else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
76
+ reasons.push("Err 6 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf, ", parent: ").concat(parent === null || parent === void 0 ? void 0 : parent.type.name));
77
+ return false;
78
+ }
79
+ }
80
+ return true;
81
+ });
82
+ return reasons.join(', ');
83
+ });
36
84
  this.initFromContext = initFromContext;
37
85
  this.transformer = new _editorJsonTransformer.JSONTransformer();
38
86
  }
@@ -67,21 +115,82 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
67
115
  key: "_privateValidatePositionsForAnnotation",
68
116
  value: function _privateValidatePositionsForAnnotation(from, to) {
69
117
  if (!this.doc || !this.schema) {
118
+ if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
119
+ this.onAnalyticsEvent({
120
+ // @ts-ignore
121
+ action: 'failed',
122
+ // @ts-ignore
123
+ actionSubject: 'applyAnnotation',
124
+ // @ts-ignore
125
+ actionSubjectId: 'inlineCommentFailureReason',
126
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
127
+ attributes: {
128
+ // @ts-ignore
129
+ reason: "Annotation Position validation failed - Missing doc or schema",
130
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
131
+ isDocValid: !!this.doc,
132
+ isSchemaValid: !!this.schema
133
+ }
134
+ });
135
+ }
70
136
  return false;
71
137
  }
72
138
  var currentSelection = _state.TextSelection.create(this.doc, from, to);
73
139
  if ((0, _utils.isEmptyTextSelection)(currentSelection, this.schema)) {
140
+ if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
141
+ this.onAnalyticsEvent({
142
+ // @ts-ignore
143
+ action: 'failed',
144
+ // @ts-ignore
145
+ actionSubject: 'applyAnnotation',
146
+ // @ts-ignore
147
+ actionSubjectId: 'inlineCommentFailureReason',
148
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
149
+ attributes: {
150
+ // @ts-ignore
151
+ reason: "Annotation Position validation - Empty Text Selection",
152
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
153
+ from: from,
154
+ to: to
155
+ }
156
+ });
157
+ }
74
158
  return false;
75
159
  }
76
- return (0, _utils.canApplyAnnotationOnRange)({
160
+ var result = (0, _utils.canApplyAnnotationOnRange)({
77
161
  from: from,
78
162
  to: to
79
163
  }, this.doc, this.schema);
164
+ if (!result && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
165
+ this.onAnalyticsEvent({
166
+ // @ts-ignore
167
+ action: 'failed',
168
+ // @ts-ignore
169
+ actionSubject: 'applyAnnotation',
170
+ // @ts-ignore
171
+ actionSubjectId: 'inlineCommentFailureReason',
172
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
173
+ attributes: {
174
+ // @ts-ignore
175
+ reason: "Annotation canApplyAnnotationOnRange failed",
176
+ details: this._privateWhyCannotApplyAnnotationOnRange({
177
+ from: from,
178
+ to: to
179
+ }, this.doc, this.schema),
180
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
181
+ from: from,
182
+ to: to
183
+ }
184
+ });
185
+ }
186
+ return result;
80
187
  }
81
- //#endregion
82
188
  }, {
83
189
  key: "deleteAnnotation",
84
- value: function deleteAnnotation(annotationId, annotationType) {
190
+ value:
191
+ //#endregion
192
+
193
+ function deleteAnnotation(annotationId, annotationType) {
85
194
  if (!this.doc || !this.schema || !this.schema.marks.annotation) {
86
195
  return false;
87
196
  }
@@ -232,6 +341,24 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
232
341
  key: "isValidAnnotationPosition",
233
342
  value: function isValidAnnotationPosition(pos) {
234
343
  if (!pos || !this.doc) {
344
+ if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
345
+ this.onAnalyticsEvent({
346
+ // @ts-ignore
347
+ action: 'failed',
348
+ // @ts-ignore
349
+ actionSubject: 'applyAnnotation',
350
+ // @ts-ignore
351
+ actionSubjectId: 'inlineCommentFailureReason',
352
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
353
+ attributes: {
354
+ // @ts-ignore
355
+ reason: "Annotation Position validation failed - Missing doc or position",
356
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
357
+ isPosValid: !!pos,
358
+ isDocValid: !!this.doc
359
+ }
360
+ });
361
+ }
235
362
  return false;
236
363
  }
237
364
  return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
@@ -293,6 +420,25 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
293
420
  key: "applyAnnotation",
294
421
  value: function applyAnnotation(pos, annotation) {
295
422
  if (!this.doc || !pos || !this.schema) {
423
+ if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
424
+ this.onAnalyticsEvent({
425
+ // @ts-ignore
426
+ action: 'failed',
427
+ // @ts-ignore
428
+ actionSubject: 'applyAnnotation',
429
+ // @ts-ignore
430
+ actionSubjectId: 'inlineCommentFailureReason',
431
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
432
+ attributes: {
433
+ // @ts-ignore
434
+ reason: "Annotation applyAnnotation failed - Missing doc, position or schema",
435
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
436
+ isPosValid: !!pos,
437
+ isDocValid: !!this.doc,
438
+ isSchemaValid: !!this.schema
439
+ }
440
+ });
441
+ }
296
442
  return false;
297
443
  }
298
444
  var from = pos.from,
@@ -326,6 +472,22 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
326
472
  doc = _step$apply2.doc,
327
473
  failed = _step$apply2.failed;
328
474
  if (failed || !doc) {
475
+ if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
476
+ this.onAnalyticsEvent({
477
+ // @ts-ignore
478
+ action: 'failed',
479
+ // @ts-ignore
480
+ actionSubject: 'applyAnnotation',
481
+ // @ts-ignore
482
+ actionSubjectId: 'inlineCommentFailureReason',
483
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
484
+ attributes: {
485
+ // @ts-ignore
486
+ reason: "Annotation applyAnnotation failed - ".concat(failed),
487
+ commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')
488
+ }
489
+ });
490
+ }
329
491
  return false;
330
492
  }
331
493
  var originalSelection = doc.textBetween(from, to);
@@ -10,9 +10,11 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = require("@emotion/react");
11
11
  var _react2 = require("react");
12
12
  var _smartCard = require("@atlaskit/smart-card");
13
+ var _ssr = require("@atlaskit/smart-card/ssr");
13
14
  var _linkProvider = require("@atlaskit/link-provider");
14
15
  var _ui = require("@atlaskit/editor-common/ui");
15
16
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
18
  var _fallback = require("./fallback");
17
19
  var _style = require("../../ui/Renderer/style");
18
20
  var _getCardClickHandler = require("../utils/getCardClickHandler");
@@ -146,6 +148,39 @@ function EmbedCard(props) {
146
148
  throw err;
147
149
  }
148
150
  };
151
+ var cardComponent;
152
+ if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url && (0, _platformFeatureFlags.fg)('platform_ssr_smartlink_embeds')) {
153
+ var _smartLinks$frameStyl2;
154
+ var ssrCardProps = {
155
+ url: url,
156
+ onClick: onClick,
157
+ container: portal,
158
+ platform: platform,
159
+ frameStyle: (_smartLinks$frameStyl2 = smartLinks === null || smartLinks === void 0 ? void 0 : smartLinks.frameStyle) !== null && _smartLinks$frameStyl2 !== void 0 ? _smartLinks$frameStyl2 : 'show',
160
+ actionOptions: actionOptions
161
+ };
162
+ cardComponent = (0, _react.jsx)(_ssr.CardSSR, (0, _extends2.default)({
163
+ appearance: "embed"
164
+ // Ignored via go/ees005
165
+ // eslint-disable-next-line react/jsx-props-no-spreading
166
+ }, ssrCardProps, {
167
+ onResolve: onResolve,
168
+ inheritDimensions: true,
169
+ embedIframeRef: embedIframeRef,
170
+ onError: onError
171
+ }));
172
+ } else {
173
+ cardComponent = (0, _react.jsx)(_smartCard.Card, (0, _extends2.default)({
174
+ appearance: "embed"
175
+ // Ignored via go/ees005
176
+ // eslint-disable-next-line react/jsx-props-no-spreading
177
+ }, cardProps, {
178
+ onResolve: onResolve,
179
+ inheritDimensions: true,
180
+ embedIframeRef: embedIframeRef,
181
+ onError: onError
182
+ }));
183
+ }
149
184
  return (
150
185
  // Ignored via go/ees005
151
186
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -177,16 +212,7 @@ function EmbedCard(props) {
177
212
  "data-card-data": data ? JSON.stringify(data) : undefined,
178
213
  "data-card-url": url,
179
214
  "data-card-original-height": originalHeight
180
- }, (0, _react.jsx)(_smartCard.Card, (0, _extends2.default)({
181
- appearance: "embed"
182
- // Ignored via go/ees005
183
- // eslint-disable-next-line react/jsx-props-no-spreading
184
- }, cardProps, {
185
- onResolve: onResolve,
186
- inheritDimensions: true,
187
- embedIframeRef: embedIframeRef,
188
- onError: onError
189
- })))))))
215
+ }, cardComponent)))))
190
216
  );
191
217
  }));
192
218
  }
@@ -57,7 +57,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_React$Component) {
57
57
  });
58
58
  (0, _defineProperty2.default)(_this, "addColGroupWidth", function (childrenArray) {
59
59
  var _this$state$colGroupW;
60
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_column_group_width_check') ? (_this$state$colGroupW = _this.state.colGroupWidths) === null || _this$state$colGroupW === void 0 ? void 0 : _this$state$colGroupW.length : _this.state.colGroupWidths) {
60
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_column_group_width_check_3') ? (_this$state$colGroupW = _this.state.colGroupWidths) === null || _this$state$colGroupW === void 0 ? void 0 : _this$state$colGroupW.length : _this.state.colGroupWidths) {
61
61
  childrenArray = childrenArray.map(function (child, index) {
62
62
  if ( /*#__PURE__*/_react.default.isValidElement(child)) {
63
63
  return /*#__PURE__*/_react.default.cloneElement(child, {
@@ -239,7 +239,7 @@ var blockquoteSharedStyles = (0, _react.css)({
239
239
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
240
240
  '> .extensionView-content-wrap:last-child': {
241
241
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
242
- display: "".concat((0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test')) ? 'block' : 'inline-block'
242
+ display: 'block'
243
243
  }
244
244
  }
245
245
  });
@@ -472,17 +472,17 @@ var listsSharedStyles = (0, _react.css)((_css3 = {
472
472
  }
473
473
  }, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css3, "".concat(_adfSchema.orderedListSelector, ", ").concat(_adfSchema.bulletListSelector), {
474
474
  /*
475
- Ensures list item content adheres to the list's margin instead
476
- of filling the entire block row. This is important to allow
477
- clicking interactive elements which are floated next to a list.
478
- For some history and context on this block, see PRs related to tickets.:
479
- @see ED-6551 - original issue.
480
- @see ED-7015 - follow up issue.
481
- @see ED-7447 - flow-root change.
475
+ Ensures list item content adheres to the list's margin instead
476
+ of filling the entire block row. This is important to allow
477
+ clicking interactive elements which are floated next to a list.
478
+ For some history and context on this block, see PRs related to tickets.:
479
+ @see ED-6551 - original issue.
480
+ @see ED-7015 - follow up issue.
481
+ @see ED-7447 - flow-root change.
482
482
  used to have display: 'table' in tag template style but not supported in object styles
483
483
  removed display: 'table' as 'flow-root' is supported in latest browsers
484
- @see https://css-tricks.com/display-flow-root/
485
- */
484
+ @see https://css-tricks.com/display-flow-root/
485
+ */
486
486
  display: 'flow-root'
487
487
  }), 'ul, ul ul ul ul', {
488
488
  listStyleType: 'disc'
@@ -1365,7 +1365,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
1365
1365
  var isAdvancedLayoutsOn = (0, _experiments.editorExperiment)('advanced_layouts', true);
1366
1366
  if ((0, _platformFeatureFlags.fg)('platform_editor_emotion_refactor_renderer')) {
1367
1367
  return (
1368
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
1368
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
1369
1369
  (0, _react.jsx)("div", {
1370
1370
  ref: innerRef,
1371
1371
  onClick: onClick,
@@ -1392,7 +1392,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
1392
1392
  );
1393
1393
  }
1394
1394
  return (
1395
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
1395
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
1396
1396
  (0, _react.jsx)("div", {
1397
1397
  ref: innerRef,
1398
1398
  onClick: onClick,