@atlaskit/renderer 109.17.0 → 109.17.2
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 +13 -0
- package/dist/cjs/react/index.js +3 -1
- package/dist/cjs/react/nodes/media/index.js +42 -2
- package/dist/cjs/react/nodes/mediaSingle/index.js +48 -35
- package/dist/cjs/react/nodes/table/colgroup.js +1 -17
- package/dist/cjs/react/nodes/table.js +9 -30
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/index.js +3 -1
- package/dist/es2019/react/nodes/media/index.js +35 -3
- package/dist/es2019/react/nodes/mediaSingle/index.js +47 -36
- package/dist/es2019/react/nodes/table/colgroup.js +2 -18
- package/dist/es2019/react/nodes/table.js +10 -31
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/index.js +3 -1
- package/dist/esm/react/nodes/media/index.js +41 -2
- package/dist/esm/react/nodes/mediaSingle/index.js +50 -37
- package/dist/esm/react/nodes/table/colgroup.js +2 -18
- package/dist/esm/react/nodes/table.js +10 -31
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/media/index.d.ts +6 -8
- package/dist/types-ts4.5/react/nodes/media/index.d.ts +6 -8
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.17.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#86368](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86368) [`8499e6f0fef4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8499e6f0fef4) - Remove custom-table-width feature flag
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 109.17.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#89893](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89893) [`8103423f9266`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8103423f9266) - [ED-22909] Update media content wrap dom with annotation draft related data attributes so that create dialog can be correctly positioned next to media
|
|
15
|
+
|
|
3
16
|
## 109.17.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -421,7 +421,9 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
|
|
|
421
421
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
422
422
|
featureFlags: this.media && this.media.featureFlags,
|
|
423
423
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
424
|
-
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
424
|
+
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr,
|
|
425
|
+
// surroundTextNodesWithTextWrapper checks inlineComment.allowDraftMode
|
|
426
|
+
allowAnnotationsDraftMode: this.surroundTextNodesWithTextWrapper
|
|
425
427
|
});
|
|
426
428
|
}
|
|
427
429
|
}, {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -28,6 +29,7 @@ var _utils = require("../../../utils");
|
|
|
28
29
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
29
30
|
var _events = require("../../../analytics/events");
|
|
30
31
|
var _annotation = _interopRequireDefault(require("../../marks/annotation"));
|
|
32
|
+
var _context = require("../../../ui/annotations/context");
|
|
31
33
|
var _styles = require("./styles");
|
|
32
34
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
33
35
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -37,6 +39,8 @@ var _excluded = ["marks"];
|
|
|
37
39
|
/** @jsx jsx */
|
|
38
40
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
39
41
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
42
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
43
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
44
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
45
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
42
46
|
var MediaBorder = function MediaBorder(_ref) {
|
|
@@ -141,7 +145,7 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
141
145
|
onClick: onClick
|
|
142
146
|
}, rest));
|
|
143
147
|
};
|
|
144
|
-
var Media =
|
|
148
|
+
var Media = /*#__PURE__*/function (_PureComponent) {
|
|
145
149
|
(0, _inherits2.default)(Media, _PureComponent);
|
|
146
150
|
var _super = _createSuper(Media);
|
|
147
151
|
function Media(props) {
|
|
@@ -237,4 +241,40 @@ var Media = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
237
241
|
}
|
|
238
242
|
}]);
|
|
239
243
|
return Media;
|
|
240
|
-
}(_react.PureComponent);
|
|
244
|
+
}(_react.PureComponent);
|
|
245
|
+
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
246
|
+
var draftPosition = _react.default.useContext(_context.AnnotationsDraftContext);
|
|
247
|
+
var dataAttributes = props.dataAttributes;
|
|
248
|
+
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
249
|
+
var _useState = (0, _react.useState)(),
|
|
250
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
251
|
+
position = _useState2[0],
|
|
252
|
+
setPosition = _useState2[1];
|
|
253
|
+
var _useState3 = (0, _react.useState)(false),
|
|
254
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
255
|
+
shouldApplyDraftAnnotation = _useState4[0],
|
|
256
|
+
setShouldApplyDraftAnnotation = _useState4[1];
|
|
257
|
+
(0, _react.useEffect)(function () {
|
|
258
|
+
if (pos === undefined) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (draftPosition !== null && draftPosition.from === pos) {
|
|
262
|
+
setShouldApplyDraftAnnotation(true);
|
|
263
|
+
setPosition(draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from);
|
|
264
|
+
} else if (draftPosition === null && shouldApplyDraftAnnotation) {
|
|
265
|
+
setShouldApplyDraftAnnotation(false);
|
|
266
|
+
setPosition(undefined);
|
|
267
|
+
}
|
|
268
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
269
|
+
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
270
|
+
var dataAttributesWithDraftAnnotation = (0, _react.useMemo)(function () {
|
|
271
|
+
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
272
|
+
'data-annotation-draft-mark': true,
|
|
273
|
+
'data-renderer-mark': true
|
|
274
|
+
}) : dataAttributes;
|
|
275
|
+
}, [applyDraftAnnotation, dataAttributes]);
|
|
276
|
+
return (0, _react2.jsx)(Media, (0, _extends2.default)({}, props, {
|
|
277
|
+
dataAttributes: dataAttributesWithDraftAnnotation
|
|
278
|
+
}));
|
|
279
|
+
};
|
|
280
|
+
var _default = exports.default = MediaWithDraftAnnotation;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getMediaContainerWidth = exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _react2 = require("@emotion/react");
|
|
@@ -58,19 +59,20 @@ var getMediaContainerWidth = exports.getMediaContainerWidth = function getMediaC
|
|
|
58
59
|
}
|
|
59
60
|
return currentContainerWidth;
|
|
60
61
|
};
|
|
61
|
-
var
|
|
62
|
+
var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
62
63
|
var rendererAppearance = props.rendererAppearance,
|
|
63
64
|
featureFlags = props.featureFlags,
|
|
64
65
|
isInsideOfBlockNode = props.isInsideOfBlockNode,
|
|
65
66
|
layout = props.layout,
|
|
66
|
-
children = props.children,
|
|
67
67
|
widthAttr = props.width,
|
|
68
68
|
widthType = props.widthType,
|
|
69
69
|
_props$allowCaptions = props.allowCaptions,
|
|
70
70
|
allowCaptions = _props$allowCaptions === void 0 ? false : _props$allowCaptions,
|
|
71
71
|
_props$isInsideOfInli = props.isInsideOfInlineExtension,
|
|
72
72
|
isInsideOfInlineExtension = _props$isInsideOfInli === void 0 ? false : _props$isInsideOfInli,
|
|
73
|
-
dataAttributes = props.dataAttributes
|
|
73
|
+
dataAttributes = props.dataAttributes,
|
|
74
|
+
media = props.media,
|
|
75
|
+
caption = props.caption;
|
|
74
76
|
var _React$useState = _react.default.useState({
|
|
75
77
|
width: 0,
|
|
76
78
|
height: 0
|
|
@@ -87,20 +89,6 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
87
89
|
height: height
|
|
88
90
|
});
|
|
89
91
|
}, []);
|
|
90
|
-
var media;
|
|
91
|
-
var _React$Children$toArr3 = _react.default.Children.toArray(children),
|
|
92
|
-
_React$Children$toArr4 = (0, _slicedToArray2.default)(_React$Children$toArr3, 2),
|
|
93
|
-
node = _React$Children$toArr4[0],
|
|
94
|
-
caption = _React$Children$toArr4[1];
|
|
95
|
-
if (!isMediaElement(node)) {
|
|
96
|
-
var mediaElement = checkForMediaElement(node.props.children);
|
|
97
|
-
if (!mediaElement) {
|
|
98
|
-
return node;
|
|
99
|
-
}
|
|
100
|
-
media = mediaElement;
|
|
101
|
-
} else {
|
|
102
|
-
media = node;
|
|
103
|
-
}
|
|
104
92
|
var _media$props = media.props,
|
|
105
93
|
_media$props$width = _media$props.width,
|
|
106
94
|
width = _media$props$width === void 0 ? DEFAULT_WIDTH : _media$props$width,
|
|
@@ -126,7 +114,7 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
126
114
|
|
|
127
115
|
var padding = rendererAppearance === 'full-page' ? _style.FullPagePadding * 2 : 0;
|
|
128
116
|
var isFullWidth = rendererAppearance === 'full-width';
|
|
129
|
-
var calcDimensions = function
|
|
117
|
+
var calcDimensions = (0, _react.useCallback)(function (mediaContainerWidth) {
|
|
130
118
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
131
119
|
var maxWidth = containerWidth;
|
|
132
120
|
var maxHeight = height / width * maxWidth;
|
|
@@ -149,16 +137,26 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
149
137
|
cardDimensions: cardDimensions,
|
|
150
138
|
lineLength: lineLength
|
|
151
139
|
};
|
|
152
|
-
};
|
|
153
|
-
var originalDimensions = {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
140
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
141
|
+
var originalDimensions = (0, _react.useMemo)(function () {
|
|
142
|
+
return {
|
|
143
|
+
width: width,
|
|
144
|
+
height: height
|
|
145
|
+
};
|
|
146
|
+
}, [height, width]);
|
|
147
|
+
|
|
148
|
+
// Note: in SSR mode the `window` object is not defined,
|
|
149
|
+
// therefore width here is 0, see:
|
|
150
|
+
// packages/editor/editor-common/src/ui/WidthProvider/index.tsx
|
|
151
|
+
var _useContext = (0, _react.useContext)(_ui.WidthContext),
|
|
152
|
+
renderWidth = _useContext.width;
|
|
153
|
+
var containerWidth = getMediaContainerWidth(renderWidth, layout);
|
|
154
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
155
|
+
return calcDimensions(containerWidth);
|
|
156
|
+
}, [calcDimensions, containerWidth]),
|
|
157
|
+
cardDimensions = _useMemo.cardDimensions,
|
|
158
|
+
lineLength = _useMemo.lineLength;
|
|
159
|
+
var renderMediaSingle = function renderMediaSingle() {
|
|
162
160
|
var mediaComponent = /*#__PURE__*/_react.default.cloneElement(media, {
|
|
163
161
|
resizeMode: 'stretchy-fit',
|
|
164
162
|
cardDimensions: cardDimensions,
|
|
@@ -186,12 +184,27 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
186
184
|
dataAttributes: dataAttributes
|
|
187
185
|
}, (0, _react2.jsx)(_react.Fragment, null, mediaComponent), allowCaptions && caption);
|
|
188
186
|
};
|
|
189
|
-
return (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
return renderMediaSingle();
|
|
188
|
+
};
|
|
189
|
+
var MediaSingle = function MediaSingle(props) {
|
|
190
|
+
var children = props.children;
|
|
191
|
+
var media;
|
|
192
|
+
var _React$Children$toArr3 = _react.default.Children.toArray(children),
|
|
193
|
+
_React$Children$toArr4 = (0, _slicedToArray2.default)(_React$Children$toArr3, 2),
|
|
194
|
+
node = _React$Children$toArr4[0],
|
|
195
|
+
caption = _React$Children$toArr4[1];
|
|
196
|
+
if (!isMediaElement(node)) {
|
|
197
|
+
var mediaElement = checkForMediaElement(node.props.children);
|
|
198
|
+
if (!mediaElement) {
|
|
199
|
+
return node;
|
|
200
|
+
}
|
|
201
|
+
media = mediaElement;
|
|
202
|
+
} else {
|
|
203
|
+
media = node;
|
|
204
|
+
}
|
|
205
|
+
return (0, _react2.jsx)(MediaSingleWithChildren, (0, _extends2.default)({}, props, {
|
|
206
|
+
media: media,
|
|
207
|
+
caption: caption
|
|
208
|
+
}));
|
|
196
209
|
};
|
|
197
210
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(MediaSingle);
|
|
@@ -15,16 +15,6 @@ var _table = require("../table");
|
|
|
15
15
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
16
16
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
17
17
|
var MAX_SCALING_PERCENT = 0.3;
|
|
18
|
-
var getTableLayoutWidth = function getTableLayoutWidth(layout) {
|
|
19
|
-
switch (layout) {
|
|
20
|
-
case 'full-width':
|
|
21
|
-
return _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
22
|
-
case 'wide':
|
|
23
|
-
return _editorSharedStyles.akEditorWideLayoutWidth;
|
|
24
|
-
default:
|
|
25
|
-
return _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
18
|
var isTableResized = function isTableResized(columnWidths) {
|
|
29
19
|
var filteredWidths = columnWidths.filter(function (width) {
|
|
30
20
|
return width !== 0;
|
|
@@ -54,7 +44,6 @@ var calcScalePercent = exports.calcScalePercent = function calcScalePercent(_ref
|
|
|
54
44
|
};
|
|
55
45
|
var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
56
46
|
var columnWidths = props.columnWidths,
|
|
57
|
-
layout = props.layout,
|
|
58
47
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
59
48
|
renderWidth = props.renderWidth,
|
|
60
49
|
tableNode = props.tableNode,
|
|
@@ -64,15 +53,10 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
|
64
53
|
if (!columnWidths) {
|
|
65
54
|
return [];
|
|
66
55
|
}
|
|
67
|
-
var tableContainerWidth;
|
|
68
56
|
var tableResized = isTableResized(columnWidths);
|
|
69
57
|
var noOfColumns = columnWidths.length;
|
|
70
58
|
var targetWidths;
|
|
71
|
-
|
|
72
|
-
tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
73
|
-
} else {
|
|
74
|
-
tableContainerWidth = getTableLayoutWidth(layout);
|
|
75
|
-
}
|
|
59
|
+
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
76
60
|
if ((0, _table.isTableResizingEnabled)(rendererAppearance) && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableResized) {
|
|
77
61
|
// for tables with no column widths defined, assume that the real table width
|
|
78
62
|
// is defined by node.attrs.width
|
|
@@ -19,7 +19,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
19
19
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
20
|
var _types = require("@atlaskit/editor-common/types");
|
|
21
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
22
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
24
23
|
var _style = require("../../ui/Renderer/style");
|
|
25
24
|
var _tableCell = require("./tableCell");
|
|
@@ -33,7 +32,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
33
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
34
33
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
34
|
var isTableResizingEnabled = exports.isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
36
|
-
return (0,
|
|
35
|
+
return (0, _appearance.isFullWidthOrFullPageAppearance)(appearance);
|
|
37
36
|
};
|
|
38
37
|
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
39
38
|
if (!tableOrderStatus || tableOrderStatus.order === _types.SortOrder.NO_ORDER) {
|
|
@@ -299,7 +298,6 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
299
298
|
isinsideMultiBodiedExtension = _this$props.isinsideMultiBodiedExtension;
|
|
300
299
|
var stickyMode = this.state.stickyMode;
|
|
301
300
|
var lineLength = _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
302
|
-
var tableWidth;
|
|
303
301
|
var left;
|
|
304
302
|
var updatedLayout;
|
|
305
303
|
|
|
@@ -307,8 +305,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
307
305
|
// Please consider changes below carefully to not negatively impact SSR
|
|
308
306
|
// `renderWidth` cannot be depended on during SSR
|
|
309
307
|
var isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
310
|
-
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(
|
|
311
|
-
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
308
|
+
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
|
|
309
|
+
if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
312
310
|
return isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
313
311
|
} else {
|
|
314
312
|
// custom width, or width mapped to breakpoint
|
|
@@ -316,12 +314,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
316
314
|
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
317
315
|
}
|
|
318
316
|
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
} else {
|
|
322
|
-
tableWidth = (0, _styles.calcTableWidth)(layout, renderWidth, false);
|
|
323
|
-
}
|
|
324
|
-
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
317
|
+
var tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
|
|
318
|
+
if (canUseLinelength(rendererAppearance) && tableWidth > lineLength) {
|
|
325
319
|
left = lineLength / 2 - tableWidth / 2;
|
|
326
320
|
}
|
|
327
321
|
var children = _react.default.Children.toArray(this.props.children);
|
|
@@ -329,30 +323,15 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
329
323
|
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
330
324
|
// This check caters for those tables and helps with SSR logic
|
|
331
325
|
var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
332
|
-
var hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
333
326
|
if (isFullWidth) {
|
|
334
327
|
updatedLayout = 'full-width';
|
|
335
|
-
|
|
328
|
+
// if table has width explicity set, ensure SSR is handled
|
|
329
|
+
} else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
|
|
336
330
|
updatedLayout = 'custom';
|
|
337
331
|
} else {
|
|
338
332
|
updatedLayout = layout;
|
|
339
333
|
}
|
|
340
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
341
|
-
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
342
|
-
tableWidth: tableWidth,
|
|
343
|
-
layout: layout,
|
|
344
|
-
renderWidth: renderWidth,
|
|
345
|
-
handleRef: this.props.handleRef,
|
|
346
|
-
shadowClassNames: this.props.shadowClassNames,
|
|
347
|
-
top: this.stickyTop,
|
|
348
|
-
left: left,
|
|
349
|
-
mode: stickyMode,
|
|
350
|
-
innerRef: this.stickyWrapperRef,
|
|
351
|
-
wrapperWidth: this.state.wrapperWidth,
|
|
352
|
-
columnWidths: columnWidths,
|
|
353
|
-
rowHeight: this.state.headerRowHeight,
|
|
354
|
-
rendererAppearance: rendererAppearance
|
|
355
|
-
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
|
|
334
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
356
335
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
357
336
|
"data-layout": updatedLayout,
|
|
358
337
|
ref: this.props.handleRef,
|
|
@@ -361,7 +340,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
361
340
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview
|
|
362
341
|
left: left
|
|
363
342
|
}
|
|
364
|
-
},
|
|
343
|
+
}, stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
|
|
365
344
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
366
345
|
tableWidth: tableWidth,
|
|
367
346
|
layout: layout,
|
|
@@ -55,7 +55,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
55
55
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
56
56
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "109.17.
|
|
58
|
+
var packageVersion = "109.17.2";
|
|
59
59
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
|
@@ -369,7 +369,9 @@ export default class ReactSerializer {
|
|
|
369
369
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
370
370
|
featureFlags: this.media && this.media.featureFlags,
|
|
371
371
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
372
|
-
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
372
|
+
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr,
|
|
373
|
+
// surroundTextNodesWithTextWrapper checks inlineComment.allowDraftMode
|
|
374
|
+
allowAnnotationsDraftMode: this.surroundTextNodesWithTextWrapper
|
|
373
375
|
};
|
|
374
376
|
}
|
|
375
377
|
getEmojiProps(node) {
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
|
|
5
|
-
import React, { PureComponent, Fragment } from 'react';
|
|
5
|
+
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
8
8
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
@@ -15,6 +15,7 @@ import { getEventHandler } from '../../../utils';
|
|
|
15
15
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
16
16
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
17
17
|
import AnnotationComponent from '../../marks/annotation';
|
|
18
|
+
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
18
19
|
import { linkStyle, borderStyle } from './styles';
|
|
19
20
|
import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
|
|
20
21
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -124,7 +125,7 @@ const CommentBadgeWrapper = ({
|
|
|
124
125
|
onClick: onClick
|
|
125
126
|
}, rest));
|
|
126
127
|
};
|
|
127
|
-
|
|
128
|
+
class Media extends PureComponent {
|
|
128
129
|
constructor(props) {
|
|
129
130
|
super(props);
|
|
130
131
|
_defineProperty(this, "renderCard", (providers = {}) => {
|
|
@@ -218,4 +219,35 @@ export default class Media extends PureComponent {
|
|
|
218
219
|
renderNode: this.renderCard
|
|
219
220
|
});
|
|
220
221
|
}
|
|
221
|
-
}
|
|
222
|
+
}
|
|
223
|
+
const MediaWithDraftAnnotation = props => {
|
|
224
|
+
const draftPosition = React.useContext(AnnotationsDraftContext);
|
|
225
|
+
const {
|
|
226
|
+
dataAttributes
|
|
227
|
+
} = props;
|
|
228
|
+
const pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
229
|
+
const [position, setPosition] = useState();
|
|
230
|
+
const [shouldApplyDraftAnnotation, setShouldApplyDraftAnnotation] = useState(false);
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
if (pos === undefined) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (draftPosition !== null && draftPosition.from === pos) {
|
|
236
|
+
setShouldApplyDraftAnnotation(true);
|
|
237
|
+
setPosition(draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from);
|
|
238
|
+
} else if (draftPosition === null && shouldApplyDraftAnnotation) {
|
|
239
|
+
setShouldApplyDraftAnnotation(false);
|
|
240
|
+
setPosition(undefined);
|
|
241
|
+
}
|
|
242
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
243
|
+
const applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
244
|
+
const dataAttributesWithDraftAnnotation = useMemo(() => applyDraftAnnotation ? {
|
|
245
|
+
...dataAttributes,
|
|
246
|
+
'data-annotation-draft-mark': true,
|
|
247
|
+
'data-renderer-mark': true
|
|
248
|
+
} : dataAttributes, [applyDraftAnnotation, dataAttributes]);
|
|
249
|
+
return jsx(Media, _extends({}, props, {
|
|
250
|
+
dataAttributes: dataAttributesWithDraftAnnotation
|
|
251
|
+
}));
|
|
252
|
+
};
|
|
253
|
+
export default MediaWithDraftAnnotation;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
3
|
|
|
3
|
-
import { default as React, Fragment } from 'react';
|
|
4
|
+
import { default as React, Fragment, useCallback, useContext, useMemo } from 'react';
|
|
4
5
|
import { jsx } from '@emotion/react';
|
|
5
6
|
import { injectIntl } from 'react-intl-next';
|
|
6
|
-
import { MediaSingle as UIMediaSingle,
|
|
7
|
+
import { MediaSingle as UIMediaSingle, WidthContext } from '@atlaskit/editor-common/ui';
|
|
7
8
|
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
8
9
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
9
10
|
import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
|
|
@@ -46,18 +47,19 @@ export const getMediaContainerWidth = (currentContainerWidth, layout) => {
|
|
|
46
47
|
}
|
|
47
48
|
return currentContainerWidth;
|
|
48
49
|
};
|
|
49
|
-
const
|
|
50
|
+
const MediaSingleWithChildren = props => {
|
|
50
51
|
const {
|
|
51
52
|
rendererAppearance,
|
|
52
53
|
featureFlags,
|
|
53
54
|
isInsideOfBlockNode,
|
|
54
55
|
layout,
|
|
55
|
-
children,
|
|
56
56
|
width: widthAttr,
|
|
57
57
|
widthType,
|
|
58
58
|
allowCaptions = false,
|
|
59
59
|
isInsideOfInlineExtension = false,
|
|
60
|
-
dataAttributes
|
|
60
|
+
dataAttributes,
|
|
61
|
+
media,
|
|
62
|
+
caption
|
|
61
63
|
} = props;
|
|
62
64
|
const [externalImageDimensions, setExternalImageDimensions] = React.useState({
|
|
63
65
|
width: 0,
|
|
@@ -73,17 +75,6 @@ const MediaSingle = props => {
|
|
|
73
75
|
height
|
|
74
76
|
});
|
|
75
77
|
}, []);
|
|
76
|
-
let media;
|
|
77
|
-
const [node, caption] = React.Children.toArray(children);
|
|
78
|
-
if (!isMediaElement(node)) {
|
|
79
|
-
const mediaElement = checkForMediaElement(node.props.children);
|
|
80
|
-
if (!mediaElement) {
|
|
81
|
-
return node;
|
|
82
|
-
}
|
|
83
|
-
media = mediaElement;
|
|
84
|
-
} else {
|
|
85
|
-
media = node;
|
|
86
|
-
}
|
|
87
78
|
let {
|
|
88
79
|
width = DEFAULT_WIDTH,
|
|
89
80
|
height = DEFAULT_HEIGHT,
|
|
@@ -110,7 +101,7 @@ const MediaSingle = props => {
|
|
|
110
101
|
|
|
111
102
|
const padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
112
103
|
const isFullWidth = rendererAppearance === 'full-width';
|
|
113
|
-
const calcDimensions = mediaContainerWidth => {
|
|
104
|
+
const calcDimensions = useCallback(mediaContainerWidth => {
|
|
114
105
|
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
115
106
|
const maxWidth = containerWidth;
|
|
116
107
|
const maxHeight = height / width * maxWidth;
|
|
@@ -133,17 +124,24 @@ const MediaSingle = props => {
|
|
|
133
124
|
cardDimensions,
|
|
134
125
|
lineLength
|
|
135
126
|
};
|
|
136
|
-
};
|
|
137
|
-
const originalDimensions = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
127
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
128
|
+
const originalDimensions = useMemo(() => ({
|
|
129
|
+
width,
|
|
130
|
+
height
|
|
131
|
+
}), [height, width]);
|
|
132
|
+
|
|
133
|
+
// Note: in SSR mode the `window` object is not defined,
|
|
134
|
+
// therefore width here is 0, see:
|
|
135
|
+
// packages/editor/editor-common/src/ui/WidthProvider/index.tsx
|
|
136
|
+
const {
|
|
137
|
+
width: renderWidth
|
|
138
|
+
} = useContext(WidthContext);
|
|
139
|
+
const containerWidth = getMediaContainerWidth(renderWidth, layout);
|
|
140
|
+
const {
|
|
141
|
+
cardDimensions,
|
|
142
|
+
lineLength
|
|
143
|
+
} = useMemo(() => calcDimensions(containerWidth), [calcDimensions, containerWidth]);
|
|
144
|
+
const renderMediaSingle = () => {
|
|
147
145
|
const mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
148
146
|
resizeMode: 'stretchy-fit',
|
|
149
147
|
cardDimensions,
|
|
@@ -171,13 +169,26 @@ const MediaSingle = props => {
|
|
|
171
169
|
dataAttributes: dataAttributes
|
|
172
170
|
}, jsx(Fragment, null, mediaComponent), allowCaptions && caption);
|
|
173
171
|
};
|
|
174
|
-
return
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
172
|
+
return renderMediaSingle();
|
|
173
|
+
};
|
|
174
|
+
const MediaSingle = props => {
|
|
175
|
+
const {
|
|
176
|
+
children
|
|
177
|
+
} = props;
|
|
178
|
+
let media;
|
|
179
|
+
const [node, caption] = React.Children.toArray(children);
|
|
180
|
+
if (!isMediaElement(node)) {
|
|
181
|
+
const mediaElement = checkForMediaElement(node.props.children);
|
|
182
|
+
if (!mediaElement) {
|
|
183
|
+
return node;
|
|
184
|
+
}
|
|
185
|
+
media = mediaElement;
|
|
186
|
+
} else {
|
|
187
|
+
media = node;
|
|
188
|
+
}
|
|
189
|
+
return jsx(MediaSingleWithChildren, _extends({}, props, {
|
|
190
|
+
media: media,
|
|
191
|
+
caption: caption
|
|
192
|
+
}));
|
|
182
193
|
};
|
|
183
194
|
export default injectIntl(MediaSingle);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import { akEditorTableNumberColumnWidth,
|
|
3
|
+
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { isTableResizingEnabled } from '../table';
|
|
6
6
|
|
|
@@ -9,16 +9,6 @@ import { isTableResizingEnabled } from '../table';
|
|
|
9
9
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
10
10
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
11
11
|
const MAX_SCALING_PERCENT = 0.3;
|
|
12
|
-
const getTableLayoutWidth = layout => {
|
|
13
|
-
switch (layout) {
|
|
14
|
-
case 'full-width':
|
|
15
|
-
return akEditorFullWidthLayoutWidth;
|
|
16
|
-
case 'wide':
|
|
17
|
-
return akEditorWideLayoutWidth;
|
|
18
|
-
default:
|
|
19
|
-
return akEditorDefaultLayoutWidth;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
12
|
const isTableResized = columnWidths => {
|
|
23
13
|
const filteredWidths = columnWidths.filter(width => width !== 0);
|
|
24
14
|
return !!filteredWidths.length;
|
|
@@ -48,7 +38,6 @@ export const calcScalePercent = ({
|
|
|
48
38
|
const renderScaleDownColgroup = props => {
|
|
49
39
|
let {
|
|
50
40
|
columnWidths,
|
|
51
|
-
layout,
|
|
52
41
|
isNumberColumnEnabled,
|
|
53
42
|
renderWidth,
|
|
54
43
|
tableNode,
|
|
@@ -59,15 +48,10 @@ const renderScaleDownColgroup = props => {
|
|
|
59
48
|
if (!columnWidths) {
|
|
60
49
|
return [];
|
|
61
50
|
}
|
|
62
|
-
let tableContainerWidth;
|
|
63
51
|
const tableResized = isTableResized(columnWidths);
|
|
64
52
|
const noOfColumns = columnWidths.length;
|
|
65
53
|
let targetWidths;
|
|
66
|
-
|
|
67
|
-
tableContainerWidth = getTableContainerWidth(tableNode);
|
|
68
|
-
} else {
|
|
69
|
-
tableContainerWidth = getTableLayoutWidth(layout);
|
|
70
|
-
}
|
|
54
|
+
const tableContainerWidth = getTableContainerWidth(tableNode);
|
|
71
55
|
if (isTableResizingEnabled(rendererAppearance) && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableResized) {
|
|
72
56
|
// for tables with no column widths defined, assume that the real table width
|
|
73
57
|
// is defined by node.attrs.width
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
11
10
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
12
11
|
import { TableHeader } from './tableCell';
|
|
@@ -14,7 +13,7 @@ import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
|
14
13
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
15
14
|
import { Table } from './table/table';
|
|
16
15
|
import { isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
17
|
-
export const isTableResizingEnabled = appearance =>
|
|
16
|
+
export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance);
|
|
18
17
|
const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
|
|
19
18
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
20
19
|
return children;
|
|
@@ -246,7 +245,6 @@ export class TableContainer extends React.Component {
|
|
|
246
245
|
stickyMode
|
|
247
246
|
} = this.state;
|
|
248
247
|
const lineLength = akEditorDefaultLayoutWidth;
|
|
249
|
-
let tableWidth;
|
|
250
248
|
let left;
|
|
251
249
|
let updatedLayout;
|
|
252
250
|
|
|
@@ -254,8 +252,8 @@ export class TableContainer extends React.Component {
|
|
|
254
252
|
// Please consider changes below carefully to not negatively impact SSR
|
|
255
253
|
// `renderWidth` cannot be depended on during SSR
|
|
256
254
|
const isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
257
|
-
const calcDefaultLayoutWidthByAppearance = (
|
|
258
|
-
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
255
|
+
const calcDefaultLayoutWidthByAppearance = (rendererAppearance, tableNode) => {
|
|
256
|
+
if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
259
257
|
return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
260
258
|
} else {
|
|
261
259
|
// custom width, or width mapped to breakpoint
|
|
@@ -263,12 +261,8 @@ export class TableContainer extends React.Component {
|
|
|
263
261
|
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
264
262
|
}
|
|
265
263
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
} else {
|
|
269
|
-
tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
270
|
-
}
|
|
271
|
-
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
264
|
+
const tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
|
|
265
|
+
if (canUseLinelength(rendererAppearance) && tableWidth > lineLength) {
|
|
272
266
|
left = lineLength / 2 - tableWidth / 2;
|
|
273
267
|
}
|
|
274
268
|
const children = React.Children.toArray(this.props.children);
|
|
@@ -276,30 +270,15 @@ export class TableContainer extends React.Component {
|
|
|
276
270
|
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
277
271
|
// This check caters for those tables and helps with SSR logic
|
|
278
272
|
const isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
279
|
-
const hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
280
273
|
if (isFullWidth) {
|
|
281
274
|
updatedLayout = 'full-width';
|
|
282
|
-
|
|
275
|
+
// if table has width explicity set, ensure SSR is handled
|
|
276
|
+
} else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
|
|
283
277
|
updatedLayout = 'custom';
|
|
284
278
|
} else {
|
|
285
279
|
updatedLayout = layout;
|
|
286
280
|
}
|
|
287
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
288
|
-
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
289
|
-
tableWidth: tableWidth,
|
|
290
|
-
layout: layout,
|
|
291
|
-
renderWidth: renderWidth,
|
|
292
|
-
handleRef: this.props.handleRef,
|
|
293
|
-
shadowClassNames: this.props.shadowClassNames,
|
|
294
|
-
top: this.stickyTop,
|
|
295
|
-
left: left,
|
|
296
|
-
mode: stickyMode,
|
|
297
|
-
innerRef: this.stickyWrapperRef,
|
|
298
|
-
wrapperWidth: this.state.wrapperWidth,
|
|
299
|
-
columnWidths: columnWidths,
|
|
300
|
-
rowHeight: this.state.headerRowHeight,
|
|
301
|
-
rendererAppearance: rendererAppearance
|
|
302
|
-
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
281
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
303
282
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
|
|
304
283
|
"data-layout": updatedLayout,
|
|
305
284
|
ref: this.props.handleRef,
|
|
@@ -308,7 +287,7 @@ export class TableContainer extends React.Component {
|
|
|
308
287
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview
|
|
309
288
|
left
|
|
310
289
|
}
|
|
311
|
-
},
|
|
290
|
+
}, stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
312
291
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
313
292
|
tableWidth: tableWidth,
|
|
314
293
|
layout: layout,
|
|
@@ -36,7 +36,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
36
36
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
37
37
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
38
38
|
const packageName = "@atlaskit/renderer";
|
|
39
|
-
const packageVersion = "109.17.
|
|
39
|
+
const packageVersion = "109.17.2";
|
|
40
40
|
export class Renderer extends PureComponent {
|
|
41
41
|
constructor(props) {
|
|
42
42
|
super(props);
|
package/dist/esm/react/index.js
CHANGED
|
@@ -414,7 +414,9 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
414
414
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
415
415
|
featureFlags: this.media && this.media.featureFlags,
|
|
416
416
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
417
|
-
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
417
|
+
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr,
|
|
418
|
+
// surroundTextNodesWithTextWrapper checks inlineComment.allowDraftMode
|
|
419
|
+
allowAnnotationsDraftMode: this.surroundTextNodesWithTextWrapper
|
|
418
420
|
});
|
|
419
421
|
}
|
|
420
422
|
}, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -8,11 +9,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
8
9
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
10
11
|
var _excluded = ["marks"];
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
15
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
16
|
/** @jsx jsx */
|
|
14
17
|
|
|
15
|
-
import React, { PureComponent, Fragment } from 'react';
|
|
18
|
+
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
16
19
|
import { jsx } from '@emotion/react';
|
|
17
20
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
18
21
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
@@ -25,6 +28,7 @@ import { getEventHandler } from '../../../utils';
|
|
|
25
28
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
26
29
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
27
30
|
import AnnotationComponent from '../../marks/annotation';
|
|
31
|
+
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
28
32
|
import { linkStyle, borderStyle } from './styles';
|
|
29
33
|
import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
|
|
30
34
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -229,4 +233,39 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
229
233
|
}]);
|
|
230
234
|
return Media;
|
|
231
235
|
}(PureComponent);
|
|
232
|
-
|
|
236
|
+
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
237
|
+
var draftPosition = React.useContext(AnnotationsDraftContext);
|
|
238
|
+
var dataAttributes = props.dataAttributes;
|
|
239
|
+
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
240
|
+
var _useState = useState(),
|
|
241
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
242
|
+
position = _useState2[0],
|
|
243
|
+
setPosition = _useState2[1];
|
|
244
|
+
var _useState3 = useState(false),
|
|
245
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
246
|
+
shouldApplyDraftAnnotation = _useState4[0],
|
|
247
|
+
setShouldApplyDraftAnnotation = _useState4[1];
|
|
248
|
+
useEffect(function () {
|
|
249
|
+
if (pos === undefined) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (draftPosition !== null && draftPosition.from === pos) {
|
|
253
|
+
setShouldApplyDraftAnnotation(true);
|
|
254
|
+
setPosition(draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from);
|
|
255
|
+
} else if (draftPosition === null && shouldApplyDraftAnnotation) {
|
|
256
|
+
setShouldApplyDraftAnnotation(false);
|
|
257
|
+
setPosition(undefined);
|
|
258
|
+
}
|
|
259
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
260
|
+
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
261
|
+
var dataAttributesWithDraftAnnotation = useMemo(function () {
|
|
262
|
+
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
263
|
+
'data-annotation-draft-mark': true,
|
|
264
|
+
'data-renderer-mark': true
|
|
265
|
+
}) : dataAttributes;
|
|
266
|
+
}, [applyDraftAnnotation, dataAttributes]);
|
|
267
|
+
return jsx(Media, _extends({}, props, {
|
|
268
|
+
dataAttributes: dataAttributesWithDraftAnnotation
|
|
269
|
+
}));
|
|
270
|
+
};
|
|
271
|
+
export default MediaWithDraftAnnotation;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
|
|
4
|
-
import { default as React, Fragment } from 'react';
|
|
5
|
+
import { default as React, Fragment, useCallback, useContext, useMemo } from 'react';
|
|
5
6
|
import { jsx } from '@emotion/react';
|
|
6
7
|
import { injectIntl } from 'react-intl-next';
|
|
7
|
-
import { MediaSingle as UIMediaSingle,
|
|
8
|
+
import { MediaSingle as UIMediaSingle, WidthContext } from '@atlaskit/editor-common/ui';
|
|
8
9
|
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
9
10
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
10
11
|
import { uiMediaSingleBaseStyles, uiMediaSingleLayoutStyles } from './styles';
|
|
@@ -48,19 +49,20 @@ export var getMediaContainerWidth = function getMediaContainerWidth(currentConta
|
|
|
48
49
|
}
|
|
49
50
|
return currentContainerWidth;
|
|
50
51
|
};
|
|
51
|
-
var
|
|
52
|
+
var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
52
53
|
var rendererAppearance = props.rendererAppearance,
|
|
53
54
|
featureFlags = props.featureFlags,
|
|
54
55
|
isInsideOfBlockNode = props.isInsideOfBlockNode,
|
|
55
56
|
layout = props.layout,
|
|
56
|
-
children = props.children,
|
|
57
57
|
widthAttr = props.width,
|
|
58
58
|
widthType = props.widthType,
|
|
59
59
|
_props$allowCaptions = props.allowCaptions,
|
|
60
60
|
allowCaptions = _props$allowCaptions === void 0 ? false : _props$allowCaptions,
|
|
61
61
|
_props$isInsideOfInli = props.isInsideOfInlineExtension,
|
|
62
62
|
isInsideOfInlineExtension = _props$isInsideOfInli === void 0 ? false : _props$isInsideOfInli,
|
|
63
|
-
dataAttributes = props.dataAttributes
|
|
63
|
+
dataAttributes = props.dataAttributes,
|
|
64
|
+
media = props.media,
|
|
65
|
+
caption = props.caption;
|
|
64
66
|
var _React$useState = React.useState({
|
|
65
67
|
width: 0,
|
|
66
68
|
height: 0
|
|
@@ -77,20 +79,6 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
77
79
|
height: height
|
|
78
80
|
});
|
|
79
81
|
}, []);
|
|
80
|
-
var media;
|
|
81
|
-
var _React$Children$toArr3 = React.Children.toArray(children),
|
|
82
|
-
_React$Children$toArr4 = _slicedToArray(_React$Children$toArr3, 2),
|
|
83
|
-
node = _React$Children$toArr4[0],
|
|
84
|
-
caption = _React$Children$toArr4[1];
|
|
85
|
-
if (!isMediaElement(node)) {
|
|
86
|
-
var mediaElement = checkForMediaElement(node.props.children);
|
|
87
|
-
if (!mediaElement) {
|
|
88
|
-
return node;
|
|
89
|
-
}
|
|
90
|
-
media = mediaElement;
|
|
91
|
-
} else {
|
|
92
|
-
media = node;
|
|
93
|
-
}
|
|
94
82
|
var _media$props = media.props,
|
|
95
83
|
_media$props$width = _media$props.width,
|
|
96
84
|
width = _media$props$width === void 0 ? DEFAULT_WIDTH : _media$props$width,
|
|
@@ -116,7 +104,7 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
116
104
|
|
|
117
105
|
var padding = rendererAppearance === 'full-page' ? FullPagePadding * 2 : 0;
|
|
118
106
|
var isFullWidth = rendererAppearance === 'full-width';
|
|
119
|
-
var calcDimensions = function
|
|
107
|
+
var calcDimensions = useCallback(function (mediaContainerWidth) {
|
|
120
108
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
121
109
|
var maxWidth = containerWidth;
|
|
122
110
|
var maxHeight = height / width * maxWidth;
|
|
@@ -139,16 +127,26 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
139
127
|
cardDimensions: cardDimensions,
|
|
140
128
|
lineLength: lineLength
|
|
141
129
|
};
|
|
142
|
-
};
|
|
143
|
-
var originalDimensions = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
130
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
131
|
+
var originalDimensions = useMemo(function () {
|
|
132
|
+
return {
|
|
133
|
+
width: width,
|
|
134
|
+
height: height
|
|
135
|
+
};
|
|
136
|
+
}, [height, width]);
|
|
137
|
+
|
|
138
|
+
// Note: in SSR mode the `window` object is not defined,
|
|
139
|
+
// therefore width here is 0, see:
|
|
140
|
+
// packages/editor/editor-common/src/ui/WidthProvider/index.tsx
|
|
141
|
+
var _useContext = useContext(WidthContext),
|
|
142
|
+
renderWidth = _useContext.width;
|
|
143
|
+
var containerWidth = getMediaContainerWidth(renderWidth, layout);
|
|
144
|
+
var _useMemo = useMemo(function () {
|
|
145
|
+
return calcDimensions(containerWidth);
|
|
146
|
+
}, [calcDimensions, containerWidth]),
|
|
147
|
+
cardDimensions = _useMemo.cardDimensions,
|
|
148
|
+
lineLength = _useMemo.lineLength;
|
|
149
|
+
var renderMediaSingle = function renderMediaSingle() {
|
|
152
150
|
var mediaComponent = /*#__PURE__*/React.cloneElement(media, {
|
|
153
151
|
resizeMode: 'stretchy-fit',
|
|
154
152
|
cardDimensions: cardDimensions,
|
|
@@ -176,12 +174,27 @@ var MediaSingle = function MediaSingle(props) {
|
|
|
176
174
|
dataAttributes: dataAttributes
|
|
177
175
|
}, jsx(Fragment, null, mediaComponent), allowCaptions && caption);
|
|
178
176
|
};
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
return renderMediaSingle();
|
|
178
|
+
};
|
|
179
|
+
var MediaSingle = function MediaSingle(props) {
|
|
180
|
+
var children = props.children;
|
|
181
|
+
var media;
|
|
182
|
+
var _React$Children$toArr3 = React.Children.toArray(children),
|
|
183
|
+
_React$Children$toArr4 = _slicedToArray(_React$Children$toArr3, 2),
|
|
184
|
+
node = _React$Children$toArr4[0],
|
|
185
|
+
caption = _React$Children$toArr4[1];
|
|
186
|
+
if (!isMediaElement(node)) {
|
|
187
|
+
var mediaElement = checkForMediaElement(node.props.children);
|
|
188
|
+
if (!mediaElement) {
|
|
189
|
+
return node;
|
|
190
|
+
}
|
|
191
|
+
media = mediaElement;
|
|
192
|
+
} else {
|
|
193
|
+
media = node;
|
|
194
|
+
}
|
|
195
|
+
return jsx(MediaSingleWithChildren, _extends({}, props, {
|
|
196
|
+
media: media,
|
|
197
|
+
caption: caption
|
|
198
|
+
}));
|
|
186
199
|
};
|
|
187
200
|
export default injectIntl(MediaSingle);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import { akEditorTableNumberColumnWidth,
|
|
3
|
+
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { isTableResizingEnabled } from '../table';
|
|
6
6
|
|
|
@@ -9,16 +9,6 @@ import { isTableResizingEnabled } from '../table';
|
|
|
9
9
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
10
10
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
11
11
|
var MAX_SCALING_PERCENT = 0.3;
|
|
12
|
-
var getTableLayoutWidth = function getTableLayoutWidth(layout) {
|
|
13
|
-
switch (layout) {
|
|
14
|
-
case 'full-width':
|
|
15
|
-
return akEditorFullWidthLayoutWidth;
|
|
16
|
-
case 'wide':
|
|
17
|
-
return akEditorWideLayoutWidth;
|
|
18
|
-
default:
|
|
19
|
-
return akEditorDefaultLayoutWidth;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
12
|
var isTableResized = function isTableResized(columnWidths) {
|
|
23
13
|
var filteredWidths = columnWidths.filter(function (width) {
|
|
24
14
|
return width !== 0;
|
|
@@ -48,7 +38,6 @@ export var calcScalePercent = function calcScalePercent(_ref) {
|
|
|
48
38
|
};
|
|
49
39
|
var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
50
40
|
var columnWidths = props.columnWidths,
|
|
51
|
-
layout = props.layout,
|
|
52
41
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
53
42
|
renderWidth = props.renderWidth,
|
|
54
43
|
tableNode = props.tableNode,
|
|
@@ -58,15 +47,10 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
|
58
47
|
if (!columnWidths) {
|
|
59
48
|
return [];
|
|
60
49
|
}
|
|
61
|
-
var tableContainerWidth;
|
|
62
50
|
var tableResized = isTableResized(columnWidths);
|
|
63
51
|
var noOfColumns = columnWidths.length;
|
|
64
52
|
var targetWidths;
|
|
65
|
-
|
|
66
|
-
tableContainerWidth = getTableContainerWidth(tableNode);
|
|
67
|
-
} else {
|
|
68
|
-
tableContainerWidth = getTableLayoutWidth(layout);
|
|
69
|
-
}
|
|
53
|
+
var tableContainerWidth = getTableContainerWidth(tableNode);
|
|
70
54
|
if (isTableResizingEnabled(rendererAppearance) && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableResized) {
|
|
71
55
|
// for tables with no column widths defined, assume that the real table width
|
|
72
56
|
// is defined by node.attrs.width
|
|
@@ -12,12 +12,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
12
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import React from 'react';
|
|
15
|
-
import {
|
|
15
|
+
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
18
18
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
19
19
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
20
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
22
21
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
23
22
|
import { TableHeader } from './tableCell';
|
|
@@ -26,7 +25,7 @@ import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky'
|
|
|
26
25
|
import { Table } from './table/table';
|
|
27
26
|
import { isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
28
27
|
export var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
29
|
-
return
|
|
28
|
+
return isFullWidthOrFullPageAppearance(appearance);
|
|
30
29
|
};
|
|
31
30
|
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
32
31
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
@@ -292,7 +291,6 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
292
291
|
isinsideMultiBodiedExtension = _this$props.isinsideMultiBodiedExtension;
|
|
293
292
|
var stickyMode = this.state.stickyMode;
|
|
294
293
|
var lineLength = akEditorDefaultLayoutWidth;
|
|
295
|
-
var tableWidth;
|
|
296
294
|
var left;
|
|
297
295
|
var updatedLayout;
|
|
298
296
|
|
|
@@ -300,8 +298,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
300
298
|
// Please consider changes below carefully to not negatively impact SSR
|
|
301
299
|
// `renderWidth` cannot be depended on during SSR
|
|
302
300
|
var isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
303
|
-
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(
|
|
304
|
-
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
301
|
+
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
|
|
302
|
+
if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
305
303
|
return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
306
304
|
} else {
|
|
307
305
|
// custom width, or width mapped to breakpoint
|
|
@@ -309,12 +307,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
309
307
|
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
310
308
|
}
|
|
311
309
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
} else {
|
|
315
|
-
tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
316
|
-
}
|
|
317
|
-
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
310
|
+
var tableWidth = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
|
|
311
|
+
if (canUseLinelength(rendererAppearance) && tableWidth > lineLength) {
|
|
318
312
|
left = lineLength / 2 - tableWidth / 2;
|
|
319
313
|
}
|
|
320
314
|
var children = React.Children.toArray(this.props.children);
|
|
@@ -322,30 +316,15 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
322
316
|
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
323
317
|
// This check caters for those tables and helps with SSR logic
|
|
324
318
|
var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
325
|
-
var hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
326
319
|
if (isFullWidth) {
|
|
327
320
|
updatedLayout = 'full-width';
|
|
328
|
-
|
|
321
|
+
// if table has width explicity set, ensure SSR is handled
|
|
322
|
+
} else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
|
|
329
323
|
updatedLayout = 'custom';
|
|
330
324
|
} else {
|
|
331
325
|
updatedLayout = layout;
|
|
332
326
|
}
|
|
333
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
334
|
-
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
335
|
-
tableWidth: tableWidth,
|
|
336
|
-
layout: layout,
|
|
337
|
-
renderWidth: renderWidth,
|
|
338
|
-
handleRef: this.props.handleRef,
|
|
339
|
-
shadowClassNames: this.props.shadowClassNames,
|
|
340
|
-
top: this.stickyTop,
|
|
341
|
-
left: left,
|
|
342
|
-
mode: stickyMode,
|
|
343
|
-
innerRef: this.stickyWrapperRef,
|
|
344
|
-
wrapperWidth: this.state.wrapperWidth,
|
|
345
|
-
columnWidths: columnWidths,
|
|
346
|
-
rowHeight: this.state.headerRowHeight,
|
|
347
|
-
rendererAppearance: rendererAppearance
|
|
348
|
-
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
327
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
349
328
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
350
329
|
"data-layout": updatedLayout,
|
|
351
330
|
ref: this.props.handleRef,
|
|
@@ -354,7 +333,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
354
333
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview
|
|
355
334
|
left: left
|
|
356
335
|
}
|
|
357
|
-
},
|
|
336
|
+
}, stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
358
337
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
359
338
|
tableWidth: tableWidth,
|
|
360
339
|
layout: layout,
|
|
@@ -46,7 +46,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
46
46
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
47
47
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
48
48
|
var packageName = "@atlaskit/renderer";
|
|
49
|
-
var packageVersion = "109.17.
|
|
49
|
+
var packageVersion = "109.17.2";
|
|
50
50
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
51
51
|
_inherits(Renderer, _PureComponent);
|
|
52
52
|
var _super = _createSuper(Renderer);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
2
4
|
import { jsx } from '@emotion/react';
|
|
3
5
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
6
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
@@ -19,14 +21,10 @@ export type MediaProps = MediaCardProps & {
|
|
|
19
21
|
featureFlags?: MediaFeatureFlags;
|
|
20
22
|
eventHandlers?: EventHandlers;
|
|
21
23
|
enableDownloadButton?: boolean;
|
|
24
|
+
allowAnnotationsDraftMode?: boolean;
|
|
22
25
|
mediaSingleElement?: HTMLElement | null;
|
|
23
26
|
width?: number;
|
|
24
27
|
height?: number;
|
|
25
28
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private handleMediaLinkClickFn;
|
|
29
|
-
private renderCard;
|
|
30
|
-
private handleMediaLinkClick;
|
|
31
|
-
render(): jsx.JSX.Element;
|
|
32
|
-
}
|
|
29
|
+
declare const MediaWithDraftAnnotation: (props: PropsWithChildren<MediaProps>) => jsx.JSX.Element;
|
|
30
|
+
export default MediaWithDraftAnnotation;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
2
4
|
import { jsx } from '@emotion/react';
|
|
3
5
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
6
|
import type { EventHandlers } from '@atlaskit/editor-common/ui';
|
|
@@ -19,14 +21,10 @@ export type MediaProps = MediaCardProps & {
|
|
|
19
21
|
featureFlags?: MediaFeatureFlags;
|
|
20
22
|
eventHandlers?: EventHandlers;
|
|
21
23
|
enableDownloadButton?: boolean;
|
|
24
|
+
allowAnnotationsDraftMode?: boolean;
|
|
22
25
|
mediaSingleElement?: HTMLElement | null;
|
|
23
26
|
width?: number;
|
|
24
27
|
height?: number;
|
|
25
28
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private handleMediaLinkClickFn;
|
|
29
|
-
private renderCard;
|
|
30
|
-
private handleMediaLinkClick;
|
|
31
|
-
render(): jsx.JSX.Element;
|
|
32
|
-
}
|
|
29
|
+
declare const MediaWithDraftAnnotation: (props: PropsWithChildren<MediaProps>) => jsx.JSX.Element;
|
|
30
|
+
export default MediaWithDraftAnnotation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "109.17.
|
|
3
|
+
"version": "109.17.2",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
39
39
|
"@atlaskit/emoji": "^67.6.0",
|
|
40
40
|
"@atlaskit/icon": "^22.1.0",
|
|
41
|
-
"@atlaskit/link-datasource": "^1.
|
|
41
|
+
"@atlaskit/link-datasource": "^1.27.0",
|
|
42
42
|
"@atlaskit/media-card": "^77.11.0",
|
|
43
43
|
"@atlaskit/media-client": "^26.3.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/media-ui": "^25.7.0",
|
|
48
48
|
"@atlaskit/media-viewer": "^48.4.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
50
|
-
"@atlaskit/smart-card": "^26.
|
|
50
|
+
"@atlaskit/smart-card": "^26.54.0",
|
|
51
51
|
"@atlaskit/status": "^1.4.0",
|
|
52
52
|
"@atlaskit/task-decision": "^17.9.0",
|
|
53
53
|
"@atlaskit/theme": "^12.7.0",
|
|
@@ -119,9 +119,6 @@
|
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
"platform-feature-flags": {
|
|
122
|
-
"platform.editor.custom-table-width": {
|
|
123
|
-
"type": "boolean"
|
|
124
|
-
},
|
|
125
122
|
"platform.media-experience.media-viewer-v2_hgsii": {
|
|
126
123
|
"type": "boolean",
|
|
127
124
|
"referenceOnly": "true"
|