@atlaskit/renderer 85.0.0 → 86.0.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 +65 -0
- package/dist/cjs/analytics/enums.js +1 -0
- package/dist/cjs/messages.js +47 -1
- package/dist/cjs/react/hooks/use-observed-width.js +94 -0
- package/dist/cjs/react/index.js +2 -0
- package/dist/cjs/react/nodes/copy-text-provider.js +2 -1
- package/dist/cjs/react/nodes/heading-anchor.js +8 -2
- package/dist/cjs/react/nodes/inlineCard.js +12 -1
- package/dist/cjs/react/nodes/mediaSingle/index.js +145 -151
- package/dist/cjs/react/nodes/mention.js +0 -2
- package/dist/cjs/react/nodes/status.js +2 -1
- package/dist/cjs/react/nodes/tableCell.js +19 -8
- package/dist/cjs/react/nodes/task-item-with-providers.js +4 -2
- package/dist/cjs/react/nodes/taskItem.js +1 -0
- package/dist/cjs/render-document.js +17 -1
- package/dist/cjs/types/smartLinksOptions.js +5 -0
- package/dist/cjs/ui/Renderer/breakout-ssr.js +47 -4
- package/dist/cjs/ui/Renderer/index.js +1 -0
- package/dist/cjs/ui/SortingIcon.js +22 -9
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +1 -0
- package/dist/es2019/messages.js +44 -0
- package/dist/es2019/react/hooks/use-observed-width.js +59 -0
- package/dist/es2019/react/index.js +2 -0
- package/dist/es2019/react/nodes/copy-text-provider.js +2 -1
- package/dist/es2019/react/nodes/heading-anchor.js +11 -2
- package/dist/es2019/react/nodes/inlineCard.js +11 -1
- package/dist/es2019/react/nodes/mediaSingle/index.js +132 -112
- package/dist/es2019/react/nodes/mention.js +0 -2
- package/dist/es2019/react/nodes/status.js +2 -1
- package/dist/es2019/react/nodes/tableCell.js +20 -9
- package/dist/es2019/react/nodes/task-item-with-providers.js +3 -1
- package/dist/es2019/react/nodes/taskItem.js +1 -0
- package/dist/es2019/render-document.js +17 -1
- package/dist/es2019/types/smartLinksOptions.js +1 -0
- package/dist/es2019/ui/Renderer/breakout-ssr.js +45 -4
- package/dist/es2019/ui/Renderer/index.js +1 -0
- package/dist/es2019/ui/SortingIcon.js +22 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +1 -0
- package/dist/esm/messages.js +44 -0
- package/dist/esm/react/hooks/use-observed-width.js +80 -0
- package/dist/esm/react/index.js +2 -0
- package/dist/esm/react/nodes/copy-text-provider.js +2 -1
- package/dist/esm/react/nodes/heading-anchor.js +9 -2
- package/dist/esm/react/nodes/inlineCard.js +11 -1
- package/dist/esm/react/nodes/mediaSingle/index.js +140 -141
- package/dist/esm/react/nodes/mention.js +0 -2
- package/dist/esm/react/nodes/status.js +2 -1
- package/dist/esm/react/nodes/tableCell.js +17 -8
- package/dist/esm/react/nodes/task-item-with-providers.js +4 -2
- package/dist/esm/react/nodes/taskItem.js +1 -0
- package/dist/esm/render-document.js +16 -1
- package/dist/esm/types/smartLinksOptions.js +1 -0
- package/dist/esm/ui/Renderer/breakout-ssr.js +47 -4
- package/dist/esm/ui/Renderer/index.js +1 -0
- package/dist/esm/ui/SortingIcon.js +20 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +2 -1
- package/dist/types/analytics/events.d.ts +2 -1
- package/dist/types/messages.d.ts +44 -0
- package/dist/types/react/hooks/use-observed-width.d.ts +3 -0
- package/dist/types/react/index.d.ts +3 -0
- package/dist/types/react/nodes/index.d.ts +1 -1
- package/dist/types/react/nodes/inlineCard.d.ts +22 -20
- package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -7
- package/dist/types/react/nodes/mediaSingle/styles.d.ts +1 -1
- package/dist/types/react/nodes/mention.d.ts +0 -1
- package/dist/types/react/nodes/tableCell.d.ts +6 -59
- package/dist/types/react/nodes/task-item-with-providers.d.ts +1 -0
- package/dist/types/types/smartLinksOptions.d.ts +3 -0
- package/dist/types/ui/SortingIcon.d.ts +6 -3
- package/dist/types/ui/renderer-props.d.ts +2 -0
- package/package.json +14 -14
|
@@ -21,6 +21,10 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
21
21
|
|
|
22
22
|
var _types = require("@atlaskit/editor-common/types");
|
|
23
23
|
|
|
24
|
+
var _messages = require("../messages");
|
|
25
|
+
|
|
26
|
+
var _reactIntlNext = require("react-intl-next");
|
|
27
|
+
|
|
24
28
|
var _templateObject, _templateObject2;
|
|
25
29
|
|
|
26
30
|
// We use data url here because of this issue:
|
|
@@ -56,29 +60,37 @@ var getClassName = function getClassName(status) {
|
|
|
56
60
|
}
|
|
57
61
|
};
|
|
58
62
|
|
|
59
|
-
var getTooltipTitle = function getTooltipTitle(status) {
|
|
63
|
+
var getTooltipTitle = function getTooltipTitle(intl, isSortingAllowed, status) {
|
|
64
|
+
var noOrderLabel = _messages.sortingIconMessages.noOrderLabel,
|
|
65
|
+
ascOrderLabel = _messages.sortingIconMessages.ascOrderLabel,
|
|
66
|
+
descOrderLabel = _messages.sortingIconMessages.descOrderLabel,
|
|
67
|
+
invalidLabel = _messages.sortingIconMessages.invalidLabel;
|
|
68
|
+
|
|
69
|
+
if (!isSortingAllowed) {
|
|
70
|
+
return intl.formatMessage(invalidLabel);
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
switch (status) {
|
|
61
74
|
case _types.SortOrder.NO_ORDER:
|
|
62
|
-
return
|
|
75
|
+
return intl.formatMessage(noOrderLabel);
|
|
63
76
|
|
|
64
77
|
case _types.SortOrder.ASC:
|
|
65
|
-
return
|
|
78
|
+
return intl.formatMessage(ascOrderLabel);
|
|
66
79
|
|
|
67
80
|
case _types.SortOrder.DESC:
|
|
68
|
-
return
|
|
81
|
+
return intl.formatMessage(descOrderLabel);
|
|
69
82
|
}
|
|
70
83
|
|
|
71
84
|
return '';
|
|
72
85
|
};
|
|
73
86
|
|
|
74
|
-
var notAllowedTooltip = "\u26A0\uFE0F You can't sort a table with merged cell";
|
|
75
|
-
|
|
76
87
|
var SortingIcon = function SortingIcon(_ref) {
|
|
77
88
|
var isSortingAllowed = _ref.isSortingAllowed,
|
|
78
|
-
sortOrdered = _ref.sortOrdered
|
|
89
|
+
sortOrdered = _ref.sortOrdered,
|
|
90
|
+
intl = _ref.intl;
|
|
79
91
|
var activated = sortOrdered !== _types.SortOrder.NO_ORDER;
|
|
80
92
|
var wrapperClassName = !isSortingAllowed ? StatusClassNames.SORTING_NOT_ALLOWED : '';
|
|
81
|
-
var content = isSortingAllowed
|
|
93
|
+
var content = getTooltipTitle(intl, isSortingAllowed, sortOrdered);
|
|
82
94
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
83
95
|
delay: 0,
|
|
84
96
|
content: content,
|
|
@@ -90,5 +102,6 @@ var SortingIcon = function SortingIcon(_ref) {
|
|
|
90
102
|
})));
|
|
91
103
|
};
|
|
92
104
|
|
|
93
|
-
var _default = SortingIcon;
|
|
105
|
+
var _default = (0, _reactIntlNext.injectIntl)(SortingIcon);
|
|
106
|
+
|
|
94
107
|
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
|
@@ -31,6 +31,7 @@ export let ACTION;
|
|
|
31
31
|
ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
|
|
32
32
|
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
|
|
33
33
|
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
|
|
34
|
+
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
34
35
|
})(ACTION || (ACTION = {}));
|
|
35
36
|
|
|
36
37
|
export let ACTION_SUBJECT;
|
package/dist/es2019/messages.js
CHANGED
|
@@ -14,6 +14,50 @@ export const headingAnchorLinkMessages = defineMessages({
|
|
|
14
14
|
id: 'fabric.editor.headingLink.failedToCopy',
|
|
15
15
|
defaultMessage: 'Copy failed',
|
|
16
16
|
description: 'failed to copy heading link to clipboard'
|
|
17
|
+
},
|
|
18
|
+
copyAriaLabel: {
|
|
19
|
+
id: 'fabric.editor.headingLink.copyAriaLabel',
|
|
20
|
+
defaultMessage: 'Copy',
|
|
21
|
+
description: 'copy aria label for link icon'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export const tableCellMessages = defineMessages({
|
|
25
|
+
noneSortingLabel: {
|
|
26
|
+
id: 'fabric.editor.headingLink.noneSortingLabel',
|
|
27
|
+
defaultMessage: 'none',
|
|
28
|
+
description: 'this table column is not sorted'
|
|
29
|
+
},
|
|
30
|
+
ascSortingLabel: {
|
|
31
|
+
id: 'fabric.editor.headingLink.ascSortingLabel',
|
|
32
|
+
defaultMessage: 'ascending',
|
|
33
|
+
description: 'this table column is sorted in ascending order'
|
|
34
|
+
},
|
|
35
|
+
descSortingLabel: {
|
|
36
|
+
id: 'fabric.editor.headingLink.noneSortingLabel',
|
|
37
|
+
defaultMessage: 'descending',
|
|
38
|
+
description: 'this table column is sorted in descending order'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export const sortingIconMessages = defineMessages({
|
|
42
|
+
noOrderLabel: {
|
|
43
|
+
id: 'fabric.editor.headingLink.noOrderLabel',
|
|
44
|
+
defaultMessage: 'Sort column A to Z',
|
|
45
|
+
description: 'Sort the column in ascending order'
|
|
46
|
+
},
|
|
47
|
+
ascOrderLabel: {
|
|
48
|
+
id: 'fabric.editor.headingLink.ascOrderLabel',
|
|
49
|
+
defaultMessage: 'Sort column Z to A',
|
|
50
|
+
description: 'Sort the column in descending order'
|
|
51
|
+
},
|
|
52
|
+
descOrderLabel: {
|
|
53
|
+
id: 'fabric.editor.headingLink.descOrderLabel',
|
|
54
|
+
defaultMessage: 'Clear sorting',
|
|
55
|
+
description: 'clear the sorting from this column'
|
|
56
|
+
},
|
|
57
|
+
invalidLabel: {
|
|
58
|
+
id: 'fabric.editor.headingLink.descOrderLabel',
|
|
59
|
+
defaultMessage: `⚠️ You can't sort a table with merged cell`,
|
|
60
|
+
description: 'this sort is invalid for merged cells'
|
|
17
61
|
}
|
|
18
62
|
});
|
|
19
63
|
export const codeBlockCopyButtonMessages = defineMessages({
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
let resizeObserver;
|
|
3
|
+
const nodeToCallback = new WeakMap();
|
|
4
|
+
export const useObservedWidth = (node, useObservedWidthFlag) => {
|
|
5
|
+
const [rect, setRect] = React.useState({
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0,
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
right: 0
|
|
14
|
+
});
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!node || !useObservedWidthFlag) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!resizeObserver) {
|
|
21
|
+
resizeObserver = new ResizeObserver(entries => {
|
|
22
|
+
for (let entry of entries) {
|
|
23
|
+
if (nodeToCallback.has(entry.target)) {
|
|
24
|
+
nodeToCallback.get(entry.target)(entry.contentRect);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
nodeToCallback.set(node, rect => {
|
|
31
|
+
const {
|
|
32
|
+
x,
|
|
33
|
+
y,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
top,
|
|
37
|
+
left,
|
|
38
|
+
bottom,
|
|
39
|
+
right
|
|
40
|
+
} = rect;
|
|
41
|
+
return setRect({
|
|
42
|
+
x,
|
|
43
|
+
y,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
top,
|
|
47
|
+
left,
|
|
48
|
+
bottom,
|
|
49
|
+
right
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
resizeObserver.observe(node);
|
|
53
|
+
return () => {
|
|
54
|
+
resizeObserver.unobserve(node);
|
|
55
|
+
nodeToCallback.delete(node);
|
|
56
|
+
};
|
|
57
|
+
}, [node, useObservedWidthFlag]);
|
|
58
|
+
return rect;
|
|
59
|
+
};
|
|
@@ -176,6 +176,7 @@ export default class ReactSerializer {
|
|
|
176
176
|
this.allowAnnotations = Boolean(init.allowAnnotations);
|
|
177
177
|
this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
|
|
178
178
|
this.media = init.media;
|
|
179
|
+
this.smartLinks = init.smartLinks;
|
|
179
180
|
this.allowSelectAllTrap = init.allowSelectAllTrap;
|
|
180
181
|
}
|
|
181
182
|
|
|
@@ -489,6 +490,7 @@ export default class ReactSerializer {
|
|
|
489
490
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
490
491
|
nodeType: node.type.name,
|
|
491
492
|
marks: node.marks,
|
|
493
|
+
smartLinks: this.smartLinks,
|
|
492
494
|
dataAttributes: {
|
|
493
495
|
// We need to account for depth (path.length gives up depth) here
|
|
494
496
|
// but depth doesnt increment the pos, only accounted for.
|
|
@@ -51,7 +51,8 @@ const {
|
|
|
51
51
|
Consumer
|
|
52
52
|
} = CopyTextContext;
|
|
53
53
|
export const CopyArea = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("div", _extends({
|
|
54
|
-
ref: ref
|
|
54
|
+
ref: ref // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
55
|
+
,
|
|
55
56
|
style: {
|
|
56
57
|
position: 'absolute',
|
|
57
58
|
left: '-9999px',
|
|
@@ -39,11 +39,19 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
39
39
|
|
|
40
40
|
_defineProperty(this, "setTooltipState", (message, isClicked = false) => {
|
|
41
41
|
this.setState({
|
|
42
|
+
// TODO: ED-14403 investigate why this does not translate
|
|
42
43
|
tooltipMessage: this.props.intl.formatMessage(message),
|
|
43
44
|
isClicked
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
_defineProperty(this, "getCopyAriaLabel", () => {
|
|
49
|
+
const {
|
|
50
|
+
copyAriaLabel
|
|
51
|
+
} = headingAnchorLinkMessages;
|
|
52
|
+
return this.props.intl.formatMessage(copyAriaLabel);
|
|
53
|
+
});
|
|
54
|
+
|
|
47
55
|
_defineProperty(this, "copyToClipboard", async event => {
|
|
48
56
|
const {
|
|
49
57
|
copiedHeadingLinkToClipboard,
|
|
@@ -66,9 +74,10 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
66
74
|
_defineProperty(this, "renderAnchorButton", () => {
|
|
67
75
|
return /*#__PURE__*/React.createElement(CopyAnchorButton, {
|
|
68
76
|
onMouseLeave: this.resetMessage,
|
|
69
|
-
onClick: this.copyToClipboard
|
|
77
|
+
onClick: this.copyToClipboard,
|
|
78
|
+
"aria-label": this.state.tooltipMessage
|
|
70
79
|
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
71
|
-
label:
|
|
80
|
+
label: this.getCopyAriaLabel(),
|
|
72
81
|
size: this.props.level > 3 ? 'small' : 'medium',
|
|
73
82
|
primaryColor: this.state.isClicked ? B400 : N200
|
|
74
83
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Card } from '@atlaskit/smart-card';
|
|
4
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
4
5
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
5
6
|
import { CardErrorBoundary } from './fallback';
|
|
6
7
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
@@ -11,7 +12,8 @@ const InlineCard = props => {
|
|
|
11
12
|
url,
|
|
12
13
|
data,
|
|
13
14
|
eventHandlers,
|
|
14
|
-
portal
|
|
15
|
+
portal,
|
|
16
|
+
smartLinks
|
|
15
17
|
} = props;
|
|
16
18
|
const onClick = getCardClickHandler(eventHandlers, url);
|
|
17
19
|
const cardProps = {
|
|
@@ -20,6 +22,14 @@ const InlineCard = props => {
|
|
|
20
22
|
onClick,
|
|
21
23
|
container: portal
|
|
22
24
|
};
|
|
25
|
+
|
|
26
|
+
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
28
|
+
appearance: "inline",
|
|
29
|
+
url: url
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
return /*#__PURE__*/React.createElement("span", {
|
|
24
34
|
"data-inline-card": true,
|
|
25
35
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mapBreakpointToLayoutMaxWidth, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { Component, default as React } from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
5
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
4
|
+
import { mapBreakpointToLayoutMaxWidth, getBreakpoint, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
7
|
+
import { useObservedWidth } from '../../hooks/use-observed-width';
|
|
7
8
|
import { ExtendedUIMediaSingle } from './styles';
|
|
8
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
9
9
|
const DEFAULT_WIDTH = 250;
|
|
10
10
|
const DEFAULT_HEIGHT = 200;
|
|
11
11
|
|
|
@@ -39,131 +39,151 @@ export const getMediaContainerWidth = (currentContainerWidth, layout) => {
|
|
|
39
39
|
return !currentContainerWidth && layout !== 'full-width' && layout !== 'wide' ? akEditorDefaultLayoutWidth : currentContainerWidth;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
super(props);
|
|
42
|
+
const MediaSingle = props => {
|
|
43
|
+
var _ref$current;
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
const {
|
|
46
|
+
rendererAppearance,
|
|
47
|
+
featureFlags,
|
|
48
|
+
isInsideOfBlockNode,
|
|
49
|
+
allowDynamicTextSizing,
|
|
50
|
+
layout,
|
|
51
|
+
children,
|
|
52
|
+
width: pctWidth
|
|
53
|
+
} = props;
|
|
54
|
+
const isCaptionsFlaggedOn = getMediaFeatureFlag('captions', featureFlags);
|
|
55
|
+
const [externalImageDimensions, setExternalImageDimensions] = React.useState({
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 0
|
|
58
|
+
});
|
|
59
|
+
const ref = React.useRef(null);
|
|
60
|
+
const onExternalImageLoaded = React.useCallback(({
|
|
61
|
+
width,
|
|
62
|
+
height
|
|
63
|
+
}) => {
|
|
64
|
+
setExternalImageDimensions({
|
|
47
65
|
width,
|
|
48
66
|
height
|
|
49
|
-
}) => {
|
|
50
|
-
this.setState({
|
|
51
|
-
width,
|
|
52
|
-
height
|
|
53
|
-
});
|
|
54
67
|
});
|
|
68
|
+
}, []);
|
|
69
|
+
const observedWidthFlag = getMediaFeatureFlag('observedWidth', featureFlags);
|
|
70
|
+
const {
|
|
71
|
+
width: observedWidth
|
|
72
|
+
} = useObservedWidth((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentElement, observedWidthFlag);
|
|
73
|
+
let media;
|
|
74
|
+
const [node, caption] = React.Children.toArray(children);
|
|
55
75
|
|
|
56
|
-
|
|
76
|
+
if (!isMediaElement(node)) {
|
|
77
|
+
const mediaElement = checkForMediaElement(node.props.children);
|
|
57
78
|
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
if (!mediaElement) {
|
|
80
|
+
return node;
|
|
81
|
+
}
|
|
60
82
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let media;
|
|
66
|
-
const [node, caption] = React.Children.toArray(props.children);
|
|
83
|
+
media = mediaElement;
|
|
84
|
+
} else {
|
|
85
|
+
media = node;
|
|
86
|
+
}
|
|
67
87
|
|
|
68
|
-
|
|
69
|
-
|
|
88
|
+
let {
|
|
89
|
+
width = DEFAULT_WIDTH,
|
|
90
|
+
height = DEFAULT_HEIGHT,
|
|
91
|
+
type
|
|
92
|
+
} = media.props;
|
|
70
93
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
if (type === 'external') {
|
|
95
|
+
const {
|
|
96
|
+
width: stateWidth,
|
|
97
|
+
height: stateHeight
|
|
98
|
+
} = externalImageDimensions;
|
|
74
99
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
media = node;
|
|
100
|
+
if (width === null) {
|
|
101
|
+
width = stateWidth || DEFAULT_WIDTH;
|
|
78
102
|
}
|
|
79
103
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = media.props;
|
|
85
|
-
|
|
86
|
-
if (type === 'external') {
|
|
87
|
-
const {
|
|
88
|
-
width: stateWidth,
|
|
89
|
-
height: stateHeight
|
|
90
|
-
} = this.state;
|
|
91
|
-
|
|
92
|
-
if (width === null) {
|
|
93
|
-
width = stateWidth || DEFAULT_WIDTH;
|
|
94
|
-
}
|
|
104
|
+
if (height === null) {
|
|
105
|
+
height = stateHeight || DEFAULT_HEIGHT;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
95
108
|
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
if (width === null) {
|
|
110
|
+
width = DEFAULT_WIDTH;
|
|
111
|
+
height = DEFAULT_HEIGHT;
|
|
112
|
+
} // TODO: put appearance-based padding into theme instead
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
116
|
+
const isFullWidth = rendererAppearance === 'full-width';
|
|
117
|
+
|
|
118
|
+
const calcDimensions = (mediaContainerWidth, mediaBreakpoint) => {
|
|
119
|
+
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
120
|
+
const breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
|
|
121
|
+
const maxWidth = containerWidth;
|
|
122
|
+
const maxHeight = height / width * maxWidth;
|
|
123
|
+
const cardDimensions = {
|
|
124
|
+
width: `${maxWidth}px`,
|
|
125
|
+
height: `${maxHeight}px`
|
|
126
|
+
};
|
|
127
|
+
let nonFullWidthSize = containerWidth;
|
|
128
|
+
|
|
129
|
+
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
130
|
+
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
131
|
+
|
|
132
|
+
if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
|
|
133
|
+
nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
|
|
134
|
+
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
135
|
+
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
136
|
+
} else {
|
|
137
|
+
nonFullWidthSize = containerWidth - padding;
|
|
98
138
|
}
|
|
99
139
|
}
|
|
100
140
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
const minWidth = Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding);
|
|
142
|
+
const lineLength = isFullWidth ? minWidth : nonFullWidthSize;
|
|
143
|
+
return {
|
|
144
|
+
cardDimensions,
|
|
145
|
+
lineLength,
|
|
146
|
+
containerWidth
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const originalDimensions = {
|
|
151
|
+
height,
|
|
152
|
+
width
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const renderMediaSingle = (renderWidth, mediaBreakpoint) => {
|
|
107
156
|
const {
|
|
108
|
-
|
|
157
|
+
cardDimensions,
|
|
158
|
+
lineLength,
|
|
159
|
+
containerWidth
|
|
160
|
+
} = calcDimensions(renderWidth, mediaBreakpoint);
|
|
161
|
+
const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
162
|
+
resizeMode: 'stretchy-fit',
|
|
163
|
+
cardDimensions,
|
|
164
|
+
originalDimensions,
|
|
165
|
+
onExternalImageLoaded,
|
|
166
|
+
disableOverlay: true,
|
|
109
167
|
featureFlags
|
|
110
|
-
} = this.props;
|
|
111
|
-
const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
112
|
-
return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
113
|
-
width: widthConsumerValue,
|
|
114
|
-
breakpoint
|
|
115
|
-
}) => {
|
|
116
|
-
const containerWidth = getMediaContainerWidth(widthConsumerValue, props.layout);
|
|
117
|
-
const {
|
|
118
|
-
isInsideOfBlockNode,
|
|
119
|
-
allowDynamicTextSizing
|
|
120
|
-
} = this.props;
|
|
121
|
-
const maxWidth = containerWidth;
|
|
122
|
-
const maxHeight = height / width * maxWidth;
|
|
123
|
-
const cardDimensions = {
|
|
124
|
-
width: `${maxWidth}px`,
|
|
125
|
-
height: `${maxHeight}px`
|
|
126
|
-
};
|
|
127
|
-
const isFullWidth = rendererAppearance === 'full-width';
|
|
128
|
-
let nonFullWidthSize = containerWidth;
|
|
129
|
-
|
|
130
|
-
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
131
|
-
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
132
|
-
|
|
133
|
-
if (isContainerSizeGreaterThanMaxFullPageWidth && allowDynamicTextSizing) {
|
|
134
|
-
nonFullWidthSize = mapBreakpointToLayoutMaxWidth(breakpoint);
|
|
135
|
-
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
136
|
-
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
137
|
-
} else {
|
|
138
|
-
nonFullWidthSize = containerWidth - padding;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const lineLength = isFullWidth ? Math.min(akEditorFullWidthLayoutWidth, containerWidth - padding) : nonFullWidthSize;
|
|
143
|
-
const originalDimensions = {
|
|
144
|
-
height,
|
|
145
|
-
width
|
|
146
|
-
};
|
|
147
|
-
const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
148
|
-
resizeMode: 'stretchy-fit',
|
|
149
|
-
cardDimensions,
|
|
150
|
-
originalDimensions,
|
|
151
|
-
onExternalImageLoaded: this.onExternalImageLoaded,
|
|
152
|
-
disableOverlay: true,
|
|
153
|
-
featureFlags: featureFlags
|
|
154
|
-
});
|
|
155
|
-
return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
|
|
156
|
-
layout: props.layout,
|
|
157
|
-
width: width,
|
|
158
|
-
height: height,
|
|
159
|
-
lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
|
|
160
|
-
containerWidth: containerWidth,
|
|
161
|
-
pctWidth: props.width,
|
|
162
|
-
fullWidthMode: isFullWidth
|
|
163
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), this.isCaptionsFlaggedOn && caption);
|
|
164
168
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
return /*#__PURE__*/React.createElement(ExtendedUIMediaSingle, {
|
|
170
|
+
handleMediaSingleRef: ref,
|
|
171
|
+
layout: layout,
|
|
172
|
+
width: width,
|
|
173
|
+
height: height,
|
|
174
|
+
lineLength: isInsideOfBlockNode ? containerWidth : lineLength,
|
|
175
|
+
containerWidth: containerWidth,
|
|
176
|
+
pctWidth: pctWidth,
|
|
177
|
+
fullWidthMode: isFullWidth
|
|
178
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, mediaComponent), isCaptionsFlaggedOn && caption);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return observedWidthFlag ? renderMediaSingle(observedWidth || document.body.offsetWidth) : /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
182
|
+
width,
|
|
183
|
+
breakpoint
|
|
184
|
+
}) => {
|
|
185
|
+
return renderMediaSingle(width, breakpoint);
|
|
186
|
+
});
|
|
187
|
+
};
|
|
168
188
|
|
|
169
189
|
export default injectIntl(MediaSingle);
|
|
@@ -6,7 +6,6 @@ export default class MentionItem extends PureComponent {
|
|
|
6
6
|
const {
|
|
7
7
|
eventHandlers,
|
|
8
8
|
id,
|
|
9
|
-
portal,
|
|
10
9
|
providers,
|
|
11
10
|
text,
|
|
12
11
|
accessLevel
|
|
@@ -16,7 +15,6 @@ export default class MentionItem extends PureComponent {
|
|
|
16
15
|
text: text,
|
|
17
16
|
accessLevel: accessLevel,
|
|
18
17
|
providers: providers,
|
|
19
|
-
portal: portal,
|
|
20
18
|
eventHandlers: eventHandlers && eventHandlers.mention
|
|
21
19
|
});
|
|
22
20
|
}
|
|
@@ -8,6 +8,8 @@ import SortingIcon from '../../ui/SortingIcon';
|
|
|
8
8
|
import { MODE, PLATFORM } from '../../analytics/events';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
10
10
|
import { RendererCssClassName } from '../../consts';
|
|
11
|
+
import { injectIntl } from 'react-intl-next';
|
|
12
|
+
import { tableCellMessages } from '../../messages';
|
|
11
13
|
const IgnoreSorting = ['LABEL', 'INPUT'];
|
|
12
14
|
|
|
13
15
|
const nextStatusOrder = currentSortOrder => {
|
|
@@ -25,19 +27,25 @@ const nextStatusOrder = currentSortOrder => {
|
|
|
25
27
|
return SortOrder.NO_ORDER;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
const getSortOrderLabel = currentSortOrder => {
|
|
30
|
+
const getSortOrderLabel = (intl, currentSortOrder) => {
|
|
31
|
+
const {
|
|
32
|
+
noneSortingLabel,
|
|
33
|
+
ascSortingLabel,
|
|
34
|
+
descSortingLabel
|
|
35
|
+
} = tableCellMessages;
|
|
36
|
+
|
|
29
37
|
switch (currentSortOrder) {
|
|
30
38
|
case SortOrder.NO_ORDER:
|
|
31
|
-
return
|
|
39
|
+
return intl.formatMessage(noneSortingLabel);
|
|
32
40
|
|
|
33
41
|
case SortOrder.ASC:
|
|
34
|
-
return
|
|
42
|
+
return intl.formatMessage(ascSortingLabel);
|
|
35
43
|
|
|
36
44
|
case SortOrder.DESC:
|
|
37
|
-
return
|
|
45
|
+
return intl.formatMessage(descSortingLabel);
|
|
38
46
|
|
|
39
47
|
default:
|
|
40
|
-
return
|
|
48
|
+
return intl.formatMessage(noneSortingLabel);
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
51
|
|
|
@@ -102,7 +110,7 @@ const withCellProps = WrapperComponent => {
|
|
|
102
110
|
};
|
|
103
111
|
|
|
104
112
|
export const withSortableColumn = WrapperComponent => {
|
|
105
|
-
|
|
113
|
+
class WithSortableColumn extends React.Component {
|
|
106
114
|
constructor(props) {
|
|
107
115
|
super(props);
|
|
108
116
|
|
|
@@ -166,7 +174,8 @@ export const withSortableColumn = WrapperComponent => {
|
|
|
166
174
|
onSorting,
|
|
167
175
|
children,
|
|
168
176
|
sortOrdered,
|
|
169
|
-
isHeaderRow
|
|
177
|
+
isHeaderRow,
|
|
178
|
+
intl
|
|
170
179
|
} = this.props;
|
|
171
180
|
const sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
|
|
172
181
|
|
|
@@ -182,7 +191,7 @@ export const withSortableColumn = WrapperComponent => {
|
|
|
182
191
|
|
|
183
192
|
return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, this.props, {
|
|
184
193
|
className: className,
|
|
185
|
-
ariaSort: getSortOrderLabel(sortOrdered)
|
|
194
|
+
ariaSort: getSortOrderLabel(intl, sortOrdered)
|
|
186
195
|
}), /*#__PURE__*/React.createElement("div", {
|
|
187
196
|
className: RendererCssClassName.SORTABLE_COLUMN_BUTTON,
|
|
188
197
|
role: "button",
|
|
@@ -199,7 +208,9 @@ export const withSortableColumn = WrapperComponent => {
|
|
|
199
208
|
}))));
|
|
200
209
|
}
|
|
201
210
|
|
|
202
|
-
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return injectIntl(WithSortableColumn);
|
|
203
214
|
};
|
|
204
215
|
export const TableHeader = compose(withSortableColumn, withCellProps)('th');
|
|
205
216
|
export const TableCell = withCellProps('td');
|
|
@@ -45,11 +45,13 @@ export default class TaskItemWithProviders extends Component {
|
|
|
45
45
|
const {
|
|
46
46
|
contextIdentifierProvider,
|
|
47
47
|
objectAri,
|
|
48
|
+
isRenderer,
|
|
48
49
|
...otherProps
|
|
49
50
|
} = this.props;
|
|
50
51
|
const resolvedObjectId = this.state.resolvedContextProvider && this.state.resolvedContextProvider.objectId || objectAri;
|
|
51
52
|
return /*#__PURE__*/React.createElement(ResourcedTaskItem, _extends({}, otherProps, {
|
|
52
|
-
objectAri: resolvedObjectId
|
|
53
|
+
objectAri: resolvedObjectId,
|
|
54
|
+
isRenderer: isRenderer
|
|
53
55
|
}));
|
|
54
56
|
}
|
|
55
57
|
|