@atlaskit/editor-plugin-table 7.31.3 → 8.1.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 +96 -0
- package/dist/cjs/commands/column-resize.js +3 -2
- package/dist/cjs/commands/hover.js +5 -3
- package/dist/cjs/event-handlers.js +12 -1
- package/dist/cjs/nodeviews/TableComponent.js +18 -15
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +2 -3
- package/dist/cjs/nodeviews/table.js +16 -12
- package/dist/cjs/plugin.js +21 -26
- package/dist/cjs/pm-plugins/main.js +3 -5
- package/dist/cjs/toolbar.js +1 -1
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/ui/common-styles.js +2 -2
- package/dist/cjs/ui/ui-styles.js +6 -9
- package/dist/cjs/utils/decoration.js +2 -2
- package/dist/es2019/commands/column-resize.js +3 -2
- package/dist/es2019/commands/hover.js +11 -6
- package/dist/es2019/event-handlers.js +12 -1
- package/dist/es2019/nodeviews/TableComponent.js +18 -15
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +2 -3
- package/dist/es2019/nodeviews/table.js +16 -12
- package/dist/es2019/plugin.js +21 -24
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/toolbar.js +1 -1
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/ui/common-styles.js +4 -4
- package/dist/es2019/ui/ui-styles.js +36 -29
- package/dist/es2019/utils/decoration.js +2 -2
- package/dist/esm/commands/column-resize.js +3 -2
- package/dist/esm/commands/hover.js +5 -3
- package/dist/esm/event-handlers.js +12 -1
- package/dist/esm/nodeviews/TableComponent.js +18 -15
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/esm/nodeviews/lazy-node-views.js +2 -3
- package/dist/esm/nodeviews/table.js +16 -12
- package/dist/esm/plugin.js +21 -26
- package/dist/esm/pm-plugins/main.js +3 -5
- package/dist/esm/toolbar.js +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/ui/common-styles.js +2 -2
- package/dist/esm/ui/ui-styles.js +6 -9
- package/dist/esm/utils/decoration.js +2 -2
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +2 -1
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +3 -1
- package/dist/types/nodeviews/lazy-node-views.d.ts +0 -1
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +2 -2
- package/dist/types/plugin.d.ts +1 -3
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/types.d.ts +4 -1
- package/dist/types/ui/ui-styles.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +1 -1
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +2 -2
- package/dist/types-ts4.5/plugin.d.ts +1 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +4 -1
- package/dist/types-ts4.5/ui/ui-styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +1 -1
- package/package.json +5 -5
- package/src/commands/column-resize.ts +8 -3
- package/src/commands/hover.ts +14 -10
- package/src/event-handlers.ts +16 -1
- package/src/nodeviews/TableComponent.tsx +22 -16
- package/src/nodeviews/TableComponentWithSharedState.tsx +6 -1
- package/src/nodeviews/lazy-node-views.ts +0 -4
- package/src/nodeviews/table.tsx +13 -8
- package/src/nodeviews/types.ts +2 -2
- package/src/plugin.tsx +24 -31
- package/src/pm-plugins/main.ts +2 -6
- package/src/toolbar.tsx +1 -1
- package/src/types.ts +5 -1
- package/src/ui/common-styles.ts +1 -1
- package/src/ui/ui-styles.ts +36 -29
- package/src/utils/decoration.ts +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 8.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#166753](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166753)
|
|
8
|
+
[`41dc866b96d84`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/41dc866b96d84) -
|
|
9
|
+
Use drag and drop classname for column resizing line when enabled, this avoids passing in feature
|
|
10
|
+
flag props to styles
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 8.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- [#162935](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162935)
|
|
21
|
+
[`48011dc10467a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/48011dc10467a) -
|
|
22
|
+
Removed `tablesPlugin` property and its child properties of `tableResizingEnabled` and
|
|
23
|
+
`isTableAlignmentEnabled` from `InitialPluginConfiguration`, and added these options as part of
|
|
24
|
+
tablePlugin.tableOptions configuration instead. The new options for each are allowTableResizing
|
|
25
|
+
and allowTableAlignment respectively and can be configured on the Editor component via
|
|
26
|
+
`allowTables` or via preset configurations.
|
|
27
|
+
|
|
28
|
+
**Warning**: Both these features require ADF storage to persist these changes.
|
|
29
|
+
|
|
30
|
+
### WHY?
|
|
31
|
+
|
|
32
|
+
To make these table features available for consumers who have no adopted composable editor and
|
|
33
|
+
want to enable table resizing and table alignment features
|
|
34
|
+
|
|
35
|
+
### WHAT changed?
|
|
36
|
+
|
|
37
|
+
**Removed** `InitialPluginConfiguration` type: Removed `tablePlugin` and child properties -
|
|
38
|
+
`isTableAlignmentEnabled`, `tableResizingEnabled`
|
|
39
|
+
|
|
40
|
+
**Added** `TableOptions` type: Added `allowTableResizing` and `allowTableAlignment`
|
|
41
|
+
|
|
42
|
+
### HOW to resolve?
|
|
43
|
+
|
|
44
|
+
Move the options from `initialPluginConfiguration` to `tableOptions`
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
Before
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const universalPreset = useUniversalPreset([
|
|
52
|
+
tablePlugin,
|
|
53
|
+
{ tableResizingEnabled: true, isTableAlignmentEnabled: true, tableOptions: {} },
|
|
54
|
+
]);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
After
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const universalPreset = useUniversalPreset([
|
|
61
|
+
tablePlugin,
|
|
62
|
+
{ tableOptions: { allowTableResizing: true, allowTableAlignment: true } },
|
|
63
|
+
]);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Before
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
return (
|
|
70
|
+
<Editor
|
|
71
|
+
allowTables={{advanced: true}}
|
|
72
|
+
initialPluginConfiguration={{
|
|
73
|
+
tablesPlugin: {
|
|
74
|
+
tableResizingEnabled: true, isTableAlignmentEnabled: true,
|
|
75
|
+
}
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
After
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
return (
|
|
85
|
+
<Editor
|
|
86
|
+
allowTables={{advanced: true, allowTableResizing: enabled, allowTableAlignment: true}}
|
|
87
|
+
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- [#166172](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166172)
|
|
95
|
+
[`00bf95ef0cc72`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/00bf95ef0cc72) -
|
|
96
|
+
[ux] [ED-25535] Fix for issue where resize handler decorations added/removed in view mode affected
|
|
97
|
+
selection range.
|
|
98
|
+
|
|
3
99
|
## 7.31.3
|
|
4
100
|
|
|
5
101
|
### Patch Changes
|
|
@@ -30,7 +30,8 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
30
30
|
var customTr = state.tr;
|
|
31
31
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
32
32
|
allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
|
|
33
|
-
getIntl = _getPluginState.getIntl
|
|
33
|
+
getIntl = _getPluginState.getIntl,
|
|
34
|
+
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
34
35
|
var fakeDispatch = function fakeDispatch(tr) {
|
|
35
36
|
customTr = tr;
|
|
36
37
|
};
|
|
@@ -43,7 +44,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
43
44
|
});
|
|
44
45
|
var decorationsWithWidgetAndHandle = (0, _utils4.updateDecorations)(customTr.doc, decorationsWithWidget, (0, _utils4.createColumnLineResize)(state.selection, {
|
|
45
46
|
right: columnIndex
|
|
46
|
-
}), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
47
|
+
}, isDragAndDropEnabled), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
47
48
|
getTablePluginCommand({
|
|
48
49
|
type: 'START_KEYBOARD_COLUMN_RESIZE',
|
|
49
50
|
data: {
|
|
@@ -128,10 +128,12 @@ var clearHoverSelection = exports.clearHoverSelection = function clearHoverSelec
|
|
|
128
128
|
};
|
|
129
129
|
var showResizeHandleLine = exports.showResizeHandleLine = function showResizeHandleLine(cellColumnPositioning) {
|
|
130
130
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
131
|
+
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
132
|
+
isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
|
|
131
133
|
return {
|
|
132
134
|
type: 'SHOW_RESIZE_HANDLE_LINE',
|
|
133
135
|
data: {
|
|
134
|
-
decorationSet: (0, _utils2.updatePluginStateDecorations)(state, (0, _utils2.createColumnLineResize)(state.selection, cellColumnPositioning), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
|
|
136
|
+
decorationSet: (0, _utils2.updatePluginStateDecorations)(state, (0, _utils2.createColumnLineResize)(state.selection, cellColumnPositioning, isDragAndDropEnabled), _types.TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
});
|
|
@@ -160,8 +162,8 @@ var setTableHovered = exports.setTableHovered = function setTableHovered(hovered
|
|
|
160
162
|
};
|
|
161
163
|
var hoverCell = exports.hoverCell = function hoverCell(rowIndex, colIndex) {
|
|
162
164
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
163
|
-
var
|
|
164
|
-
prevHoveredCell =
|
|
165
|
+
var _getPluginState5 = (0, _pluginFactory.getPluginState)(state),
|
|
166
|
+
prevHoveredCell = _getPluginState5.hoveredCell;
|
|
165
167
|
|
|
166
168
|
// If no arguments have been passed then the intention it to reset the hover cell data
|
|
167
169
|
var clear = rowIndex === undefined && colIndex === undefined;
|
|
@@ -407,11 +407,22 @@ var isTableInFocus = exports.isTableInFocus = function isTableInFocus(view) {
|
|
|
407
407
|
var _getPluginState10, _getResizePluginState;
|
|
408
408
|
return !!((_getPluginState10 = (0, _pluginFactory2.getPluginState)(view.state)) !== null && _getPluginState10 !== void 0 && _getPluginState10.tableNode) && !((_getResizePluginState = (0, _pluginFactory3.getPluginState)(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
|
|
409
409
|
};
|
|
410
|
-
var whenTableInFocus = exports.whenTableInFocus = function whenTableInFocus(eventHandler) {
|
|
410
|
+
var whenTableInFocus = exports.whenTableInFocus = function whenTableInFocus(eventHandler, pluginInjectionApi) {
|
|
411
411
|
return function (view, mouseEvent) {
|
|
412
|
+
var _pluginInjectionApi$e;
|
|
412
413
|
if (!isTableInFocus(view)) {
|
|
413
414
|
return false;
|
|
414
415
|
}
|
|
416
|
+
var isViewMode = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) === 'view';
|
|
417
|
+
/**
|
|
418
|
+
* Table cannot be in focus if we are in view mode.
|
|
419
|
+
* This will prevent an infinite flow of adding and removing
|
|
420
|
+
* resize handle decorations in view mode that causes unpredictable
|
|
421
|
+
* selections.
|
|
422
|
+
*/
|
|
423
|
+
if (isViewMode) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
415
426
|
return eventHandler(view, mouseEvent);
|
|
416
427
|
};
|
|
417
428
|
};
|
|
@@ -155,7 +155,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
155
155
|
var _this$props = _this.props,
|
|
156
156
|
getNode = _this$props.getNode,
|
|
157
157
|
containerWidth = _this$props.containerWidth,
|
|
158
|
-
options = _this$props.options
|
|
158
|
+
options = _this$props.options,
|
|
159
|
+
allowTableResizing = _this$props.allowTableResizing;
|
|
159
160
|
var prevNode = _this.node;
|
|
160
161
|
var node = getNode();
|
|
161
162
|
var prevAttrs = prevNode.attrs;
|
|
@@ -189,7 +190,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
189
190
|
// This last check is also to cater for dynamic text sizing changing the 'default' layout width
|
|
190
191
|
// Usually happens on window resize.
|
|
191
192
|
layoutSize !== _this.layoutSize || noOfColumnsChanged) {
|
|
192
|
-
var shouldScaleTable = (!
|
|
193
|
+
var shouldScaleTable = (!allowTableResizing || allowTableResizing && isNested) && !hasNumberedColumnChanged && !noOfColumnsChanged;
|
|
193
194
|
|
|
194
195
|
// If column has been inserted/deleted avoid multi dispatch
|
|
195
196
|
if (shouldScaleTable) {
|
|
@@ -199,7 +200,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
// only when table resizing is enabled and toggle numbered column to run scaleTable
|
|
202
|
-
if (
|
|
203
|
+
if (allowTableResizing && hasNumberedColumnChanged) {
|
|
203
204
|
if (!(0, _colgroup.hasTableBeenResized)(prevNode)) {
|
|
204
205
|
_this.scaleTable({
|
|
205
206
|
parentWidth: node.attrs.width
|
|
@@ -251,7 +252,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
251
252
|
var _this$props3 = _this.props,
|
|
252
253
|
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
253
254
|
containerWidth = _this$props3.containerWidth,
|
|
254
|
-
|
|
255
|
+
allowTableResizing = _this$props3.allowTableResizing;
|
|
255
256
|
var parentWidth = ((_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.parentWidth) || 0;
|
|
256
257
|
_this.initialOverflowCaptureTimerId = setTimeout(function () {
|
|
257
258
|
dispatchAnalyticsEvent({
|
|
@@ -262,7 +263,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
262
263
|
attributes: {
|
|
263
264
|
editorWidth: containerWidth.width || 0,
|
|
264
265
|
isOverflowing: isOverflowing,
|
|
265
|
-
tableResizingEnabled:
|
|
266
|
+
tableResizingEnabled: allowTableResizing || false,
|
|
266
267
|
width: _this.node.attrs.width || 0,
|
|
267
268
|
parentWidth: parentWidth
|
|
268
269
|
}
|
|
@@ -383,8 +384,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
383
384
|
_this2 = this;
|
|
384
385
|
var _this$props7 = this.props,
|
|
385
386
|
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
387
|
+
allowTableResizing = _this$props7.allowTableResizing,
|
|
386
388
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
387
|
-
options = _this$props7.options,
|
|
388
389
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
389
390
|
getNode = _this$props7.getNode,
|
|
390
391
|
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
@@ -437,7 +438,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
437
438
|
* We no longer use `containerWidth` as a variable to determine an update for table resizing (avoids unnecessary updates).
|
|
438
439
|
* Instead we use the resize event to only trigger updates when necessary.
|
|
439
440
|
*/
|
|
440
|
-
if (!
|
|
441
|
+
if (!allowTableResizing) {
|
|
441
442
|
window.addEventListener('resize', this.handleWindowResizeDebounced);
|
|
442
443
|
}
|
|
443
444
|
this.handleTableResizingDebounced();
|
|
@@ -458,8 +459,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
458
459
|
var _this$resizeObserver, _this$wrapperReisizeO, _this$table4, _this$table5, _this$table6;
|
|
459
460
|
var _this$props8 = this.props,
|
|
460
461
|
allowColumnResizing = _this$props8.allowColumnResizing,
|
|
462
|
+
allowTableResizing = _this$props8.allowTableResizing,
|
|
461
463
|
eventDispatcher = _this$props8.eventDispatcher,
|
|
462
|
-
options = _this$props8.options,
|
|
463
464
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled;
|
|
464
465
|
if (this.wrapper && !isIE11) {
|
|
465
466
|
this.wrapper.removeEventListener('scroll', this.handleScrollDebounced);
|
|
@@ -476,10 +477,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
476
477
|
this.scaleTableDebounced.cancel();
|
|
477
478
|
this.handleTableResizingDebounced.cancel();
|
|
478
479
|
this.handleAutoSizeDebounced.cancel();
|
|
479
|
-
if (!
|
|
480
|
+
if (!allowTableResizing) {
|
|
480
481
|
this.handleWindowResizeDebounced.cancel();
|
|
481
482
|
}
|
|
482
|
-
if (!
|
|
483
|
+
if (!allowTableResizing && allowColumnResizing) {
|
|
483
484
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
484
485
|
}
|
|
485
486
|
this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
@@ -626,6 +627,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
626
627
|
getNode = _this$props11.getNode,
|
|
627
628
|
isMediaFullscreen = _this$props11.isMediaFullscreen,
|
|
628
629
|
allowColumnResizing = _this$props11.allowColumnResizing,
|
|
630
|
+
allowTableResizing = _this$props11.allowTableResizing,
|
|
629
631
|
isResizing = _this$props11.isResizing,
|
|
630
632
|
options = _this$props11.options,
|
|
631
633
|
isTableScalingEnabled = _this$props11.isTableScalingEnabled,
|
|
@@ -658,7 +660,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
658
660
|
if (isInDanger && !table) {
|
|
659
661
|
(0, _commands.clearHoverSelection)()(view.state, view.dispatch);
|
|
660
662
|
}
|
|
661
|
-
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor &&
|
|
663
|
+
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && allowTableResizing && !(options !== null && options !== void 0 && options.isTableScalingEnabled)) {
|
|
662
664
|
this.removeInlineTableWidth();
|
|
663
665
|
}
|
|
664
666
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -698,7 +700,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
698
700
|
// re-draw colgroup.
|
|
699
701
|
if ((0, _utils5.tablesHaveDifferentColumnWidths)(currentTable, previousTable) || isNoOfColumnsChanged) {
|
|
700
702
|
var _view = this.props.view;
|
|
701
|
-
var shouldRecreateResizeCols = !
|
|
703
|
+
var shouldRecreateResizeCols = !allowTableResizing || !isResizing || isNoOfColumnsChanged && isResizing;
|
|
702
704
|
if (shouldRecreateResizeCols) {
|
|
703
705
|
var start = getPos() || 0;
|
|
704
706
|
var depth = _view.state.doc.resolve(start).depth;
|
|
@@ -766,7 +768,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
766
768
|
isDragAndDropEnabled = _this$props12.isDragAndDropEnabled,
|
|
767
769
|
getEditorFeatureFlags = _this$props12.getEditorFeatureFlags,
|
|
768
770
|
isTableScalingEnabled = _this$props12.isTableScalingEnabled,
|
|
769
|
-
|
|
771
|
+
allowTableResizing = _this$props12.allowTableResizing,
|
|
772
|
+
allowTableAlignment = _this$props12.allowTableAlignment;
|
|
770
773
|
var _this$props13 = this.props,
|
|
771
774
|
isInDanger = _this$props13.isInDanger,
|
|
772
775
|
hoveredRows = _this$props13.hoveredRows,
|
|
@@ -880,12 +883,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
880
883
|
isNested: isNested,
|
|
881
884
|
pluginInjectionApi: pluginInjectionApi,
|
|
882
885
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
883
|
-
isTableResizingEnabled:
|
|
886
|
+
isTableResizingEnabled: allowTableResizing,
|
|
884
887
|
isResizing: isResizing,
|
|
885
888
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
886
889
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
887
890
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
888
|
-
isTableAlignmentEnabled:
|
|
891
|
+
isTableAlignmentEnabled: allowTableAlignment,
|
|
889
892
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
890
893
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
891
894
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
@@ -23,7 +23,9 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
23
23
|
allowColumnResizing = _ref.allowColumnResizing,
|
|
24
24
|
allowControls = _ref.allowControls,
|
|
25
25
|
getPos = _ref.getPos,
|
|
26
|
-
forwardRef = _ref.forwardRef
|
|
26
|
+
forwardRef = _ref.forwardRef,
|
|
27
|
+
allowTableAlignment = _ref.allowTableAlignment,
|
|
28
|
+
allowTableResizing = _ref.allowTableResizing;
|
|
27
29
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media']),
|
|
28
30
|
widthState = _useSharedPluginState.widthState,
|
|
29
31
|
tableState = _useSharedPluginState.tableState,
|
|
@@ -69,7 +71,8 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
69
71
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
70
72
|
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
71
73
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
72
|
-
|
|
74
|
+
allowTableAlignment: allowTableAlignment,
|
|
75
|
+
allowTableResizing: allowTableResizing,
|
|
73
76
|
tableActive: tableActive,
|
|
74
77
|
ordering: ordering,
|
|
75
78
|
isResizing: isResizing,
|
|
@@ -16,7 +16,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
16
16
|
var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
17
17
|
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
18
18
|
return function (node, view, getPos) {
|
|
19
|
-
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.
|
|
19
|
+
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
var loader = function loader() {
|
|
@@ -33,10 +33,9 @@ var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
|
33
33
|
getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
|
|
34
34
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
35
35
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
36
|
-
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
37
36
|
isCommentEditor = _getNodeViewOptions.isCommentEditor,
|
|
38
37
|
isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
|
|
39
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi,
|
|
38
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor);
|
|
40
39
|
};
|
|
41
40
|
});
|
|
42
41
|
return result;
|
|
@@ -45,15 +45,15 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
45
45
|
'data-table-display-mode': node.attrs.displayMode
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
var getInlineWidth = function getInlineWidth(node, options, state, pos) {
|
|
49
|
-
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor &&
|
|
48
|
+
var getInlineWidth = function getInlineWidth(node, options, state, pos, allowTableResizing) {
|
|
49
|
+
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && allowTableResizing) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// provide a width for tables when custom table width is supported
|
|
54
54
|
// this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
|
|
55
55
|
// support screen size adjustments
|
|
56
|
-
var shouldHaveInlineWidth =
|
|
56
|
+
var shouldHaveInlineWidth = allowTableResizing && !(0, _utils2.isTableNested)(state, pos);
|
|
57
57
|
var widthValue = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
58
58
|
if (node.attrs.isNumberColumnEnabled) {
|
|
59
59
|
widthValue -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
@@ -98,7 +98,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
98
98
|
var _this$options, _this$options2, _this$getEditorFeatur;
|
|
99
99
|
this.table = rendered.dom;
|
|
100
100
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && (_this$getEditorFeatur = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur !== void 0 && _this$getEditorFeatur.call(this).tableWithFixedColumnWidthsOption && this.node.attrs.displayMode === 'fixed') {
|
|
101
|
-
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
|
|
101
|
+
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
|
|
102
102
|
if (tableInlineWidth) {
|
|
103
103
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
104
104
|
}
|
|
@@ -125,7 +125,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
125
125
|
if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && (_this$getEditorFeatur2 = this.getEditorFeatureFlags) !== null && _this$getEditorFeatur2 !== void 0 && _this$getEditorFeatur2.call(this).tableWithFixedColumnWidthsOption && node.attrs.displayMode === 'fixed') {
|
|
126
126
|
var _tableWidthPluginKey$;
|
|
127
127
|
// handle inline style when table been resized
|
|
128
|
-
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
|
|
128
|
+
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos(), this.reactComponentProps.allowTableResizing);
|
|
129
129
|
var isTableResizing = (_tableWidthPluginKey$ = _tableWidth.pluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
130
130
|
if (!isTableResizing && tableInlineWidth) {
|
|
131
131
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
@@ -145,6 +145,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
145
145
|
eventDispatcher: props.eventDispatcher,
|
|
146
146
|
api: props.pluginInjectionApi,
|
|
147
147
|
allowColumnResizing: props.allowColumnResizing,
|
|
148
|
+
allowTableAlignment: props.allowTableAlignment,
|
|
149
|
+
allowTableResizing: props.allowTableResizing,
|
|
148
150
|
allowControls: props.allowControls,
|
|
149
151
|
getPos: props.getPos,
|
|
150
152
|
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
@@ -182,7 +184,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
182
184
|
},
|
|
183
185
|
editorView: props.view,
|
|
184
186
|
render: function render(pluginStates) {
|
|
185
|
-
var _props$options
|
|
187
|
+
var _props$options;
|
|
186
188
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
187
189
|
tableWidthPluginState = pluginStates.tableWidthPluginState,
|
|
188
190
|
pluginState = pluginStates.pluginState,
|
|
@@ -216,7 +218,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
216
218
|
isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
|
|
217
219
|
isTableScalingEnabled: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.isTableScalingEnabled // this.options?.isTableScalingEnabled same as TableOptions.isTableScalingEnabled same as pluginState.isTableScalingEnabled
|
|
218
220
|
,
|
|
219
|
-
|
|
221
|
+
allowTableAlignment: props.allowTableAlignment,
|
|
222
|
+
allowTableResizing: props.allowTableResizing,
|
|
220
223
|
tableActive: tableActive,
|
|
221
224
|
ordering: pluginState.ordering,
|
|
222
225
|
isResizing: isResizing,
|
|
@@ -293,21 +296,24 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
293
296
|
}]);
|
|
294
297
|
return TableView;
|
|
295
298
|
}(_reactNodeView.default);
|
|
296
|
-
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi,
|
|
299
|
+
var createTableView = exports.createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) {
|
|
297
300
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
298
301
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
299
302
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
300
303
|
wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
|
|
301
|
-
isTableResizingEnabled = _getPluginState2.isTableResizingEnabled,
|
|
302
304
|
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled,
|
|
303
305
|
isTableScalingEnabled = _getPluginState2.isTableScalingEnabled;
|
|
304
306
|
var _getPluginConfig = (0, _createPluginConfig.pluginConfig)(pluginConfig),
|
|
305
307
|
allowColumnResizing = _getPluginConfig.allowColumnResizing,
|
|
306
|
-
allowControls = _getPluginConfig.allowControls
|
|
308
|
+
allowControls = _getPluginConfig.allowControls,
|
|
309
|
+
allowTableResizing = _getPluginConfig.allowTableResizing,
|
|
310
|
+
allowTableAlignment = _getPluginConfig.allowTableAlignment;
|
|
307
311
|
return new TableView({
|
|
308
312
|
node: node,
|
|
309
313
|
view: view,
|
|
310
314
|
allowColumnResizing: allowColumnResizing,
|
|
315
|
+
allowTableResizing: allowTableResizing,
|
|
316
|
+
allowTableAlignment: allowTableAlignment,
|
|
311
317
|
allowControls: allowControls,
|
|
312
318
|
portalProviderAPI: portalProviderAPI,
|
|
313
319
|
eventDispatcher: eventDispatcher,
|
|
@@ -315,11 +321,9 @@ var createTableView = exports.createTableView = function createTableView(node, v
|
|
|
315
321
|
options: {
|
|
316
322
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
317
323
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
318
|
-
isTableResizingEnabled: isTableResizingEnabled,
|
|
319
324
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
320
325
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
321
326
|
// same as options.isTableScalingEnabled
|
|
322
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
323
327
|
isCommentEditor: isCommentEditor,
|
|
324
328
|
isChromelessEditor: isChromelessEditor
|
|
325
329
|
},
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -119,11 +119,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
119
119
|
var _api$contentInsertion, _api$contentInsertion2;
|
|
120
120
|
var node = (0, _utils2.createTableWithWidth)({
|
|
121
121
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
122
|
-
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.
|
|
122
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
123
123
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
124
124
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
125
125
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
126
|
-
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.
|
|
126
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
127
127
|
})(state.schema);
|
|
128
128
|
|
|
129
129
|
// If the cursor is inside a table
|
|
@@ -158,7 +158,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
commands: {
|
|
161
|
-
insertTableWithSize: (0, _insert.insertTableWithSize)(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.
|
|
161
|
+
insertTableWithSize: (0, _insert.insertTableWithSize)(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
162
162
|
},
|
|
163
163
|
nodes: function nodes() {
|
|
164
164
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
@@ -168,7 +168,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
168
168
|
name: 'table',
|
|
169
169
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
170
170
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
171
|
-
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.
|
|
171
|
+
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
172
172
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
173
173
|
isNestingSupported: isNestingSupported
|
|
174
174
|
})
|
|
@@ -185,7 +185,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
185
185
|
name: 'table',
|
|
186
186
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
187
187
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
188
|
-
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.
|
|
188
|
+
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
189
189
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
190
190
|
isNestingSupported: isNestingSupported
|
|
191
191
|
})
|
|
@@ -213,15 +213,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
213
213
|
var _ref3 = options || {},
|
|
214
214
|
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
215
215
|
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
216
|
-
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
217
216
|
tableOptions = _ref3.tableOptions,
|
|
218
217
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
219
218
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
220
219
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
221
|
-
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
222
220
|
isCommentEditor = _ref3.isCommentEditor,
|
|
223
221
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
224
|
-
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl,
|
|
222
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
225
223
|
}
|
|
226
224
|
}, {
|
|
227
225
|
name: 'tablePMColResizing',
|
|
@@ -233,13 +231,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
233
231
|
tableOptions = _ref5.tableOptions,
|
|
234
232
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
235
233
|
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
236
|
-
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled
|
|
237
|
-
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled;
|
|
234
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
238
235
|
var _pluginConfig2 = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
239
|
-
allowColumnResizing = _pluginConfig2.allowColumnResizing
|
|
236
|
+
allowColumnResizing = _pluginConfig2.allowColumnResizing,
|
|
237
|
+
allowTableAlignment = _pluginConfig2.allowTableAlignment;
|
|
240
238
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
241
239
|
lastColumnResizable: !fullWidthEnabled
|
|
242
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled,
|
|
240
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, allowTableAlignment, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
243
241
|
}
|
|
244
242
|
}, {
|
|
245
243
|
name: 'tableEditing',
|
|
@@ -258,17 +256,14 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
258
256
|
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
259
257
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
260
258
|
isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
|
|
261
|
-
_ref7$isTableAlignmen = _ref7.isTableAlignmentEnabled,
|
|
262
|
-
isTableAlignmentEnabled = _ref7$isTableAlignmen === void 0 ? false : _ref7$isTableAlignmen,
|
|
263
259
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
264
260
|
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
|
|
265
261
|
_ref7$isCommentEditor = _ref7.isCommentEditor,
|
|
266
262
|
isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
|
|
267
263
|
_ref7$isChromelessEdi = _ref7.isChromelessEditor,
|
|
268
264
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
265
|
+
tableOptions = _ref7.tableOptions;
|
|
266
|
+
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
|
|
272
267
|
}
|
|
273
268
|
}, {
|
|
274
269
|
name: 'tableSelectionKeymap',
|
|
@@ -328,27 +323,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
328
323
|
}, {
|
|
329
324
|
name: 'tableWidth',
|
|
330
325
|
plugin: function plugin(_ref15) {
|
|
331
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
326
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions, _options$isCommentEdi;
|
|
332
327
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
333
328
|
dispatch = _ref15.dispatch;
|
|
334
|
-
return options !== null && options !== void 0 && options.
|
|
329
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions = options.tableOptions.allowTableResizing) !== null && _options$tableOptions !== void 0 ? _options$tableOptions : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
335
330
|
}
|
|
336
331
|
}, {
|
|
337
332
|
name: 'tableWidthInCommentFix',
|
|
338
333
|
plugin: function plugin(_ref16) {
|
|
339
|
-
var _options$
|
|
334
|
+
var _options$tableOptions2;
|
|
340
335
|
var dispatch = _ref16.dispatch;
|
|
341
|
-
return options !== null && options !== void 0 && options.
|
|
336
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$tableOptions2 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions2 !== void 0 ? _options$tableOptions2 : false) : undefined;
|
|
342
337
|
}
|
|
343
338
|
},
|
|
344
339
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
345
340
|
{
|
|
346
341
|
name: 'tableOverflowAnalyticsPlugin',
|
|
347
342
|
plugin: function plugin(_ref17) {
|
|
348
|
-
var _options$
|
|
343
|
+
var _options$tableOptions3;
|
|
349
344
|
var dispatch = _ref17.dispatch,
|
|
350
345
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
351
|
-
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$
|
|
346
|
+
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableOptions3 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false);
|
|
352
347
|
}
|
|
353
348
|
}, {
|
|
354
349
|
name: 'tableAnalyticsPlugin',
|
|
@@ -511,7 +506,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
511
506
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
512
507
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
513
508
|
api: api
|
|
514
|
-
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.
|
|
509
|
+
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/_react.default.createElement(_FloatingToolbarLabel.FloatingToolbarLabel, {
|
|
515
510
|
target: resizingTableRef,
|
|
516
511
|
content: /*#__PURE__*/_react.default.createElement(_TableFullWidthLabel.FullWidthDisplay, null),
|
|
517
512
|
alignX: 'center',
|
|
@@ -543,11 +538,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
543
538
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
544
539
|
var tableNode = (0, _utils2.createTableWithWidth)({
|
|
545
540
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
546
|
-
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.
|
|
541
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
547
542
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
548
543
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
549
544
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
550
|
-
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.
|
|
545
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
551
546
|
})(state.schema);
|
|
552
547
|
var tr = state.tr;
|
|
553
548
|
// If the cursor is inside a table
|