@atlaskit/renderer 109.1.5 → 109.2.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 +20 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +4 -13
- package/dist/cjs/react/nodes/mediaInline.js +77 -114
- package/dist/cjs/react/nodes/multiBodiedExtension.js +14 -9
- package/dist/cjs/react/nodes/panel.js +2 -16
- package/dist/cjs/react/nodes/table/colgroup.js +5 -12
- package/dist/cjs/react/nodes/table.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +7 -58
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +22 -29
- package/dist/es2019/react/nodes/mediaInline.js +66 -88
- package/dist/es2019/react/nodes/multiBodiedExtension.js +43 -37
- package/dist/es2019/react/nodes/panel.js +11 -23
- package/dist/es2019/react/nodes/table/colgroup.js +5 -12
- package/dist/es2019/react/nodes/table.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +27 -79
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +5 -14
- package/dist/esm/react/nodes/mediaInline.js +82 -119
- package/dist/esm/react/nodes/multiBodiedExtension.js +16 -10
- package/dist/esm/react/nodes/panel.js +3 -17
- package/dist/esm/react/nodes/table/colgroup.js +5 -12
- package/dist/esm/react/nodes/table.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +9 -59
- package/dist/types/react/nodes/mediaInline.d.ts +5 -8
- package/dist/types-ts4.5/react/nodes/mediaInline.d.ts +5 -8
- package/package.json +5 -8
|
@@ -35,7 +35,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
35
35
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
36
36
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
37
37
|
const packageName = "@atlaskit/renderer";
|
|
38
|
-
const packageVersion = "109.
|
|
38
|
+
const packageVersion = "109.2.0";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
|
|
1
3
|
import { css } from '@emotion/react';
|
|
2
|
-
import { themed } from '@atlaskit/theme/components';
|
|
3
4
|
import { fontFamily, fontSize } from '@atlaskit/theme/constants';
|
|
4
5
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
6
|
import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
|
|
7
|
+
import { getGlobalTheme } from '@atlaskit/tokens';
|
|
6
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { mediaInlineImageStyles } from '@atlaskit/editor-common/media-inline';
|
|
8
10
|
import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding, textColorStyles, codeBlockInListSafariFix, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
11
|
import { shadowClassNames } from '@atlaskit/editor-common/ui';
|
|
10
12
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
11
|
-
import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar,
|
|
13
|
+
import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableBorder, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
12
14
|
import { N40A } from '@atlaskit/theme/colors';
|
|
13
15
|
import { RendererCssClassName } from '../../consts';
|
|
14
16
|
import { HeadingAnchorWrapperClassName } from '../../react/nodes/heading-anchor';
|
|
@@ -18,7 +20,10 @@ import { isTableResizingEnabled } from '../../react/nodes/table';
|
|
|
18
20
|
export const FullPagePadding = 32;
|
|
19
21
|
const tableShadowWidth = 32;
|
|
20
22
|
export const TELEPOINTER_ID = 'ai-streaming-telepointer';
|
|
21
|
-
const telepointerStyles =
|
|
23
|
+
const telepointerStyles = () => {
|
|
24
|
+
const {
|
|
25
|
+
colorMode
|
|
26
|
+
} = getGlobalTheme();
|
|
22
27
|
return css`
|
|
23
28
|
#${TELEPOINTER_ID} {
|
|
24
29
|
display: inline-block;
|
|
@@ -27,20 +32,9 @@ const telepointerStyles = themeProps => {
|
|
|
27
32
|
height: 25px;
|
|
28
33
|
background: linear-gradient(
|
|
29
34
|
45deg,
|
|
30
|
-
${
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})(themeProps)} -12.02%,
|
|
34
|
-
${themed({
|
|
35
|
-
light: '#8BDBE5',
|
|
36
|
-
dark: '#60C6D2'
|
|
37
|
-
})(themeProps)}
|
|
38
|
-
19.18%,
|
|
39
|
-
${themed({
|
|
40
|
-
light: '#0C66E4',
|
|
41
|
-
dark: '#388BFF'
|
|
42
|
-
})(themeProps)}
|
|
43
|
-
71.87%
|
|
35
|
+
${colorMode === 'dark' ? '#f5cd47' : '#f8e6a0'} -12.02%,
|
|
36
|
+
${colorMode === 'dark' ? '#60c6d2' : '#8bdbe5'} 19.18%,
|
|
37
|
+
${colorMode === 'dark' ? '#388bff' : '#0c66e4'} 71.87%
|
|
44
38
|
);
|
|
45
39
|
margin-left: ${"var(--ds-space-025, 2px)"};
|
|
46
40
|
|
|
@@ -61,15 +55,8 @@ const telepointerStyles = themeProps => {
|
|
|
61
55
|
color: ${"var(--ds-text-inverse, white)"};
|
|
62
56
|
background: linear-gradient(
|
|
63
57
|
45deg,
|
|
64
|
-
${
|
|
65
|
-
|
|
66
|
-
dark: '#60C6D2'
|
|
67
|
-
})(themeProps)} -57%,
|
|
68
|
-
${themed({
|
|
69
|
-
light: '#0C66E4',
|
|
70
|
-
dark: '#388BFF'
|
|
71
|
-
})(themeProps)}
|
|
72
|
-
71.87%
|
|
58
|
+
${colorMode === 'dark' ? '#60c6d2' : '#8bdbe5'} -57%,
|
|
59
|
+
${colorMode === 'dark' ? '#388bff' : '#0c66e4'} 71.87%
|
|
73
60
|
);
|
|
74
61
|
}
|
|
75
62
|
}
|
|
@@ -414,10 +401,7 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
414
401
|
return css`
|
|
415
402
|
font-size: ${editorFontSize(themeProps)}px;
|
|
416
403
|
line-height: 1.5rem;
|
|
417
|
-
color: ${
|
|
418
|
-
light: `var(--ds-text, ${colors.N800})`,
|
|
419
|
-
dark: "var(--ds-text, #B8C7E0)"
|
|
420
|
-
})(themeProps)};
|
|
404
|
+
color: ${`var(--ds-text, ${colors.N800})`};
|
|
421
405
|
|
|
422
406
|
.${RendererCssClassName.DOCUMENT}::after {
|
|
423
407
|
// we add a clearfix after ak-renderer-document in order to
|
|
@@ -480,13 +464,10 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
480
464
|
}
|
|
481
465
|
|
|
482
466
|
& span[data-placeholder] {
|
|
483
|
-
color: ${
|
|
484
|
-
light: `var(--ds-text-subtlest, ${colors.N200})`,
|
|
485
|
-
dark: `var(--ds-text-subtlest, ${colors.DN200})`
|
|
486
|
-
})(themeProps)};
|
|
467
|
+
color: ${`var(--ds-text-subtlest, ${colors.N200})`};
|
|
487
468
|
}
|
|
488
469
|
|
|
489
|
-
${telepointerStyles(
|
|
470
|
+
${telepointerStyles()}
|
|
490
471
|
${whitespaceSharedStyles};
|
|
491
472
|
${blockquoteSharedStyles};
|
|
492
473
|
${headingsSharedStyles()};
|
|
@@ -511,15 +492,9 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
511
492
|
}
|
|
512
493
|
|
|
513
494
|
& span.date-node {
|
|
514
|
-
background: ${
|
|
515
|
-
light: `var(--ds-background-neutral, ${colors.N30A})`,
|
|
516
|
-
dark: `var(--ds-background-neutral, ${colors.DN70})`
|
|
517
|
-
})(themeProps)};
|
|
495
|
+
background: ${`var(--ds-background-neutral, ${colors.N30A})`};
|
|
518
496
|
border-radius: ${"var(--ds-border-radius-100, 3px)"};
|
|
519
|
-
color: ${
|
|
520
|
-
light: `var(--ds-text, ${colors.N800})`,
|
|
521
|
-
dark: `var(--ds-text, ${colors.DN600})`
|
|
522
|
-
})(themeProps)};
|
|
497
|
+
color: ${`var(--ds-text, ${colors.N800})`};
|
|
523
498
|
padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-050, 4px)"};
|
|
524
499
|
margin: 0 1px;
|
|
525
500
|
transition: background 0.3s;
|
|
@@ -655,21 +630,12 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
655
630
|
|
|
656
631
|
table[data-number-column='true'] {
|
|
657
632
|
.${RendererCssClassName.NUMBER_COLUMN} {
|
|
658
|
-
background-color: ${
|
|
659
|
-
light: `var(--ds-background-neutral, ${akEditorTableToolbar})`,
|
|
660
|
-
dark: `var(--ds-background-neutral, ${akEditorTableToolbarDark})`
|
|
661
|
-
})(themeProps)};
|
|
633
|
+
background-color: ${`var(--ds-background-neutral, ${akEditorTableToolbar})`};
|
|
662
634
|
border-right: 1px solid
|
|
663
|
-
${
|
|
664
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`,
|
|
665
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorderDark})`
|
|
666
|
-
})(themeProps)};
|
|
635
|
+
${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
|
|
667
636
|
width: ${akEditorTableNumberColumnWidth}px;
|
|
668
637
|
text-align: center;
|
|
669
|
-
color: ${
|
|
670
|
-
light: `var(--ds-text-subtlest, ${colors.N200})`,
|
|
671
|
-
dark: `var(--ds-text-subtlest, ${colors.DN400})`
|
|
672
|
-
})(themeProps)};
|
|
638
|
+
color: ${`var(--ds-text-subtlest, ${colors.N200})`};
|
|
673
639
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
674
640
|
}
|
|
675
641
|
|
|
@@ -686,15 +652,9 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
686
652
|
z-index: ${akEditorStickyHeaderZIndex};
|
|
687
653
|
|
|
688
654
|
border-right: 1px solid
|
|
689
|
-
${
|
|
690
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`,
|
|
691
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorderDark})`
|
|
692
|
-
})(themeProps)};
|
|
655
|
+
${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
|
|
693
656
|
border-bottom: 1px solid
|
|
694
|
-
${
|
|
695
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`,
|
|
696
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorderDark})`
|
|
697
|
-
})(themeProps)};
|
|
657
|
+
${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
|
|
698
658
|
|
|
699
659
|
/* this is to compensate for the table border */
|
|
700
660
|
transform: translateX(-1px);
|
|
@@ -718,22 +678,10 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
718
678
|
.sticky th,
|
|
719
679
|
.sticky td {
|
|
720
680
|
box-shadow: 0px 1px
|
|
721
|
-
${
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
0px -0.5px ${themed({
|
|
726
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`,
|
|
727
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorderDark})`
|
|
728
|
-
})(themeProps)},
|
|
729
|
-
inset -1px 0px ${themed({
|
|
730
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableToolbar})`,
|
|
731
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableToolbarDark})`
|
|
732
|
-
})(themeProps)},
|
|
733
|
-
0px -1px ${themed({
|
|
734
|
-
light: `var(--ds-background-accent-gray-subtler, ${akEditorTableToolbar})`,
|
|
735
|
-
dark: `var(--ds-background-accent-gray-subtler, ${akEditorTableToolbarDark})`
|
|
736
|
-
})(themeProps)};
|
|
681
|
+
${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`},
|
|
682
|
+
0px -0.5px ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`},
|
|
683
|
+
inset -1px 0px ${`var(--ds-background-accent-gray-subtler, ${akEditorTableToolbar})`},
|
|
684
|
+
0px -1px ${`var(--ds-background-accent-gray-subtler, ${akEditorTableToolbar})`};
|
|
737
685
|
}
|
|
738
686
|
|
|
739
687
|
/* this will remove jumpiness caused in Chrome for sticky headers */
|
|
@@ -3,23 +3,14 @@ var _templateObject;
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { jsx, css } from '@emotion/react';
|
|
5
5
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { N20
|
|
7
|
-
import { themed } from '@atlaskit/theme/components';
|
|
6
|
+
import { N20 } from '@atlaskit/theme/colors';
|
|
8
7
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
9
8
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
10
9
|
import CodeBlockButtonContainer from './codeBlockButtonContainer';
|
|
11
|
-
var codeBlockStyleOverrides =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})(props), CodeBlockSharedCssClassName.DS_CODEBLOCK, relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
16
|
-
background: themed({
|
|
17
|
-
light: "var(--ds-background-neutral, ".concat(N20, ")"),
|
|
18
|
-
dark: "var(--ds-background-neutral, ".concat(DN50, ")")
|
|
19
|
-
})(props),
|
|
20
|
-
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
10
|
+
var codeBlockStyleOverrides = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n background-color: ", ";\n\n &:hover {\n button {\n opacity: 1;\n }\n }\n\n button {\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n }\n\n ", " {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, local, local, local, scroll, scroll, scroll,\n scroll;\n background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0;\n }\n"])), "var(--ds-surface-raised, ".concat(N20, ")"), CodeBlockSharedCssClassName.DS_CODEBLOCK, relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
11
|
+
background: "var(--ds-background-neutral, ".concat(N20, ")"),
|
|
12
|
+
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
13
|
+
}));
|
|
23
14
|
var CodeBlockContainer = function CodeBlockContainer(_ref) {
|
|
24
15
|
var allowCopyToClipboard = _ref.allowCopyToClipboard,
|
|
25
16
|
allowWrapCodeBlock = _ref.allowWrapCodeBlock,
|
|
@@ -5,95 +5,72 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import { MediaInlineImageCard
|
|
9
|
-
import {
|
|
8
|
+
import { MediaInlineImageCard } from '@atlaskit/editor-common/media-inline';
|
|
9
|
+
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
10
10
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
11
11
|
import { MediaClientContext } from '@atlaskit/media-client-react';
|
|
12
|
-
import {
|
|
13
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
14
|
-
import {
|
|
12
|
+
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
13
|
+
import React, { useCallback, useEffect, useState, useContext } from 'react';
|
|
14
|
+
import { injectIntl } from 'react-intl-next';
|
|
15
15
|
import { getClipboardAttrs, mediaIdentifierMap } from '../../ui/MediaCard';
|
|
16
16
|
export var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
17
17
|
var rendererAppearance = _ref.rendererAppearance,
|
|
18
|
-
intl = _ref.intl,
|
|
19
18
|
clipboardAttrs = _ref.clipboardAttrs,
|
|
20
|
-
mediaInlineProviders = _ref.mediaInlineProviders,
|
|
21
19
|
collectionName = _ref.collection,
|
|
22
20
|
eventHandlers = _ref.eventHandlers,
|
|
23
|
-
identifier = _ref.identifier
|
|
24
|
-
alt = _ref.alt,
|
|
25
|
-
width = _ref.width,
|
|
26
|
-
height = _ref.height,
|
|
27
|
-
type = _ref.type,
|
|
28
|
-
borderSize = _ref.borderSize,
|
|
29
|
-
borderColor = _ref.borderColor;
|
|
21
|
+
identifier = _ref.identifier;
|
|
30
22
|
var _useState = useState(),
|
|
31
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
contextIdentifier = _useState2[0],
|
|
25
|
+
setContextIdentifier = _useState2[1];
|
|
34
26
|
var _useState3 = useState(),
|
|
35
27
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
28
|
fileState = _useState4[0],
|
|
37
29
|
setFileState = _useState4[1];
|
|
38
|
-
var mediaClient =
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (!contextIdentifierProvider) {
|
|
46
|
-
_context.next = 5;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
_context.next = 3;
|
|
50
|
-
return contextIdentifierProvider;
|
|
51
|
-
case 3:
|
|
52
|
-
resolvedContextID = _context.sent;
|
|
53
|
-
setContextIdentifierProvider(resolvedContextID);
|
|
54
|
-
case 5:
|
|
55
|
-
case "end":
|
|
56
|
-
return _context.stop();
|
|
30
|
+
var mediaClient = useContext(MediaClientContext);
|
|
31
|
+
var contextIdentifierProvider = useProvider('contextIdentifierProvider');
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
if (contextIdentifierProvider) {
|
|
34
|
+
contextIdentifierProvider.then(function (resolvedContextID) {
|
|
35
|
+
if (contextIdentifier !== resolvedContextID) {
|
|
36
|
+
setContextIdentifier(resolvedContextID);
|
|
57
37
|
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return _ref2.apply(this, arguments);
|
|
62
|
-
};
|
|
63
|
-
}();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, [contextIdentifier, contextIdentifierProvider]);
|
|
64
41
|
var updateFileState = useCallback( /*#__PURE__*/function () {
|
|
65
|
-
var
|
|
42
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
66
43
|
var options, _fileState;
|
|
67
|
-
return _regeneratorRuntime.wrap(function
|
|
68
|
-
while (1) switch (
|
|
44
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
69
46
|
case 0:
|
|
70
47
|
options = {
|
|
71
48
|
collectionName: collectionName
|
|
72
49
|
};
|
|
73
|
-
|
|
50
|
+
_context.prev = 1;
|
|
74
51
|
if (!mediaClient) {
|
|
75
|
-
|
|
52
|
+
_context.next = 7;
|
|
76
53
|
break;
|
|
77
54
|
}
|
|
78
|
-
|
|
55
|
+
_context.next = 5;
|
|
79
56
|
return mediaClient.file.getCurrentState(id, options);
|
|
80
57
|
case 5:
|
|
81
|
-
_fileState =
|
|
58
|
+
_fileState = _context.sent;
|
|
82
59
|
setFileState(_fileState);
|
|
83
60
|
case 7:
|
|
84
|
-
|
|
61
|
+
_context.next = 11;
|
|
85
62
|
break;
|
|
86
63
|
case 9:
|
|
87
|
-
|
|
88
|
-
|
|
64
|
+
_context.prev = 9;
|
|
65
|
+
_context.t0 = _context["catch"](1);
|
|
89
66
|
case 11:
|
|
90
67
|
case "end":
|
|
91
|
-
return
|
|
68
|
+
return _context.stop();
|
|
92
69
|
}
|
|
93
|
-
},
|
|
70
|
+
}, _callee, null, [[1, 9]]);
|
|
94
71
|
}));
|
|
95
|
-
return function (
|
|
96
|
-
return
|
|
72
|
+
return function (_x) {
|
|
73
|
+
return _ref2.apply(this, arguments);
|
|
97
74
|
};
|
|
98
75
|
}(), [collectionName, mediaClient]);
|
|
99
76
|
useEffect(function () {
|
|
@@ -109,14 +86,12 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
109
86
|
};
|
|
110
87
|
}, [identifier, collectionName]);
|
|
111
88
|
useEffect(function () {
|
|
112
|
-
var contextIdentifierProvider = mediaInlineProviders.contextIdentifierProvider;
|
|
113
89
|
var id = clipboardAttrs.id;
|
|
114
|
-
updateContext(contextIdentifierProvider);
|
|
115
90
|
id && updateFileState(id);
|
|
116
|
-
}, [
|
|
91
|
+
}, [contextIdentifier, clipboardAttrs, updateFileState]);
|
|
117
92
|
|
|
118
93
|
/*
|
|
119
|
-
* Only show the loading view if the media
|
|
94
|
+
* Only show the loading view if the media client is not ready
|
|
120
95
|
* prevents calling the media API before the provider is ready
|
|
121
96
|
*/
|
|
122
97
|
if (!mediaClient) {
|
|
@@ -125,19 +100,6 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
125
100
|
isSelected: false
|
|
126
101
|
});
|
|
127
102
|
}
|
|
128
|
-
if (type && shouldShowInlineImage(type)) {
|
|
129
|
-
return /*#__PURE__*/React.createElement(MediaInlineImageCard, {
|
|
130
|
-
mediaClient: mediaClient,
|
|
131
|
-
identifier: identifier,
|
|
132
|
-
alt: alt,
|
|
133
|
-
width: width,
|
|
134
|
-
height: height,
|
|
135
|
-
border: {
|
|
136
|
-
borderSize: borderSize,
|
|
137
|
-
borderColor: borderColor
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
103
|
var handleMediaInlineClick = function handleMediaInlineClick(result) {
|
|
142
104
|
var _eventHandlers$media;
|
|
143
105
|
if (eventHandlers !== null && eventHandlers !== void 0 && (_eventHandlers$media = eventHandlers.media) !== null && _eventHandlers$media !== void 0 && _eventHandlers$media.onClick) {
|
|
@@ -147,34 +109,31 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
147
109
|
};
|
|
148
110
|
var shouldOpenMediaViewer = rendererAppearance !== 'mobile';
|
|
149
111
|
var shouldDisplayToolTip = rendererAppearance !== 'mobile';
|
|
150
|
-
var mediaProvider = mediaInlineProviders.mediaProvider;
|
|
151
112
|
var id = clipboardAttrs.id,
|
|
152
113
|
collection = clipboardAttrs.collection;
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}))
|
|
171
|
-
|
|
114
|
+
return (
|
|
115
|
+
/*#__PURE__*/
|
|
116
|
+
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
117
|
+
React.createElement("span", _extends({}, getClipboardAttrs({
|
|
118
|
+
id: id,
|
|
119
|
+
collection: collection,
|
|
120
|
+
contextIdentifierProvider: contextIdentifier,
|
|
121
|
+
fileState: fileState
|
|
122
|
+
}), {
|
|
123
|
+
"data-node-type": "mediaInline"
|
|
124
|
+
}), /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
125
|
+
identifier: identifier,
|
|
126
|
+
onClick: handleMediaInlineClick,
|
|
127
|
+
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
128
|
+
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
129
|
+
mediaClientConfig: mediaClient.mediaClientConfig,
|
|
130
|
+
mediaViewerItems: Array.from(mediaIdentifierMap.values())
|
|
131
|
+
}))
|
|
132
|
+
);
|
|
172
133
|
};
|
|
173
134
|
var MediaInline = function MediaInline(props) {
|
|
174
|
-
var _borderMark$attrs$col, _borderMark$attrs$siz;
|
|
175
135
|
var collection = props.collection,
|
|
176
136
|
id = props.id,
|
|
177
|
-
providerFactory = props.providers,
|
|
178
137
|
intl = props.intl,
|
|
179
138
|
rendererAppearance = props.rendererAppearance,
|
|
180
139
|
featureFlags = props.featureFlags,
|
|
@@ -182,7 +141,8 @@ var MediaInline = function MediaInline(props) {
|
|
|
182
141
|
alt = props.alt,
|
|
183
142
|
width = props.width,
|
|
184
143
|
height = props.height,
|
|
185
|
-
marks = props.marks
|
|
144
|
+
marks = props.marks,
|
|
145
|
+
ssr = props.ssr;
|
|
186
146
|
var clipboardAttrs = {
|
|
187
147
|
id: id,
|
|
188
148
|
collection: collection
|
|
@@ -192,32 +152,35 @@ var MediaInline = function MediaInline(props) {
|
|
|
192
152
|
mediaItemType: 'file',
|
|
193
153
|
collectionName: collection
|
|
194
154
|
};
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
collection: collection,
|
|
212
|
-
featureFlags: featureFlags,
|
|
213
|
-
type: fileType,
|
|
214
|
-
alt: alt,
|
|
215
|
-
width: width,
|
|
216
|
-
height: height,
|
|
155
|
+
var mediaClient = useContext(MediaClientContext);
|
|
156
|
+
if (fileType === 'image') {
|
|
157
|
+
var _borderMark$attrs$col, _borderMark$attrs$siz;
|
|
158
|
+
var borderMark = marks === null || marks === void 0 ? void 0 : marks.find(function (mark) {
|
|
159
|
+
return (mark === null || mark === void 0 ? void 0 : mark.type.name) === 'border';
|
|
160
|
+
});
|
|
161
|
+
var borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
|
|
162
|
+
var borderSize = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
|
|
163
|
+
return /*#__PURE__*/React.createElement(MediaInlineImageCard, {
|
|
164
|
+
mediaClient: mediaClient,
|
|
165
|
+
identifier: identifier,
|
|
166
|
+
alt: alt,
|
|
167
|
+
width: width,
|
|
168
|
+
height: height,
|
|
169
|
+
ssr: ssr,
|
|
170
|
+
border: {
|
|
217
171
|
borderSize: borderSize,
|
|
218
172
|
borderColor: borderColor
|
|
219
|
-
}
|
|
220
|
-
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
177
|
+
identifier: identifier,
|
|
178
|
+
clipboardAttrs: clipboardAttrs,
|
|
179
|
+
eventHandlers: props.eventHandlers,
|
|
180
|
+
rendererAppearance: rendererAppearance,
|
|
181
|
+
intl: intl,
|
|
182
|
+
collection: collection,
|
|
183
|
+
featureFlags: featureFlags
|
|
221
184
|
});
|
|
222
185
|
};
|
|
223
186
|
export default injectIntl(MediaInline);
|
|
@@ -2,10 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
4
|
var _templateObject, _templateObject2;
|
|
5
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
5
6
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
6
7
|
/** @jsx jsx */
|
|
7
8
|
|
|
8
|
-
import { jsx
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-imports
|
|
11
|
+
import { css } from '@emotion/react';
|
|
9
12
|
import { N40, N50 } from '@atlaskit/theme/colors';
|
|
10
13
|
import React, { useState } from 'react';
|
|
11
14
|
import { renderExtension } from './extension';
|
|
@@ -67,13 +70,7 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
67
70
|
var containerCSS = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-height: 100px;\n\n .multiBodiedExtension--frames > [data-extension-frame='true'] {\n display: none;\n }\n\n .multiBodiedExtension--frames\n > [data-extension-frame='true']:nth-of-type(", ") {\n border: 1px solid ", ";\n display: block;\n min-height: 100px;\n }\n "])), activeChildIndex + 1, "var(--ds-border, ".concat(N50, ")"));
|
|
68
71
|
var isTopLevel = path.length < 1;
|
|
69
72
|
var centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
70
|
-
|
|
71
|
-
className: "multiBodiedExtension--container",
|
|
72
|
-
css: containerCSS,
|
|
73
|
-
"data-testid": "multiBodiedExtension--container",
|
|
74
|
-
"data-active-child-index": activeChildIndex
|
|
75
|
-
}, jsx(WidthConsumer, null, function (_ref2) {
|
|
76
|
-
var width = _ref2.width;
|
|
73
|
+
function renderMbeContent(width) {
|
|
77
74
|
return jsx("div", {
|
|
78
75
|
className: "".concat(RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
79
76
|
style: {
|
|
@@ -87,8 +84,8 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
87
84
|
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
88
85
|
actions: actions,
|
|
89
86
|
type: "multiBodiedExtension"
|
|
90
|
-
}), function (
|
|
91
|
-
var result =
|
|
87
|
+
}), function (_ref2) {
|
|
88
|
+
var result = _ref2.result;
|
|
92
89
|
try {
|
|
93
90
|
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
94
91
|
// Return the content directly if it's a valid JSX.Element
|
|
@@ -109,6 +106,15 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
109
106
|
className: "multiBodiedExtension--frames",
|
|
110
107
|
"data-testid": "multiBodiedExtension--frames"
|
|
111
108
|
}, children));
|
|
109
|
+
}
|
|
110
|
+
return jsx("section", {
|
|
111
|
+
className: "multiBodiedExtension--container",
|
|
112
|
+
css: containerCSS,
|
|
113
|
+
"data-testid": "multiBodiedExtension--container",
|
|
114
|
+
"data-active-child-index": activeChildIndex
|
|
115
|
+
}, jsx(WidthConsumer, null, function (_ref3) {
|
|
116
|
+
var width = _ref3.width;
|
|
117
|
+
return renderMbeContent(width);
|
|
112
118
|
}));
|
|
113
119
|
};
|
|
114
120
|
export default MultiBodiedExtension;
|
|
@@ -8,32 +8,18 @@ import React from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import TipIcon from '@atlaskit/icon/glyph/editor/hint';
|
|
10
10
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
11
|
-
import {
|
|
11
|
+
import { panelSharedStylesWithoutPrefix, PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
12
12
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
13
13
|
import EmojiIcon from '@atlaskit/icon/glyph/editor/emoji';
|
|
14
14
|
import EmojiItem from './emoji';
|
|
15
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
16
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
17
|
-
import { themed } from '@atlaskit/theme';
|
|
18
15
|
import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
|
|
19
16
|
var PanelStyled = function PanelStyled(_ref) {
|
|
20
17
|
var backgroundColor = _ref.backgroundColor,
|
|
21
18
|
hasIcon = _ref.hasIcon,
|
|
22
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
var styles =
|
|
24
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", " {\n ", "\n\n &[data-panel-type=", "] {\n ", "\n }\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, hasIcon ? '' : 'padding-left: 12px;');
|
|
25
|
-
};
|
|
20
|
+
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", " {\n ", "\n\n &[data-panel-type=", "] {\n ", "\n }\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, hasIcon ? '' : 'padding-left: 12px;');
|
|
26
21
|
if (props['data-panel-type'] === PanelType.CUSTOM && backgroundColor) {
|
|
27
|
-
styles =
|
|
28
|
-
var tokenColor = hexToEditorBackgroundPaletteColor(backgroundColor);
|
|
29
|
-
var customStyle = themed({
|
|
30
|
-
dark: getPanelBackgroundDarkModeColors,
|
|
31
|
-
light: "background-color: ".concat(tokenColor || backgroundColor, ";")
|
|
32
|
-
})({
|
|
33
|
-
theme: theme
|
|
34
|
-
});
|
|
35
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.", " {\n ", "\n }\n\n &[data-panel-type=", "] {\n ", ";\n ", "\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, customStyle, hasIcon ? '' : 'padding-left: 12px;');
|
|
36
|
-
};
|
|
22
|
+
styles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.", " {\n ", "\n }\n\n &[data-panel-type=", "] {\n background-color: ", ";\n ", "\n }\n "])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, hexToEditorBackgroundPaletteColor(backgroundColor) || backgroundColor, hasIcon ? '' : 'padding-left: 12px;');
|
|
37
23
|
}
|
|
38
24
|
return jsx("div", _extends({
|
|
39
25
|
css: styles
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { isTableResizingEnabled } from '../table';
|
|
7
6
|
|
|
8
7
|
// we allow scaling down column widths by no more than 30%
|
|
@@ -68,17 +67,11 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
|
68
67
|
tableContainerWidth = getTableLayoutWidth(layout);
|
|
69
68
|
}
|
|
70
69
|
if (isTableResizingEnabled(rendererAppearance) && !isInsideOfBlockNode && !tableResized) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
targetWidths = new Array(noOfColumns).fill(defaultColumnWidth);
|
|
77
|
-
} else {
|
|
78
|
-
return new Array(noOfColumns).fill({
|
|
79
|
-
minWidth: "".concat(tableCellMinWidth, "px")
|
|
80
|
-
});
|
|
81
|
-
}
|
|
70
|
+
// for tables with no column widths defined, assume that the real table width
|
|
71
|
+
// is defined by node.attrs.width
|
|
72
|
+
var _tableWidth2 = (isNumberColumnEnabled ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth) - 1;
|
|
73
|
+
var defaultColumnWidth = _tableWidth2 / noOfColumns;
|
|
74
|
+
targetWidths = new Array(noOfColumns).fill(defaultColumnWidth);
|
|
82
75
|
} else if (!tableResized) {
|
|
83
76
|
return null;
|
|
84
77
|
}
|