@atlaskit/renderer 109.1.0 → 109.1.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 +6 -0
- package/dist/cjs/react/nodes/multiBodiedExtension.js +43 -28
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/multiBodiedExtension.js +16 -3
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/multiBodiedExtension.js +44 -29
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#62765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62765) [`ec6a2bbae20e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ec6a2bbae20e) - ED-21606: Width options support for MBE renderer and adding back edit option on toolbar
|
|
8
|
+
|
|
3
9
|
## 109.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -14,7 +14,11 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
14
14
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _extension = require("./extension");
|
|
16
16
|
var _ExtensionRenderer = _interopRequireDefault(require("../../ui/ExtensionRenderer"));
|
|
17
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
|
+
var _consts = require("../../consts");
|
|
19
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
20
|
var _templateObject, _templateObject2;
|
|
21
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
18
22
|
/** @jsx jsx */
|
|
19
23
|
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); }
|
|
20
24
|
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; }
|
|
@@ -69,40 +73,51 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
69
73
|
updateActiveChild: updateActiveChild,
|
|
70
74
|
children: children
|
|
71
75
|
});
|
|
72
|
-
var containerCSS = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n
|
|
76
|
+
var containerCSS = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\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(_colors.N50, ")"));
|
|
77
|
+
var isTopLevel = path.length < 1;
|
|
78
|
+
var centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
73
79
|
return (0, _react.jsx)("section", {
|
|
74
80
|
className: "multiBodiedExtension--container",
|
|
75
81
|
css: containerCSS,
|
|
76
82
|
"data-testid": "multiBodiedExtension--container",
|
|
77
83
|
"data-active-child-index": activeChildIndex
|
|
78
|
-
}, (0, _react.jsx)(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
}, (0, _react.jsx)(_ui.WidthConsumer, null, function (_ref2) {
|
|
85
|
+
var width = _ref2.width;
|
|
86
|
+
return (0, _react.jsx)("div", {
|
|
87
|
+
className: "".concat(_consts.RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
88
|
+
style: {
|
|
89
|
+
width: isTopLevel ? (0, _utils.calcBreakoutWidth)(layout, width) : '100%'
|
|
90
|
+
},
|
|
91
|
+
"data-layout": layout
|
|
92
|
+
}, (0, _react.jsx)("nav", {
|
|
93
|
+
className: "multiBodiedExtension-navigation",
|
|
94
|
+
css: navigationCSS,
|
|
95
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
96
|
+
}, (0, _react.jsx)(_ExtensionRenderer.default, (0, _extends2.default)({}, props, {
|
|
97
|
+
actions: actions,
|
|
98
|
+
type: "multiBodiedExtension"
|
|
99
|
+
}), function (_ref3) {
|
|
100
|
+
var result = _ref3.result;
|
|
101
|
+
try {
|
|
102
|
+
if (result && /*#__PURE__*/_react2.default.isValidElement(result)) {
|
|
103
|
+
// Return the content directly if it's a valid JSX.Element
|
|
104
|
+
return (0, _extension.renderExtension)(result, layout, {
|
|
105
|
+
isTopLevel: path.length < 1
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
} catch (e) {
|
|
109
|
+
/** We don't want this error to block renderer */
|
|
110
|
+
/** We keep rendering the default content */
|
|
93
111
|
}
|
|
94
|
-
} catch (e) {
|
|
95
|
-
/** We don't want this error to block renderer */
|
|
96
|
-
/** We keep rendering the default content */
|
|
97
|
-
}
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
// Always return default content if anything goes wrong
|
|
114
|
+
return (0, _extension.renderExtension)(children, layout, {
|
|
115
|
+
isTopLevel: path.length < 1
|
|
116
|
+
});
|
|
117
|
+
})), (0, _react.jsx)("article", {
|
|
118
|
+
className: "multiBodiedExtension--frames",
|
|
119
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
120
|
+
}, children));
|
|
121
|
+
}));
|
|
107
122
|
};
|
|
108
123
|
var _default = exports.default = MultiBodiedExtension;
|
|
@@ -54,7 +54,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
54
54
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
55
55
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
56
56
|
var packageName = "@atlaskit/renderer";
|
|
57
|
-
var packageVersion = "109.1.
|
|
57
|
+
var packageVersion = "109.1.1";
|
|
58
58
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
59
59
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
60
60
|
var _super = _createSuper(Renderer);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
|
|
4
5
|
import { jsx, css } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
+
import { N40, N50 } from '@atlaskit/theme/colors';
|
|
6
7
|
import React, { useState } from 'react';
|
|
7
8
|
import { renderExtension } from './extension';
|
|
8
9
|
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
10
|
+
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
11
|
+
import { RendererCssClassName } from '../../consts';
|
|
12
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
9
13
|
const useMultiBodiedExtensionActions = ({
|
|
10
14
|
updateActiveChild,
|
|
11
15
|
children
|
|
@@ -68,7 +72,6 @@ const MultiBodiedExtension = props => {
|
|
|
68
72
|
children
|
|
69
73
|
});
|
|
70
74
|
const containerCSS = css`
|
|
71
|
-
border: 1px solid ${`var(--ds-border, ${N30})`};
|
|
72
75
|
min-height: 100px;
|
|
73
76
|
|
|
74
77
|
.multiBodiedExtension--frames > [data-extension-frame='true'] {
|
|
@@ -82,11 +85,21 @@ const MultiBodiedExtension = props => {
|
|
|
82
85
|
min-height: 100px;
|
|
83
86
|
}
|
|
84
87
|
`;
|
|
88
|
+
const isTopLevel = path.length < 1;
|
|
89
|
+
const centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
85
90
|
return jsx("section", {
|
|
86
91
|
className: "multiBodiedExtension--container",
|
|
87
92
|
css: containerCSS,
|
|
88
93
|
"data-testid": "multiBodiedExtension--container",
|
|
89
94
|
"data-active-child-index": activeChildIndex
|
|
95
|
+
}, jsx(WidthConsumer, null, ({
|
|
96
|
+
width
|
|
97
|
+
}) => jsx("div", {
|
|
98
|
+
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass}`,
|
|
99
|
+
style: {
|
|
100
|
+
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
101
|
+
},
|
|
102
|
+
"data-layout": layout
|
|
90
103
|
}, jsx("nav", {
|
|
91
104
|
className: "multiBodiedExtension-navigation",
|
|
92
105
|
css: navigationCSS,
|
|
@@ -116,6 +129,6 @@ const MultiBodiedExtension = props => {
|
|
|
116
129
|
})), jsx("article", {
|
|
117
130
|
className: "multiBodiedExtension--frames",
|
|
118
131
|
"data-testid": "multiBodiedExtension--frames"
|
|
119
|
-
}, children));
|
|
132
|
+
}, children))));
|
|
120
133
|
};
|
|
121
134
|
export default MultiBodiedExtension;
|
|
@@ -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.1.
|
|
38
|
+
const packageVersion = "109.1.1";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|
|
@@ -2,13 +2,17 @@ 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/ensure-design-token-usage/preview */
|
|
5
6
|
/** @jsx jsx */
|
|
6
7
|
|
|
7
8
|
import { jsx, css } from '@emotion/react';
|
|
8
|
-
import {
|
|
9
|
+
import { N40, N50 } from '@atlaskit/theme/colors';
|
|
9
10
|
import React, { useState } from 'react';
|
|
10
11
|
import { renderExtension } from './extension';
|
|
11
12
|
import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
13
|
+
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
14
|
+
import { RendererCssClassName } from '../../consts';
|
|
15
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
12
16
|
var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_ref) {
|
|
13
17
|
var updateActiveChild = _ref.updateActiveChild,
|
|
14
18
|
children = _ref.children;
|
|
@@ -60,40 +64,51 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
60
64
|
updateActiveChild: updateActiveChild,
|
|
61
65
|
children: children
|
|
62
66
|
});
|
|
63
|
-
var containerCSS = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
67
|
+
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
|
+
var isTopLevel = path.length < 1;
|
|
69
|
+
var centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
64
70
|
return jsx("section", {
|
|
65
71
|
className: "multiBodiedExtension--container",
|
|
66
72
|
css: containerCSS,
|
|
67
73
|
"data-testid": "multiBodiedExtension--container",
|
|
68
74
|
"data-active-child-index": activeChildIndex
|
|
69
|
-
}, jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
}, jsx(WidthConsumer, null, function (_ref2) {
|
|
76
|
+
var width = _ref2.width;
|
|
77
|
+
return jsx("div", {
|
|
78
|
+
className: "".concat(RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
79
|
+
style: {
|
|
80
|
+
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
81
|
+
},
|
|
82
|
+
"data-layout": layout
|
|
83
|
+
}, jsx("nav", {
|
|
84
|
+
className: "multiBodiedExtension-navigation",
|
|
85
|
+
css: navigationCSS,
|
|
86
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
87
|
+
}, jsx(ExtensionRenderer, _extends({}, props, {
|
|
88
|
+
actions: actions,
|
|
89
|
+
type: "multiBodiedExtension"
|
|
90
|
+
}), function (_ref3) {
|
|
91
|
+
var result = _ref3.result;
|
|
92
|
+
try {
|
|
93
|
+
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
94
|
+
// Return the content directly if it's a valid JSX.Element
|
|
95
|
+
return renderExtension(result, layout, {
|
|
96
|
+
isTopLevel: path.length < 1
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
/** We don't want this error to block renderer */
|
|
101
|
+
/** We keep rendering the default content */
|
|
84
102
|
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
/** We don't want this error to block renderer */
|
|
87
|
-
/** We keep rendering the default content */
|
|
88
|
-
}
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
// Always return default content if anything goes wrong
|
|
105
|
+
return renderExtension(children, layout, {
|
|
106
|
+
isTopLevel: path.length < 1
|
|
107
|
+
});
|
|
108
|
+
})), jsx("article", {
|
|
109
|
+
className: "multiBodiedExtension--frames",
|
|
110
|
+
"data-testid": "multiBodiedExtension--frames"
|
|
111
|
+
}, children));
|
|
112
|
+
}));
|
|
98
113
|
};
|
|
99
114
|
export default MultiBodiedExtension;
|
|
@@ -45,7 +45,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
45
45
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
var packageName = "@atlaskit/renderer";
|
|
48
|
-
var packageVersion = "109.1.
|
|
48
|
+
var packageVersion = "109.1.1";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|