@atlaskit/renderer 109.0.5 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
9
+ ## 109.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#61685](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61685) [`ac1ec9ea4cd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ac1ec9ea4cd3) - [ux] Add border mark support to mediaInline in Editor/Renderer
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 109.0.5
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Border;
7
+ var _react = require("@emotion/react");
8
+ var _editorPalette = require("@atlaskit/editor-palette");
9
+ /** @jsx jsx */
10
+
11
+ function Border(props) {
12
+ var _props$color, _props$size;
13
+ var borderColor = (_props$color = props.color) !== null && _props$color !== void 0 ? _props$color : '';
14
+ var borderSize = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 0;
15
+ var paletteColorValue = (0, _editorPalette.hexToEditorBorderPaletteColor)(borderColor) || borderColor;
16
+ return (0, _react.jsx)("span", {
17
+ "data-color": paletteColorValue,
18
+ "data-size": borderSize,
19
+ "data-mark-type": "border"
20
+ }, props.children);
21
+ }
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "Annotation", {
11
11
  return _annotation.default;
12
12
  }
13
13
  });
14
+ Object.defineProperty(exports, "Border", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _border.default;
18
+ }
19
+ });
14
20
  Object.defineProperty(exports, "Breakout", {
15
21
  enumerable: true,
16
22
  get: function get() {
@@ -112,6 +118,7 @@ var _unsupportedNodeAttribute = _interopRequireDefault(require("./unsupportedNod
112
118
  var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
113
119
  var _fragment = _interopRequireDefault(require("./fragment"));
114
120
  var _annotation = _interopRequireWildcard(require("./annotation"));
121
+ var _border = _interopRequireDefault(require("./border"));
115
122
  var _confluenceInlineComment = _interopRequireDefault(require("./confluence-inline-comment"));
116
123
  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); }
117
124
  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; }
@@ -127,6 +134,7 @@ var markToReact = exports.markToReact = {
127
134
  textColor: _textColor.default,
128
135
  underline: _underline.default,
129
136
  annotation: _annotation.default,
137
+ border: _border.default,
130
138
  // Stage0
131
139
  confluenceInlineComment: _confluenceInlineComment.default,
132
140
  breakout: _breakout.default,
@@ -34,7 +34,9 @@ var RenderMediaInline = exports.RenderMediaInline = function RenderMediaInline(_
34
34
  alt = _ref.alt,
35
35
  width = _ref.width,
36
36
  height = _ref.height,
37
- type = _ref.type;
37
+ type = _ref.type,
38
+ borderSize = _ref.borderSize,
39
+ borderColor = _ref.borderColor;
38
40
  var _useState = (0, _react.useState)(),
39
41
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
40
42
  contextIdentifierProvider = _useState2[0],
@@ -139,7 +141,11 @@ var RenderMediaInline = exports.RenderMediaInline = function RenderMediaInline(_
139
141
  identifier: identifier,
140
142
  alt: alt,
141
143
  width: width,
142
- height: height
144
+ height: height,
145
+ border: {
146
+ borderSize: borderSize,
147
+ borderColor: borderColor
148
+ }
143
149
  });
144
150
  }
145
151
  var handleMediaInlineClick = function handleMediaInlineClick(result) {
@@ -175,6 +181,7 @@ var RenderMediaInline = exports.RenderMediaInline = function RenderMediaInline(_
175
181
  }));
176
182
  };
177
183
  var MediaInline = function MediaInline(props) {
184
+ var _borderMark$attrs$col, _borderMark$attrs$siz;
178
185
  var collection = props.collection,
179
186
  id = props.id,
180
187
  providerFactory = props.providers,
@@ -184,7 +191,8 @@ var MediaInline = function MediaInline(props) {
184
191
  fileType = props.type,
185
192
  alt = props.alt,
186
193
  width = props.width,
187
- height = props.height;
194
+ height = props.height,
195
+ marks = props.marks;
188
196
  var clipboardAttrs = {
189
197
  id: id,
190
198
  collection: collection
@@ -194,6 +202,11 @@ var MediaInline = function MediaInline(props) {
194
202
  mediaItemType: 'file',
195
203
  collectionName: collection
196
204
  };
205
+ var borderMark = marks === null || marks === void 0 ? void 0 : marks.find(function (mark) {
206
+ return (mark === null || mark === void 0 ? void 0 : mark.type.name) === 'border';
207
+ });
208
+ var borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
209
+ 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;
197
210
  return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
198
211
  providers: ['mediaProvider', 'contextIdentifierProvider'],
199
212
  providerFactory: providerFactory,
@@ -210,7 +223,9 @@ var MediaInline = function MediaInline(props) {
210
223
  type: fileType,
211
224
  alt: alt,
212
225
  width: width,
213
- height: height
226
+ height: height,
227
+ borderSize: borderSize,
228
+ borderColor: borderColor
214
229
  });
215
230
  }
216
231
  });
@@ -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 border: 1px solid ", ";\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 "])), "var(--ds-border, ".concat(_colors.N30, ")"), activeChildIndex + 1, "var(--ds-border, ".concat(_colors.N50, ")"));
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)("nav", {
79
- className: "multiBodiedExtension-navigation",
80
- css: navigationCSS,
81
- "data-testid": "multiBodiedExtension-navigation"
82
- }, (0, _react.jsx)(_ExtensionRenderer.default, (0, _extends2.default)({}, props, {
83
- actions: actions,
84
- type: "multiBodiedExtension"
85
- }), function (_ref2) {
86
- var result = _ref2.result;
87
- try {
88
- if (result && /*#__PURE__*/_react2.default.isValidElement(result)) {
89
- // Return the content directly if it's a valid JSX.Element
90
- return (0, _extension.renderExtension)(result, layout, {
91
- isTopLevel: path.length < 1
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
- // Always return default content if anything goes wrong
100
- return (0, _extension.renderExtension)(children, layout, {
101
- isTopLevel: path.length < 1
102
- });
103
- })), (0, _react.jsx)("article", {
104
- className: "multiBodiedExtension--frames",
105
- "data-testid": "multiBodiedExtension--frames"
106
- }, children));
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.0.5";
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);
@@ -0,0 +1,14 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
4
+ export default function Border(props) {
5
+ var _props$color, _props$size;
6
+ const borderColor = (_props$color = props.color) !== null && _props$color !== void 0 ? _props$color : '';
7
+ const borderSize = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 0;
8
+ const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
9
+ return jsx("span", {
10
+ "data-color": paletteColorValue,
11
+ "data-size": borderSize,
12
+ "data-mark-type": "border"
13
+ }, props.children);
14
+ }
@@ -14,6 +14,7 @@ import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
14
14
  import DataConsumer from './data-consumer';
15
15
  import FragmentMark from './fragment';
16
16
  import Annotation, { isAnnotationMark } from './annotation';
17
+ import Border from './border';
17
18
 
18
19
  // Stage0
19
20
  import ConfluenceInlineComment from './confluence-inline-comment';
@@ -27,6 +28,7 @@ export const markToReact = {
27
28
  textColor: TextColor,
28
29
  underline: Underline,
29
30
  annotation: Annotation,
31
+ border: Border,
30
32
  // Stage0
31
33
  confluenceInlineComment: ConfluenceInlineComment,
32
34
  breakout: Breakout,
@@ -40,4 +42,4 @@ export const markToReact = {
40
42
  export const toReact = mark => {
41
43
  return markToReact[mark.type.name];
42
44
  };
43
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
45
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
@@ -18,7 +18,9 @@ export const RenderMediaInline = ({
18
18
  alt,
19
19
  width,
20
20
  height,
21
- type
21
+ type,
22
+ borderSize,
23
+ borderColor
22
24
  }) => {
23
25
  const [contextIdentifierProvider, setContextIdentifierProvider] = useState();
24
26
  const [fileState, setFileState] = useState();
@@ -84,7 +86,11 @@ export const RenderMediaInline = ({
84
86
  identifier: identifier,
85
87
  alt: alt,
86
88
  width: width,
87
- height: height
89
+ height: height,
90
+ border: {
91
+ borderSize,
92
+ borderColor
93
+ }
88
94
  });
89
95
  }
90
96
  const handleMediaInlineClick = result => {
@@ -124,6 +130,7 @@ export const RenderMediaInline = ({
124
130
  }));
125
131
  };
126
132
  const MediaInline = props => {
133
+ var _borderMark$attrs$col, _borderMark$attrs$siz;
127
134
  const {
128
135
  collection,
129
136
  id,
@@ -134,7 +141,8 @@ const MediaInline = props => {
134
141
  type: fileType,
135
142
  alt,
136
143
  width,
137
- height
144
+ height,
145
+ marks
138
146
  } = props;
139
147
  const clipboardAttrs = {
140
148
  id,
@@ -145,6 +153,9 @@ const MediaInline = props => {
145
153
  mediaItemType: 'file',
146
154
  collectionName: collection
147
155
  };
156
+ const borderMark = marks === null || marks === void 0 ? void 0 : marks.find(mark => (mark === null || mark === void 0 ? void 0 : mark.type.name) === 'border');
157
+ const borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
158
+ const borderSize = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
148
159
  return /*#__PURE__*/React.createElement(WithProviders, {
149
160
  providers: ['mediaProvider', 'contextIdentifierProvider'],
150
161
  providerFactory: providerFactory,
@@ -161,7 +172,9 @@ const MediaInline = props => {
161
172
  type: fileType,
162
173
  alt: alt,
163
174
  width: width,
164
- height: height
175
+ height: height,
176
+ borderSize: borderSize,
177
+ borderColor: borderColor
165
178
  });
166
179
  }
167
180
  });
@@ -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 { N30, N40, N50 } from '@atlaskit/theme/colors';
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.0.5";
38
+ const packageVersion = "109.1.1";
39
39
  export class Renderer extends PureComponent {
40
40
  constructor(props) {
41
41
  super(props);
@@ -0,0 +1,14 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
4
+ export default function Border(props) {
5
+ var _props$color, _props$size;
6
+ var borderColor = (_props$color = props.color) !== null && _props$color !== void 0 ? _props$color : '';
7
+ var borderSize = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 0;
8
+ var paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
9
+ return jsx("span", {
10
+ "data-color": paletteColorValue,
11
+ "data-size": borderSize,
12
+ "data-mark-type": "border"
13
+ }, props.children);
14
+ }
@@ -14,6 +14,7 @@ import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
14
14
  import DataConsumer from './data-consumer';
15
15
  import FragmentMark from './fragment';
16
16
  import Annotation, { isAnnotationMark } from './annotation';
17
+ import Border from './border';
17
18
 
18
19
  // Stage0
19
20
  import ConfluenceInlineComment from './confluence-inline-comment';
@@ -27,6 +28,7 @@ export var markToReact = {
27
28
  textColor: TextColor,
28
29
  underline: Underline,
29
30
  annotation: Annotation,
31
+ border: Border,
30
32
  // Stage0
31
33
  confluenceInlineComment: ConfluenceInlineComment,
32
34
  breakout: Breakout,
@@ -40,4 +42,4 @@ export var markToReact = {
40
42
  export var toReact = function toReact(mark) {
41
43
  return markToReact[mark.type.name];
42
44
  };
43
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
45
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
@@ -24,7 +24,9 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
24
24
  alt = _ref.alt,
25
25
  width = _ref.width,
26
26
  height = _ref.height,
27
- type = _ref.type;
27
+ type = _ref.type,
28
+ borderSize = _ref.borderSize,
29
+ borderColor = _ref.borderColor;
28
30
  var _useState = useState(),
29
31
  _useState2 = _slicedToArray(_useState, 2),
30
32
  contextIdentifierProvider = _useState2[0],
@@ -129,7 +131,11 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
129
131
  identifier: identifier,
130
132
  alt: alt,
131
133
  width: width,
132
- height: height
134
+ height: height,
135
+ border: {
136
+ borderSize: borderSize,
137
+ borderColor: borderColor
138
+ }
133
139
  });
134
140
  }
135
141
  var handleMediaInlineClick = function handleMediaInlineClick(result) {
@@ -165,6 +171,7 @@ export var RenderMediaInline = function RenderMediaInline(_ref) {
165
171
  }));
166
172
  };
167
173
  var MediaInline = function MediaInline(props) {
174
+ var _borderMark$attrs$col, _borderMark$attrs$siz;
168
175
  var collection = props.collection,
169
176
  id = props.id,
170
177
  providerFactory = props.providers,
@@ -174,7 +181,8 @@ var MediaInline = function MediaInline(props) {
174
181
  fileType = props.type,
175
182
  alt = props.alt,
176
183
  width = props.width,
177
- height = props.height;
184
+ height = props.height,
185
+ marks = props.marks;
178
186
  var clipboardAttrs = {
179
187
  id: id,
180
188
  collection: collection
@@ -184,6 +192,11 @@ var MediaInline = function MediaInline(props) {
184
192
  mediaItemType: 'file',
185
193
  collectionName: collection
186
194
  };
195
+ var borderMark = marks === null || marks === void 0 ? void 0 : marks.find(function (mark) {
196
+ return (mark === null || mark === void 0 ? void 0 : mark.type.name) === 'border';
197
+ });
198
+ var borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
199
+ 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;
187
200
  return /*#__PURE__*/React.createElement(WithProviders, {
188
201
  providers: ['mediaProvider', 'contextIdentifierProvider'],
189
202
  providerFactory: providerFactory,
@@ -200,7 +213,9 @@ var MediaInline = function MediaInline(props) {
200
213
  type: fileType,
201
214
  alt: alt,
202
215
  width: width,
203
- height: height
216
+ height: height,
217
+ borderSize: borderSize,
218
+ borderColor: borderColor
204
219
  });
205
220
  }
206
221
  });
@@ -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 { N30, N40, N50 } from '@atlaskit/theme/colors';
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 border: 1px solid ", ";\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 "])), "var(--ds-border, ".concat(N30, ")"), activeChildIndex + 1, "var(--ds-border, ".concat(N50, ")"));
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("nav", {
70
- className: "multiBodiedExtension-navigation",
71
- css: navigationCSS,
72
- "data-testid": "multiBodiedExtension-navigation"
73
- }, jsx(ExtensionRenderer, _extends({}, props, {
74
- actions: actions,
75
- type: "multiBodiedExtension"
76
- }), function (_ref2) {
77
- var result = _ref2.result;
78
- try {
79
- if (result && /*#__PURE__*/React.isValidElement(result)) {
80
- // Return the content directly if it's a valid JSX.Element
81
- return renderExtension(result, layout, {
82
- isTopLevel: path.length < 1
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
- // Always return default content if anything goes wrong
91
- return renderExtension(children, layout, {
92
- isTopLevel: path.length < 1
93
- });
94
- })), jsx("article", {
95
- className: "multiBodiedExtension--frames",
96
- "data-testid": "multiBodiedExtension--frames"
97
- }, children));
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.0.5";
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);
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
4
+ import type { MarkProps } from '../types';
5
+ export default function Border(props: MarkProps<BorderMarkAttributes>): jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
- import { ComponentType } from 'react';
2
- import { Mark } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ComponentType } from 'react';
2
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
3
3
  import Code from './code';
4
4
  import Em from './em';
5
5
  import Link from './link';
@@ -14,8 +14,9 @@ import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
14
14
  import DataConsumer from './data-consumer';
15
15
  import FragmentMark from './fragment';
16
16
  import Annotation, { isAnnotationMark } from './annotation';
17
+ import Border from './border';
17
18
  export declare const markToReact: {
18
19
  [key: string]: ComponentType<any>;
19
20
  };
20
21
  export declare const toReact: (mark: Mark) => ComponentType<any>;
21
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
22
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
@@ -9,6 +9,7 @@ import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
9
9
  import type { ClipboardAttrs, MediaProvider } from '../../ui/MediaCard';
10
10
  import type { RendererAppearance } from '../../ui/Renderer/types';
11
11
  import type { RendererContext } from '../types';
12
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
12
13
  type MediaInlineProviders = {
13
14
  mediaProvider?: Promise<MediaProvider>;
14
15
  contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
@@ -32,6 +33,7 @@ export type MediaInlineProps = {
32
33
  eventHandlers?: EventHandlers;
33
34
  rendererAppearance?: RendererAppearance;
34
35
  featureFlags?: MediaFeatureFlags;
36
+ marks?: Array<Mark>;
35
37
  };
36
38
  export declare const RenderMediaInline: FC<RenderMediaInlineProps & MediaInlineAttrs>;
37
39
  declare const _default: FC<import("react-intl-next").WithIntlProps<MediaInlineProps & WrappedComponentProps<"intl"> & MediaInlineAttrs>> & {
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
4
+ import type { MarkProps } from '../types';
5
+ export default function Border(props: MarkProps<BorderMarkAttributes>): jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
- import { ComponentType } from 'react';
2
- import { Mark } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ComponentType } from 'react';
2
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
3
3
  import Code from './code';
4
4
  import Em from './em';
5
5
  import Link from './link';
@@ -14,8 +14,9 @@ import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
14
14
  import DataConsumer from './data-consumer';
15
15
  import FragmentMark from './fragment';
16
16
  import Annotation, { isAnnotationMark } from './annotation';
17
+ import Border from './border';
17
18
  export declare const markToReact: {
18
19
  [key: string]: ComponentType<any>;
19
20
  };
20
21
  export declare const toReact: (mark: Mark) => ComponentType<any>;
21
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
22
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
@@ -9,6 +9,7 @@ import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
9
9
  import type { ClipboardAttrs, MediaProvider } from '../../ui/MediaCard';
10
10
  import type { RendererAppearance } from '../../ui/Renderer/types';
11
11
  import type { RendererContext } from '../types';
12
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
12
13
  type MediaInlineProviders = {
13
14
  mediaProvider?: Promise<MediaProvider>;
14
15
  contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
@@ -32,6 +33,7 @@ export type MediaInlineProps = {
32
33
  eventHandlers?: EventHandlers;
33
34
  rendererAppearance?: RendererAppearance;
34
35
  featureFlags?: MediaFeatureFlags;
36
+ marks?: Array<Mark>;
35
37
  };
36
38
  export declare const RenderMediaInline: FC<RenderMediaInlineProps & MediaInlineAttrs>;
37
39
  declare const _default: FC<import("react-intl-next").WithIntlProps<MediaInlineProps & WrappedComponentProps<"intl"> & MediaInlineAttrs>> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.0.5",
3
+ "version": "109.1.1",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/analytics-next": "^9.1.0",
33
33
  "@atlaskit/button": "^17.1.0",
34
34
  "@atlaskit/code": "^15.1.0",
35
- "@atlaskit/editor-common": "^76.27.0",
35
+ "@atlaskit/editor-common": "^76.28.0",
36
36
  "@atlaskit/editor-json-transformer": "^8.10.0",
37
37
  "@atlaskit/editor-palette": "1.5.2",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",