@atlaskit/editor-plugin-table 7.17.1 → 7.17.3
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 +27 -0
- package/dist/cjs/nodeviews/TableResizer.js +2 -0
- package/dist/cjs/plugin.js +5 -3
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/es2019/nodeviews/TableResizer.js +2 -0
- package/dist/es2019/plugin.js +37 -33
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/esm/nodeviews/TableResizer.js +2 -0
- package/dist/esm/plugin.js +5 -3
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/types/plugin.d.ts +1 -0
- 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/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +8 -0
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +16 -0
- package/dist/types/ui/TableFloatingControls/index.d.ts +8 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- 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/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +16 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +8 -0
- package/package.json +144 -147
- package/src/nodeviews/TableResizer.tsx +3 -0
- package/src/plugin.tsx +12 -3
- package/src/pm-plugins/table-resizing/event-handlers.ts +4 -3
- package/src/pm-plugins/table-resizing/plugin.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#111381](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111381)
|
|
8
|
+
[`5ec7ab3d39035`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ec7ab3d39035) -
|
|
9
|
+
Replace the LD flag controlling new column resizing experience with statsig experiment
|
|
10
|
+
|
|
11
|
+
## 7.17.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#110390](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110390)
|
|
16
|
+
[`bead123202369`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bead123202369) -
|
|
17
|
+
[ux] [ED-23642] Reordering the typeahead so that date, status, code block & info panel are above
|
|
18
|
+
the fold (in the top 5 results)
|
|
19
|
+
- [#111045](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111045)
|
|
20
|
+
[`2f693993423ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2f693993423ec) -
|
|
21
|
+
improve input latency of drag and drop experience and hide drag handle during resizing
|
|
22
|
+
- [#111428](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111428)
|
|
23
|
+
[`5679a3e527073`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5679a3e527073) -
|
|
24
|
+
ED-23129: Disabled internal column resizing for nested tables
|
|
25
|
+
- [#111254](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111254)
|
|
26
|
+
[`c76f505dccf41`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c76f505dccf41) -
|
|
27
|
+
[ux] Fixed resizeAmount for left-aligned tables when internal column resizing is enabled.
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 7.17.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -216,6 +216,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
216
216
|
tableLocalId: node.attrs.localId,
|
|
217
217
|
tableRef: tableRef
|
|
218
218
|
});
|
|
219
|
+
tr.setMeta('is-resizer-resizing', true);
|
|
219
220
|
tr.setMeta(_tableAnalytics.META_KEYS.OVERFLOW_TRIGGER, {
|
|
220
221
|
name: _analytics.TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
221
222
|
});
|
|
@@ -281,6 +282,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
281
282
|
tableLocalId: '',
|
|
282
283
|
tableRef: null
|
|
283
284
|
});
|
|
285
|
+
tr.setMeta('is-resizer-resizing', false);
|
|
284
286
|
var frameRateSamples = endMeasure();
|
|
285
287
|
if (frameRateSamples.length > 0) {
|
|
286
288
|
var resizeFrameRatePayloads = (0, _analytics2.generateResizeFrameRatePayloads)({
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -177,12 +177,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
177
177
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
178
178
|
tableOptions = _ref5.tableOptions,
|
|
179
179
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
180
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled
|
|
180
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
181
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
181
182
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
182
183
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
183
184
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
184
185
|
lastColumnResizable: !fullWidthEnabled
|
|
185
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
186
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
186
187
|
}
|
|
187
188
|
}, {
|
|
188
189
|
name: 'tableEditing',
|
|
@@ -438,13 +439,14 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
438
439
|
},
|
|
439
440
|
pluginsOptions: {
|
|
440
441
|
quickInsert: function quickInsert(_ref19) {
|
|
442
|
+
var _options$getEditorFea3;
|
|
441
443
|
var formatMessage = _ref19.formatMessage;
|
|
442
444
|
return [{
|
|
443
445
|
id: 'table',
|
|
444
446
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
445
447
|
description: formatMessage(_messages.toolbarInsertBlockMessages.tableDescription),
|
|
446
448
|
keywords: ['cell', 'table'],
|
|
447
|
-
priority: 600,
|
|
449
|
+
priority: options !== null && options !== void 0 && (_options$getEditorFea3 = options.getEditorFeatureFlags) !== null && _options$getEditorFea3 !== void 0 && _options$getEditorFea3.call(options).platformEditorTypeaheadImprovedRelevancy ? 800 : 600,
|
|
448
450
|
keyshortcut: (0, _keymaps.tooltip)(_keymaps.toggleTable),
|
|
449
451
|
icon: function icon() {
|
|
450
452
|
return /*#__PURE__*/_react.default.createElement(_icons.IconTable, null);
|
|
@@ -18,7 +18,7 @@ var _tableAnalytics = require("../table-analytics");
|
|
|
18
18
|
var _commands = require("./commands");
|
|
19
19
|
var _pluginFactory2 = require("./plugin-factory");
|
|
20
20
|
var _utils3 = require("./utils");
|
|
21
|
-
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) {
|
|
21
|
+
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) {
|
|
22
22
|
var state = view.state,
|
|
23
23
|
dispatch = view.dispatch;
|
|
24
24
|
var editorDisabled = !view.editable;
|
|
@@ -147,7 +147,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
147
147
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
148
148
|
}
|
|
149
149
|
var resizedDelta = clientX - startX;
|
|
150
|
-
if ((0,
|
|
150
|
+
if (isNewColumnResizingEnabled && !(0, _utils2.isTableNested)(state, tablePos)) {
|
|
151
151
|
var newResizeState = (0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
|
|
152
152
|
tr = (0, _transforms.updateColumnWidths)(newResizeState, table, start)(tr);
|
|
153
153
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -224,7 +224,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
224
224
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
225
225
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
226
226
|
}
|
|
227
|
-
if ((0,
|
|
227
|
+
if (isNewColumnResizingEnabled && !(0, _utils2.isTableNested)(state, tablePos)) {
|
|
228
228
|
(0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
229
229
|
} else {
|
|
230
230
|
(0, _utils3.resizeColumn)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -16,7 +16,7 @@ var _eventHandlers = require("./event-handlers");
|
|
|
16
16
|
var _pluginFactory2 = require("./plugin-factory");
|
|
17
17
|
var _pluginKey = require("./plugin-key");
|
|
18
18
|
var _utils = require("./utils");
|
|
19
|
-
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
19
|
+
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
20
20
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
21
21
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
22
22
|
return new _safePlugin.SafePlugin({
|
|
@@ -56,7 +56,7 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
59
|
-
if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
59
|
+
if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
60
60
|
var _state = view.state,
|
|
61
61
|
_dispatch = view.dispatch;
|
|
62
62
|
return (0, _commands.setResizeHandlePos)(resizeHandlePos)(_state, _dispatch);
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.resizeColumnAndTable = exports.resizeColumn = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _types = require("../../../types");
|
|
10
|
+
var _alignment = require("../../../utils/alignment");
|
|
10
11
|
var _misc = require("./misc");
|
|
11
12
|
var _resizeLogic = require("./resize-logic");
|
|
12
13
|
var _resizeState = require("./resize-state");
|
|
@@ -36,7 +37,7 @@ var resizeColumnAndTable = exports.resizeColumnAndTable = function resizeColumnA
|
|
|
36
37
|
var tableWidth = tableRef.clientWidth;
|
|
37
38
|
var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
38
39
|
var isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
|
|
39
|
-
var resizeAmount = amount * 2;
|
|
40
|
+
var resizeAmount = tableNode.attrs.layout === _alignment.ALIGN_START && !isOverflowed ? amount : amount * 2;
|
|
40
41
|
|
|
41
42
|
// todo: reimplement - use getTableScalingPercentFrozen to get scaled percent before table width changes dynamically
|
|
42
43
|
// let scalePercent = 1;
|
|
@@ -209,6 +209,7 @@ export const TableResizer = ({
|
|
|
209
209
|
tableLocalId: node.attrs.localId,
|
|
210
210
|
tableRef: tableRef
|
|
211
211
|
});
|
|
212
|
+
tr.setMeta('is-resizer-resizing', true);
|
|
212
213
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
213
214
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
214
215
|
});
|
|
@@ -276,6 +277,7 @@ export const TableResizer = ({
|
|
|
276
277
|
tableLocalId: '',
|
|
277
278
|
tableRef: null
|
|
278
279
|
});
|
|
280
|
+
tr.setMeta('is-resizer-resizing', false);
|
|
279
281
|
const frameRateSamples = endMeasure();
|
|
280
282
|
if (frameRateSamples.length > 0) {
|
|
281
283
|
const resizeFrameRatePayloads = generateResizeFrameRatePayloads({
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -169,14 +169,15 @@ const tablesPlugin = ({
|
|
|
169
169
|
fullWidthEnabled,
|
|
170
170
|
tableOptions,
|
|
171
171
|
getEditorFeatureFlags,
|
|
172
|
-
isTableScalingEnabled
|
|
172
|
+
isTableScalingEnabled,
|
|
173
|
+
isNewColumnResizingEnabled
|
|
173
174
|
} = options || {};
|
|
174
175
|
const {
|
|
175
176
|
allowColumnResizing
|
|
176
177
|
} = pluginConfig(tableOptions);
|
|
177
178
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
178
179
|
lastColumnResizable: !fullWidthEnabled
|
|
179
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
180
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
180
181
|
}
|
|
181
182
|
}, {
|
|
182
183
|
name: 'tableEditing',
|
|
@@ -433,37 +434,40 @@ const tablesPlugin = ({
|
|
|
433
434
|
pluginsOptions: {
|
|
434
435
|
quickInsert: ({
|
|
435
436
|
formatMessage
|
|
436
|
-
}) =>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
437
|
+
}) => {
|
|
438
|
+
var _options$getEditorFea3;
|
|
439
|
+
return [{
|
|
440
|
+
id: 'table',
|
|
441
|
+
title: formatMessage(messages.table),
|
|
442
|
+
description: formatMessage(messages.tableDescription),
|
|
443
|
+
keywords: ['cell', 'table'],
|
|
444
|
+
priority: options !== null && options !== void 0 && (_options$getEditorFea3 = options.getEditorFeatureFlags) !== null && _options$getEditorFea3 !== void 0 && _options$getEditorFea3.call(options).platformEditorTypeaheadImprovedRelevancy ? 800 : 600,
|
|
445
|
+
keyshortcut: tooltip(toggleTable),
|
|
446
|
+
icon: () => /*#__PURE__*/React.createElement(IconTable, null),
|
|
447
|
+
action(insert, state) {
|
|
448
|
+
var _api$table;
|
|
449
|
+
// see comment on tablesPlugin.getSharedState on usage
|
|
450
|
+
const tableState = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
451
|
+
const tableNode = createTableWithWidth({
|
|
452
|
+
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
453
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
454
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled
|
|
455
|
+
})(state.schema);
|
|
456
|
+
const tr = insert(tableNode);
|
|
457
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
458
|
+
action: ACTION.INSERTED,
|
|
459
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
460
|
+
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
461
|
+
attributes: {
|
|
462
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
463
|
+
localId: tableNode.attrs.localId
|
|
464
|
+
},
|
|
465
|
+
eventType: EVENT_TYPE.TRACK
|
|
466
|
+
})(tr);
|
|
467
|
+
return tr;
|
|
468
|
+
}
|
|
469
|
+
}];
|
|
470
|
+
},
|
|
467
471
|
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, () => editorViewRef.current, options, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
468
472
|
}
|
|
469
473
|
};
|
|
@@ -6,13 +6,13 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
6
6
|
import { stopKeyboardColumnResizing } from '../../commands/column-resize';
|
|
7
7
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
8
8
|
import { updateColumnWidths } from '../../transforms';
|
|
9
|
-
import { getSelectedColumnIndexes } from '../../utils';
|
|
9
|
+
import { getSelectedColumnIndexes, isTableNested } from '../../utils';
|
|
10
10
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
11
11
|
import { META_KEYS } from '../table-analytics';
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
14
14
|
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
15
|
-
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) => {
|
|
15
|
+
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) => {
|
|
16
16
|
const {
|
|
17
17
|
state,
|
|
18
18
|
dispatch
|
|
@@ -154,7 +154,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
154
154
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
155
155
|
}
|
|
156
156
|
const resizedDelta = clientX - startX;
|
|
157
|
-
if (
|
|
157
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
158
158
|
const newResizeState = resizeColumnAndTable(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale);
|
|
159
159
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
160
160
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -237,7 +237,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
237
237
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
238
238
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
239
239
|
}
|
|
240
|
-
if (
|
|
240
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
241
241
|
resizeColumnAndTable(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
242
242
|
} else {
|
|
243
243
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -10,7 +10,7 @@ import { pluginKey } from './plugin-key';
|
|
|
10
10
|
import { getResizeCellPos } from './utils';
|
|
11
11
|
export function createPlugin(dispatch, {
|
|
12
12
|
lastColumnResizable = true
|
|
13
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
13
|
+
}, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
14
14
|
return new SafePlugin({
|
|
15
15
|
key: pluginKey,
|
|
16
16
|
state: createPluginState(dispatch, {
|
|
@@ -54,7 +54,7 @@ export function createPlugin(dispatch, {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
57
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
57
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
58
58
|
const {
|
|
59
59
|
state,
|
|
60
60
|
dispatch
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Resize a given column by an amount from the current state
|
|
2
2
|
|
|
3
3
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
4
|
+
import { ALIGN_START } from '../../../utils/alignment';
|
|
4
5
|
import { getTableContainerElementWidth, getTableScalingPercent } from './misc';
|
|
5
6
|
import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
6
7
|
import { updateColgroup } from './resize-state';
|
|
@@ -23,7 +24,7 @@ export const resizeColumnAndTable = (resizeState, colIndex, amount, tableRef, ta
|
|
|
23
24
|
const tableWidth = tableRef.clientWidth;
|
|
24
25
|
const tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
25
26
|
const isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
|
|
26
|
-
let resizeAmount = amount * 2;
|
|
27
|
+
let resizeAmount = tableNode.attrs.layout === ALIGN_START && !isOverflowed ? amount : amount * 2;
|
|
27
28
|
|
|
28
29
|
// todo: reimplement - use getTableScalingPercentFrozen to get scaled percent before table width changes dynamically
|
|
29
30
|
// let scalePercent = 1;
|
|
@@ -206,6 +206,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
206
206
|
tableLocalId: node.attrs.localId,
|
|
207
207
|
tableRef: tableRef
|
|
208
208
|
});
|
|
209
|
+
tr.setMeta('is-resizer-resizing', true);
|
|
209
210
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
210
211
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
211
212
|
});
|
|
@@ -271,6 +272,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
271
272
|
tableLocalId: '',
|
|
272
273
|
tableRef: null
|
|
273
274
|
});
|
|
275
|
+
tr.setMeta('is-resizer-resizing', false);
|
|
274
276
|
var frameRateSamples = endMeasure();
|
|
275
277
|
if (frameRateSamples.length > 0) {
|
|
276
278
|
var resizeFrameRatePayloads = generateResizeFrameRatePayloads({
|
package/dist/esm/plugin.js
CHANGED
|
@@ -170,12 +170,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
170
170
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
171
171
|
tableOptions = _ref5.tableOptions,
|
|
172
172
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
173
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled
|
|
173
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
174
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
174
175
|
var _pluginConfig = pluginConfig(tableOptions),
|
|
175
176
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
176
177
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
177
178
|
lastColumnResizable: !fullWidthEnabled
|
|
178
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
179
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
179
180
|
}
|
|
180
181
|
}, {
|
|
181
182
|
name: 'tableEditing',
|
|
@@ -431,13 +432,14 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
431
432
|
},
|
|
432
433
|
pluginsOptions: {
|
|
433
434
|
quickInsert: function quickInsert(_ref19) {
|
|
435
|
+
var _options$getEditorFea3;
|
|
434
436
|
var formatMessage = _ref19.formatMessage;
|
|
435
437
|
return [{
|
|
436
438
|
id: 'table',
|
|
437
439
|
title: formatMessage(messages.table),
|
|
438
440
|
description: formatMessage(messages.tableDescription),
|
|
439
441
|
keywords: ['cell', 'table'],
|
|
440
|
-
priority: 600,
|
|
442
|
+
priority: options !== null && options !== void 0 && (_options$getEditorFea3 = options.getEditorFeatureFlags) !== null && _options$getEditorFea3 !== void 0 && _options$getEditorFea3.call(options).platformEditorTypeaheadImprovedRelevancy ? 800 : 600,
|
|
441
443
|
keyshortcut: tooltip(toggleTable),
|
|
442
444
|
icon: function icon() {
|
|
443
445
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
@@ -6,13 +6,13 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
6
6
|
import { stopKeyboardColumnResizing } from '../../commands/column-resize';
|
|
7
7
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
8
8
|
import { updateColumnWidths } from '../../transforms';
|
|
9
|
-
import { getSelectedColumnIndexes } from '../../utils';
|
|
9
|
+
import { getSelectedColumnIndexes, isTableNested } from '../../utils';
|
|
10
10
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
11
11
|
import { META_KEYS } from '../table-analytics';
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
14
14
|
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
15
|
-
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) {
|
|
15
|
+
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) {
|
|
16
16
|
var state = view.state,
|
|
17
17
|
dispatch = view.dispatch;
|
|
18
18
|
var editorDisabled = !view.editable;
|
|
@@ -141,7 +141,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
141
141
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
142
142
|
}
|
|
143
143
|
var resizedDelta = clientX - startX;
|
|
144
|
-
if (
|
|
144
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
145
145
|
var newResizeState = resizeColumnAndTable(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
|
|
146
146
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
147
147
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -218,7 +218,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
218
218
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
219
219
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
220
220
|
}
|
|
221
|
-
if (
|
|
221
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
222
222
|
resizeColumnAndTable(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
223
223
|
} else {
|
|
224
224
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -9,7 +9,7 @@ import { handleMouseDown } from './event-handlers';
|
|
|
9
9
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
10
10
|
import { pluginKey } from './plugin-key';
|
|
11
11
|
import { getResizeCellPos } from './utils';
|
|
12
|
-
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
12
|
+
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
13
13
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
14
14
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
15
15
|
return new SafePlugin({
|
|
@@ -49,7 +49,7 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
52
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
52
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
53
53
|
var _state = view.state,
|
|
54
54
|
_dispatch = view.dispatch;
|
|
55
55
|
return setResizeHandlePos(resizeHandlePos)(_state, _dispatch);
|
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
// Resize a given column by an amount from the current state
|
|
5
5
|
|
|
6
6
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
7
|
+
import { ALIGN_START } from '../../../utils/alignment';
|
|
7
8
|
import { getTableContainerElementWidth, getTableScalingPercent } from './misc';
|
|
8
9
|
import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
9
10
|
import { updateColgroup } from './resize-state';
|
|
@@ -31,7 +32,7 @@ export var resizeColumnAndTable = function resizeColumnAndTable(resizeState, col
|
|
|
31
32
|
var tableWidth = tableRef.clientWidth;
|
|
32
33
|
var tableContainerWidth = (_tableRef$closest = tableRef.closest('.pm-table-container')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
33
34
|
var isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
|
|
34
|
-
var resizeAmount = amount * 2;
|
|
35
|
+
var resizeAmount = tableNode.attrs.layout === ALIGN_START && !isOverflowed ? amount : amount * 2;
|
|
35
36
|
|
|
36
37
|
// todo: reimplement - use getTableScalingPercentFrozen to get scaled percent before table width changes dynamically
|
|
37
38
|
// let scalePercent = 1;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface TablePluginOptions {
|
|
|
20
20
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
22
|
isTableAlignmentEnabled?: boolean;
|
|
23
|
+
isNewColumnResizingEnabled?: boolean;
|
|
23
24
|
}
|
|
24
25
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
25
26
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => boolean;
|
|
4
|
+
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean) => boolean;
|
|
@@ -3,4 +3,4 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { ColumnResizingPluginState } from '../../types';
|
|
6
|
-
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
6
|
+
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
@@ -116,6 +116,10 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
116
116
|
to: number;
|
|
117
117
|
mark: import("prosemirror-model").Mark;
|
|
118
118
|
}) => boolean;
|
|
119
|
+
addInlineCommentNodeMark: (props: {
|
|
120
|
+
pos: number;
|
|
121
|
+
mark: import("prosemirror-model").Mark;
|
|
122
|
+
}) => boolean;
|
|
119
123
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
120
124
|
};
|
|
121
125
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -220,6 +224,10 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
220
224
|
to: number;
|
|
221
225
|
mark: import("prosemirror-model").Mark;
|
|
222
226
|
}) => boolean;
|
|
227
|
+
addInlineCommentNodeMark: (props: {
|
|
228
|
+
pos: number;
|
|
229
|
+
mark: import("prosemirror-model").Mark;
|
|
230
|
+
}) => boolean;
|
|
223
231
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
224
232
|
};
|
|
225
233
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -97,6 +97,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
97
97
|
to: number;
|
|
98
98
|
mark: import("prosemirror-model").Mark;
|
|
99
99
|
}) => boolean;
|
|
100
|
+
addInlineCommentNodeMark: (props: {
|
|
101
|
+
pos: number;
|
|
102
|
+
mark: import("prosemirror-model").Mark;
|
|
103
|
+
}) => boolean;
|
|
100
104
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
101
105
|
};
|
|
102
106
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -201,6 +205,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
201
205
|
to: number;
|
|
202
206
|
mark: import("prosemirror-model").Mark;
|
|
203
207
|
}) => boolean;
|
|
208
|
+
addInlineCommentNodeMark: (props: {
|
|
209
|
+
pos: number;
|
|
210
|
+
mark: import("prosemirror-model").Mark;
|
|
211
|
+
}) => boolean;
|
|
204
212
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
205
213
|
};
|
|
206
214
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -316,6 +324,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
316
324
|
to: number;
|
|
317
325
|
mark: import("prosemirror-model").Mark;
|
|
318
326
|
}) => boolean;
|
|
327
|
+
addInlineCommentNodeMark: (props: {
|
|
328
|
+
pos: number;
|
|
329
|
+
mark: import("prosemirror-model").Mark;
|
|
330
|
+
}) => boolean;
|
|
319
331
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
320
332
|
};
|
|
321
333
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -420,6 +432,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
420
432
|
to: number;
|
|
421
433
|
mark: import("prosemirror-model").Mark;
|
|
422
434
|
}) => boolean;
|
|
435
|
+
addInlineCommentNodeMark: (props: {
|
|
436
|
+
pos: number;
|
|
437
|
+
mark: import("prosemirror-model").Mark;
|
|
438
|
+
}) => boolean;
|
|
423
439
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
424
440
|
};
|
|
425
441
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -125,6 +125,10 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
125
125
|
to: number;
|
|
126
126
|
mark: import("prosemirror-model").Mark;
|
|
127
127
|
}) => boolean;
|
|
128
|
+
addInlineCommentNodeMark: (props: {
|
|
129
|
+
pos: number;
|
|
130
|
+
mark: import("prosemirror-model").Mark;
|
|
131
|
+
}) => boolean;
|
|
128
132
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
129
133
|
};
|
|
130
134
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -229,6 +233,10 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
229
233
|
to: number;
|
|
230
234
|
mark: import("prosemirror-model").Mark;
|
|
231
235
|
}) => boolean;
|
|
236
|
+
addInlineCommentNodeMark: (props: {
|
|
237
|
+
pos: number;
|
|
238
|
+
mark: import("prosemirror-model").Mark;
|
|
239
|
+
}) => boolean;
|
|
232
240
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
233
241
|
};
|
|
234
242
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
@@ -20,6 +20,7 @@ export interface TablePluginOptions {
|
|
|
20
20
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
22
|
isTableAlignmentEnabled?: boolean;
|
|
23
|
+
isNewColumnResizingEnabled?: boolean;
|
|
23
24
|
}
|
|
24
25
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
25
26
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => boolean;
|
|
4
|
+
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean) => boolean;
|
|
@@ -3,4 +3,4 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { ColumnResizingPluginState } from '../../types';
|
|
6
|
-
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
6
|
+
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
@@ -140,6 +140,10 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
140
140
|
to: number;
|
|
141
141
|
mark: import("prosemirror-model").Mark;
|
|
142
142
|
}) => boolean;
|
|
143
|
+
addInlineCommentNodeMark: (props: {
|
|
144
|
+
pos: number;
|
|
145
|
+
mark: import("prosemirror-model").Mark;
|
|
146
|
+
}) => boolean;
|
|
143
147
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
144
148
|
};
|
|
145
149
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -270,6 +274,10 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
270
274
|
to: number;
|
|
271
275
|
mark: import("prosemirror-model").Mark;
|
|
272
276
|
}) => boolean;
|
|
277
|
+
addInlineCommentNodeMark: (props: {
|
|
278
|
+
pos: number;
|
|
279
|
+
mark: import("prosemirror-model").Mark;
|
|
280
|
+
}) => boolean;
|
|
273
281
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
274
282
|
};
|
|
275
283
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -121,6 +121,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
121
121
|
to: number;
|
|
122
122
|
mark: import("prosemirror-model").Mark;
|
|
123
123
|
}) => boolean;
|
|
124
|
+
addInlineCommentNodeMark: (props: {
|
|
125
|
+
pos: number;
|
|
126
|
+
mark: import("prosemirror-model").Mark;
|
|
127
|
+
}) => boolean;
|
|
124
128
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
125
129
|
};
|
|
126
130
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -251,6 +255,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
251
255
|
to: number;
|
|
252
256
|
mark: import("prosemirror-model").Mark;
|
|
253
257
|
}) => boolean;
|
|
258
|
+
addInlineCommentNodeMark: (props: {
|
|
259
|
+
pos: number;
|
|
260
|
+
mark: import("prosemirror-model").Mark;
|
|
261
|
+
}) => boolean;
|
|
254
262
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
255
263
|
};
|
|
256
264
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -393,6 +401,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
393
401
|
to: number;
|
|
394
402
|
mark: import("prosemirror-model").Mark;
|
|
395
403
|
}) => boolean;
|
|
404
|
+
addInlineCommentNodeMark: (props: {
|
|
405
|
+
pos: number;
|
|
406
|
+
mark: import("prosemirror-model").Mark;
|
|
407
|
+
}) => boolean;
|
|
396
408
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
397
409
|
};
|
|
398
410
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -523,6 +535,10 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
523
535
|
to: number;
|
|
524
536
|
mark: import("prosemirror-model").Mark;
|
|
525
537
|
}) => boolean;
|
|
538
|
+
addInlineCommentNodeMark: (props: {
|
|
539
|
+
pos: number;
|
|
540
|
+
mark: import("prosemirror-model").Mark;
|
|
541
|
+
}) => boolean;
|
|
526
542
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
527
543
|
};
|
|
528
544
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -149,6 +149,10 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
149
149
|
to: number;
|
|
150
150
|
mark: import("prosemirror-model").Mark;
|
|
151
151
|
}) => boolean;
|
|
152
|
+
addInlineCommentNodeMark: (props: {
|
|
153
|
+
pos: number;
|
|
154
|
+
mark: import("prosemirror-model").Mark;
|
|
155
|
+
}) => boolean;
|
|
152
156
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
153
157
|
};
|
|
154
158
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
@@ -279,6 +283,10 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
279
283
|
to: number;
|
|
280
284
|
mark: import("prosemirror-model").Mark;
|
|
281
285
|
}) => boolean;
|
|
286
|
+
addInlineCommentNodeMark: (props: {
|
|
287
|
+
pos: number;
|
|
288
|
+
mark: import("prosemirror-model").Mark;
|
|
289
|
+
}) => boolean;
|
|
282
290
|
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
283
291
|
};
|
|
284
292
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
package/package.json
CHANGED
|
@@ -1,148 +1,145 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
2
|
+
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
+
"version": "7.17.3",
|
|
4
|
+
"description": "Table plugin for the @atlaskit/editor",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
|
+
"author": "Atlassian Pty Ltd",
|
|
10
|
+
"main": "dist/cjs/index.js",
|
|
11
|
+
"module": "dist/esm/index.js",
|
|
12
|
+
"module:es2019": "dist/es2019/index.js",
|
|
13
|
+
"types": "dist/types/index.d.ts",
|
|
14
|
+
"typesVersions": {
|
|
15
|
+
">=4.5 <4.9": {
|
|
16
|
+
"*": [
|
|
17
|
+
"dist/types-ts4.5/*",
|
|
18
|
+
"dist/types-ts4.5/index.d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"atlaskit:src": "src/index.ts",
|
|
24
|
+
"atlassian": {
|
|
25
|
+
"team": "Editor: Jenga",
|
|
26
|
+
"singleton": true,
|
|
27
|
+
"releaseModel": "continuous",
|
|
28
|
+
"runReact18": false
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@atlaskit/adf-schema": "^36.10.7",
|
|
32
|
+
"@atlaskit/button": "^17.17.0",
|
|
33
|
+
"@atlaskit/custom-steps": "^0.2.0",
|
|
34
|
+
"@atlaskit/editor-common": "^82.7.0",
|
|
35
|
+
"@atlaskit/editor-palette": "1.6.0",
|
|
36
|
+
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
38
|
+
"@atlaskit/editor-plugin-content-insertion": "^1.2.0",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^1.2.0",
|
|
40
|
+
"@atlaskit/editor-plugin-guideline": "^1.1.0",
|
|
41
|
+
"@atlaskit/editor-plugin-selection": "^1.2.0",
|
|
42
|
+
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
43
|
+
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
44
|
+
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
45
|
+
"@atlaskit/editor-tables": "^2.7.0",
|
|
46
|
+
"@atlaskit/icon": "^22.3.0",
|
|
47
|
+
"@atlaskit/menu": "^2.4.0",
|
|
48
|
+
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
49
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
50
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
51
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
+
"@atlaskit/primitives": "^7.3.0",
|
|
53
|
+
"@atlaskit/theme": "^12.9.0",
|
|
54
|
+
"@atlaskit/toggle": "^13.1.0",
|
|
55
|
+
"@atlaskit/tokens": "^1.50.0",
|
|
56
|
+
"@atlaskit/tooltip": "^18.4.0",
|
|
57
|
+
"@babel/runtime": "^7.0.0",
|
|
58
|
+
"@emotion/react": "^11.7.1",
|
|
59
|
+
"classnames": "^2.2.5",
|
|
60
|
+
"lodash": "^4.17.21",
|
|
61
|
+
"memoize-one": "^6.0.0",
|
|
62
|
+
"raf-schd": "^4.0.3"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"react": "^16.8.0",
|
|
66
|
+
"react-dom": "^16.8.0",
|
|
67
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"typescript": "~5.4.2"
|
|
71
|
+
},
|
|
72
|
+
"af:exports": {
|
|
73
|
+
"./types": "./src/types.ts",
|
|
74
|
+
".": "./src/index.ts",
|
|
75
|
+
"./ui/common-styles": "./src/ui/common-styles.ts",
|
|
76
|
+
"./ui/consts": "./src/ui/consts.ts",
|
|
77
|
+
"./plugin-key": "./src/pm-plugins/plugin-key.ts",
|
|
78
|
+
"./commands": "./src/commands/index.ts"
|
|
79
|
+
},
|
|
80
|
+
"techstack": {
|
|
81
|
+
"@atlassian/frontend": {
|
|
82
|
+
"import-structure": [
|
|
83
|
+
"atlassian-conventions"
|
|
84
|
+
],
|
|
85
|
+
"circular-dependencies": [
|
|
86
|
+
"file-and-folder-level"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"@repo/internal": {
|
|
90
|
+
"design-tokens": [
|
|
91
|
+
"color"
|
|
92
|
+
],
|
|
93
|
+
"deprecation": "no-deprecated-imports",
|
|
94
|
+
"styling": [
|
|
95
|
+
"emotion"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"stricter": {
|
|
100
|
+
"no-unused-dependencies": {
|
|
101
|
+
"checkDevDependencies": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"platform-feature-flags": {
|
|
105
|
+
"platform.editor.table.insert-last-column-btn-stays-in-place": {
|
|
106
|
+
"type": "boolean"
|
|
107
|
+
},
|
|
108
|
+
"platform.editor.table.drag-move-options-logic-update_fp7xw": {
|
|
109
|
+
"type": "boolean"
|
|
110
|
+
},
|
|
111
|
+
"platform.editor.a11y-table-resizing_uapcv": {
|
|
112
|
+
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"platform.editor.a11y-column-resizing_emcvz": {
|
|
115
|
+
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
"platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg": {
|
|
118
|
+
"type": "boolean"
|
|
119
|
+
},
|
|
120
|
+
"platform.editor.transform-slice-for-nested-expand": {
|
|
121
|
+
"type": "boolean"
|
|
122
|
+
},
|
|
123
|
+
"platform.editor.table.cmd-a-select-table": {
|
|
124
|
+
"type": "boolean"
|
|
125
|
+
},
|
|
126
|
+
"platform.editor.table.use-shared-state-hook": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33": {
|
|
130
|
+
"type": "boolean"
|
|
131
|
+
},
|
|
132
|
+
"platform.editor.table.use-increased-scaling-percent": {
|
|
133
|
+
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"platform.editor.explicit-html-element-check": {
|
|
136
|
+
"type": "boolean"
|
|
137
|
+
},
|
|
138
|
+
"platform.editor.table.live-pages-sorting_4malx": {
|
|
139
|
+
"type": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"platform.editor.table.editor-num-col-style-changes": {
|
|
142
|
+
"type": "boolean"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -350,6 +350,8 @@ export const TableResizer = ({
|
|
|
350
350
|
tableLocalId: node.attrs.localId,
|
|
351
351
|
tableRef: tableRef,
|
|
352
352
|
});
|
|
353
|
+
tr.setMeta('is-resizer-resizing', true);
|
|
354
|
+
|
|
353
355
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
354
356
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED,
|
|
355
357
|
});
|
|
@@ -507,6 +509,7 @@ export const TableResizer = ({
|
|
|
507
509
|
tableLocalId: '',
|
|
508
510
|
tableRef: null,
|
|
509
511
|
});
|
|
512
|
+
tr.setMeta('is-resizer-resizing', false);
|
|
510
513
|
const frameRateSamples = endMeasure();
|
|
511
514
|
|
|
512
515
|
if (frameRateSamples.length > 0) {
|
package/src/plugin.tsx
CHANGED
|
@@ -94,6 +94,7 @@ export interface TablePluginOptions {
|
|
|
94
94
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
95
95
|
isTableScalingEnabled?: boolean;
|
|
96
96
|
isTableAlignmentEnabled?: boolean;
|
|
97
|
+
isNewColumnResizingEnabled?: boolean;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -296,8 +297,13 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
296
297
|
{
|
|
297
298
|
name: 'tablePMColResizing',
|
|
298
299
|
plugin: ({ dispatch }) => {
|
|
299
|
-
const {
|
|
300
|
-
|
|
300
|
+
const {
|
|
301
|
+
fullWidthEnabled,
|
|
302
|
+
tableOptions,
|
|
303
|
+
getEditorFeatureFlags,
|
|
304
|
+
isTableScalingEnabled,
|
|
305
|
+
isNewColumnResizingEnabled,
|
|
306
|
+
} = options || ({} as TablePluginOptions);
|
|
301
307
|
const { allowColumnResizing } = pluginConfig(tableOptions);
|
|
302
308
|
return allowColumnResizing
|
|
303
309
|
? createFlexiResizingPlugin(
|
|
@@ -309,6 +315,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
309
315
|
getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
310
316
|
editorAnalyticsAPI,
|
|
311
317
|
isTableScalingEnabled || false,
|
|
318
|
+
isNewColumnResizingEnabled,
|
|
312
319
|
)
|
|
313
320
|
: undefined;
|
|
314
321
|
},
|
|
@@ -639,7 +646,9 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
639
646
|
title: formatMessage(messages.table),
|
|
640
647
|
description: formatMessage(messages.tableDescription),
|
|
641
648
|
keywords: ['cell', 'table'],
|
|
642
|
-
priority:
|
|
649
|
+
priority: options?.getEditorFeatureFlags?.().platformEditorTypeaheadImprovedRelevancy
|
|
650
|
+
? 800
|
|
651
|
+
: 600,
|
|
643
652
|
keyshortcut: tooltip(toggleTable),
|
|
644
653
|
icon: () => <IconTable />,
|
|
645
654
|
action(insert, state) {
|
|
@@ -17,7 +17,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
17
17
|
import { stopKeyboardColumnResizing } from '../../commands/column-resize';
|
|
18
18
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
19
19
|
import { updateColumnWidths } from '../../transforms';
|
|
20
|
-
import { getSelectedColumnIndexes } from '../../utils';
|
|
20
|
+
import { getSelectedColumnIndexes, isTableNested } from '../../utils';
|
|
21
21
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
22
22
|
import { META_KEYS } from '../table-analytics';
|
|
23
23
|
|
|
@@ -41,6 +41,7 @@ export const handleMouseDown = (
|
|
|
41
41
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
42
42
|
isTableScalingEnabled: boolean,
|
|
43
43
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
44
|
+
isNewColumnResizingEnabled?: boolean,
|
|
44
45
|
): boolean => {
|
|
45
46
|
const { state, dispatch } = view;
|
|
46
47
|
const editorDisabled = !view.editable;
|
|
@@ -192,7 +193,7 @@ export const handleMouseDown = (
|
|
|
192
193
|
|
|
193
194
|
const resizedDelta = clientX - startX;
|
|
194
195
|
|
|
195
|
-
if (
|
|
196
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
196
197
|
const newResizeState = resizeColumnAndTable(
|
|
197
198
|
resizeState,
|
|
198
199
|
colIndex,
|
|
@@ -297,7 +298,7 @@ export const handleMouseDown = (
|
|
|
297
298
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
if (
|
|
301
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
301
302
|
resizeColumnAndTable(
|
|
302
303
|
resizeState,
|
|
303
304
|
colIndex,
|
|
@@ -23,6 +23,7 @@ export function createPlugin(
|
|
|
23
23
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
24
24
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
25
25
|
isTableScalingEnabled?: boolean,
|
|
26
|
+
isNewColumnResizingEnabled?: boolean,
|
|
26
27
|
) {
|
|
27
28
|
return new SafePlugin({
|
|
28
29
|
key: pluginKey,
|
|
@@ -75,6 +76,7 @@ export function createPlugin(
|
|
|
75
76
|
getEditorFeatureFlags,
|
|
76
77
|
isTableScalingEnabled || false,
|
|
77
78
|
editorAnalyticsAPI,
|
|
79
|
+
isNewColumnResizingEnabled,
|
|
78
80
|
)
|
|
79
81
|
) {
|
|
80
82
|
const { state, dispatch } = view;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
|
|
4
4
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
5
|
+
import { ALIGN_START } from '../../../utils/alignment';
|
|
5
6
|
|
|
6
7
|
import { getTableContainerElementWidth, getTableScalingPercent } from './misc';
|
|
7
8
|
import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
@@ -61,7 +62,7 @@ export const resizeColumnAndTable = (
|
|
|
61
62
|
const tableContainerWidth = tableRef.closest('.pm-table-container')?.clientWidth;
|
|
62
63
|
|
|
63
64
|
const isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
|
|
64
|
-
let resizeAmount = amount * 2;
|
|
65
|
+
let resizeAmount = tableNode.attrs.layout === ALIGN_START && !isOverflowed ? amount : amount * 2;
|
|
65
66
|
|
|
66
67
|
// todo: reimplement - use getTableScalingPercentFrozen to get scaled percent before table width changes dynamically
|
|
67
68
|
// let scalePercent = 1;
|