@atlaskit/editor-plugin-table 7.6.13 → 7.7.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 +12 -0
- package/dist/cjs/commands/misc.js +0 -2
- package/dist/cjs/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/cjs/nodeviews/TableComponent.js +3 -18
- package/dist/cjs/nodeviews/TableContainer.js +2 -18
- package/dist/cjs/nodeviews/table.js +0 -2
- package/dist/cjs/plugin.js +3 -20
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -21
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/cjs/reducer.js +0 -2
- package/dist/cjs/transforms/column-width.js +3 -5
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +35 -8
- package/dist/cjs/ui/common-styles.js +5 -12
- package/dist/cjs/ui/ui-styles.js +7 -12
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/utils/nodes.js +5 -18
- package/dist/es2019/commands/misc.js +0 -2
- package/dist/es2019/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/es2019/nodeviews/TableComponent.js +3 -18
- package/dist/es2019/nodeviews/TableContainer.js +1 -16
- package/dist/es2019/nodeviews/table.js +0 -2
- package/dist/es2019/plugin.js +5 -24
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +8 -22
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +30 -53
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +14 -24
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/es2019/reducer.js +0 -5
- package/dist/es2019/transforms/column-width.js +3 -5
- package/dist/es2019/types.js +0 -1
- package/dist/es2019/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +30 -5
- package/dist/es2019/ui/common-styles.js +15 -46
- package/dist/es2019/ui/ui-styles.js +34 -41
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/nodes.js +0 -15
- package/dist/esm/commands/misc.js +0 -2
- package/dist/esm/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/esm/nodeviews/TableComponent.js +3 -18
- package/dist/esm/nodeviews/TableContainer.js +2 -18
- package/dist/esm/nodeviews/table.js +0 -2
- package/dist/esm/plugin.js +5 -22
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +8 -22
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/esm/reducer.js +0 -2
- package/dist/esm/transforms/column-width.js +3 -5
- package/dist/esm/types.js +0 -1
- package/dist/esm/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +35 -8
- package/dist/esm/ui/common-styles.js +6 -13
- package/dist/esm/ui/ui-styles.js +7 -12
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/nodes.js +0 -13
- package/dist/types/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types/nodeviews/types.d.ts +0 -1
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types/types.d.ts +0 -9
- package/dist/types/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -9
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
- package/package.json +6 -6
- package/src/commands/misc.ts +0 -2
- package/src/nodeviews/OverflowShadowsObserver.ts +1 -6
- package/src/nodeviews/TableComponent.tsx +2 -25
- package/src/nodeviews/TableContainer.tsx +2 -26
- package/src/nodeviews/table.tsx +0 -2
- package/src/nodeviews/types.ts +0 -1
- package/src/plugin.tsx +4 -43
- package/src/pm-plugins/main.ts +0 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +40 -61
- package/src/pm-plugins/table-resizing/utils/misc.ts +4 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -29
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +2 -13
- package/src/reducer.ts +0 -3
- package/src/transforms/column-width.ts +2 -10
- package/src/types.ts +0 -8
- package/src/ui/ColumnResizeWidget/index.tsx +10 -1
- package/src/ui/FloatingContextualButton/index.tsx +0 -2
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +39 -7
- package/src/ui/common-styles.ts +15 -53
- package/src/ui/ui-styles.ts +34 -47
- package/src/utils/index.ts +0 -1
- package/src/utils/nodes.ts +0 -23
- package/dist/cjs/ui/LayoutButton/index.js +0 -206
- package/dist/es2019/ui/LayoutButton/index.js +0 -168
- package/dist/esm/ui/LayoutButton/index.js +0 -196
- package/dist/types/ui/LayoutButton/index.d.ts +0 -21
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -21
- package/src/ui/LayoutButton/index.tsx +0 -217
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#86368](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86368) [`d07ec8d13230`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d07ec8d13230) - [ux] Remove the custom table width platform flag and remove Layout/Breakout button
|
|
8
|
+
|
|
9
|
+
## 7.6.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#89135](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89135) [`134b3db4945d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/134b3db4945d) - fix drag menu flicker issue
|
|
14
|
+
|
|
3
15
|
## 7.6.13
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -38,7 +38,6 @@ var setTableRef = exports.setTableRef = function setTableRef(ref) {
|
|
|
38
38
|
var tableNode = ref && foundTable ? foundTable.node : undefined;
|
|
39
39
|
var tablePos = ref && foundTable ? foundTable.pos : undefined;
|
|
40
40
|
var tableWrapperTarget = (0, _utils.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
|
|
41
|
-
var layout = tableNode ? tableNode.attrs.layout : undefined;
|
|
42
41
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
43
42
|
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
44
43
|
return {
|
|
@@ -48,7 +47,6 @@ var setTableRef = exports.setTableRef = function setTableRef(ref) {
|
|
|
48
47
|
tableNode: tableNode,
|
|
49
48
|
tablePos: tablePos,
|
|
50
49
|
tableWrapperTarget: tableWrapperTarget,
|
|
51
|
-
layout: layout || 'default',
|
|
52
50
|
isNumberColumnEnabled: (0, _nodes.checkIfNumberColumnEnabled)(state.selection),
|
|
53
51
|
isHeaderRowEnabled: (0, _nodes.checkIfHeaderRowEnabled)(state.selection),
|
|
54
52
|
isHeaderColumnEnabled: (0, _nodes.checkIfHeaderColumnEnabled)(state.selection),
|
|
@@ -9,9 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _types = require("../types");
|
|
14
|
-
var _consts = require("../ui/consts");
|
|
15
13
|
var _updateOverflowShadows = require("./update-overflow-shadows");
|
|
16
14
|
var OverflowShadowsObserver = exports.OverflowShadowsObserver = /*#__PURE__*/function () {
|
|
17
15
|
// updateShadowState is a method to update shadow key
|
|
@@ -43,7 +41,7 @@ var OverflowShadowsObserver = exports.OverflowShadowsObserver = /*#__PURE__*/fun
|
|
|
43
41
|
}, {
|
|
44
42
|
threshold: [0, 1],
|
|
45
43
|
root: _this.wrapper,
|
|
46
|
-
rootMargin:
|
|
44
|
+
rootMargin: '0px'
|
|
47
45
|
});
|
|
48
46
|
return;
|
|
49
47
|
}
|
|
@@ -135,16 +135,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
135
135
|
var node = getNode();
|
|
136
136
|
var prevAttrs = prevNode.attrs;
|
|
137
137
|
var isNested = (0, _utils5.isTableNested)(_this.props.view.state, _this.props.getPos());
|
|
138
|
-
// We only consider a layout change valid if it's done outside of an autoSize.
|
|
139
|
-
var layoutChanged = prevAttrs.layout !== node.attrs.layout && prevAttrs.__autoSize === node.attrs.__autoSize;
|
|
140
138
|
var parentWidth = _this.getParentNodeWidth();
|
|
141
139
|
var parentWidthChanged = parentWidth && parentWidth !== _this.state.parentWidth;
|
|
142
140
|
var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
|
|
143
141
|
var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
|
|
144
142
|
var noOfColumnsChanged = (0, _utils5.tablesHaveDifferentNoOfColumns)(node, prevNode);
|
|
145
143
|
if (
|
|
146
|
-
// Breakout mode/layout changed
|
|
147
|
-
layoutChanged ||
|
|
148
144
|
// We need to react if our parent changes
|
|
149
145
|
// Scales the cols widths relative to the new parent width.
|
|
150
146
|
parentWidthChanged ||
|
|
@@ -158,8 +154,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
158
154
|
// If column has been inserted/deleted avoid multi dispatch
|
|
159
155
|
if (shouldScaleTable) {
|
|
160
156
|
_this.scaleTable({
|
|
161
|
-
parentWidth: parentWidth
|
|
162
|
-
layoutChanged: layoutChanged
|
|
157
|
+
parentWidth: parentWidth
|
|
163
158
|
});
|
|
164
159
|
}
|
|
165
160
|
|
|
@@ -167,8 +162,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
167
162
|
if (options !== null && options !== void 0 && options.isTableResizingEnabled && hasNumberedColumnChanged) {
|
|
168
163
|
if (!(0, _colgroup.hasTableBeenResized)(prevNode)) {
|
|
169
164
|
_this.scaleTable({
|
|
170
|
-
parentWidth: node.attrs.width
|
|
171
|
-
layoutChanged: layoutChanged
|
|
165
|
+
parentWidth: node.attrs.width
|
|
172
166
|
});
|
|
173
167
|
}
|
|
174
168
|
}
|
|
@@ -246,21 +240,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
246
240
|
}
|
|
247
241
|
});
|
|
248
242
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResize", function () {
|
|
249
|
-
var _node$attrs, _node$attrs2;
|
|
250
243
|
var _this$props5 = _this.props,
|
|
251
244
|
getNode = _this$props5.getNode,
|
|
252
245
|
containerWidth = _this$props5.containerWidth;
|
|
253
246
|
var node = getNode();
|
|
254
|
-
var prevNode = _this.node;
|
|
255
247
|
var layoutSize = _this.tableNodeLayoutSize(node);
|
|
256
|
-
var prevAttrs = prevNode === null || prevNode === void 0 ? void 0 : prevNode.attrs;
|
|
257
|
-
var layoutChanged = (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.layout) !== (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) && (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.__autoSize) === (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.__autoSize);
|
|
258
248
|
if (containerWidth.width > layoutSize) {
|
|
259
249
|
return;
|
|
260
250
|
}
|
|
261
251
|
var parentWidth = _this.getParentNodeWidth();
|
|
262
252
|
_this.scaleTableDebounced({
|
|
263
|
-
layoutChanged: layoutChanged,
|
|
264
253
|
parentWidth: parentWidth
|
|
265
254
|
});
|
|
266
255
|
});
|
|
@@ -713,7 +702,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
713
702
|
node: node,
|
|
714
703
|
tableRef: tableRef,
|
|
715
704
|
containerWidth: containerWidth,
|
|
716
|
-
isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
|
|
717
705
|
isNested: isNested,
|
|
718
706
|
pluginInjectionApi: pluginInjectionApi,
|
|
719
707
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
@@ -784,10 +772,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
784
772
|
}), this.state.stickyHeader && /*#__PURE__*/_react.default.createElement("div", {
|
|
785
773
|
style: {
|
|
786
774
|
position: 'absolute',
|
|
787
|
-
right:
|
|
788
|
-
:
|
|
789
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
790
|
-
'22px'
|
|
775
|
+
right: "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
|
|
791
776
|
}
|
|
792
777
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
793
778
|
className: "".concat(_types.TableCssClassName.TABLE_RIGHT_SHADOW, " ").concat(_types.TableCssClassName.TABLE_STICKY_SHADOW),
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
14
14
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
15
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
16
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _utils = require("../pm-plugins/table-resizing/utils");
|
|
@@ -22,16 +21,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
22
21
|
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; }
|
|
23
22
|
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; }
|
|
24
23
|
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; }
|
|
25
|
-
var getMarginLeft = function getMarginLeft(lineLength, tableWidth) {
|
|
26
|
-
var marginLeft;
|
|
27
|
-
if (tableWidth !== 'inherit' && lineLength) {
|
|
28
|
-
var containerWidth = tableWidth;
|
|
29
|
-
if (containerWidth) {
|
|
30
|
-
marginLeft = (lineLength - containerWidth) / 2;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return marginLeft;
|
|
34
|
-
};
|
|
35
24
|
var InnerContainer = exports.InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
36
25
|
var className = _ref.className,
|
|
37
26
|
style = _ref.style,
|
|
@@ -174,11 +163,8 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref3) {
|
|
|
174
163
|
var children = _ref3.children,
|
|
175
164
|
node = _ref3.node,
|
|
176
165
|
className = _ref3.className,
|
|
177
|
-
|
|
178
|
-
lineLength = _ref3$containerWidth.lineLength,
|
|
179
|
-
editorWidth = _ref3$containerWidth.width,
|
|
166
|
+
editorWidth = _ref3.containerWidth.width,
|
|
180
167
|
isTableResizingEnabled = _ref3.isTableResizingEnabled,
|
|
181
|
-
isBreakoutEnabled = _ref3.isBreakoutEnabled,
|
|
182
168
|
editorView = _ref3.editorView,
|
|
183
169
|
getPos = _ref3.getPos,
|
|
184
170
|
tableRef = _ref3.tableRef,
|
|
@@ -203,15 +189,13 @@ var TableContainer = exports.TableContainer = function TableContainer(_ref3) {
|
|
|
203
189
|
isWholeTableInDanger: isWholeTableInDanger
|
|
204
190
|
}, children);
|
|
205
191
|
}
|
|
206
|
-
var tableWidth = isBreakoutEnabled ? (0, _styles.calcTableWidth)(node.attrs.layout, editorWidth) : 'inherit';
|
|
207
192
|
return /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
208
193
|
node: node,
|
|
209
194
|
className: (0, _classnames.default)(className, {
|
|
210
195
|
'less-padding': editorWidth < _editorSharedStyles.akEditorMobileBreakoutPoint && !isNested
|
|
211
196
|
}),
|
|
212
197
|
style: {
|
|
213
|
-
width:
|
|
214
|
-
marginLeft: getMarginLeft(lineLength, tableWidth)
|
|
198
|
+
width: 'inherit'
|
|
215
199
|
}
|
|
216
200
|
}, children);
|
|
217
201
|
};
|
|
@@ -279,7 +279,6 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
279
279
|
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi) {
|
|
280
280
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
281
281
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
282
|
-
isBreakoutEnabled = _getPluginState2.isBreakoutEnabled,
|
|
283
282
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
284
283
|
wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
|
|
285
284
|
isTableResizingEnabled = _getPluginState2.isTableResizingEnabled,
|
|
@@ -298,7 +297,6 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
298
297
|
eventDispatcher: eventDispatcher,
|
|
299
298
|
getPos: getPos,
|
|
300
299
|
options: {
|
|
301
|
-
isBreakoutEnabled: isBreakoutEnabled,
|
|
302
300
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
303
301
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
304
302
|
isTableResizingEnabled: isTableResizingEnabled,
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -40,7 +40,6 @@ var _FloatingContextualMenu = _interopRequireDefault(require("./ui/FloatingConte
|
|
|
40
40
|
var _FloatingDeleteButton = _interopRequireDefault(require("./ui/FloatingDeleteButton"));
|
|
41
41
|
var _FloatingDragMenu = _interopRequireDefault(require("./ui/FloatingDragMenu"));
|
|
42
42
|
var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertButton"));
|
|
43
|
-
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
44
43
|
var _utils2 = require("./utils");
|
|
45
44
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
46
45
|
return {};
|
|
@@ -117,10 +116,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
117
116
|
insertTableWithSize: (0, _insert.insertTableWithSize)(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
118
117
|
},
|
|
119
118
|
nodes: function nodes() {
|
|
120
|
-
var tableNode = options !== null && options !== void 0 && options.tableResizingEnabled ? _adfSchema.tableWithCustomWidth : _adfSchema.table;
|
|
121
119
|
return [{
|
|
122
120
|
name: 'table',
|
|
123
|
-
node:
|
|
121
|
+
node: _adfSchema.table
|
|
124
122
|
}, {
|
|
125
123
|
name: 'tableHeader',
|
|
126
124
|
node: _adfSchema.tableHeader
|
|
@@ -145,12 +143,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
145
143
|
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
146
144
|
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
147
145
|
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
148
|
-
breakoutEnabled = _ref3.breakoutEnabled,
|
|
149
146
|
tableOptions = _ref3.tableOptions,
|
|
150
147
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
151
148
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
152
149
|
isTableScalingEnabled = _ref3.isTableScalingEnabled;
|
|
153
|
-
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl,
|
|
150
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled);
|
|
154
151
|
}
|
|
155
152
|
}, {
|
|
156
153
|
name: 'tablePMColResizing',
|
|
@@ -312,7 +309,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
312
309
|
tablePluginState = _ref17.tablePluginState,
|
|
313
310
|
tableWidthPluginState = _ref17.tableWidthPluginState,
|
|
314
311
|
dragAndDropState = _ref17.dragAndDropState;
|
|
315
|
-
var state = editorView.state;
|
|
316
312
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
317
313
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
318
314
|
var isResizing = isColumnResizing || isTableResizing;
|
|
@@ -321,7 +317,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
321
317
|
tablePos = _ref18.tablePos,
|
|
322
318
|
targetCellPosition = _ref18.targetCellPosition,
|
|
323
319
|
isContextualMenuOpen = _ref18.isContextualMenuOpen,
|
|
324
|
-
layout = _ref18.layout,
|
|
325
320
|
tableRef = _ref18.tableRef,
|
|
326
321
|
pluginConfig = _ref18.pluginConfig,
|
|
327
322
|
insertColumnButtonIndex = _ref18.insertColumnButtonIndex,
|
|
@@ -332,17 +327,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
332
327
|
tableWrapperTarget = _ref18.tableWrapperTarget;
|
|
333
328
|
var allowControls = pluginConfig.allowControls;
|
|
334
329
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
335
|
-
var LayoutContent = options && !options.tableResizingEnabled && (0, _utils2.isLayoutSupported)(state) && options.breakoutEnabled ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
336
|
-
editorView: editorView,
|
|
337
|
-
mountPoint: popupsMountPoint,
|
|
338
|
-
boundariesElement: popupsBoundariesElement,
|
|
339
|
-
scrollableElement: popupsScrollableElement,
|
|
340
|
-
targetRef: tableWrapperTarget,
|
|
341
|
-
layout: layout,
|
|
342
|
-
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
343
|
-
stickyHeader: stickyHeader,
|
|
344
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
345
|
-
}) : null;
|
|
346
330
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
347
331
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
348
332
|
editorView: editorView,
|
|
@@ -352,7 +336,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
352
336
|
scrollableElement: popupsScrollableElement,
|
|
353
337
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
354
338
|
isContextualMenuOpen: isContextualMenuOpen,
|
|
355
|
-
layout: layout,
|
|
356
339
|
stickyHeader: stickyHeader,
|
|
357
340
|
tableWrapper: tableWrapperTarget
|
|
358
341
|
}), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingInsertButton.default, {
|
|
@@ -405,7 +388,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
405
388
|
stickyHeaders: stickyHeader,
|
|
406
389
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
407
390
|
editorAnalyticsAPI: editorAnalyticsAPI
|
|
408
|
-
})
|
|
391
|
+
}));
|
|
409
392
|
}
|
|
410
393
|
}));
|
|
411
394
|
},
|
|
@@ -32,7 +32,7 @@ var _pluginFactory = require("./plugin-factory");
|
|
|
32
32
|
var _pluginKey = require("./plugin-key");
|
|
33
33
|
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; }
|
|
34
34
|
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; }
|
|
35
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl,
|
|
35
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) {
|
|
36
36
|
var _accessibilityUtils;
|
|
37
37
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
38
38
|
pluginConfig: pluginConfig,
|
|
@@ -40,7 +40,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
40
40
|
insertColumnButtonIndex: undefined,
|
|
41
41
|
insertRowButtonIndex: undefined,
|
|
42
42
|
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
43
|
-
isBreakoutEnabled: breakoutEnabled,
|
|
44
43
|
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
45
44
|
isTableResizingEnabled: tableResizingEnabled,
|
|
46
45
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.handleMouseDown = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
-
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
9
8
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
9
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -50,25 +48,13 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
50
48
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
51
49
|
dom = dom.closest('table');
|
|
52
50
|
}
|
|
53
|
-
var maxSize
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (originalTable.attrs.isNumberColumnEnabled) {
|
|
61
|
-
maxSize -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
maxSize = (0, _utils3.getTableMaxWidth)({
|
|
65
|
-
table: originalTable,
|
|
66
|
-
tableStart: start,
|
|
67
|
-
state: state,
|
|
68
|
-
layout: originalTable.attrs.layout,
|
|
69
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
70
|
-
});
|
|
71
|
-
}
|
|
51
|
+
var maxSize = (0, _utils3.getTableMaxWidth)({
|
|
52
|
+
table: originalTable,
|
|
53
|
+
tableStart: start,
|
|
54
|
+
state: state,
|
|
55
|
+
layout: originalTable.attrs.layout,
|
|
56
|
+
getEditorContainerWidth: getEditorContainerWidth
|
|
57
|
+
});
|
|
72
58
|
var shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
73
59
|
var resizeState = (0, _utils3.getResizeState)({
|
|
74
60
|
minWidth: _styles.tableCellMinWidth,
|
|
@@ -10,7 +10,6 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
12
12
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _misc = require("./misc");
|
|
15
14
|
/**
|
|
16
15
|
* This ensures the combined width of the columns (and tbody) of table is always smaller or equal
|
|
@@ -23,66 +22,42 @@ var getColWidthFix = exports.getColWidthFix = function getColWidthFix(colwidth,
|
|
|
23
22
|
};
|
|
24
23
|
var generateColgroup = exports.generateColgroup = function generateColgroup(table, tableRef) {
|
|
25
24
|
var cols = [];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var scalePercent = (0, _misc.getTableScalingPercent)(table, tableRef);
|
|
35
|
-
cell.attrs.colwidth.slice(0, colspan).forEach(function (width) {
|
|
36
|
-
var fixedColWidth = getColWidthFix(width, map.width);
|
|
37
|
-
var scaledWidth = fixedColWidth * scalePercent;
|
|
38
|
-
var finalWidth = Math.max(scaledWidth, _styles.tableCellMinWidth);
|
|
39
|
-
cols.push(['col', {
|
|
40
|
-
style: "width: ".concat(finalWidth, "px;")
|
|
41
|
-
}]);
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
cell.attrs.colwidth.slice(0, colspan).forEach(function (width) {
|
|
45
|
-
cols.push(['col', {
|
|
46
|
-
style: "width: ".concat(getColWidthFix(width ? Math.max(width, _styles.tableCellMinWidth) : _styles.tableCellMinWidth, map.width), "px;")
|
|
47
|
-
}]);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
// When we have merged cells on the first row (firstChild),
|
|
52
|
-
// We want to ensure we're creating the appropriate amount of
|
|
53
|
-
// cols the table still has.
|
|
54
|
-
cols.push.apply(cols, (0, _toConsumableArray2.default)(Array.from({
|
|
55
|
-
length: colspan
|
|
56
|
-
}, function (_) {
|
|
57
|
-
return ['col', {
|
|
58
|
-
style: "width: ".concat(_styles.tableCellMinWidth, "px;")
|
|
59
|
-
}];
|
|
60
|
-
})));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
table.content.firstChild.content.forEach(function (cell) {
|
|
65
|
-
var colspan = cell.attrs.colspan || 1;
|
|
66
|
-
if (Array.isArray(cell.attrs.colwidth)) {
|
|
67
|
-
// We slice here to guard against our colwidth array having more entries
|
|
68
|
-
// Than the we actually span. We'll patch the document at a later point.
|
|
25
|
+
var map = _tableMap.TableMap.get(table);
|
|
26
|
+
table.content.firstChild.content.forEach(function (cell) {
|
|
27
|
+
var colspan = cell.attrs.colspan || 1;
|
|
28
|
+
if (Array.isArray(cell.attrs.colwidth)) {
|
|
29
|
+
// We slice here to guard against our colwidth array having more entries
|
|
30
|
+
// Than the we actually span. We'll patch the document at a later point.
|
|
31
|
+
if (tableRef) {
|
|
32
|
+
var scalePercent = (0, _misc.getTableScalingPercent)(table, tableRef);
|
|
69
33
|
cell.attrs.colwidth.slice(0, colspan).forEach(function (width) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
34
|
+
var fixedColWidth = getColWidthFix(width, map.width);
|
|
35
|
+
var scaledWidth = fixedColWidth * scalePercent;
|
|
36
|
+
var finalWidth = Math.max(scaledWidth, _styles.tableCellMinWidth);
|
|
37
|
+
cols.push(['col', {
|
|
38
|
+
style: "width: ".concat(finalWidth, "px;")
|
|
39
|
+
}]);
|
|
73
40
|
});
|
|
74
41
|
} else {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, function (_) {
|
|
81
|
-
return ['col', {}];
|
|
82
|
-
})));
|
|
42
|
+
cell.attrs.colwidth.slice(0, colspan).forEach(function (width) {
|
|
43
|
+
cols.push(['col', {
|
|
44
|
+
style: "width: ".concat(getColWidthFix(width ? Math.max(width, _styles.tableCellMinWidth) : _styles.tableCellMinWidth, map.width), "px;")
|
|
45
|
+
}]);
|
|
46
|
+
});
|
|
83
47
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
48
|
+
} else {
|
|
49
|
+
// When we have merged cells on the first row (firstChild),
|
|
50
|
+
// We want to ensure we're creating the appropriate amount of
|
|
51
|
+
// cols the table still has.
|
|
52
|
+
cols.push.apply(cols, (0, _toConsumableArray2.default)(Array.from({
|
|
53
|
+
length: colspan
|
|
54
|
+
}, function (_) {
|
|
55
|
+
return ['col', {
|
|
56
|
+
style: "width: ".concat(_styles.tableCellMinWidth, "px;")
|
|
57
|
+
}];
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
86
61
|
return cols;
|
|
87
62
|
};
|
|
88
63
|
var insertColgroupFromNode = exports.insertColgroupFromNode = function insertColgroupFromNode(tableRef, table) {
|
|
@@ -14,7 +14,6 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
14
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _colgroup = require("./colgroup");
|
|
19
18
|
var _consts = require("./consts");
|
|
20
19
|
// Translates named layouts in number values.
|
|
@@ -77,7 +76,7 @@ var getTableMaxWidth = exports.getTableMaxWidth = function getTableMaxWidth(_ref
|
|
|
77
76
|
getEditorContainerWidth = _ref2.getEditorContainerWidth;
|
|
78
77
|
var containerWidth = getEditorContainerWidth();
|
|
79
78
|
var parentWidth = (0, _nodeWidth.getParentNodeWidth)(tableStart, state, containerWidth);
|
|
80
|
-
var maxWidth =
|
|
79
|
+
var maxWidth = parentWidth || table.attrs.width || getLayoutSize(layout, containerWidth.width, {});
|
|
81
80
|
if (table.attrs.isNumberColumnEnabled) {
|
|
82
81
|
maxWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
83
82
|
}
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _utils2 = require("../../../utils");
|
|
14
13
|
var _colgroup = require("./colgroup");
|
|
15
14
|
var _columnState = require("./column-state");
|
|
@@ -94,39 +93,28 @@ var getResizeState = exports.getResizeState = function getResizeState(_ref) {
|
|
|
94
93
|
// updates Colgroup DOM node with new widths
|
|
95
94
|
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled) {
|
|
96
95
|
var cols = tableRef.querySelectorAll('col');
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
state.cols.filter(function (column) {
|
|
115
|
-
return column && !!column.width;
|
|
116
|
-
}) // if width is 0, we dont want to apply that.
|
|
117
|
-
.forEach(function (column, i) {
|
|
118
|
-
if (cols[i]) {
|
|
119
|
-
cols[i].style.width = "".concat((0, _colgroup.getColWidthFix)(column.width, columnsCount), "px");
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
96
|
+
var columnsCount = cols.length;
|
|
97
|
+
if (isTableScalingEnabled && tableNode) {
|
|
98
|
+
var scalePercent = (0, _misc.getTableScalingPercent)(tableNode, tableRef);
|
|
99
|
+
state.cols.filter(function (column) {
|
|
100
|
+
return column && !!column.width;
|
|
101
|
+
}) // if width is 0, we dont want to apply that.
|
|
102
|
+
.forEach(function (column, i) {
|
|
103
|
+
var fixedColWidth = (0, _colgroup.getColWidthFix)(column.width, columnsCount);
|
|
104
|
+
var scaledWidth = fixedColWidth * scalePercent;
|
|
105
|
+
var finalWidth = Math.max(scaledWidth, _styles.tableCellMinWidth);
|
|
106
|
+
// we aren't handling the remaining pixels here when the 48px min width is reached
|
|
107
|
+
if (cols[i]) {
|
|
108
|
+
cols[i].style.width = "".concat(finalWidth, "px");
|
|
109
|
+
}
|
|
110
|
+
});
|
|
123
111
|
} else {
|
|
124
112
|
state.cols.filter(function (column) {
|
|
125
113
|
return column && !!column.width;
|
|
126
114
|
}) // if width is 0, we dont want to apply that.
|
|
127
115
|
.forEach(function (column, i) {
|
|
128
116
|
if (cols[i]) {
|
|
129
|
-
cols[i].style.width = "".concat(column.width, "px");
|
|
117
|
+
cols[i].style.width = "".concat((0, _colgroup.getColWidthFix)(column.width, columnsCount), "px");
|
|
130
118
|
}
|
|
131
119
|
});
|
|
132
120
|
}
|
|
@@ -24,26 +24,16 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
24
24
|
// Will only resize/scale if a table has been previously resized.
|
|
25
25
|
var scale = exports.scale = function scale(tableRef, options, domAtPos) {
|
|
26
26
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
27
|
-
/**
|
|
28
|
-
* isBreakoutEnabled === true -> default center aligned
|
|
29
|
-
* isBreakoutEnabled === false -> full width mode
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
27
|
var node = options.node,
|
|
33
28
|
containerWidth = options.containerWidth,
|
|
34
29
|
previousContainerWidth = options.previousContainerWidth,
|
|
35
30
|
prevNode = options.prevNode,
|
|
36
31
|
start = options.start,
|
|
37
|
-
isBreakoutEnabled = options.isBreakoutEnabled,
|
|
38
32
|
layoutChanged = options.layoutChanged,
|
|
39
33
|
isTableResizingEnabled = options.isTableResizingEnabled;
|
|
40
|
-
var maxSize = isTableResizingEnabled ? (0, _nodeWidth.getTableContainerWidth)(node) : (0, _misc.getLayoutSize)(node.attrs.layout, containerWidth, {
|
|
41
|
-
isBreakoutEnabled: isBreakoutEnabled
|
|
42
|
-
});
|
|
34
|
+
var maxSize = isTableResizingEnabled ? (0, _nodeWidth.getTableContainerWidth)(node) : (0, _misc.getLayoutSize)(node.attrs.layout, containerWidth, {});
|
|
43
35
|
var prevTableWidth = (0, _utils.getTableWidth)(prevNode);
|
|
44
|
-
var previousMaxSize = isTableResizingEnabled ? (0, _nodeWidth.getTableContainerWidth)(node) : (0, _misc.getLayoutSize)(prevNode.attrs.layout, previousContainerWidth, {
|
|
45
|
-
isBreakoutEnabled: isBreakoutEnabled
|
|
46
|
-
});
|
|
36
|
+
var previousMaxSize = isTableResizingEnabled ? (0, _nodeWidth.getTableContainerWidth)(node) : (0, _misc.getLayoutSize)(prevNode.attrs.layout, previousContainerWidth, {});
|
|
47
37
|
var newWidth = maxSize;
|
|
48
38
|
|
|
49
39
|
// adjust table width if layout is updated
|
package/dist/cjs/reducer.js
CHANGED
|
@@ -29,8 +29,6 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
29
29
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
30
30
|
isContextualMenuOpen: false
|
|
31
31
|
});
|
|
32
|
-
case 'SET_TABLE_LAYOUT':
|
|
33
|
-
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
34
32
|
case 'TOGGLE_CONTEXTUAL_MENU':
|
|
35
33
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
36
34
|
isContextualMenuOpen: !pluginState.isContextualMenuOpen
|
|
@@ -9,12 +9,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _utils = require("../pm-plugins/table-resizing/utils");
|
|
14
13
|
var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
15
14
|
var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
|
|
16
15
|
var _scaleTable = require("../pm-plugins/table-resizing/utils/scale-table");
|
|
17
|
-
var _commonStyles = require("../ui/common-styles");
|
|
18
16
|
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; }
|
|
19
17
|
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; }
|
|
20
18
|
/**
|
|
@@ -122,16 +120,16 @@ var rescaleColumns = exports.rescaleColumns = function rescaleColumns() {
|
|
|
122
120
|
if (shouldScale) {
|
|
123
121
|
previousTableInfo = {
|
|
124
122
|
width: (0, _utils.getTableElementWidth)(table.node),
|
|
125
|
-
possibleMaxWidth: (0,
|
|
123
|
+
possibleMaxWidth: (0, _utils.getTableContainerElementWidth)(table.node),
|
|
126
124
|
isResized: isResized
|
|
127
125
|
};
|
|
128
126
|
} else {
|
|
129
|
-
var _tableRef$parentEleme
|
|
127
|
+
var _tableRef$parentEleme;
|
|
130
128
|
previousTableInfo = {
|
|
131
129
|
// when table is resized the tableRef client width will be 1px larger than colGroup, which is used in calculations
|
|
132
130
|
width: isResized ? tableRef.clientWidth - 1 : tableRef.clientWidth,
|
|
133
131
|
/** the is the width the table can reach before overflowing */
|
|
134
|
-
possibleMaxWidth: (
|
|
132
|
+
possibleMaxWidth: (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0,
|
|
135
133
|
isResized: isResized
|
|
136
134
|
};
|
|
137
135
|
}
|
package/dist/cjs/types.js
CHANGED
|
@@ -77,7 +77,6 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
|
|
|
77
77
|
CONTROLS_INSERT_BUTTON_WRAP: "".concat(_adfSchema.tablePrefixSelector, "-controls__insert-button-wrap"),
|
|
78
78
|
CONTROLS_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-controls__insert-line"),
|
|
79
79
|
CONTROLS_BUTTON_OVERLAY: "".concat(_adfSchema.tablePrefixSelector, "-controls__button-overlay"),
|
|
80
|
-
LAYOUT_BUTTON: "".concat(_adfSchema.tablePrefixSelector, "-layout-button"),
|
|
81
80
|
DRAG_CONTROLS_INSERT_BUTTON: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button"),
|
|
82
81
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner"),
|
|
83
82
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-controls__drag-insert-button-inner-column"),
|