@atlaskit/renderer 95.0.1 → 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 +25 -0
- package/dist/cjs/react/index.js +0 -2
- package/dist/cjs/react/nodes/embedCard.js +2 -5
- 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 +2 -4
- 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 +2 -2
- 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 +4 -12
- package/dist/cjs/ui/Renderer/style.js +3 -3
- 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/nodes/embedCard.js +4 -7
- 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 +2 -4
- 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 +1 -1
- 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 +3 -11
- package/dist/es2019/ui/Renderer/style.js +16 -3
- 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/nodes/embedCard.js +4 -7
- 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 +2 -4
- 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 +1 -1
- 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 +3 -11
- package/dist/esm/ui/Renderer/style.js +4 -3
- 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/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 +13 -12
|
@@ -9,6 +9,7 @@ import { shadowClassNames } from '@atlaskit/editor-common/ui';
|
|
|
9
9
|
import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { RendererCssClassName } from '../../consts';
|
|
11
11
|
import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
|
|
12
|
+
import { shadowObserverClassNames } from '@atlaskit/editor-common/ui';
|
|
12
13
|
export const FullPagePadding = 32;
|
|
13
14
|
|
|
14
15
|
const getLineHeight = fontCode => headingSizesImport[fontCode].lineHeight / headingSizesImport[fontCode].size;
|
|
@@ -201,11 +202,11 @@ const tableSortableColumnStyle = ({
|
|
|
201
202
|
margin-top: 0;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
> .ProseMirror-gapcursor.-right:first-
|
|
205
|
+
> .ProseMirror-gapcursor.-right:first-of-type + * {
|
|
205
206
|
margin-top: 0;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
> .ProseMirror-gapcursor:first-
|
|
209
|
+
> .ProseMirror-gapcursor:first-of-type + span + * {
|
|
209
210
|
margin-top: 0;
|
|
210
211
|
}
|
|
211
212
|
|
|
@@ -469,6 +470,11 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
469
470
|
.${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
|
|
470
471
|
overflow-x: auto;
|
|
471
472
|
}
|
|
473
|
+
|
|
474
|
+
.${shadowObserverClassNames.SHADOW_CONTAINER}
|
|
475
|
+
.${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
|
|
476
|
+
display: flex;
|
|
477
|
+
}
|
|
472
478
|
}
|
|
473
479
|
|
|
474
480
|
${tableSharedStyle(themeProps)}
|
|
@@ -486,6 +492,13 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
486
492
|
z-index: ${akEditorStickyHeaderZIndex};
|
|
487
493
|
}
|
|
488
494
|
|
|
495
|
+
&
|
|
496
|
+
.${shadowObserverClassNames.SENTINEL_LEFT},
|
|
497
|
+
&
|
|
498
|
+
.${shadowObserverClassNames.SENTINEL_RIGHT} {
|
|
499
|
+
height: calc(100% - ${tableMarginTop}px);
|
|
500
|
+
}
|
|
501
|
+
|
|
489
502
|
/**
|
|
490
503
|
* A hack for making all the <th /> heights equal in case some have shorter
|
|
491
504
|
* content than others.
|
|
@@ -499,7 +512,7 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
499
512
|
margin-right: 0;
|
|
500
513
|
}
|
|
501
514
|
|
|
502
|
-
table tr:first-
|
|
515
|
+
table tr:first-of-type {
|
|
503
516
|
height: 100%;
|
|
504
517
|
|
|
505
518
|
td,
|
|
@@ -19,7 +19,7 @@ export const useAnnotationStateByTypeEvent = ({
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const nextStates = Object.values(payload).reduce((acc, curr) => {
|
|
22
|
-
if (curr.annotationType === type) {
|
|
22
|
+
if (curr.id && curr.annotationType === type) {
|
|
23
23
|
// Check for empty state to prevent additional renders
|
|
24
24
|
const isEmpty = curr.state === null || curr.state === undefined;
|
|
25
25
|
return { ...acc,
|
|
@@ -83,7 +83,7 @@ export const useAnnotationClickEvent = props => {
|
|
|
83
83
|
annotationIds,
|
|
84
84
|
eventTarget
|
|
85
85
|
}) => {
|
|
86
|
-
const annotationsByType = annotationIds.map(id => ({
|
|
86
|
+
const annotationsByType = annotationIds.filter(id => !!id).map(id => ({
|
|
87
87
|
id,
|
|
88
88
|
type: AnnotationTypes.INLINE_COMMENT
|
|
89
89
|
}));
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/react/index.js
CHANGED
|
@@ -179,7 +179,6 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
179
179
|
this.appearance = init.appearance;
|
|
180
180
|
this.disableHeadingIDs = init.disableHeadingIDs;
|
|
181
181
|
this.disableActions = init.disableActions;
|
|
182
|
-
this.allowDynamicTextSizing = init.allowDynamicTextSizing;
|
|
183
182
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
184
183
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
185
184
|
this.allowPlaceholderText = init.allowPlaceholderText;
|
|
@@ -550,7 +549,6 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
550
549
|
rendererContext: this.rendererContext,
|
|
551
550
|
serializer: this,
|
|
552
551
|
content: node.content ? node.content.toJSON() : undefined,
|
|
553
|
-
allowDynamicTextSizing: this.allowDynamicTextSizing,
|
|
554
552
|
allowHeadingAnchorLinks: this.allowHeadingAnchorLinks,
|
|
555
553
|
allowCopyToClipboard: this.allowCopyToClipboard,
|
|
556
554
|
allowPlaceholderText: this.allowPlaceholderText,
|
|
@@ -8,8 +8,8 @@ var _templateObject, _templateObject2;
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { useMemo, useContext, useState, useRef } from 'react';
|
|
10
10
|
import { Card, Context as CardContext, EmbedResizeMessageListener } from '@atlaskit/smart-card';
|
|
11
|
-
import { WidthConsumer,
|
|
12
|
-
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH
|
|
11
|
+
import { WidthConsumer, UnsupportedBlock, MediaSingle as UIMediaSingle } from '@atlaskit/editor-common/ui';
|
|
12
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { getPlatform } from '../../utils';
|
|
14
14
|
import { CardErrorBoundary } from './fallback';
|
|
15
15
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
@@ -24,7 +24,6 @@ export default function EmbedCard(props) {
|
|
|
24
24
|
layout = props.layout,
|
|
25
25
|
width = props.width,
|
|
26
26
|
isInsideOfBlockNode = props.isInsideOfBlockNode,
|
|
27
|
-
allowDynamicTextSizing = props.allowDynamicTextSizing,
|
|
28
27
|
rendererAppearance = props.rendererAppearance;
|
|
29
28
|
var embedIframeRef = useRef(null);
|
|
30
29
|
var onClick = getCardClickHandler(eventHandlers, url);
|
|
@@ -103,10 +102,8 @@ export default function EmbedCard(props) {
|
|
|
103
102
|
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
104
103
|
var 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
|
}
|
|
@@ -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
|
var InlineCard = function InlineCard(props) {
|
|
11
12
|
var url = props.url,
|
|
@@ -20,6 +21,7 @@ var InlineCard = function InlineCard(props) {
|
|
|
20
21
|
onClick: onClick,
|
|
21
22
|
container: portal
|
|
22
23
|
};
|
|
24
|
+
var featureFlags = useFeatureFlags();
|
|
23
25
|
|
|
24
26
|
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
|
|
25
27
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
@@ -35,7 +37,8 @@ var InlineCard = function InlineCard(props) {
|
|
|
35
37
|
}, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
|
|
36
38
|
unsupportedComponent: UnsupportedInline
|
|
37
39
|
}, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
|
|
38
|
-
appearance: "inline"
|
|
40
|
+
appearance: "inline",
|
|
41
|
+
showHoverPreview: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.showHoverPreview
|
|
39
42
|
}, cardProps, {
|
|
40
43
|
onResolve: function onResolve(data) {
|
|
41
44
|
if (!data.url || !data.title) {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
5
|
import React, { useEffect, useState } from 'react';
|
|
5
6
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
7
|
+
import { MediaInlineCardErroredView, MediaInlineCardLoadingView, messages } from '@atlaskit/media-ui';
|
|
6
8
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
import { getClipboardAttrs } from '../../ui/MediaCard';
|
|
10
|
+
import { createIntl, injectIntl } from 'react-intl-next';
|
|
7
11
|
export var RenderMediaInline = function RenderMediaInline(props) {
|
|
8
12
|
var mediaProvider = props.mediaProvider;
|
|
9
13
|
|
|
10
|
-
var _useState = useState(
|
|
14
|
+
var _useState = useState(),
|
|
11
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12
16
|
viewMediaClientConfigState = _useState2[0],
|
|
13
17
|
setViewMediaClientConfigState = _useState2[1];
|
|
@@ -47,6 +51,18 @@ export var RenderMediaInline = function RenderMediaInline(props) {
|
|
|
47
51
|
return _ref.apply(this, arguments);
|
|
48
52
|
};
|
|
49
53
|
}();
|
|
54
|
+
/*
|
|
55
|
+
* Only show the loading view if the media provider is not ready
|
|
56
|
+
* prevents calling the media API before the provider is ready
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if (!viewMediaClientConfigState) {
|
|
61
|
+
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
62
|
+
message: "",
|
|
63
|
+
isSelected: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
50
66
|
|
|
51
67
|
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
52
68
|
identifier: props.identifier,
|
|
@@ -58,17 +74,33 @@ export var RenderMediaInline = function RenderMediaInline(props) {
|
|
|
58
74
|
var MediaInline = function MediaInline(props) {
|
|
59
75
|
var collection = props.collection,
|
|
60
76
|
id = props.id,
|
|
61
|
-
providers = props.providers
|
|
77
|
+
providers = props.providers,
|
|
78
|
+
intl = props.intl;
|
|
62
79
|
var identifier = {
|
|
63
80
|
id: id,
|
|
64
81
|
mediaItemType: 'file',
|
|
65
82
|
collectionName: collection
|
|
66
83
|
};
|
|
67
|
-
|
|
84
|
+
var defaultIntl = createIntl({
|
|
85
|
+
locale: 'en'
|
|
86
|
+
});
|
|
87
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, getClipboardAttrs({
|
|
88
|
+
id: id,
|
|
89
|
+
collection: collection
|
|
90
|
+
}), {
|
|
91
|
+
"data-node-type": "mediaInline"
|
|
92
|
+
}), /*#__PURE__*/React.createElement(WithProviders, {
|
|
68
93
|
providers: ['mediaProvider'],
|
|
69
94
|
providerFactory: providers,
|
|
70
95
|
renderNode: function renderNode(providers) {
|
|
71
96
|
var mediaProvider = providers.mediaProvider;
|
|
97
|
+
|
|
98
|
+
if (!mediaProvider) {
|
|
99
|
+
return /*#__PURE__*/React.createElement(MediaInlineCardErroredView, {
|
|
100
|
+
message: (intl || defaultIntl).formatMessage(messages.couldnt_load_file)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
72
104
|
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
73
105
|
identifier: identifier,
|
|
74
106
|
mediaProvider: mediaProvider
|
|
@@ -77,4 +109,4 @@ var MediaInline = function MediaInline(props) {
|
|
|
77
109
|
}));
|
|
78
110
|
};
|
|
79
111
|
|
|
80
|
-
export default MediaInline;
|
|
112
|
+
export default injectIntl(MediaInline);
|
|
@@ -5,8 +5,8 @@ import { default as React, Fragment } from 'react';
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
8
|
-
import {
|
|
9
|
-
import { akEditorFullWidthLayoutWidth,
|
|
8
|
+
import { MediaSingle as UIMediaSingle, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
9
|
+
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
11
11
|
import { useObservedWidth } from '../../hooks/use-observed-width';
|
|
12
12
|
import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
|
|
@@ -51,7 +51,6 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
51
51
|
var rendererAppearance = props.rendererAppearance,
|
|
52
52
|
featureFlags = props.featureFlags,
|
|
53
53
|
isInsideOfBlockNode = props.isInsideOfBlockNode,
|
|
54
|
-
allowDynamicTextSizing = props.allowDynamicTextSizing,
|
|
55
54
|
layout = props.layout,
|
|
56
55
|
children = props.children,
|
|
57
56
|
pctWidth = props.width;
|
|
@@ -129,7 +128,6 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
129
128
|
|
|
130
129
|
var calcDimensions = function calcDimensions(mediaContainerWidth, mediaBreakpoint) {
|
|
131
130
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
132
|
-
var breakpoint = mediaBreakpoint || getBreakpoint(containerWidth);
|
|
133
131
|
var maxWidth = containerWidth;
|
|
134
132
|
var maxHeight = height / width * maxWidth;
|
|
135
133
|
var cardDimensions = {
|
|
@@ -139,12 +137,10 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
139
137
|
var nonFullWidthSize = containerWidth;
|
|
140
138
|
|
|
141
139
|
if (!isInsideOfBlockNode && rendererAppearance !== 'comment') {
|
|
142
|
-
var isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >=
|
|
140
|
+
var isContainerSizeGreaterThanMaxFullPageWidth = containerWidth - padding >= akEditorDefaultLayoutWidth;
|
|
143
141
|
|
|
144
|
-
if (isContainerSizeGreaterThanMaxFullPageWidth
|
|
145
|
-
nonFullWidthSize =
|
|
146
|
-
} else if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
147
|
-
nonFullWidthSize = getAkEditorFullPageMaxWidth(allowDynamicTextSizing);
|
|
142
|
+
if (isContainerSizeGreaterThanMaxFullPageWidth) {
|
|
143
|
+
nonFullWidthSize = akEditorDefaultLayoutWidth;
|
|
148
144
|
} else {
|
|
149
145
|
nonFullWidthSize = containerWidth - padding;
|
|
150
146
|
}
|
|
@@ -14,11 +14,7 @@ var getTableLayoutWidth = function getTableLayoutWidth(layout, opts) {
|
|
|
14
14
|
return akEditorWideLayoutWidth;
|
|
15
15
|
|
|
16
16
|
default:
|
|
17
|
-
|
|
18
|
-
containerWidth = _ref.containerWidth,
|
|
19
|
-
isDynamicTextSizingEnabled = _ref.isDynamicTextSizingEnabled;
|
|
20
|
-
|
|
21
|
-
return calcLineLength(containerWidth, isDynamicTextSizingEnabled);
|
|
17
|
+
return calcLineLength();
|
|
22
18
|
}
|
|
23
19
|
};
|
|
24
20
|
|
|
@@ -44,10 +40,10 @@ var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWi
|
|
|
44
40
|
columnWidth - tableCellBorderWidth, zeroWidthColumnsCount ? akEditorTableLegacyCellMinWidth : tableCellMinWidth);
|
|
45
41
|
};
|
|
46
42
|
|
|
47
|
-
export var calcScalePercent = function calcScalePercent(
|
|
48
|
-
var renderWidth =
|
|
49
|
-
tableWidth =
|
|
50
|
-
maxScale =
|
|
43
|
+
export var calcScalePercent = function calcScalePercent(_ref) {
|
|
44
|
+
var renderWidth = _ref.renderWidth,
|
|
45
|
+
tableWidth = _ref.tableWidth,
|
|
46
|
+
maxScale = _ref.maxScale;
|
|
51
47
|
var diffPercent = 1 - renderWidth / tableWidth;
|
|
52
48
|
return diffPercent < maxScale ? diffPercent : maxScale;
|
|
53
49
|
};
|
|
@@ -55,8 +51,7 @@ export var Colgroup = function Colgroup(props) {
|
|
|
55
51
|
var columnWidths = props.columnWidths,
|
|
56
52
|
layout = props.layout,
|
|
57
53
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
58
|
-
renderWidth = props.renderWidth
|
|
59
|
-
allowDynamicTextSizing = props.allowDynamicTextSizing;
|
|
54
|
+
renderWidth = props.renderWidth;
|
|
60
55
|
|
|
61
56
|
if (!columnWidths || !isTableResized(columnWidths)) {
|
|
62
57
|
return null;
|
|
@@ -64,7 +59,6 @@ export var Colgroup = function Colgroup(props) {
|
|
|
64
59
|
|
|
65
60
|
|
|
66
61
|
var layoutWidth = getTableLayoutWidth(layout, {
|
|
67
|
-
isDynamicTextSizingEnabled: allowDynamicTextSizing,
|
|
68
62
|
containerWidth: renderWidth
|
|
69
63
|
});
|
|
70
64
|
var maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth; // If table has a layout of default, it is confined by the defined column width.
|
|
@@ -54,7 +54,6 @@ export var StickyTable = function StickyTable(_ref) {
|
|
|
54
54
|
children = _ref.children,
|
|
55
55
|
columnWidths = _ref.columnWidths,
|
|
56
56
|
renderWidth = _ref.renderWidth,
|
|
57
|
-
allowDynamicTextSizing = _ref.allowDynamicTextSizing,
|
|
58
57
|
rowHeight = _ref.rowHeight;
|
|
59
58
|
return jsx("div", {
|
|
60
59
|
css: {
|
|
@@ -67,7 +66,7 @@ export var StickyTable = function StickyTable(_ref) {
|
|
|
67
66
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
68
67
|
wrapperWidth: wrapperWidth
|
|
69
68
|
}, jsx("div", {
|
|
70
|
-
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames),
|
|
69
|
+
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames || ''),
|
|
71
70
|
"data-layout": layout,
|
|
72
71
|
style: {
|
|
73
72
|
width: tableWidth
|
|
@@ -82,8 +81,7 @@ export var StickyTable = function StickyTable(_ref) {
|
|
|
82
81
|
columnWidths: columnWidths,
|
|
83
82
|
layout: layout,
|
|
84
83
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
85
|
-
renderWidth: renderWidth
|
|
86
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
84
|
+
renderWidth: renderWidth
|
|
87
85
|
},
|
|
88
86
|
/**
|
|
89
87
|
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
@@ -6,7 +6,6 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
6
6
|
columnWidths = _ref.columnWidths,
|
|
7
7
|
layout = _ref.layout,
|
|
8
8
|
renderWidth = _ref.renderWidth,
|
|
9
|
-
allowDynamicTextSizing = _ref.allowDynamicTextSizing,
|
|
10
9
|
children = _ref.children;
|
|
11
10
|
return /*#__PURE__*/React.createElement("table", {
|
|
12
11
|
"data-number-column": isNumberColumnEnabled,
|
|
@@ -15,7 +14,6 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
15
14
|
columnWidths: columnWidths,
|
|
16
15
|
layout: layout,
|
|
17
16
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
18
|
-
renderWidth: renderWidth
|
|
19
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
17
|
+
renderWidth: renderWidth
|
|
20
18
|
}), /*#__PURE__*/React.createElement("tbody", null, children));
|
|
21
19
|
});
|
|
@@ -293,13 +293,12 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
293
293
|
isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
|
|
294
294
|
layout = _this$props.layout,
|
|
295
295
|
renderWidth = _this$props.renderWidth,
|
|
296
|
-
allowDynamicTextSizing = _this$props.allowDynamicTextSizing,
|
|
297
296
|
columnWidths = _this$props.columnWidths,
|
|
298
297
|
stickyHeaders = _this$props.stickyHeaders,
|
|
299
298
|
tableNode = _this$props.tableNode;
|
|
300
299
|
var stickyMode = this.state.stickyMode;
|
|
301
300
|
var tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
302
|
-
var lineLength = calcLineLength(
|
|
301
|
+
var lineLength = calcLineLength();
|
|
303
302
|
var left;
|
|
304
303
|
|
|
305
304
|
if (canUseLinelength(this.props.rendererAppearance) && tableWidth !== 'inherit') {
|
|
@@ -322,10 +321,9 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
322
321
|
innerRef: this.stickyWrapperRef,
|
|
323
322
|
wrapperWidth: wrapperWidth,
|
|
324
323
|
columnWidths: columnWidths,
|
|
325
|
-
rowHeight: this.headerRowHeight
|
|
326
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
324
|
+
rowHeight: this.headerRowHeight
|
|
327
325
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
328
|
-
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames),
|
|
326
|
+
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
329
327
|
"data-layout": layout,
|
|
330
328
|
ref: this.props.handleRef,
|
|
331
329
|
style: {
|
|
@@ -341,8 +339,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
341
339
|
columnWidths: columnWidths,
|
|
342
340
|
layout: layout,
|
|
343
341
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
344
|
-
renderWidth: renderWidth
|
|
345
|
-
allowDynamicTextSizing: allowDynamicTextSizing
|
|
342
|
+
renderWidth: renderWidth
|
|
346
343
|
}, this.grabFirstRowRef(children)))));
|
|
347
344
|
}
|
|
348
345
|
}]);
|
|
@@ -425,14 +422,28 @@ export var TableProcessor = /*#__PURE__*/function (_React$Component2) {
|
|
|
425
422
|
return TableProcessor;
|
|
426
423
|
}(React.Component);
|
|
427
424
|
var TableWithShadows = overflowShadow(TableProcessor, {
|
|
428
|
-
overflowSelector: ".".concat(TableSharedCssClassName.TABLE_NODE_WRAPPER)
|
|
425
|
+
overflowSelector: ".".concat(TableSharedCssClassName.TABLE_NODE_WRAPPER),
|
|
426
|
+
useShadowObserver: true
|
|
429
427
|
});
|
|
430
428
|
|
|
431
429
|
var TableWithWidth = function TableWithWidth(props) {
|
|
432
430
|
return /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref2) {
|
|
431
|
+
var _props$columnWidths;
|
|
432
|
+
|
|
433
433
|
var width = _ref2.width;
|
|
434
434
|
var renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
435
|
-
|
|
435
|
+
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
436
|
+
return total + val;
|
|
437
|
+
}, 0)) || 0;
|
|
438
|
+
|
|
439
|
+
if (colWidthsSum) {
|
|
440
|
+
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
441
|
+
renderWidth: renderWidth
|
|
442
|
+
}, props));
|
|
443
|
+
} // 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
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
436
447
|
renderWidth: renderWidth
|
|
437
448
|
}, props));
|
|
438
449
|
});
|
|
@@ -146,8 +146,10 @@ export var withSortableColumn = function withSortableColumn(WrapperComponent) {
|
|
|
146
146
|
|
|
147
147
|
_defineProperty(_assertThisInitialized(_this), "onKeyPress", function (event) {
|
|
148
148
|
var keys = [' ', 'Enter', 'Spacebar'];
|
|
149
|
+
var _ref = event.target,
|
|
150
|
+
tagName = _ref.tagName; // trigger sorting if space or enter are clicked but not when in an input field (template variables)
|
|
149
151
|
|
|
150
|
-
if (keys.includes(event.key)) {
|
|
152
|
+
if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
|
|
151
153
|
event.preventDefault();
|
|
152
154
|
|
|
153
155
|
_this.onClick(event);
|
|
@@ -156,8 +158,8 @@ export var withSortableColumn = function withSortableColumn(WrapperComponent) {
|
|
|
156
158
|
|
|
157
159
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (event) {
|
|
158
160
|
// ignore sorting when specific elements are clicked
|
|
159
|
-
var
|
|
160
|
-
tagName =
|
|
161
|
+
var _ref2 = event.target,
|
|
162
|
+
tagName = _ref2.tagName;
|
|
161
163
|
|
|
162
164
|
if (IgnoreSorting.includes(tagName)) {
|
|
163
165
|
return;
|
|
@@ -6,7 +6,7 @@ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaski
|
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
|
|
7
7
|
import { PLATFORM } from './analytics/events';
|
|
8
8
|
import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
|
|
9
|
-
import { transformMediaLinkMarks } from '@atlaskit/adf-utils';
|
|
9
|
+
import { transformMediaLinkMarks } from '@atlaskit/adf-utils/transforms';
|
|
10
10
|
var SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
|
|
11
11
|
|
|
12
12
|
var withStopwatch = function withStopwatch(cb) {
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -17,7 +17,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
17
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
18
|
|
|
19
19
|
import React, { Component } from 'react';
|
|
20
|
-
import { filter } from '@atlaskit/adf-utils';
|
|
20
|
+
import { filter } from '@atlaskit/adf-utils/traverse';
|
|
21
21
|
import { Card, CardLoading, CardError } from '@atlaskit/media-card';
|
|
22
22
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
23
23
|
import { withImageLoader } from '@atlaskit/editor-common/utils';
|
|
@@ -7,9 +7,7 @@ import { breakoutConsts } from '@atlaskit/editor-common/utils';
|
|
|
7
7
|
* More info: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1216218119/Renderer+SSR+for+Breakout+Nodes
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export function BreakoutSSRInlineScript(
|
|
11
|
-
var allowDynamicTextSizing = _ref.allowDynamicTextSizing;
|
|
12
|
-
|
|
10
|
+
export function BreakoutSSRInlineScript() {
|
|
13
11
|
/**
|
|
14
12
|
* Should only inline this script while SSR,
|
|
15
13
|
* not needed on the client side.
|
|
@@ -19,7 +17,7 @@ export function BreakoutSSRInlineScript(_ref) {
|
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
var id = Math.floor(Math.random() * (9999999999 - 9999 + 1)) + 9999;
|
|
22
|
-
var context = createBreakoutInlineScript(id
|
|
20
|
+
var context = createBreakoutInlineScript(id);
|
|
23
21
|
return /*#__PURE__*/React.createElement("script", {
|
|
24
22
|
"data-breakout-script-id": id,
|
|
25
23
|
dangerouslySetInnerHTML: {
|
|
@@ -27,12 +25,12 @@ export function BreakoutSSRInlineScript(_ref) {
|
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
export function createBreakoutInlineScript(id
|
|
31
|
-
return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\",
|
|
28
|
+
export function createBreakoutInlineScript(id) {
|
|
29
|
+
return "\n (function(window){\n ".concat(breakoutInlineScriptContext, ";\n (").concat(applyBreakoutAfterSSR.toString(), ")(\"").concat(id, "\", breakoutConsts);\n })(window);\n");
|
|
32
30
|
}
|
|
33
31
|
export var breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON.stringify(breakoutConsts), ";\n breakoutConsts.mapBreakpointToLayoutMaxWidth = ").concat(breakoutConsts.mapBreakpointToLayoutMaxWidth.toString(), ";\n breakoutConsts.getBreakpoint = ").concat(breakoutConsts.getBreakpoint.toString(), ";\n breakoutConsts.calcBreakoutWidth = ").concat(breakoutConsts.calcBreakoutWidth.toString(), ";\n breakoutConsts.calcLineLength = ").concat(breakoutConsts.calcLineLength.toString(), ";\n breakoutConsts.calcWideWidth = ").concat(breakoutConsts.calcWideWidth.toString(), ";\n");
|
|
34
32
|
|
|
35
|
-
function applyBreakoutAfterSSR(id,
|
|
33
|
+
function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
36
34
|
var MEDIA_NODE_TYPE = 'mediaSingle';
|
|
37
35
|
var WIDE_LAYOUT_MODES = ['full-width', 'wide'];
|
|
38
36
|
|
|
@@ -86,7 +84,7 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
|
|
|
86
84
|
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
87
85
|
|
|
88
86
|
if (node.classList.contains('pm-table-container')) {
|
|
89
|
-
var lineLength = breakoutConsts.calcLineLength(
|
|
87
|
+
var lineLength = breakoutConsts.calcLineLength();
|
|
90
88
|
var left = lineLength / 2 - parseInt(width) / 2;
|
|
91
89
|
|
|
92
90
|
if (left < 0) {
|
|
@@ -20,7 +20,7 @@ import React, { Fragment, useContext, useLayoutEffect, useRef } from 'react';
|
|
|
20
20
|
import { jsx } from '@emotion/react';
|
|
21
21
|
import { PureComponent } from 'react';
|
|
22
22
|
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
23
|
-
import { reduce } from '@atlaskit/adf-utils';
|
|
23
|
+
import { reduce } from '@atlaskit/adf-utils/traverse';
|
|
24
24
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
25
25
|
import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
|
|
26
26
|
import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI } from '@atlaskit/editor-common/utils';
|
|
@@ -217,7 +217,6 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
217
217
|
appearance: props.appearance,
|
|
218
218
|
disableHeadingIDs: props.disableHeadingIDs,
|
|
219
219
|
disableActions: props.disableActions,
|
|
220
|
-
allowDynamicTextSizing: props.allowDynamicTextSizing,
|
|
221
220
|
allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
|
|
222
221
|
allowColumnSorting: props.allowColumnSorting,
|
|
223
222
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
@@ -246,7 +245,6 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
246
245
|
onError = _this$props.onError,
|
|
247
246
|
appearance = _this$props.appearance,
|
|
248
247
|
adfStage = _this$props.adfStage,
|
|
249
|
-
allowDynamicTextSizing = _this$props.allowDynamicTextSizing,
|
|
250
248
|
truncated = _this$props.truncated,
|
|
251
249
|
maxHeight = _this$props.maxHeight,
|
|
252
250
|
fadeOutHeight = _this$props.fadeOutHeight,
|
|
@@ -328,7 +326,6 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
328
326
|
}
|
|
329
327
|
}, jsx(SmartCardStorageProvider, null, jsx(RendererWrapper, {
|
|
330
328
|
appearance: appearance,
|
|
331
|
-
dynamicTextSizing: !!allowDynamicTextSizing,
|
|
332
329
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
333
330
|
allowColumnSorting: allowColumnSorting,
|
|
334
331
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
@@ -337,9 +334,7 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
337
334
|
innerRef: this.editorRef,
|
|
338
335
|
onClick: handleWrapperOnClick,
|
|
339
336
|
onMouseDown: this.onMouseDownEditView
|
|
340
|
-
}, enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, {
|
|
341
|
-
allowDynamicTextSizing: !!allowDynamicTextSizing
|
|
342
|
-
}) : null, jsx(RendererActionsInternalUpdater, {
|
|
337
|
+
}, enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, null) : null, jsx(RendererActionsInternalUpdater, {
|
|
343
338
|
doc: pmDoc,
|
|
344
339
|
schema: schema,
|
|
345
340
|
onAnalyticsEvent: this.fireAnalyticsEvent
|
|
@@ -364,7 +359,6 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
364
359
|
|
|
365
360
|
return jsx(RendererWrapper, {
|
|
366
361
|
appearance: appearance,
|
|
367
|
-
dynamicTextSizing: !!allowDynamicTextSizing,
|
|
368
362
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
369
363
|
allowPlaceholderText: allowPlaceholderText,
|
|
370
364
|
allowColumnSorting: allowColumnSorting,
|
|
@@ -417,7 +411,6 @@ var RendererWithAnalytics = /*#__PURE__*/React.memo(function (props) {
|
|
|
417
411
|
});
|
|
418
412
|
var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
419
413
|
var allowColumnSorting = props.allowColumnSorting,
|
|
420
|
-
dynamicTextSizing = props.dynamicTextSizing,
|
|
421
414
|
allowNestedHeaderLinks = props.allowNestedHeaderLinks,
|
|
422
415
|
innerRef = props.innerRef,
|
|
423
416
|
appearance = props.appearance,
|
|
@@ -427,8 +420,7 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
427
420
|
return jsx(WidthProvider, {
|
|
428
421
|
className: "ak-renderer-wrapper"
|
|
429
422
|
}, jsx(BaseTheme, {
|
|
430
|
-
|
|
431
|
-
baseFontSize: !dynamicTextSizing && appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
423
|
+
baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
432
424
|
}, jsx("div", {
|
|
433
425
|
ref: innerRef,
|
|
434
426
|
onClick: onClick,
|