@atlaskit/editor-plugin-table 7.25.2 → 7.25.4
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 +18 -0
- package/dist/cjs/commands/column-resize.js +4 -1
- package/dist/cjs/commands-with-analytics.js +2 -1
- package/dist/cjs/event-handlers.js +3 -2
- package/dist/cjs/nodeviews/TableComponent.js +18 -19
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/nodeviews/lazy-node-views.js +1 -5
- package/dist/cjs/nodeviews/table.js +18 -8
- package/dist/cjs/plugin.js +6 -4
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +10 -5
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/main.js +0 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -1
- package/dist/cjs/toolbar.js +10 -6
- package/dist/cjs/ui/DragHandle/index.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/commands/column-resize.js +4 -1
- package/dist/es2019/commands-with-analytics.js +2 -1
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +17 -19
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/nodeviews/lazy-node-views.js +1 -5
- package/dist/es2019/nodeviews/table.js +21 -8
- package/dist/es2019/plugin.js +6 -4
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +8 -6
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +3 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +5 -3
- package/dist/es2019/toolbar.js +10 -10
- package/dist/es2019/ui/DragHandle/index.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/commands/column-resize.js +4 -1
- package/dist/esm/commands-with-analytics.js +2 -1
- package/dist/esm/event-handlers.js +3 -2
- package/dist/esm/nodeviews/TableComponent.js +18 -19
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/nodeviews/lazy-node-views.js +1 -5
- package/dist/esm/nodeviews/table.js +18 -8
- package/dist/esm/plugin.js +6 -4
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +10 -5
- package/dist/esm/pm-plugins/keymap.js +2 -2
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +3 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +5 -2
- package/dist/esm/toolbar.js +10 -6
- package/dist/esm/ui/DragHandle/index.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/types/commands/column-resize.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
- package/package.json +9 -12
- package/src/commands/column-resize.ts +7 -2
- package/src/commands-with-analytics.ts +2 -0
- package/src/event-handlers.ts +2 -1
- package/src/nodeviews/TableComponent.tsx +17 -14
- package/src/nodeviews/TableResizer.tsx +1 -0
- package/src/nodeviews/lazy-node-views.ts +0 -4
- package/src/nodeviews/table.tsx +30 -8
- package/src/plugin.tsx +8 -2
- package/src/pm-plugins/drag-and-drop/plugin.ts +9 -4
- package/src/pm-plugins/keymap.ts +2 -0
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +11 -6
- package/src/pm-plugins/table-resizing/plugin.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -3
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -3
- package/src/toolbar.tsx +10 -1
- package/src/ui/DragHandle/index.tsx +1 -1
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +6 -2
- package/src/ui/FloatingContextualMenu/index.tsx +3 -0
- package/dist/cjs/nodeviews/ignore-mutation-delegate.js +0 -23
- package/dist/es2019/nodeviews/ignore-mutation-delegate.js +0 -20
- package/dist/esm/nodeviews/ignore-mutation-delegate.js +0 -17
- package/dist/types/nodeviews/ignore-mutation-delegate.d.ts +0 -5
- package/dist/types-ts4.5/nodeviews/ignore-mutation-delegate.d.ts +0 -5
- package/src/nodeviews/ignore-mutation-delegate.ts +0 -28
|
@@ -22,7 +22,8 @@ const FloatingContextualMenu = ({
|
|
|
22
22
|
editorAnalyticsAPI,
|
|
23
23
|
getEditorContainerWidth,
|
|
24
24
|
getEditorFeatureFlags,
|
|
25
|
-
isCellMenuOpenByKeyboard
|
|
25
|
+
isCellMenuOpenByKeyboard,
|
|
26
|
+
isCommentEditor
|
|
26
27
|
}) => {
|
|
27
28
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
28
29
|
const {
|
|
@@ -76,7 +77,8 @@ const FloatingContextualMenu = ({
|
|
|
76
77
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
77
78
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
78
79
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
79
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
80
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
81
|
+
isCommentEditor: isCommentEditor
|
|
80
82
|
})));
|
|
81
83
|
};
|
|
82
84
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -149,6 +149,7 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
149
149
|
getEditorContainerWidth = _ref4.getEditorContainerWidth,
|
|
150
150
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
151
151
|
isTableFixedColumnWidthsOptionEnabled = _ref4.isTableFixedColumnWidthsOptionEnabled,
|
|
152
|
+
isCommentEditor = _ref4.isCommentEditor,
|
|
152
153
|
ariaNotify = _ref4.ariaNotify,
|
|
153
154
|
getIntl = _ref4.getIntl;
|
|
154
155
|
return function (state, dispatch, view) {
|
|
@@ -197,7 +198,9 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
197
198
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
198
199
|
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
199
200
|
}
|
|
200
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent')
|
|
201
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
202
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
203
|
+
isTableScalingEnabled && isCommentEditor;
|
|
201
204
|
var initialResizeState = getResizeState({
|
|
202
205
|
minWidth: tableCellMinWidth,
|
|
203
206
|
maxSize: maxSize,
|
|
@@ -188,7 +188,7 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
|
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
190
|
export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
|
|
191
|
-
return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, inputMethod, ariaNotify, getIntl) {
|
|
191
|
+
return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, inputMethod, ariaNotify, getIntl) {
|
|
192
192
|
return withEditorAnalyticsAPI(function (state) {
|
|
193
193
|
var _getSelectedTableInfo2 = getSelectedTableInfo(state.selection),
|
|
194
194
|
table = _getSelectedTableInfo2.table,
|
|
@@ -215,6 +215,7 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
|
|
|
215
215
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
216
216
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
217
217
|
isTableFixedColumnWidthsOptionEnabled: isTableFixedColumnWidthsOptionEnabled,
|
|
218
|
+
isCommentEditor: isCommentEditor,
|
|
218
219
|
ariaNotify: ariaNotify,
|
|
219
220
|
getIntl: getIntl
|
|
220
221
|
}));
|
|
@@ -220,7 +220,8 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
|
|
|
220
220
|
if (isTableHovered) {
|
|
221
221
|
if (isDragAndDropEnabled) {
|
|
222
222
|
var _getDragDropPluginSta = getDragDropPluginState(state),
|
|
223
|
-
|
|
223
|
+
_getDragDropPluginSta2 = _getDragDropPluginSta.isDragMenuOpen,
|
|
224
|
+
isDragMenuOpen = _getDragDropPluginSta2 === void 0 ? false : _getDragDropPluginSta2;
|
|
224
225
|
!isDragMenuOpen && setTableHovered(false)(state, dispatch);
|
|
225
226
|
} else {
|
|
226
227
|
setTableHovered(false)(state, dispatch);
|
|
@@ -430,7 +431,7 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
430
431
|
};
|
|
431
432
|
export var withCellTracking = function withCellTracking(eventHandler) {
|
|
432
433
|
return function (view, mouseEvent) {
|
|
433
|
-
if (getPluginState(view.state).isDragAndDropEnabled && !getDragDropPluginState(view.state).isDragging) {
|
|
434
|
+
if (getPluginState(view.state).isDragAndDropEnabled && getDragDropPluginState(view.state) && !getDragDropPluginState(view.state).isDragging) {
|
|
434
435
|
trackCellLocation(view, mouseEvent);
|
|
435
436
|
}
|
|
436
437
|
return eventHandler(view, mouseEvent);
|
|
@@ -353,6 +353,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
353
353
|
_createClass(TableComponent, [{
|
|
354
354
|
key: "componentDidMount",
|
|
355
355
|
value: function componentDidMount() {
|
|
356
|
+
var _this$table2;
|
|
356
357
|
var _this$props7 = this.props,
|
|
357
358
|
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
358
359
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
@@ -370,10 +371,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
370
371
|
this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
|
-
|
|
374
|
-
var _this$table2;
|
|
375
|
-
this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
|
|
376
|
-
}
|
|
374
|
+
this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
|
|
377
375
|
if (fg('platform_editor_react_18_table_column_resize_hover')) {
|
|
378
376
|
var _this$table3;
|
|
379
377
|
this === null || this === void 0 || (_this$table3 = this.table) === null || _this$table3 === void 0 || _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
@@ -427,7 +425,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
427
425
|
}, {
|
|
428
426
|
key: "componentWillUnmount",
|
|
429
427
|
value: function componentWillUnmount() {
|
|
430
|
-
var _this$resizeObserver;
|
|
428
|
+
var _this$resizeObserver, _this$table5;
|
|
431
429
|
var _this$props8 = this.props,
|
|
432
430
|
allowColumnResizing = _this$props8.allowColumnResizing,
|
|
433
431
|
eventDispatcher = _this$props8.eventDispatcher,
|
|
@@ -462,10 +460,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
462
460
|
var _this$table4;
|
|
463
461
|
this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
464
462
|
}
|
|
465
|
-
|
|
466
|
-
var _this$table5;
|
|
467
|
-
this === null || this === void 0 || (_this$table5 = this.table) === null || _this$table5 === void 0 || _this$table5.removeEventListener('mouseout', this.handleMouseOut);
|
|
468
|
-
}
|
|
463
|
+
this === null || this === void 0 || (_this$table5 = this.table) === null || _this$table5 === void 0 || _this$table5.removeEventListener('mouseout', this.handleMouseOut);
|
|
469
464
|
if (fg('platform_editor_react_18_table_column_resize_hover')) {
|
|
470
465
|
var _this$table6;
|
|
471
466
|
this === null || this === void 0 || (_this$table6 = this.table) === null || _this$table6 === void 0 || _this$table6.removeEventListener('mouseover', this.handleMouseOver);
|
|
@@ -537,7 +532,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
537
532
|
var isNumberOfColumnsChanged = tablesHaveDifferentNoOfColumns(tableNode, this.node);
|
|
538
533
|
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth || isNumberColumnChanged || isNumberOfColumnsChanged;
|
|
539
534
|
if (force || maybeScale) {
|
|
540
|
-
var _this$containerWidth, _this$props$options;
|
|
535
|
+
var _this$containerWidth, _this$props$options, _this$props$options2, _this$props$options3;
|
|
541
536
|
var containerWidthValue = containerWidth.width;
|
|
542
537
|
var isWidthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.width) !== containerWidthValue;
|
|
543
538
|
var wasTableResized = hasTableBeenResized(this.node);
|
|
@@ -548,10 +543,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
548
543
|
var _getEditorFeatureFlag4 = getEditorFeatureFlags(),
|
|
549
544
|
_getEditorFeatureFlag5 = _getEditorFeatureFlag4.tableWithFixedColumnWidthsOption,
|
|
550
545
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag5 === void 0 ? false : _getEditorFeatureFlag5;
|
|
551
|
-
var isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options)
|
|
552
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
546
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options = this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
547
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
548
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
549
|
+
!!((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled) && !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isCommentEditor);
|
|
553
550
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
554
|
-
var _this$props$
|
|
551
|
+
var _this$props$options4;
|
|
555
552
|
var resizeState = getResizeState({
|
|
556
553
|
minWidth: COLUMN_MIN_WIDTH,
|
|
557
554
|
maxSize: tableRenderWidth,
|
|
@@ -563,7 +560,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
563
560
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
564
561
|
});
|
|
565
562
|
var shouldScaleOnColgroupUpdate = false;
|
|
566
|
-
if ((_this$props$
|
|
563
|
+
if ((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
567
564
|
shouldScaleOnColgroupUpdate = true;
|
|
568
565
|
}
|
|
569
566
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && tableNode.attrs.displayMode !== 'fixed') {
|
|
@@ -583,7 +580,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
583
580
|
}, {
|
|
584
581
|
key: "componentDidUpdate",
|
|
585
582
|
value: function componentDidUpdate(_, prevState) {
|
|
586
|
-
var _this$props$
|
|
583
|
+
var _this$props$options5,
|
|
584
|
+
_this$props$options6,
|
|
587
585
|
_this$wrapper,
|
|
588
586
|
_this3 = this;
|
|
589
587
|
var _this$props11 = this.props,
|
|
@@ -611,8 +609,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
611
609
|
shouldScale = true;
|
|
612
610
|
shouldHandleColgroupUpdates = true;
|
|
613
611
|
}
|
|
614
|
-
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
615
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
612
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
613
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
|
|
616
614
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
617
615
|
shouldScale = true;
|
|
618
616
|
shouldHandleColgroupUpdates = true;
|
|
@@ -623,7 +621,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
623
621
|
if (isInDanger && !table) {
|
|
624
622
|
clearHoverSelection()(view.state, view.dispatch);
|
|
625
623
|
}
|
|
626
|
-
if ((_this$props$
|
|
624
|
+
if ((_this$props$options6 = this.props.options) !== null && _this$props$options6 !== void 0 && _this$props$options6.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
627
625
|
this.removeInlineTableWidth();
|
|
628
626
|
}
|
|
629
627
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -710,6 +708,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
710
708
|
key: "render",
|
|
711
709
|
value: function render() {
|
|
712
710
|
var _this4 = this,
|
|
711
|
+
_this$props$options7,
|
|
713
712
|
_classnames;
|
|
714
713
|
var _this$props12 = this.props,
|
|
715
714
|
view = _this$props12.view,
|
|
@@ -828,7 +827,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
828
827
|
stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
|
|
829
828
|
_getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
|
|
830
829
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
|
|
831
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
830
|
+
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options7 = this.props.options) !== null && _this$props$options7 !== void 0 && _this$props$options7.isCommentEditor));
|
|
832
831
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
833
832
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
834
833
|
, {
|
|
@@ -255,7 +255,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
255
255
|
prevNode: node,
|
|
256
256
|
start: pos + 1,
|
|
257
257
|
parentWidth: newWidth
|
|
258
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled);
|
|
258
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
259
259
|
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth;
|
|
260
260
|
var closestSnap = findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
261
261
|
updateActiveGuidelines(closestSnap);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import ignoreMutationDelegate from './ignore-mutation-delegate';
|
|
4
3
|
// TODO: Clean up ED-23976
|
|
5
4
|
import { createTableView } from './table';
|
|
6
5
|
import TableCell from './TableCell';
|
|
@@ -36,10 +35,7 @@ export var lazyTableView = function lazyTableView(options) {
|
|
|
36
35
|
getNodeViewOptions: function getNodeViewOptions() {
|
|
37
36
|
return options;
|
|
38
37
|
},
|
|
39
|
-
loader: loader
|
|
40
|
-
lazyNodeViewOptions: {
|
|
41
|
-
ignoreMutationDelegate: ignoreMutationDelegate
|
|
42
|
-
}
|
|
38
|
+
loader: loader
|
|
43
39
|
});
|
|
44
40
|
};
|
|
45
41
|
export var lazyTableCellView = function lazyTableCellView(options) {
|
|
@@ -26,7 +26,6 @@ import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizin
|
|
|
26
26
|
import { generateColgroup } from '../pm-plugins/table-resizing/utils';
|
|
27
27
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
28
28
|
import { isTableNested } from '../utils';
|
|
29
|
-
import ignoreMutationDelegate from './ignore-mutation-delegate';
|
|
30
29
|
import TableComponent from './TableComponent';
|
|
31
30
|
import { TableComponentWithSharedState } from './TableComponentWithSharedState';
|
|
32
31
|
var tableAttributes = function tableAttributes(node) {
|
|
@@ -255,16 +254,27 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
255
254
|
}, {
|
|
256
255
|
key: "ignoreMutation",
|
|
257
256
|
value: function ignoreMutation(mutation) {
|
|
258
|
-
var
|
|
257
|
+
var type = mutation.type,
|
|
258
|
+
_mutation$target = mutation.target,
|
|
259
|
+
nodeName = _mutation$target.nodeName,
|
|
260
|
+
firstChild = _mutation$target.firstChild;
|
|
261
|
+
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// ED-16668
|
|
266
|
+
// Do not remove this fixes an issue with windows firefox that relates to
|
|
267
|
+
// the addition of the shadow sentinels
|
|
268
|
+
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'TABLE' && ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'COLGROUP' || (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'SPAN')) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
259
271
|
if (fg('platform_editor_react_18_table_insertion_cursor')) {
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
|
|
272
|
+
if (!this.contentDOM) {
|
|
273
|
+
return true;
|
|
265
274
|
}
|
|
275
|
+
return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
|
|
266
276
|
}
|
|
267
|
-
return
|
|
277
|
+
return true;
|
|
268
278
|
}
|
|
269
279
|
}, {
|
|
270
280
|
key: "destroy",
|
package/dist/esm/plugin.js
CHANGED
|
@@ -68,7 +68,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
68
68
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
69
69
|
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
70
70
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
71
|
-
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && isTableFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent')
|
|
71
|
+
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
72
|
+
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
72
73
|
var isCellBackgroundDuplicated = (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
|
|
73
74
|
return {
|
|
74
75
|
name: 'table',
|
|
@@ -187,7 +188,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
187
188
|
allowColumnResizing = _pluginConfig2.allowColumnResizing;
|
|
188
189
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
189
190
|
lastColumnResizable: !fullWidthEnabled
|
|
190
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled) : undefined;
|
|
191
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
191
192
|
}
|
|
192
193
|
}, {
|
|
193
194
|
name: 'tableEditing',
|
|
@@ -256,7 +257,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
256
257
|
name: 'tableDragAndDrop',
|
|
257
258
|
plugin: function plugin(_ref12) {
|
|
258
259
|
var dispatch = _ref12.dispatch;
|
|
259
|
-
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
|
260
|
+
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor) : undefined;
|
|
260
261
|
}
|
|
261
262
|
}, {
|
|
262
263
|
name: 'tableViewModeSort',
|
|
@@ -410,7 +411,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
410
411
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
411
412
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
412
413
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
413
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
414
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
415
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
414
416
|
}), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
415
417
|
editorView: editorView,
|
|
416
418
|
mountPoint: popupsMountPoint,
|
|
@@ -18,7 +18,7 @@ import { DropTargetType } from './consts';
|
|
|
18
18
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
19
19
|
import { pluginKey } from './plugin-key';
|
|
20
20
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
21
|
-
var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) {
|
|
21
|
+
var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) {
|
|
22
22
|
var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
23
23
|
var rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
|
|
24
24
|
canMonitor: function canMonitor(_ref) {
|
|
@@ -159,7 +159,9 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
159
159
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
160
160
|
isTableScalingEnabledOnCurrentTable = tableNode.attrs.displayMode !== 'fixed';
|
|
161
161
|
}
|
|
162
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent')
|
|
162
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
163
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
164
|
+
isTableScalingEnabled && isCommentEditor;
|
|
163
165
|
insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable, undefined, shouldUseIncreasedScalingPercent);
|
|
164
166
|
}
|
|
165
167
|
}
|
|
@@ -171,6 +173,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
171
173
|
export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
172
174
|
var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
173
175
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
176
|
+
var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
174
177
|
return new SafePlugin({
|
|
175
178
|
state: createPluginState(dispatch, function (state) {
|
|
176
179
|
return {
|
|
@@ -190,7 +193,8 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
190
193
|
var _getTablePluginState5 = getTablePluginState(newState),
|
|
191
194
|
newTargetCellPosition = _getTablePluginState5.targetCellPosition;
|
|
192
195
|
var _getPluginState = getPluginState(newState),
|
|
193
|
-
|
|
196
|
+
_getPluginState$isDra = _getPluginState.isDragMenuOpen,
|
|
197
|
+
isDragMenuOpen = _getPluginState$isDra === void 0 ? false : _getPluginState$isDra,
|
|
194
198
|
dragMenuIndex = _getPluginState.dragMenuIndex;
|
|
195
199
|
transactions.forEach(function (transaction) {
|
|
196
200
|
if (transaction.getMeta('selectedRowViaKeyboard')) {
|
|
@@ -238,7 +242,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
238
242
|
},
|
|
239
243
|
view: function view(editorView) {
|
|
240
244
|
return {
|
|
241
|
-
destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled)
|
|
245
|
+
destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)
|
|
242
246
|
};
|
|
243
247
|
},
|
|
244
248
|
props: {
|
|
@@ -272,7 +276,8 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
272
276
|
var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
|
|
273
277
|
var keysToTrap = ['Enter', ' '];
|
|
274
278
|
var _getPluginState3 = getPluginState(view.state),
|
|
275
|
-
|
|
279
|
+
_getPluginState3$isDr = _getPluginState3.isDragMenuOpen,
|
|
280
|
+
isDragMenuOpen = _getPluginState3$isDr === void 0 ? false : _getPluginState3$isDr;
|
|
276
281
|
|
|
277
282
|
// drag handle is focused, and user presses any key return them back to editing
|
|
278
283
|
if (isDragHandleFocused && !isDragMenuOpen && !keysToTrap.includes(event.key)) {
|
|
@@ -69,8 +69,8 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
69
69
|
ariaNotify: ariaNotifyPlugin,
|
|
70
70
|
getIntl: getIntl
|
|
71
71
|
}), list);
|
|
72
|
-
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
73
|
-
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
72
|
+
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
73
|
+
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
74
74
|
bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing({
|
|
75
75
|
ariaNotify: ariaNotifyPlugin,
|
|
76
76
|
getIntl: getIntl
|
|
@@ -13,7 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
13
13
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
14
14
|
import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
15
15
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
16
|
-
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove,
|
|
16
|
+
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOver, handleMouseUp, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
17
17
|
import { lazyTableCellView, lazyTableHeaderView, lazyTableRowView, lazyTableView } from '../nodeviews/lazy-node-views';
|
|
18
18
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
19
19
|
import { fixTables, replaceSelectedTable } from '../transforms';
|
|
@@ -274,7 +274,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
274
274
|
mousedown: withCellTracking(handleMouseDown),
|
|
275
275
|
mouseover: fg('platform_editor_react_18_table_column_resize_hover') ? undefined : withCellTracking(whenTableInFocus(handleMouseOver)),
|
|
276
276
|
mouseleave: handleMouseLeave,
|
|
277
|
-
mouseout: fg('editor_react_18_fix_table_delete_col_decorations') ? undefined : whenTableInFocus(handleMouseOut),
|
|
278
277
|
mousemove: whenTableInFocus(handleMouseMove),
|
|
279
278
|
mouseenter: handleMouseEnter,
|
|
280
279
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
@@ -17,7 +17,7 @@ import { evenColumns, setDragging, stopResizing } from './commands';
|
|
|
17
17
|
import { getPluginState } from './plugin-factory';
|
|
18
18
|
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
19
19
|
import { scaleResizeState } from './utils/resize-column';
|
|
20
|
-
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled) {
|
|
20
|
+
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
21
21
|
var state = view.state,
|
|
22
22
|
dispatch = view.dispatch;
|
|
23
23
|
var editorDisabled = !view.editable;
|
|
@@ -70,7 +70,9 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
70
70
|
start: start,
|
|
71
71
|
domAtPos: domAtPos,
|
|
72
72
|
isTableScalingEnabled: shouldScale,
|
|
73
|
-
shouldUseIncreasedScalingPercent: isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent')
|
|
73
|
+
shouldUseIncreasedScalingPercent: isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
74
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
75
|
+
isTableScalingEnabled && !!isCommentEditor
|
|
74
76
|
});
|
|
75
77
|
if (evenColumns({
|
|
76
78
|
resizeState: resizeState,
|
|
@@ -158,7 +160,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
158
160
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
159
161
|
}
|
|
160
162
|
var resizedDelta = clientX - startX;
|
|
161
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
163
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || isTableScalingEnabled && !!isCommentEditor;
|
|
162
164
|
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
163
165
|
var newResizeState = resizeColumnAndTable({
|
|
164
166
|
resizeState: resizeState,
|
|
@@ -263,7 +265,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
263
265
|
var map = TableMap.get(table);
|
|
264
266
|
var colIndex = map.colCount($cell.pos - $cell.start(-1)) + $cell.nodeAfter.attrs.colspan - 1;
|
|
265
267
|
var shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
266
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
268
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || isTableScalingEnabled && isCommentEditor;
|
|
267
269
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
268
270
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
269
271
|
}
|
|
@@ -8,7 +8,7 @@ import { handleMouseDown } from './event-handlers';
|
|
|
8
8
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
import { getResizeCellPos } from './utils';
|
|
11
|
-
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled) {
|
|
11
|
+
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
12
12
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
13
13
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
14
14
|
return new SafePlugin({
|
|
@@ -46,7 +46,7 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
46
46
|
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
47
47
|
}
|
|
48
48
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
49
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled)) {
|
|
49
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
50
50
|
var _state = view.state,
|
|
51
51
|
_dispatch = view.dispatch;
|
|
52
52
|
return setResizeHandlePos(resizeHandlePos)(_state, _dispatch);
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { getSelectedTableInfo } from '../../../utils';
|
|
9
9
|
import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
10
10
|
import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
|
|
@@ -299,6 +299,7 @@ export var normaliseTableLayout = function normaliseTableLayout(input) {
|
|
|
299
299
|
export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, getEditorContainerWidth) {
|
|
300
300
|
var isTableScalingEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
301
301
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
302
|
+
var isCommentEditor = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
302
303
|
// Fail early so that we don't do complex calculations for no reason
|
|
303
304
|
var numColumnsSelected = rect.right - rect.left;
|
|
304
305
|
if (numColumnsSelected <= 1) {
|
|
@@ -344,7 +345,7 @@ export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFrom
|
|
|
344
345
|
start: table.start,
|
|
345
346
|
domAtPos: domAtPos,
|
|
346
347
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
347
|
-
shouldUseIncreasedScalingPercent: isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
348
|
+
shouldUseIncreasedScalingPercent: isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || isTableScalingEnabled && isCommentEditor
|
|
348
349
|
});
|
|
349
350
|
var newResizeState = evenSelectedColumnsWidths(resizeState, rect);
|
|
350
351
|
var widthsBefore = resizeState.widths;
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { updateColumnWidths } from '../../../transforms';
|
|
9
9
|
import { getTableWidth } from '../../../utils';
|
|
10
10
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -102,6 +102,7 @@ export function scaleTableTo(state, maxSize) {
|
|
|
102
102
|
export var previewScaleTable = function previewScaleTable(tableRef, options, domAtPos) {
|
|
103
103
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
104
104
|
var isTableWithFixedColumnWidthsOptionEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
105
|
+
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
105
106
|
var node = options.node,
|
|
106
107
|
start = options.start,
|
|
107
108
|
parentWidth = options.parentWidth;
|
|
@@ -124,7 +125,9 @@ export var previewScaleTable = function previewScaleTable(tableRef, options, dom
|
|
|
124
125
|
syncStickyRowToTable(tableRef);
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
128
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
|
|
129
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
130
|
+
isTableScalingEnabled && isCommentEditor;
|
|
128
131
|
var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos, false,
|
|
129
132
|
// Here isTableScalingEnabled = false
|
|
130
133
|
shouldUseIncreasedScalingPercent) : scale(tableRef, options, domAtPos, false, shouldUseIncreasedScalingPercent);
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -129,6 +129,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
129
129
|
var isCellBackgroundDuplicated = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
130
130
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
131
131
|
var shouldUseIncreasedScalingPercent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
132
|
+
var isCommentEditor = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
132
133
|
var top = initialSelectionRect.top,
|
|
133
134
|
bottom = initialSelectionRect.bottom,
|
|
134
135
|
right = initialSelectionRect.right,
|
|
@@ -227,7 +228,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
227
228
|
}
|
|
228
229
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
|
|
229
230
|
var _newResizeStateWithAn;
|
|
230
|
-
var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
|
231
|
+
var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) : undefined;
|
|
231
232
|
var wouldChange = (_newResizeStateWithAn = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn !== void 0 ? _newResizeStateWithAn : false;
|
|
232
233
|
var distributeColumnWidths = function distributeColumnWidths(state, dispatch) {
|
|
233
234
|
if (newResizeStateWithAnalytics) {
|
|
@@ -372,8 +373,8 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
372
373
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
373
374
|
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !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) : [];
|
|
374
375
|
var isCellBackgroundDuplicated = getEditorFeatureFlags().tableDuplicateCellColouring || false;
|
|
375
|
-
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
376
|
-
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : [];
|
|
376
|
+
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
377
|
+
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
377
378
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
378
379
|
|
|
379
380
|
// Check if we need to show confirm dialog for delete button
|
|
@@ -465,11 +466,12 @@ var getCellItems = function getCellItems(state, view, _ref3, getEditorContainerW
|
|
|
465
466
|
var isCellBackgroundDuplicated = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
466
467
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
467
468
|
var shouldUseIncreasedScalingPercent = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
469
|
+
var isCommentEditor = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
468
470
|
var initialSelectionRect = getClosestSelectionRect(state);
|
|
469
471
|
if (initialSelectionRect) {
|
|
470
472
|
var cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
471
473
|
formatMessage: formatMessage
|
|
472
|
-
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
474
|
+
}, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
473
475
|
return [cellOptions, separator(cellOptions.hidden)];
|
|
474
476
|
}
|
|
475
477
|
return [];
|
|
@@ -477,12 +479,13 @@ var getCellItems = function getCellItems(state, view, _ref3, getEditorContainerW
|
|
|
477
479
|
export var getDistributeConfig = function getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
478
480
|
var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
479
481
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
482
|
+
var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
480
483
|
return function (state, dispatch, editorView) {
|
|
481
484
|
var selectionOrTableRect = getClosestSelectionOrTableRect(state);
|
|
482
485
|
if (!editorView || !selectionOrTableRect) {
|
|
483
486
|
return false;
|
|
484
487
|
}
|
|
485
|
-
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled);
|
|
488
|
+
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
486
489
|
if (newResizeStateWithAnalytics) {
|
|
487
490
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, newResizeStateWithAnalytics)(state, dispatch);
|
|
488
491
|
return true;
|
|
@@ -498,6 +501,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
498
501
|
var formatMessage = _ref4.formatMessage;
|
|
499
502
|
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
500
503
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
504
|
+
var isCommentEditor = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
501
505
|
var pluginState = getPluginState(editorState);
|
|
502
506
|
var selectionOrTableRect = getClosestSelectionOrTableRect(editorState);
|
|
503
507
|
if (!selectionOrTableRect || !editorView) {
|
|
@@ -513,7 +517,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
513
517
|
title: formatMessage(messages.distributeColumns),
|
|
514
518
|
icon: DistributeColumnIcon,
|
|
515
519
|
onClick: function onClick(state, dispatch, view) {
|
|
516
|
-
return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled)(state, dispatch, view);
|
|
520
|
+
return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)(state, dispatch, view);
|
|
517
521
|
},
|
|
518
522
|
disabled: !wouldChange
|
|
519
523
|
});
|
|
@@ -47,7 +47,8 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
47
47
|
hoveredColumns = _getPluginState.hoveredColumns,
|
|
48
48
|
hoveredRows = _getPluginState.hoveredRows;
|
|
49
49
|
var _getDnDPluginState = getDnDPluginState(state),
|
|
50
|
-
|
|
50
|
+
_getDnDPluginState$is = _getDnDPluginState.isDragMenuOpen,
|
|
51
|
+
isDragMenuOpen = _getDnDPluginState$is === void 0 ? false : _getDnDPluginState$is;
|
|
51
52
|
var isRow = direction === 'row';
|
|
52
53
|
var isColumn = direction === 'column';
|
|
53
54
|
|