@atlaskit/renderer 108.1.8 → 108.2.0
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 +10 -0
- package/dist/cjs/react/nodes/media.js +2 -0
- package/dist/cjs/react/nodes/table/colgroup.js +13 -12
- package/dist/cjs/react/nodes/table/table.js +4 -2
- package/dist/cjs/react/nodes/table.js +15 -6
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/nodes/media.js +2 -0
- package/dist/es2019/react/nodes/table/colgroup.js +13 -12
- package/dist/es2019/react/nodes/table/table.js +4 -2
- package/dist/es2019/react/nodes/table.js +15 -6
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +7 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/nodes/media.js +2 -0
- package/dist/esm/react/nodes/table/colgroup.js +13 -12
- package/dist/esm/react/nodes/table/table.js +4 -2
- package/dist/esm/react/nodes/table.js +15 -6
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/react/nodes/table/table.d.ts +1 -1
- package/dist/types/react/nodes/table/types.d.ts +2 -0
- package/dist/types-ts4.5/react/nodes/table/table.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/table/types.d.ts +2 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 108.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`149b6c14e3e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/149b6c14e3e) - [ux] [ED-17634] Use the table width attribute in the renderer when platform.editor.custom-table-width FF is true
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`406f89ad910`](https://bitbucket.org/atlassian/atlassian-frontend/commits/406f89ad910) - [ux] fix image border missing in renderer when image is linked and also double seperators issue
|
|
12
|
+
|
|
3
13
|
## 108.1.8
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -79,6 +79,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
79
79
|
"data-color": borderColor,
|
|
80
80
|
"data-size": borderWidth,
|
|
81
81
|
style: {
|
|
82
|
+
width: '100%',
|
|
83
|
+
height: '100%',
|
|
82
84
|
borderColor: paletteColorValue,
|
|
83
85
|
borderWidth: "".concat(borderWidth, "px"),
|
|
84
86
|
borderStyle: 'solid',
|
|
@@ -8,12 +8,14 @@ exports.calcScalePercent = exports.Colgroup = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
11
13
|
// we allow scaling down column widths by no more than 30%
|
|
12
14
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
13
15
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
14
16
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
15
17
|
var MAX_SCALING_PERCENT = 0.3;
|
|
16
|
-
var getTableLayoutWidth = function getTableLayoutWidth(layout
|
|
18
|
+
var getTableLayoutWidth = function getTableLayoutWidth(layout) {
|
|
17
19
|
switch (layout) {
|
|
18
20
|
case 'full-width':
|
|
19
21
|
return _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
@@ -55,22 +57,21 @@ var Colgroup = function Colgroup(props) {
|
|
|
55
57
|
var columnWidths = props.columnWidths,
|
|
56
58
|
layout = props.layout,
|
|
57
59
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
58
|
-
renderWidth = props.renderWidth
|
|
60
|
+
renderWidth = props.renderWidth,
|
|
61
|
+
tableNode = props.tableNode;
|
|
59
62
|
if (!columnWidths || !isTableResized(columnWidths)) {
|
|
60
63
|
return null;
|
|
61
64
|
}
|
|
62
|
-
|
|
65
|
+
var tableContainerWidth;
|
|
66
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') && tableNode) {
|
|
67
|
+
tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
68
|
+
} else {
|
|
69
|
+
tableContainerWidth = getTableLayoutWidth(layout);
|
|
70
|
+
}
|
|
63
71
|
// @see ED-6056
|
|
64
|
-
var
|
|
65
|
-
containerWidth: renderWidth
|
|
66
|
-
});
|
|
67
|
-
var maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth;
|
|
68
|
-
|
|
69
|
-
// If table has a layout of default, it is confined by the defined column width.
|
|
70
|
-
// renderWidth is better used for breakout tables.
|
|
71
|
-
// @see ED-6737
|
|
72
|
+
var maxTableWidth = renderWidth < tableContainerWidth ? renderWidth : tableContainerWidth;
|
|
72
73
|
if (layout === 'default') {
|
|
73
|
-
renderWidth = Math.min(renderWidth,
|
|
74
|
+
renderWidth = Math.min(renderWidth, tableContainerWidth);
|
|
74
75
|
}
|
|
75
76
|
var tableWidth = isNumberColumnEnabled ? _editorSharedStyles.akEditorTableNumberColumnWidth : 0;
|
|
76
77
|
var minTableWidth = tableWidth;
|
|
@@ -13,7 +13,8 @@ var Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
13
13
|
columnWidths = _ref.columnWidths,
|
|
14
14
|
layout = _ref.layout,
|
|
15
15
|
renderWidth = _ref.renderWidth,
|
|
16
|
-
children = _ref.children
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
tableNode = _ref.tableNode;
|
|
17
18
|
return /*#__PURE__*/_react.default.createElement("table", {
|
|
18
19
|
"data-number-column": isNumberColumnEnabled,
|
|
19
20
|
ref: innerRef
|
|
@@ -21,7 +22,8 @@ var Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
21
22
|
columnWidths: columnWidths,
|
|
22
23
|
layout: layout,
|
|
23
24
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
24
|
-
renderWidth: renderWidth
|
|
25
|
+
renderWidth: renderWidth,
|
|
26
|
+
tableNode: tableNode
|
|
25
27
|
}), /*#__PURE__*/_react.default.createElement("tbody", null, children));
|
|
26
28
|
});
|
|
27
29
|
exports.Table = Table;
|
|
@@ -18,12 +18,14 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
18
18
|
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
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
|
+
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
21
24
|
var _style = require("../../ui/Renderer/style");
|
|
22
25
|
var _tableCell = require("./tableCell");
|
|
23
26
|
var _SmartCardStorage = require("../../ui/SmartCardStorage");
|
|
24
27
|
var _sticky = require("./table/sticky");
|
|
25
28
|
var _table = require("./table/table");
|
|
26
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
27
29
|
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); }; }
|
|
28
30
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
31
|
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
@@ -250,12 +252,18 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
250
252
|
renderWidth = _this$props.renderWidth,
|
|
251
253
|
columnWidths = _this$props.columnWidths,
|
|
252
254
|
stickyHeaders = _this$props.stickyHeaders,
|
|
253
|
-
tableNode = _this$props.tableNode
|
|
255
|
+
tableNode = _this$props.tableNode,
|
|
256
|
+
rendererAppearance = _this$props.rendererAppearance;
|
|
254
257
|
var stickyMode = this.state.stickyMode;
|
|
255
|
-
var tableWidth = (0, _styles.calcTableWidth)(layout, renderWidth, false);
|
|
256
258
|
var lineLength = _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
259
|
+
var tableWidth;
|
|
257
260
|
var left;
|
|
258
|
-
if (
|
|
261
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') && tableNode) {
|
|
262
|
+
tableWidth = Math.min((0, _nodeWidth.getTableContainerWidth)(tableNode), renderWidth);
|
|
263
|
+
} else {
|
|
264
|
+
tableWidth = (0, _styles.calcTableWidth)(layout, renderWidth, false);
|
|
265
|
+
}
|
|
266
|
+
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
259
267
|
left = lineLength / 2 - tableWidth / 2;
|
|
260
268
|
}
|
|
261
269
|
var wrapperWidth = this.wrapperRef.current ? this.wrapperRef.current.clientWidth : 0;
|
|
@@ -280,7 +288,7 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
280
288
|
ref: this.props.handleRef,
|
|
281
289
|
style: {
|
|
282
290
|
width: tableWidth,
|
|
283
|
-
left: left
|
|
291
|
+
left: left
|
|
284
292
|
}
|
|
285
293
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
286
294
|
className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
@@ -291,7 +299,8 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
291
299
|
columnWidths: columnWidths,
|
|
292
300
|
layout: layout,
|
|
293
301
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
294
|
-
renderWidth: renderWidth
|
|
302
|
+
renderWidth: renderWidth,
|
|
303
|
+
tableNode: tableNode
|
|
295
304
|
}, this.grabFirstRowRef(children)))));
|
|
296
305
|
}
|
|
297
306
|
}]);
|
|
@@ -55,7 +55,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
|
|
|
55
55
|
var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
56
56
|
exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "108.
|
|
58
|
+
var packageVersion = "108.2.0";
|
|
59
59
|
var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
|
@@ -12,6 +12,7 @@ var _components = require("@atlaskit/theme/components");
|
|
|
12
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
13
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
14
14
|
var _typography = require("@atlaskit/theme/typography");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
16
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
18
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -83,7 +84,7 @@ var fullWidthStyles = function fullWidthStyles(_ref5) {
|
|
|
83
84
|
if (appearance !== 'full-width') {
|
|
84
85
|
return '';
|
|
85
86
|
}
|
|
86
|
-
return (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .
|
|
87
|
+
return (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .ak-renderer-extension {\n width: 100% !important;\n }\n\n ", "\n "])), _editorSharedStyles.akEditorFullWidthLayoutWidth, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? '' : "\n .pm-table-container {\n width: 100% !important;\n }\n ");
|
|
87
88
|
};
|
|
88
89
|
var breakoutWidthStyle = function breakoutWidthStyle(useFragmentMarkBreakoutWidthStylingFix) {
|
|
89
90
|
if (useFragmentMarkBreakoutWidthStylingFix) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
6
|
// we allow scaling down column widths by no more than 30%
|
|
5
7
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
6
8
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
7
9
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
8
10
|
const MAX_SCALING_PERCENT = 0.3;
|
|
9
|
-
const getTableLayoutWidth =
|
|
11
|
+
const getTableLayoutWidth = layout => {
|
|
10
12
|
switch (layout) {
|
|
11
13
|
case 'full-width':
|
|
12
14
|
return akEditorFullWidthLayoutWidth;
|
|
@@ -47,23 +49,22 @@ export const Colgroup = props => {
|
|
|
47
49
|
columnWidths,
|
|
48
50
|
layout,
|
|
49
51
|
isNumberColumnEnabled,
|
|
50
|
-
renderWidth
|
|
52
|
+
renderWidth,
|
|
53
|
+
tableNode
|
|
51
54
|
} = props;
|
|
52
55
|
if (!columnWidths || !isTableResized(columnWidths)) {
|
|
53
56
|
return null;
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
let tableContainerWidth;
|
|
59
|
+
if (getBooleanFF('platform.editor.custom-table-width') && tableNode) {
|
|
60
|
+
tableContainerWidth = getTableContainerWidth(tableNode);
|
|
61
|
+
} else {
|
|
62
|
+
tableContainerWidth = getTableLayoutWidth(layout);
|
|
63
|
+
}
|
|
56
64
|
// @see ED-6056
|
|
57
|
-
const
|
|
58
|
-
containerWidth: renderWidth
|
|
59
|
-
});
|
|
60
|
-
const maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth;
|
|
61
|
-
|
|
62
|
-
// If table has a layout of default, it is confined by the defined column width.
|
|
63
|
-
// renderWidth is better used for breakout tables.
|
|
64
|
-
// @see ED-6737
|
|
65
|
+
const maxTableWidth = renderWidth < tableContainerWidth ? renderWidth : tableContainerWidth;
|
|
65
66
|
if (layout === 'default') {
|
|
66
|
-
renderWidth = Math.min(renderWidth,
|
|
67
|
+
renderWidth = Math.min(renderWidth, tableContainerWidth);
|
|
67
68
|
}
|
|
68
69
|
let tableWidth = isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0;
|
|
69
70
|
let minTableWidth = tableWidth;
|
|
@@ -6,7 +6,8 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
6
6
|
columnWidths,
|
|
7
7
|
layout,
|
|
8
8
|
renderWidth,
|
|
9
|
-
children
|
|
9
|
+
children,
|
|
10
|
+
tableNode
|
|
10
11
|
}) => {
|
|
11
12
|
return /*#__PURE__*/React.createElement("table", {
|
|
12
13
|
"data-number-column": isNumberColumnEnabled,
|
|
@@ -15,6 +16,7 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
15
16
|
columnWidths: columnWidths,
|
|
16
17
|
layout: layout,
|
|
17
18
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
18
|
-
renderWidth: renderWidth
|
|
19
|
+
renderWidth: renderWidth,
|
|
20
|
+
tableNode: tableNode
|
|
19
21
|
}), /*#__PURE__*/React.createElement("tbody", null, children));
|
|
20
22
|
});
|
|
@@ -5,12 +5,14 @@ import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlask
|
|
|
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
|
+
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
11
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
9
12
|
import { TableHeader } from './tableCell';
|
|
10
13
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
11
14
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
12
15
|
import { Table } from './table/table';
|
|
13
|
-
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
14
16
|
const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
|
|
15
17
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
16
18
|
return children;
|
|
@@ -206,15 +208,21 @@ export class TableContainer extends React.Component {
|
|
|
206
208
|
renderWidth,
|
|
207
209
|
columnWidths,
|
|
208
210
|
stickyHeaders,
|
|
209
|
-
tableNode
|
|
211
|
+
tableNode,
|
|
212
|
+
rendererAppearance
|
|
210
213
|
} = this.props;
|
|
211
214
|
const {
|
|
212
215
|
stickyMode
|
|
213
216
|
} = this.state;
|
|
214
|
-
let tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
215
217
|
const lineLength = akEditorDefaultLayoutWidth;
|
|
218
|
+
let tableWidth;
|
|
216
219
|
let left;
|
|
217
|
-
if (
|
|
220
|
+
if (getBooleanFF('platform.editor.custom-table-width') && tableNode) {
|
|
221
|
+
tableWidth = Math.min(getTableContainerWidth(tableNode), renderWidth);
|
|
222
|
+
} else {
|
|
223
|
+
tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
224
|
+
}
|
|
225
|
+
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
218
226
|
left = lineLength / 2 - tableWidth / 2;
|
|
219
227
|
}
|
|
220
228
|
const wrapperWidth = this.wrapperRef.current ? this.wrapperRef.current.clientWidth : 0;
|
|
@@ -239,7 +247,7 @@ export class TableContainer extends React.Component {
|
|
|
239
247
|
ref: this.props.handleRef,
|
|
240
248
|
style: {
|
|
241
249
|
width: tableWidth,
|
|
242
|
-
left
|
|
250
|
+
left
|
|
243
251
|
}
|
|
244
252
|
}, /*#__PURE__*/React.createElement("div", {
|
|
245
253
|
className: TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
@@ -250,7 +258,8 @@ export class TableContainer extends React.Component {
|
|
|
250
258
|
columnWidths: columnWidths,
|
|
251
259
|
layout: layout,
|
|
252
260
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
253
|
-
renderWidth: renderWidth
|
|
261
|
+
renderWidth: renderWidth,
|
|
262
|
+
tableNode: tableNode
|
|
254
263
|
}, this.grabFirstRowRef(children)))));
|
|
255
264
|
}
|
|
256
265
|
}
|
|
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
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 = "108.
|
|
38
|
+
const packageVersion = "108.2.0";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|
|
@@ -3,6 +3,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
3
3
|
import { fontFamily, fontSize } from '@atlaskit/theme/constants';
|
|
4
4
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
5
|
import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding, textColorStyles, codeBlockInListSafariFix } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { shadowClassNames } from '@atlaskit/editor-common/ui';
|
|
8
9
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
@@ -267,10 +268,15 @@ const fullWidthStyles = ({
|
|
|
267
268
|
margin: 0 auto;
|
|
268
269
|
|
|
269
270
|
.fabric-editor-breakout-mark,
|
|
270
|
-
.pm-table-container,
|
|
271
271
|
.ak-renderer-extension {
|
|
272
272
|
width: 100% !important;
|
|
273
273
|
}
|
|
274
|
+
|
|
275
|
+
${getBooleanFF('platform.editor.custom-table-width') ? '' : `
|
|
276
|
+
.pm-table-container {
|
|
277
|
+
width: 100% !important;
|
|
278
|
+
}
|
|
279
|
+
`}
|
|
274
280
|
`;
|
|
275
281
|
};
|
|
276
282
|
const breakoutWidthStyle = useFragmentMarkBreakoutWidthStylingFix => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -71,6 +71,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
71
71
|
"data-color": borderColor,
|
|
72
72
|
"data-size": borderWidth,
|
|
73
73
|
style: {
|
|
74
|
+
width: '100%',
|
|
75
|
+
height: '100%',
|
|
74
76
|
borderColor: paletteColorValue,
|
|
75
77
|
borderWidth: "".concat(borderWidth, "px"),
|
|
76
78
|
borderStyle: 'solid',
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
6
|
// we allow scaling down column widths by no more than 30%
|
|
5
7
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
6
8
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
7
9
|
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
8
10
|
var MAX_SCALING_PERCENT = 0.3;
|
|
9
|
-
var getTableLayoutWidth = function getTableLayoutWidth(layout
|
|
11
|
+
var getTableLayoutWidth = function getTableLayoutWidth(layout) {
|
|
10
12
|
switch (layout) {
|
|
11
13
|
case 'full-width':
|
|
12
14
|
return akEditorFullWidthLayoutWidth;
|
|
@@ -47,22 +49,21 @@ export var Colgroup = function Colgroup(props) {
|
|
|
47
49
|
var columnWidths = props.columnWidths,
|
|
48
50
|
layout = props.layout,
|
|
49
51
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
50
|
-
renderWidth = props.renderWidth
|
|
52
|
+
renderWidth = props.renderWidth,
|
|
53
|
+
tableNode = props.tableNode;
|
|
51
54
|
if (!columnWidths || !isTableResized(columnWidths)) {
|
|
52
55
|
return null;
|
|
53
56
|
}
|
|
54
|
-
|
|
57
|
+
var tableContainerWidth;
|
|
58
|
+
if (getBooleanFF('platform.editor.custom-table-width') && tableNode) {
|
|
59
|
+
tableContainerWidth = getTableContainerWidth(tableNode);
|
|
60
|
+
} else {
|
|
61
|
+
tableContainerWidth = getTableLayoutWidth(layout);
|
|
62
|
+
}
|
|
55
63
|
// @see ED-6056
|
|
56
|
-
var
|
|
57
|
-
containerWidth: renderWidth
|
|
58
|
-
});
|
|
59
|
-
var maxTableWidth = renderWidth < layoutWidth ? renderWidth : layoutWidth;
|
|
60
|
-
|
|
61
|
-
// If table has a layout of default, it is confined by the defined column width.
|
|
62
|
-
// renderWidth is better used for breakout tables.
|
|
63
|
-
// @see ED-6737
|
|
64
|
+
var maxTableWidth = renderWidth < tableContainerWidth ? renderWidth : tableContainerWidth;
|
|
64
65
|
if (layout === 'default') {
|
|
65
|
-
renderWidth = Math.min(renderWidth,
|
|
66
|
+
renderWidth = Math.min(renderWidth, tableContainerWidth);
|
|
66
67
|
}
|
|
67
68
|
var tableWidth = isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0;
|
|
68
69
|
var minTableWidth = tableWidth;
|
|
@@ -6,7 +6,8 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
6
6
|
columnWidths = _ref.columnWidths,
|
|
7
7
|
layout = _ref.layout,
|
|
8
8
|
renderWidth = _ref.renderWidth,
|
|
9
|
-
children = _ref.children
|
|
9
|
+
children = _ref.children,
|
|
10
|
+
tableNode = _ref.tableNode;
|
|
10
11
|
return /*#__PURE__*/React.createElement("table", {
|
|
11
12
|
"data-number-column": isNumberColumnEnabled,
|
|
12
13
|
ref: innerRef
|
|
@@ -14,6 +15,7 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
14
15
|
columnWidths: columnWidths,
|
|
15
16
|
layout: layout,
|
|
16
17
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
17
|
-
renderWidth: renderWidth
|
|
18
|
+
renderWidth: renderWidth,
|
|
19
|
+
tableNode: tableNode
|
|
18
20
|
}), /*#__PURE__*/React.createElement("tbody", null, children));
|
|
19
21
|
});
|
|
@@ -13,12 +13,14 @@ import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlask
|
|
|
13
13
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
15
15
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
16
|
+
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
17
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
18
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
16
19
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
17
20
|
import { TableHeader } from './tableCell';
|
|
18
21
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
19
22
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
20
23
|
import { Table } from './table/table';
|
|
21
|
-
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
22
24
|
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
23
25
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
24
26
|
return children;
|
|
@@ -243,12 +245,18 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
243
245
|
renderWidth = _this$props.renderWidth,
|
|
244
246
|
columnWidths = _this$props.columnWidths,
|
|
245
247
|
stickyHeaders = _this$props.stickyHeaders,
|
|
246
|
-
tableNode = _this$props.tableNode
|
|
248
|
+
tableNode = _this$props.tableNode,
|
|
249
|
+
rendererAppearance = _this$props.rendererAppearance;
|
|
247
250
|
var stickyMode = this.state.stickyMode;
|
|
248
|
-
var tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
249
251
|
var lineLength = akEditorDefaultLayoutWidth;
|
|
252
|
+
var tableWidth;
|
|
250
253
|
var left;
|
|
251
|
-
if (
|
|
254
|
+
if (getBooleanFF('platform.editor.custom-table-width') && tableNode) {
|
|
255
|
+
tableWidth = Math.min(getTableContainerWidth(tableNode), renderWidth);
|
|
256
|
+
} else {
|
|
257
|
+
tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
258
|
+
}
|
|
259
|
+
if (canUseLinelength(rendererAppearance) && tableWidth !== 'inherit' && tableWidth > lineLength) {
|
|
252
260
|
left = lineLength / 2 - tableWidth / 2;
|
|
253
261
|
}
|
|
254
262
|
var wrapperWidth = this.wrapperRef.current ? this.wrapperRef.current.clientWidth : 0;
|
|
@@ -273,7 +281,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
273
281
|
ref: this.props.handleRef,
|
|
274
282
|
style: {
|
|
275
283
|
width: tableWidth,
|
|
276
|
-
left: left
|
|
284
|
+
left: left
|
|
277
285
|
}
|
|
278
286
|
}, /*#__PURE__*/React.createElement("div", {
|
|
279
287
|
className: TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
@@ -284,7 +292,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
284
292
|
columnWidths: columnWidths,
|
|
285
293
|
layout: layout,
|
|
286
294
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
287
|
-
renderWidth: renderWidth
|
|
295
|
+
renderWidth: renderWidth,
|
|
296
|
+
tableNode: tableNode
|
|
288
297
|
}, this.grabFirstRowRef(children)))));
|
|
289
298
|
}
|
|
290
299
|
}]);
|
|
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
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 = "108.
|
|
48
|
+
var packageVersion = "108.2.0";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|
|
@@ -5,6 +5,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
5
5
|
import { fontFamily, fontSize } from '@atlaskit/theme/constants';
|
|
6
6
|
import * as colors from '@atlaskit/theme/colors';
|
|
7
7
|
import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { tableSharedStyle, columnLayoutSharedStyle, blockquoteSharedStyles, headingsSharedStyles, ruleSharedStyles, whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, mediaSingleSharedStyle, TableSharedCssClassName, tableMarginTop, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, richMediaClassName, tasksAndDecisionsStyles, smartCardSharedStyles, tableCellPadding, textColorStyles, codeBlockInListSafariFix } from '@atlaskit/editor-common/styles';
|
|
9
10
|
import { shadowClassNames } from '@atlaskit/editor-common/ui';
|
|
10
11
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
@@ -72,7 +73,7 @@ var fullWidthStyles = function fullWidthStyles(_ref5) {
|
|
|
72
73
|
if (appearance !== 'full-width') {
|
|
73
74
|
return '';
|
|
74
75
|
}
|
|
75
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .
|
|
76
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .ak-renderer-extension {\n width: 100% !important;\n }\n\n ", "\n "])), akEditorFullWidthLayoutWidth, getBooleanFF('platform.editor.custom-table-width') ? '' : "\n .pm-table-container {\n width: 100% !important;\n }\n ");
|
|
76
77
|
};
|
|
77
78
|
var breakoutWidthStyle = function breakoutWidthStyle(useFragmentMarkBreakoutWidthStylingFix) {
|
|
78
79
|
if (useFragmentMarkBreakoutWidthStylingFix) {
|
package/dist/esm/version.json
CHANGED
|
@@ -4,4 +4,4 @@ export type TableProps = SharedTableProps & {
|
|
|
4
4
|
innerRef?: React.RefObject<HTMLTableElement>;
|
|
5
5
|
children: React.ReactNode[];
|
|
6
6
|
};
|
|
7
|
-
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, }: TableProps) => JSX.Element>;
|
|
7
|
+
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, }: TableProps) => JSX.Element>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
1
2
|
import { TableLayout } from '@atlaskit/adf-schema';
|
|
2
3
|
export type SharedTableProps = {
|
|
3
4
|
columnWidths?: Array<number>;
|
|
4
5
|
layout: TableLayout;
|
|
5
6
|
isNumberColumnEnabled: boolean;
|
|
6
7
|
renderWidth: number;
|
|
8
|
+
tableNode?: PMNode;
|
|
7
9
|
};
|
|
@@ -4,4 +4,4 @@ export type TableProps = SharedTableProps & {
|
|
|
4
4
|
innerRef?: React.RefObject<HTMLTableElement>;
|
|
5
5
|
children: React.ReactNode[];
|
|
6
6
|
};
|
|
7
|
-
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, }: TableProps) => JSX.Element>;
|
|
7
|
+
export declare const Table: React.MemoExoticComponent<({ innerRef, isNumberColumnEnabled, columnWidths, layout, renderWidth, children, tableNode, }: TableProps) => JSX.Element>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
1
2
|
import { TableLayout } from '@atlaskit/adf-schema';
|
|
2
3
|
export type SharedTableProps = {
|
|
3
4
|
columnWidths?: Array<number>;
|
|
4
5
|
layout: TableLayout;
|
|
5
6
|
isNumberColumnEnabled: boolean;
|
|
6
7
|
renderWidth: number;
|
|
8
|
+
tableNode?: PMNode;
|
|
7
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "108.
|
|
3
|
+
"version": "108.2.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@atlaskit/visual-regression": "*",
|
|
97
97
|
"@atlaskit/webdriver-runner": "*",
|
|
98
98
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
99
|
+
"@atlassian/feature-flags-test-utils": "*",
|
|
99
100
|
"@testing-library/react": "^12.1.5",
|
|
100
101
|
"@types/prosemirror-model": "^1.11.0",
|
|
101
102
|
"@types/prosemirror-transform": "^1.1.0",
|
|
@@ -130,6 +131,9 @@
|
|
|
130
131
|
"platform-feature-flags": {
|
|
131
132
|
"platform.editor.sentry-error-monitoring_6bksu": {
|
|
132
133
|
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"platform.editor.custom-table-width": {
|
|
136
|
+
"type": "boolean"
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
}
|