@atlaskit/renderer 94.0.0 → 96.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 +48 -0
- package/dist/cjs/react/index.js +0 -2
- package/dist/cjs/react/marks/link.js +3 -1
- package/dist/cjs/react/nodes/codeBlock.js +5 -0
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +3 -1
- package/dist/cjs/react/nodes/embedCard.js +2 -5
- package/dist/cjs/react/nodes/heading-anchor.js +4 -2
- package/dist/cjs/react/nodes/inlineCard.js +5 -1
- package/dist/cjs/react/nodes/mediaInline.js +41 -4
- package/dist/cjs/react/nodes/mediaSingle/index.js +3 -7
- package/dist/cjs/react/nodes/table/colgroup.js +6 -12
- package/dist/cjs/react/nodes/table/sticky.js +21 -21
- package/dist/cjs/react/nodes/table/table.js +1 -3
- package/dist/cjs/react/nodes/table.js +20 -9
- package/dist/cjs/react/nodes/tableCell.js +5 -3
- package/dist/cjs/render-document.js +142 -55
- package/dist/cjs/ui/MediaCard.js +2 -2
- package/dist/cjs/ui/Renderer/breakout-ssr.js +6 -8
- package/dist/cjs/ui/Renderer/index.js +22 -34
- package/dist/cjs/ui/Renderer/style.js +30 -28
- package/dist/cjs/ui/Renderer/truncated-wrapper.js +6 -3
- package/dist/cjs/ui/SortingIcon.js +6 -2
- package/dist/cjs/ui/annotations/draft/component.js +1 -1
- package/dist/cjs/ui/annotations/element/mark.js +1 -1
- package/dist/cjs/ui/annotations/hooks/use-events.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/index.js +0 -2
- package/dist/es2019/react/marks/link.js +8 -3
- package/dist/es2019/react/nodes/codeBlock.js +5 -0
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +7 -6
- package/dist/es2019/react/nodes/embedCard.js +4 -7
- package/dist/es2019/react/nodes/heading-anchor.js +3 -2
- package/dist/es2019/react/nodes/inlineCard.js +4 -1
- package/dist/es2019/react/nodes/mediaInline.js +36 -4
- package/dist/es2019/react/nodes/mediaSingle/index.js +5 -9
- package/dist/es2019/react/nodes/table/colgroup.js +2 -8
- package/dist/es2019/react/nodes/table/sticky.js +30 -28
- package/dist/es2019/react/nodes/table/table.js +1 -3
- package/dist/es2019/react/nodes/table.js +18 -9
- package/dist/es2019/react/nodes/tableCell.js +4 -1
- package/dist/es2019/render-document.js +117 -56
- package/dist/es2019/ui/MediaCard.js +1 -1
- package/dist/es2019/ui/Renderer/breakout-ssr.js +6 -8
- package/dist/es2019/ui/Renderer/index.js +6 -19
- package/dist/es2019/ui/Renderer/style.js +50 -32
- package/dist/es2019/ui/Renderer/truncated-wrapper.js +5 -3
- package/dist/es2019/ui/SortingIcon.js +7 -5
- package/dist/es2019/ui/annotations/draft/component.js +1 -1
- package/dist/es2019/ui/annotations/element/mark.js +1 -1
- package/dist/es2019/ui/annotations/hooks/use-events.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/index.js +0 -2
- package/dist/esm/react/marks/link.js +3 -2
- package/dist/esm/react/nodes/codeBlock.js +5 -0
- package/dist/esm/react/nodes/codeBlockCopyButton.js +2 -1
- package/dist/esm/react/nodes/embedCard.js +4 -7
- package/dist/esm/react/nodes/heading-anchor.js +3 -2
- package/dist/esm/react/nodes/inlineCard.js +4 -1
- package/dist/esm/react/nodes/mediaInline.js +36 -4
- package/dist/esm/react/nodes/mediaSingle/index.js +5 -9
- package/dist/esm/react/nodes/table/colgroup.js +6 -12
- package/dist/esm/react/nodes/table/sticky.js +20 -22
- package/dist/esm/react/nodes/table/table.js +1 -3
- package/dist/esm/react/nodes/table.js +20 -9
- package/dist/esm/react/nodes/tableCell.js +5 -3
- package/dist/esm/render-document.js +137 -55
- package/dist/esm/ui/MediaCard.js +1 -1
- package/dist/esm/ui/Renderer/breakout-ssr.js +6 -8
- package/dist/esm/ui/Renderer/index.js +21 -33
- package/dist/esm/ui/Renderer/style.js +30 -28
- package/dist/esm/ui/Renderer/truncated-wrapper.js +5 -3
- package/dist/esm/ui/SortingIcon.js +5 -3
- package/dist/esm/ui/annotations/draft/component.js +1 -1
- package/dist/esm/ui/annotations/element/mark.js +1 -1
- package/dist/esm/ui/annotations/hooks/use-events.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/react/index.d.ts +0 -2
- package/dist/types/react/nodes/embedCard.d.ts +0 -1
- package/dist/types/react/nodes/extension.d.ts +6 -0
- package/dist/types/react/nodes/index.d.ts +1 -2
- package/dist/types/react/nodes/media.d.ts +0 -1
- package/dist/types/react/nodes/mediaInline.d.ts +6 -3
- package/dist/types/react/nodes/mediaSingle/index.d.ts +0 -1
- package/dist/types/react/nodes/table/sticky.d.ts +1 -2
- package/dist/types/react/nodes/table/table.d.ts +1 -1
- package/dist/types/react/nodes/table/types.d.ts +0 -1
- package/dist/types/react/types.d.ts +0 -1
- package/dist/types/render-document.d.ts +1 -1
- package/dist/types/renderer-context.d.ts +1 -0
- package/dist/types/ui/MediaCard.d.ts +1 -1
- package/dist/types/ui/Renderer/breakout-ssr.d.ts +2 -4
- package/dist/types/ui/renderer-props.d.ts +1 -0
- package/package.json +27 -20
|
@@ -23,15 +23,19 @@ var _messages = require("../messages");
|
|
|
23
23
|
|
|
24
24
|
var _reactIntlNext = require("react-intl-next");
|
|
25
25
|
|
|
26
|
+
var _tokens = require("@atlaskit/tokens");
|
|
27
|
+
|
|
26
28
|
var _templateObject, _templateObject2;
|
|
27
29
|
|
|
28
30
|
// We use data url here because of this issue:
|
|
29
31
|
// https://product-fabric.atlassian.net/browse/ED-8001
|
|
30
32
|
// Remove this workaround if Firefox has fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=1664350
|
|
33
|
+
// TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4136
|
|
31
34
|
var TableSortIconDataUrl = "data:image/svg+xml;utf8,".concat(encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M-8-6h24v24H-8z\"></path><path d=\"M3 8.509V1c0-.552.449-1 1-1 .552 0 1 .448 1 1V8.51l1.217-1.206a1.05 1.05 0 011.477 0 1.03 1.03 0 01.004 1.463l-.003.002-2.956 2.93a1.053 1.053 0 01-1.478 0L.305 8.767a1.03 1.03 0 01.001-1.464 1.05 1.05 0 011.477 0L3 8.508z\" fill=\"#42526E\"></path></g></svg>"));
|
|
32
35
|
exports.TableSortIconDataUrl = TableSortIconDataUrl;
|
|
33
36
|
var TABLE_SORTING_ICON_CLASS = 'table-sorting-icon';
|
|
34
|
-
var StatusClassNames;
|
|
37
|
+
var StatusClassNames; // TODO: get design to check border
|
|
38
|
+
|
|
35
39
|
exports.StatusClassNames = StatusClassNames;
|
|
36
40
|
|
|
37
41
|
(function (StatusClassNames) {
|
|
@@ -41,7 +45,7 @@ exports.StatusClassNames = StatusClassNames;
|
|
|
41
45
|
StatusClassNames["SORTING_NOT_ALLOWED"] = "sorting-icon-svg__not-allowed";
|
|
42
46
|
})(StatusClassNames || (exports.StatusClassNames = StatusClassNames = {}));
|
|
43
47
|
|
|
44
|
-
var wrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n display: flex;\n height: 28px;\n width: 28px;\n margin: 6px;\n right: 0;\n top: 0;\n border: 2px solid
|
|
48
|
+
var wrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n display: flex;\n height: 28px;\n width: 28px;\n margin: 6px;\n right: 0;\n top: 0;\n border: 2px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n justify-content: center;\n align-items: center;\n\n &:hover {\n background-color: ", ";\n }\n\n &.", " {\n cursor: not-allowed;\n }\n"])), (0, _tokens.token)('color.border.inverse', '#fff'), (0, _constants.gridSize)() / 2, (0, _tokens.token)('color.background.neutral.subtle', _colors.N20), (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N30), StatusClassNames.SORTING_NOT_ALLOWED);
|
|
45
49
|
var tableSortingIconStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 8px;\n height: 12px;\n transition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n transform-origin: 50% 50%;\n background-image: url(", ");\n\n &.", " {\n transform: rotate(-180deg);\n }\n\n &.", "-inactive {\n opacity: 0.7;\n }\n"])), TableSortIconDataUrl, StatusClassNames.DESC, TABLE_SORTING_ICON_CLASS);
|
|
46
50
|
|
|
47
51
|
var getClassName = function getClassName(status) {
|
|
@@ -36,7 +36,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
36
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
37
|
|
|
38
38
|
var markStyles = function markStyles(props) {
|
|
39
|
-
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color:
|
|
39
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n ", ";\n"])), (0, _styles.AnnotationSharedCSSByState)(props).focus);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
var AnnotationDraft = function AnnotationDraft(_ref) {
|
|
@@ -36,7 +36,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
36
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
37
|
|
|
38
38
|
var markStyles = function markStyles(props) {
|
|
39
|
-
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color:
|
|
39
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n }\n"])), _adfSchema.AnnotationMarkStates.ACTIVE, (0, _styles.AnnotationSharedCSSByState)({
|
|
40
40
|
theme: props
|
|
41
41
|
}).blur, (0, _styles.AnnotationSharedCSSByState)({
|
|
42
42
|
theme: props
|
|
@@ -45,7 +45,7 @@ var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEvent(_ref)
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
var nextStates = Object.values(payload).reduce(function (acc, curr) {
|
|
48
|
-
if (curr.annotationType === type) {
|
|
48
|
+
if (curr.id && curr.annotationType === type) {
|
|
49
49
|
// Check for empty state to prevent additional renders
|
|
50
50
|
var isEmpty = curr.state === null || curr.state === undefined;
|
|
51
51
|
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, curr.id, !isEmpty ? curr.state : states[curr.id]));
|
|
@@ -116,7 +116,9 @@ var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
|
|
|
116
116
|
var cb = function cb(_ref3) {
|
|
117
117
|
var annotationIds = _ref3.annotationIds,
|
|
118
118
|
eventTarget = _ref3.eventTarget;
|
|
119
|
-
var annotationsByType = annotationIds.
|
|
119
|
+
var annotationsByType = annotationIds.filter(function (id) {
|
|
120
|
+
return !!id;
|
|
121
|
+
}).map(function (id) {
|
|
120
122
|
return {
|
|
121
123
|
id: id,
|
|
122
124
|
type: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
package/dist/cjs/version.json
CHANGED
|
@@ -162,7 +162,6 @@ export default class ReactSerializer {
|
|
|
162
162
|
this.appearance = init.appearance;
|
|
163
163
|
this.disableHeadingIDs = init.disableHeadingIDs;
|
|
164
164
|
this.disableActions = init.disableActions;
|
|
165
|
-
this.allowDynamicTextSizing = init.allowDynamicTextSizing;
|
|
166
165
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
167
166
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
168
167
|
this.allowPlaceholderText = init.allowPlaceholderText;
|
|
@@ -482,7 +481,6 @@ export default class ReactSerializer {
|
|
|
482
481
|
rendererContext: this.rendererContext,
|
|
483
482
|
serializer: this,
|
|
484
483
|
content: node.content ? node.content.toJSON() : undefined,
|
|
485
|
-
allowDynamicTextSizing: this.allowDynamicTextSizing,
|
|
486
484
|
allowHeadingAnchorLinks: this.allowHeadingAnchorLinks,
|
|
487
485
|
allowCopyToClipboard: this.allowCopyToClipboard,
|
|
488
486
|
allowPlaceholderText: this.allowPlaceholderText,
|
|
@@ -3,17 +3,22 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { Fragment } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import { B400, B300 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { B400, B300, B500 } from '@atlaskit/theme/colors';
|
|
7
7
|
import { getEventHandler } from '../../utils';
|
|
8
8
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
10
11
|
const anchorStyles = css`
|
|
11
|
-
color: ${B400};
|
|
12
|
+
color: ${token('color.link', B400)};
|
|
12
13
|
|
|
13
14
|
&:hover {
|
|
14
|
-
color: ${B300};
|
|
15
|
+
color: ${token('color.link', B300)};
|
|
15
16
|
text-decoration: underline;
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
&:active {
|
|
20
|
+
color: ${token('color.link.pressed', B500)};
|
|
21
|
+
}
|
|
17
22
|
`;
|
|
18
23
|
export default function Link(props) {
|
|
19
24
|
const {
|
|
@@ -10,6 +10,9 @@ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { useFeatureFlags } from '../../use-feature-flags';
|
|
11
11
|
import CopyButton from './codeBlockCopyButton';
|
|
12
12
|
|
|
13
|
+
// TODO: Quality ticket https://product-fabric.atlassian.net/browse/DSP-4118
|
|
14
|
+
|
|
15
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
13
16
|
const codeBlockStyle = props => css`
|
|
14
17
|
tab-size: 4;
|
|
15
18
|
[data-ds--code--code-block] {
|
|
@@ -26,6 +29,8 @@ const codeBlockStyle = props => css`
|
|
|
26
29
|
background-position: 100% 0, 100% 0, 0 0;
|
|
27
30
|
}
|
|
28
31
|
`;
|
|
32
|
+
/* eslint-enable */
|
|
33
|
+
|
|
29
34
|
|
|
30
35
|
function CodeBlock(props) {
|
|
31
36
|
const {
|
|
@@ -8,6 +8,7 @@ import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
|
8
8
|
import { N20, N30, N700 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { CopyTextConsumer } from './copy-text-provider';
|
|
10
10
|
import { codeBlockCopyButtonMessages } from '../../messages';
|
|
11
|
+
import { token } from '@atlaskit/tokens';
|
|
11
12
|
const copyButtonWrapperStyles = css`
|
|
12
13
|
display: flex;
|
|
13
14
|
position: sticky;
|
|
@@ -25,19 +26,19 @@ const copyButtonWrapperStyles = css`
|
|
|
25
26
|
padding: 2px;
|
|
26
27
|
opacity: 0;
|
|
27
28
|
transition: opacity 0.2s ease 0s;
|
|
28
|
-
border: 2px solid #fff;
|
|
29
|
+
border: 2px solid ${token('color.border.inverse', '#fff')};
|
|
29
30
|
border-radius: 4px;
|
|
30
|
-
background-color: ${N20};
|
|
31
|
-
color: rgb(66, 82, 110);
|
|
31
|
+
background-color: ${token('color.background.neutral.subtle', N20)};
|
|
32
|
+
color: ${token('color.icon', 'rgb(66, 82, 110)')};
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
button:hover {
|
|
35
|
-
background-color: ${N30};
|
|
36
|
+
background-color: ${token('color.background.neutral.hovered', N30)};
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
button.clicked {
|
|
39
|
-
background-color: ${N700};
|
|
40
|
-
color: #fff !important;
|
|
40
|
+
background-color: ${token('color.background.neutral.bold.pressed', N700)};
|
|
41
|
+
color: ${token('color.icon.inverse', '#fff')} !important;
|
|
41
42
|
}
|
|
42
43
|
`;
|
|
43
44
|
|
|
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { useMemo, useContext, useState, useRef } from 'react';
|
|
6
6
|
import { Card, Context as CardContext, EmbedResizeMessageListener } from '@atlaskit/smart-card';
|
|
7
|
-
import { WidthConsumer,
|
|
8
|
-
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH
|
|
7
|
+
import { WidthConsumer, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
|
|
8
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { getPlatform } from '../../utils';
|
|
10
10
|
import { CardErrorBoundary } from './fallback';
|
|
11
11
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
@@ -37,7 +37,6 @@ export default function EmbedCard(props) {
|
|
|
37
37
|
layout,
|
|
38
38
|
width,
|
|
39
39
|
isInsideOfBlockNode,
|
|
40
|
-
allowDynamicTextSizing,
|
|
41
40
|
rendererAppearance
|
|
42
41
|
} = props;
|
|
43
42
|
const embedIframeRef = useRef(null);
|
|
@@ -103,10 +102,8 @@ export default function EmbedCard(props) {
|
|
|
103
102
|
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
104
103
|
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= akEditorDefaultLayoutWidth;
|
|
105
104
|
|
|
106
|
-
if (isContainerSizeGreaterThanMaxFullPageWidth
|
|
107
|
-
nonFullWidthSize =
|
|
108
|
-
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
109
|
-
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
105
|
+
if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
106
|
+
nonFullWidthSize = akEditorDefaultLayoutWidth;
|
|
110
107
|
} else {
|
|
111
108
|
nonFullWidthSize = containerWidth - padding;
|
|
112
109
|
}
|
|
@@ -9,6 +9,7 @@ import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
|
9
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
10
|
import { injectIntl } from 'react-intl-next';
|
|
11
11
|
import { headingAnchorLinkMessages } from '../../messages';
|
|
12
|
+
import { token } from '@atlaskit/tokens';
|
|
12
13
|
export const HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
13
14
|
const CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
14
15
|
const {
|
|
@@ -25,7 +26,7 @@ const copyAnchorButtonStyles = css`
|
|
|
25
26
|
outline: none;
|
|
26
27
|
background-color: transparent;
|
|
27
28
|
border: none;
|
|
28
|
-
color: ${N500};
|
|
29
|
+
color: ${token('color.icon', N500)};
|
|
29
30
|
cursor: pointer;
|
|
30
31
|
right: 0;
|
|
31
32
|
`;
|
|
@@ -82,7 +83,7 @@ class HeadingAnchor extends React.PureComponent {
|
|
|
82
83
|
}, jsx(LinkIcon, {
|
|
83
84
|
label: this.getCopyAriaLabel(),
|
|
84
85
|
size: this.props.level > 3 ? 'small' : 'medium',
|
|
85
|
-
primaryColor: this.state.isClicked ? B400 : N200
|
|
86
|
+
primaryColor: this.state.isClicked ? token('color.icon.selected', B400) : token('color.icon.subtle', N200)
|
|
86
87
|
}));
|
|
87
88
|
});
|
|
88
89
|
}
|
|
@@ -6,6 +6,7 @@ import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
|
6
6
|
import { CardErrorBoundary } from './fallback';
|
|
7
7
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
8
8
|
import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
9
|
+
import { useFeatureFlags } from '../../use-feature-flags';
|
|
9
10
|
|
|
10
11
|
const InlineCard = props => {
|
|
11
12
|
const {
|
|
@@ -22,6 +23,7 @@ const InlineCard = props => {
|
|
|
22
23
|
onClick,
|
|
23
24
|
container: portal
|
|
24
25
|
};
|
|
26
|
+
const featureFlags = useFeatureFlags();
|
|
25
27
|
|
|
26
28
|
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
|
|
27
29
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
@@ -37,7 +39,8 @@ const InlineCard = props => {
|
|
|
37
39
|
}, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
|
|
38
40
|
unsupportedComponent: UnsupportedInline
|
|
39
41
|
}, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
|
|
40
|
-
appearance: "inline"
|
|
42
|
+
appearance: "inline",
|
|
43
|
+
showHoverPreview: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.showHoverPreview
|
|
41
44
|
}, cardProps, {
|
|
42
45
|
onResolve: data => {
|
|
43
46
|
if (!data.url || !data.title) {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
4
|
+
import { MediaInlineCardErroredView, MediaInlineCardLoadingView, messages } from '@atlaskit/media-ui';
|
|
3
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { getClipboardAttrs } from '../../ui/MediaCard';
|
|
7
|
+
import { createIntl, injectIntl } from 'react-intl-next';
|
|
4
8
|
export const RenderMediaInline = props => {
|
|
5
9
|
const {
|
|
6
10
|
mediaProvider
|
|
7
11
|
} = props;
|
|
8
|
-
const [viewMediaClientConfigState, setViewMediaClientConfigState] = useState(
|
|
12
|
+
const [viewMediaClientConfigState, setViewMediaClientConfigState] = useState();
|
|
9
13
|
useEffect(() => {
|
|
10
14
|
updateViewMediaClientConfigState(mediaProvider);
|
|
11
15
|
}, [mediaProvider]);
|
|
@@ -16,6 +20,18 @@ export const RenderMediaInline = props => {
|
|
|
16
20
|
setViewMediaClientConfigState(mediaClientConfig.viewMediaClientConfig);
|
|
17
21
|
}
|
|
18
22
|
};
|
|
23
|
+
/*
|
|
24
|
+
* Only show the loading view if the media provider is not ready
|
|
25
|
+
* prevents calling the media API before the provider is ready
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if (!viewMediaClientConfigState) {
|
|
30
|
+
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
31
|
+
message: "",
|
|
32
|
+
isSelected: false
|
|
33
|
+
});
|
|
34
|
+
}
|
|
19
35
|
|
|
20
36
|
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
21
37
|
identifier: props.identifier,
|
|
@@ -28,20 +44,36 @@ const MediaInline = props => {
|
|
|
28
44
|
const {
|
|
29
45
|
collection,
|
|
30
46
|
id,
|
|
31
|
-
providers
|
|
47
|
+
providers,
|
|
48
|
+
intl
|
|
32
49
|
} = props;
|
|
33
50
|
const identifier = {
|
|
34
51
|
id,
|
|
35
52
|
mediaItemType: 'file',
|
|
36
53
|
collectionName: collection
|
|
37
54
|
};
|
|
38
|
-
|
|
55
|
+
const defaultIntl = createIntl({
|
|
56
|
+
locale: 'en'
|
|
57
|
+
});
|
|
58
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, getClipboardAttrs({
|
|
59
|
+
id,
|
|
60
|
+
collection
|
|
61
|
+
}), {
|
|
62
|
+
"data-node-type": "mediaInline"
|
|
63
|
+
}), /*#__PURE__*/React.createElement(WithProviders, {
|
|
39
64
|
providers: ['mediaProvider'],
|
|
40
65
|
providerFactory: providers,
|
|
41
66
|
renderNode: providers => {
|
|
42
67
|
const {
|
|
43
68
|
mediaProvider
|
|
44
69
|
} = providers;
|
|
70
|
+
|
|
71
|
+
if (!mediaProvider) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
|
|
73
|
+
message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
45
77
|
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
46
78
|
identifier: identifier,
|
|
47
79
|
mediaProvider: mediaProvider
|
|
@@ -50,4 +82,4 @@ const MediaInline = props => {
|
|
|
50
82
|
}));
|
|
51
83
|
};
|
|
52
84
|
|
|
53
|
-
export default MediaInline;
|
|
85
|
+
export default injectIntl(MediaInline);
|
|
@@ -3,8 +3,8 @@ import { default as React, Fragment } from 'react';
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
5
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
6
|
-
import {
|
|
7
|
-
import { akEditorFullWidthLayoutWidth,
|
|
6
|
+
import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
7
|
+
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
9
9
|
import { useObservedWidth } from '../../hooks/use-observed-width';
|
|
10
10
|
import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
|
|
@@ -48,7 +48,6 @@ const MediaSingle = props => {
|
|
|
48
48
|
rendererAppearance,
|
|
49
49
|
featureFlags,
|
|
50
50
|
isInsideOfBlockNode,
|
|
51
|
-
allowDynamicTextSizing,
|
|
52
51
|
layout,
|
|
53
52
|
children,
|
|
54
53
|
width: pctWidth
|
|
@@ -119,7 +118,6 @@ const MediaSingle = props => {
|
|
|
119
118
|
|
|
120
119
|
const calcDimensions = (mediaContainerWidth, mediaBreakpoint) => {
|
|
121
120
|
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
122
|
-
const breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
|
|
123
121
|
const maxWidth = containerWidth;
|
|
124
122
|
const maxHeight = height / width * maxWidth;
|
|
125
123
|
const cardDimensions = {
|
|
@@ -129,12 +127,10 @@ const MediaSingle = props => {
|
|
|
129
127
|
let nonFullWidthSize = containerWidth;
|
|
130
128
|
|
|
131
129
|
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
132
|
-
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >=
|
|
130
|
+
const isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= akEditorDefaultLayoutWidth;
|
|
133
131
|
|
|
134
|
-
if (isContainerSizeGreaterThanMaxFullPageWidth
|
|
135
|
-
nonFullWidthSize =
|
|
136
|
-
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
137
|
-
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
132
|
+
if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
133
|
+
nonFullWidthSize = akEditorDefaultLayoutWidth;
|
|
138
134
|
} else {
|
|
139
135
|
nonFullWidthSize = containerWidth - padding;
|
|
140
136
|
}
|
|
@@ -14,11 +14,7 @@ const getTableLayoutWidth = (layout, opts) => {
|
|
|
14
14
|
return akEditorWideLayoutWidth;
|
|
15
15
|
|
|
16
16
|
default:
|
|
17
|
-
|
|
18
|
-
containerWidth,
|
|
19
|
-
isDynamicTextSizingEnabled
|
|
20
|
-
} = opts || {};
|
|
21
|
-
return calcLineLength(containerWidth, isDynamicTextSizingEnabled);
|
|
17
|
+
return calcLineLength();
|
|
22
18
|
}
|
|
23
19
|
};
|
|
24
20
|
|
|
@@ -55,8 +51,7 @@ export const Colgroup = props => {
|
|
|
55
51
|
columnWidths,
|
|
56
52
|
layout,
|
|
57
53
|
isNumberColumnEnabled,
|
|
58
|
-
renderWidth
|
|
59
|
-
allowDynamicTextSizing
|
|
54
|
+
renderWidth
|
|
60
55
|
} = props;
|
|
61
56
|
|
|
62
57
|
if (!columnWidths || !isTableResized(columnWidths)) {
|
|
@@ -65,7 +60,6 @@ export const Colgroup = props => {
|
|
|
65
60
|
|
|
66
61
|
|
|
67
62
|
const layoutWidth = getTableLayoutWidth(layout, {
|
|
68
|
-
isDynamicTextSizingEnabled: allowDynamicTextSizing,
|
|
69
63
|
containerWidth: renderWidth
|
|
70
64
|
});
|
|
71
65
|
const maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth; // If table has a layout of default, it is confined by the defined column width.
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { css, jsx } from '@emotion/react';
|
|
4
6
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
5
7
|
import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import * as colors from '@atlaskit/theme/colors';
|
|
8
|
+
import * as colors from '@atlaskit/theme/colors'; // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
9
|
+
|
|
7
10
|
const {
|
|
8
11
|
N40A
|
|
9
12
|
} = colors;
|
|
13
|
+
import { token } from '@atlaskit/tokens';
|
|
10
14
|
import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
11
15
|
import { Table } from './table';
|
|
12
16
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
13
17
|
export const tableStickyPadding = 8;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return css`
|
|
26
|
-
position: ${fixedTableDivModeToPosition[mode]};
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
18
|
+
const modeSpecficStyles = {
|
|
19
|
+
none: css`
|
|
20
|
+
display: none;
|
|
21
|
+
`,
|
|
22
|
+
stick: css`
|
|
23
|
+
position: fixed;
|
|
24
|
+
`,
|
|
25
|
+
'pin-bottom': css`
|
|
26
|
+
position: absolute;
|
|
27
|
+
`
|
|
28
|
+
}; // TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4123
|
|
30
29
|
|
|
31
30
|
const fixedTableDivStaticStyles = (top, width) => css`
|
|
32
|
-
top: ${top}px
|
|
31
|
+
${typeof top === 'number' && `top: ${top}px;`}
|
|
33
32
|
width: ${width}px;
|
|
34
33
|
z-index: ${akEditorStickyHeaderZIndex};
|
|
35
34
|
&
|
|
@@ -41,9 +40,10 @@ const fixedTableDivStaticStyles = (top, width) => css`
|
|
|
41
40
|
margin-bottom: 0;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
border-top: ${tableStickyPadding}px solid
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
border-top: ${tableStickyPadding}px solid
|
|
44
|
+
${token('elevation.surface', 'white')};
|
|
45
|
+
background: ${token('elevation.surface.overlay', 'white')};
|
|
46
|
+
box-shadow: ${token('elevation.shadow.overflow', `0 6px 4px -4px ${N40A}`)};
|
|
47
47
|
|
|
48
48
|
div[data-expanded='false'] & {
|
|
49
49
|
display: none;
|
|
@@ -64,10 +64,14 @@ export const FixedTableDiv = props => {
|
|
|
64
64
|
wrapperWidth,
|
|
65
65
|
mode
|
|
66
66
|
} = props;
|
|
67
|
-
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth),
|
|
68
|
-
|
|
67
|
+
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
68
|
+
const attrs = {
|
|
69
|
+
mode
|
|
70
|
+
};
|
|
71
|
+
return jsx("div", _extends({}, attrs, {
|
|
72
|
+
"data-testid": "sticky-table-fixed",
|
|
69
73
|
css: fixedTableCss
|
|
70
|
-
}, props.children);
|
|
74
|
+
}), props.children);
|
|
71
75
|
};
|
|
72
76
|
export const StickyTable = ({
|
|
73
77
|
top,
|
|
@@ -82,7 +86,6 @@ export const StickyTable = ({
|
|
|
82
86
|
children,
|
|
83
87
|
columnWidths,
|
|
84
88
|
renderWidth,
|
|
85
|
-
allowDynamicTextSizing,
|
|
86
89
|
rowHeight
|
|
87
90
|
}) => {
|
|
88
91
|
return jsx("div", {
|
|
@@ -96,7 +99,7 @@ export const StickyTable = ({
|
|
|
96
99
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
97
100
|
wrapperWidth: wrapperWidth
|
|
98
101
|
}, jsx("div", {
|
|
99
|
-
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${shadowClassNames}`,
|
|
102
|
+
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${shadowClassNames || ''}`,
|
|
100
103
|
"data-layout": layout,
|
|
101
104
|
style: {
|
|
102
105
|
width: tableWidth
|
|
@@ -111,8 +114,7 @@ export const StickyTable = ({
|
|
|
111
114
|
columnWidths: columnWidths,
|
|
112
115
|
layout: layout,
|
|
113
116
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
114
|
-
renderWidth: renderWidth
|
|
115
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
117
|
+
renderWidth: renderWidth
|
|
116
118
|
},
|
|
117
119
|
/**
|
|
118
120
|
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
@@ -6,7 +6,6 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
6
6
|
columnWidths,
|
|
7
7
|
layout,
|
|
8
8
|
renderWidth,
|
|
9
|
-
allowDynamicTextSizing,
|
|
10
9
|
children
|
|
11
10
|
}) => {
|
|
12
11
|
return /*#__PURE__*/React.createElement("table", {
|
|
@@ -16,7 +15,6 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
16
15
|
columnWidths: columnWidths,
|
|
17
16
|
layout: layout,
|
|
18
17
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
19
|
-
renderWidth: renderWidth
|
|
20
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
18
|
+
renderWidth: renderWidth
|
|
21
19
|
}), /*#__PURE__*/React.createElement("tbody", null, children));
|
|
22
20
|
});
|
|
@@ -253,7 +253,6 @@ export class TableContainer extends React.Component {
|
|
|
253
253
|
isNumberColumnEnabled,
|
|
254
254
|
layout,
|
|
255
255
|
renderWidth,
|
|
256
|
-
allowDynamicTextSizing,
|
|
257
256
|
columnWidths,
|
|
258
257
|
stickyHeaders,
|
|
259
258
|
tableNode
|
|
@@ -262,7 +261,7 @@ export class TableContainer extends React.Component {
|
|
|
262
261
|
stickyMode
|
|
263
262
|
} = this.state;
|
|
264
263
|
let tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
265
|
-
const lineLength = calcLineLength(
|
|
264
|
+
const lineLength = calcLineLength();
|
|
266
265
|
let left;
|
|
267
266
|
|
|
268
267
|
if (canUseLinelength(this.props.rendererAppearance) && tableWidth !== 'inherit') {
|
|
@@ -285,10 +284,9 @@ export class TableContainer extends React.Component {
|
|
|
285
284
|
innerRef: this.stickyWrapperRef,
|
|
286
285
|
wrapperWidth: wrapperWidth,
|
|
287
286
|
columnWidths: columnWidths,
|
|
288
|
-
rowHeight: this.headerRowHeight
|
|
289
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
287
|
+
rowHeight: this.headerRowHeight
|
|
290
288
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
291
|
-
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames}`,
|
|
289
|
+
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
|
|
292
290
|
"data-layout": layout,
|
|
293
291
|
ref: this.props.handleRef,
|
|
294
292
|
style: {
|
|
@@ -304,8 +302,7 @@ export class TableContainer extends React.Component {
|
|
|
304
302
|
columnWidths: columnWidths,
|
|
305
303
|
layout: layout,
|
|
306
304
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
307
|
-
renderWidth: renderWidth
|
|
308
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
305
|
+
renderWidth: renderWidth
|
|
309
306
|
}, this.grabFirstRowRef(children)))));
|
|
310
307
|
}
|
|
311
308
|
|
|
@@ -375,14 +372,26 @@ export class TableProcessor extends React.Component {
|
|
|
375
372
|
|
|
376
373
|
}
|
|
377
374
|
const TableWithShadows = overflowShadow(TableProcessor, {
|
|
378
|
-
overflowSelector: `.${TableSharedCssClassName.TABLE_NODE_WRAPPER}
|
|
375
|
+
overflowSelector: `.${TableSharedCssClassName.TABLE_NODE_WRAPPER}`,
|
|
376
|
+
useShadowObserver: true
|
|
379
377
|
});
|
|
380
378
|
|
|
381
379
|
const TableWithWidth = props => /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
382
380
|
width
|
|
383
381
|
}) => {
|
|
382
|
+
var _props$columnWidths;
|
|
383
|
+
|
|
384
384
|
const renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
385
|
-
|
|
385
|
+
const colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce((total, val) => total + val, 0)) || 0;
|
|
386
|
+
|
|
387
|
+
if (colWidthsSum) {
|
|
388
|
+
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
389
|
+
renderWidth: renderWidth
|
|
390
|
+
}, props));
|
|
391
|
+
} // there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
386
395
|
renderWidth: renderWidth
|
|
387
396
|
}, props));
|
|
388
397
|
});
|
|
@@ -116,8 +116,11 @@ export const withSortableColumn = WrapperComponent => {
|
|
|
116
116
|
|
|
117
117
|
_defineProperty(this, "onKeyPress", event => {
|
|
118
118
|
const keys = [' ', 'Enter', 'Spacebar'];
|
|
119
|
+
const {
|
|
120
|
+
tagName
|
|
121
|
+
} = event.target; // trigger sorting if space or enter are clicked but not when in an input field (template variables)
|
|
119
122
|
|
|
120
|
-
if (keys.includes(event.key)) {
|
|
123
|
+
if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
|
|
121
124
|
event.preventDefault();
|
|
122
125
|
this.onClick(event);
|
|
123
126
|
}
|