@atlaskit/editor-plugin-table 7.12.6 → 7.13.1
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 +24 -0
- package/dist/cjs/commands/insert.js +6 -4
- package/dist/cjs/commands-with-analytics.js +4 -2
- package/dist/cjs/plugin.js +7 -4
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +10 -4
- package/dist/cjs/utils/drag-menu.js +3 -2
- package/dist/es2019/commands/insert.js +6 -6
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/plugin.js +7 -4
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -3
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +10 -4
- package/dist/es2019/utils/drag-menu.js +3 -3
- package/dist/esm/commands/insert.js +6 -4
- package/dist/esm/commands-with-analytics.js +4 -2
- package/dist/esm/plugin.js +7 -4
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +11 -7
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +10 -4
- package/dist/esm/utils/drag-menu.js +3 -2
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types/utils/drag-menu.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/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- 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/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/insert.ts +16 -6
- package/src/commands-with-analytics.ts +13 -3
- package/src/plugin.tsx +12 -0
- package/src/pm-plugins/main.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -8
- package/src/ui/FloatingContextualMenu/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +11 -1
- package/src/ui/FloatingInsertButton/index.tsx +38 -11
- package/src/utils/drag-menu.ts +17 -11
|
@@ -65,7 +65,7 @@ const defaultSelectionRect = {
|
|
|
65
65
|
right: 0,
|
|
66
66
|
bottom: 0
|
|
67
67
|
};
|
|
68
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false) => {
|
|
68
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false) => {
|
|
69
69
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
70
70
|
const addOptions = direction === 'row' ? [{
|
|
71
71
|
label: 'above',
|
|
@@ -140,12 +140,12 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
140
140
|
icon,
|
|
141
141
|
onClick: (state, dispatch) => {
|
|
142
142
|
if (direction === 'row') {
|
|
143
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
143
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
144
144
|
index: (index !== null && index !== void 0 ? index : 0) + offset,
|
|
145
145
|
moveCursorToInsertedRow: true
|
|
146
146
|
})(state, dispatch);
|
|
147
147
|
} else {
|
|
148
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
148
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
149
149
|
}
|
|
150
150
|
return true;
|
|
151
151
|
},
|
|
@@ -21,6 +21,7 @@ function addColumnAtCustomStep(column) {
|
|
|
21
21
|
}
|
|
22
22
|
export function addColumnAt() {
|
|
23
23
|
var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
24
|
+
var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
|
|
24
25
|
return function (column) {
|
|
25
26
|
var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
26
27
|
var view = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -29,7 +30,7 @@ export function addColumnAt() {
|
|
|
29
30
|
if (allowAddColumnCustomStep) {
|
|
30
31
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
31
32
|
} else {
|
|
32
|
-
updatedTr = addColumnAtPMUtils(column)(updatedTr);
|
|
33
|
+
updatedTr = addColumnAtPMUtils(column, isCellBackgroundDuplicated)(updatedTr);
|
|
33
34
|
}
|
|
34
35
|
var table = findTable(updatedTr.selection);
|
|
35
36
|
if (table) {
|
|
@@ -83,9 +84,10 @@ export var addColumnAfter = function addColumnAfter(isTableScalingEnabled) {
|
|
|
83
84
|
};
|
|
84
85
|
export var insertColumn = function insertColumn() {
|
|
85
86
|
var isTableScalingEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
87
|
+
var isCellBackgroundDuplicated = arguments.length > 1 ? arguments[1] : undefined;
|
|
86
88
|
return function (column) {
|
|
87
89
|
return function (state, dispatch, view) {
|
|
88
|
-
var tr = addColumnAt(isTableScalingEnabled)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
90
|
+
var tr = addColumnAt(isTableScalingEnabled, isCellBackgroundDuplicated)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
89
91
|
var table = findTable(tr.selection);
|
|
90
92
|
if (!table) {
|
|
91
93
|
return false;
|
|
@@ -99,7 +101,7 @@ export var insertColumn = function insertColumn() {
|
|
|
99
101
|
};
|
|
100
102
|
};
|
|
101
103
|
};
|
|
102
|
-
export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
104
|
+
export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBackgroundDuplicated) {
|
|
103
105
|
return function (state, dispatch) {
|
|
104
106
|
// Don't clone the header row
|
|
105
107
|
var headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
@@ -110,7 +112,7 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
|
110
112
|
if (row === 0 && headerRowEnabled) {
|
|
111
113
|
return false;
|
|
112
114
|
}
|
|
113
|
-
var tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row)(state.tr);
|
|
115
|
+
var tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
|
|
114
116
|
var table = findTable(tr.selection);
|
|
115
117
|
if (!table) {
|
|
116
118
|
return false;
|
|
@@ -165,6 +165,7 @@ export var addRowAroundSelection = function addRowAroundSelection(editorAnalytic
|
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyticsAPI) {
|
|
168
|
+
var isCellbackgroundDuplicated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
168
169
|
return function (inputMethod, options) {
|
|
169
170
|
return withEditorAnalyticsAPI(function (state) {
|
|
170
171
|
var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
|
|
@@ -182,7 +183,7 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
|
|
|
182
183
|
},
|
|
183
184
|
eventType: EVENT_TYPE.TRACK
|
|
184
185
|
};
|
|
185
|
-
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
186
|
+
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated));
|
|
186
187
|
};
|
|
187
188
|
};
|
|
188
189
|
export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
|
|
@@ -219,6 +220,7 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
|
|
|
219
220
|
};
|
|
220
221
|
export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
|
|
221
222
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
223
|
+
var isCellbackgroundDuplicated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
222
224
|
return function (inputMethod, position) {
|
|
223
225
|
return withEditorAnalyticsAPI(function (state) {
|
|
224
226
|
var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
|
|
@@ -236,7 +238,7 @@ export var insertColumnWithAnalytics = function insertColumnWithAnalytics(editor
|
|
|
236
238
|
},
|
|
237
239
|
eventType: EVENT_TYPE.TRACK
|
|
238
240
|
};
|
|
239
|
-
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
|
|
241
|
+
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position));
|
|
240
242
|
};
|
|
241
243
|
};
|
|
242
244
|
export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -144,8 +144,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
144
144
|
tableOptions = _ref3.tableOptions,
|
|
145
145
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
146
146
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
147
|
-
isTableScalingEnabled = _ref3.isTableScalingEnabled
|
|
148
|
-
|
|
147
|
+
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
148
|
+
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled;
|
|
149
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled);
|
|
149
150
|
}
|
|
150
151
|
}, {
|
|
151
152
|
name: 'tablePMColResizing',
|
|
@@ -360,7 +361,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
360
361
|
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
361
362
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
362
363
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
363
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
364
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
365
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
364
366
|
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
365
367
|
editorView: editorView,
|
|
366
368
|
mountPoint: popupsMountPoint,
|
|
@@ -385,7 +387,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
385
387
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
386
388
|
stickyHeaders: stickyHeader,
|
|
387
389
|
pluginConfig: pluginConfig,
|
|
388
|
-
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled
|
|
390
|
+
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
391
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
389
392
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
390
393
|
editorView: editorView,
|
|
391
394
|
selection: editorView.state.selection,
|
|
@@ -25,7 +25,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
25
25
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
26
26
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
27
27
|
import { pluginKey } from './plugin-key';
|
|
28
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) {
|
|
28
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled) {
|
|
29
29
|
var _accessibilityUtils;
|
|
30
30
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
31
31
|
pluginConfig: pluginConfig,
|
|
@@ -365,7 +365,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
365
365
|
editorView = _this$props10.editorView,
|
|
366
366
|
selectionRect = _this$props10.selectionRect,
|
|
367
367
|
editorAnalyticsAPI = _this$props10.editorAnalyticsAPI,
|
|
368
|
-
getEditorContainerWidth = _this$props10.getEditorContainerWidth
|
|
368
|
+
getEditorContainerWidth = _this$props10.getEditorContainerWidth,
|
|
369
|
+
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
|
|
369
370
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
370
371
|
var state = editorView.state,
|
|
371
372
|
dispatch = editorView.dispatch;
|
|
@@ -373,6 +374,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
373
374
|
targetCellPosition = _getPluginState11.targetCellPosition,
|
|
374
375
|
_getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
|
|
375
376
|
isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
|
|
377
|
+
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
378
|
+
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
379
|
+
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
|
|
376
380
|
switch (item.value.name) {
|
|
377
381
|
case 'sort_column_desc':
|
|
378
382
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
@@ -402,11 +406,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
402
406
|
_this.toggleOpen();
|
|
403
407
|
break;
|
|
404
408
|
case 'insert_column':
|
|
405
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
409
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
406
410
|
_this.toggleOpen();
|
|
407
411
|
break;
|
|
408
412
|
case 'insert_row':
|
|
409
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
413
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.CONTEXT_MENU, {
|
|
410
414
|
index: selectionRect.bottom,
|
|
411
415
|
moveCursorToInsertedRow: true
|
|
412
416
|
})(state, dispatch);
|
|
@@ -446,8 +450,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
446
450
|
isSubmenuOpen: false
|
|
447
451
|
});
|
|
448
452
|
});
|
|
449
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (
|
|
450
|
-
var item =
|
|
453
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref3) {
|
|
454
|
+
var item = _ref3.item;
|
|
451
455
|
var _this$props12 = _this.props,
|
|
452
456
|
_this$props12$editorV = _this$props12.editorView,
|
|
453
457
|
state = _this$props12$editorV.state,
|
|
@@ -470,8 +474,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
470
474
|
hoverMergedCells()(state, dispatch);
|
|
471
475
|
}
|
|
472
476
|
});
|
|
473
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (
|
|
474
|
-
var item =
|
|
477
|
+
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref4) {
|
|
478
|
+
var item = _ref4.item;
|
|
475
479
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
476
480
|
state = _this$props$editorVie2.state,
|
|
477
481
|
dispatch = _this$props$editorVie2.dispatch;
|
|
@@ -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,
|
|
@@ -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';
|
|
@@ -180,7 +180,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
180
180
|
mountPoint = _ref.mountPoint,
|
|
181
181
|
scrollableElement = _ref.scrollableElement,
|
|
182
182
|
boundariesElement = _ref.boundariesElement,
|
|
183
|
-
isTableScalingEnabled = _ref.isTableScalingEnabled
|
|
183
|
+
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
184
|
+
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring;
|
|
184
185
|
var state = editorView.state,
|
|
185
186
|
dispatch = editorView.dispatch;
|
|
186
187
|
var selection = state.selection;
|
|
@@ -204,7 +205,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
204
205
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
205
206
|
}
|
|
206
207
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
207
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
|
|
208
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring);
|
|
208
209
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
209
210
|
menuItems = _convertToDropdownIte.menuItems,
|
|
210
211
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -18,7 +18,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
18
18
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
19
19
|
stickyHeaders = _ref.stickyHeaders,
|
|
20
20
|
pluginConfig = _ref.pluginConfig,
|
|
21
|
-
isTableScalingEnabled = _ref.isTableScalingEnabled
|
|
21
|
+
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
22
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags;
|
|
22
23
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
@@ -28,6 +29,9 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
28
29
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
32
|
+
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
33
|
+
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
34
|
+
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC;
|
|
31
35
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
32
36
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
33
37
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -61,7 +65,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
61
65
|
mountPoint: mountPoint,
|
|
62
66
|
boundariesElement: boundariesElement,
|
|
63
67
|
scrollableElement: scrollableElement,
|
|
64
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
68
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
69
|
+
tableDuplicateCellColouring: tableDuplicateCellColouring
|
|
65
70
|
}));
|
|
66
71
|
};
|
|
67
72
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -169,12 +169,14 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
169
169
|
var _this$props3 = this.props,
|
|
170
170
|
editorView = _this$props3.editorView,
|
|
171
171
|
insertRowButtonIndex = _this$props3.insertRowButtonIndex,
|
|
172
|
-
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI
|
|
172
|
+
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI,
|
|
173
|
+
getEditorFeatureFlags = _this$props3.getEditorFeatureFlags;
|
|
173
174
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
174
175
|
event.preventDefault();
|
|
175
176
|
var state = editorView.state,
|
|
176
177
|
dispatch = editorView.dispatch;
|
|
177
|
-
|
|
178
|
+
var featureFlags = !!getEditorFeatureFlags && getEditorFeatureFlags();
|
|
179
|
+
insertRowWithAnalytics(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, {
|
|
178
180
|
index: insertRowButtonIndex,
|
|
179
181
|
moveCursorToInsertedRow: true
|
|
180
182
|
})(state, dispatch);
|
|
@@ -186,15 +188,19 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
186
188
|
var _this$props4 = this.props,
|
|
187
189
|
editorView = _this$props4.editorView,
|
|
188
190
|
insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
|
|
189
|
-
editorAnalyticsAPI = _this$props4.editorAnalyticsAPI
|
|
191
|
+
editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
|
|
192
|
+
getEditorFeatureFlags = _this$props4.getEditorFeatureFlags;
|
|
190
193
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
191
194
|
event.preventDefault();
|
|
192
195
|
var _getPluginState = getPluginState(editorView.state),
|
|
193
196
|
_getPluginState$isTab = _getPluginState.isTableScalingEnabled,
|
|
194
197
|
isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
|
|
198
|
+
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
199
|
+
_ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
|
|
200
|
+
tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe;
|
|
195
201
|
var state = editorView.state,
|
|
196
202
|
dispatch = editorView.dispatch;
|
|
197
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
203
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
}]);
|
|
@@ -71,6 +71,7 @@ var defaultSelectionRect = {
|
|
|
71
71
|
export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
|
|
72
72
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
73
73
|
var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
74
|
+
var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
74
75
|
var addOptions = direction === 'row' ? [{
|
|
75
76
|
label: 'above',
|
|
76
77
|
offset: 0,
|
|
@@ -150,12 +151,12 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
150
151
|
icon: icon,
|
|
151
152
|
onClick: function onClick(state, dispatch) {
|
|
152
153
|
if (direction === 'row') {
|
|
153
|
-
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
154
|
+
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
154
155
|
index: (index !== null && index !== void 0 ? index : 0) + offset,
|
|
155
156
|
moveCursorToInsertedRow: true
|
|
156
157
|
})(state, dispatch);
|
|
157
158
|
} else {
|
|
158
|
-
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
159
|
+
insertColumnWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
159
160
|
}
|
|
160
161
|
return true;
|
|
161
162
|
},
|
|
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
|
|
|
2
2
|
import type { Command, EditorCommand } 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(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
|
|
7
7
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
|
-
export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
|
|
9
|
-
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
8
|
+
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
10
|
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
11
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
|
|
|
12
12
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
13
13
|
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, editorView?: EditorView | null) => Command;
|
|
14
14
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
15
|
-
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
15
|
+
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
16
16
|
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
|
|
17
|
-
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
17
|
+
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
18
18
|
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;
|
|
19
19
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
20
20
|
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface TablePluginOptions {
|
|
|
18
18
|
wasFullWidthEnabled?: boolean;
|
|
19
19
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
20
20
|
isTableScalingEnabled?: boolean;
|
|
21
|
+
isTableAlignmentEnabled?: boolean;
|
|
21
22
|
}
|
|
22
23
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
23
24
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -6,4 +6,4 @@ import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-pro
|
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
9
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
9
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -17,7 +17,7 @@ export interface Props {
|
|
|
17
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
18
18
|
}
|
|
19
19
|
declare const FloatingContextualMenu: {
|
|
20
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export default FloatingContextualMenu;
|
|
@@ -25,8 +25,9 @@ type DragMenuProps = {
|
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
27
|
isTableScalingEnabled?: boolean;
|
|
28
|
+
tableDuplicateCellColouring?: boolean;
|
|
28
29
|
};
|
|
29
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
31
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
31
32
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
32
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -21,9 +21,10 @@ export interface Props {
|
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
23
|
isTableScalingEnabled?: boolean;
|
|
24
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
24
25
|
}
|
|
25
26
|
declare const FloatingDragMenu: {
|
|
26
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
27
28
|
displayName: string;
|
|
28
29
|
};
|
|
29
30
|
export default FloatingDragMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
export interface Props {
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
25
26
|
static displayName: string;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
|
|
@@ -2,10 +2,10 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
|
|
|
2
2
|
import type { Command, EditorCommand } 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(isTableScalingEnabled?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare function addColumnAt(isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Command;
|
|
7
7
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
|
-
export declare const insertColumn: (isTableScalingEnabled?: boolean) => (column: number) => Command;
|
|
9
|
-
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
8
|
+
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
10
|
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
11
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -12,9 +12,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
|
|
|
12
12
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
13
13
|
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, editorView?: EditorView | null) => Command;
|
|
14
14
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
15
|
-
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
15
|
+
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
16
16
|
export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
|
|
17
|
-
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
17
|
+
export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
|
|
18
18
|
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;
|
|
19
19
|
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
|
|
20
20
|
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
@@ -18,6 +18,7 @@ export interface TablePluginOptions {
|
|
|
18
18
|
wasFullWidthEnabled?: boolean;
|
|
19
19
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
20
20
|
isTableScalingEnabled?: boolean;
|
|
21
|
+
isTableAlignmentEnabled?: boolean;
|
|
21
22
|
}
|
|
22
23
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
23
24
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -6,4 +6,4 @@ import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-pro
|
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
9
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
9
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -17,7 +17,7 @@ export interface Props {
|
|
|
17
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
18
18
|
}
|
|
19
19
|
declare const FloatingContextualMenu: {
|
|
20
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export default FloatingContextualMenu;
|
|
@@ -25,8 +25,9 @@ type DragMenuProps = {
|
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
27
|
isTableScalingEnabled?: boolean;
|
|
28
|
+
tableDuplicateCellColouring?: boolean;
|
|
28
29
|
};
|
|
29
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
31
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
31
32
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
32
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -21,9 +21,10 @@ export interface Props {
|
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
23
|
isTableScalingEnabled?: boolean;
|
|
24
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
24
25
|
}
|
|
25
26
|
declare const FloatingDragMenu: {
|
|
26
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, }: Props): JSX.Element | null;
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
27
28
|
displayName: string;
|
|
28
29
|
};
|
|
29
30
|
export default FloatingDragMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
export interface Props {
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
25
26
|
static displayName: string;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean) => DragMenuConfig[];
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"runReact18": false
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^
|
|
31
|
+
"@atlaskit/adf-schema": "^36.1.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.1.0",
|
|
33
33
|
"@atlaskit/editor-common": "^79.2.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.0",
|