@atlaskit/renderer 138.1.9 → 139.1.0
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 +33 -0
- package/dist/cjs/react/index.js +10 -19
- package/dist/cjs/react/nodes/layoutSection.js +2 -2
- package/dist/cjs/react/nodes/media/index.js +84 -23
- package/dist/cjs/react/nodes/multiBodiedExtension.js +2 -3
- package/dist/cjs/react/nodes/orderedList.js +2 -2
- package/dist/cjs/ui/ExtensionRenderer.js +2 -3
- package/dist/cjs/ui/MediaCard.js +57 -44
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +7 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/index.js +9 -19
- package/dist/es2019/react/nodes/layoutSection.js +2 -2
- package/dist/es2019/react/nodes/media/index.js +59 -7
- package/dist/es2019/react/nodes/multiBodiedExtension.js +2 -3
- package/dist/es2019/react/nodes/orderedList.js +2 -2
- package/dist/es2019/ui/ExtensionRenderer.js +2 -3
- package/dist/es2019/ui/MediaCard.js +17 -4
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +9 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/index.js +10 -19
- package/dist/esm/react/nodes/layoutSection.js +2 -2
- package/dist/esm/react/nodes/media/index.js +84 -23
- package/dist/esm/react/nodes/multiBodiedExtension.js +2 -3
- package/dist/esm/react/nodes/orderedList.js +2 -2
- package/dist/esm/ui/ExtensionRenderer.js +2 -3
- package/dist/esm/ui/MediaCard.js +57 -44
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +7 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/bodiedExtension.d.ts +0 -1
- package/dist/types/react/nodes/extensionFrame.d.ts +0 -1
- package/dist/types/react/nodes/layoutSection.d.ts +0 -1
- package/dist/types/react/nodes/media/index.d.ts +2 -0
- package/dist/types/react/nodes/multiBodiedExtension.d.ts +0 -1
- package/dist/types/react/nodes/orderedList.d.ts +0 -1
- package/dist/types/react/nodes/taskItem.d.ts +1 -1
- package/dist/types/react/types.d.ts +4 -17
- package/dist/types/types/mediaOptions.d.ts +16 -0
- package/dist/types/ui/ExtensionRenderer.d.ts +0 -5
- package/dist/types/ui/MediaCard.d.ts +5 -1
- package/package.json +7 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
3
|
export default function LayoutSection(props) {
|
|
4
|
-
var
|
|
5
|
-
const columnCount = (
|
|
4
|
+
var _props$getContent, _props$getContent$cal;
|
|
5
|
+
const columnCount = (_props$getContent = props.getContent) === null || _props$getContent === void 0 ? void 0 : (_props$getContent$cal = _props$getContent.call(props)) === null || _props$getContent$cal === void 0 ? void 0 : _props$getContent$cal.length;
|
|
6
6
|
return editorExperiment('advanced_layouts', true) ?
|
|
7
7
|
/*#__PURE__*/
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -25,6 +25,11 @@ import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inlin
|
|
|
25
25
|
import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
|
|
26
26
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
27
27
|
import { useAnnotationRangeState } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
28
|
+
const getDataConsumerMark = marks => marks.find(mark => {
|
|
29
|
+
var _mark$type;
|
|
30
|
+
return mark.type === 'dataConsumer' || ((_mark$type = mark.type) === null || _mark$type === void 0 ? void 0 : _mark$type.name) === 'dataConsumer';
|
|
31
|
+
});
|
|
32
|
+
const getRemixDataConsumerMark = marks => fg('cc-maui-add-mark-for-remix-generated-images') ? getDataConsumerMark(marks) : undefined;
|
|
28
33
|
const linkStyle = css({
|
|
29
34
|
position: 'absolute',
|
|
30
35
|
background: 'transparent',
|
|
@@ -212,12 +217,39 @@ const CommentBadgeWrapper = ({
|
|
|
212
217
|
// Ignored via go/ees005
|
|
213
218
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
214
219
|
class Media extends PureComponent {
|
|
215
|
-
constructor(
|
|
216
|
-
super(
|
|
217
|
-
_defineProperty(this, "
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
constructor(_props) {
|
|
221
|
+
super(_props);
|
|
222
|
+
_defineProperty(this, "mediaInstance", {});
|
|
223
|
+
_defineProperty(this, "getDataConsumerMark", () => getRemixDataConsumerMark(this.props.marks));
|
|
224
|
+
_defineProperty(this, "getDataConsumerSource", (props = this.props) => {
|
|
225
|
+
var _getDataConsumerMark, _getDataConsumerMark$;
|
|
226
|
+
return (_getDataConsumerMark = getDataConsumerMark(props.marks)) === null || _getDataConsumerMark === void 0 ? void 0 : (_getDataConsumerMark$ = _getDataConsumerMark.attrs.sources) === null || _getDataConsumerMark$ === void 0 ? void 0 : _getDataConsumerMark$[0];
|
|
227
|
+
});
|
|
228
|
+
_defineProperty(this, "emitMediaRenderEvent", (event, props = this.props) => {
|
|
229
|
+
var _props$onMediaRenderE;
|
|
230
|
+
(_props$onMediaRenderE = props.onMediaRenderEvent) === null || _props$onMediaRenderE === void 0 ? void 0 : _props$onMediaRenderE.call(props, {
|
|
231
|
+
...event,
|
|
232
|
+
dataConsumerSource: this.getDataConsumerSource(props),
|
|
233
|
+
mediaId: props.id,
|
|
234
|
+
mediaInstance: this.mediaInstance
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
_defineProperty(this, "onPreviewRender", renderedMediaId => {
|
|
238
|
+
var _this$props$onPreview, _this$props;
|
|
239
|
+
(_this$props$onPreview = (_this$props = this.props).onPreviewRender) === null || _this$props$onPreview === void 0 ? void 0 : _this$props$onPreview.call(_this$props, renderedMediaId);
|
|
240
|
+
this.emitMediaRenderEvent({
|
|
241
|
+
renderedMediaId,
|
|
242
|
+
type: 'preview-rendered'
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
_defineProperty(this, "onError", reason => {
|
|
246
|
+
var _this$props$onError, _this$props2;
|
|
247
|
+
(_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, reason);
|
|
248
|
+
this.emitMediaRenderEvent({
|
|
249
|
+
reason,
|
|
250
|
+
type: 'error'
|
|
251
|
+
});
|
|
252
|
+
});
|
|
221
253
|
_defineProperty(this, "renderCard", (providers = {}) => {
|
|
222
254
|
var _dataConsumerMark$att;
|
|
223
255
|
const {
|
|
@@ -287,7 +319,9 @@ class Media extends PureComponent {
|
|
|
287
319
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
288
320
|
featureFlags: featureFlags,
|
|
289
321
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
290
|
-
ssr: ssr
|
|
322
|
+
ssr: ssr,
|
|
323
|
+
onError: this.props.onMediaRenderEvent || this.props.onError ? this.onError : undefined,
|
|
324
|
+
onPreviewRender: this.props.onMediaRenderEvent || this.props.onPreviewRender ? this.onPreviewRender : undefined
|
|
291
325
|
}))))));
|
|
292
326
|
});
|
|
293
327
|
_defineProperty(this, "handleMediaLinkClick", event => {
|
|
@@ -320,6 +354,9 @@ class Media extends PureComponent {
|
|
|
320
354
|
}
|
|
321
355
|
componentDidMount() {
|
|
322
356
|
var _dataConsumerMark$att2;
|
|
357
|
+
this.emitMediaRenderEvent({
|
|
358
|
+
type: 'mounted'
|
|
359
|
+
});
|
|
323
360
|
const dataConsumerMark = this.getDataConsumerMark();
|
|
324
361
|
const infographicType = dataConsumerMark === null || dataConsumerMark === void 0 ? void 0 : (_dataConsumerMark$att2 = dataConsumerMark.attrs.sources) === null || _dataConsumerMark$att2 === void 0 ? void 0 : _dataConsumerMark$att2[0];
|
|
325
362
|
if (infographicType && this.props.fireAnalyticsEvent) {
|
|
@@ -336,6 +373,21 @@ class Media extends PureComponent {
|
|
|
336
373
|
});
|
|
337
374
|
}
|
|
338
375
|
}
|
|
376
|
+
componentDidUpdate(prevProps) {
|
|
377
|
+
if (prevProps.id !== this.props.id || this.getDataConsumerSource(prevProps) !== this.getDataConsumerSource() || prevProps.onMediaRenderEvent !== this.props.onMediaRenderEvent) {
|
|
378
|
+
this.emitMediaRenderEvent({
|
|
379
|
+
type: 'unmounted'
|
|
380
|
+
}, prevProps);
|
|
381
|
+
this.emitMediaRenderEvent({
|
|
382
|
+
type: 'mounted'
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
componentWillUnmount() {
|
|
387
|
+
this.emitMediaRenderEvent({
|
|
388
|
+
type: 'unmounted'
|
|
389
|
+
});
|
|
390
|
+
}
|
|
339
391
|
render() {
|
|
340
392
|
const {
|
|
341
393
|
providers
|
|
@@ -139,7 +139,6 @@ const MultiBodiedExtension = props => {
|
|
|
139
139
|
extensionType,
|
|
140
140
|
extensionKey,
|
|
141
141
|
extensionHandlers,
|
|
142
|
-
content,
|
|
143
142
|
getContent,
|
|
144
143
|
marks,
|
|
145
144
|
localId,
|
|
@@ -183,7 +182,7 @@ const MultiBodiedExtension = props => {
|
|
|
183
182
|
extensionKey,
|
|
184
183
|
extensionType,
|
|
185
184
|
parameters,
|
|
186
|
-
content:
|
|
185
|
+
content: getContent === null || getContent === void 0 ? void 0 : getContent(),
|
|
187
186
|
localId,
|
|
188
187
|
fragmentLocalId
|
|
189
188
|
};
|
|
@@ -200,7 +199,7 @@ const MultiBodiedExtension = props => {
|
|
|
200
199
|
activeChildIndex: activeChildIndex
|
|
201
200
|
}, children));
|
|
202
201
|
}
|
|
203
|
-
}, [activeChildIndex, loading, extensionContext, marks, extensionKey, extensionType, parameters,
|
|
202
|
+
}, [activeChildIndex, loading, extensionContext, marks, extensionKey, extensionType, parameters, getContent, localId, actions, children]);
|
|
204
203
|
|
|
205
204
|
// make the frame visible
|
|
206
205
|
const containerActiveFrameStyles = getContainerActiveFrameStyles(activeChildIndex);
|
|
@@ -5,11 +5,11 @@ import { getOrderedListInlineStyles } from '@atlaskit/editor-common/styles';
|
|
|
5
5
|
import { getItemCounterDigitsSize, resolveOrder } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { getListIndentLevel } from '../utils/lists';
|
|
7
7
|
export default function OrderedList(props) {
|
|
8
|
-
var
|
|
8
|
+
var _props$getContent, _props$getContent$cal;
|
|
9
9
|
const extraProps = {};
|
|
10
10
|
|
|
11
11
|
// Item count drives the marker column width, so losing it narrows the gutter by a digit.
|
|
12
|
-
const itemsCount = (
|
|
12
|
+
const itemsCount = (_props$getContent = props.getContent) === null || _props$getContent === void 0 ? void 0 : (_props$getContent$cal = _props$getContent.call(props)) === null || _props$getContent$cal === void 0 ? void 0 : _props$getContent$cal.length;
|
|
13
13
|
const itemCounterDigitsSize = getItemCounterDigitsSize({
|
|
14
14
|
order: props.order,
|
|
15
15
|
itemsCount
|
|
@@ -43,7 +43,6 @@ export default function ExtensionRenderer(props) {
|
|
|
43
43
|
extensionType,
|
|
44
44
|
extensionKey,
|
|
45
45
|
parameters,
|
|
46
|
-
content,
|
|
47
46
|
getContent,
|
|
48
47
|
text,
|
|
49
48
|
type,
|
|
@@ -84,7 +83,7 @@ export default function ExtensionRenderer(props) {
|
|
|
84
83
|
extensionKey,
|
|
85
84
|
extensionType,
|
|
86
85
|
parameters,
|
|
87
|
-
content: (
|
|
86
|
+
content: (getContent === null || getContent === void 0 ? void 0 : getContent()) || text,
|
|
88
87
|
localId,
|
|
89
88
|
fragmentLocalId
|
|
90
89
|
};
|
|
@@ -123,7 +122,7 @@ export default function ExtensionRenderer(props) {
|
|
|
123
122
|
node,
|
|
124
123
|
result
|
|
125
124
|
});
|
|
126
|
-
}, [actions, children,
|
|
125
|
+
}, [actions, children, getContent, extensionHandlers, extensionKey, extensionType, localGetNodeRenderer, localId, marks, parameters, rendererContext === null || rendererContext === void 0 ? void 0 : rendererContext.adDoc, text, type]);
|
|
127
126
|
const setupAndRenderExtensionNode = React.useCallback(providers => {
|
|
128
127
|
if (extensionProvider === null && providers.extensionProvider) {
|
|
129
128
|
handleProvider('extensionProvider', providers.extensionProvider);
|
|
@@ -63,12 +63,13 @@ export class MediaCardView extends Component {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
_defineProperty(this, "onError", reason => {
|
|
66
|
-
var _this$props$fireAnaly, _this$
|
|
66
|
+
var _this$props$onError, _this$props, _this$props$fireAnaly, _this$props2;
|
|
67
67
|
const {
|
|
68
68
|
nestedUnder,
|
|
69
69
|
rendererContext
|
|
70
70
|
} = this.props;
|
|
71
|
-
(_this$props$
|
|
71
|
+
(_this$props$onError = (_this$props = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props, reason);
|
|
72
|
+
(_this$props$fireAnaly = (_this$props2 = this.props).fireAnalyticsEvent) === null || _this$props$fireAnaly === void 0 ? void 0 : _this$props$fireAnaly.call(_this$props2, {
|
|
72
73
|
action: ACTION.ERRORED,
|
|
73
74
|
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
74
75
|
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
@@ -85,6 +86,16 @@ export class MediaCardView extends Component {
|
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
88
|
});
|
|
89
|
+
_defineProperty(this, "onConsumerError", reason => {
|
|
90
|
+
var _this$props$onError2, _this$props3;
|
|
91
|
+
(_this$props$onError2 = (_this$props3 = this.props).onError) === null || _this$props$onError2 === void 0 ? void 0 : _this$props$onError2.call(_this$props3, reason);
|
|
92
|
+
});
|
|
93
|
+
_defineProperty(this, "getMediaErrorHandler", () => {
|
|
94
|
+
if (expValEquals('platform_editor_media_error_analytics', 'isEnabled', true)) {
|
|
95
|
+
return this.onError;
|
|
96
|
+
}
|
|
97
|
+
return this.props.onError ? this.onConsumerError : undefined;
|
|
98
|
+
});
|
|
88
99
|
_defineProperty(this, "renderLoadingCard", () => {
|
|
89
100
|
const {
|
|
90
101
|
cardDimensions
|
|
@@ -218,7 +229,8 @@ export class MediaCardView extends Component {
|
|
|
218
229
|
featureFlags: featureFlags,
|
|
219
230
|
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
220
231
|
shouldHideTooltip: false,
|
|
221
|
-
onError:
|
|
232
|
+
onError: this.getMediaErrorHandler(),
|
|
233
|
+
onPreviewRender: this.props.onPreviewRender
|
|
222
234
|
}))
|
|
223
235
|
);
|
|
224
236
|
}
|
|
@@ -316,7 +328,8 @@ export class MediaCardView extends Component {
|
|
|
316
328
|
shouldHideTooltip: isMobile,
|
|
317
329
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
318
330
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
319
|
-
onError:
|
|
331
|
+
onError: this.getMediaErrorHandler(),
|
|
332
|
+
onPreviewRender: this.props.onPreviewRender
|
|
320
333
|
}));
|
|
321
334
|
}
|
|
322
335
|
}
|
|
@@ -1278,6 +1278,14 @@ const centerWrapperStyles = css({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
1280
|
});
|
|
1281
|
+
|
|
1282
|
+
// Reset only Expands with no preceding content sibling. Streaming SSR style/script siblings
|
|
1283
|
+
// are ignored so moving them to the head on the client does not change the top margin.
|
|
1284
|
+
const expandSsrMarginStyles = css({
|
|
1285
|
+
[`.${RendererCssClassName.DOCUMENT} .${RendererCssClassName.STICKY_SAFE_BREAKOUT_INNER} > [data-node-type='expand']:not(:not(style, script) ~ *)`]: {
|
|
1286
|
+
marginTop: 0
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1281
1289
|
const baseOtherStylesDuplicateAnchor = css({
|
|
1282
1290
|
'& .UnknownBlock': {
|
|
1283
1291
|
fontFamily: "var(--ds-font-family-body, \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
@@ -2919,7 +2927,7 @@ export const RendererStyleContainer = props => {
|
|
|
2919
2927
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
2920
2928
|
textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
|
|
2921
2929
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
2922
|
-
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor,
|
|
2930
|
+
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStylesCommentHeightFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? baseOtherStyles : baseOtherStylesDuplicateAnchor, fg('platform_renderer_expand_ssr_margin_fix') && expandSsrMarginStyles,
|
|
2923
2931
|
// this should be placed after baseOtherStyles
|
|
2924
2932
|
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), fg('platform_forge_inline_bodied_macro') && [migratedInlineBodiedFlowStyle, forgeInlineBodiedSpacingStyle], inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle, firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableOuterBorderOverlayStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && roundedTableRemixBlockHighlightStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeScopedStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_fit_to_content_patch_2') && tableContentModeExtensionContainmentStyles, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeNestedTableStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, firstNodeWithNotMarginTopWithNestedDnD, rendererTableStyles, isStickyScrollbarOn && stickyScrollbarStyles, isStickyScrollbarOn && isExperimentEnabled('platform_editor_table_css_overflow_shadow') && stickyScrollbarOverflowShadowFixStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && expValEqualsNoExposure('platform_editor_table_menu_updates', 'isEnabled', true) && rendererTableSortableColumnValignStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? contentMode === 'compact' ? scaledDenseEmojiStyles : scaledEmojiStyles : contentMode === 'compact' ? denseStyles : undefined, contentMode === 'compact' ? scaledDenseUnicodeEmojiStylesNew : scaledUnicodeEmojiStylesNew, syncBlockStyles, centerWrapperStyles, isInsideSyncBlock ? syncBlockRendererStyles : null, isInsideSyncBlock && tableFakeBorderStyles, isInsideSyncBlock && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? roundedTableFakeBorderOverlayStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2925
2933
|
"data-testid": testId
|
|
@@ -59,7 +59,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
59
59
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
60
60
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
61
61
|
const packageName = "@atlaskit/renderer";
|
|
62
|
-
const packageVersion = "
|
|
62
|
+
const packageVersion = "139.0.0";
|
|
63
63
|
const setAsQueryContainerStyles = css({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size'
|
package/dist/esm/react/index.js
CHANGED
|
@@ -502,7 +502,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
502
502
|
_this$media,
|
|
503
503
|
_this$media2,
|
|
504
504
|
_this$media3,
|
|
505
|
-
_this$media4
|
|
505
|
+
_this$media4,
|
|
506
|
+
_this$media5;
|
|
506
507
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
507
508
|
var _node$type$schema$mar = node.type.schema.marks,
|
|
508
509
|
annotation = _node$type$schema$mar.annotation,
|
|
@@ -539,6 +540,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
539
540
|
enableSyncMediaCard: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableSyncMediaCard,
|
|
540
541
|
mediaViewerExtensions: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.mediaViewerExtensions,
|
|
541
542
|
fallbackMediaNameFetcher: (_this$media4 = this.media) === null || _this$media4 === void 0 ? void 0 : _this$media4.fallbackMediaNameFetcher,
|
|
543
|
+
onMediaRenderEvent: (_this$media5 = this.media) === null || _this$media5 === void 0 ? void 0 : _this$media5.onMediaRenderEvent,
|
|
542
544
|
nestedUnder: nestedUnder
|
|
543
545
|
});
|
|
544
546
|
}
|
|
@@ -601,22 +603,22 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
601
603
|
}, {
|
|
602
604
|
key: "getMediaGroupProps",
|
|
603
605
|
value: function getMediaGroupProps(node) {
|
|
604
|
-
var _this$
|
|
606
|
+
var _this$media6, _this$media7;
|
|
605
607
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
606
608
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
607
609
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
608
610
|
featureFlags: this.media && this.media.featureFlags,
|
|
609
|
-
enableDownloadButton: (_this$
|
|
610
|
-
ssr: (_this$
|
|
611
|
+
enableDownloadButton: (_this$media6 = this.media) === null || _this$media6 === void 0 ? void 0 : _this$media6.enableDownloadButton,
|
|
612
|
+
ssr: (_this$media7 = this.media) === null || _this$media7 === void 0 ? void 0 : _this$media7.ssr
|
|
611
613
|
});
|
|
612
614
|
}
|
|
613
615
|
}, {
|
|
614
616
|
key: "getMediaInlineProps",
|
|
615
617
|
value: function getMediaInlineProps(node) {
|
|
616
|
-
var _this$
|
|
618
|
+
var _this$media8, _this$media9;
|
|
617
619
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
618
|
-
ssr: (_this$
|
|
619
|
-
fallbackMediaNameFetcher: (_this$
|
|
620
|
+
ssr: (_this$media8 = this.media) === null || _this$media8 === void 0 ? void 0 : _this$media8.ssr,
|
|
621
|
+
fallbackMediaNameFetcher: (_this$media9 = this.media) === null || _this$media9 === void 0 ? void 0 : _this$media9.fallbackMediaNameFetcher
|
|
620
622
|
});
|
|
621
623
|
}
|
|
622
624
|
}, {
|
|
@@ -664,18 +666,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
664
666
|
}, {
|
|
665
667
|
key: "getProps",
|
|
666
668
|
value: function getProps(node) {
|
|
667
|
-
var _node$content;
|
|
668
669
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
669
670
|
var startPos = this.startPos + path.length;
|
|
670
|
-
|
|
671
|
-
// `content` is a recursive Fragment.toJSON() attached to every node, so the document is
|
|
672
|
-
// re-serialized once per ancestor — O(depth x size) overall, and a table paid it again for
|
|
673
|
-
// every row and cell. Consumers read `getContent()` instead, which serializes at most once.
|
|
674
|
-
// Experiment call last, so exposure only fires for nodes that have content to serialize.
|
|
675
|
-
var skipEagerContent = !!((_node$content = node.content) !== null && _node$content !== void 0 && _node$content.childCount) && isExperimentEnabled('platform_editor_renderer_defer_content');
|
|
676
|
-
|
|
677
|
-
// Shared so the `content` prop and `getContent()` never serialize the subtree twice.
|
|
678
|
-
var getContent = createContentGetter(node.content);
|
|
679
671
|
return _objectSpread({
|
|
680
672
|
asInline: this.inlinePositions.has(startPos) ? 'on' : undefined,
|
|
681
673
|
text: node.text,
|
|
@@ -685,8 +677,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
685
677
|
portal: this.portal,
|
|
686
678
|
rendererContext: this.rendererContext,
|
|
687
679
|
serializer: this,
|
|
688
|
-
|
|
689
|
-
getContent: getContent,
|
|
680
|
+
getContent: createContentGetter(node.content),
|
|
690
681
|
allowHeadingAnchorLinks: this.allowHeadingAnchorLinks,
|
|
691
682
|
allowCopyToClipboard: this.allowCopyToClipboard,
|
|
692
683
|
allowDownloadCodeBlock: this.allowDownloadCodeBlock,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
3
|
export default function LayoutSection(props) {
|
|
4
|
-
var
|
|
5
|
-
var columnCount = (
|
|
4
|
+
var _props$getContent;
|
|
5
|
+
var columnCount = (_props$getContent = props.getContent) === null || _props$getContent === void 0 || (_props$getContent = _props$getContent.call(props)) === null || _props$getContent === void 0 ? void 0 : _props$getContent.length;
|
|
6
6
|
return editorExperiment('advanced_layouts', true) ?
|
|
7
7
|
/*#__PURE__*/
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -37,6 +37,15 @@ import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inlin
|
|
|
37
37
|
import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
|
|
38
38
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
39
39
|
import { useAnnotationRangeState } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
40
|
+
var getDataConsumerMark = function getDataConsumerMark(marks) {
|
|
41
|
+
return marks.find(function (mark) {
|
|
42
|
+
var _mark$type;
|
|
43
|
+
return mark.type === 'dataConsumer' || ((_mark$type = mark.type) === null || _mark$type === void 0 ? void 0 : _mark$type.name) === 'dataConsumer';
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var getRemixDataConsumerMark = function getRemixDataConsumerMark(marks) {
|
|
47
|
+
return fg('cc-maui-add-mark-for-remix-generated-images') ? getDataConsumerMark(marks) : undefined;
|
|
48
|
+
};
|
|
40
49
|
var linkStyle = css({
|
|
41
50
|
position: 'absolute',
|
|
42
51
|
background: 'transparent',
|
|
@@ -233,32 +242,60 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
233
242
|
// Ignored via go/ees005
|
|
234
243
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
235
244
|
var Media = /*#__PURE__*/function (_PureComponent) {
|
|
236
|
-
function Media(
|
|
245
|
+
function Media(_props) {
|
|
237
246
|
var _this;
|
|
238
247
|
_classCallCheck(this, Media);
|
|
239
|
-
_this = _callSuper(this, Media, [
|
|
248
|
+
_this = _callSuper(this, Media, [_props]);
|
|
249
|
+
_defineProperty(_this, "mediaInstance", {});
|
|
240
250
|
_defineProperty(_this, "getDataConsumerMark", function () {
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
return getRemixDataConsumerMark(_this.props.marks);
|
|
252
|
+
});
|
|
253
|
+
_defineProperty(_this, "getDataConsumerSource", function () {
|
|
254
|
+
var _getDataConsumerMark;
|
|
255
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
|
|
256
|
+
return (_getDataConsumerMark = getDataConsumerMark(props.marks)) === null || _getDataConsumerMark === void 0 || (_getDataConsumerMark = _getDataConsumerMark.attrs.sources) === null || _getDataConsumerMark === void 0 ? void 0 : _getDataConsumerMark[0];
|
|
257
|
+
});
|
|
258
|
+
_defineProperty(_this, "emitMediaRenderEvent", function (event) {
|
|
259
|
+
var _props$onMediaRenderE;
|
|
260
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props;
|
|
261
|
+
(_props$onMediaRenderE = props.onMediaRenderEvent) === null || _props$onMediaRenderE === void 0 || _props$onMediaRenderE.call(props, _objectSpread(_objectSpread({}, event), {}, {
|
|
262
|
+
dataConsumerSource: _this.getDataConsumerSource(props),
|
|
263
|
+
mediaId: props.id,
|
|
264
|
+
mediaInstance: _this.mediaInstance
|
|
265
|
+
}));
|
|
266
|
+
});
|
|
267
|
+
_defineProperty(_this, "onPreviewRender", function (renderedMediaId) {
|
|
268
|
+
var _this$props$onPreview, _this$props;
|
|
269
|
+
(_this$props$onPreview = (_this$props = _this.props).onPreviewRender) === null || _this$props$onPreview === void 0 || _this$props$onPreview.call(_this$props, renderedMediaId);
|
|
270
|
+
_this.emitMediaRenderEvent({
|
|
271
|
+
renderedMediaId: renderedMediaId,
|
|
272
|
+
type: 'preview-rendered'
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
_defineProperty(_this, "onError", function (reason) {
|
|
276
|
+
var _this$props$onError, _this$props2;
|
|
277
|
+
(_this$props$onError = (_this$props2 = _this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props2, reason);
|
|
278
|
+
_this.emitMediaRenderEvent({
|
|
279
|
+
reason: reason,
|
|
280
|
+
type: 'error'
|
|
281
|
+
});
|
|
245
282
|
});
|
|
246
283
|
_defineProperty(_this, "renderCard", function () {
|
|
247
284
|
var _dataConsumerMark$att;
|
|
248
285
|
var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
249
286
|
var contextIdentifierProvider = providers.contextIdentifierProvider;
|
|
250
|
-
var _this$
|
|
251
|
-
allowAltTextOnImages = _this$
|
|
252
|
-
alt = _this$
|
|
253
|
-
featureFlags = _this$
|
|
254
|
-
allowMediaViewer = _this$
|
|
255
|
-
enableDownloadButton = _this$
|
|
256
|
-
ssr = _this$
|
|
257
|
-
width = _this$
|
|
258
|
-
height = _this$
|
|
259
|
-
mediaSingleElement = _this$
|
|
260
|
-
_this$
|
|
261
|
-
isDrafting = _this$
|
|
287
|
+
var _this$props3 = _this.props,
|
|
288
|
+
allowAltTextOnImages = _this$props3.allowAltTextOnImages,
|
|
289
|
+
alt = _this$props3.alt,
|
|
290
|
+
featureFlags = _this$props3.featureFlags,
|
|
291
|
+
allowMediaViewer = _this$props3.shouldOpenMediaViewer,
|
|
292
|
+
enableDownloadButton = _this$props3.enableDownloadButton,
|
|
293
|
+
ssr = _this$props3.ssr,
|
|
294
|
+
width = _this$props3.width,
|
|
295
|
+
height = _this$props3.height,
|
|
296
|
+
mediaSingleElement = _this$props3.mediaSingleElement,
|
|
297
|
+
_this$props3$isDrafti = _this$props3.isDrafting,
|
|
298
|
+
isDrafting = _this$props3$isDrafti === void 0 ? false : _this$props3$isDrafti;
|
|
262
299
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
263
300
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
264
301
|
var dataConsumerMark = _this.getDataConsumerMark();
|
|
@@ -310,14 +347,16 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
310
347
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
311
348
|
featureFlags: featureFlags,
|
|
312
349
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
313
|
-
ssr: ssr
|
|
350
|
+
ssr: ssr,
|
|
351
|
+
onError: _this.props.onMediaRenderEvent || _this.props.onError ? _this.onError : undefined,
|
|
352
|
+
onPreviewRender: _this.props.onMediaRenderEvent || _this.props.onPreviewRender ? _this.onPreviewRender : undefined
|
|
314
353
|
}))))));
|
|
315
354
|
});
|
|
316
355
|
_defineProperty(_this, "handleMediaLinkClick", function (event) {
|
|
317
|
-
var _this$
|
|
318
|
-
fireAnalyticsEvent = _this$
|
|
319
|
-
isLinkMark = _this$
|
|
320
|
-
marks = _this$
|
|
356
|
+
var _this$props4 = _this.props,
|
|
357
|
+
fireAnalyticsEvent = _this$props4.fireAnalyticsEvent,
|
|
358
|
+
isLinkMark = _this$props4.isLinkMark,
|
|
359
|
+
marks = _this$props4.marks;
|
|
321
360
|
if (fireAnalyticsEvent) {
|
|
322
361
|
fireAnalyticsEvent({
|
|
323
362
|
action: ACTION.VISITED,
|
|
@@ -346,6 +385,9 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
346
385
|
key: "componentDidMount",
|
|
347
386
|
value: function componentDidMount() {
|
|
348
387
|
var _dataConsumerMark$att2;
|
|
388
|
+
this.emitMediaRenderEvent({
|
|
389
|
+
type: 'mounted'
|
|
390
|
+
});
|
|
349
391
|
var dataConsumerMark = this.getDataConsumerMark();
|
|
350
392
|
var infographicType = dataConsumerMark === null || dataConsumerMark === void 0 || (_dataConsumerMark$att2 = dataConsumerMark.attrs.sources) === null || _dataConsumerMark$att2 === void 0 ? void 0 : _dataConsumerMark$att2[0];
|
|
351
393
|
if (infographicType && this.props.fireAnalyticsEvent) {
|
|
@@ -362,6 +404,25 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
362
404
|
});
|
|
363
405
|
}
|
|
364
406
|
}
|
|
407
|
+
}, {
|
|
408
|
+
key: "componentDidUpdate",
|
|
409
|
+
value: function componentDidUpdate(prevProps) {
|
|
410
|
+
if (prevProps.id !== this.props.id || this.getDataConsumerSource(prevProps) !== this.getDataConsumerSource() || prevProps.onMediaRenderEvent !== this.props.onMediaRenderEvent) {
|
|
411
|
+
this.emitMediaRenderEvent({
|
|
412
|
+
type: 'unmounted'
|
|
413
|
+
}, prevProps);
|
|
414
|
+
this.emitMediaRenderEvent({
|
|
415
|
+
type: 'mounted'
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "componentWillUnmount",
|
|
421
|
+
value: function componentWillUnmount() {
|
|
422
|
+
this.emitMediaRenderEvent({
|
|
423
|
+
type: 'unmounted'
|
|
424
|
+
});
|
|
425
|
+
}
|
|
365
426
|
}, {
|
|
366
427
|
key: "render",
|
|
367
428
|
value: function render() {
|
|
@@ -131,7 +131,6 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
131
131
|
extensionType = props.extensionType,
|
|
132
132
|
extensionKey = props.extensionKey,
|
|
133
133
|
extensionHandlers = props.extensionHandlers,
|
|
134
|
-
content = props.content,
|
|
135
134
|
getContent = props.getContent,
|
|
136
135
|
marks = props.marks,
|
|
137
136
|
localId = props.localId,
|
|
@@ -175,7 +174,7 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
175
174
|
extensionKey: extensionKey,
|
|
176
175
|
extensionType: extensionType,
|
|
177
176
|
parameters: parameters,
|
|
178
|
-
content:
|
|
177
|
+
content: getContent === null || getContent === void 0 ? void 0 : getContent(),
|
|
179
178
|
localId: localId,
|
|
180
179
|
fragmentLocalId: fragmentLocalId
|
|
181
180
|
};
|
|
@@ -192,7 +191,7 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
192
191
|
activeChildIndex: activeChildIndex
|
|
193
192
|
}, children));
|
|
194
193
|
}
|
|
195
|
-
}, [activeChildIndex, loading, extensionContext, marks, extensionKey, extensionType, parameters,
|
|
194
|
+
}, [activeChildIndex, loading, extensionContext, marks, extensionKey, extensionType, parameters, getContent, localId, actions, children]);
|
|
196
195
|
|
|
197
196
|
// make the frame visible
|
|
198
197
|
var containerActiveFrameStyles = getContainerActiveFrameStyles(activeChildIndex);
|
|
@@ -5,11 +5,11 @@ import { getOrderedListInlineStyles } from '@atlaskit/editor-common/styles';
|
|
|
5
5
|
import { getItemCounterDigitsSize, resolveOrder } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { getListIndentLevel } from '../utils/lists';
|
|
7
7
|
export default function OrderedList(props) {
|
|
8
|
-
var
|
|
8
|
+
var _props$getContent;
|
|
9
9
|
var extraProps = {};
|
|
10
10
|
|
|
11
11
|
// Item count drives the marker column width, so losing it narrows the gutter by a digit.
|
|
12
|
-
var itemsCount = (
|
|
12
|
+
var itemsCount = (_props$getContent = props.getContent) === null || _props$getContent === void 0 || (_props$getContent = _props$getContent.call(props)) === null || _props$getContent === void 0 ? void 0 : _props$getContent.length;
|
|
13
13
|
var itemCounterDigitsSize = getItemCounterDigitsSize({
|
|
14
14
|
order: props.order,
|
|
15
15
|
itemsCount: itemsCount
|
|
@@ -43,7 +43,6 @@ export default function ExtensionRenderer(props) {
|
|
|
43
43
|
extensionType = props.extensionType,
|
|
44
44
|
extensionKey = props.extensionKey,
|
|
45
45
|
parameters = props.parameters,
|
|
46
|
-
content = props.content,
|
|
47
46
|
getContent = props.getContent,
|
|
48
47
|
text = props.text,
|
|
49
48
|
type = props.type,
|
|
@@ -90,7 +89,7 @@ export default function ExtensionRenderer(props) {
|
|
|
90
89
|
extensionKey: extensionKey,
|
|
91
90
|
extensionType: extensionType,
|
|
92
91
|
parameters: parameters,
|
|
93
|
-
content: (
|
|
92
|
+
content: (getContent === null || getContent === void 0 ? void 0 : getContent()) || text,
|
|
94
93
|
localId: localId,
|
|
95
94
|
fragmentLocalId: fragmentLocalId
|
|
96
95
|
};
|
|
@@ -129,7 +128,7 @@ export default function ExtensionRenderer(props) {
|
|
|
129
128
|
node: node,
|
|
130
129
|
result: result
|
|
131
130
|
});
|
|
132
|
-
}, [actions, children,
|
|
131
|
+
}, [actions, children, getContent, extensionHandlers, extensionKey, extensionType, localGetNodeRenderer, localId, marks, parameters, rendererContext === null || rendererContext === void 0 ? void 0 : rendererContext.adDoc, text, type]);
|
|
133
132
|
var setupAndRenderExtensionNode = React.useCallback(function (providers) {
|
|
134
133
|
if (extensionProvider === null && providers.extensionProvider) {
|
|
135
134
|
handleProvider('extensionProvider', providers.extensionProvider);
|