@atlaskit/editor-plugin-table 7.31.3 → 8.0.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 +83 -0
- 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/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/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/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 +2 -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 +2 -1
- package/package.json +2 -2
- package/src/event-handlers.ts +17 -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 +2 -1
|
@@ -148,7 +148,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
148
148
|
var _this$props = _this.props,
|
|
149
149
|
getNode = _this$props.getNode,
|
|
150
150
|
containerWidth = _this$props.containerWidth,
|
|
151
|
-
options = _this$props.options
|
|
151
|
+
options = _this$props.options,
|
|
152
|
+
allowTableResizing = _this$props.allowTableResizing;
|
|
152
153
|
var prevNode = _this.node;
|
|
153
154
|
var node = getNode();
|
|
154
155
|
var prevAttrs = prevNode.attrs;
|
|
@@ -182,7 +183,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
182
183
|
// This last check is also to cater for dynamic text sizing changing the 'default' layout width
|
|
183
184
|
// Usually happens on window resize.
|
|
184
185
|
layoutSize !== _this.layoutSize || noOfColumnsChanged) {
|
|
185
|
-
var shouldScaleTable = (!
|
|
186
|
+
var shouldScaleTable = (!allowTableResizing || allowTableResizing && isNested) && !hasNumberedColumnChanged && !noOfColumnsChanged;
|
|
186
187
|
|
|
187
188
|
// If column has been inserted/deleted avoid multi dispatch
|
|
188
189
|
if (shouldScaleTable) {
|
|
@@ -192,7 +193,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
// only when table resizing is enabled and toggle numbered column to run scaleTable
|
|
195
|
-
if (
|
|
196
|
+
if (allowTableResizing && hasNumberedColumnChanged) {
|
|
196
197
|
if (!hasTableBeenResized(prevNode)) {
|
|
197
198
|
_this.scaleTable({
|
|
198
199
|
parentWidth: node.attrs.width
|
|
@@ -244,7 +245,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
244
245
|
var _this$props3 = _this.props,
|
|
245
246
|
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
246
247
|
containerWidth = _this$props3.containerWidth,
|
|
247
|
-
|
|
248
|
+
allowTableResizing = _this$props3.allowTableResizing;
|
|
248
249
|
var parentWidth = ((_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.parentWidth) || 0;
|
|
249
250
|
_this.initialOverflowCaptureTimerId = setTimeout(function () {
|
|
250
251
|
dispatchAnalyticsEvent({
|
|
@@ -255,7 +256,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
255
256
|
attributes: {
|
|
256
257
|
editorWidth: containerWidth.width || 0,
|
|
257
258
|
isOverflowing: isOverflowing,
|
|
258
|
-
tableResizingEnabled:
|
|
259
|
+
tableResizingEnabled: allowTableResizing || false,
|
|
259
260
|
width: _this.node.attrs.width || 0,
|
|
260
261
|
parentWidth: parentWidth
|
|
261
262
|
}
|
|
@@ -376,8 +377,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
376
377
|
_this2 = this;
|
|
377
378
|
var _this$props7 = this.props,
|
|
378
379
|
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
380
|
+
allowTableResizing = _this$props7.allowTableResizing,
|
|
379
381
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
380
|
-
options = _this$props7.options,
|
|
381
382
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
382
383
|
getNode = _this$props7.getNode,
|
|
383
384
|
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
@@ -430,7 +431,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
430
431
|
* We no longer use `containerWidth` as a variable to determine an update for table resizing (avoids unnecessary updates).
|
|
431
432
|
* Instead we use the resize event to only trigger updates when necessary.
|
|
432
433
|
*/
|
|
433
|
-
if (!
|
|
434
|
+
if (!allowTableResizing) {
|
|
434
435
|
window.addEventListener('resize', this.handleWindowResizeDebounced);
|
|
435
436
|
}
|
|
436
437
|
this.handleTableResizingDebounced();
|
|
@@ -451,8 +452,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
451
452
|
var _this$resizeObserver, _this$wrapperReisizeO, _this$table4, _this$table5, _this$table6;
|
|
452
453
|
var _this$props8 = this.props,
|
|
453
454
|
allowColumnResizing = _this$props8.allowColumnResizing,
|
|
455
|
+
allowTableResizing = _this$props8.allowTableResizing,
|
|
454
456
|
eventDispatcher = _this$props8.eventDispatcher,
|
|
455
|
-
options = _this$props8.options,
|
|
456
457
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled;
|
|
457
458
|
if (this.wrapper && !isIE11) {
|
|
458
459
|
this.wrapper.removeEventListener('scroll', this.handleScrollDebounced);
|
|
@@ -469,10 +470,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
469
470
|
this.scaleTableDebounced.cancel();
|
|
470
471
|
this.handleTableResizingDebounced.cancel();
|
|
471
472
|
this.handleAutoSizeDebounced.cancel();
|
|
472
|
-
if (!
|
|
473
|
+
if (!allowTableResizing) {
|
|
473
474
|
this.handleWindowResizeDebounced.cancel();
|
|
474
475
|
}
|
|
475
|
-
if (!
|
|
476
|
+
if (!allowTableResizing && allowColumnResizing) {
|
|
476
477
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
477
478
|
}
|
|
478
479
|
this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
@@ -619,6 +620,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
619
620
|
getNode = _this$props11.getNode,
|
|
620
621
|
isMediaFullscreen = _this$props11.isMediaFullscreen,
|
|
621
622
|
allowColumnResizing = _this$props11.allowColumnResizing,
|
|
623
|
+
allowTableResizing = _this$props11.allowTableResizing,
|
|
622
624
|
isResizing = _this$props11.isResizing,
|
|
623
625
|
options = _this$props11.options,
|
|
624
626
|
isTableScalingEnabled = _this$props11.isTableScalingEnabled,
|
|
@@ -651,7 +653,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
651
653
|
if (isInDanger && !table) {
|
|
652
654
|
clearHoverSelection()(view.state, view.dispatch);
|
|
653
655
|
}
|
|
654
|
-
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor &&
|
|
656
|
+
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)) {
|
|
655
657
|
this.removeInlineTableWidth();
|
|
656
658
|
}
|
|
657
659
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -691,7 +693,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
691
693
|
// re-draw colgroup.
|
|
692
694
|
if (tablesHaveDifferentColumnWidths(currentTable, previousTable) || isNoOfColumnsChanged) {
|
|
693
695
|
var _view = this.props.view;
|
|
694
|
-
var shouldRecreateResizeCols = !
|
|
696
|
+
var shouldRecreateResizeCols = !allowTableResizing || !isResizing || isNoOfColumnsChanged && isResizing;
|
|
695
697
|
if (shouldRecreateResizeCols) {
|
|
696
698
|
var start = getPos() || 0;
|
|
697
699
|
var depth = _view.state.doc.resolve(start).depth;
|
|
@@ -759,7 +761,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
759
761
|
isDragAndDropEnabled = _this$props12.isDragAndDropEnabled,
|
|
760
762
|
getEditorFeatureFlags = _this$props12.getEditorFeatureFlags,
|
|
761
763
|
isTableScalingEnabled = _this$props12.isTableScalingEnabled,
|
|
762
|
-
|
|
764
|
+
allowTableResizing = _this$props12.allowTableResizing,
|
|
765
|
+
allowTableAlignment = _this$props12.allowTableAlignment;
|
|
763
766
|
var _this$props13 = this.props,
|
|
764
767
|
isInDanger = _this$props13.isInDanger,
|
|
765
768
|
hoveredRows = _this$props13.hoveredRows,
|
|
@@ -873,12 +876,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
873
876
|
isNested: isNested,
|
|
874
877
|
pluginInjectionApi: pluginInjectionApi,
|
|
875
878
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
876
|
-
isTableResizingEnabled:
|
|
879
|
+
isTableResizingEnabled: allowTableResizing,
|
|
877
880
|
isResizing: isResizing,
|
|
878
881
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
879
882
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
880
883
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
881
|
-
isTableAlignmentEnabled:
|
|
884
|
+
isTableAlignmentEnabled: allowTableAlignment,
|
|
882
885
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
883
886
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
884
887
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
@@ -16,7 +16,9 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
16
16
|
allowColumnResizing = _ref.allowColumnResizing,
|
|
17
17
|
allowControls = _ref.allowControls,
|
|
18
18
|
getPos = _ref.getPos,
|
|
19
|
-
forwardRef = _ref.forwardRef
|
|
19
|
+
forwardRef = _ref.forwardRef,
|
|
20
|
+
allowTableAlignment = _ref.allowTableAlignment,
|
|
21
|
+
allowTableResizing = _ref.allowTableResizing;
|
|
20
22
|
var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media']),
|
|
21
23
|
widthState = _useSharedPluginState.widthState,
|
|
22
24
|
tableState = _useSharedPluginState.tableState,
|
|
@@ -62,7 +64,8 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
62
64
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
63
65
|
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
64
66
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
65
|
-
|
|
67
|
+
allowTableAlignment: allowTableAlignment,
|
|
68
|
+
allowTableResizing: allowTableResizing,
|
|
66
69
|
tableActive: tableActive,
|
|
67
70
|
ordering: ordering,
|
|
68
71
|
isResizing: isResizing,
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
export var lazyTableView = function lazyTableView(options) {
|
|
8
8
|
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
9
9
|
return function (node, view, getPos) {
|
|
10
|
-
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var loader = function loader() {
|
|
@@ -22,10 +22,9 @@ export var lazyTableView = function lazyTableView(options) {
|
|
|
22
22
|
getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
|
|
23
23
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
24
24
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
25
|
-
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
26
25
|
isCommentEditor = _getNodeViewOptions.isCommentEditor,
|
|
27
26
|
isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
|
|
28
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi,
|
|
27
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor);
|
|
29
28
|
};
|
|
30
29
|
});
|
|
31
30
|
return result;
|
|
@@ -38,15 +38,15 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
38
38
|
'data-table-display-mode': node.attrs.displayMode
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
var getInlineWidth = function getInlineWidth(node, options, state, pos) {
|
|
42
|
-
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor &&
|
|
41
|
+
var getInlineWidth = function getInlineWidth(node, options, state, pos, allowTableResizing) {
|
|
42
|
+
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && allowTableResizing) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// provide a width for tables when custom table width is supported
|
|
47
47
|
// this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
|
|
48
48
|
// support screen size adjustments
|
|
49
|
-
var shouldHaveInlineWidth =
|
|
49
|
+
var shouldHaveInlineWidth = allowTableResizing && !isTableNested(state, pos);
|
|
50
50
|
var widthValue = getTableContainerWidth(node);
|
|
51
51
|
if (node.attrs.isNumberColumnEnabled) {
|
|
52
52
|
widthValue -= akEditorTableNumberColumnWidth;
|
|
@@ -91,7 +91,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
91
91
|
var _this$options, _this$options2, _this$getEditorFeatur;
|
|
92
92
|
this.table = rendered.dom;
|
|
93
93
|
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') {
|
|
94
|
-
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
|
|
94
|
+
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos(), this.reactComponentProps.allowTableResizing);
|
|
95
95
|
if (tableInlineWidth) {
|
|
96
96
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
97
97
|
}
|
|
@@ -118,7 +118,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
118
118
|
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') {
|
|
119
119
|
var _tableWidthPluginKey$;
|
|
120
120
|
// handle inline style when table been resized
|
|
121
|
-
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
|
|
121
|
+
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos(), this.reactComponentProps.allowTableResizing);
|
|
122
122
|
var isTableResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
123
123
|
if (!isTableResizing && tableInlineWidth) {
|
|
124
124
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
@@ -138,6 +138,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
138
138
|
eventDispatcher: props.eventDispatcher,
|
|
139
139
|
api: props.pluginInjectionApi,
|
|
140
140
|
allowColumnResizing: props.allowColumnResizing,
|
|
141
|
+
allowTableAlignment: props.allowTableAlignment,
|
|
142
|
+
allowTableResizing: props.allowTableResizing,
|
|
141
143
|
allowControls: props.allowControls,
|
|
142
144
|
getPos: props.getPos,
|
|
143
145
|
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
@@ -175,7 +177,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
175
177
|
},
|
|
176
178
|
editorView: props.view,
|
|
177
179
|
render: function render(pluginStates) {
|
|
178
|
-
var _props$options
|
|
180
|
+
var _props$options;
|
|
179
181
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
180
182
|
tableWidthPluginState = pluginStates.tableWidthPluginState,
|
|
181
183
|
pluginState = pluginStates.pluginState,
|
|
@@ -209,7 +211,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
209
211
|
isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
|
|
210
212
|
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
|
|
211
213
|
,
|
|
212
|
-
|
|
214
|
+
allowTableAlignment: props.allowTableAlignment,
|
|
215
|
+
allowTableResizing: props.allowTableResizing,
|
|
213
216
|
tableActive: tableActive,
|
|
214
217
|
ordering: pluginState.ordering,
|
|
215
218
|
isResizing: isResizing,
|
|
@@ -287,21 +290,24 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
287
290
|
return TableView;
|
|
288
291
|
}(ReactNodeView);
|
|
289
292
|
export { TableView as default };
|
|
290
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi,
|
|
293
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor) {
|
|
291
294
|
var _getPluginState2 = getPluginState(view.state),
|
|
292
295
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
293
296
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
294
297
|
wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
|
|
295
|
-
isTableResizingEnabled = _getPluginState2.isTableResizingEnabled,
|
|
296
298
|
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled,
|
|
297
299
|
isTableScalingEnabled = _getPluginState2.isTableScalingEnabled;
|
|
298
300
|
var _getPluginConfig = getPluginConfig(pluginConfig),
|
|
299
301
|
allowColumnResizing = _getPluginConfig.allowColumnResizing,
|
|
300
|
-
allowControls = _getPluginConfig.allowControls
|
|
302
|
+
allowControls = _getPluginConfig.allowControls,
|
|
303
|
+
allowTableResizing = _getPluginConfig.allowTableResizing,
|
|
304
|
+
allowTableAlignment = _getPluginConfig.allowTableAlignment;
|
|
301
305
|
return new TableView({
|
|
302
306
|
node: node,
|
|
303
307
|
view: view,
|
|
304
308
|
allowColumnResizing: allowColumnResizing,
|
|
309
|
+
allowTableResizing: allowTableResizing,
|
|
310
|
+
allowTableAlignment: allowTableAlignment,
|
|
305
311
|
allowControls: allowControls,
|
|
306
312
|
portalProviderAPI: portalProviderAPI,
|
|
307
313
|
eventDispatcher: eventDispatcher,
|
|
@@ -309,11 +315,9 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
309
315
|
options: {
|
|
310
316
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
311
317
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
312
|
-
isTableResizingEnabled: isTableResizingEnabled,
|
|
313
318
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
314
319
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
315
320
|
// same as options.isTableScalingEnabled
|
|
316
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
317
321
|
isCommentEditor: isCommentEditor,
|
|
318
322
|
isChromelessEditor: isChromelessEditor
|
|
319
323
|
},
|
package/dist/esm/plugin.js
CHANGED
|
@@ -112,11 +112,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
112
112
|
var _api$contentInsertion, _api$contentInsertion2;
|
|
113
113
|
var node = createTableWithWidth({
|
|
114
114
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
115
|
-
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.
|
|
115
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
116
116
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
117
117
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
118
118
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
119
|
-
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.
|
|
119
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
120
120
|
})(state.schema);
|
|
121
121
|
|
|
122
122
|
// If the cursor is inside a table
|
|
@@ -151,7 +151,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
commands: {
|
|
154
|
-
insertTableWithSize: 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.
|
|
154
|
+
insertTableWithSize: 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)
|
|
155
155
|
},
|
|
156
156
|
nodes: function nodes() {
|
|
157
157
|
var _pluginConfig = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
@@ -161,7 +161,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
161
161
|
name: 'table',
|
|
162
162
|
node: tableNodeSpecWithFixedToDOM({
|
|
163
163
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
164
|
-
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.
|
|
164
|
+
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
165
165
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
166
166
|
isNestingSupported: isNestingSupported
|
|
167
167
|
})
|
|
@@ -178,7 +178,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
178
178
|
name: 'table',
|
|
179
179
|
node: tableNodeSpecWithFixedToDOM({
|
|
180
180
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
181
|
-
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.
|
|
181
|
+
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
182
182
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
183
183
|
isNestingSupported: isNestingSupported
|
|
184
184
|
})
|
|
@@ -206,15 +206,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
206
206
|
var _ref3 = options || {},
|
|
207
207
|
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
208
208
|
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
209
|
-
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
210
209
|
tableOptions = _ref3.tableOptions,
|
|
211
210
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
212
211
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
213
212
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
214
|
-
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
215
213
|
isCommentEditor = _ref3.isCommentEditor,
|
|
216
214
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
217
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl,
|
|
215
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
218
216
|
}
|
|
219
217
|
}, {
|
|
220
218
|
name: 'tablePMColResizing',
|
|
@@ -226,13 +224,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
226
224
|
tableOptions = _ref5.tableOptions,
|
|
227
225
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
228
226
|
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
229
|
-
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled
|
|
230
|
-
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled;
|
|
227
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
231
228
|
var _pluginConfig2 = pluginConfig(tableOptions),
|
|
232
|
-
allowColumnResizing = _pluginConfig2.allowColumnResizing
|
|
229
|
+
allowColumnResizing = _pluginConfig2.allowColumnResizing,
|
|
230
|
+
allowTableAlignment = _pluginConfig2.allowTableAlignment;
|
|
233
231
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
234
232
|
lastColumnResizable: !fullWidthEnabled
|
|
235
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled,
|
|
233
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, allowTableAlignment, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
236
234
|
}
|
|
237
235
|
}, {
|
|
238
236
|
name: 'tableEditing',
|
|
@@ -251,17 +249,14 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
251
249
|
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
252
250
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
253
251
|
isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
|
|
254
|
-
_ref7$isTableAlignmen = _ref7.isTableAlignmentEnabled,
|
|
255
|
-
isTableAlignmentEnabled = _ref7$isTableAlignmen === void 0 ? false : _ref7$isTableAlignmen,
|
|
256
252
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
257
253
|
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
|
|
258
254
|
_ref7$isCommentEditor = _ref7.isCommentEditor,
|
|
259
255
|
isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
|
|
260
256
|
_ref7$isChromelessEdi = _ref7.isChromelessEditor,
|
|
261
257
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
258
|
+
tableOptions = _ref7.tableOptions;
|
|
259
|
+
return 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);
|
|
265
260
|
}
|
|
266
261
|
}, {
|
|
267
262
|
name: 'tableSelectionKeymap',
|
|
@@ -321,27 +316,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
321
316
|
}, {
|
|
322
317
|
name: 'tableWidth',
|
|
323
318
|
plugin: function plugin(_ref15) {
|
|
324
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
319
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions, _options$isCommentEdi;
|
|
325
320
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
326
321
|
dispatch = _ref15.dispatch;
|
|
327
|
-
return options !== null && options !== void 0 && options.
|
|
322
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(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;
|
|
328
323
|
}
|
|
329
324
|
}, {
|
|
330
325
|
name: 'tableWidthInCommentFix',
|
|
331
326
|
plugin: function plugin(_ref16) {
|
|
332
|
-
var _options$
|
|
327
|
+
var _options$tableOptions2;
|
|
333
328
|
var dispatch = _ref16.dispatch;
|
|
334
|
-
return options !== null && options !== void 0 && options.
|
|
329
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions2 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions2 !== void 0 ? _options$tableOptions2 : false) : undefined;
|
|
335
330
|
}
|
|
336
331
|
},
|
|
337
332
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
338
333
|
{
|
|
339
334
|
name: 'tableOverflowAnalyticsPlugin',
|
|
340
335
|
plugin: function plugin(_ref17) {
|
|
341
|
-
var _options$
|
|
336
|
+
var _options$tableOptions3;
|
|
342
337
|
var dispatch = _ref17.dispatch,
|
|
343
338
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
344
|
-
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$
|
|
339
|
+
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableOptions3 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false);
|
|
345
340
|
}
|
|
346
341
|
}, {
|
|
347
342
|
name: 'tableAnalyticsPlugin',
|
|
@@ -504,7 +499,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
504
499
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
505
500
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
506
501
|
api: api
|
|
507
|
-
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.
|
|
502
|
+
}), ((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.createElement(FloatingToolbarLabel, {
|
|
508
503
|
target: resizingTableRef,
|
|
509
504
|
content: /*#__PURE__*/React.createElement(FullWidthDisplay, null),
|
|
510
505
|
alignX: 'center',
|
|
@@ -536,11 +531,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
536
531
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
537
532
|
var tableNode = createTableWithWidth({
|
|
538
533
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
539
|
-
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.
|
|
534
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
540
535
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
541
536
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
542
537
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
543
|
-
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.
|
|
538
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
544
539
|
})(state.schema);
|
|
545
540
|
var tr = state.tr;
|
|
546
541
|
// If the cursor is inside a table
|
|
@@ -22,7 +22,7 @@ import { isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from '.
|
|
|
22
22
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
23
23
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
24
24
|
import { pluginKey } from './plugin-key';
|
|
25
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl,
|
|
25
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
26
26
|
var _accessibilityUtils;
|
|
27
27
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
28
28
|
pluginConfig: pluginConfig,
|
|
@@ -31,7 +31,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
31
31
|
insertRowButtonIndex: undefined,
|
|
32
32
|
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
33
33
|
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
34
|
-
isTableResizingEnabled: tableResizingEnabled,
|
|
35
34
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
36
35
|
isHeaderColumnEnabled: false,
|
|
37
36
|
isDragAndDropEnabled: dragAndDropEnabled,
|
|
@@ -169,7 +168,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
169
168
|
|
|
170
169
|
// fix for when pasting a table with default layout into comment editor
|
|
171
170
|
// table lose width and expand to full width
|
|
172
|
-
if (!insideTable(editorState) && isCommentEditor &&
|
|
171
|
+
if (!insideTable(editorState) && isCommentEditor && pluginConfig.allowTableAlignment && isTableScalingEnabled) {
|
|
173
172
|
slice = transformSliceTableLayoutDefaultToCenter(slice, schema);
|
|
174
173
|
}
|
|
175
174
|
slice = transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema);
|
|
@@ -257,7 +256,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
257
256
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
258
257
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
259
258
|
pluginInjectionApi: pluginInjectionApi,
|
|
260
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
261
259
|
isCommentEditor: isCommentEditor,
|
|
262
260
|
isChromelessEditor: isChromelessEditor
|
|
263
261
|
}),
|
|
@@ -278,7 +276,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
278
276
|
blur: handleBlur,
|
|
279
277
|
mousedown: withCellTracking(handleMouseDown),
|
|
280
278
|
mouseleave: handleMouseLeave,
|
|
281
|
-
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI)),
|
|
279
|
+
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI), pluginInjectionApi),
|
|
282
280
|
mouseenter: handleMouseEnter,
|
|
283
281
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
284
282
|
click: withCellTracking(whenTableInFocus(handleClick))
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -379,7 +379,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
379
379
|
return element;
|
|
380
380
|
};
|
|
381
381
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
382
|
-
var alignmentMenu =
|
|
382
|
+
var alignmentMenu = config.allowTableAlignment && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
383
383
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
384
384
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
385
385
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
@@ -16,5 +16,5 @@ export declare const handleMouseMove: (nodeViewPortalProviderAPI: PortalProvider
|
|
|
16
16
|
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
17
17
|
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => Transaction;
|
|
18
18
|
export declare const isTableInFocus: (view: EditorView) => boolean;
|
|
19
|
-
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
19
|
+
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean, pluginInjectionApi?: PluginInjectionAPI) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
20
20
|
export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
@@ -18,12 +18,13 @@ interface ComponentProps {
|
|
|
18
18
|
contentDOM: (node: HTMLElement | null) => void;
|
|
19
19
|
containerWidth: EditorContainerWidth;
|
|
20
20
|
allowControls: boolean;
|
|
21
|
+
allowTableResizing?: boolean;
|
|
22
|
+
allowTableAlignment?: boolean;
|
|
21
23
|
isHeaderRowEnabled: boolean;
|
|
22
24
|
isHeaderColumnEnabled: boolean;
|
|
23
25
|
isMediaFullscreen?: boolean;
|
|
24
26
|
isDragAndDropEnabled?: boolean;
|
|
25
27
|
isTableScalingEnabled?: boolean;
|
|
26
|
-
isTableAlignmentEnabled?: boolean;
|
|
27
28
|
tableActive: boolean;
|
|
28
29
|
ordering?: TableColumnOrdering;
|
|
29
30
|
isResizing?: boolean;
|
|
@@ -19,9 +19,11 @@ type TableComponentWithSharedStateProps = {
|
|
|
19
19
|
getPos: getPosHandlerNode;
|
|
20
20
|
allowColumnResizing?: boolean;
|
|
21
21
|
allowControls?: boolean;
|
|
22
|
+
allowTableAlignment?: boolean;
|
|
23
|
+
allowTableResizing?: boolean;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
25
27
|
*/
|
|
26
|
-
export declare const TableComponentWithSharedState: ({ view, options, getNode, dispatchAnalyticsEvent, api, getEditorFeatureFlags, eventDispatcher, allowColumnResizing, allowControls, getPos, forwardRef, }: TableComponentWithSharedStateProps) => JSX.Element | null;
|
|
28
|
+
export declare const TableComponentWithSharedState: ({ view, options, getNode, dispatchAnalyticsEvent, api, getEditorFeatureFlags, eventDispatcher, allowColumnResizing, allowControls, getPos, forwardRef, allowTableAlignment, allowTableResizing, }: TableComponentWithSharedStateProps) => JSX.Element | null;
|
|
27
29
|
export {};
|
|
@@ -14,7 +14,6 @@ type TableViewOptions = {
|
|
|
14
14
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
15
15
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
16
16
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
17
|
-
isTableAlignmentEnabled?: boolean;
|
|
18
17
|
isCommentEditor?: boolean;
|
|
19
18
|
isChromelessEditor?: boolean;
|
|
20
19
|
};
|
|
@@ -32,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
32
32
|
}): boolean;
|
|
33
33
|
destroy(): void;
|
|
34
34
|
}
|
|
35
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI,
|
|
35
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => NodeView;
|
|
36
36
|
export {};
|
|
@@ -8,10 +8,8 @@ import type { PluginInjectionAPI } from '../types';
|
|
|
8
8
|
export type TableOptions = {
|
|
9
9
|
isFullWidthModeEnabled?: boolean;
|
|
10
10
|
wasFullWidthModeEnabled?: boolean;
|
|
11
|
-
isTableResizingEnabled?: boolean;
|
|
12
11
|
isDragAndDropEnabled?: boolean;
|
|
13
12
|
isTableScalingEnabled?: boolean;
|
|
14
|
-
isTableAlignmentEnabled?: boolean;
|
|
15
13
|
isCommentEditor?: boolean;
|
|
16
14
|
isChromelessEditor?: boolean;
|
|
17
15
|
};
|
|
@@ -19,6 +17,8 @@ export interface Props {
|
|
|
19
17
|
node: PmNode;
|
|
20
18
|
view: EditorView;
|
|
21
19
|
allowColumnResizing?: boolean;
|
|
20
|
+
allowTableResizing?: boolean;
|
|
21
|
+
allowTableAlignment?: boolean;
|
|
22
22
|
allowControls?: boolean;
|
|
23
23
|
cellMinWidth?: number;
|
|
24
24
|
portalProviderAPI: PortalProviderAPI;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -13,14 +13,12 @@ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
|
13
13
|
import type { PluginConfig, TableSharedState } from './types';
|
|
14
14
|
export interface TablePluginOptions {
|
|
15
15
|
tableOptions: PluginConfig;
|
|
16
|
-
tableResizingEnabled?: boolean;
|
|
17
16
|
dragAndDropEnabled?: boolean;
|
|
17
|
+
isTableScalingEnabled?: boolean;
|
|
18
18
|
allowContextualMenu?: boolean;
|
|
19
19
|
fullWidthEnabled?: boolean;
|
|
20
20
|
wasFullWidthEnabled?: boolean;
|
|
21
21
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
22
|
-
isTableScalingEnabled?: boolean;
|
|
23
|
-
isTableAlignmentEnabled?: boolean;
|
|
24
22
|
isNewColumnResizingEnabled?: boolean;
|
|
25
23
|
isCommentEditor?: boolean;
|
|
26
24
|
isChromelessEditor?: boolean;
|
|
@@ -5,4 +5,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape,
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface PluginConfig {
|
|
|
45
45
|
advanced?: boolean;
|
|
46
46
|
allowBackgroundColor?: boolean;
|
|
47
47
|
allowColumnResizing?: boolean;
|
|
48
|
+
allowTableResizing?: boolean;
|
|
49
|
+
allowTableAlignment?: boolean;
|
|
48
50
|
allowHeaderColumn?: boolean;
|
|
49
51
|
allowHeaderRow?: boolean;
|
|
50
52
|
allowMergeCells?: boolean;
|
|
@@ -102,7 +104,6 @@ export interface TablePluginState {
|
|
|
102
104
|
widthToWidest?: WidthToWidest;
|
|
103
105
|
getIntl: () => IntlShape;
|
|
104
106
|
wasFullWidthModeEnabled?: boolean;
|
|
105
|
-
isTableResizingEnabled?: boolean;
|
|
106
107
|
isDragAndDropEnabled?: boolean;
|
|
107
108
|
isTableHovered?: boolean;
|
|
108
109
|
isTableScalingEnabled?: boolean;
|