@atlaskit/renderer 118.6.8 → 118.6.9
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 +10 -0
- package/dist/cjs/actions/index.js +7 -173
- package/dist/cjs/ui/Renderer/index.js +22 -7
- package/dist/cjs/ui/annotations/selection/mounter.js +1 -27
- package/dist/es2019/actions/index.js +5 -169
- package/dist/es2019/ui/Renderer/index.js +22 -7
- package/dist/es2019/ui/annotations/selection/mounter.js +1 -27
- package/dist/esm/actions/index.js +7 -173
- package/dist/esm/ui/Renderer/index.js +22 -7
- package/dist/esm/ui/annotations/selection/mounter.js +1 -27
- package/dist/types/actions/index.d.ts +0 -6
- package/dist/types/ui/Renderer/RendererStyleContainer.d.ts +1 -1
- package/dist/types/ui/Renderer/index.d.ts +1 -0
- package/dist/types/ui/renderer-props.d.ts +1 -0
- package/dist/types-ts4.5/actions/index.d.ts +0 -6
- package/dist/types-ts4.5/ui/Renderer/RendererStyleContainer.d.ts +1 -1
- package/dist/types-ts4.5/ui/Renderer/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/renderer-props.d.ts +1 -0
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 118.6.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#164686](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164686)
|
|
8
|
+
[`4b2aaa6783398`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4b2aaa6783398) -
|
|
9
|
+
Removed extra debug logging which was adding behind gate
|
|
10
|
+
platform_renderer_annotations_create_debug_logging
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 118.6.8
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -22,6 +22,10 @@ var _matchesUtils = require("./matches-utils");
|
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
25
|
+
// Any kind of refence is allowed
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
|
|
25
29
|
function RendererActions() {
|
|
26
30
|
var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
27
31
|
(0, _classCallCheck2.default)(this, RendererActions);
|
|
@@ -29,55 +33,6 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
29
33
|
// This module can only be used when wrapped with
|
|
30
34
|
// the <RendererContext> component for now.
|
|
31
35
|
(0, _defineProperty2.default)(this, "initFromContext", false);
|
|
32
|
-
(0, _defineProperty2.default)(this, "debugAnalyticLoggingEnabled", false);
|
|
33
|
-
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
34
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
35
|
-
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
36
|
-
// the annotation cannot be applied to the range.
|
|
37
|
-
(0, _defineProperty2.default)(this, "_privateWhyCannotApplyAnnotationOnRange", function (pos, doc, schema) {
|
|
38
|
-
var from = pos.from,
|
|
39
|
-
to = pos.to;
|
|
40
|
-
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
41
|
-
return 'position invalid';
|
|
42
|
-
}
|
|
43
|
-
var reasons = [];
|
|
44
|
-
doc.nodesBetween(from, to, function (node, _pos, parent) {
|
|
45
|
-
// Special exception for hardBreak nodes
|
|
46
|
-
if (schema.nodes.hardBreak === node.type) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// For block elements or text nodes, we want to check
|
|
51
|
-
// if annotations are allowed inside this tree
|
|
52
|
-
// or if we're leaf and not text
|
|
53
|
-
if ((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
54
|
-
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
55
|
-
if (node.isInline && !node.isText && !isAllowedInlineNode) {
|
|
56
|
-
reasons.push("Err 1 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
57
|
-
return false;
|
|
58
|
-
} else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
|
|
59
|
-
reasons.push("Err 2 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
60
|
-
return false;
|
|
61
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
62
|
-
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));
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
if (node.isInline && !node.isText) {
|
|
67
|
-
reasons.push("Err 4 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
68
|
-
return false;
|
|
69
|
-
} else if (node.isLeaf && !node.isText) {
|
|
70
|
-
reasons.push("Err 5 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
71
|
-
return false;
|
|
72
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
73
|
-
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));
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
});
|
|
79
|
-
return reasons.join(', ');
|
|
80
|
-
});
|
|
81
36
|
this.initFromContext = initFromContext;
|
|
82
37
|
this.transformer = new _editorJsonTransformer.JSONTransformer();
|
|
83
38
|
}
|
|
@@ -112,82 +67,23 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
112
67
|
key: "_privateValidatePositionsForAnnotation",
|
|
113
68
|
value: function _privateValidatePositionsForAnnotation(from, to) {
|
|
114
69
|
if (!this.doc || !this.schema) {
|
|
115
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
116
|
-
this.onAnalyticsEvent({
|
|
117
|
-
// @ts-ignore
|
|
118
|
-
action: 'failed',
|
|
119
|
-
// @ts-ignore
|
|
120
|
-
actionSubject: 'applyAnnotation',
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
123
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
124
|
-
attributes: {
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
reason: "Annotation Position validation failed - Missing doc or schema",
|
|
127
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
|
|
128
|
-
isDocValid: !!this.doc,
|
|
129
|
-
isSchemaValid: !!this.schema
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
70
|
return false;
|
|
134
71
|
}
|
|
135
72
|
var currentSelection = _state.TextSelection.create(this.doc, from, to);
|
|
136
73
|
if ((0, _utils.isEmptyTextSelection)(currentSelection, this.schema)) {
|
|
137
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
138
|
-
this.onAnalyticsEvent({
|
|
139
|
-
// @ts-ignore
|
|
140
|
-
action: 'failed',
|
|
141
|
-
// @ts-ignore
|
|
142
|
-
actionSubject: 'applyAnnotation',
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
145
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
146
|
-
attributes: {
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
reason: "Annotation Position validation - Empty Text Selection",
|
|
149
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
|
|
150
|
-
from: from,
|
|
151
|
-
to: to
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
74
|
return false;
|
|
156
75
|
}
|
|
157
76
|
var result = (0, _utils.canApplyAnnotationOnRange)({
|
|
158
77
|
from: from,
|
|
159
78
|
to: to
|
|
160
79
|
}, this.doc, this.schema);
|
|
161
|
-
if (this.debugAnalyticLoggingEnabled && !result && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
162
|
-
this.onAnalyticsEvent({
|
|
163
|
-
// @ts-ignore
|
|
164
|
-
action: 'failed',
|
|
165
|
-
// @ts-ignore
|
|
166
|
-
actionSubject: 'applyAnnotation',
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
169
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
170
|
-
attributes: {
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
reason: "Annotation canApplyAnnotationOnRange failed",
|
|
173
|
-
details: this._privateWhyCannotApplyAnnotationOnRange({
|
|
174
|
-
from: from,
|
|
175
|
-
to: to
|
|
176
|
-
}, this.doc, this.schema),
|
|
177
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
|
|
178
|
-
from: from,
|
|
179
|
-
to: to
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
80
|
return result;
|
|
184
81
|
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
185
84
|
}, {
|
|
186
85
|
key: "deleteAnnotation",
|
|
187
|
-
value:
|
|
188
|
-
//#endregion
|
|
189
|
-
|
|
190
|
-
function deleteAnnotation(annotationId, annotationType) {
|
|
86
|
+
value: function deleteAnnotation(annotationId, annotationType) {
|
|
191
87
|
if (!this.doc || !this.schema || !this.schema.marks.annotation) {
|
|
192
88
|
return false;
|
|
193
89
|
}
|
|
@@ -338,24 +234,6 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
338
234
|
key: "isValidAnnotationPosition",
|
|
339
235
|
value: function isValidAnnotationPosition(pos) {
|
|
340
236
|
if (!pos || !this.doc) {
|
|
341
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
342
|
-
this.onAnalyticsEvent({
|
|
343
|
-
// @ts-ignore
|
|
344
|
-
action: 'failed',
|
|
345
|
-
// @ts-ignore
|
|
346
|
-
actionSubject: 'applyAnnotation',
|
|
347
|
-
// @ts-ignore
|
|
348
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
349
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
350
|
-
attributes: {
|
|
351
|
-
// @ts-ignore
|
|
352
|
-
reason: "Annotation Position validation failed - Missing doc or position",
|
|
353
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
|
|
354
|
-
isPosValid: !!pos,
|
|
355
|
-
isDocValid: !!this.doc
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
237
|
return false;
|
|
360
238
|
}
|
|
361
239
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
@@ -417,25 +295,6 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
417
295
|
key: "applyAnnotation",
|
|
418
296
|
value: function applyAnnotation(pos, annotation) {
|
|
419
297
|
if (!this.doc || !pos || !this.schema) {
|
|
420
|
-
if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
421
|
-
this.onAnalyticsEvent({
|
|
422
|
-
// @ts-ignore
|
|
423
|
-
action: 'failed',
|
|
424
|
-
// @ts-ignore
|
|
425
|
-
actionSubject: 'applyAnnotation',
|
|
426
|
-
// @ts-ignore
|
|
427
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
428
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
429
|
-
attributes: {
|
|
430
|
-
// @ts-ignore
|
|
431
|
-
reason: "Annotation applyAnnotation failed - Missing doc, position or schema",
|
|
432
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes'),
|
|
433
|
-
isPosValid: !!pos,
|
|
434
|
-
isDocValid: !!this.doc,
|
|
435
|
-
isSchemaValid: !!this.schema
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
298
|
return false;
|
|
440
299
|
}
|
|
441
300
|
var from = pos.from,
|
|
@@ -469,22 +328,6 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
469
328
|
doc = _step$apply2.doc,
|
|
470
329
|
failed = _step$apply2.failed;
|
|
471
330
|
if (failed || !doc) {
|
|
472
|
-
if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
473
|
-
this.onAnalyticsEvent({
|
|
474
|
-
// @ts-ignore
|
|
475
|
-
action: 'failed',
|
|
476
|
-
// @ts-ignore
|
|
477
|
-
actionSubject: 'applyAnnotation',
|
|
478
|
-
// @ts-ignore
|
|
479
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
480
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
481
|
-
attributes: {
|
|
482
|
-
// @ts-ignore
|
|
483
|
-
reason: "Annotation applyAnnotation failed - ".concat(failed),
|
|
484
|
-
commentsOnInlineNodesAllowed: (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
331
|
return false;
|
|
489
332
|
}
|
|
490
333
|
var originalSelection = doc.textBetween(from, to);
|
|
@@ -545,14 +388,5 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
545
388
|
schema: this.schema
|
|
546
389
|
}, annotationId);
|
|
547
390
|
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* This is a temporary method used for controlling when extra analytics shoulw be logged.
|
|
551
|
-
*/
|
|
552
|
-
}, {
|
|
553
|
-
key: "_setDebugLogging",
|
|
554
|
-
value: function _setDebugLogging(enabled) {
|
|
555
|
-
this.debugAnalyticLoggingEnabled = enabled;
|
|
556
|
-
}
|
|
557
391
|
}]);
|
|
558
392
|
}();
|
|
@@ -62,7 +62,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
62
62
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
63
63
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "118.6.
|
|
65
|
+
var packageVersion = "118.6.9";
|
|
66
66
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -422,7 +422,8 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
422
422
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
423
423
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
424
424
|
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
425
|
-
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
425
|
+
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent,
|
|
426
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
426
427
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? (0, _react2.jsx)(_breakoutSsr.BreakoutSSRInlineScript, {
|
|
427
428
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
428
429
|
}) : null, (0, _react2.jsx)(RendererActionsInternalUpdater, {
|
|
@@ -453,7 +454,8 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
453
454
|
onClick: function onClick(event) {
|
|
454
455
|
return handleWrapperOnClick(event, props, mouseDownSelection);
|
|
455
456
|
},
|
|
456
|
-
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
457
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
458
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
457
459
|
}, (0, _react2.jsx)(_ui.UnsupportedBlock, null));
|
|
458
460
|
}
|
|
459
461
|
};
|
|
@@ -545,7 +547,8 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
545
547
|
ssr = props.ssr,
|
|
546
548
|
isInsideOfInlineExtension = props.isInsideOfInlineExtension,
|
|
547
549
|
allowTableResizing = props.allowTableResizing,
|
|
548
|
-
isTopLevelRenderer = props.isTopLevelRenderer
|
|
550
|
+
isTopLevelRenderer = props.isTopLevelRenderer,
|
|
551
|
+
allowRendererContainerStyles = props.allowRendererContainerStyles;
|
|
549
552
|
var createTelepointer = function createTelepointer() {
|
|
550
553
|
var telepointer = document.createElement('span');
|
|
551
554
|
telepointer.textContent = "\u200B";
|
|
@@ -620,20 +623,32 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
620
623
|
allowColumnSorting: !!allowColumnSorting,
|
|
621
624
|
useBlockRenderForCodeBlock: useBlockRenderForCodeBlock,
|
|
622
625
|
allowAnnotations: props.allowAnnotations,
|
|
623
|
-
allowTableResizing: allowTableResizing
|
|
626
|
+
allowTableResizing: allowTableResizing,
|
|
627
|
+
allowRendererContainerStyles: allowRendererContainerStyles
|
|
624
628
|
}, children))));
|
|
625
629
|
|
|
626
630
|
// We can only make the wrapper div query container when we have a known width.
|
|
627
631
|
// This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
|
|
628
632
|
//
|
|
633
|
+
|
|
634
|
+
// allowRendererContainerStyles is not needed for comment container styling as container should always be set for comments
|
|
635
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
636
|
+
if (appearance === 'comment' && isTopLevelRenderer && (0, _platformFeatureFlags.fg)('platform-ssr-table-resize')) {
|
|
637
|
+
return (0, _react2.jsx)("div", {
|
|
638
|
+
css: setAsQueryContainerStyles
|
|
639
|
+
}, renderer);
|
|
640
|
+
}
|
|
641
|
+
|
|
629
642
|
// We are setting this wrapper div as query container conditionally.
|
|
630
643
|
// Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
|
|
631
644
|
// Otherwise when appearance is unspecified the renderer size is decided by the content.
|
|
632
645
|
// In this case we can't set the container-type = inline-size as it will collapse width to 0.
|
|
633
|
-
return (appearance === 'full-page' || appearance === 'full-width'
|
|
646
|
+
return (appearance === 'full-page' || appearance === 'full-width') &&
|
|
634
647
|
// In case of having excerpt-include on page there are multiple renderers nested.
|
|
635
648
|
// Make sure only the root renderer is set to be query container.
|
|
636
|
-
isTopLevelRenderer &&
|
|
649
|
+
isTopLevelRenderer && allowRendererContainerStyles &&
|
|
650
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
651
|
+
(0, _platformFeatureFlags.fg)('platform-ssr-table-resize') ? (0, _react2.jsx)("div", {
|
|
637
652
|
css: setAsQueryContainerStyles
|
|
638
653
|
}, renderer) : renderer;
|
|
639
654
|
});
|
|
@@ -70,28 +70,8 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
70
70
|
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
71
71
|
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
72
72
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
73
|
-
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
74
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
75
|
-
if (createAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
76
|
-
createAnalyticsEvent({
|
|
77
|
-
action: 'failed',
|
|
78
|
-
actionSubject: 'applyAnnotation',
|
|
79
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
80
|
-
attributes: {
|
|
81
|
-
reason: 'Annotation Position invalid',
|
|
82
|
-
draftDocumentPosition: selectionDraftDocumentPosition,
|
|
83
|
-
documentPosition: documentPosition,
|
|
84
|
-
applyAnnotation: !!applyAnnotation,
|
|
85
|
-
isDraftPositionFixEnabled: true
|
|
86
|
-
},
|
|
87
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
88
|
-
}).fire(_types.FabricChannel.editor);
|
|
89
|
-
}
|
|
90
73
|
return false;
|
|
91
74
|
}
|
|
92
|
-
if ((0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
|
|
93
|
-
actions._setDebugLogging(true);
|
|
94
|
-
}
|
|
95
75
|
|
|
96
76
|
// Evaluate position validity when the user commits the position to be annotated
|
|
97
77
|
var isCreateAllowedOnPosition = actions.isValidAnnotationPosition(positionToAnnotate);
|
|
@@ -113,13 +93,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
113
93
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
114
94
|
}).fire(_types.FabricChannel.editor);
|
|
115
95
|
}
|
|
116
|
-
|
|
117
|
-
var result = applyAnnotation(positionToAnnotate, annotation);
|
|
118
|
-
actions._setDebugLogging(false);
|
|
119
|
-
return result;
|
|
120
|
-
} else {
|
|
121
|
-
return applyAnnotation(positionToAnnotate, annotation);
|
|
122
|
-
}
|
|
96
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
123
97
|
}, [actions, documentPosition, applyAnnotation, createAnalyticsEvent, inlineNodeTypes, selectionDraftDocumentPosition]);
|
|
124
98
|
var createIndexCallback = (0, _react.useCallback)(function () {
|
|
125
99
|
if (!documentPosition || !generateIndexMatch) {
|
|
@@ -10,62 +10,15 @@ import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
|
10
10
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
11
11
|
import { getIndexMatch } from './matches-utils';
|
|
12
12
|
export default class RendererActions {
|
|
13
|
+
// Any kind of refence is allowed
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
|
|
13
17
|
constructor(initFromContext = false) {
|
|
14
18
|
// This is our psuedo feature flag for now
|
|
15
19
|
// This module can only be used when wrapped with
|
|
16
20
|
// the <RendererContext> component for now.
|
|
17
21
|
_defineProperty(this, "initFromContext", false);
|
|
18
|
-
_defineProperty(this, "debugAnalyticLoggingEnabled", false);
|
|
19
|
-
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
20
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
21
|
-
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
22
|
-
// the annotation cannot be applied to the range.
|
|
23
|
-
_defineProperty(this, "_privateWhyCannotApplyAnnotationOnRange", (pos, doc, schema) => {
|
|
24
|
-
const {
|
|
25
|
-
from,
|
|
26
|
-
to
|
|
27
|
-
} = pos;
|
|
28
|
-
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
29
|
-
return 'position invalid';
|
|
30
|
-
}
|
|
31
|
-
const reasons = [];
|
|
32
|
-
doc.nodesBetween(from, to, (node, _pos, parent) => {
|
|
33
|
-
// Special exception for hardBreak nodes
|
|
34
|
-
if (schema.nodes.hardBreak === node.type) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// For block elements or text nodes, we want to check
|
|
39
|
-
// if annotations are allowed inside this tree
|
|
40
|
-
// or if we're leaf and not text
|
|
41
|
-
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
42
|
-
const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
43
|
-
if (node.isInline && !node.isText && !isAllowedInlineNode) {
|
|
44
|
-
reasons.push(`Err 1 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
45
|
-
return false;
|
|
46
|
-
} else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
|
|
47
|
-
reasons.push(`Err 2 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
48
|
-
return false;
|
|
49
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
50
|
-
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}`);
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
if (node.isInline && !node.isText) {
|
|
55
|
-
reasons.push(`Err 4 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
56
|
-
return false;
|
|
57
|
-
} else if (node.isLeaf && !node.isText) {
|
|
58
|
-
reasons.push(`Err 5 - type: ${node.type.name}, isInline: ${node.isInline}, isText: ${node.isText}, isLeaf: ${node.isLeaf}`);
|
|
59
|
-
return false;
|
|
60
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
61
|
-
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}`);
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
return reasons.join(', ');
|
|
68
|
-
});
|
|
69
22
|
this.initFromContext = initFromContext;
|
|
70
23
|
this.transformer = new JSONTransformer();
|
|
71
24
|
}
|
|
@@ -94,76 +47,19 @@ export default class RendererActions {
|
|
|
94
47
|
*/
|
|
95
48
|
_privateValidatePositionsForAnnotation(from, to) {
|
|
96
49
|
if (!this.doc || !this.schema) {
|
|
97
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
98
|
-
this.onAnalyticsEvent({
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
action: 'failed',
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
actionSubject: 'applyAnnotation',
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
105
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
106
|
-
attributes: {
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
reason: `Annotation Position validation failed - Missing doc or schema`,
|
|
109
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
110
|
-
isDocValid: !!this.doc,
|
|
111
|
-
isSchemaValid: !!this.schema
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
50
|
return false;
|
|
116
51
|
}
|
|
117
52
|
const currentSelection = TextSelection.create(this.doc, from, to);
|
|
118
53
|
if (isEmptyTextSelection(currentSelection, this.schema)) {
|
|
119
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
120
|
-
this.onAnalyticsEvent({
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
action: 'failed',
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
actionSubject: 'applyAnnotation',
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
127
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
128
|
-
attributes: {
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
reason: `Annotation Position validation - Empty Text Selection`,
|
|
131
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
132
|
-
from,
|
|
133
|
-
to
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
54
|
return false;
|
|
138
55
|
}
|
|
139
56
|
const result = canApplyAnnotationOnRange({
|
|
140
57
|
from,
|
|
141
58
|
to
|
|
142
59
|
}, this.doc, this.schema);
|
|
143
|
-
if (this.debugAnalyticLoggingEnabled && !result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
144
|
-
this.onAnalyticsEvent({
|
|
145
|
-
// @ts-ignore
|
|
146
|
-
action: 'failed',
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
actionSubject: 'applyAnnotation',
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
151
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
152
|
-
attributes: {
|
|
153
|
-
// @ts-ignore
|
|
154
|
-
reason: `Annotation canApplyAnnotationOnRange failed`,
|
|
155
|
-
details: this._privateWhyCannotApplyAnnotationOnRange({
|
|
156
|
-
from,
|
|
157
|
-
to
|
|
158
|
-
}, this.doc, this.schema),
|
|
159
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
160
|
-
from,
|
|
161
|
-
to
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
60
|
return result;
|
|
166
61
|
}
|
|
62
|
+
|
|
167
63
|
//#endregion
|
|
168
64
|
|
|
169
65
|
deleteAnnotation(annotationId, annotationType) {
|
|
@@ -314,24 +210,6 @@ export default class RendererActions {
|
|
|
314
210
|
}
|
|
315
211
|
isValidAnnotationPosition(pos) {
|
|
316
212
|
if (!pos || !this.doc) {
|
|
317
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
318
|
-
this.onAnalyticsEvent({
|
|
319
|
-
// @ts-ignore
|
|
320
|
-
action: 'failed',
|
|
321
|
-
// @ts-ignore
|
|
322
|
-
actionSubject: 'applyAnnotation',
|
|
323
|
-
// @ts-ignore
|
|
324
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
325
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
326
|
-
attributes: {
|
|
327
|
-
// @ts-ignore
|
|
328
|
-
reason: `Annotation Position validation failed - Missing doc or position`,
|
|
329
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
330
|
-
isPosValid: !!pos,
|
|
331
|
-
isDocValid: !!this.doc
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
213
|
return false;
|
|
336
214
|
}
|
|
337
215
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
@@ -389,25 +267,6 @@ export default class RendererActions {
|
|
|
389
267
|
}
|
|
390
268
|
applyAnnotation(pos, annotation) {
|
|
391
269
|
if (!this.doc || !pos || !this.schema) {
|
|
392
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
393
|
-
this.onAnalyticsEvent({
|
|
394
|
-
// @ts-ignore
|
|
395
|
-
action: 'failed',
|
|
396
|
-
// @ts-ignore
|
|
397
|
-
actionSubject: 'applyAnnotation',
|
|
398
|
-
// @ts-ignore
|
|
399
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
400
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
401
|
-
attributes: {
|
|
402
|
-
// @ts-ignore
|
|
403
|
-
reason: `Annotation applyAnnotation failed - Missing doc, position or schema`,
|
|
404
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
405
|
-
isPosValid: !!pos,
|
|
406
|
-
isDocValid: !!this.doc,
|
|
407
|
-
isSchemaValid: !!this.schema
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
270
|
return false;
|
|
412
271
|
}
|
|
413
272
|
const {
|
|
@@ -446,22 +305,6 @@ export default class RendererActions {
|
|
|
446
305
|
failed
|
|
447
306
|
} = step.apply(this.doc);
|
|
448
307
|
if (failed || !doc) {
|
|
449
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
450
|
-
this.onAnalyticsEvent({
|
|
451
|
-
// @ts-ignore
|
|
452
|
-
action: 'failed',
|
|
453
|
-
// @ts-ignore
|
|
454
|
-
actionSubject: 'applyAnnotation',
|
|
455
|
-
// @ts-ignore
|
|
456
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
457
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
458
|
-
attributes: {
|
|
459
|
-
// @ts-ignore
|
|
460
|
-
reason: `Annotation applyAnnotation failed - ${failed}`,
|
|
461
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes')
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
308
|
return false;
|
|
466
309
|
}
|
|
467
310
|
const originalSelection = doc.textBetween(from, to);
|
|
@@ -523,11 +366,4 @@ export default class RendererActions {
|
|
|
523
366
|
schema: this.schema
|
|
524
367
|
}, annotationId);
|
|
525
368
|
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* This is a temporary method used for controlling when extra analytics shoulw be logged.
|
|
529
|
-
*/
|
|
530
|
-
_setDebugLogging(enabled) {
|
|
531
|
-
this.debugAnalyticLoggingEnabled = enabled;
|
|
532
|
-
}
|
|
533
369
|
}
|
|
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
|
|
|
48
48
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
const packageName = "@atlaskit/renderer";
|
|
51
|
-
const packageVersion = "118.6.
|
|
51
|
+
const packageVersion = "118.6.9";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size'
|
|
@@ -407,7 +407,8 @@ export const RendererFunctionalComponent = props => {
|
|
|
407
407
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
408
408
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
409
409
|
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
410
|
-
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
410
|
+
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent,
|
|
411
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
411
412
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? jsx(BreakoutSSRInlineScript, {
|
|
412
413
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
413
414
|
}) : null, jsx(RendererActionsInternalUpdater, {
|
|
@@ -436,7 +437,8 @@ export const RendererFunctionalComponent = props => {
|
|
|
436
437
|
useBlockRenderForCodeBlock: (_rendererContext$feat2 = rendererContext.featureFlags.useBlockRenderForCodeBlock) !== null && _rendererContext$feat2 !== void 0 ? _rendererContext$feat2 : true,
|
|
437
438
|
addTelepointer: props.addTelepointer,
|
|
438
439
|
onClick: event => handleWrapperOnClick(event, props, mouseDownSelection),
|
|
439
|
-
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
440
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
441
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
440
442
|
}, jsx(UnsupportedBlock, null));
|
|
441
443
|
}
|
|
442
444
|
};
|
|
@@ -532,7 +534,8 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
532
534
|
ssr,
|
|
533
535
|
isInsideOfInlineExtension,
|
|
534
536
|
allowTableResizing,
|
|
535
|
-
isTopLevelRenderer
|
|
537
|
+
isTopLevelRenderer,
|
|
538
|
+
allowRendererContainerStyles
|
|
536
539
|
} = props;
|
|
537
540
|
const createTelepointer = () => {
|
|
538
541
|
const telepointer = document.createElement('span');
|
|
@@ -606,20 +609,32 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
606
609
|
allowColumnSorting: !!allowColumnSorting,
|
|
607
610
|
useBlockRenderForCodeBlock: useBlockRenderForCodeBlock,
|
|
608
611
|
allowAnnotations: props.allowAnnotations,
|
|
609
|
-
allowTableResizing: allowTableResizing
|
|
612
|
+
allowTableResizing: allowTableResizing,
|
|
613
|
+
allowRendererContainerStyles: allowRendererContainerStyles
|
|
610
614
|
}, children))));
|
|
611
615
|
|
|
612
616
|
// We can only make the wrapper div query container when we have a known width.
|
|
613
617
|
// This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
|
|
614
618
|
//
|
|
619
|
+
|
|
620
|
+
// allowRendererContainerStyles is not needed for comment container styling as container should always be set for comments
|
|
621
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
622
|
+
if (appearance === 'comment' && isTopLevelRenderer && fg('platform-ssr-table-resize')) {
|
|
623
|
+
return jsx("div", {
|
|
624
|
+
css: setAsQueryContainerStyles
|
|
625
|
+
}, renderer);
|
|
626
|
+
}
|
|
627
|
+
|
|
615
628
|
// We are setting this wrapper div as query container conditionally.
|
|
616
629
|
// Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
|
|
617
630
|
// Otherwise when appearance is unspecified the renderer size is decided by the content.
|
|
618
631
|
// In this case we can't set the container-type = inline-size as it will collapse width to 0.
|
|
619
|
-
return (appearance === 'full-page' || appearance === 'full-width'
|
|
632
|
+
return (appearance === 'full-page' || appearance === 'full-width') &&
|
|
620
633
|
// In case of having excerpt-include on page there are multiple renderers nested.
|
|
621
634
|
// Make sure only the root renderer is set to be query container.
|
|
622
|
-
isTopLevelRenderer &&
|
|
635
|
+
isTopLevelRenderer && allowRendererContainerStyles &&
|
|
636
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
637
|
+
fg('platform-ssr-table-resize') ? jsx("div", {
|
|
623
638
|
css: setAsQueryContainerStyles
|
|
624
639
|
}, renderer) : renderer;
|
|
625
640
|
});
|
|
@@ -67,28 +67,8 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
67
67
|
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
68
68
|
const positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
69
69
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
70
|
-
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
71
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
72
|
-
if (createAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
73
|
-
createAnalyticsEvent({
|
|
74
|
-
action: 'failed',
|
|
75
|
-
actionSubject: 'applyAnnotation',
|
|
76
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
77
|
-
attributes: {
|
|
78
|
-
reason: 'Annotation Position invalid',
|
|
79
|
-
draftDocumentPosition: selectionDraftDocumentPosition,
|
|
80
|
-
documentPosition,
|
|
81
|
-
applyAnnotation: !!applyAnnotation,
|
|
82
|
-
isDraftPositionFixEnabled: true
|
|
83
|
-
},
|
|
84
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
85
|
-
}).fire(FabricChannel.editor);
|
|
86
|
-
}
|
|
87
70
|
return false;
|
|
88
71
|
}
|
|
89
|
-
if (fg('platform_renderer_annotations_create_debug_logging')) {
|
|
90
|
-
actions._setDebugLogging(true);
|
|
91
|
-
}
|
|
92
72
|
|
|
93
73
|
// Evaluate position validity when the user commits the position to be annotated
|
|
94
74
|
const isCreateAllowedOnPosition = actions.isValidAnnotationPosition(positionToAnnotate);
|
|
@@ -110,13 +90,7 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
110
90
|
eventType: EVENT_TYPE.TRACK
|
|
111
91
|
}).fire(FabricChannel.editor);
|
|
112
92
|
}
|
|
113
|
-
|
|
114
|
-
const result = applyAnnotation(positionToAnnotate, annotation);
|
|
115
|
-
actions._setDebugLogging(false);
|
|
116
|
-
return result;
|
|
117
|
-
} else {
|
|
118
|
-
return applyAnnotation(positionToAnnotate, annotation);
|
|
119
|
-
}
|
|
93
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
120
94
|
}, [actions, documentPosition, applyAnnotation, createAnalyticsEvent, inlineNodeTypes, selectionDraftDocumentPosition]);
|
|
121
95
|
const createIndexCallback = useCallback(() => {
|
|
122
96
|
if (!documentPosition || !generateIndexMatch) {
|
|
@@ -15,6 +15,10 @@ import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
|
15
15
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
16
16
|
import { getIndexMatch } from './matches-utils';
|
|
17
17
|
var RendererActions = /*#__PURE__*/function () {
|
|
18
|
+
// Any kind of refence is allowed
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
|
|
18
22
|
function RendererActions() {
|
|
19
23
|
var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
20
24
|
_classCallCheck(this, RendererActions);
|
|
@@ -22,55 +26,6 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
22
26
|
// This module can only be used when wrapped with
|
|
23
27
|
// the <RendererContext> component for now.
|
|
24
28
|
_defineProperty(this, "initFromContext", false);
|
|
25
|
-
_defineProperty(this, "debugAnalyticLoggingEnabled", false);
|
|
26
|
-
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
27
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
28
|
-
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
29
|
-
// the annotation cannot be applied to the range.
|
|
30
|
-
_defineProperty(this, "_privateWhyCannotApplyAnnotationOnRange", function (pos, doc, schema) {
|
|
31
|
-
var from = pos.from,
|
|
32
|
-
to = pos.to;
|
|
33
|
-
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
34
|
-
return 'position invalid';
|
|
35
|
-
}
|
|
36
|
-
var reasons = [];
|
|
37
|
-
doc.nodesBetween(from, to, function (node, _pos, parent) {
|
|
38
|
-
// Special exception for hardBreak nodes
|
|
39
|
-
if (schema.nodes.hardBreak === node.type) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// For block elements or text nodes, we want to check
|
|
44
|
-
// if annotations are allowed inside this tree
|
|
45
|
-
// or if we're leaf and not text
|
|
46
|
-
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
47
|
-
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
48
|
-
if (node.isInline && !node.isText && !isAllowedInlineNode) {
|
|
49
|
-
reasons.push("Err 1 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
50
|
-
return false;
|
|
51
|
-
} else if (node.isLeaf && !node.isText && !isAllowedInlineNode) {
|
|
52
|
-
reasons.push("Err 2 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
53
|
-
return false;
|
|
54
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
55
|
-
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));
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
if (node.isInline && !node.isText) {
|
|
60
|
-
reasons.push("Err 4 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
61
|
-
return false;
|
|
62
|
-
} else if (node.isLeaf && !node.isText) {
|
|
63
|
-
reasons.push("Err 5 - type: ".concat(node.type.name, ", isInline: ").concat(node.isInline, ", isText: ").concat(node.isText, ", isLeaf: ").concat(node.isLeaf));
|
|
64
|
-
return false;
|
|
65
|
-
} else if (node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
66
|
-
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));
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
});
|
|
72
|
-
return reasons.join(', ');
|
|
73
|
-
});
|
|
74
29
|
this.initFromContext = initFromContext;
|
|
75
30
|
this.transformer = new JSONTransformer();
|
|
76
31
|
}
|
|
@@ -105,82 +60,23 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
105
60
|
key: "_privateValidatePositionsForAnnotation",
|
|
106
61
|
value: function _privateValidatePositionsForAnnotation(from, to) {
|
|
107
62
|
if (!this.doc || !this.schema) {
|
|
108
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
109
|
-
this.onAnalyticsEvent({
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
action: 'failed',
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
actionSubject: 'applyAnnotation',
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
116
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
117
|
-
attributes: {
|
|
118
|
-
// @ts-ignore
|
|
119
|
-
reason: "Annotation Position validation failed - Missing doc or schema",
|
|
120
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
121
|
-
isDocValid: !!this.doc,
|
|
122
|
-
isSchemaValid: !!this.schema
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
63
|
return false;
|
|
127
64
|
}
|
|
128
65
|
var currentSelection = TextSelection.create(this.doc, from, to);
|
|
129
66
|
if (isEmptyTextSelection(currentSelection, this.schema)) {
|
|
130
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
131
|
-
this.onAnalyticsEvent({
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
action: 'failed',
|
|
134
|
-
// @ts-ignore
|
|
135
|
-
actionSubject: 'applyAnnotation',
|
|
136
|
-
// @ts-ignore
|
|
137
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
138
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
139
|
-
attributes: {
|
|
140
|
-
// @ts-ignore
|
|
141
|
-
reason: "Annotation Position validation - Empty Text Selection",
|
|
142
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
143
|
-
from: from,
|
|
144
|
-
to: to
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
67
|
return false;
|
|
149
68
|
}
|
|
150
69
|
var result = canApplyAnnotationOnRange({
|
|
151
70
|
from: from,
|
|
152
71
|
to: to
|
|
153
72
|
}, this.doc, this.schema);
|
|
154
|
-
if (this.debugAnalyticLoggingEnabled && !result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
155
|
-
this.onAnalyticsEvent({
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
action: 'failed',
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
actionSubject: 'applyAnnotation',
|
|
160
|
-
// @ts-ignore
|
|
161
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
162
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
163
|
-
attributes: {
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
reason: "Annotation canApplyAnnotationOnRange failed",
|
|
166
|
-
details: this._privateWhyCannotApplyAnnotationOnRange({
|
|
167
|
-
from: from,
|
|
168
|
-
to: to
|
|
169
|
-
}, this.doc, this.schema),
|
|
170
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
171
|
-
from: from,
|
|
172
|
-
to: to
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
73
|
return result;
|
|
177
74
|
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
178
77
|
}, {
|
|
179
78
|
key: "deleteAnnotation",
|
|
180
|
-
value:
|
|
181
|
-
//#endregion
|
|
182
|
-
|
|
183
|
-
function deleteAnnotation(annotationId, annotationType) {
|
|
79
|
+
value: function deleteAnnotation(annotationId, annotationType) {
|
|
184
80
|
if (!this.doc || !this.schema || !this.schema.marks.annotation) {
|
|
185
81
|
return false;
|
|
186
82
|
}
|
|
@@ -331,24 +227,6 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
331
227
|
key: "isValidAnnotationPosition",
|
|
332
228
|
value: function isValidAnnotationPosition(pos) {
|
|
333
229
|
if (!pos || !this.doc) {
|
|
334
|
-
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
335
|
-
this.onAnalyticsEvent({
|
|
336
|
-
// @ts-ignore
|
|
337
|
-
action: 'failed',
|
|
338
|
-
// @ts-ignore
|
|
339
|
-
actionSubject: 'applyAnnotation',
|
|
340
|
-
// @ts-ignore
|
|
341
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
342
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
343
|
-
attributes: {
|
|
344
|
-
// @ts-ignore
|
|
345
|
-
reason: "Annotation Position validation failed - Missing doc or position",
|
|
346
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
347
|
-
isPosValid: !!pos,
|
|
348
|
-
isDocValid: !!this.doc
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
230
|
return false;
|
|
353
231
|
}
|
|
354
232
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
@@ -410,25 +288,6 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
410
288
|
key: "applyAnnotation",
|
|
411
289
|
value: function applyAnnotation(pos, annotation) {
|
|
412
290
|
if (!this.doc || !pos || !this.schema) {
|
|
413
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
414
|
-
this.onAnalyticsEvent({
|
|
415
|
-
// @ts-ignore
|
|
416
|
-
action: 'failed',
|
|
417
|
-
// @ts-ignore
|
|
418
|
-
actionSubject: 'applyAnnotation',
|
|
419
|
-
// @ts-ignore
|
|
420
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
421
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
422
|
-
attributes: {
|
|
423
|
-
// @ts-ignore
|
|
424
|
-
reason: "Annotation applyAnnotation failed - Missing doc, position or schema",
|
|
425
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes'),
|
|
426
|
-
isPosValid: !!pos,
|
|
427
|
-
isDocValid: !!this.doc,
|
|
428
|
-
isSchemaValid: !!this.schema
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
291
|
return false;
|
|
433
292
|
}
|
|
434
293
|
var from = pos.from,
|
|
@@ -462,22 +321,6 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
462
321
|
doc = _step$apply2.doc,
|
|
463
322
|
failed = _step$apply2.failed;
|
|
464
323
|
if (failed || !doc) {
|
|
465
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
466
|
-
this.onAnalyticsEvent({
|
|
467
|
-
// @ts-ignore
|
|
468
|
-
action: 'failed',
|
|
469
|
-
// @ts-ignore
|
|
470
|
-
actionSubject: 'applyAnnotation',
|
|
471
|
-
// @ts-ignore
|
|
472
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
473
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
474
|
-
attributes: {
|
|
475
|
-
// @ts-ignore
|
|
476
|
-
reason: "Annotation applyAnnotation failed - ".concat(failed),
|
|
477
|
-
commentsOnInlineNodesAllowed: fg('editor_inline_comments_on_inline_nodes')
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
324
|
return false;
|
|
482
325
|
}
|
|
483
326
|
var originalSelection = doc.textBetween(from, to);
|
|
@@ -538,15 +381,6 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
538
381
|
schema: this.schema
|
|
539
382
|
}, annotationId);
|
|
540
383
|
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* This is a temporary method used for controlling when extra analytics shoulw be logged.
|
|
544
|
-
*/
|
|
545
|
-
}, {
|
|
546
|
-
key: "_setDebugLogging",
|
|
547
|
-
value: function _setDebugLogging(enabled) {
|
|
548
|
-
this.debugAnalyticLoggingEnabled = enabled;
|
|
549
|
-
}
|
|
550
384
|
}]);
|
|
551
385
|
}();
|
|
552
386
|
export { RendererActions as default };
|
|
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
|
|
|
53
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "118.6.
|
|
56
|
+
var packageVersion = "118.6.9";
|
|
57
57
|
var setAsQueryContainerStyles = css({
|
|
58
58
|
containerName: 'ak-renderer-wrapper',
|
|
59
59
|
containerType: 'inline-size'
|
|
@@ -413,7 +413,8 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
413
413
|
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
414
414
|
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
415
415
|
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
416
|
-
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent
|
|
416
|
+
shouldRemoveEmptySpaceAroundContent: props.shouldRemoveEmptySpaceAroundContent,
|
|
417
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
417
418
|
}, props.enableSsrInlineScripts || props.noOpSSRInlineScript ? jsx(BreakoutSSRInlineScript, {
|
|
418
419
|
noOpSSRInlineScript: Boolean(props.noOpSSRInlineScript)
|
|
419
420
|
}) : null, jsx(RendererActionsInternalUpdater, {
|
|
@@ -444,7 +445,8 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
444
445
|
onClick: function onClick(event) {
|
|
445
446
|
return handleWrapperOnClick(event, props, mouseDownSelection);
|
|
446
447
|
},
|
|
447
|
-
isTopLevelRenderer: rendererContext.isTopLevelRenderer
|
|
448
|
+
isTopLevelRenderer: rendererContext.isTopLevelRenderer,
|
|
449
|
+
allowRendererContainerStyles: props.allowRendererContainerStyles
|
|
448
450
|
}, jsx(UnsupportedBlock, null));
|
|
449
451
|
}
|
|
450
452
|
};
|
|
@@ -536,7 +538,8 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
536
538
|
ssr = props.ssr,
|
|
537
539
|
isInsideOfInlineExtension = props.isInsideOfInlineExtension,
|
|
538
540
|
allowTableResizing = props.allowTableResizing,
|
|
539
|
-
isTopLevelRenderer = props.isTopLevelRenderer
|
|
541
|
+
isTopLevelRenderer = props.isTopLevelRenderer,
|
|
542
|
+
allowRendererContainerStyles = props.allowRendererContainerStyles;
|
|
540
543
|
var createTelepointer = function createTelepointer() {
|
|
541
544
|
var telepointer = document.createElement('span');
|
|
542
545
|
telepointer.textContent = "\u200B";
|
|
@@ -611,20 +614,32 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
611
614
|
allowColumnSorting: !!allowColumnSorting,
|
|
612
615
|
useBlockRenderForCodeBlock: useBlockRenderForCodeBlock,
|
|
613
616
|
allowAnnotations: props.allowAnnotations,
|
|
614
|
-
allowTableResizing: allowTableResizing
|
|
617
|
+
allowTableResizing: allowTableResizing,
|
|
618
|
+
allowRendererContainerStyles: allowRendererContainerStyles
|
|
615
619
|
}, children))));
|
|
616
620
|
|
|
617
621
|
// We can only make the wrapper div query container when we have a known width.
|
|
618
622
|
// This is also required for SSR to work correctly. As WidthProvider/WithConsumer will not have the correct width during SSR.
|
|
619
623
|
//
|
|
624
|
+
|
|
625
|
+
// allowRendererContainerStyles is not needed for comment container styling as container should always be set for comments
|
|
626
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
627
|
+
if (appearance === 'comment' && isTopLevelRenderer && fg('platform-ssr-table-resize')) {
|
|
628
|
+
return jsx("div", {
|
|
629
|
+
css: setAsQueryContainerStyles
|
|
630
|
+
}, renderer);
|
|
631
|
+
}
|
|
632
|
+
|
|
620
633
|
// We are setting this wrapper div as query container conditionally.
|
|
621
634
|
// Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
|
|
622
635
|
// Otherwise when appearance is unspecified the renderer size is decided by the content.
|
|
623
636
|
// In this case we can't set the container-type = inline-size as it will collapse width to 0.
|
|
624
|
-
return (appearance === 'full-page' || appearance === 'full-width'
|
|
637
|
+
return (appearance === 'full-page' || appearance === 'full-width') &&
|
|
625
638
|
// In case of having excerpt-include on page there are multiple renderers nested.
|
|
626
639
|
// Make sure only the root renderer is set to be query container.
|
|
627
|
-
isTopLevelRenderer &&
|
|
640
|
+
isTopLevelRenderer && allowRendererContainerStyles &&
|
|
641
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
642
|
+
fg('platform-ssr-table-resize') ? jsx("div", {
|
|
628
643
|
css: setAsQueryContainerStyles
|
|
629
644
|
}, renderer) : renderer;
|
|
630
645
|
});
|
|
@@ -61,28 +61,8 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
61
61
|
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
62
62
|
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
63
63
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
64
|
-
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
65
|
-
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
66
|
-
if (createAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
67
|
-
createAnalyticsEvent({
|
|
68
|
-
action: 'failed',
|
|
69
|
-
actionSubject: 'applyAnnotation',
|
|
70
|
-
actionSubjectId: 'inlineCommentFailureReason',
|
|
71
|
-
attributes: {
|
|
72
|
-
reason: 'Annotation Position invalid',
|
|
73
|
-
draftDocumentPosition: selectionDraftDocumentPosition,
|
|
74
|
-
documentPosition: documentPosition,
|
|
75
|
-
applyAnnotation: !!applyAnnotation,
|
|
76
|
-
isDraftPositionFixEnabled: true
|
|
77
|
-
},
|
|
78
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
79
|
-
}).fire(FabricChannel.editor);
|
|
80
|
-
}
|
|
81
64
|
return false;
|
|
82
65
|
}
|
|
83
|
-
if (fg('platform_renderer_annotations_create_debug_logging')) {
|
|
84
|
-
actions._setDebugLogging(true);
|
|
85
|
-
}
|
|
86
66
|
|
|
87
67
|
// Evaluate position validity when the user commits the position to be annotated
|
|
88
68
|
var isCreateAllowedOnPosition = actions.isValidAnnotationPosition(positionToAnnotate);
|
|
@@ -104,13 +84,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
104
84
|
eventType: EVENT_TYPE.TRACK
|
|
105
85
|
}).fire(FabricChannel.editor);
|
|
106
86
|
}
|
|
107
|
-
|
|
108
|
-
var result = applyAnnotation(positionToAnnotate, annotation);
|
|
109
|
-
actions._setDebugLogging(false);
|
|
110
|
-
return result;
|
|
111
|
-
} else {
|
|
112
|
-
return applyAnnotation(positionToAnnotate, annotation);
|
|
113
|
-
}
|
|
87
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
114
88
|
}, [actions, documentPosition, applyAnnotation, createAnalyticsEvent, inlineNodeTypes, selectionDraftDocumentPosition]);
|
|
115
89
|
var createIndexCallback = useCallback(function () {
|
|
116
90
|
if (!documentPosition || !generateIndexMatch) {
|
|
@@ -39,7 +39,6 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
39
39
|
private schema?;
|
|
40
40
|
private ref?;
|
|
41
41
|
private onAnalyticsEvent?;
|
|
42
|
-
private debugAnalyticLoggingEnabled;
|
|
43
42
|
constructor(initFromContext?: boolean);
|
|
44
43
|
_privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void): void;
|
|
45
44
|
_privateUnregisterRenderer(): void;
|
|
@@ -47,7 +46,6 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
47
46
|
* Validate whether we can create an annotation between two positions
|
|
48
47
|
*/
|
|
49
48
|
_privateValidatePositionsForAnnotation(from: number, to: number): boolean;
|
|
50
|
-
_privateWhyCannotApplyAnnotationOnRange: (pos: Position, doc: Node, schema: Schema) => string;
|
|
51
49
|
deleteAnnotation(annotationId: string, annotationType: 'inlineComment'): false | {
|
|
52
50
|
step: RemoveNodeMarkStep | RemoveMarkStep;
|
|
53
51
|
doc: JSONDocNode;
|
|
@@ -71,9 +69,5 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
71
69
|
applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
|
|
72
70
|
generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
|
|
73
71
|
getInlineNodeTypes(annotationId: string): string[] | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* This is a temporary method used for controlling when extra analytics shoulw be logged.
|
|
76
|
-
*/
|
|
77
|
-
_setDebugLogging(enabled: boolean): void;
|
|
78
72
|
}
|
|
79
73
|
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type RendererWrapperProps } from './index';
|
|
7
|
-
type RendererStyleContainerProps = Pick<RendererWrapperProps, 'onClick' | 'onMouseDown' | 'appearance' | 'allowNestedHeaderLinks' | 'allowColumnSorting' | 'useBlockRenderForCodeBlock' | 'allowAnnotations' | 'allowTableResizing' | 'innerRef' | 'children'> & {
|
|
7
|
+
type RendererStyleContainerProps = Pick<RendererWrapperProps, 'onClick' | 'onMouseDown' | 'appearance' | 'allowNestedHeaderLinks' | 'allowColumnSorting' | 'useBlockRenderForCodeBlock' | 'allowAnnotations' | 'allowTableResizing' | 'innerRef' | 'children' | 'allowRendererContainerStyles'> & {
|
|
8
8
|
testId?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const RendererStyleContainer: (props: RendererStyleContainerProps) => jsx.JSX.Element;
|
|
@@ -68,6 +68,7 @@ export interface RendererProps {
|
|
|
68
68
|
isInsideOfInlineExtension?: boolean;
|
|
69
69
|
isTopLevelRenderer?: boolean;
|
|
70
70
|
includeNodesCountInStats?: boolean;
|
|
71
|
+
allowRendererContainerStyles?: boolean;
|
|
71
72
|
shouldRemoveEmptySpaceAroundContent?: boolean;
|
|
72
73
|
/**
|
|
73
74
|
* When enabled a trailing telepointer will be added to the rendered document
|
|
@@ -39,7 +39,6 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
39
39
|
private schema?;
|
|
40
40
|
private ref?;
|
|
41
41
|
private onAnalyticsEvent?;
|
|
42
|
-
private debugAnalyticLoggingEnabled;
|
|
43
42
|
constructor(initFromContext?: boolean);
|
|
44
43
|
_privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void): void;
|
|
45
44
|
_privateUnregisterRenderer(): void;
|
|
@@ -47,7 +46,6 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
47
46
|
* Validate whether we can create an annotation between two positions
|
|
48
47
|
*/
|
|
49
48
|
_privateValidatePositionsForAnnotation(from: number, to: number): boolean;
|
|
50
|
-
_privateWhyCannotApplyAnnotationOnRange: (pos: Position, doc: Node, schema: Schema) => string;
|
|
51
49
|
deleteAnnotation(annotationId: string, annotationType: 'inlineComment'): false | {
|
|
52
50
|
step: RemoveNodeMarkStep | RemoveMarkStep;
|
|
53
51
|
doc: JSONDocNode;
|
|
@@ -71,9 +69,5 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
71
69
|
applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
|
|
72
70
|
generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
|
|
73
71
|
getInlineNodeTypes(annotationId: string): string[] | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* This is a temporary method used for controlling when extra analytics shoulw be logged.
|
|
76
|
-
*/
|
|
77
|
-
_setDebugLogging(enabled: boolean): void;
|
|
78
72
|
}
|
|
79
73
|
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type RendererWrapperProps } from './index';
|
|
7
|
-
type RendererStyleContainerProps = Pick<RendererWrapperProps, 'onClick' | 'onMouseDown' | 'appearance' | 'allowNestedHeaderLinks' | 'allowColumnSorting' | 'useBlockRenderForCodeBlock' | 'allowAnnotations' | 'allowTableResizing' | 'innerRef' | 'children'> & {
|
|
7
|
+
type RendererStyleContainerProps = Pick<RendererWrapperProps, 'onClick' | 'onMouseDown' | 'appearance' | 'allowNestedHeaderLinks' | 'allowColumnSorting' | 'useBlockRenderForCodeBlock' | 'allowAnnotations' | 'allowTableResizing' | 'innerRef' | 'children' | 'allowRendererContainerStyles'> & {
|
|
8
8
|
testId?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const RendererStyleContainer: (props: RendererStyleContainerProps) => jsx.JSX.Element;
|
|
@@ -68,6 +68,7 @@ export interface RendererProps {
|
|
|
68
68
|
isInsideOfInlineExtension?: boolean;
|
|
69
69
|
isTopLevelRenderer?: boolean;
|
|
70
70
|
includeNodesCountInStats?: boolean;
|
|
71
|
+
allowRendererContainerStyles?: boolean;
|
|
71
72
|
shouldRemoveEmptySpaceAroundContent?: boolean;
|
|
72
73
|
/**
|
|
73
74
|
* When enabled a trailing telepointer will be added to the rendered document
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "118.6.
|
|
3
|
+
"version": "118.6.9",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/code": "^17.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^106.
|
|
34
|
+
"@atlaskit/editor-common": "^106.3.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",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags-react": "^0.2.0",
|
|
54
54
|
"@atlaskit/react-ufo": "^3.13.0",
|
|
55
|
-
"@atlaskit/smart-card": "^38.
|
|
55
|
+
"@atlaskit/smart-card": "^38.8.0",
|
|
56
56
|
"@atlaskit/status": "^3.0.0",
|
|
57
57
|
"@atlaskit/task-decision": "^19.2.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.13.0",
|
|
60
|
+
"@atlaskit/tokens": "^5.1.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
63
63
|
"@babel/runtime": "^7.0.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@atlaskit/linking-common": "^9.0.0",
|
|
87
87
|
"@atlaskit/media-core": "^36.1.0",
|
|
88
88
|
"@atlaskit/media-integration-test-helpers": "workspace:^",
|
|
89
|
-
"@atlaskit/media-test-helpers": "^36.
|
|
89
|
+
"@atlaskit/media-test-helpers": "^36.1.0",
|
|
90
90
|
"@atlaskit/mention": "^24.2.0",
|
|
91
91
|
"@atlaskit/modal-dialog": "^14.2.0",
|
|
92
92
|
"@atlaskit/navigation-next": "patch:@atlaskit/navigation-next@npm%3A9.0.17#~/.yarn/patches/@atlaskit-navigation-next-npm-9.0.17-d1445f2f74.patch",
|
|
@@ -139,9 +139,6 @@
|
|
|
139
139
|
"cc_complexit_fe_reduce_fragment_serialization": {
|
|
140
140
|
"type": "boolean"
|
|
141
141
|
},
|
|
142
|
-
"platform_renderer_annotations_create_debug_logging": {
|
|
143
|
-
"type": "boolean"
|
|
144
|
-
},
|
|
145
142
|
"platform_editor_annotation_position_comment_nodes": {
|
|
146
143
|
"type": "boolean"
|
|
147
144
|
},
|