@atlaskit/editor-plugin-table 7.4.8 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/commands/column-resize.js +4 -2
- package/dist/cjs/commands/delete.js +2 -1
- package/dist/cjs/commands/insert.js +6 -3
- package/dist/cjs/commands-with-analytics.js +4 -2
- package/dist/cjs/event-handlers.js +2 -1
- package/dist/cjs/nodeviews/TableComponent.js +116 -47
- package/dist/cjs/nodeviews/TableContainer.js +8 -4
- package/dist/cjs/nodeviews/TableResizer.js +6 -5
- package/dist/cjs/nodeviews/table.js +12 -4
- package/dist/cjs/plugin.js +50 -47
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -6
- package/dist/cjs/pm-plugins/keymap.js +6 -3
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -11
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +24 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +20 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +52 -11
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +19 -8
- package/dist/cjs/toolbar.js +17 -10
- package/dist/cjs/transforms/column-width.js +22 -7
- package/dist/cjs/transforms/delete-columns.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
- package/dist/cjs/ui/FloatingContextualMenu/index.js +5 -3
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +15 -4
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +53 -8
- package/dist/cjs/ui/FloatingDragMenu/index.js +15 -6
- package/dist/cjs/ui/FloatingInsertButton/index.js +5 -1
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/cjs/utils/create.js +1 -1
- package/dist/cjs/utils/drag-menu.js +4 -3
- package/dist/es2019/commands/column-resize.js +4 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +6 -6
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +77 -8
- package/dist/es2019/nodeviews/TableContainer.js +8 -4
- package/dist/es2019/nodeviews/TableResizer.js +6 -5
- package/dist/es2019/nodeviews/table.js +12 -4
- package/dist/es2019/plugin.js +14 -8
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -4
- package/dist/es2019/pm-plugins/keymap.js +6 -3
- package/dist/es2019/pm-plugins/main.js +4 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +31 -12
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +20 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +47 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +19 -12
- package/dist/es2019/toolbar.js +15 -12
- package/dist/es2019/transforms/column-width.js +24 -10
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -5
- package/dist/es2019/ui/FloatingContextualMenu/index.js +6 -4
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +15 -4
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +42 -8
- package/dist/es2019/ui/FloatingDragMenu/index.js +16 -7
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -1
- package/dist/es2019/ui/consts.js +1 -0
- package/dist/es2019/utils/create.js +1 -1
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +4 -2
- package/dist/esm/commands/delete.js +2 -1
- package/dist/esm/commands/insert.js +6 -3
- package/dist/esm/commands-with-analytics.js +4 -2
- package/dist/esm/event-handlers.js +2 -1
- package/dist/esm/nodeviews/TableComponent.js +118 -49
- package/dist/esm/nodeviews/TableContainer.js +8 -4
- package/dist/esm/nodeviews/TableResizer.js +6 -5
- package/dist/esm/nodeviews/table.js +12 -4
- package/dist/esm/plugin.js +50 -47
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -6
- package/dist/esm/pm-plugins/keymap.js +6 -3
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -11
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +22 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +52 -11
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +19 -8
- package/dist/esm/toolbar.js +17 -10
- package/dist/esm/transforms/column-width.js +23 -8
- package/dist/esm/transforms/delete-columns.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
- package/dist/esm/ui/FloatingContextualMenu/index.js +6 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +15 -4
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +50 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +16 -7
- package/dist/esm/ui/FloatingInsertButton/index.js +5 -1
- package/dist/esm/ui/consts.js +1 -0
- package/dist/esm/utils/create.js +1 -1
- package/dist/esm/utils/drag-menu.js +4 -3
- package/dist/types/commands/column-resize.d.ts +1 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +3 -0
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/nodeviews/table.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +7 -1
- package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +7 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +3 -3
- package/src/commands/column-resize.ts +3 -0
- package/src/commands/delete.ts +2 -1
- package/src/commands/insert.ts +15 -6
- package/src/commands-with-analytics.ts +9 -3
- package/src/event-handlers.ts +2 -0
- package/src/nodeviews/TableComponent.tsx +91 -5
- package/src/nodeviews/TableContainer.tsx +6 -0
- package/src/nodeviews/TableResizer.tsx +6 -0
- package/src/nodeviews/table.tsx +15 -10
- package/src/plugin.tsx +17 -5
- package/src/pm-plugins/drag-and-drop/plugin.ts +16 -8
- package/src/pm-plugins/keymap.ts +11 -3
- package/src/pm-plugins/main.ts +3 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +11 -1
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +49 -17
- package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +8 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +25 -1
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +2 -1
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +56 -11
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +24 -6
- package/src/toolbar.tsx +18 -5
- package/src/transforms/column-width.ts +33 -11
- package/src/transforms/delete-columns.ts +7 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -5
- package/src/ui/FloatingContextualMenu/index.tsx +4 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +19 -1
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +94 -50
- package/src/ui/FloatingDragMenu/index.tsx +17 -4
- package/src/ui/FloatingInsertButton/index.tsx +17 -5
- package/src/ui/consts.ts +1 -0
- package/src/utils/create.ts +1 -3
- package/src/utils/drag-menu.ts +4 -1
|
@@ -274,8 +274,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
274
274
|
isDragAndDropEnabled = _getPluginState8.isDragAndDropEnabled,
|
|
275
275
|
allowDistributeColumns = _getPluginState8.pluginConfig.allowDistributeColumns;
|
|
276
276
|
if (allowDistributeColumns && (!isDragAndDropEnabled || !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))) {
|
|
277
|
-
var _newResizeState$chang;
|
|
278
|
-
var
|
|
277
|
+
var _this$props$getEditor, _this$props9, _newResizeState$chang;
|
|
278
|
+
var _ref = ((_this$props$getEditor = (_this$props9 = _this.props).getEditorFeatureFlags) === null || _this$props$getEditor === void 0 ? void 0 : _this$props$getEditor.call(_this$props9)) || {},
|
|
279
|
+
_ref$tablePreserveWid = _ref.tablePreserveWidth,
|
|
280
|
+
tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
|
|
281
|
+
var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, editorView.state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
|
|
279
282
|
var wouldChange = (_newResizeState$chang = newResizeState === null || newResizeState === void 0 ? void 0 : newResizeState.changed) !== null && _newResizeState$chang !== void 0 ? _newResizeState$chang : false;
|
|
280
283
|
return {
|
|
281
284
|
content: formatMessage(messages.distributeColumns),
|
|
@@ -288,10 +291,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
288
291
|
return null;
|
|
289
292
|
});
|
|
290
293
|
_defineProperty(_assertThisInitialized(_this), "createSortColumnItems", function () {
|
|
291
|
-
var _this$
|
|
292
|
-
formatMessage = _this$
|
|
293
|
-
editorView = _this$
|
|
294
|
-
allowColumnSorting = _this$
|
|
294
|
+
var _this$props10 = _this.props,
|
|
295
|
+
formatMessage = _this$props10.intl.formatMessage,
|
|
296
|
+
editorView = _this$props10.editorView,
|
|
297
|
+
allowColumnSorting = _this$props10.allowColumnSorting;
|
|
295
298
|
var _getPluginState9 = getPluginState(editorView.state),
|
|
296
299
|
isDragAndDropEnabled = _getPluginState9.isDragAndDropEnabled;
|
|
297
300
|
if (allowColumnSorting && (!isDragAndDropEnabled || !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))) {
|
|
@@ -357,18 +360,22 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
357
360
|
items[1].items.push(deleteRowItem);
|
|
358
361
|
return items;
|
|
359
362
|
});
|
|
360
|
-
_defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (
|
|
361
|
-
var item =
|
|
362
|
-
var _this$
|
|
363
|
-
editorView = _this$
|
|
364
|
-
selectionRect = _this$
|
|
365
|
-
editorAnalyticsAPI = _this$
|
|
366
|
-
getEditorContainerWidth = _this$
|
|
363
|
+
_defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref2) {
|
|
364
|
+
var item = _ref2.item;
|
|
365
|
+
var _this$props11 = _this.props,
|
|
366
|
+
editorView = _this$props11.editorView,
|
|
367
|
+
selectionRect = _this$props11.selectionRect,
|
|
368
|
+
editorAnalyticsAPI = _this$props11.editorAnalyticsAPI,
|
|
369
|
+
getEditorContainerWidth = _this$props11.getEditorContainerWidth,
|
|
370
|
+
getEditorFeatureFlags = _this$props11.getEditorFeatureFlags;
|
|
367
371
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
368
372
|
var state = editorView.state,
|
|
369
373
|
dispatch = editorView.dispatch;
|
|
370
374
|
var _getPluginState10 = getPluginState(state),
|
|
371
375
|
targetCellPosition = _getPluginState10.targetCellPosition;
|
|
376
|
+
var _ref3 = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) || {},
|
|
377
|
+
_ref3$tablePreserveWi = _ref3.tablePreserveWidth,
|
|
378
|
+
tablePreserveWidth = _ref3$tablePreserveWi === void 0 ? false : _ref3$tablePreserveWi;
|
|
372
379
|
switch (item.value.name) {
|
|
373
380
|
case 'sort_column_desc':
|
|
374
381
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
@@ -387,7 +394,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
387
394
|
_this.toggleOpen();
|
|
388
395
|
break;
|
|
389
396
|
case 'distribute_columns':
|
|
390
|
-
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
|
|
397
|
+
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
|
|
391
398
|
if (newResizeStateWithAnalytics) {
|
|
392
399
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, newResizeStateWithAnalytics)(state, dispatch);
|
|
393
400
|
_this.toggleOpen();
|
|
@@ -398,7 +405,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
398
405
|
_this.toggleOpen();
|
|
399
406
|
break;
|
|
400
407
|
case 'insert_column':
|
|
401
|
-
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
408
|
+
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
402
409
|
_this.toggleOpen();
|
|
403
410
|
break;
|
|
404
411
|
case 'insert_row':
|
|
@@ -421,11 +428,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
421
428
|
}
|
|
422
429
|
});
|
|
423
430
|
_defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
|
|
424
|
-
var _this$
|
|
425
|
-
isOpen = _this$
|
|
426
|
-
_this$
|
|
427
|
-
state = _this$
|
|
428
|
-
dispatch = _this$
|
|
431
|
+
var _this$props12 = _this.props,
|
|
432
|
+
isOpen = _this$props12.isOpen,
|
|
433
|
+
_this$props12$editorV = _this$props12.editorView,
|
|
434
|
+
state = _this$props12$editorV.state,
|
|
435
|
+
dispatch = _this$props12$editorV.dispatch;
|
|
429
436
|
toggleContextualMenu()(state, dispatch);
|
|
430
437
|
if (!isOpen) {
|
|
431
438
|
_this.setState({
|
|
@@ -442,13 +449,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
442
449
|
isSubmenuOpen: false
|
|
443
450
|
});
|
|
444
451
|
});
|
|
445
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (
|
|
446
|
-
var item =
|
|
447
|
-
var _this$
|
|
448
|
-
_this$
|
|
449
|
-
state = _this$
|
|
450
|
-
dispatch = _this$
|
|
451
|
-
selectionRect = _this$
|
|
452
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref4) {
|
|
453
|
+
var item = _ref4.item;
|
|
454
|
+
var _this$props13 = _this.props,
|
|
455
|
+
_this$props13$editorV = _this$props13.editorView,
|
|
456
|
+
state = _this$props13$editorV.state,
|
|
457
|
+
dispatch = _this$props13$editorV.dispatch,
|
|
458
|
+
selectionRect = _this$props13.selectionRect;
|
|
452
459
|
if (item.value.name === 'background') {
|
|
453
460
|
if (!_this.state.isSubmenuOpen) {
|
|
454
461
|
_this.setState({
|
|
@@ -466,8 +473,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
466
473
|
hoverMergedCells()(state, dispatch);
|
|
467
474
|
}
|
|
468
475
|
});
|
|
469
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (
|
|
470
|
-
var item =
|
|
476
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref5) {
|
|
477
|
+
var item = _ref5.item;
|
|
471
478
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
472
479
|
state = _this$props$editorVie2.state,
|
|
473
480
|
dispatch = _this$props$editorVie2.dispatch;
|
|
@@ -486,9 +493,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
486
493
|
}
|
|
487
494
|
});
|
|
488
495
|
_defineProperty(_assertThisInitialized(_this), "setColor", function (color) {
|
|
489
|
-
var _this$
|
|
490
|
-
editorView = _this$
|
|
491
|
-
editorAnalyticsAPI = _this$
|
|
496
|
+
var _this$props14 = _this.props,
|
|
497
|
+
editorView = _this$props14.editorView,
|
|
498
|
+
editorAnalyticsAPI = _this$props14.editorAnalyticsAPI;
|
|
492
499
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
493
500
|
var _getPluginState12 = getPluginState(editorView.state),
|
|
494
501
|
targetCellPosition = _getPluginState12.targetCellPosition;
|
|
@@ -502,12 +509,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
502
509
|
_createClass(ContextualMenu, [{
|
|
503
510
|
key: "render",
|
|
504
511
|
value: function render() {
|
|
505
|
-
var _this$
|
|
506
|
-
isOpen = _this$
|
|
507
|
-
mountPoint = _this$
|
|
508
|
-
offset = _this$
|
|
509
|
-
boundariesElement = _this$
|
|
510
|
-
editorView = _this$
|
|
512
|
+
var _this$props15 = this.props,
|
|
513
|
+
isOpen = _this$props15.isOpen,
|
|
514
|
+
mountPoint = _this$props15.mountPoint,
|
|
515
|
+
offset = _this$props15.offset,
|
|
516
|
+
boundariesElement = _this$props15.boundariesElement,
|
|
517
|
+
editorView = _this$props15.editorView;
|
|
511
518
|
var _getPluginState13 = getPluginState(editorView.state),
|
|
512
519
|
isDragAndDropEnabled = _getPluginState13.isDragAndDropEnabled;
|
|
513
520
|
var items = isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
@@ -5,7 +5,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
-
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize } from '../consts';
|
|
8
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
9
9
|
import ContextualMenu from './ContextualMenu';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
11
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
@@ -16,7 +16,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
16
16
|
isOpen = _ref.isOpen,
|
|
17
17
|
pluginConfig = _ref.pluginConfig,
|
|
18
18
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
19
|
-
getEditorContainerWidth = _ref.getEditorContainerWidth
|
|
19
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
20
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
20
21
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
21
22
|
var _getPluginState = getPluginState(editorView.state),
|
|
22
23
|
targetCellPosition = _getPluginState.targetCellPosition,
|
|
@@ -42,7 +43,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
42
43
|
mountTo: mountPoint,
|
|
43
44
|
boundariesElement: boundariesElement,
|
|
44
45
|
scrollableElement: scrollableElement,
|
|
45
|
-
fitHeight:
|
|
46
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
46
47
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth
|
|
47
48
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
48
49
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -64,7 +65,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
64
65
|
selectionRect: selectionRect,
|
|
65
66
|
boundariesElement: boundariesElement,
|
|
66
67
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
67
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
68
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
69
|
+
getEditorFeatureFlags: getEditorFeatureFlags
|
|
68
70
|
})));
|
|
69
71
|
};
|
|
70
72
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -174,7 +174,13 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
174
174
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
175
175
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
176
176
|
pluginConfig = _ref.pluginConfig,
|
|
177
|
-
formatMessage = _ref.intl.formatMessage
|
|
177
|
+
formatMessage = _ref.intl.formatMessage,
|
|
178
|
+
fitHeight = _ref.fitHeight,
|
|
179
|
+
fitWidth = _ref.fitWidth,
|
|
180
|
+
mountPoint = _ref.mountPoint,
|
|
181
|
+
scrollableElement = _ref.scrollableElement,
|
|
182
|
+
boundariesElement = _ref.boundariesElement,
|
|
183
|
+
tablePreserveWidth = _ref.tablePreserveWidth;
|
|
178
184
|
var state = editorView.state,
|
|
179
185
|
dispatch = editorView.dispatch;
|
|
180
186
|
var selection = state.selection;
|
|
@@ -190,7 +196,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
190
196
|
var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
191
197
|
var hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
192
198
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
193
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired);
|
|
199
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, tablePreserveWidth);
|
|
194
200
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
195
201
|
menuItems = _convertToDropdownIte.menuItems,
|
|
196
202
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -446,12 +452,17 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
446
452
|
section: {
|
|
447
453
|
hasSeparator: true
|
|
448
454
|
},
|
|
449
|
-
target: target,
|
|
450
455
|
items: menuItems,
|
|
451
456
|
onItemActivated: handleMenuItemActivated,
|
|
452
457
|
onMouseEnter: handleItemMouseEnter,
|
|
453
458
|
onMouseLeave: handleItemMouseLeave,
|
|
454
|
-
handleClose: closeMenu
|
|
459
|
+
handleClose: closeMenu,
|
|
460
|
+
fitHeight: fitHeight,
|
|
461
|
+
fitWidth: fitWidth,
|
|
462
|
+
direction: direction,
|
|
463
|
+
mountPoint: mountPoint,
|
|
464
|
+
boundariesElement: boundariesElement,
|
|
465
|
+
scrollableElement: scrollableElement
|
|
455
466
|
});
|
|
456
467
|
});
|
|
457
468
|
export default injectIntl(DragMenu);
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { DropList, Popup } from '@atlaskit/editor-common/ui';
|
|
3
5
|
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
6
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
7
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
8
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
6
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
10
|
import { dragMenuDropdownWidth } from '../consts';
|
|
8
11
|
var DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
|
|
9
12
|
export var DropdownMenu = function DropdownMenu(_ref) {
|
|
10
|
-
var
|
|
11
|
-
items = _ref.items,
|
|
13
|
+
var items = _ref.items,
|
|
12
14
|
section = _ref.section,
|
|
13
15
|
disableKeyboardHandling = _ref.disableKeyboardHandling,
|
|
14
16
|
onItemActivated = _ref.onItemActivated,
|
|
15
17
|
handleClose = _ref.handleClose,
|
|
16
18
|
onMouseEnter = _ref.onMouseEnter,
|
|
17
|
-
onMouseLeave = _ref.onMouseLeave
|
|
19
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
20
|
+
fitWidth = _ref.fitWidth,
|
|
21
|
+
fitHeight = _ref.fitHeight,
|
|
22
|
+
direction = _ref.direction,
|
|
23
|
+
mountPoint = _ref.mountPoint,
|
|
24
|
+
boundariesElement = _ref.boundariesElement,
|
|
25
|
+
scrollableElement = _ref.scrollableElement;
|
|
26
|
+
var _useState = useState(['bottom', 'left']),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
popupPlacement = _useState2[0],
|
|
29
|
+
setPopupPlacement = _useState2[1];
|
|
30
|
+
var _useState3 = useState(null),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
targetRefDiv = _useState4[0],
|
|
33
|
+
setTargetRefDiv = _useState4[1];
|
|
34
|
+
var handleRef = function handleRef(ref) {
|
|
35
|
+
setTargetRefDiv(ref);
|
|
36
|
+
};
|
|
18
37
|
var innerMenu = function innerMenu() {
|
|
19
38
|
return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
|
|
20
39
|
isOpen: true,
|
|
21
40
|
shouldFitContainer: true,
|
|
22
|
-
position:
|
|
41
|
+
position: popupPlacement.join(' '),
|
|
23
42
|
handleClickOutside: function handleClickOutside() {
|
|
24
43
|
return handleClose('editor');
|
|
25
44
|
},
|
|
@@ -34,7 +53,7 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
34
53
|
e.stopPropagation();
|
|
35
54
|
}
|
|
36
55
|
},
|
|
37
|
-
targetRef:
|
|
56
|
+
targetRef: targetRefDiv
|
|
38
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
style: {
|
|
40
59
|
height: 0,
|
|
@@ -63,7 +82,29 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
63
82
|
if (disableKeyboardHandling) {
|
|
64
83
|
return innerMenu();
|
|
65
84
|
}
|
|
66
|
-
|
|
85
|
+
|
|
86
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
87
|
+
var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
|
|
88
|
+
var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "drag-dropdown-menu-wrapper"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "drag-dropdown-menu-popup-ref",
|
|
93
|
+
ref: handleRef
|
|
94
|
+
}), /*#__PURE__*/React.createElement(Popup, {
|
|
95
|
+
target: targetRefDiv,
|
|
96
|
+
mountTo: mountPoint,
|
|
97
|
+
boundariesElement: boundariesElement,
|
|
98
|
+
scrollableElement: scrollableElement,
|
|
99
|
+
onPlacementChanged: function onPlacementChanged(placement) {
|
|
100
|
+
setPopupPlacement(placement);
|
|
101
|
+
},
|
|
102
|
+
fitHeight: fitHeight,
|
|
103
|
+
fitWidth: fitWidth,
|
|
104
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
105
|
+
offset: [offsetX, offsetY],
|
|
106
|
+
allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
107
|
+
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
67
108
|
closeOnTab: true,
|
|
68
109
|
type: ArrowKeyNavigationType.MENU,
|
|
69
110
|
onSelection: function onSelection(index) {
|
|
@@ -112,5 +153,5 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
112
153
|
});
|
|
113
154
|
}
|
|
114
155
|
}
|
|
115
|
-
}, innerMenu());
|
|
156
|
+
}, innerMenu())));
|
|
116
157
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
5
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
6
|
import DragMenu from './DragMenu';
|
|
7
7
|
var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
8
8
|
var mountPoint = _ref.mountPoint,
|
|
@@ -17,18 +17,20 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
17
17
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
18
18
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
19
19
|
stickyHeaders = _ref.stickyHeaders,
|
|
20
|
-
pluginConfig = _ref.pluginConfig
|
|
20
|
+
pluginConfig = _ref.pluginConfig,
|
|
21
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
21
22
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
25
|
var inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
25
26
|
var targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
26
|
-
var offset = direction === 'row' ? [-9,
|
|
27
|
+
var offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
27
28
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
32
|
+
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tablePreserveWidth,
|
|
33
|
+
tablePreserveWidth = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
32
34
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
33
35
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
34
36
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -36,7 +38,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
36
38
|
mountTo: mountPoint,
|
|
37
39
|
boundariesElement: boundariesElement,
|
|
38
40
|
scrollableElement: scrollableElement,
|
|
39
|
-
fitWidth: dragMenuDropdownWidth
|
|
41
|
+
fitWidth: dragMenuDropdownWidth,
|
|
42
|
+
fitHeight: tablePopupMenuFitHeight
|
|
40
43
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
41
44
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
42
45
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -55,7 +58,13 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
55
58
|
targetCellPosition: targetCellPosition,
|
|
56
59
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
57
60
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
58
|
-
pluginConfig: pluginConfig
|
|
61
|
+
pluginConfig: pluginConfig,
|
|
62
|
+
fitWidth: dragMenuDropdownWidth,
|
|
63
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
64
|
+
mountPoint: mountPoint,
|
|
65
|
+
boundariesElement: boundariesElement,
|
|
66
|
+
scrollableElement: scrollableElement,
|
|
67
|
+
tablePreserveWidth: tablePreserveWidth
|
|
59
68
|
}));
|
|
60
69
|
};
|
|
61
70
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -188,10 +188,14 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
188
188
|
editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
|
|
189
189
|
getEditorContainerWidth = _this$props4.getEditorContainerWidth;
|
|
190
190
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
191
|
+
var _this$props$getEditor, _this$props5;
|
|
191
192
|
event.preventDefault();
|
|
193
|
+
var _ref = ((_this$props$getEditor = (_this$props5 = this.props).getEditorFeatureFlags) === null || _this$props$getEditor === void 0 ? void 0 : _this$props$getEditor.call(_this$props5)) || {},
|
|
194
|
+
_ref$tablePreserveWid = _ref.tablePreserveWidth,
|
|
195
|
+
tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
|
|
192
196
|
var state = editorView.state,
|
|
193
197
|
dispatch = editorView.dispatch;
|
|
194
|
-
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
198
|
+
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
201
|
}]);
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -56,6 +56,7 @@ export var stickyRowOffsetTop = 8;
|
|
|
56
56
|
export var stickyHeaderBorderBottomWidth = 1;
|
|
57
57
|
export var tableOverflowShadowWidth = 8;
|
|
58
58
|
export var tableOverflowShadowWidthWide = 32;
|
|
59
|
+
export var tablePopupMenuFitHeight = 188;
|
|
59
60
|
export var dropTargetsZIndex = 14;
|
|
60
61
|
export var TABLE_SNAP_GAP = 9;
|
|
61
62
|
export var TABLE_HIGHLIGHT_GAP = 10;
|
package/dist/esm/utils/create.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
|
|
|
5
5
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
6
6
|
export var createTableWithWidth = function createTableWithWidth(isFullWidthModeEnabled, getEditorFeatureFlags, createTableProps) {
|
|
7
7
|
return function (schema) {
|
|
8
|
-
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags()
|
|
8
|
+
var _ref = (getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) || {},
|
|
9
9
|
_ref$tablePreserveWid = _ref.tablePreserveWidth,
|
|
10
10
|
tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
|
|
11
11
|
if (tablePreserveWidth && isFullWidthModeEnabled) {
|
|
@@ -63,6 +63,7 @@ var defaultSelectionRect = {
|
|
|
63
63
|
};
|
|
64
64
|
export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
|
|
65
65
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
66
|
+
var tablePreserveWidth = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
66
67
|
var addOptions = direction === 'row' ? [{
|
|
67
68
|
label: 'above',
|
|
68
69
|
offset: 0,
|
|
@@ -147,7 +148,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
147
148
|
moveCursorToInsertedRow: true
|
|
148
149
|
})(state, dispatch);
|
|
149
150
|
} else {
|
|
150
|
-
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
151
|
+
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
151
152
|
}
|
|
152
153
|
return true;
|
|
153
154
|
},
|
|
@@ -160,7 +161,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
160
161
|
onClick: function onClick(state, dispatch) {
|
|
161
162
|
var selectionRect = getClosestSelectionRect(state);
|
|
162
163
|
if (selectionRect) {
|
|
163
|
-
var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
|
|
164
|
+
var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth, tablePreserveWidth);
|
|
164
165
|
if (newResizeState) {
|
|
165
166
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(state, dispatch);
|
|
166
167
|
return true;
|
|
@@ -186,7 +187,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
186
187
|
if (direction === 'row') {
|
|
187
188
|
deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect, !!isHeaderRowRequired)(state, dispatch);
|
|
188
189
|
} else {
|
|
189
|
-
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
|
|
190
|
+
deleteColumnsWithAnalytics(editorAnalyticsAPI, tablePreserveWidth)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect !== null && selectionRect !== void 0 ? selectionRect : defaultSelectionRect)(state, dispatch, editorView);
|
|
190
191
|
}
|
|
191
192
|
return true;
|
|
192
193
|
},
|
|
@@ -3,5 +3,5 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import type { Direction } from '@atlaskit/editor-tables/types';
|
|
4
4
|
export declare const initiateKeyboardColumnResizing: Command;
|
|
5
5
|
export declare const activateNextResizeArea: (direction: Direction) => Command;
|
|
6
|
-
export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
6
|
+
export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => Command;
|
|
7
7
|
export declare const stopKeyboardColumnResizing: (originalTr?: Transaction) => Command;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
|
-
export declare const deleteColumnsCommand: (rect: Rect) => Command;
|
|
3
|
+
export declare const deleteColumnsCommand: (rect: Rect, tablePreserveWidth?: boolean) => Command;
|
|
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
|
|
|
2
2
|
import type { Command, EditorCommand, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
|
-
export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
5
|
+
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
|
+
export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => Command;
|
|
7
7
|
export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
8
|
-
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
|
|
8
|
+
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth, tablePreserveWidth?: boolean) => (column: number) => Command;
|
|
9
9
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
10
10
|
export declare const createTable: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => Command;
|
|
11
11
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -11,9 +11,9 @@ 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 insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
14
|
+
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
15
|
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
|
-
export declare const deleteColumnsWithAnalytics: (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) => Command;
|
|
16
|
+
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;
|
|
17
17
|
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
18
18
|
export declare const deleteTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
19
19
|
export declare const deleteTableIfSelectedWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) => Command;
|
|
@@ -13,7 +13,7 @@ export declare const handleMouseEnter: (view: EditorView, mouseEvent: Event) =>
|
|
|
13
13
|
export declare const handleMouseLeave: (view: EditorView, event: Event) => boolean;
|
|
14
14
|
export declare const handleMouseMove: (view: EditorView, event: Event, elementContentRects?: ElementContentRects) => boolean;
|
|
15
15
|
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
16
|
-
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView) => Transaction;
|
|
16
|
+
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView, tablePreserveWidth?: boolean) => Transaction;
|
|
17
17
|
export declare const isTableInFocus: (view: EditorView) => boolean;
|
|
18
18
|
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
19
19
|
export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
@@ -29,6 +29,7 @@ export interface ComponentProps {
|
|
|
29
29
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
30
30
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
31
31
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
32
|
+
tableRef?: HTMLElement | undefined;
|
|
32
33
|
}
|
|
33
34
|
interface TableState {
|
|
34
35
|
scroll: number;
|
|
@@ -50,9 +51,11 @@ declare class TableComponent extends React.Component<ComponentProps, TableState>
|
|
|
50
51
|
private isInitialOverflowSent;
|
|
51
52
|
private initialOverflowCaptureTimerId?;
|
|
52
53
|
private dragAndDropCleanupFn?;
|
|
54
|
+
private tableColumnWidths?;
|
|
53
55
|
constructor(props: ComponentProps);
|
|
54
56
|
componentDidMount(): void;
|
|
55
57
|
componentWillUnmount(): void;
|
|
58
|
+
handleColgroupUpdates(): void;
|
|
56
59
|
componentDidUpdate(_: any, prevState: TableState): void;
|
|
57
60
|
private updateShadowState;
|
|
58
61
|
private createShadowSentinels;
|
|
@@ -24,8 +24,9 @@ type ResizableTableContainerProps = {
|
|
|
24
24
|
tableRef: HTMLTableElement;
|
|
25
25
|
isResizing?: boolean;
|
|
26
26
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
|
+
tablePreserveWidth?: boolean;
|
|
27
28
|
};
|
|
28
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tablePreserveWidth, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
29
30
|
type TableContainerProps = {
|
|
30
31
|
node: PMNode;
|
|
31
32
|
className: string;
|
|
@@ -38,6 +39,7 @@ type TableContainerProps = {
|
|
|
38
39
|
isNested: boolean;
|
|
39
40
|
isResizing?: boolean;
|
|
40
41
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
42
|
+
tablePreserveWidth?: boolean;
|
|
41
43
|
};
|
|
42
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
44
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, tablePreserveWidth, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
43
45
|
export {};
|
|
@@ -16,10 +16,11 @@ interface TableResizerProps {
|
|
|
16
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
17
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
18
18
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
19
|
+
tablePreserveWidth?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
21
22
|
onResizeStop?: () => void;
|
|
22
23
|
onResizeStart?: () => void;
|
|
23
24
|
}
|
|
24
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, tablePreserveWidth, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -14,6 +14,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
14
14
|
private resizeObserver?;
|
|
15
15
|
eventDispatcher?: EventDispatcher;
|
|
16
16
|
getPos: getPosHandlerNode;
|
|
17
|
+
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
17
18
|
constructor(props: Props);
|
|
18
19
|
getContentDOM(): {
|
|
19
20
|
dom: HTMLElement;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Dispatch
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
|
|
4
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
export declare const createPlugin: (dispatch: Dispatch, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<import("./types").DragAndDropPluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean): SafePlugin;
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags?: GetEditorFeatureFlags, dragAndDropEnabled?: boolean): SafePlugin;
|
|
5
5
|
export default keymapPlugin;
|
|
@@ -9,8 +9,8 @@ type Col = Array<string | {
|
|
|
9
9
|
* overflow.
|
|
10
10
|
*/
|
|
11
11
|
export declare const getColWidthFix: (colwidth: number, tableColumnCount: number) => number;
|
|
12
|
-
export declare const generateColgroup: (table: PmNode) => Col[];
|
|
13
|
-
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode) => HTMLCollection;
|
|
12
|
+
export declare const generateColgroup: (table: PmNode, tableRef?: HTMLElement) => Col[];
|
|
13
|
+
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode, tablePreserveWidth?: boolean, shouldRemove?: boolean) => HTMLCollection;
|
|
14
14
|
export declare const hasTableBeenResized: (table: PmNode) => boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Check if a table has all the column width set to tableCellMinWidth(48px) or null
|