@atlaskit/editor-plugin-table 7.5.1 → 7.5.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 +12 -0
- package/dist/cjs/commands-with-analytics.js +65 -38
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -2
- package/dist/cjs/nodeviews/TableCell.js +1 -1
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/nodeviews/TableContainer.js +2 -2
- package/dist/cjs/nodeviews/TableResizer.js +2 -2
- package/dist/cjs/nodeviews/TableRow.js +1 -1
- package/dist/cjs/nodeviews/table.js +1 -1
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/table-analytics.js +2 -2
- package/dist/cjs/pm-plugins/table-local-id.js +11 -11
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +16 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/cjs/reducer.js +0 -2
- package/dist/cjs/toolbar.js +2 -2
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/ui/FloatingDeleteButton/index.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +2 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -3
- package/dist/cjs/ui/LayoutButton/index.js +3 -3
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/index.js +3 -3
- package/dist/cjs/utils/decoration.js +0 -4
- package/dist/cjs/utils/merged-cells.js +7 -3
- package/dist/es2019/commands-with-analytics.js +27 -0
- package/dist/es2019/pm-plugins/keymap.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +17 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/es2019/reducer.js +0 -2
- package/dist/es2019/utils/decoration.js +0 -4
- package/dist/es2019/utils/merged-cells.js +7 -3
- package/dist/esm/commands-with-analytics.js +64 -37
- package/dist/esm/nodeviews/TableCell.js +1 -1
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/nodeviews/TableRow.js +1 -1
- package/dist/esm/nodeviews/table.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +4 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +17 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +0 -1
- package/dist/esm/reducer.js +0 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/esm/ui/FloatingDeleteButton/index.js +1 -1
- package/dist/esm/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/ui/LayoutButton/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +1 -1
- package/dist/esm/ui/TableFloatingControls/index.js +1 -1
- package/dist/esm/utils/decoration.js +0 -4
- package/dist/esm/utils/merged-cells.js +7 -3
- package/dist/types/commands-with-analytics.d.ts +1 -0
- package/dist/types-ts4.5/commands-with-analytics.d.ts +1 -0
- package/package.json +2 -2
- package/src/commands-with-analytics.ts +39 -0
- package/src/pm-plugins/keymap.ts +13 -3
- package/src/pm-plugins/table-resizing/event-handlers.ts +20 -1
- package/src/utils/merged-cells.ts +7 -3
|
@@ -7,6 +7,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
7
7
|
import { findCellClosestToPos, findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { clearMultipleCells } from './commands/clear';
|
|
9
9
|
import { wrapTableInExpand } from './commands/collapse';
|
|
10
|
+
import { changeColumnWidthByStep } from './commands/column-resize';
|
|
10
11
|
import { deleteColumnsCommand } from './commands/delete';
|
|
11
12
|
import { insertColumn, insertRow } from './commands/insert';
|
|
12
13
|
import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs } from './commands/misc';
|
|
@@ -182,13 +183,39 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
|
|
|
182
183
|
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
183
184
|
};
|
|
184
185
|
};
|
|
185
|
-
export var
|
|
186
|
-
|
|
187
|
-
return function (inputMethod, position) {
|
|
186
|
+
export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
|
|
187
|
+
return function (stepSize, getEditorContainerWidth, tablePreserveWidth, inputMethod) {
|
|
188
188
|
return withEditorAnalyticsAPI(function (state) {
|
|
189
189
|
var _getSelectedTableInfo2 = getSelectedTableInfo(state.selection),
|
|
190
|
+
table = _getSelectedTableInfo2.table,
|
|
190
191
|
totalRowCount = _getSelectedTableInfo2.totalRowCount,
|
|
191
192
|
totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
|
|
193
|
+
var _getPluginState = getPluginState(state),
|
|
194
|
+
colIndex = _getPluginState.hoveredCell.colIndex;
|
|
195
|
+
return {
|
|
196
|
+
action: TABLE_ACTION.COLUMN_RESIZED,
|
|
197
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
198
|
+
eventType: EVENT_TYPE.TRACK,
|
|
199
|
+
attributes: {
|
|
200
|
+
colIndex: colIndex,
|
|
201
|
+
resizedDelta: stepSize,
|
|
202
|
+
isLastColumn: colIndex === totalColumnCount - 1,
|
|
203
|
+
tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width,
|
|
204
|
+
inputMethod: inputMethod,
|
|
205
|
+
totalRowCount: totalRowCount,
|
|
206
|
+
totalColumnCount: totalColumnCount
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
})(editorAnalyticsAPI)(changeColumnWidthByStep(stepSize, getEditorContainerWidth, tablePreserveWidth));
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export var insertColumnWithAnalytics = function insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
213
|
+
var tablePreserveWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
214
|
+
return function (inputMethod, position) {
|
|
215
|
+
return withEditorAnalyticsAPI(function (state) {
|
|
216
|
+
var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
|
|
217
|
+
totalRowCount = _getSelectedTableInfo3.totalRowCount,
|
|
218
|
+
totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
|
|
192
219
|
return {
|
|
193
220
|
action: TABLE_ACTION.ADDED_COLUMN,
|
|
194
221
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -208,9 +235,9 @@ export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnal
|
|
|
208
235
|
return function (inputMethod, rect, isHeaderRowRequired) {
|
|
209
236
|
return withEditorAnalyticsAPI(function (_ref5) {
|
|
210
237
|
var selection = _ref5.selection;
|
|
211
|
-
var
|
|
212
|
-
totalRowCount =
|
|
213
|
-
totalColumnCount =
|
|
238
|
+
var _getSelectedTableInfo4 = getSelectedTableInfo(selection),
|
|
239
|
+
totalRowCount = _getSelectedTableInfo4.totalRowCount,
|
|
240
|
+
totalColumnCount = _getSelectedTableInfo4.totalColumnCount;
|
|
214
241
|
return {
|
|
215
242
|
action: TABLE_ACTION.DELETED_ROW,
|
|
216
243
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -237,9 +264,9 @@ export var deleteColumnsWithAnalytics = function deleteColumnsWithAnalytics(edit
|
|
|
237
264
|
return function (inputMethod, rect) {
|
|
238
265
|
return withEditorAnalyticsAPI(function (_ref6) {
|
|
239
266
|
var selection = _ref6.selection;
|
|
240
|
-
var
|
|
241
|
-
totalRowCount =
|
|
242
|
-
totalColumnCount =
|
|
267
|
+
var _getSelectedTableInfo5 = getSelectedTableInfo(selection),
|
|
268
|
+
totalRowCount = _getSelectedTableInfo5.totalRowCount,
|
|
269
|
+
totalColumnCount = _getSelectedTableInfo5.totalColumnCount;
|
|
243
270
|
return {
|
|
244
271
|
action: TABLE_ACTION.DELETED_COLUMN,
|
|
245
272
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -269,8 +296,8 @@ export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function delete
|
|
|
269
296
|
}
|
|
270
297
|
var selectionType = getTableSelectionType(selection);
|
|
271
298
|
if (selectionType === 'row') {
|
|
272
|
-
var
|
|
273
|
-
pluginConfig =
|
|
299
|
+
var _getPluginState2 = getPluginState(state),
|
|
300
|
+
pluginConfig = _getPluginState2.pluginConfig;
|
|
274
301
|
var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
|
|
275
302
|
return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
|
|
276
303
|
} else if (selectionType === 'column') {
|
|
@@ -281,9 +308,9 @@ export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function delete
|
|
|
281
308
|
};
|
|
282
309
|
};
|
|
283
310
|
var getTableDeletedAnalytics = function getTableDeletedAnalytics(selection, inputMethod) {
|
|
284
|
-
var
|
|
285
|
-
totalRowCount =
|
|
286
|
-
totalColumnCount =
|
|
311
|
+
var _getSelectedTableInfo6 = getSelectedTableInfo(selection),
|
|
312
|
+
totalRowCount = _getSelectedTableInfo6.totalRowCount,
|
|
313
|
+
totalColumnCount = _getSelectedTableInfo6.totalColumnCount;
|
|
287
314
|
return {
|
|
288
315
|
action: TABLE_ACTION.DELETED,
|
|
289
316
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -311,11 +338,11 @@ export var deleteTableIfSelectedWithAnalytics = function deleteTableIfSelectedWi
|
|
|
311
338
|
};
|
|
312
339
|
export var toggleHeaderRowWithAnalytics = function toggleHeaderRowWithAnalytics(editorAnalyticsAPI) {
|
|
313
340
|
return withEditorAnalyticsAPI(function (state) {
|
|
314
|
-
var
|
|
315
|
-
totalRowCount =
|
|
316
|
-
totalColumnCount =
|
|
317
|
-
var
|
|
318
|
-
isHeaderRowEnabled =
|
|
341
|
+
var _getSelectedTableInfo7 = getSelectedTableInfo(state.selection),
|
|
342
|
+
totalRowCount = _getSelectedTableInfo7.totalRowCount,
|
|
343
|
+
totalColumnCount = _getSelectedTableInfo7.totalColumnCount;
|
|
344
|
+
var _getPluginState3 = getPluginState(state),
|
|
345
|
+
isHeaderRowEnabled = _getPluginState3.isHeaderRowEnabled;
|
|
319
346
|
return {
|
|
320
347
|
action: TABLE_ACTION.TOGGLED_HEADER_ROW,
|
|
321
348
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -331,11 +358,11 @@ export var toggleHeaderRowWithAnalytics = function toggleHeaderRowWithAnalytics(
|
|
|
331
358
|
};
|
|
332
359
|
export var toggleHeaderColumnWithAnalytics = function toggleHeaderColumnWithAnalytics(editorAnalyticsAPI) {
|
|
333
360
|
return withEditorAnalyticsAPI(function (state) {
|
|
334
|
-
var
|
|
335
|
-
totalRowCount =
|
|
336
|
-
totalColumnCount =
|
|
337
|
-
var
|
|
338
|
-
isHeaderColumnEnabled =
|
|
361
|
+
var _getSelectedTableInfo8 = getSelectedTableInfo(state.selection),
|
|
362
|
+
totalRowCount = _getSelectedTableInfo8.totalRowCount,
|
|
363
|
+
totalColumnCount = _getSelectedTableInfo8.totalColumnCount;
|
|
364
|
+
var _getPluginState4 = getPluginState(state),
|
|
365
|
+
isHeaderColumnEnabled = _getPluginState4.isHeaderColumnEnabled;
|
|
339
366
|
return {
|
|
340
367
|
action: TABLE_ACTION.TOGGLED_HEADER_COLUMN,
|
|
341
368
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -351,9 +378,9 @@ export var toggleHeaderColumnWithAnalytics = function toggleHeaderColumnWithAnal
|
|
|
351
378
|
};
|
|
352
379
|
export var toggleNumberColumnWithAnalytics = function toggleNumberColumnWithAnalytics(editorAnalyticsAPI) {
|
|
353
380
|
return withEditorAnalyticsAPI(function (state) {
|
|
354
|
-
var
|
|
355
|
-
totalRowCount =
|
|
356
|
-
totalColumnCount =
|
|
381
|
+
var _getSelectedTableInfo9 = getSelectedTableInfo(state.selection),
|
|
382
|
+
totalRowCount = _getSelectedTableInfo9.totalRowCount,
|
|
383
|
+
totalColumnCount = _getSelectedTableInfo9.totalColumnCount;
|
|
357
384
|
return {
|
|
358
385
|
action: TABLE_ACTION.TOGGLED_NUMBER_COLUMN,
|
|
359
386
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -369,10 +396,10 @@ export var toggleNumberColumnWithAnalytics = function toggleNumberColumnWithAnal
|
|
|
369
396
|
};
|
|
370
397
|
export var toggleTableLayoutWithAnalytics = function toggleTableLayoutWithAnalytics(editorAnalyticsAPI) {
|
|
371
398
|
return withEditorAnalyticsAPI(function (state) {
|
|
372
|
-
var
|
|
373
|
-
table =
|
|
374
|
-
totalRowCount =
|
|
375
|
-
totalColumnCount =
|
|
399
|
+
var _getSelectedTableInfo10 = getSelectedTableInfo(state.selection),
|
|
400
|
+
table = _getSelectedTableInfo10.table,
|
|
401
|
+
totalRowCount = _getSelectedTableInfo10.totalRowCount,
|
|
402
|
+
totalColumnCount = _getSelectedTableInfo10.totalColumnCount;
|
|
376
403
|
if (table) {
|
|
377
404
|
var _ref9 = table.node.attrs,
|
|
378
405
|
layout = _ref9.layout;
|
|
@@ -395,9 +422,9 @@ export var toggleTableLayoutWithAnalytics = function toggleTableLayoutWithAnalyt
|
|
|
395
422
|
export var sortColumnWithAnalytics = function sortColumnWithAnalytics(editorAnalyticsAPI) {
|
|
396
423
|
return function (inputMethod, columnIndex, sortOrder) {
|
|
397
424
|
return withEditorAnalyticsAPI(function (state) {
|
|
398
|
-
var
|
|
399
|
-
totalRowCount =
|
|
400
|
-
totalColumnCount =
|
|
425
|
+
var _getSelectedTableInfo11 = getSelectedTableInfo(state.selection),
|
|
426
|
+
totalRowCount = _getSelectedTableInfo11.totalRowCount,
|
|
427
|
+
totalColumnCount = _getSelectedTableInfo11.totalColumnCount;
|
|
401
428
|
return {
|
|
402
429
|
action: TABLE_ACTION.SORTED_COLUMN,
|
|
403
430
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -439,9 +466,9 @@ export var distributeColumnsWidthsWithAnalytics = function distributeColumnsWidt
|
|
|
439
466
|
};
|
|
440
467
|
export var wrapTableInExpandWithAnalytics = function wrapTableInExpandWithAnalytics(editorAnalyticsAPI) {
|
|
441
468
|
return withEditorAnalyticsAPI(function (state) {
|
|
442
|
-
var
|
|
443
|
-
totalRowCount =
|
|
444
|
-
totalColumnCount =
|
|
469
|
+
var _getSelectedTableInfo12 = getSelectedTableInfo(state.selection),
|
|
470
|
+
totalRowCount = _getSelectedTableInfo12.totalRowCount,
|
|
471
|
+
totalColumnCount = _getSelectedTableInfo12.totalColumnCount;
|
|
445
472
|
return {
|
|
446
473
|
action: TABLE_ACTION.COLLAPSED,
|
|
447
474
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -5,7 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _isNativeReflectConstruct() {
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import uuid from 'uuid';
|
|
10
10
|
import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
|
|
11
11
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import classnames from 'classnames';
|
|
15
15
|
import memoizeOne from 'memoize-one';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import debounce from 'lodash/debounce';
|
|
11
11
|
import throttle from 'lodash/throttle';
|
|
12
12
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
@@ -9,7 +9,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
15
15
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -4,8 +4,8 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
7
|
-
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
|
-
import { activateNextResizeArea,
|
|
7
|
+
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
|
+
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
11
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
@@ -58,8 +58,8 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, getEdi
|
|
|
58
58
|
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing, list);
|
|
59
59
|
bindKeymapWithCommand(moveRight.common, activateNextResizeArea(1), list);
|
|
60
60
|
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
|
|
61
|
-
bindKeymapWithCommand(decreaseMediaSize.common,
|
|
62
|
-
bindKeymapWithCommand(increaseMediaSize.common,
|
|
61
|
+
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, tablePreserveWidth, INPUT_METHOD.SHORTCUT), list);
|
|
62
|
+
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, tablePreserveWidth, INPUT_METHOD.SHORTCUT), list);
|
|
63
63
|
bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing(), list);
|
|
64
64
|
}
|
|
65
65
|
return keymap(list);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
|
|
3
3
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -141,6 +141,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
141
141
|
// only selected (or selected - 1) columns should be distributed
|
|
142
142
|
var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
143
143
|
var newResizeState = resizeColumn(resizeState, colIndex, clientX - startX, dom, resizingSelectedColumns ? selectedColumns : undefined, tablePreserveWidth);
|
|
144
|
+
var resizedDelta = clientX - startX;
|
|
144
145
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
145
146
|
if (colIndex === map.width - 1) {
|
|
146
147
|
var mouseUpTime = event.timeStamp;
|
|
@@ -152,11 +153,25 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
152
153
|
type: 'table-border',
|
|
153
154
|
position: 'right',
|
|
154
155
|
duration: mouseUpTime - mouseDownTime,
|
|
155
|
-
delta: Math.abs(
|
|
156
|
+
delta: Math.abs(resizedDelta)
|
|
156
157
|
},
|
|
157
158
|
eventType: EVENT_TYPE.UI
|
|
158
159
|
})(tr);
|
|
159
160
|
}
|
|
161
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
162
|
+
action: TABLE_ACTION.COLUMN_RESIZED,
|
|
163
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
164
|
+
eventType: EVENT_TYPE.TRACK,
|
|
165
|
+
attributes: {
|
|
166
|
+
colIndex: colIndex,
|
|
167
|
+
resizedDelta: resizedDelta,
|
|
168
|
+
isLastColumn: colIndex === map.width - 1,
|
|
169
|
+
tableWidth: table.attrs.width,
|
|
170
|
+
inputMethod: INPUT_METHOD.MOUSE,
|
|
171
|
+
totalRowCount: map.height,
|
|
172
|
+
totalColumnCount: map.width
|
|
173
|
+
}
|
|
174
|
+
})(tr);
|
|
160
175
|
}
|
|
161
176
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
162
177
|
if (isKeyboardResize || !isTableHovered) {
|
|
@@ -48,7 +48,6 @@ export var getResizeState = function getResizeState(_ref) {
|
|
|
48
48
|
// Getting the resize state from DOM
|
|
49
49
|
var colgroupChildren = insertColgroupFromNode(tableRef, table, tablePreserveWidth, shouldReinsertColgroup // don't reinsert colgroup when preserving table width - this causes widths to jump
|
|
50
50
|
);
|
|
51
|
-
|
|
52
51
|
var cols = Array.from(colgroupChildren).map(function (_, index) {
|
|
53
52
|
// If the table hasn't been resized and we have a table width attribute, we can use it
|
|
54
53
|
// to calculate the widths of the columns
|
package/dist/esm/reducer.js
CHANGED
|
@@ -35,7 +35,6 @@ export default (function (pluginState, action) {
|
|
|
35
35
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
36
36
|
insertColumnButtonIndex: undefined // We need to assure that column is not shown
|
|
37
37
|
});
|
|
38
|
-
|
|
39
38
|
case 'SHOW_INSERT_COLUMN_BUTTON':
|
|
40
39
|
if (action.data.insertColumnButtonIndex === pluginState.insertColumnButtonIndex) {
|
|
41
40
|
return pluginState;
|
|
@@ -43,7 +42,6 @@ export default (function (pluginState, action) {
|
|
|
43
42
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
44
43
|
insertRowButtonIndex: undefined // We need to assure that row is not shown
|
|
45
44
|
});
|
|
46
|
-
|
|
47
45
|
case 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON':
|
|
48
46
|
if (pluginState.insertRowButtonIndex !== undefined || pluginState.insertColumnButtonIndex !== undefined) {
|
|
49
47
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import { Component } from 'react';
|
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
14
|
import { createPortal } from 'react-dom';
|
|
15
15
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -7,7 +7,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _isNativeReflectConstruct() {
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { injectIntl } from 'react-intl-next';
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
import React, { createRef } from 'react';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -9,7 +9,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
14
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
15
15
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
@@ -431,11 +431,9 @@ export var createColumnLineResize = function createColumnLineResize(selection, c
|
|
|
431
431
|
if (isLastColumn) {
|
|
432
432
|
return true; // If is the last column no filter applied
|
|
433
433
|
}
|
|
434
|
-
|
|
435
434
|
var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
|
|
436
435
|
return cellPosition !== nextPosition; // Removed it if next position is merged
|
|
437
436
|
});
|
|
438
|
-
|
|
439
437
|
var cells = cellPositions.map(function (pos) {
|
|
440
438
|
return {
|
|
441
439
|
pos: pos + table.start,
|
|
@@ -476,11 +474,9 @@ export var createColumnInsertLine = function createColumnInsertLine(columnIndex,
|
|
|
476
474
|
if (isLastColumn) {
|
|
477
475
|
return true; // If is the last column no filter applied
|
|
478
476
|
}
|
|
479
|
-
|
|
480
477
|
var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
|
|
481
478
|
return cellPosition !== nextPosition; // Removed it if next position is merged
|
|
482
479
|
});
|
|
483
|
-
|
|
484
480
|
var cells = cellPositions.map(function (pos) {
|
|
485
481
|
return {
|
|
486
482
|
pos: pos + table.start,
|
|
@@ -118,7 +118,6 @@ export var hasMergedCellsInBetween = function hasMergedCellsInBetween(indexes, t
|
|
|
118
118
|
return !cells.includes(nodePos) // cell exists in Rect but not show in the map.cellsInRect list => merged cell
|
|
119
119
|
? true : mergedCells.has(nodePos); // cell includes in mergedCells => merged cell
|
|
120
120
|
});
|
|
121
|
-
|
|
122
121
|
return _toConsumableArray(new Set(mergedCell));
|
|
123
122
|
};
|
|
124
123
|
var mergedCellsInRectArr = indexes.map(function (index) {
|
|
@@ -227,8 +226,13 @@ export var checkEdgeHasMergedCells = function checkEdgeHasMergedCells(indexes, t
|
|
|
227
226
|
var maxIndex = Math.max.apply(Math, _toConsumableArray(indexes));
|
|
228
227
|
var isTopSideHaveMergedCells = false;
|
|
229
228
|
var isBottomSideHaveMergedCells = false;
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* this is to check if the cell position from last focused table is overflow. since if you selection from a cell in 6th row and 7th column cell in a 7x8 table to 3x3 table, the cell position will be overflow because new table dont have this cell at all.
|
|
232
|
+
TODO: ED-22335 this should better called only when hover over the drag handle.
|
|
233
|
+
*/
|
|
234
|
+
var isOldMinIndex = !map[minIndex - 1] || !map[minIndex];
|
|
235
|
+
var isOldMaxIndex = !map[maxIndex + 1] || !map[maxIndex];
|
|
232
236
|
if (minIndex > 0 && !isOldMinIndex) {
|
|
233
237
|
var prevSelectionSet = map[minIndex - 1];
|
|
234
238
|
var minSelectionSet = map[minIndex];
|
|
@@ -11,6 +11,7 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
|
|
|
11
11
|
export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number) => Command;
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
|
+
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth: boolean, inputMethod: INPUT_METHOD.SHORTCUT) => Command;
|
|
14
15
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
15
16
|
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
17
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
@@ -11,6 +11,7 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
|
|
|
11
11
|
export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, targetCellPosition?: number) => Command;
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
|
+
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth: boolean, inputMethod: INPUT_METHOD.SHORTCUT) => Command;
|
|
14
15
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
15
16
|
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
17
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, tablePreserveWidth?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -145,4 +145,4 @@
|
|
|
145
145
|
"type": "boolean"
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}
|
|
148
|
+
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
|
|
28
28
|
import { clearMultipleCells } from './commands/clear';
|
|
29
29
|
import { wrapTableInExpand } from './commands/collapse';
|
|
30
|
+
import { changeColumnWidthByStep } from './commands/column-resize';
|
|
30
31
|
import { deleteColumnsCommand } from './commands/delete';
|
|
31
32
|
import { insertColumn, insertRow } from './commands/insert';
|
|
32
33
|
import {
|
|
@@ -251,6 +252,44 @@ export const insertRowWithAnalytics =
|
|
|
251
252
|
insertRow(options.index, options.moveCursorToInsertedRow),
|
|
252
253
|
);
|
|
253
254
|
|
|
255
|
+
export const changeColumnWidthByStepWithAnalytics =
|
|
256
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
257
|
+
(
|
|
258
|
+
stepSize: number,
|
|
259
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
260
|
+
tablePreserveWidth: boolean,
|
|
261
|
+
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
262
|
+
) =>
|
|
263
|
+
withEditorAnalyticsAPI((state) => {
|
|
264
|
+
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
|
|
265
|
+
state.selection,
|
|
266
|
+
);
|
|
267
|
+
const {
|
|
268
|
+
hoveredCell: { colIndex },
|
|
269
|
+
} = getPluginState(state);
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
action: TABLE_ACTION.COLUMN_RESIZED,
|
|
273
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
274
|
+
eventType: EVENT_TYPE.TRACK,
|
|
275
|
+
attributes: {
|
|
276
|
+
colIndex,
|
|
277
|
+
resizedDelta: stepSize,
|
|
278
|
+
isLastColumn: colIndex === totalColumnCount - 1,
|
|
279
|
+
tableWidth: table?.node.attrs.width,
|
|
280
|
+
inputMethod,
|
|
281
|
+
totalRowCount,
|
|
282
|
+
totalColumnCount,
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
})(editorAnalyticsAPI)(
|
|
286
|
+
changeColumnWidthByStep(
|
|
287
|
+
stepSize,
|
|
288
|
+
getEditorContainerWidth,
|
|
289
|
+
tablePreserveWidth,
|
|
290
|
+
),
|
|
291
|
+
);
|
|
292
|
+
|
|
254
293
|
export const insertColumnWithAnalytics =
|
|
255
294
|
(
|
|
256
295
|
getEditorContainerWidth: GetEditorContainerWidth,
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -41,13 +41,13 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
41
41
|
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
42
42
|
import {
|
|
43
43
|
addRowAroundSelection,
|
|
44
|
+
changeColumnWidthByStepWithAnalytics,
|
|
44
45
|
deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut,
|
|
45
46
|
deleteTableIfSelectedWithAnalytics,
|
|
46
47
|
emptyMultipleCellsWithAnalytics,
|
|
47
48
|
} from '../commands-with-analytics';
|
|
48
49
|
import {
|
|
49
50
|
activateNextResizeArea,
|
|
50
|
-
changeColumnWidthByStep,
|
|
51
51
|
initiateKeyboardColumnResizing,
|
|
52
52
|
stopKeyboardColumnResizing,
|
|
53
53
|
} from '../commands/column-resize';
|
|
@@ -198,13 +198,23 @@ export function keymapPlugin(
|
|
|
198
198
|
|
|
199
199
|
bindKeymapWithCommand(
|
|
200
200
|
decreaseMediaSize.common!,
|
|
201
|
-
|
|
201
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
202
|
+
-10,
|
|
203
|
+
getEditorContainerWidth,
|
|
204
|
+
tablePreserveWidth,
|
|
205
|
+
INPUT_METHOD.SHORTCUT,
|
|
206
|
+
),
|
|
202
207
|
list,
|
|
203
208
|
);
|
|
204
209
|
|
|
205
210
|
bindKeymapWithCommand(
|
|
206
211
|
increaseMediaSize.common!,
|
|
207
|
-
|
|
212
|
+
changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(
|
|
213
|
+
10,
|
|
214
|
+
getEditorContainerWidth,
|
|
215
|
+
tablePreserveWidth,
|
|
216
|
+
INPUT_METHOD.SHORTCUT,
|
|
217
|
+
),
|
|
208
218
|
list,
|
|
209
219
|
);
|
|
210
220
|
bindKeymapWithCommand(escape.common!, stopKeyboardColumnResizing(), list);
|