@atlaskit/renderer 90.0.0 → 92.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 +28 -0
- package/dist/cjs/analytics/enums.js +1 -0
- package/dist/cjs/react/nodes/codeBlock.js +17 -16
- package/dist/cjs/react/nodes/heading.js +4 -2
- package/dist/cjs/react/nodes/layoutColumn.js +7 -2
- package/dist/cjs/react/nodes/media.js +7 -6
- package/dist/cjs/react/nodes/table/sticky.js +13 -2
- package/dist/cjs/react/utils/inject-props.js +33 -0
- package/dist/cjs/ui/Expand.js +15 -11
- package/dist/cjs/ui/Renderer/index.js +44 -25
- package/dist/cjs/ui/Renderer/style.js +19 -7
- package/dist/cjs/ui/annotations/draft/component.js +22 -12
- package/dist/cjs/ui/annotations/element/mark.js +9 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +1 -0
- package/dist/es2019/react/nodes/codeBlock.js +25 -23
- package/dist/es2019/react/nodes/heading.js +4 -2
- package/dist/es2019/react/nodes/layoutColumn.js +7 -3
- package/dist/es2019/react/nodes/media.js +9 -5
- package/dist/es2019/react/nodes/table/sticky.js +16 -5
- package/dist/es2019/react/utils/inject-props.js +24 -0
- package/dist/es2019/ui/Expand.js +17 -12
- package/dist/es2019/ui/Renderer/index.js +45 -25
- package/dist/es2019/ui/Renderer/style.js +40 -24
- package/dist/es2019/ui/annotations/draft/component.js +18 -12
- package/dist/es2019/ui/annotations/element/mark.js +12 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +1 -0
- package/dist/esm/react/nodes/codeBlock.js +18 -14
- package/dist/esm/react/nodes/heading.js +4 -2
- package/dist/esm/react/nodes/layoutColumn.js +7 -3
- package/dist/esm/react/nodes/media.js +8 -5
- package/dist/esm/react/nodes/table/sticky.js +12 -2
- package/dist/esm/react/utils/inject-props.js +24 -0
- package/dist/esm/ui/Expand.js +16 -12
- package/dist/esm/ui/Renderer/index.js +46 -25
- package/dist/esm/ui/Renderer/style.js +16 -8
- package/dist/esm/ui/annotations/draft/component.js +18 -11
- package/dist/esm/ui/annotations/element/mark.js +11 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +1 -0
- package/dist/types/analytics/events.d.ts +6 -1
- package/dist/types/react/nodes/codeBlock.d.ts +4 -14
- package/dist/types/react/nodes/heading.d.ts +1 -0
- package/dist/types/react/nodes/index.d.ts +1 -13
- package/dist/types/react/nodes/layoutColumn.d.ts +3 -1
- package/dist/types/react/nodes/media.d.ts +3 -1
- package/dist/types/react/utils/inject-props.d.ts +6 -0
- package/dist/types/ui/Expand.d.ts +1 -0
- package/dist/types/ui/Renderer/index.d.ts +5 -3
- package/dist/types/ui/Renderer/style.d.ts +3 -1
- package/dist/types/ui/annotations/draft/component.d.ts +1 -0
- package/dist/types/ui/annotations/element/mark.d.ts +1 -0
- package/package.json +14 -13
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -11,7 +13,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
13
|
|
|
12
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
15
|
|
|
14
|
-
var _react =
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _react2 = require("@emotion/react");
|
|
15
19
|
|
|
16
20
|
var _types = require("../types");
|
|
17
21
|
|
|
@@ -23,20 +27,26 @@ var _position = require("./position");
|
|
|
23
27
|
|
|
24
28
|
var _dom = require("./dom");
|
|
25
29
|
|
|
26
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
27
|
-
|
|
28
30
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
29
31
|
|
|
30
32
|
var _templateObject;
|
|
31
33
|
|
|
32
|
-
var
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
var markStyles = function markStyles(props) {
|
|
39
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n ", ";\n"])), (0, _styles.AnnotationSharedCSSByState)(props).focus);
|
|
40
|
+
};
|
|
33
41
|
|
|
34
42
|
var AnnotationDraft = function AnnotationDraft(_ref) {
|
|
35
43
|
var draftPosition = _ref.draftPosition,
|
|
36
44
|
children = _ref.children;
|
|
37
|
-
return
|
|
45
|
+
return (0, _react2.jsx)("mark", (0, _extends2.default)({
|
|
38
46
|
"data-renderer-mark": true
|
|
39
|
-
}, (0, _dom.dataAttributes)(draftPosition)
|
|
47
|
+
}, (0, _dom.dataAttributes)(draftPosition), {
|
|
48
|
+
css: markStyles
|
|
49
|
+
}), children);
|
|
40
50
|
};
|
|
41
51
|
|
|
42
52
|
exports.AnnotationDraft = AnnotationDraft;
|
|
@@ -66,13 +76,13 @@ var applyAnnotationOnText = function applyAnnotationOnText(_ref2) {
|
|
|
66
76
|
var annotateIndex = getAnnotationIndex(shouldApplyAnnotationAt, texts.length);
|
|
67
77
|
return texts.map(function (value, index) {
|
|
68
78
|
if (annotateIndex === index) {
|
|
69
|
-
return
|
|
79
|
+
return (0, _react2.jsx)(AnnotationDraft, {
|
|
70
80
|
key: index,
|
|
71
81
|
draftPosition: draftPosition
|
|
72
82
|
}, value);
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
return
|
|
85
|
+
return (0, _react2.jsx)(_react.default.Fragment, {
|
|
76
86
|
key: index
|
|
77
87
|
}, value);
|
|
78
88
|
});
|
|
@@ -103,11 +113,11 @@ var TextWithAnnotationDraft = function TextWithAnnotationDraft(_ref3) {
|
|
|
103
113
|
}, [nextDraftPosition, textPosition]);
|
|
104
114
|
|
|
105
115
|
if (shouldApplyAnnotationAt === false || !nextDraftPosition) {
|
|
106
|
-
return
|
|
116
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
if (shouldApplyAnnotationAt === _types.InsertDraftPosition.AROUND_TEXT) {
|
|
110
|
-
return
|
|
120
|
+
return (0, _react2.jsx)(AnnotationDraft, {
|
|
111
121
|
key: 0,
|
|
112
122
|
draftPosition: nextDraftPosition
|
|
113
123
|
}, children);
|
|
@@ -117,7 +127,7 @@ var TextWithAnnotationDraft = function TextWithAnnotationDraft(_ref3) {
|
|
|
117
127
|
var texts = (0, _text.splitText)(children, offsets);
|
|
118
128
|
|
|
119
129
|
if (!texts) {
|
|
120
|
-
return
|
|
130
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
var components = applyAnnotationOnText({
|
|
@@ -125,7 +135,7 @@ var TextWithAnnotationDraft = function TextWithAnnotationDraft(_ref3) {
|
|
|
125
135
|
shouldApplyAnnotationAt: shouldApplyAnnotationAt,
|
|
126
136
|
draftPosition: nextDraftPosition
|
|
127
137
|
});
|
|
128
|
-
return
|
|
138
|
+
return (0, _react2.jsx)(_react.Fragment, null, components);
|
|
129
139
|
};
|
|
130
140
|
|
|
131
141
|
exports.TextWithAnnotationDraft = TextWithAnnotationDraft;
|
|
@@ -19,12 +19,12 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
+
var _react2 = require("@emotion/react");
|
|
23
|
+
|
|
22
24
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
23
25
|
|
|
24
26
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
25
27
|
|
|
26
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
27
|
-
|
|
28
28
|
var _templateObject;
|
|
29
29
|
|
|
30
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -35,7 +35,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
35
35
|
|
|
36
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var markStyles = function markStyles(props) {
|
|
39
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n }\n"])), _adfSchema.AnnotationMarkStates.ACTIVE, (0, _styles.AnnotationSharedCSSByState)(props).blur, (0, _styles.AnnotationSharedCSSByState)(props).focus);
|
|
40
|
+
};
|
|
39
41
|
|
|
40
42
|
var MarkComponent = function MarkComponent(_ref) {
|
|
41
43
|
var annotationParentIds = _ref.annotationParentIds,
|
|
@@ -70,10 +72,12 @@ var MarkComponent = function MarkComponent(_ref) {
|
|
|
70
72
|
} : {
|
|
71
73
|
'aria-details': annotationIds.join(', ')
|
|
72
74
|
};
|
|
73
|
-
return
|
|
75
|
+
return (0, _react2.jsx)("mark", (0, _extends2.default)({
|
|
74
76
|
id: id,
|
|
75
77
|
onClick: onMarkClick
|
|
76
|
-
}, accessibility, overriddenData
|
|
78
|
+
}, accessibility, overriddenData, {
|
|
79
|
+
css: markStyles
|
|
80
|
+
}), children);
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
exports.MarkComponent = MarkComponent;
|
package/dist/cjs/version.json
CHANGED
|
@@ -12,6 +12,7 @@ export let ACTION;
|
|
|
12
12
|
(function (ACTION) {
|
|
13
13
|
ACTION["STARTED"] = "started";
|
|
14
14
|
ACTION["RENDERED"] = "rendered";
|
|
15
|
+
ACTION["RENDERER_TTI"] = "tti";
|
|
15
16
|
ACTION["CRASHED"] = "unhandledErrorCaught";
|
|
16
17
|
ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
|
|
17
18
|
ACTION["SELECT_ALL_CAUGHT"] = "selectAllCaught";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/react';
|
|
2
3
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
4
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
5
5
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { N20, DN50 } from '@atlaskit/theme/colors';
|
|
@@ -10,6 +10,23 @@ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { useFeatureFlags } from '../../use-feature-flags';
|
|
11
11
|
import CopyButton from './codeBlockCopyButton';
|
|
12
12
|
|
|
13
|
+
const codeBlockStyle = props => css`
|
|
14
|
+
tab-size: 4;
|
|
15
|
+
[data-ds--code--code-block] {
|
|
16
|
+
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
17
|
+
line-height: 1.5rem;
|
|
18
|
+
background-image: ${overflowShadow({
|
|
19
|
+
background: themed({
|
|
20
|
+
light: N20,
|
|
21
|
+
dark: DN50
|
|
22
|
+
})(props),
|
|
23
|
+
width: `${gridSize()}px`
|
|
24
|
+
})};
|
|
25
|
+
background-attachment: local, scroll, scroll;
|
|
26
|
+
background-position: 100% 0, 100% 0, 0 0;
|
|
27
|
+
|
|
28
|
+
`;
|
|
29
|
+
|
|
13
30
|
function CodeBlock(props) {
|
|
14
31
|
const {
|
|
15
32
|
text,
|
|
@@ -20,11 +37,12 @@ function CodeBlock(props) {
|
|
|
20
37
|
const featureFlags = useFeatureFlags();
|
|
21
38
|
const codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
22
39
|
const className = ['code-block', props.className].join(' ');
|
|
23
|
-
return
|
|
24
|
-
className: className
|
|
25
|
-
|
|
40
|
+
return jsx("div", {
|
|
41
|
+
className: className,
|
|
42
|
+
css: codeBlockStyle
|
|
43
|
+
}, allowCopyToClipboard ? jsx(CopyButton, {
|
|
26
44
|
content: text
|
|
27
|
-
}) : null,
|
|
45
|
+
}) : null, jsx(AkCodeBlock, {
|
|
28
46
|
language: language,
|
|
29
47
|
text: text,
|
|
30
48
|
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
@@ -33,20 +51,4 @@ function CodeBlock(props) {
|
|
|
33
51
|
}));
|
|
34
52
|
}
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
export default styled(IntlCodeBlock)`
|
|
38
|
-
tab-size: 4;
|
|
39
|
-
[data-ds--code--code-block] {
|
|
40
|
-
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
41
|
-
line-height: 1.5rem;
|
|
42
|
-
background-image: ${overflowShadow({
|
|
43
|
-
background: themed({
|
|
44
|
-
light: N20,
|
|
45
|
-
dark: DN50
|
|
46
|
-
}),
|
|
47
|
-
width: `${gridSize()}px`
|
|
48
|
-
})};
|
|
49
|
-
background-attachment: local, scroll, scroll;
|
|
50
|
-
background-position: 100% 0, 100% 0, 0 0;
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
54
|
+
export default injectIntl(CodeBlock);
|
|
@@ -32,14 +32,16 @@ function Heading(props) {
|
|
|
32
32
|
headingId,
|
|
33
33
|
dataAttributes,
|
|
34
34
|
allowHeadingAnchorLinks,
|
|
35
|
-
marks
|
|
35
|
+
marks,
|
|
36
|
+
invisible
|
|
36
37
|
} = props;
|
|
37
38
|
const HX = `h${props.level}`;
|
|
38
39
|
const showAnchorLink = !!props.showAnchorLink;
|
|
39
40
|
const isRightAligned = hasRightAlignmentMark(marks);
|
|
40
41
|
const enableNestedHeaderLinks = allowHeadingAnchorLinks && allowHeadingAnchorLinks.allowNestedHeaderLinks;
|
|
42
|
+
const headingIdToUse = invisible ? undefined : headingId;
|
|
41
43
|
return /*#__PURE__*/React.createElement(HX, _extends({
|
|
42
|
-
id:
|
|
44
|
+
id: headingIdToUse
|
|
43
45
|
}, dataAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, showAnchorLink && isRightAligned ? WrapChildTextInSpan(props.children) : props.children, showAnchorLink && /*#__PURE__*/React.createElement(CopyTextConsumer, null, ({
|
|
44
46
|
copyTextToClipboard
|
|
45
47
|
}) => {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { WidthProvider, clearNextSiblingMarginTopStyle } from '@atlaskit/editor-common/ui';
|
|
3
5
|
export default function LayoutSection(props) {
|
|
4
|
-
return
|
|
6
|
+
return jsx("div", {
|
|
5
7
|
"data-layout-column": true,
|
|
6
8
|
"data-column-width": props.width,
|
|
7
9
|
style: {
|
|
8
10
|
flexBasis: `${props.width}%`
|
|
9
11
|
}
|
|
10
|
-
},
|
|
12
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
13
|
+
css: clearNextSiblingMarginTopStyle
|
|
14
|
+
}), props.children));
|
|
11
15
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import { PureComponent } from 'react';
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
5
8
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
-
import {
|
|
9
|
+
import { mediaLinkStyle } from '@atlaskit/editor-common/ui';
|
|
7
10
|
import { MediaCard } from '../../ui/MediaCard';
|
|
8
11
|
import { getEventHandler } from '../../utils';
|
|
9
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
|
|
@@ -29,7 +32,7 @@ export default class Media extends PureComponent {
|
|
|
29
32
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
30
33
|
const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
|
|
31
34
|
const shouldOpenMediaViewer = !linkHref && allowMediaViewer;
|
|
32
|
-
const mediaComponent =
|
|
35
|
+
const mediaComponent = jsx(MediaCard, _extends({
|
|
33
36
|
mediaProvider: mediaProvider,
|
|
34
37
|
contextIdentifierProvider: contextIdentifierProvider
|
|
35
38
|
}, this.props, {
|
|
@@ -40,11 +43,12 @@ export default class Media extends PureComponent {
|
|
|
40
43
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
41
44
|
ssr: ssr
|
|
42
45
|
}));
|
|
43
|
-
return linkHref ?
|
|
46
|
+
return linkHref ? jsx("a", {
|
|
44
47
|
href: linkHref,
|
|
45
48
|
rel: "noreferrer noopener",
|
|
46
49
|
onClick: this.handleMediaLinkClick,
|
|
47
|
-
"data-block-link": linkHref
|
|
50
|
+
"data-block-link": linkHref,
|
|
51
|
+
css: mediaLinkStyle
|
|
48
52
|
}, mediaComponent) : mediaComponent;
|
|
49
53
|
});
|
|
50
54
|
|
|
@@ -88,7 +92,7 @@ export default class Media extends PureComponent {
|
|
|
88
92
|
return this.renderCard();
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
return
|
|
95
|
+
return jsx(WithProviders, {
|
|
92
96
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
93
97
|
providerFactory: providers,
|
|
94
98
|
renderNode: this.renderCard
|
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
} = colors;
|
|
9
9
|
import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
10
10
|
import { Table } from './table';
|
|
11
|
+
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
11
12
|
export const tableStickyPadding = 8;
|
|
12
13
|
// creates a new stacking context and places the div in the same
|
|
13
14
|
// position as the table
|
|
@@ -37,9 +38,10 @@ export const FixedTableDiv = styled.div.attrs({
|
|
|
37
38
|
|
|
38
39
|
z-index: ${akEditorStickyHeaderZIndex};
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
// Fix this when move we move this to use emotion
|
|
42
|
+
&&&
|
|
41
43
|
.${TableSharedCssClassName.TABLE_CONTAINER},
|
|
42
|
-
|
|
44
|
+
&&&
|
|
43
45
|
.${TableSharedCssClassName.TABLE_STICKY_WRAPPER}
|
|
44
46
|
> table {
|
|
45
47
|
margin-top: 0;
|
|
@@ -54,9 +56,9 @@ export const FixedTableDiv = styled.div.attrs({
|
|
|
54
56
|
display: none;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
&&&
|
|
58
60
|
.${TableSharedCssClassName.TABLE_CONTAINER}.right-shadow::after,
|
|
59
|
-
|
|
61
|
+
&&&
|
|
60
62
|
.${TableSharedCssClassName.TABLE_CONTAINER}.left-shadow::before {
|
|
61
63
|
top: 0px;
|
|
62
64
|
height: 100%;
|
|
@@ -104,7 +106,16 @@ export const StickyTable = ({
|
|
|
104
106
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
105
107
|
renderWidth: renderWidth,
|
|
106
108
|
allowDynamicTextSizing: allowDynamicTextSizing
|
|
107
|
-
},
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
112
|
+
* We pass prop 'invisible' to our table's children nodes meaning
|
|
113
|
+
* they exist inside of the 'invisible' duplicated table component that
|
|
114
|
+
* enables sticky headers.
|
|
115
|
+
*/
|
|
116
|
+
recursivelyInjectProps(children, {
|
|
117
|
+
invisible: true
|
|
118
|
+
}))))));
|
|
108
119
|
};
|
|
109
120
|
export class OverflowParent {
|
|
110
121
|
constructor(ref) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to recursively injects props to
|
|
4
|
+
* all valid children react nodes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export function recursivelyInjectProps(children, propsToInject) {
|
|
8
|
+
return React.Children.toArray(children).map(child => {
|
|
9
|
+
// Cannot add a prop to an invalid element, so just return the child
|
|
10
|
+
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
11
|
+
return child;
|
|
12
|
+
} // Recursive call if child has nested children
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if (child.props.children) {
|
|
16
|
+
child = /*#__PURE__*/React.cloneElement(child, {
|
|
17
|
+
children: recursivelyInjectProps(child.props.children, propsToInject)
|
|
18
|
+
});
|
|
19
|
+
} // Add props to react child node
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.cloneElement(child, propsToInject);
|
|
23
|
+
});
|
|
24
|
+
}
|
package/dist/es2019/ui/Expand.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import React, { forwardRef, useRef, useCallback } from 'react';
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
3
6
|
import styled from 'styled-components';
|
|
4
7
|
import { gridSize, fontSize } from '@atlaskit/theme/constants';
|
|
5
8
|
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
6
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper,
|
|
10
|
+
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, ExpandLayoutWrapper, clearNextSiblingMarginTopStyle } from '@atlaskit/editor-common/ui';
|
|
8
11
|
import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
9
12
|
import { PLATFORM, MODE } from '../analytics/events';
|
|
10
13
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
|
|
@@ -42,7 +45,7 @@ const ContentContainer = styled.div`
|
|
|
42
45
|
`;
|
|
43
46
|
const ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef(function WithRef(props, ref) {
|
|
44
47
|
// @ts-ignore: incorrect innerRef typing
|
|
45
|
-
return
|
|
48
|
+
return jsx(ExpandLayoutWrapper, _extends({}, props, {
|
|
46
49
|
innerRef: ref
|
|
47
50
|
}));
|
|
48
51
|
});
|
|
@@ -80,16 +83,16 @@ function Expand({
|
|
|
80
83
|
} = useRef(_uniqueId('expand-title-'));
|
|
81
84
|
const handleFocus = useCallback(() => setFocused(true), []);
|
|
82
85
|
const handleBlur = useCallback(() => setFocused(false), []);
|
|
83
|
-
return
|
|
86
|
+
return jsx(Container, {
|
|
84
87
|
"data-node-type": nodeType,
|
|
85
88
|
"data-title": title,
|
|
86
89
|
"data-expanded": expanded,
|
|
87
90
|
expanded: expanded,
|
|
88
91
|
focused: focused
|
|
89
|
-
}, nestedHeaderIds && nestedHeaderIds.length > 0 ?
|
|
92
|
+
}, nestedHeaderIds && nestedHeaderIds.length > 0 ? jsx(ActiveHeaderIdConsumer, {
|
|
90
93
|
nestedHeaderIds: nestedHeaderIds,
|
|
91
94
|
onNestedHeaderIdMatch: () => setExpanded(true)
|
|
92
|
-
}) : null,
|
|
95
|
+
}) : null, jsx(TitleContainer, {
|
|
93
96
|
onClick: e => {
|
|
94
97
|
e.stopPropagation();
|
|
95
98
|
fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
|
|
@@ -104,21 +107,23 @@ function Expand({
|
|
|
104
107
|
"aria-expanded": expanded,
|
|
105
108
|
contentEditable: false,
|
|
106
109
|
expanded: expanded
|
|
107
|
-
},
|
|
110
|
+
}, jsx(Tooltip, {
|
|
108
111
|
content: label,
|
|
109
112
|
position: "top",
|
|
110
113
|
tag: ExpandLayoutWrapperWithRef
|
|
111
|
-
},
|
|
114
|
+
}, jsx(ExpandIconWrapper, {
|
|
112
115
|
expanded: expanded
|
|
113
|
-
},
|
|
116
|
+
}, jsx(ChevronRightIcon, {
|
|
114
117
|
label: label
|
|
115
|
-
}))),
|
|
118
|
+
}))), jsx(Title, {
|
|
116
119
|
id: id
|
|
117
|
-
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))),
|
|
120
|
+
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))), jsx(ContentContainer, {
|
|
118
121
|
expanded: expanded
|
|
119
|
-
},
|
|
122
|
+
}, jsx("div", {
|
|
120
123
|
className: `${nodeType}-content-wrapper`
|
|
121
|
-
},
|
|
124
|
+
}, jsx(WidthProvider, null, jsx("div", {
|
|
125
|
+
css: clearNextSiblingMarginTopStyle
|
|
126
|
+
}), children))));
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
export default injectIntl(Expand);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React, { useContext, useLayoutEffect, useRef } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
4
7
|
import { PureComponent } from 'react';
|
|
5
8
|
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema';
|
|
6
9
|
import { reduce } from '@atlaskit/adf-utils';
|
|
7
10
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
8
11
|
import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, LegacyToNextIntlProvider, IntlLegacyFallbackProvider, IntlNextErrorBoundary } from '@atlaskit/editor-common/ui';
|
|
9
|
-
import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
12
|
+
import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI } from '@atlaskit/editor-common/utils';
|
|
10
13
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
11
14
|
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
12
15
|
import { IframeWidthObserverFallbackWrapper, IframeWrapperConsumer } from '@atlaskit/width-detector';
|
|
@@ -14,7 +17,7 @@ import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
|
14
17
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
15
18
|
import uuid from 'uuid/v4';
|
|
16
19
|
import { ReactSerializer, renderDocument } from '../../';
|
|
17
|
-
import {
|
|
20
|
+
import { DeprecatedWrapper, rendererStyles } from './style';
|
|
18
21
|
import { TruncatedWrapper } from './truncated-wrapper';
|
|
19
22
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
20
23
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
@@ -80,6 +83,22 @@ export class Renderer extends PureComponent {
|
|
|
80
83
|
this.editorRef = props.innerRef || /*#__PURE__*/React.createRef();
|
|
81
84
|
this.id = uuid();
|
|
82
85
|
startMeasure(`Renderer Render Time: ${this.id}`);
|
|
86
|
+
const _featureFlags = this.featureFlags(this.props.featureFlags).featureFlags;
|
|
87
|
+
|
|
88
|
+
if (_featureFlags !== null && _featureFlags !== void 0 && _featureFlags.rendererTtiTracking) {
|
|
89
|
+
measureTTI((tti, ttiFromInvocation, canceled) => {
|
|
90
|
+
this.fireAnalyticsEvent({
|
|
91
|
+
action: ACTION.RENDERER_TTI,
|
|
92
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
93
|
+
attributes: {
|
|
94
|
+
tti,
|
|
95
|
+
ttiFromInvocation,
|
|
96
|
+
canceled
|
|
97
|
+
},
|
|
98
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
83
102
|
}
|
|
84
103
|
|
|
85
104
|
anchorLinkAnalytics() {
|
|
@@ -268,15 +287,15 @@ export class Renderer extends PureComponent {
|
|
|
268
287
|
onComplete(stat);
|
|
269
288
|
}
|
|
270
289
|
|
|
271
|
-
const rendererOutput =
|
|
290
|
+
const rendererOutput = jsx(RendererContextProvider, {
|
|
272
291
|
value: this.featureFlags(this.props.featureFlags)
|
|
273
|
-
},
|
|
292
|
+
}, jsx(CopyTextProvider, null, jsx(ActiveHeaderIdProvider, {
|
|
274
293
|
value: getActiveHeadingId(allowHeadingAnchorLinks)
|
|
275
|
-
},
|
|
294
|
+
}, jsx(LegacyToNextIntlProvider, null, jsx(IntlLegacyFallbackProvider, null, jsx(AnalyticsContext.Provider, {
|
|
276
295
|
value: {
|
|
277
296
|
fireAnalyticsEvent: event => this.fireAnalyticsEvent(event)
|
|
278
297
|
}
|
|
279
|
-
},
|
|
298
|
+
}, jsx(SmartCardStorageProvider, null, jsx(RendererWrapper, {
|
|
280
299
|
appearance: appearance,
|
|
281
300
|
dynamicTextSizing: !!allowDynamicTextSizing,
|
|
282
301
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
@@ -287,14 +306,14 @@ export class Renderer extends PureComponent {
|
|
|
287
306
|
innerRef: this.editorRef,
|
|
288
307
|
onClick: handleWrapperOnClick,
|
|
289
308
|
onMouseDown: this.onMouseDownEditView
|
|
290
|
-
}, enableSsrInlineScripts ?
|
|
309
|
+
}, enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, {
|
|
291
310
|
allowDynamicTextSizing: !!allowDynamicTextSizing
|
|
292
|
-
}) : null,
|
|
311
|
+
}) : null, jsx(RendererActionsInternalUpdater, {
|
|
293
312
|
doc: pmDoc,
|
|
294
313
|
schema: schema,
|
|
295
314
|
onAnalyticsEvent: this.fireAnalyticsEvent
|
|
296
315
|
}, result)))))))));
|
|
297
|
-
return truncated ?
|
|
316
|
+
return truncated ? jsx(TruncatedWrapper, {
|
|
298
317
|
height: maxHeight,
|
|
299
318
|
fadeHeight: fadeOutHeight
|
|
300
319
|
}, rendererOutput) : rendererOutput;
|
|
@@ -303,7 +322,7 @@ export class Renderer extends PureComponent {
|
|
|
303
322
|
onError(e);
|
|
304
323
|
}
|
|
305
324
|
|
|
306
|
-
return
|
|
325
|
+
return jsx(RendererWrapper, {
|
|
307
326
|
appearance: appearance,
|
|
308
327
|
dynamicTextSizing: !!allowDynamicTextSizing,
|
|
309
328
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
@@ -311,7 +330,7 @@ export class Renderer extends PureComponent {
|
|
|
311
330
|
allowColumnSorting: allowColumnSorting,
|
|
312
331
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
313
332
|
onClick: handleWrapperOnClick
|
|
314
|
-
},
|
|
333
|
+
}, jsx(UnsupportedBlock, null));
|
|
315
334
|
}
|
|
316
335
|
}
|
|
317
336
|
|
|
@@ -332,7 +351,7 @@ export class Renderer extends PureComponent {
|
|
|
332
351
|
}
|
|
333
352
|
|
|
334
353
|
}
|
|
335
|
-
const RendererWithAnalytics = /*#__PURE__*/React.memo(props =>
|
|
354
|
+
const RendererWithAnalytics = /*#__PURE__*/React.memo(props => jsx(FabricEditorAnalyticsContext, {
|
|
336
355
|
data: {
|
|
337
356
|
appearance: getAnalyticsAppearance(props.appearance),
|
|
338
357
|
packageName: name,
|
|
@@ -340,15 +359,15 @@ const RendererWithAnalytics = /*#__PURE__*/React.memo(props => /*#__PURE__*/Reac
|
|
|
340
359
|
componentName: 'renderer',
|
|
341
360
|
editorSessionId: uuid()
|
|
342
361
|
}
|
|
343
|
-
},
|
|
362
|
+
}, jsx(WithCreateAnalyticsEvent, {
|
|
344
363
|
render: createAnalyticsEvent => {
|
|
345
364
|
// `IntlNextErrorBoundary` only captures Internationalisation errors, leaving others for `ErrorBoundary`.
|
|
346
|
-
return
|
|
365
|
+
return jsx(ErrorBoundary, {
|
|
347
366
|
component: ACTION_SUBJECT.RENDERER,
|
|
348
367
|
rethrowError: true,
|
|
349
368
|
fallbackComponent: null,
|
|
350
369
|
createAnalyticsEvent: createAnalyticsEvent
|
|
351
|
-
},
|
|
370
|
+
}, jsx(IntlNextErrorBoundary, null, jsx(Renderer, _extends({}, props, {
|
|
352
371
|
createAnalyticsEvent: createAnalyticsEvent
|
|
353
372
|
}))));
|
|
354
373
|
}
|
|
@@ -365,22 +384,23 @@ const RendererWithIframeFallbackWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
365
384
|
onClick,
|
|
366
385
|
onMouseDown
|
|
367
386
|
} = props;
|
|
368
|
-
const renderer =
|
|
387
|
+
const renderer = jsx(WidthProvider, {
|
|
369
388
|
className: "ak-renderer-wrapper"
|
|
370
|
-
},
|
|
389
|
+
}, jsx(BaseTheme, {
|
|
371
390
|
dynamicTextSizing: dynamicTextSizing,
|
|
372
391
|
baseFontSize: !dynamicTextSizing && appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
373
|
-
},
|
|
392
|
+
}, jsx(DeprecatedWrapper, {
|
|
374
393
|
innerRef: innerRef,
|
|
375
394
|
appearance: appearance,
|
|
376
395
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
377
396
|
allowColumnSorting: !!allowColumnSorting,
|
|
378
397
|
onClick: onClick,
|
|
379
|
-
onMouseDown: onMouseDown
|
|
398
|
+
onMouseDown: onMouseDown,
|
|
399
|
+
css: rendererStyles
|
|
380
400
|
}, children)));
|
|
381
401
|
|
|
382
402
|
if (!subscribe) {
|
|
383
|
-
return
|
|
403
|
+
return jsx(IframeWidthObserverFallbackWrapper, null, renderer);
|
|
384
404
|
}
|
|
385
405
|
|
|
386
406
|
return renderer;
|
|
@@ -394,9 +414,9 @@ const RendererWithIframeFallbackWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
394
414
|
*/
|
|
395
415
|
|
|
396
416
|
export function RendererWrapper(props) {
|
|
397
|
-
return
|
|
417
|
+
return jsx(IframeWrapperConsumer, null, ({
|
|
398
418
|
subscribe
|
|
399
|
-
}) =>
|
|
419
|
+
}) => jsx(RendererWithIframeFallbackWrapper, _extends({}, props, {
|
|
400
420
|
subscribe: subscribe
|
|
401
421
|
})));
|
|
402
422
|
}
|
|
@@ -430,16 +450,16 @@ const RendererWithAnnotationSelection = props => {
|
|
|
430
450
|
const innerRef = props.innerRef || localRef;
|
|
431
451
|
|
|
432
452
|
if (!allowAnnotations) {
|
|
433
|
-
return
|
|
453
|
+
return jsx(RendererWithAnalytics, _extends({
|
|
434
454
|
innerRef: innerRef
|
|
435
455
|
}, props));
|
|
436
456
|
}
|
|
437
457
|
|
|
438
|
-
return
|
|
458
|
+
return jsx(RendererActionsContext, null, jsx(AnnotationsWrapper, {
|
|
439
459
|
rendererRef: innerRef,
|
|
440
460
|
adfDocument: adfDocument,
|
|
441
461
|
annotationProvider: props.annotationProvider
|
|
442
|
-
},
|
|
462
|
+
}, jsx(RendererWithAnalytics, _extends({
|
|
443
463
|
innerRef: innerRef
|
|
444
464
|
}, props))));
|
|
445
465
|
};
|