@atlaskit/renderer 115.0.5 → 115.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 +24 -0
- package/dist/cjs/actions/index.js +14 -8
- package/dist/cjs/react/nodes/blockCard.js +2 -1
- package/dist/cjs/react/nodes/embedCard.js +4 -1
- package/dist/cjs/react/nodes/inlineCard.js +2 -1
- package/dist/cjs/react/nodes/media/index.js +5 -1
- package/dist/cjs/react/nodes/mediaSingle/index.js +2 -2
- package/dist/cjs/react/nodes/tableNew.js +9 -3
- package/dist/cjs/ui/Renderer/PortalContext.js +24 -0
- package/dist/cjs/ui/Renderer/index.js +31 -10
- package/dist/cjs/ui/annotations/context.js +14 -1
- package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +199 -35
- package/dist/cjs/ui/annotations/draft/component.js +6 -1
- package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +5 -1
- package/dist/cjs/ui/annotations/hooks/user-selection.js +14 -9
- package/dist/cjs/ui/annotations/hover/mounter.js +31 -10
- package/dist/cjs/ui/annotations/hover/range-validator.js +2 -1
- package/dist/cjs/ui/annotations/index.js +2 -1
- package/dist/cjs/ui/annotations/selection/mounter.js +41 -12
- package/dist/cjs/ui/annotations/selection/range-validator.js +10 -7
- package/dist/cjs/ui/annotations/wrapper.js +48 -2
- package/dist/es2019/actions/index.js +12 -8
- package/dist/es2019/react/nodes/blockCard.js +2 -1
- package/dist/es2019/react/nodes/embedCard.js +4 -1
- package/dist/es2019/react/nodes/inlineCard.js +2 -1
- package/dist/es2019/react/nodes/media/index.js +6 -1
- package/dist/es2019/react/nodes/mediaSingle/index.js +2 -2
- package/dist/es2019/react/nodes/tableNew.js +9 -3
- package/dist/es2019/ui/Renderer/PortalContext.js +15 -0
- package/dist/es2019/ui/Renderer/index.js +31 -10
- package/dist/es2019/ui/annotations/context.js +14 -1
- package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +207 -30
- package/dist/es2019/ui/annotations/draft/component.js +7 -1
- package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +6 -1
- package/dist/es2019/ui/annotations/hooks/user-selection.js +14 -9
- package/dist/es2019/ui/annotations/hover/mounter.js +33 -10
- package/dist/es2019/ui/annotations/hover/range-validator.js +2 -1
- package/dist/es2019/ui/annotations/index.js +2 -1
- package/dist/es2019/ui/annotations/selection/mounter.js +43 -12
- package/dist/es2019/ui/annotations/selection/range-validator.js +6 -4
- package/dist/es2019/ui/annotations/wrapper.js +49 -1
- package/dist/esm/actions/index.js +14 -8
- package/dist/esm/react/nodes/blockCard.js +2 -1
- package/dist/esm/react/nodes/embedCard.js +4 -1
- package/dist/esm/react/nodes/inlineCard.js +2 -1
- package/dist/esm/react/nodes/media/index.js +5 -1
- package/dist/esm/react/nodes/mediaSingle/index.js +2 -2
- package/dist/esm/react/nodes/tableNew.js +9 -3
- package/dist/esm/ui/Renderer/PortalContext.js +15 -0
- package/dist/esm/ui/Renderer/index.js +31 -10
- package/dist/esm/ui/annotations/context.js +14 -1
- package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +198 -34
- package/dist/esm/ui/annotations/draft/component.js +6 -1
- package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +5 -1
- package/dist/esm/ui/annotations/hooks/user-selection.js +14 -9
- package/dist/esm/ui/annotations/hover/mounter.js +31 -10
- package/dist/esm/ui/annotations/hover/range-validator.js +2 -1
- package/dist/esm/ui/annotations/index.js +2 -1
- package/dist/esm/ui/annotations/selection/mounter.js +41 -12
- package/dist/esm/ui/annotations/selection/range-validator.js +10 -7
- package/dist/esm/ui/annotations/wrapper.js +47 -1
- package/dist/types/actions/index.d.ts +5 -0
- package/dist/types/ui/Renderer/PortalContext.d.ts +6 -0
- package/dist/types/ui/Renderer/index.d.ts +0 -3
- package/dist/types/ui/annotations/context.d.ts +13 -1
- package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +46 -4
- package/dist/types/ui/annotations/hooks/user-selection.d.ts +2 -1
- package/dist/types/ui/annotations/hover/mounter.d.ts +10 -2
- package/dist/types/ui/annotations/hover/range-validator.d.ts +14 -3
- package/dist/types/ui/annotations/selection/mounter.d.ts +10 -2
- package/dist/types/ui/annotations/selection/range-validator.d.ts +14 -3
- package/dist/types/ui/annotations/wrapper.d.ts +2 -0
- package/dist/types-ts4.5/actions/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/Renderer/PortalContext.d.ts +6 -0
- package/dist/types-ts4.5/ui/Renderer/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/annotations/context.d.ts +13 -1
- package/dist/types-ts4.5/ui/annotations/contexts/AnnotationRangeContext.d.ts +46 -4
- package/dist/types-ts4.5/ui/annotations/hooks/user-selection.d.ts +2 -0
- package/dist/types-ts4.5/ui/annotations/hover/mounter.d.ts +10 -2
- package/dist/types-ts4.5/ui/annotations/hover/range-validator.d.ts +14 -3
- package/dist/types-ts4.5/ui/annotations/selection/mounter.d.ts +10 -2
- package/dist/types-ts4.5/ui/annotations/selection/range-validator.d.ts +14 -3
- package/dist/types-ts4.5/ui/annotations/wrapper.d.ts +2 -0
- package/package.json +8 -2
|
@@ -2,8 +2,9 @@ import React, { useCallback, useContext } from 'react';
|
|
|
2
2
|
import { AnnotationsDraftContextWrapper, ProvidersContext } from './context';
|
|
3
3
|
import { RangeValidator as HoverRangeValidator } from './hover/range-validator';
|
|
4
4
|
import { SelectionRangeValidator } from './selection/range-validator';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { useAnnotationRangeDispatch, useAnnotationRangeState } from './contexts/AnnotationRangeContext';
|
|
6
|
-
export const
|
|
7
|
+
export const AnnotationsContextWrapperOld = props => {
|
|
7
8
|
const providers = useContext(ProvidersContext);
|
|
8
9
|
const {
|
|
9
10
|
range,
|
|
@@ -62,4 +63,51 @@ export const AnnotationsContextWrapper = props => {
|
|
|
62
63
|
clearDraftRange: clearRangeForDraft,
|
|
63
64
|
isNestedRender: isNestedRender
|
|
64
65
|
}, render);
|
|
66
|
+
};
|
|
67
|
+
export const AnnotationsContextWrapperNew = props => {
|
|
68
|
+
const providers = useContext(ProvidersContext);
|
|
69
|
+
const {
|
|
70
|
+
rendererRef,
|
|
71
|
+
createAnalyticsEvent,
|
|
72
|
+
children
|
|
73
|
+
} = props;
|
|
74
|
+
const inlineCommentProvider = providers && providers.inlineComment;
|
|
75
|
+
const selectionComponent = inlineCommentProvider && inlineCommentProvider.selectionComponent;
|
|
76
|
+
const hoverComponent = inlineCommentProvider && inlineCommentProvider.hoverComponent;
|
|
77
|
+
if (!selectionComponent && !hoverComponent) {
|
|
78
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children, !!hoverComponent && /*#__PURE__*/React.createElement(HoverRangeValidator, {
|
|
81
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
82
|
+
rendererRef: rendererRef
|
|
83
|
+
// Ignored via go/ees005
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
85
|
+
,
|
|
86
|
+
component: hoverComponent
|
|
87
|
+
}), !!selectionComponent && /*#__PURE__*/React.createElement(SelectionRangeValidator, {
|
|
88
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
89
|
+
rendererRef: rendererRef
|
|
90
|
+
// Ignored via go/ees005
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
92
|
+
,
|
|
93
|
+
selectionComponent: selectionComponent
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
export const AnnotationsContextWrapper = props => {
|
|
97
|
+
if (fg('platform_renderer_annotation_draft_position_fix')) {
|
|
98
|
+
// IMPORTANT: Please make sure the AnnotationsDraftContextWrapper is not used anc cleaned up correctly.
|
|
99
|
+
// This code path completely removes all reliance on that wrapper. Also the applyAnnotationDraftAt & clearAnnotationDraft
|
|
100
|
+
// properties have been made optional and not used. This means when we cleanup we can also remove those properties.
|
|
101
|
+
return /*#__PURE__*/React.createElement(AnnotationsContextWrapperNew, {
|
|
102
|
+
rendererRef: props.rendererRef,
|
|
103
|
+
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
104
|
+
isNestedRender: props.isNestedRender
|
|
105
|
+
}, props.children);
|
|
106
|
+
} else {
|
|
107
|
+
return /*#__PURE__*/React.createElement(AnnotationsContextWrapperOld, {
|
|
108
|
+
rendererRef: props.rendererRef,
|
|
109
|
+
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
110
|
+
isNestedRender: props.isNestedRender
|
|
111
|
+
}, props.children);
|
|
112
|
+
}
|
|
65
113
|
};
|
|
@@ -15,10 +15,6 @@ 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
|
-
|
|
22
18
|
function RendererActions() {
|
|
23
19
|
var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
24
20
|
_classCallCheck(this, RendererActions);
|
|
@@ -26,6 +22,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
26
22
|
// This module can only be used when wrapped with
|
|
27
23
|
// the <RendererContext> component for now.
|
|
28
24
|
_defineProperty(this, "initFromContext", false);
|
|
25
|
+
_defineProperty(this, "debugAnalyticLoggingEnabled", false);
|
|
29
26
|
// TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
|
|
30
27
|
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
31
28
|
// This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
|
|
@@ -108,7 +105,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
108
105
|
key: "_privateValidatePositionsForAnnotation",
|
|
109
106
|
value: function _privateValidatePositionsForAnnotation(from, to) {
|
|
110
107
|
if (!this.doc || !this.schema) {
|
|
111
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
108
|
+
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
112
109
|
this.onAnalyticsEvent({
|
|
113
110
|
// @ts-ignore
|
|
114
111
|
action: 'failed',
|
|
@@ -130,7 +127,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
130
127
|
}
|
|
131
128
|
var currentSelection = TextSelection.create(this.doc, from, to);
|
|
132
129
|
if (isEmptyTextSelection(currentSelection, this.schema)) {
|
|
133
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
130
|
+
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
134
131
|
this.onAnalyticsEvent({
|
|
135
132
|
// @ts-ignore
|
|
136
133
|
action: 'failed',
|
|
@@ -154,7 +151,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
154
151
|
from: from,
|
|
155
152
|
to: to
|
|
156
153
|
}, this.doc, this.schema);
|
|
157
|
-
if (!result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
154
|
+
if (this.debugAnalyticLoggingEnabled && !result && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
158
155
|
this.onAnalyticsEvent({
|
|
159
156
|
// @ts-ignore
|
|
160
157
|
action: 'failed',
|
|
@@ -334,7 +331,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
334
331
|
key: "isValidAnnotationPosition",
|
|
335
332
|
value: function isValidAnnotationPosition(pos) {
|
|
336
333
|
if (!pos || !this.doc) {
|
|
337
|
-
if (this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
334
|
+
if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && fg('platform_renderer_annotations_create_debug_logging')) {
|
|
338
335
|
this.onAnalyticsEvent({
|
|
339
336
|
// @ts-ignore
|
|
340
337
|
action: 'failed',
|
|
@@ -541,6 +538,15 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
541
538
|
schema: this.schema
|
|
542
539
|
}, annotationId);
|
|
543
540
|
}
|
|
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
|
+
}
|
|
544
550
|
}]);
|
|
545
551
|
}();
|
|
546
552
|
export { RendererActions as default };
|
|
@@ -16,6 +16,7 @@ import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
import { N40 } from '@atlaskit/theme/colors';
|
|
18
18
|
import { calcBreakoutWidth, canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
19
|
+
import { usePortal } from '../../ui/Renderer/PortalContext';
|
|
19
20
|
var datasourceContainerStyle = css({
|
|
20
21
|
borderRadius: "var(--ds-border-radius-200, 8px)",
|
|
21
22
|
border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
@@ -29,9 +30,9 @@ export default function BlockCard(props) {
|
|
|
29
30
|
var url = props.url,
|
|
30
31
|
data = props.data,
|
|
31
32
|
eventHandlers = props.eventHandlers,
|
|
32
|
-
portal = props.portal,
|
|
33
33
|
smartLinks = props.smartLinks,
|
|
34
34
|
isNodeNested = props.isNodeNested;
|
|
35
|
+
var portal = usePortal(props);
|
|
35
36
|
var _ref = smartLinks || {},
|
|
36
37
|
actionOptions = _ref.actionOptions;
|
|
37
38
|
var onClick = getCardClickHandler(eventHandlers, url);
|
|
@@ -17,6 +17,7 @@ import { CardErrorBoundary } from './fallback';
|
|
|
17
17
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
18
18
|
import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
19
19
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
20
|
+
import { usePortal } from '../../ui/Renderer/PortalContext';
|
|
20
21
|
var embedCardWrapperStyles = css({
|
|
21
22
|
width: '100%',
|
|
22
23
|
height: '100%',
|
|
@@ -30,6 +31,8 @@ var embedCardWrapperStyles = css({
|
|
|
30
31
|
},
|
|
31
32
|
margin: '0 auto'
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
33
36
|
var uIMediaSingleLayoutStyles = css({
|
|
34
37
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
35
38
|
marginLeft: '50%',
|
|
@@ -40,13 +43,13 @@ export default function EmbedCard(props) {
|
|
|
40
43
|
var url = props.url,
|
|
41
44
|
data = props.data,
|
|
42
45
|
eventHandlers = props.eventHandlers,
|
|
43
|
-
portal = props.portal,
|
|
44
46
|
layout = props.layout,
|
|
45
47
|
width = props.width,
|
|
46
48
|
isInsideOfBlockNode = props.isInsideOfBlockNode,
|
|
47
49
|
rendererAppearance = props.rendererAppearance,
|
|
48
50
|
smartLinks = props.smartLinks,
|
|
49
51
|
isInsideOfInlineExtension = props.isInsideOfInlineExtension;
|
|
52
|
+
var portal = usePortal(props);
|
|
50
53
|
var embedIframeRef = useRef(null);
|
|
51
54
|
var onClick = getCardClickHandler(eventHandlers, url);
|
|
52
55
|
var _ref = smartLinks || {},
|
|
@@ -14,12 +14,13 @@ import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
|
14
14
|
import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
15
15
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
16
16
|
import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
|
|
17
|
+
import { usePortal } from '../../ui/Renderer/PortalContext';
|
|
17
18
|
var InlineCard = function InlineCard(props) {
|
|
18
19
|
var url = props.url,
|
|
19
20
|
data = props.data,
|
|
20
21
|
eventHandlers = props.eventHandlers,
|
|
21
|
-
portal = props.portal,
|
|
22
22
|
smartLinks = props.smartLinks;
|
|
23
|
+
var portal = usePortal(props);
|
|
23
24
|
var onClick = getCardClickHandler(eventHandlers, url);
|
|
24
25
|
var cardProps = {
|
|
25
26
|
url: url,
|
|
@@ -40,6 +40,7 @@ import { injectIntl } from 'react-intl-next';
|
|
|
40
40
|
import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inline-comments-filter';
|
|
41
41
|
import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
|
|
42
42
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
43
|
+
import { useAnnotationRangeState } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
43
44
|
var linkStyle = css({
|
|
44
45
|
position: 'absolute',
|
|
45
46
|
background: 'transparent',
|
|
@@ -421,7 +422,10 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
421
422
|
}]);
|
|
422
423
|
}(PureComponent);
|
|
423
424
|
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
424
|
-
var
|
|
425
|
+
var draftPositionOld = React.useContext(AnnotationsDraftContext);
|
|
426
|
+
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
427
|
+
hoverDraftDocumentPosition = _useAnnotationRangeSt.hoverDraftDocumentPosition;
|
|
428
|
+
var draftPosition = fg('platform_renderer_annotation_draft_position_fix') ? hoverDraftDocumentPosition : draftPositionOld;
|
|
425
429
|
var dataAttributes = props.dataAttributes;
|
|
426
430
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
427
431
|
var _useState9 = useState(),
|
|
@@ -130,7 +130,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
130
130
|
var padding = isFullPage ? FullPagePadding * 2 : 0;
|
|
131
131
|
var calcDimensions = useCallback(function (mediaContainerWidth) {
|
|
132
132
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
133
|
-
var maxWidth = isSSR() && widthAttr && fg('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
|
|
133
|
+
var maxWidth = isSSR() && widthAttr && typeof widthAttr === 'number' && widthType === 'pixel' && fg('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
|
|
134
134
|
var maxHeight = height / width * maxWidth;
|
|
135
135
|
var cardDimensions = {
|
|
136
136
|
width: "".concat(maxWidth, "px"),
|
|
@@ -151,7 +151,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
151
151
|
cardDimensions: cardDimensions,
|
|
152
152
|
lineLength: lineLength
|
|
153
153
|
};
|
|
154
|
-
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr]);
|
|
154
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr, widthType]);
|
|
155
155
|
var originalDimensions = useMemo(function () {
|
|
156
156
|
return {
|
|
157
157
|
width: width,
|
|
@@ -380,11 +380,17 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
380
380
|
this.updatedLayout = layout;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
// defined in colgroup.tsx:
|
|
384
|
+
// appearance == comment && allowTableResizing && means it is a comment
|
|
385
|
+
// appearance == comment && !allowTableResizing && means it is a inline comment
|
|
386
|
+
// for inline comments, the table should inherit the width of the parent component rather than maintain its own size
|
|
387
|
+
var isInsideInlineComment = rendererAppearance === 'comment' && !allowTableResizing;
|
|
388
|
+
|
|
383
389
|
// These styling removes extra padding for `comment` rendererAppearance.
|
|
384
390
|
// This is especially relevant for Jira which only uses `comment` appearance and does not need padding.
|
|
385
391
|
var resizerContainerPadding = rendererAppearance === 'comment' ? 0 : gutterPadding;
|
|
386
|
-
var resizerItemMaxWidth = rendererAppearance === 'comment' ? "min(100cqw, var(--ak-editor-table-max-width))" : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))";
|
|
387
|
-
var resizerItemWidth = rendererAppearance === 'comment' ? "min(100cqw, ".concat(tableWidthAttribute, ")") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")");
|
|
392
|
+
var resizerItemMaxWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, var(--ak-editor-table-max-width))" : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))";
|
|
393
|
+
var resizerItemWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, ".concat(tableWidthAttribute, ")") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")");
|
|
388
394
|
|
|
389
395
|
// full width tables can have either left-aligned or centered layout despite looking centered in the renderer.
|
|
390
396
|
// in these cases, keep the alignment unset
|
|
@@ -406,7 +412,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
406
412
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
407
413
|
,
|
|
408
414
|
style: {
|
|
409
|
-
width: "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
|
|
415
|
+
width: isInsideInlineComment ? '100%' : "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
|
|
410
416
|
}
|
|
411
417
|
}, /*#__PURE__*/React.createElement("div", {
|
|
412
418
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
export var PortalContext = /*#__PURE__*/React.createContext(undefined);
|
|
4
|
+
export var usePortal = function usePortal() {
|
|
5
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
6
|
+
portalFromProps = _ref.portal;
|
|
7
|
+
var portalFromContext = useContext(PortalContext);
|
|
8
|
+
if (portalFromProps) {
|
|
9
|
+
return portalFromProps;
|
|
10
|
+
}
|
|
11
|
+
if (fg('cc_complexit_reduce_portal_rerenders')) {
|
|
12
|
+
return portalFromContext;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["portal"];
|
|
3
5
|
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; }
|
|
4
6
|
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) { _defineProperty(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; }
|
|
5
7
|
/**
|
|
@@ -47,14 +49,14 @@ import { RendererStyleContainer } from './RendererStyleContainer';
|
|
|
47
49
|
import { getBaseFontSize } from './get-base-font-size';
|
|
48
50
|
import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
49
51
|
import { useMemoFromPropsDerivative } from './useMemoFromPropsDerivative';
|
|
52
|
+
import { PortalContext } from './PortalContext';
|
|
50
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
51
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
52
55
|
var packageName = "@atlaskit/renderer";
|
|
53
|
-
var packageVersion = "115.0
|
|
56
|
+
var packageVersion = "115.1.0";
|
|
54
57
|
var setAsQueryContainerStyles = css({
|
|
55
58
|
containerName: 'ak-renderer-wrapper',
|
|
56
|
-
containerType: 'inline-size'
|
|
57
|
-
contain: 'layout style inline-size'
|
|
59
|
+
containerType: 'inline-size'
|
|
58
60
|
});
|
|
59
61
|
var handleMouseTripleClickInTables = function handleMouseTripleClickInTables(event) {
|
|
60
62
|
var _parentElement, _parentElement2;
|
|
@@ -162,10 +164,6 @@ var handleWrapperOnClick = function handleWrapperOnClick(event, props, mouseDown
|
|
|
162
164
|
props.eventHandlers.onUnhandledClick(event);
|
|
163
165
|
}
|
|
164
166
|
};
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Exported due to enzyme test reliance on this component.
|
|
168
|
-
*/
|
|
169
167
|
export var RendererFunctionalComponent = function RendererFunctionalComponent(props) {
|
|
170
168
|
var createAnalyticsEvent = props.createAnalyticsEvent;
|
|
171
169
|
var mouseDownSelection = useRef(undefined);
|
|
@@ -448,6 +446,29 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
448
446
|
}
|
|
449
447
|
};
|
|
450
448
|
var RendererFunctionalComponentMemoized = /*#__PURE__*/React.memo(RendererFunctionalComponent);
|
|
449
|
+
var RendererFunctionalComponentWithPortalContext = function RendererFunctionalComponentWithPortalContext(props) {
|
|
450
|
+
var portal = props.portal,
|
|
451
|
+
propsWithoutPortal = _objectWithoutProperties(props, _excluded);
|
|
452
|
+
return jsx(PortalContext.Provider, {
|
|
453
|
+
value: portal
|
|
454
|
+
}, jsx(RendererFunctionalComponent, propsWithoutPortal));
|
|
455
|
+
};
|
|
456
|
+
var RendererFunctionalComponentWithPortalContextMemoized = /*#__PURE__*/React.memo(RendererFunctionalComponentWithPortalContext);
|
|
457
|
+
var getRendererComponent = function getRendererComponent(nodeComponents) {
|
|
458
|
+
// If nodeComponents are provided, for now we don't want to remove portal from props
|
|
459
|
+
// and use context instead because at this time we cannot guarantee that existing
|
|
460
|
+
// consumers of Atlaskit Renderer will update to use the new portal context.
|
|
461
|
+
if (!Boolean(nodeComponents) && fg('cc_complexit_reduce_portal_rerenders')) {
|
|
462
|
+
if (fg('cc_perf_reduce_rerenders')) {
|
|
463
|
+
return RendererFunctionalComponentWithPortalContextMemoized;
|
|
464
|
+
}
|
|
465
|
+
return RendererFunctionalComponentWithPortalContext;
|
|
466
|
+
}
|
|
467
|
+
if (fg('cc_perf_reduce_rerenders')) {
|
|
468
|
+
return RendererFunctionalComponentMemoized;
|
|
469
|
+
}
|
|
470
|
+
return RendererFunctionalComponent;
|
|
471
|
+
};
|
|
451
472
|
export function Renderer(props) {
|
|
452
473
|
var _React$useContext = React.useContext(AnnotationsPositionContext),
|
|
453
474
|
startPos = _React$useContext.startPos;
|
|
@@ -455,7 +476,7 @@ export function Renderer(props) {
|
|
|
455
476
|
isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
|
|
456
477
|
var _ref = useContext(ValidationContext) || {},
|
|
457
478
|
skipValidation = _ref.skipValidation;
|
|
458
|
-
var RendererComponent =
|
|
479
|
+
var RendererComponent = getRendererComponent(props.nodeComponents);
|
|
459
480
|
return jsx(RendererComponent
|
|
460
481
|
// Ignored via go/ees005
|
|
461
482
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -593,10 +614,10 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
593
614
|
// Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
|
|
594
615
|
// Otherwise when appearance is unspecified the renderer size is decided by the content.
|
|
595
616
|
// In this case we can't set the container-type = inline-size as it will collapse width to 0.
|
|
596
|
-
return
|
|
617
|
+
return appearance === 'comment' &&
|
|
597
618
|
// In case of having excerpt-include on page there are multiple renderers nested.
|
|
598
619
|
// Make sure only the root renderer is set to be query container.
|
|
599
|
-
isTopLevelRenderer && fg('platform-
|
|
620
|
+
isTopLevelRenderer && fg('platform-ssr-table-resize') ? jsx("div", {
|
|
600
621
|
css: setAsQueryContainerStyles
|
|
601
622
|
}, renderer) : renderer;
|
|
602
623
|
});
|
|
@@ -8,10 +8,23 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import React, { createContext } from 'react';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
export var AnnotationsDraftContext = /*#__PURE__*/createContext(null);
|
|
12
11
|
export var ProvidersContext = /*#__PURE__*/createContext(null);
|
|
13
12
|
export var InlineCommentsStateContext = /*#__PURE__*/createContext({});
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
17
|
+
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
18
|
+
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
19
|
+
*/
|
|
20
|
+
export var AnnotationsDraftContext = /*#__PURE__*/createContext(null);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @private
|
|
24
|
+
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
25
|
+
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
26
|
+
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
27
|
+
*/
|
|
15
28
|
// Ignored via go/ees005
|
|
16
29
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
17
30
|
export var AnnotationsDraftContextWrapper = /*#__PURE__*/function (_React$Component) {
|