@atlaskit/renderer 93.0.4 → 95.0.1
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 +29 -0
- 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/heading-anchor.js +4 -2
- package/dist/cjs/react/nodes/table/sticky.js +19 -17
- package/dist/cjs/render-document.js +141 -54
- package/dist/cjs/ui/Renderer/index.js +19 -23
- 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/version.json +1 -1
- 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/heading-anchor.js +3 -2
- package/dist/es2019/react/nodes/table/sticky.js +28 -24
- package/dist/es2019/render-document.js +116 -55
- package/dist/es2019/ui/Renderer/index.js +3 -8
- package/dist/es2019/ui/Renderer/style.js +34 -29
- 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/version.json +1 -1
- 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/heading-anchor.js +3 -2
- package/dist/esm/react/nodes/table/sticky.js +18 -18
- package/dist/esm/render-document.js +136 -54
- package/dist/esm/ui/Renderer/index.js +19 -23
- package/dist/esm/ui/Renderer/style.js +29 -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/version.json +1 -1
- package/dist/types/render-document.d.ts +1 -1
- package/package.json +22 -16
|
@@ -3,6 +3,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
3
3
|
import { gridSize, fontFamily, fontSize, borderRadius } from '@atlaskit/theme/constants';
|
|
4
4
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
5
|
import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
6
7
|
import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding, textColorStyles } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { shadowClassNames } from '@atlaskit/editor-common/ui';
|
|
8
9
|
import { editorFontSize, blockNodesVerticalMargin, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, gridMediumMaxWidth, akEditorFullWidthLayoutWidth, akEditorStickyHeaderZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -213,7 +214,7 @@ const tableSortableColumnStyle = ({
|
|
|
213
214
|
outline: unset;
|
|
214
215
|
}
|
|
215
216
|
&:focus-visible {
|
|
216
|
-
border-color: ${colors.B300};
|
|
217
|
+
border-color: ${token('color.border.focused', colors.B300)};
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
|
|
@@ -288,8 +289,8 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
288
289
|
font-size: ${editorFontSize(themeProps)}px;
|
|
289
290
|
line-height: 1.5rem;
|
|
290
291
|
color: ${themed({
|
|
291
|
-
light: colors.N800,
|
|
292
|
-
dark: '#B8C7E0'
|
|
292
|
+
light: token('color.text', colors.N800),
|
|
293
|
+
dark: token('color.text', '#B8C7E0')
|
|
293
294
|
})(themeProps)};
|
|
294
295
|
|
|
295
296
|
.${RendererCssClassName.DOCUMENT}::after {
|
|
@@ -331,13 +332,17 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
& span.akActionMark {
|
|
334
|
-
color: ${colors.B400};
|
|
335
|
+
color: ${token('color.link', colors.B400)};
|
|
335
336
|
text-decoration: none;
|
|
336
337
|
|
|
337
338
|
&:hover {
|
|
338
|
-
color: ${colors.B300};
|
|
339
|
+
color: ${token('color.link', colors.B300)};
|
|
339
340
|
text-decoration: underline;
|
|
340
341
|
}
|
|
342
|
+
|
|
343
|
+
&:active {
|
|
344
|
+
color: ${token('color.link.pressed', colors.B500)};
|
|
345
|
+
}
|
|
341
346
|
}
|
|
342
347
|
|
|
343
348
|
& span.akActionMark {
|
|
@@ -373,13 +378,13 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
373
378
|
|
|
374
379
|
& span.date-node {
|
|
375
380
|
background: ${themed({
|
|
376
|
-
light: colors.N30A,
|
|
377
|
-
dark: colors.DN70
|
|
381
|
+
light: token('color.background.neutral', colors.N30A),
|
|
382
|
+
dark: token('color.background.neutral', colors.DN70)
|
|
378
383
|
})(themeProps)};
|
|
379
384
|
border-radius: ${borderRadius()}px;
|
|
380
385
|
color: ${themed({
|
|
381
|
-
light: colors.N800,
|
|
382
|
-
dark: colors.DN600
|
|
386
|
+
light: token('color.text', colors.N800),
|
|
387
|
+
dark: token('color.text', colors.DN600)
|
|
383
388
|
})(themeProps)};
|
|
384
389
|
padding: 2px 4px;
|
|
385
390
|
margin: 0 1px;
|
|
@@ -387,8 +392,8 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
387
392
|
}
|
|
388
393
|
|
|
389
394
|
& span.date-node-highlighted {
|
|
390
|
-
background: ${colors.R50};
|
|
391
|
-
color: ${colors.R500};
|
|
395
|
+
background: ${token('color.background.danger', colors.R50)};
|
|
396
|
+
color: ${token('color.text.danger', colors.R500)};
|
|
392
397
|
}
|
|
393
398
|
|
|
394
399
|
& .renderer-image {
|
|
@@ -506,19 +511,19 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
506
511
|
table[data-number-column='true'] {
|
|
507
512
|
.${RendererCssClassName.NUMBER_COLUMN} {
|
|
508
513
|
background-color: ${themed({
|
|
509
|
-
light: akEditorTableToolbar,
|
|
510
|
-
dark: akEditorTableToolbarDark
|
|
514
|
+
light: token('color.background.neutral', akEditorTableToolbar),
|
|
515
|
+
dark: token('color.background.neutral', akEditorTableToolbarDark)
|
|
511
516
|
})(themeProps)};
|
|
512
517
|
border-right: 1px solid
|
|
513
518
|
${themed({
|
|
514
|
-
light: akEditorTableBorder,
|
|
515
|
-
dark: akEditorTableBorderDark
|
|
519
|
+
light: token('color.border', akEditorTableBorder),
|
|
520
|
+
dark: token('color.border', akEditorTableBorderDark)
|
|
516
521
|
})(themeProps)};
|
|
517
522
|
width: ${akEditorTableNumberColumnWidth}px;
|
|
518
523
|
text-align: center;
|
|
519
524
|
color: ${themed({
|
|
520
|
-
light: colors.N200,
|
|
521
|
-
dark: colors.DN400
|
|
525
|
+
light: token('color.text.subtlest', colors.N200),
|
|
526
|
+
dark: token('color.text.subtlest', colors.DN400)
|
|
522
527
|
})(themeProps)};
|
|
523
528
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
524
529
|
}
|
|
@@ -537,13 +542,13 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
537
542
|
|
|
538
543
|
border-right: 1px solid
|
|
539
544
|
${themed({
|
|
540
|
-
light: akEditorTableBorder,
|
|
541
|
-
dark: akEditorTableBorderDark
|
|
545
|
+
light: token('color.border', akEditorTableBorder),
|
|
546
|
+
dark: token('color.border', akEditorTableBorderDark)
|
|
542
547
|
})(themeProps)};
|
|
543
548
|
border-bottom: 1px solid
|
|
544
549
|
${themed({
|
|
545
|
-
light: akEditorTableBorder,
|
|
546
|
-
dark: akEditorTableBorderDark
|
|
550
|
+
light: token('color.border', akEditorTableBorder),
|
|
551
|
+
dark: token('color.border', akEditorTableBorderDark)
|
|
547
552
|
})(themeProps)};
|
|
548
553
|
|
|
549
554
|
/* this is to compensate for the table border */
|
|
@@ -569,20 +574,20 @@ export const rendererStyles = wrapperProps => theme => {
|
|
|
569
574
|
.sticky td {
|
|
570
575
|
box-shadow: 0px 1px
|
|
571
576
|
${themed({
|
|
572
|
-
light: akEditorTableBorder,
|
|
573
|
-
dark: akEditorTableBorderDark
|
|
577
|
+
light: token('color.border', akEditorTableBorder),
|
|
578
|
+
dark: token('color.border', akEditorTableBorderDark)
|
|
574
579
|
})(themeProps)},
|
|
575
580
|
0px -0.5px ${themed({
|
|
576
|
-
light: akEditorTableBorder,
|
|
577
|
-
dark: akEditorTableBorderDark
|
|
581
|
+
light: token('color.border', akEditorTableBorder),
|
|
582
|
+
dark: token('color.border', akEditorTableBorderDark)
|
|
578
583
|
})(themeProps)},
|
|
579
584
|
inset -1px 0px ${themed({
|
|
580
|
-
light: akEditorTableToolbar,
|
|
581
|
-
dark: akEditorTableToolbarDark
|
|
585
|
+
light: token('color.border', akEditorTableToolbar),
|
|
586
|
+
dark: token('color.border', akEditorTableToolbarDark)
|
|
582
587
|
})(themeProps)},
|
|
583
588
|
0px -1px ${themed({
|
|
584
|
-
light: akEditorTableToolbar,
|
|
585
|
-
dark: akEditorTableToolbarDark
|
|
589
|
+
light: token('color.border', akEditorTableToolbar),
|
|
590
|
+
dark: token('color.border', akEditorTableToolbarDark)
|
|
586
591
|
})(themeProps)};
|
|
587
592
|
}
|
|
588
593
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { Component } from 'react';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
4
5
|
|
|
5
6
|
const fadeOutStyles = (maxHeight, top, backgroundColor) => css`
|
|
6
7
|
position: relative;
|
|
@@ -14,7 +15,7 @@ const fadeOutStyles = (maxHeight, top, backgroundColor) => css`
|
|
|
14
15
|
left: 0;
|
|
15
16
|
right: 0;
|
|
16
17
|
background-image: linear-gradient(
|
|
17
|
-
rgba(255, 255, 255, 0),
|
|
18
|
+
${token('color.background.neutral.subtle', 'rgba(255, 255, 255, 0)')},
|
|
18
19
|
${backgroundColor}
|
|
19
20
|
);
|
|
20
21
|
}
|
|
@@ -37,13 +38,14 @@ const FadeOut = props => {
|
|
|
37
38
|
export class TruncatedWrapper extends Component {
|
|
38
39
|
constructor(props) {
|
|
39
40
|
super(props);
|
|
40
|
-
}
|
|
41
|
+
} // TODO: Quality ticket as elevation.surface will be issue when sits top of modal. https://product-fabric.atlassian.net/browse/DSP-4123
|
|
42
|
+
|
|
41
43
|
|
|
42
44
|
render() {
|
|
43
45
|
const {
|
|
44
46
|
height = 95,
|
|
45
47
|
fadeHeight = 24,
|
|
46
|
-
backgroundColor = 'white',
|
|
48
|
+
backgroundColor = token('elevation.surface', 'white'),
|
|
47
49
|
children
|
|
48
50
|
} = this.props;
|
|
49
51
|
return jsx(FadeOut, {
|
|
@@ -5,13 +5,15 @@ import { gridSize } from '@atlaskit/theme/constants';
|
|
|
5
5
|
import { N20, N30 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
7
7
|
import { sortingIconMessages } from '../messages';
|
|
8
|
-
import { injectIntl } from 'react-intl-next';
|
|
8
|
+
import { injectIntl } from 'react-intl-next';
|
|
9
|
+
import { token } from '@atlaskit/tokens'; // We use data url here because of this issue:
|
|
9
10
|
// https://product-fabric.atlassian.net/browse/ED-8001
|
|
10
11
|
// Remove this workaround if Firefox has fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=1664350
|
|
12
|
+
// TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4136
|
|
11
13
|
|
|
12
14
|
export const TableSortIconDataUrl = `data:image/svg+xml;utf8,${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>`)}`;
|
|
13
15
|
const TABLE_SORTING_ICON_CLASS = 'table-sorting-icon';
|
|
14
|
-
export let StatusClassNames;
|
|
16
|
+
export let StatusClassNames; // TODO: get design to check border
|
|
15
17
|
|
|
16
18
|
(function (StatusClassNames) {
|
|
17
19
|
StatusClassNames["ASC"] = "sorting-icon-svg__asc";
|
|
@@ -28,14 +30,14 @@ const wrapperStyles = css`
|
|
|
28
30
|
margin: 6px;
|
|
29
31
|
right: 0;
|
|
30
32
|
top: 0;
|
|
31
|
-
border: 2px solid #fff;
|
|
33
|
+
border: 2px solid ${token('color.border.inverse', '#fff')};
|
|
32
34
|
border-radius: ${gridSize() / 2}px;
|
|
33
|
-
background-color: ${N20};
|
|
35
|
+
background-color: ${token('color.background.neutral.subtle', N20)};
|
|
34
36
|
justify-content: center;
|
|
35
37
|
align-items: center;
|
|
36
38
|
|
|
37
39
|
&:hover {
|
|
38
|
-
background-color: ${N30};
|
|
40
|
+
background-color: ${token('color.background.neutral.subtle.hovered', N30)};
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
&.${StatusClassNames.SORTING_NOT_ALLOWED} {
|
|
@@ -13,7 +13,7 @@ import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
|
|
|
13
13
|
const markStyles = props => css`
|
|
14
14
|
color: inherit;
|
|
15
15
|
background-color: unset;
|
|
16
|
-
-webkit-tap-highlight-color:
|
|
16
|
+
-webkit-tap-highlight-color: transparent;
|
|
17
17
|
|
|
18
18
|
${AnnotationSharedCSSByState(props).focus};
|
|
19
19
|
`;
|
|
@@ -9,7 +9,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
|
9
9
|
const markStyles = props => css`
|
|
10
10
|
color: inherit;
|
|
11
11
|
background-color: unset;
|
|
12
|
-
-webkit-tap-highlight-color:
|
|
12
|
+
-webkit-tap-highlight-color: transparent;
|
|
13
13
|
|
|
14
14
|
&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}'] {
|
|
15
15
|
${AnnotationSharedCSSByState({
|
package/dist/es2019/version.json
CHANGED
|
@@ -6,11 +6,12 @@ var _templateObject;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import React, { Fragment } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { B400, B300 } from '@atlaskit/theme/colors';
|
|
9
|
+
import { B400, B300, B500 } from '@atlaskit/theme/colors';
|
|
10
10
|
import { getEventHandler } from '../../utils';
|
|
11
11
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
13
|
-
|
|
13
|
+
import { token } from '@atlaskit/tokens';
|
|
14
|
+
var anchorStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n"])), token('color.link', B400), token('color.link', B300), token('color.link.pressed', B500));
|
|
14
15
|
export default function Link(props) {
|
|
15
16
|
var href = props.href,
|
|
16
17
|
target = props.target,
|
|
@@ -14,6 +14,9 @@ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
|
14
14
|
import { useFeatureFlags } from '../../use-feature-flags';
|
|
15
15
|
import CopyButton from './codeBlockCopyButton';
|
|
16
16
|
|
|
17
|
+
// TODO: Quality ticket https://product-fabric.atlassian.net/browse/DSP-4118
|
|
18
|
+
|
|
19
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
17
20
|
var codeBlockStyle = function codeBlockStyle(props) {
|
|
18
21
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n }\n "])), relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
19
22
|
background: themed({
|
|
@@ -23,6 +26,8 @@ var codeBlockStyle = function codeBlockStyle(props) {
|
|
|
23
26
|
width: "".concat(gridSize(), "px")
|
|
24
27
|
}));
|
|
25
28
|
};
|
|
29
|
+
/* eslint-enable */
|
|
30
|
+
|
|
26
31
|
|
|
27
32
|
function CodeBlock(props) {
|
|
28
33
|
var text = props.text,
|
|
@@ -13,7 +13,8 @@ import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
|
13
13
|
import { N20, N30, N700 } from '@atlaskit/theme/colors';
|
|
14
14
|
import { CopyTextConsumer } from './copy-text-provider';
|
|
15
15
|
import { codeBlockCopyButtonMessages } from '../../messages';
|
|
16
|
-
|
|
16
|
+
import { token } from '@atlaskit/tokens';
|
|
17
|
+
var copyButtonWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n position: sticky;\n justify-content: flex-end;\n top: 0;\n\n button {\n position: absolute;\n display: flex;\n justify-content: center;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n border: 2px solid ", ";\n border-radius: 4px;\n background-color: ", ";\n color: ", ";\n }\n\n button:hover {\n background-color: ", ";\n }\n\n button.clicked {\n background-color: ", ";\n color: ", " !important;\n }\n"])), token('color.border.inverse', '#fff'), token('color.background.neutral.subtle', N20), token('color.icon', 'rgb(66, 82, 110)'), token('color.background.neutral.hovered', N30), token('color.background.neutral.bold.pressed', N700), token('color.icon.inverse', '#fff'));
|
|
17
18
|
|
|
18
19
|
var CopyButton = function CopyButton(_ref) {
|
|
19
20
|
var content = _ref.content,
|
|
@@ -27,6 +27,7 @@ import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
|
27
27
|
import Tooltip from '@atlaskit/tooltip';
|
|
28
28
|
import { injectIntl } from 'react-intl-next';
|
|
29
29
|
import { headingAnchorLinkMessages } from '../../messages';
|
|
30
|
+
import { token } from '@atlaskit/tokens';
|
|
30
31
|
export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
31
32
|
var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
32
33
|
var children = props.children,
|
|
@@ -37,7 +38,7 @@ var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, re
|
|
|
37
38
|
ref: ref
|
|
38
39
|
}), children);
|
|
39
40
|
});
|
|
40
|
-
var copyAnchorButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline;\n outline: none;\n background-color: transparent;\n border: none;\n color: ", ";\n cursor: pointer;\n right: 0;\n"])), N500);
|
|
41
|
+
var copyAnchorButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline;\n outline: none;\n background-color: transparent;\n border: none;\n color: ", ";\n cursor: pointer;\n right: 0;\n"])), token('color.icon', N500));
|
|
41
42
|
|
|
42
43
|
var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
43
44
|
_inherits(HeadingAnchor, _React$PureComponent);
|
|
@@ -126,7 +127,7 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
126
127
|
}, jsx(LinkIcon, {
|
|
127
128
|
label: _this.getCopyAriaLabel(),
|
|
128
129
|
size: _this.props.level > 3 ? 'small' : 'medium',
|
|
129
|
-
primaryColor: _this.state.isClicked ? B400 : N200
|
|
130
|
+
primaryColor: _this.state.isClicked ? token('color.icon.selected', B400) : token('color.icon.subtle', N200)
|
|
130
131
|
}));
|
|
131
132
|
});
|
|
132
133
|
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
5
|
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
6
7
|
|
|
7
8
|
/** @jsx jsx */
|
|
8
9
|
import React from 'react';
|
|
9
10
|
import { css, jsx } from '@emotion/react';
|
|
10
11
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
11
12
|
import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
|
-
import * as colors from '@atlaskit/theme/colors';
|
|
13
|
+
import * as colors from '@atlaskit/theme/colors'; // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
14
|
+
|
|
13
15
|
var N40A = colors.N40A;
|
|
16
|
+
import { token } from '@atlaskit/tokens';
|
|
14
17
|
import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
15
18
|
import { Table } from './table';
|
|
16
19
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
17
20
|
export var tableStickyPadding = 8;
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var getModeSpecificStyles = function getModeSpecificStyles(mode) {
|
|
24
|
-
if (mode === 'none') {
|
|
25
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "])));
|
|
26
|
-
} else {
|
|
27
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: ", ";\n "])), fixedTableDivModeToPosition[mode]);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
21
|
+
var modeSpecficStyles = {
|
|
22
|
+
none: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "]))),
|
|
23
|
+
stick: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: fixed;\n "]))),
|
|
24
|
+
'pin-bottom': css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n "])))
|
|
25
|
+
}; // TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4123
|
|
30
26
|
|
|
31
27
|
var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width) {
|
|
32
|
-
return css(
|
|
28
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n width: ", "px;\n z-index: ", ";\n &\n .", ",\n &\n .", "\n > table {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n border-top: ", "px solid\n ", ";\n background: ", ";\n box-shadow: ", ";\n\n div[data-expanded='false'] & {\n display: none;\n }\n\n &\n .", ".right-shadow::after,\n &\n .", ".left-shadow::before {\n top: 0px;\n height: 100%;\n }\n"])), typeof top === 'number' && "top: ".concat(top, "px;"), width, akEditorStickyHeaderZIndex, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableStickyPadding, token('elevation.surface', 'white'), token('elevation.surface.overlay', 'white'), token('elevation.shadow.overflow', "0 6px 4px -4px ".concat(N40A)), TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
|
|
33
29
|
};
|
|
34
30
|
|
|
35
31
|
export var FixedTableDiv = function FixedTableDiv(props) {
|
|
36
32
|
var top = props.top,
|
|
37
33
|
wrapperWidth = props.wrapperWidth,
|
|
38
34
|
mode = props.mode;
|
|
39
|
-
var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth),
|
|
40
|
-
|
|
35
|
+
var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
36
|
+
var attrs = {
|
|
37
|
+
mode: mode
|
|
38
|
+
};
|
|
39
|
+
return jsx("div", _extends({}, attrs, {
|
|
40
|
+
"data-testid": "sticky-table-fixed",
|
|
41
41
|
css: fixedTableCss
|
|
42
|
-
}, props.children);
|
|
42
|
+
}), props.children);
|
|
43
43
|
};
|
|
44
44
|
export var StickyTable = function StickyTable(_ref) {
|
|
45
45
|
var top = _ref.top,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import memoizeOne from 'memoize-one';
|
|
1
3
|
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
2
4
|
import { getValidDocument } from '@atlaskit/editor-common/validator';
|
|
3
5
|
import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common/utils';
|
|
@@ -18,6 +20,137 @@ var withStopwatch = function withStopwatch(cb) {
|
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
|
|
23
|
+
var _validation = function _validation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent) {
|
|
24
|
+
var result;
|
|
25
|
+
|
|
26
|
+
if (useSpecBasedValidator) {
|
|
27
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
28
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
29
|
+
var _transformMediaLinkMa = transformMediaLinkMarks(doc),
|
|
30
|
+
transformedAdf = _transformMediaLinkMa.transformedAdf,
|
|
31
|
+
isTransformed = _transformMediaLinkMa.isTransformed;
|
|
32
|
+
|
|
33
|
+
if (isTransformed && dispatchAnalyticsEvent) {
|
|
34
|
+
dispatchAnalyticsEvent({
|
|
35
|
+
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
36
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
37
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
result = validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
42
|
+
} else {
|
|
43
|
+
result = getValidDocument(doc, schema, adfStage);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!result) {
|
|
47
|
+
return result;
|
|
48
|
+
} // ProseMirror always require a child under doc
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if (result.type === 'doc' && useSpecBasedValidator) {
|
|
52
|
+
if (Array.isArray(result.content) && result.content.length === 0) {
|
|
53
|
+
result.content.push({
|
|
54
|
+
type: 'paragraph',
|
|
55
|
+
content: []
|
|
56
|
+
});
|
|
57
|
+
} // Just making sure doc is always valid
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if (!result.version) {
|
|
61
|
+
result.version = 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var memoValidation = memoizeOne(_validation, function (newArgs, lastArgs) {
|
|
69
|
+
var _newArgs = _slicedToArray(newArgs, 4),
|
|
70
|
+
newDoc = _newArgs[0],
|
|
71
|
+
newSchema = _newArgs[1],
|
|
72
|
+
newADFStage = _newArgs[2],
|
|
73
|
+
newUseSpecValidator = _newArgs[3];
|
|
74
|
+
|
|
75
|
+
var _lastArgs = _slicedToArray(lastArgs, 4),
|
|
76
|
+
oldDoc = _lastArgs[0],
|
|
77
|
+
oldSchema = _lastArgs[1],
|
|
78
|
+
oldADFStage = _lastArgs[2],
|
|
79
|
+
oldUseSpecValidator = _lastArgs[3]; // we're ignoring changes to dispatchAnalyticsEvent in this check
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
var result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator;
|
|
83
|
+
return result;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var areDocsEqual = function areDocsEqual(docA, docB) {
|
|
87
|
+
if (docA === docB) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof docA === 'string' && typeof docB === 'string') {
|
|
92
|
+
return docA === docB;
|
|
93
|
+
} // PMNode
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if (docA.type && docA.toJSON && docB.type && docB.toJSON) {
|
|
97
|
+
return JSON.stringify(docA.toJSON()) === JSON.stringify(docB.toJSON());
|
|
98
|
+
} // Object
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
return JSON.stringify(docA) === JSON.stringify(docB);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var _serializeFragment = function _serializeFragment(serializer, doc) {
|
|
105
|
+
return serializer.serializeFragment(doc.content);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var memoSerializeFragment = memoizeOne(_serializeFragment, function (newArgs, lastArgs) {
|
|
109
|
+
var _newArgs2 = _slicedToArray(newArgs, 2),
|
|
110
|
+
newSerializer = _newArgs2[0],
|
|
111
|
+
newDoc = _newArgs2[1];
|
|
112
|
+
|
|
113
|
+
var _lastArgs2 = _slicedToArray(lastArgs, 2),
|
|
114
|
+
oldSerializer = _lastArgs2[0],
|
|
115
|
+
oldDoc = _lastArgs2[1];
|
|
116
|
+
|
|
117
|
+
return newSerializer === oldSerializer && areDocsEqual(newDoc, oldDoc);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
var _createNodeAndCheck = function _createNodeAndCheck(schema, doc, dispatchAnalyticsEvent) {
|
|
121
|
+
var pmNode = schema.nodeFromJSON(doc);
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
pmNode.check();
|
|
125
|
+
} catch (err) {
|
|
126
|
+
if (dispatchAnalyticsEvent) {
|
|
127
|
+
dispatchAnalyticsEvent({
|
|
128
|
+
action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
|
|
129
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
130
|
+
attributes: {
|
|
131
|
+
platform: PLATFORM.WEB,
|
|
132
|
+
error: err === null || err === void 0 ? void 0 : err.toString()
|
|
133
|
+
},
|
|
134
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return pmNode;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
var memoCreateNodeAndCheck = memoizeOne(_createNodeAndCheck, function (newArgs, lastArgs) {
|
|
143
|
+
// ignore dispatchAnalyticsEvent
|
|
144
|
+
var _newArgs3 = _slicedToArray(newArgs, 2),
|
|
145
|
+
newSchema = _newArgs3[0],
|
|
146
|
+
newDoc = _newArgs3[1];
|
|
147
|
+
|
|
148
|
+
var _lastArgs3 = _slicedToArray(lastArgs, 2),
|
|
149
|
+
oldSchema = _lastArgs3[0],
|
|
150
|
+
oldDoc = _lastArgs3[1];
|
|
151
|
+
|
|
152
|
+
return newSchema === oldSchema && areDocsEqual(newDoc, oldDoc);
|
|
153
|
+
});
|
|
21
154
|
export var renderDocument = function renderDocument(doc, serializer) {
|
|
22
155
|
var schema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultSchema;
|
|
23
156
|
var adfStage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'final';
|
|
@@ -31,25 +164,7 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
31
164
|
};
|
|
32
165
|
|
|
33
166
|
var _withStopwatch = withStopwatch(function () {
|
|
34
|
-
|
|
35
|
-
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
36
|
-
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
37
|
-
var _transformMediaLinkMa = transformMediaLinkMarks(doc),
|
|
38
|
-
transformedAdf = _transformMediaLinkMa.transformedAdf,
|
|
39
|
-
isTransformed = _transformMediaLinkMa.isTransformed;
|
|
40
|
-
|
|
41
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
42
|
-
dispatchAnalyticsEvent({
|
|
43
|
-
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
44
|
-
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
45
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return getValidDocument(doc, schema, adfStage);
|
|
167
|
+
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent);
|
|
53
168
|
}),
|
|
54
169
|
validDoc = _withStopwatch.output,
|
|
55
170
|
sanitizeTime = _withStopwatch.time; // save sanitize time to stats
|
|
@@ -62,43 +177,10 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
62
177
|
stat: stat,
|
|
63
178
|
result: null
|
|
64
179
|
};
|
|
65
|
-
} // ProseMirror always require a child under doc
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (validDoc.type === 'doc' && useSpecBasedValidator) {
|
|
69
|
-
if (Array.isArray(validDoc.content) && validDoc.content.length === 0) {
|
|
70
|
-
validDoc.content.push({
|
|
71
|
-
type: 'paragraph',
|
|
72
|
-
content: []
|
|
73
|
-
});
|
|
74
|
-
} // Just making sure doc is always valid
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!validDoc.version) {
|
|
78
|
-
validDoc.version = 1;
|
|
79
|
-
}
|
|
80
180
|
}
|
|
81
181
|
|
|
82
182
|
var _withStopwatch2 = withStopwatch(function () {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
pmNode.check();
|
|
87
|
-
} catch (err) {
|
|
88
|
-
if (dispatchAnalyticsEvent) {
|
|
89
|
-
dispatchAnalyticsEvent({
|
|
90
|
-
action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
|
|
91
|
-
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
92
|
-
attributes: {
|
|
93
|
-
platform: PLATFORM.WEB,
|
|
94
|
-
error: err === null || err === void 0 ? void 0 : err.toString()
|
|
95
|
-
},
|
|
96
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return pmNode;
|
|
183
|
+
return memoCreateNodeAndCheck(schema, validDoc, dispatchAnalyticsEvent);
|
|
102
184
|
}),
|
|
103
185
|
node = _withStopwatch2.output,
|
|
104
186
|
buildTreeTime = _withStopwatch2.time; // save build tree time to stats
|
|
@@ -107,7 +189,7 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
107
189
|
stat.buildTreeTime = buildTreeTime;
|
|
108
190
|
|
|
109
191
|
var _withStopwatch3 = withStopwatch(function () {
|
|
110
|
-
return serializer
|
|
192
|
+
return memoSerializeFragment(serializer, node);
|
|
111
193
|
}),
|
|
112
194
|
result = _withStopwatch3.output,
|
|
113
195
|
serializeTime = _withStopwatch3.time; // save serialize tree time to stats
|