@atlaskit/renderer 114.11.0 → 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 +12 -0
- package/dist/cjs/actions/index.js +165 -3
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +11 -8
- package/dist/cjs/ui/annotations/selection/mounter.js +16 -0
- package/dist/es2019/actions/index.js +163 -1
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +9 -8
- package/dist/es2019/ui/annotations/selection/mounter.js +16 -0
- package/dist/esm/actions/index.js +165 -3
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/esm/ui/Renderer/index.js +11 -8
- package/dist/esm/ui/annotations/selection/mounter.js +16 -0
- package/dist/types/actions/index.d.ts +1 -0
- package/dist/types-ts4.5/actions/index.d.ts +1 -0
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 114.11.0
|
|
4
16
|
|
|
5
17
|
### Minor 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
|
-
|
|
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:
|
|
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);
|
|
@@ -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:
|
|
242
|
+
display: 'block'
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
});
|
|
@@ -59,7 +59,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
59
59
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
60
60
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
61
61
|
var packageName = "@atlaskit/renderer";
|
|
62
|
-
var packageVersion = "114.11.
|
|
62
|
+
var packageVersion = "114.11.1";
|
|
63
63
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size',
|
|
@@ -369,8 +369,11 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
369
369
|
// having a dependency array means we run stopMeasure twice per render
|
|
370
370
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
371
371
|
}, []);
|
|
372
|
+
var rendererContext = (0, _react.useMemo)(function () {
|
|
373
|
+
return createRendererContext(props.featureFlags, props.isTopLevelRenderer);
|
|
374
|
+
}, [props.featureFlags, props.isTopLevelRenderer, createRendererContext]);
|
|
372
375
|
try {
|
|
373
|
-
var
|
|
376
|
+
var _rendererContext$feat, _props$media;
|
|
374
377
|
var schema = getSchema(props.schema, props.adfStage);
|
|
375
378
|
var _renderDocument = (0, _.renderDocument)(props.shouldRemoveEmptySpaceAroundContent ? (0, _rendererHelper.removeEmptySpaceAroundContent)(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation),
|
|
376
379
|
result = _renderDocument.result,
|
|
@@ -380,7 +383,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
380
383
|
props.onComplete(stat);
|
|
381
384
|
}
|
|
382
385
|
var rendererOutput = (0, _react2.jsx)(_rendererContext.RendererContextProvider, {
|
|
383
|
-
value:
|
|
386
|
+
value: rendererContext
|
|
384
387
|
}, (0, _react2.jsx)(_activeHeaderIdProvider.ActiveHeaderIdProvider, {
|
|
385
388
|
value: (0, _links.getActiveHeadingId)(props.allowHeadingAnchorLinks)
|
|
386
389
|
}, (0, _react2.jsx)(_analyticsContext.default.Provider, {
|
|
@@ -400,7 +403,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
400
403
|
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
401
404
|
allowCustomPanels: props.allowCustomPanels,
|
|
402
405
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
403
|
-
useBlockRenderForCodeBlock: (
|
|
406
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat !== void 0 ? _rendererContext$feat : true,
|
|
404
407
|
addTelepointer: props.addTelepointer,
|
|
405
408
|
innerRef: editorRef,
|
|
406
409
|
onClick: function onClick(event) {
|
|
@@ -409,7 +412,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
409
412
|
onMouseDown: onMouseDownEditView,
|
|
410
413
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
411
414
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
412
|
-
isTopLevelRenderer:
|
|
415
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
413
416
|
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
414
417
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? (0, _react2.jsx)(_breakoutSsr.BreakoutSSRInlineScript, {
|
|
415
418
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
@@ -424,7 +427,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
424
427
|
}, rendererOutput) : rendererOutput;
|
|
425
428
|
return (0, _react2.jsx)(_react.Fragment, null, rendererResult);
|
|
426
429
|
} catch (e) {
|
|
427
|
-
var
|
|
430
|
+
var _rendererContext$feat2;
|
|
428
431
|
if (props.onError) {
|
|
429
432
|
props.onError(e);
|
|
430
433
|
}
|
|
@@ -436,12 +439,12 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
436
439
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
437
440
|
allowColumnSorting: props.allowColumnSorting,
|
|
438
441
|
allowNestedHeaderLinks: (0, _links.isNestedHeaderLinksEnabled)(props.allowHeadingAnchorLinks),
|
|
439
|
-
useBlockRenderForCodeBlock: (
|
|
442
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat2 = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat2 !== void 0 ? _rendererContext$feat2 : true,
|
|
440
443
|
addTelepointer: props.addTelepointer,
|
|
441
444
|
onClick: function onClick(event) {
|
|
442
445
|
return handleWrapperOnClick(event, props, mouseDownSelection);
|
|
443
446
|
},
|
|
444
|
-
isTopLevelRenderer:
|
|
447
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
445
448
|
}, (0, _react2.jsx)(_ui.UnsupportedBlock, null));
|
|
446
449
|
}
|
|
447
450
|
};
|
|
@@ -63,6 +63,22 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
63
63
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
64
64
|
var positionToAnnotate = draftDocumentPosition || documentPosition;
|
|
65
65
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
66
|
+
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
67
|
+
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
68
|
+
if (createAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
69
|
+
createAnalyticsEvent({
|
|
70
|
+
action: 'failed',
|
|
71
|
+
actionSubject: 'applyAnnotation',
|
|
72
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
73
|
+
attributes: {
|
|
74
|
+
reason: 'Annotation Position invalid',
|
|
75
|
+
draftDocumentPosition: draftDocumentPosition,
|
|
76
|
+
documentPosition: documentPosition,
|
|
77
|
+
applyAnnotation: !!applyAnnotation
|
|
78
|
+
},
|
|
79
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
80
|
+
}).fire(_types.FabricChannel.editor);
|
|
81
|
+
}
|
|
66
82
|
return false;
|
|
67
83
|
}
|
|
68
84
|
|
|
@@ -19,6 +19,56 @@ export default class RendererActions {
|
|
|
19
19
|
// This module can only be used when wrapped with
|
|
20
20
|
// the <RendererContext> component for now.
|
|
21
21
|
_defineProperty(this, "initFromContext", false);
|
|
22
|
+
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
23
|
+
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
24
|
+
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
25
|
+
// the annotation cannot be applied to the range.
|
|
26
|
+
_defineProperty(this, "_privateWhyCannotApplyAnnotationOnRange", (pos, doc, schema) => {
|
|
27
|
+
const {
|
|
28
|
+
from,
|
|
29
|
+
to
|
|
30
|
+
} = pos;
|
|
31
|
+
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
32
|
+
return 'position invalid';
|
|
33
|
+
}
|
|
34
|
+
const reasons = [];
|
|
35
|
+
doc.nodesBetween(from, to, (node, _pos, parent) => {
|
|
36
|
+
// Special exception for hardBreak nodes
|
|
37
|
+
if (schema.nodes.hardBreak === node.type) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// For block elements or text nodes, we want to check
|
|
42
|
+
// if annotations are allowed inside this tree
|
|
43
|
+
// or if we're leaf and not text
|
|
44
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
45
|
+
const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
46
|
+
if (node.isInline && !node.isText && !isAllowedInlineNode) {
|
|
47
|
+
reasons.push(`Err 1 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
48
|
+
return false;
|
|
49
|
+
} else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
|
|
50
|
+
reasons.push(`Err 2 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
51
|
+
return false;
|
|
52
|
+
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
53
|
+
reasons.push(`Err 3 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}, parent: ${parent === null || parent === void 0 ? void 0 : parent.type.name}`);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (node.isInline && !node.isText) {
|
|
58
|
+
reasons.push(`Err 4 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
59
|
+
return false;
|
|
60
|
+
} else if (node.isLeaf && !node.isText) {
|
|
61
|
+
reasons.push(`Err 5 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
62
|
+
return false;
|
|
63
|
+
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
64
|
+
reasons.push(`Err 6 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}, parent: ${parent === null || parent === void 0 ? void 0 : parent.type.name}`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
return reasons.join(', ');
|
|
71
|
+
});
|
|
22
72
|
this.initFromContext = initFromContext;
|
|
23
73
|
this.transformer = new JSONTransformer();
|
|
24
74
|
}
|
|
@@ -47,16 +97,75 @@ export default class RendererActions {
|
|
|
47
97
|
*/
|
|
48
98
|
_privateValidatePositionsForAnnotation(from, to) {
|
|
49
99
|
if (!this.doc || !this.schema) {
|
|
100
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
101
|
+
this.onAnalyticsEvent({
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
action: 'failed',
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
actionSubject: 'applyAnnotation',
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
108
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
109
|
+
attributes: {
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
reason: `Annotation Position validation failed - Missing doc or schema`,
|
|
112
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
113
|
+
isDocValid: !!this.doc,
|
|
114
|
+
isSchemaValid: !!this.schema
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
50
118
|
return false;
|
|
51
119
|
}
|
|
52
120
|
const currentSelection = TextSelection.create(this.doc, from, to);
|
|
53
121
|
if (isEmptyTextSelection(currentSelection, this.schema)) {
|
|
122
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
123
|
+
this.onAnalyticsEvent({
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
action: 'failed',
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
actionSubject: 'applyAnnotation',
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
130
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
131
|
+
attributes: {
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
reason: `Annotation Position validation - Empty Text Selection`,
|
|
134
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
135
|
+
from,
|
|
136
|
+
to
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
54
140
|
return false;
|
|
55
141
|
}
|
|
56
|
-
|
|
142
|
+
const result = canApplyAnnotationOnRange({
|
|
57
143
|
from,
|
|
58
144
|
to
|
|
59
145
|
}, this.doc, this.schema);
|
|
146
|
+
if (!result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
147
|
+
this.onAnalyticsEvent({
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
action: 'failed',
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
actionSubject: 'applyAnnotation',
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
154
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
155
|
+
attributes: {
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
reason: `Annotation canApplyAnnotationOnRange failed`,
|
|
158
|
+
details: this._privateWhyCannotApplyAnnotationOnRange({
|
|
159
|
+
from,
|
|
160
|
+
to
|
|
161
|
+
}, this.doc, this.schema),
|
|
162
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
163
|
+
from,
|
|
164
|
+
to
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
60
169
|
}
|
|
61
170
|
//#endregion
|
|
62
171
|
|
|
@@ -208,6 +317,24 @@ export default class RendererActions {
|
|
|
208
317
|
}
|
|
209
318
|
isValidAnnotationPosition(pos) {
|
|
210
319
|
if (!pos || !this.doc) {
|
|
320
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
321
|
+
this.onAnalyticsEvent({
|
|
322
|
+
// @ts-ignore
|
|
323
|
+
action: 'failed',
|
|
324
|
+
// @ts-ignore
|
|
325
|
+
actionSubject: 'applyAnnotation',
|
|
326
|
+
// @ts-ignore
|
|
327
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
328
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
329
|
+
attributes: {
|
|
330
|
+
// @ts-ignore
|
|
331
|
+
reason: `Annotation Position validation failed - Missing doc or position`,
|
|
332
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
333
|
+
isPosValid: !!pos,
|
|
334
|
+
isDocValid: !!this.doc
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
211
338
|
return false;
|
|
212
339
|
}
|
|
213
340
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
@@ -265,6 +392,25 @@ export default class RendererActions {
|
|
|
265
392
|
}
|
|
266
393
|
applyAnnotation(pos, annotation) {
|
|
267
394
|
if (!this.doc || !pos || !this.schema) {
|
|
395
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
396
|
+
this.onAnalyticsEvent({
|
|
397
|
+
// @ts-ignore
|
|
398
|
+
action: 'failed',
|
|
399
|
+
// @ts-ignore
|
|
400
|
+
actionSubject: 'applyAnnotation',
|
|
401
|
+
// @ts-ignore
|
|
402
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
403
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
404
|
+
attributes: {
|
|
405
|
+
// @ts-ignore
|
|
406
|
+
reason: `Annotation applyAnnotation failed - Missing doc, position or schema`,
|
|
407
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
408
|
+
isPosValid: !!pos,
|
|
409
|
+
isDocValid: !!this.doc,
|
|
410
|
+
isSchemaValid: !!this.schema
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
268
414
|
return false;
|
|
269
415
|
}
|
|
270
416
|
const {
|
|
@@ -303,6 +449,22 @@ export default class RendererActions {
|
|
|
303
449
|
failed
|
|
304
450
|
} = step.apply(this.doc);
|
|
305
451
|
if (failed || !doc) {
|
|
452
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
453
|
+
this.onAnalyticsEvent({
|
|
454
|
+
// @ts-ignore
|
|
455
|
+
action: 'failed',
|
|
456
|
+
// @ts-ignore
|
|
457
|
+
actionSubject: 'applyAnnotation',
|
|
458
|
+
// @ts-ignore
|
|
459
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
460
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
461
|
+
attributes: {
|
|
462
|
+
// @ts-ignore
|
|
463
|
+
reason: `Annotation applyAnnotation failed - ${failed}`,
|
|
464
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes')
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
306
468
|
return false;
|
|
307
469
|
}
|
|
308
470
|
const originalSelection = doc.textBetween(from, to);
|
|
@@ -300,7 +300,7 @@ const blockquoteSharedStyles = css({
|
|
|
300
300
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
301
301
|
'> .extensionView-content-wrap:last-child': {
|
|
302
302
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
303
|
-
display:
|
|
303
|
+
display: 'block'
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
});
|
|
@@ -46,7 +46,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
46
46
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
47
47
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
48
48
|
const packageName = "@atlaskit/renderer";
|
|
49
|
-
const packageVersion = "114.11.
|
|
49
|
+
const packageVersion = "114.11.1";
|
|
50
50
|
const setAsQueryContainerStyles = css({
|
|
51
51
|
containerName: 'ak-renderer-wrapper',
|
|
52
52
|
containerType: 'inline-size',
|
|
@@ -361,8 +361,9 @@ export const RendererFunctionalComponent = props => {
|
|
|
361
361
|
// having a dependency array means we run stopMeasure twice per render
|
|
362
362
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
363
363
|
}, []);
|
|
364
|
+
const rendererContext = useMemo(() => createRendererContext(props.featureFlags, props.isTopLevelRenderer), [props.featureFlags, props.isTopLevelRenderer, createRendererContext]);
|
|
364
365
|
try {
|
|
365
|
-
var
|
|
366
|
+
var _rendererContext$feat, _props$media;
|
|
366
367
|
const schema = getSchema(props.schema, props.adfStage);
|
|
367
368
|
const {
|
|
368
369
|
result,
|
|
@@ -373,7 +374,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
373
374
|
props.onComplete(stat);
|
|
374
375
|
}
|
|
375
376
|
const rendererOutput = jsx(RendererContextProvider, {
|
|
376
|
-
value:
|
|
377
|
+
value: rendererContext
|
|
377
378
|
}, jsx(ActiveHeaderIdProvider, {
|
|
378
379
|
value: getActiveHeadingId(props.allowHeadingAnchorLinks)
|
|
379
380
|
}, jsx(AnalyticsContext.Provider, {
|
|
@@ -391,14 +392,14 @@ export const RendererFunctionalComponent = props => {
|
|
|
391
392
|
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
392
393
|
allowCustomPanels: props.allowCustomPanels,
|
|
393
394
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
394
|
-
useBlockRenderForCodeBlock: (
|
|
395
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat !== void 0 ? _rendererContext$feat : true,
|
|
395
396
|
addTelepointer: props.addTelepointer,
|
|
396
397
|
innerRef: editorRef,
|
|
397
398
|
onClick: event => handleWrapperOnClick(event, props, mouseDownSelection),
|
|
398
399
|
onMouseDown: onMouseDownEditView,
|
|
399
400
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
400
401
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
401
|
-
isTopLevelRenderer:
|
|
402
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
402
403
|
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
403
404
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? jsx(BreakoutSSRInlineScript, {
|
|
404
405
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
@@ -413,7 +414,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
413
414
|
}, rendererOutput) : rendererOutput;
|
|
414
415
|
return jsx(Fragment, null, rendererResult);
|
|
415
416
|
} catch (e) {
|
|
416
|
-
var
|
|
417
|
+
var _rendererContext$feat2;
|
|
417
418
|
if (props.onError) {
|
|
418
419
|
props.onError(e);
|
|
419
420
|
}
|
|
@@ -425,10 +426,10 @@ export const RendererFunctionalComponent = props => {
|
|
|
425
426
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
426
427
|
allowColumnSorting: props.allowColumnSorting,
|
|
427
428
|
allowNestedHeaderLinks: isNestedHeaderLinksEnabled(props.allowHeadingAnchorLinks),
|
|
428
|
-
useBlockRenderForCodeBlock: (
|
|
429
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat2 = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat2 !== void 0 ? _rendererContext$feat2 : true,
|
|
429
430
|
addTelepointer: props.addTelepointer,
|
|
430
431
|
onClick: event => handleWrapperOnClick(event, props, mouseDownSelection),
|
|
431
|
-
isTopLevelRenderer:
|
|
432
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
432
433
|
}, jsx(UnsupportedBlock, null));
|
|
433
434
|
}
|
|
434
435
|
};
|
|
@@ -51,6 +51,22 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
51
51
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
52
52
|
const positionToAnnotate = draftDocumentPosition || documentPosition;
|
|
53
53
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
54
|
+
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
55
|
+
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
56
|
+
if (createAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
57
|
+
createAnalyticsEvent({
|
|
58
|
+
action: 'failed',
|
|
59
|
+
actionSubject: 'applyAnnotation',
|
|
60
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
61
|
+
attributes: {
|
|
62
|
+
reason: 'Annotation Position invalid',
|
|
63
|
+
draftDocumentPosition,
|
|
64
|
+
documentPosition,
|
|
65
|
+
applyAnnotation: !!applyAnnotation
|
|
66
|
+
},
|
|
67
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
68
|
+
}).fire(FabricChannel.editor);
|
|
69
|
+
}
|
|
54
70
|
return false;
|
|
55
71
|
}
|
|
56
72
|
|
|
@@ -26,6 +26,54 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
26
26
|
// This module can only be used when wrapped with
|
|
27
27
|
// the <RendererContext> component for now.
|
|
28
28
|
_defineProperty(this, "initFromContext", false);
|
|
29
|
+
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
30
|
+
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
31
|
+
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
32
|
+
// the annotation cannot be applied to the range.
|
|
33
|
+
_defineProperty(this, "_privateWhyCannotApplyAnnotationOnRange", function (pos, doc, schema) {
|
|
34
|
+
var from = pos.from,
|
|
35
|
+
to = pos.to;
|
|
36
|
+
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
37
|
+
return 'position invalid';
|
|
38
|
+
}
|
|
39
|
+
var reasons = [];
|
|
40
|
+
doc.nodesBetween(from, to, function (node, _pos, parent) {
|
|
41
|
+
// Special exception for hardBreak nodes
|
|
42
|
+
if (schema.nodes.hardBreak === node.type) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// For block elements or text nodes, we want to check
|
|
47
|
+
// if annotations are allowed inside this tree
|
|
48
|
+
// or if we're leaf and not text
|
|
49
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
50
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
51
|
+
if (node.isInline && !node.isText && !isAllowedInlineNode) {
|
|
52
|
+
reasons.push("Err 1 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
53
|
+
return false;
|
|
54
|
+
} else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
|
|
55
|
+
reasons.push("Err 2 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
56
|
+
return false;
|
|
57
|
+
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
58
|
+
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));
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
if (node.isInline && !node.isText) {
|
|
63
|
+
reasons.push("Err 4 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
64
|
+
return false;
|
|
65
|
+
} else if (node.isLeaf && !node.isText) {
|
|
66
|
+
reasons.push("Err 5 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
67
|
+
return false;
|
|
68
|
+
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
69
|
+
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));
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
75
|
+
return reasons.join(', ');
|
|
76
|
+
});
|
|
29
77
|
this.initFromContext = initFromContext;
|
|
30
78
|
this.transformer = new JSONTransformer();
|
|
31
79
|
}
|
|
@@ -60,21 +108,82 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
60
108
|
key: "_privateValidatePositionsForAnnotation",
|
|
61
109
|
value: function _privateValidatePositionsForAnnotation(from, to) {
|
|
62
110
|
if (!this.doc || !this.schema) {
|
|
111
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
112
|
+
this.onAnalyticsEvent({
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
action: 'failed',
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
actionSubject: 'applyAnnotation',
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
119
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
120
|
+
attributes: {
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
reason: "Annotation Position validation failed - Missing doc or schema",
|
|
123
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
124
|
+
isDocValid: !!this.doc,
|
|
125
|
+
isSchemaValid: !!this.schema
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
63
129
|
return false;
|
|
64
130
|
}
|
|
65
131
|
var currentSelection = TextSelection.create(this.doc, from, to);
|
|
66
132
|
if (isEmptyTextSelection(currentSelection, this.schema)) {
|
|
133
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
134
|
+
this.onAnalyticsEvent({
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
action: 'failed',
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
actionSubject: 'applyAnnotation',
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
141
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
142
|
+
attributes: {
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
reason: "Annotation Position validation - Empty Text Selection",
|
|
145
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
146
|
+
from: from,
|
|
147
|
+
to: to
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
67
151
|
return false;
|
|
68
152
|
}
|
|
69
|
-
|
|
153
|
+
var result = canApplyAnnotationOnRange({
|
|
70
154
|
from: from,
|
|
71
155
|
to: to
|
|
72
156
|
}, this.doc, this.schema);
|
|
157
|
+
if (!result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
158
|
+
this.onAnalyticsEvent({
|
|
159
|
+
// @ts-ignore
|
|
160
|
+
action: 'failed',
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
actionSubject: 'applyAnnotation',
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
165
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
166
|
+
attributes: {
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
reason: "Annotation canApplyAnnotationOnRange failed",
|
|
169
|
+
details: this._privateWhyCannotApplyAnnotationOnRange({
|
|
170
|
+
from: from,
|
|
171
|
+
to: to
|
|
172
|
+
}, this.doc, this.schema),
|
|
173
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
174
|
+
from: from,
|
|
175
|
+
to: to
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
73
180
|
}
|
|
74
|
-
//#endregion
|
|
75
181
|
}, {
|
|
76
182
|
key: "deleteAnnotation",
|
|
77
|
-
value:
|
|
183
|
+
value:
|
|
184
|
+
//#endregion
|
|
185
|
+
|
|
186
|
+
function deleteAnnotation(annotationId, annotationType) {
|
|
78
187
|
if (!this.doc || !this.schema || !this.schema.marks.annotation) {
|
|
79
188
|
return false;
|
|
80
189
|
}
|
|
@@ -225,6 +334,24 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
225
334
|
key: "isValidAnnotationPosition",
|
|
226
335
|
value: function isValidAnnotationPosition(pos) {
|
|
227
336
|
if (!pos || !this.doc) {
|
|
337
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
338
|
+
this.onAnalyticsEvent({
|
|
339
|
+
// @ts-ignore
|
|
340
|
+
action: 'failed',
|
|
341
|
+
// @ts-ignore
|
|
342
|
+
actionSubject: 'applyAnnotation',
|
|
343
|
+
// @ts-ignore
|
|
344
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
345
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
346
|
+
attributes: {
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
reason: "Annotation Position validation failed - Missing doc or position",
|
|
349
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
350
|
+
isPosValid: !!pos,
|
|
351
|
+
isDocValid: !!this.doc
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
228
355
|
return false;
|
|
229
356
|
}
|
|
230
357
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
@@ -286,6 +413,25 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
286
413
|
key: "applyAnnotation",
|
|
287
414
|
value: function applyAnnotation(pos, annotation) {
|
|
288
415
|
if (!this.doc || !pos || !this.schema) {
|
|
416
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
417
|
+
this.onAnalyticsEvent({
|
|
418
|
+
// @ts-ignore
|
|
419
|
+
action: 'failed',
|
|
420
|
+
// @ts-ignore
|
|
421
|
+
actionSubject: 'applyAnnotation',
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
424
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
425
|
+
attributes: {
|
|
426
|
+
// @ts-ignore
|
|
427
|
+
reason: "Annotation applyAnnotation failed - Missing doc, position or schema",
|
|
428
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
429
|
+
isPosValid: !!pos,
|
|
430
|
+
isDocValid: !!this.doc,
|
|
431
|
+
isSchemaValid: !!this.schema
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
}
|
|
289
435
|
return false;
|
|
290
436
|
}
|
|
291
437
|
var from = pos.from,
|
|
@@ -319,6 +465,22 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
319
465
|
doc = _step$apply2.doc,
|
|
320
466
|
failed = _step$apply2.failed;
|
|
321
467
|
if (failed || !doc) {
|
|
468
|
+
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
469
|
+
this.onAnalyticsEvent({
|
|
470
|
+
// @ts-ignore
|
|
471
|
+
action: 'failed',
|
|
472
|
+
// @ts-ignore
|
|
473
|
+
actionSubject: 'applyAnnotation',
|
|
474
|
+
// @ts-ignore
|
|
475
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
476
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
477
|
+
attributes: {
|
|
478
|
+
// @ts-ignore
|
|
479
|
+
reason: "Annotation applyAnnotation failed - ".concat(failed),
|
|
480
|
+
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes')
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
322
484
|
return false;
|
|
323
485
|
}
|
|
324
486
|
var originalSelection = doc.textBetween(from, to);
|
|
@@ -232,7 +232,7 @@ var blockquoteSharedStyles = css({
|
|
|
232
232
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
233
233
|
'> .extensionView-content-wrap:last-child': {
|
|
234
234
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
235
|
-
display:
|
|
235
|
+
display: 'block'
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
});
|
|
@@ -49,7 +49,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
49
49
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
50
50
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
51
51
|
var packageName = "@atlaskit/renderer";
|
|
52
|
-
var packageVersion = "114.11.
|
|
52
|
+
var packageVersion = "114.11.1";
|
|
53
53
|
var setAsQueryContainerStyles = css({
|
|
54
54
|
containerName: 'ak-renderer-wrapper',
|
|
55
55
|
containerType: 'inline-size',
|
|
@@ -359,8 +359,11 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
359
359
|
// having a dependency array means we run stopMeasure twice per render
|
|
360
360
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
361
361
|
}, []);
|
|
362
|
+
var rendererContext = useMemo(function () {
|
|
363
|
+
return createRendererContext(props.featureFlags, props.isTopLevelRenderer);
|
|
364
|
+
}, [props.featureFlags, props.isTopLevelRenderer, createRendererContext]);
|
|
362
365
|
try {
|
|
363
|
-
var
|
|
366
|
+
var _rendererContext$feat, _props$media;
|
|
364
367
|
var schema = getSchema(props.schema, props.adfStage);
|
|
365
368
|
var _renderDocument = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation),
|
|
366
369
|
result = _renderDocument.result,
|
|
@@ -370,7 +373,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
370
373
|
props.onComplete(stat);
|
|
371
374
|
}
|
|
372
375
|
var rendererOutput = jsx(RendererContextProvider, {
|
|
373
|
-
value:
|
|
376
|
+
value: rendererContext
|
|
374
377
|
}, jsx(ActiveHeaderIdProvider, {
|
|
375
378
|
value: getActiveHeadingId(props.allowHeadingAnchorLinks)
|
|
376
379
|
}, jsx(AnalyticsContext.Provider, {
|
|
@@ -390,7 +393,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
390
393
|
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
391
394
|
allowCustomPanels: props.allowCustomPanels,
|
|
392
395
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
393
|
-
useBlockRenderForCodeBlock: (
|
|
396
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat !== void 0 ? _rendererContext$feat : true,
|
|
394
397
|
addTelepointer: props.addTelepointer,
|
|
395
398
|
innerRef: editorRef,
|
|
396
399
|
onClick: function onClick(event) {
|
|
@@ -399,7 +402,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
399
402
|
onMouseDown: onMouseDownEditView,
|
|
400
403
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
401
404
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
402
|
-
isTopLevelRenderer:
|
|
405
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
403
406
|
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
404
407
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? jsx(BreakoutSSRInlineScript, {
|
|
405
408
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
@@ -414,7 +417,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
414
417
|
}, rendererOutput) : rendererOutput;
|
|
415
418
|
return jsx(Fragment, null, rendererResult);
|
|
416
419
|
} catch (e) {
|
|
417
|
-
var
|
|
420
|
+
var _rendererContext$feat2;
|
|
418
421
|
if (props.onError) {
|
|
419
422
|
props.onError(e);
|
|
420
423
|
}
|
|
@@ -426,12 +429,12 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
426
429
|
allowPlaceholderText: props.allowPlaceholderText,
|
|
427
430
|
allowColumnSorting: props.allowColumnSorting,
|
|
428
431
|
allowNestedHeaderLinks: isNestedHeaderLinksEnabled(props.allowHeadingAnchorLinks),
|
|
429
|
-
useBlockRenderForCodeBlock: (
|
|
432
|
+
useBlockRenderForCodeBlock: (_rendererContext$feat2 = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat2 !== void 0 ? _rendererContext$feat2 : true,
|
|
430
433
|
addTelepointer: props.addTelepointer,
|
|
431
434
|
onClick: function onClick(event) {
|
|
432
435
|
return handleWrapperOnClick(event, props, mouseDownSelection);
|
|
433
436
|
},
|
|
434
|
-
isTopLevelRenderer:
|
|
437
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
435
438
|
}, jsx(UnsupportedBlock, null));
|
|
436
439
|
}
|
|
437
440
|
};
|
|
@@ -53,6 +53,22 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
53
53
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
54
54
|
var positionToAnnotate = draftDocumentPosition || documentPosition;
|
|
55
55
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
56
|
+
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
57
|
+
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
58
|
+
if (createAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
59
|
+
createAnalyticsEvent({
|
|
60
|
+
action: 'failed',
|
|
61
|
+
actionSubject: 'applyAnnotation',
|
|
62
|
+
actionSubjectId: 'inlineCommentFailureReason',
|
|
63
|
+
attributes: {
|
|
64
|
+
reason: 'Annotation Position invalid',
|
|
65
|
+
draftDocumentPosition: draftDocumentPosition,
|
|
66
|
+
documentPosition: documentPosition,
|
|
67
|
+
applyAnnotation: !!applyAnnotation
|
|
68
|
+
},
|
|
69
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
70
|
+
}).fire(FabricChannel.editor);
|
|
71
|
+
}
|
|
56
72
|
return false;
|
|
57
73
|
}
|
|
58
74
|
|
|
@@ -45,6 +45,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
45
45
|
* Validate whether we can create an annotation between two positions
|
|
46
46
|
*/
|
|
47
47
|
_privateValidatePositionsForAnnotation(from: number, to: number): boolean;
|
|
48
|
+
_privateWhyCannotApplyAnnotationOnRange: (pos: Position, doc: Node, schema: Schema) => string;
|
|
48
49
|
deleteAnnotation(annotationId: string, annotationType: 'inlineComment'): false | {
|
|
49
50
|
step: Step;
|
|
50
51
|
doc: JSONDocNode;
|
|
@@ -45,6 +45,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
45
45
|
* Validate whether we can create an annotation between two positions
|
|
46
46
|
*/
|
|
47
47
|
_privateValidatePositionsForAnnotation(from: number, to: number): boolean;
|
|
48
|
+
_privateWhyCannotApplyAnnotationOnRange: (pos: Position, doc: Node, schema: Schema) => string;
|
|
48
49
|
deleteAnnotation(annotationId: string, annotationType: 'inlineComment'): false | {
|
|
49
50
|
step: Step;
|
|
50
51
|
doc: JSONDocNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "114.11.
|
|
3
|
+
"version": "114.11.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
32
32
|
"@atlaskit/button": "^23.0.0",
|
|
33
|
-
"@atlaskit/code": "^17.
|
|
34
|
-
"@atlaskit/editor-common": "^103.
|
|
33
|
+
"@atlaskit/code": "^17.1.0",
|
|
34
|
+
"@atlaskit/editor-common": "^103.19.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",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@atlaskit/media-viewer": "^52.0.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
51
|
"@atlaskit/platform-feature-flags-react": "^0.1.0",
|
|
52
|
-
"@atlaskit/react-ufo": "^3.
|
|
53
|
-
"@atlaskit/smart-card": "^36.
|
|
52
|
+
"@atlaskit/react-ufo": "^3.8.0",
|
|
53
|
+
"@atlaskit/smart-card": "^36.11.0",
|
|
54
54
|
"@atlaskit/status": "^3.0.0",
|
|
55
|
-
"@atlaskit/task-decision": "^19.
|
|
55
|
+
"@atlaskit/task-decision": "^19.2.0",
|
|
56
56
|
"@atlaskit/theme": "^18.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^4.15.0",
|
|
58
58
|
"@atlaskit/tokens": "^4.8.0",
|
|
59
59
|
"@atlaskit/tooltip": "^20.0.0",
|
|
60
60
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -123,6 +123,9 @@
|
|
|
123
123
|
"cc_complexit_fe_improve_table_sorting": {
|
|
124
124
|
"type": "boolean"
|
|
125
125
|
},
|
|
126
|
+
"platform_renderer_annotations_create_debug_logging": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
126
129
|
"platform_editor_annotation_position_comment_nodes": {
|
|
127
130
|
"type": "boolean"
|
|
128
131
|
},
|