@atlaskit/renderer 118.6.7 → 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 +19 -0
- package/dist/cjs/actions/index.js +7 -173
- package/dist/cjs/ui/ExtensionRenderer.js +9 -14
- 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/ExtensionRenderer.js +8 -12
- 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/ExtensionRenderer.js +9 -14
- 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/ExtensionRenderer.d.ts +1 -3
- 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/ExtensionRenderer.d.ts +1 -3
- 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 +7 -10
|
@@ -9,21 +9,18 @@ import memoizeOne from 'memoize-one';
|
|
|
9
9
|
import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
|
|
10
10
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
11
11
|
import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
|
|
12
|
-
// When running on server-side emotion will generate style tags before elements.
|
|
13
|
-
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
14
|
-
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
15
|
-
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
16
|
-
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
17
|
-
const forceMarginTopStyle = css({
|
|
18
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
19
|
-
marginTop: `1px !important`
|
|
20
|
-
});
|
|
21
12
|
const inlineExtensionStyle = css({
|
|
22
13
|
display: 'inline-block',
|
|
23
14
|
maxWidth: '100%',
|
|
24
15
|
verticalAlign: 'middle',
|
|
16
|
+
// 0px margin top is important here.
|
|
17
|
+
// When running on server-side emotion will generate style tags before elements.
|
|
18
|
+
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
19
|
+
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
20
|
+
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
21
|
+
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
25
22
|
// es-lint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
26
|
-
margin: `
|
|
23
|
+
margin: `0px 1px ${"var(--ds-space-050, 4px)"}`,
|
|
27
24
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
28
25
|
'& .rich-media-item': {
|
|
29
26
|
maxWidth: '100%'
|
|
@@ -122,12 +119,11 @@ export default function ExtensionRenderer(props) {
|
|
|
122
119
|
});
|
|
123
120
|
}
|
|
124
121
|
export const InlineNodeRendererWrapper = ({
|
|
125
|
-
forceMarginTop = false,
|
|
126
122
|
children
|
|
127
123
|
}) => {
|
|
128
124
|
return jsx("div", {
|
|
129
125
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
130
126
|
className: "inline-extension-renderer",
|
|
131
|
-
css:
|
|
127
|
+
css: inlineExtensionStyle
|
|
132
128
|
}, children);
|
|
133
129
|
};
|
|
@@ -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 };
|
|
@@ -10,21 +10,18 @@ import memoizeOne from 'memoize-one';
|
|
|
10
10
|
import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
|
|
11
11
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
12
12
|
import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
|
|
13
|
-
// When running on server-side emotion will generate style tags before elements.
|
|
14
|
-
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
15
|
-
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
16
|
-
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
17
|
-
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
18
|
-
var forceMarginTopStyle = css({
|
|
19
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
20
|
-
marginTop: "1px !important"
|
|
21
|
-
});
|
|
22
13
|
var inlineExtensionStyle = css({
|
|
23
14
|
display: 'inline-block',
|
|
24
15
|
maxWidth: '100%',
|
|
25
16
|
verticalAlign: 'middle',
|
|
17
|
+
// 0px margin top is important here.
|
|
18
|
+
// When running on server-side emotion will generate style tags before elements.
|
|
19
|
+
// This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
|
|
20
|
+
// However as soon as the styles are extracted to <head> it adds back the margin.
|
|
21
|
+
// The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
|
|
22
|
+
// This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
|
|
26
23
|
// es-lint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
27
|
-
margin: "
|
|
24
|
+
margin: "0px 1px ".concat("var(--ds-space-050, 4px)"),
|
|
28
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
29
26
|
'& .rich-media-item': {
|
|
30
27
|
maxWidth: '100%'
|
|
@@ -128,12 +125,10 @@ export default function ExtensionRenderer(props) {
|
|
|
128
125
|
});
|
|
129
126
|
}
|
|
130
127
|
export var InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
|
|
131
|
-
var
|
|
132
|
-
forceMarginTop = _ref$forceMarginTop === void 0 ? false : _ref$forceMarginTop,
|
|
133
|
-
children = _ref.children;
|
|
128
|
+
var children = _ref.children;
|
|
134
129
|
return jsx("div", {
|
|
135
130
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
136
131
|
className: "inline-extension-renderer",
|
|
137
|
-
css:
|
|
132
|
+
css: inlineExtensionStyle
|
|
138
133
|
}, children);
|
|
139
134
|
};
|
|
@@ -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 {};
|
|
@@ -28,7 +28,5 @@ interface Props {
|
|
|
28
28
|
}) => JSX.Element;
|
|
29
29
|
}
|
|
30
30
|
export default function ExtensionRenderer(props: Props): JSX.Element;
|
|
31
|
-
export declare const InlineNodeRendererWrapper: ({
|
|
32
|
-
forceMarginTop?: boolean | undefined;
|
|
33
|
-
}>) => jsx.JSX.Element;
|
|
31
|
+
export declare const InlineNodeRendererWrapper: ({ children }: React.PropsWithChildren<unknown>) => jsx.JSX.Element;
|
|
34
32
|
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 {};
|