@atlaskit/editor-plugin-table 7.31.2 → 7.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/commands/insert.js +16 -19
- package/dist/cjs/commands-with-analytics.js +5 -7
- package/dist/cjs/plugin.js +2 -3
- package/dist/cjs/pm-plugins/keymap.js +9 -10
- package/dist/cjs/toolbar.js +9 -12
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +1 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +2 -4
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -7
- package/dist/cjs/utils/drag-menu.js +6 -7
- package/dist/es2019/commands/insert.js +10 -10
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/plugin.js +2 -3
- package/dist/es2019/pm-plugins/keymap.js +5 -5
- package/dist/es2019/toolbar.js +5 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +2 -3
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +2 -3
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -6
- package/dist/es2019/utils/drag-menu.js +3 -3
- package/dist/esm/commands/insert.js +16 -19
- package/dist/esm/commands-with-analytics.js +5 -7
- package/dist/esm/plugin.js +2 -3
- package/dist/esm/pm-plugins/keymap.js +9 -10
- package/dist/esm/toolbar.js +9 -12
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +2 -4
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -7
- package/dist/esm/utils/drag-menu.js +6 -7
- package/dist/types/commands/insert.d.ts +5 -5
- package/dist/types/commands-with-analytics.d.ts +3 -4
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/toolbar.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +5 -5
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -4
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +3 -3
- package/src/commands/insert.ts +3 -10
- package/src/commands-with-analytics.ts +7 -8
- package/src/plugin.tsx +0 -4
- package/src/pm-plugins/keymap.ts +0 -5
- package/src/toolbar.tsx +0 -8
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +7 -10
- package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -3
- package/src/ui/FloatingDragMenu/index.tsx +1 -3
- package/src/ui/FloatingInsertButton/index.tsx +5 -10
- package/src/utils/drag-menu.ts +4 -9
package/dist/es2019/toolbar.js
CHANGED
|
@@ -124,7 +124,7 @@ export const getToolbarMenuConfig = (config, state, {
|
|
|
124
124
|
// with native widgets. It's enabled via a plugin config.
|
|
125
125
|
export const getToolbarCellOptionsConfig = (editorState, editorView, initialSelectionRect, {
|
|
126
126
|
formatMessage
|
|
127
|
-
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled = false,
|
|
127
|
+
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
128
128
|
var _pluginState$pluginCo, _pluginState$pluginCo2;
|
|
129
129
|
const {
|
|
130
130
|
top,
|
|
@@ -142,7 +142,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
142
142
|
const selectionRect = getClosestSelectionRect(state);
|
|
143
143
|
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
144
144
|
if (index) {
|
|
145
|
-
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
145
|
+
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
146
146
|
}
|
|
147
147
|
return true;
|
|
148
148
|
},
|
|
@@ -367,8 +367,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
367
367
|
};
|
|
368
368
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
369
369
|
const alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
370
|
-
const
|
|
371
|
-
const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
370
|
+
const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
372
371
|
const columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
373
372
|
const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
374
373
|
|
|
@@ -445,12 +444,12 @@ const separator = hidden => {
|
|
|
445
444
|
};
|
|
446
445
|
const getCellItems = (state, view, {
|
|
447
446
|
formatMessage
|
|
448
|
-
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled = false,
|
|
447
|
+
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
|
|
449
448
|
const initialSelectionRect = getClosestSelectionRect(state);
|
|
450
449
|
if (initialSelectionRect) {
|
|
451
450
|
const cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
452
451
|
formatMessage
|
|
453
|
-
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
452
|
+
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
454
453
|
return [cellOptions, separator(cellOptions.hidden)];
|
|
455
454
|
}
|
|
456
455
|
return [];
|
|
@@ -512,7 +512,6 @@ export class ContextualMenu extends Component {
|
|
|
512
512
|
isTableScalingEnabled = false
|
|
513
513
|
} = getPluginState(state);
|
|
514
514
|
const {
|
|
515
|
-
tableDuplicateCellColouring = false,
|
|
516
515
|
tableWithFixedColumnWidthsOption = false
|
|
517
516
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
518
517
|
// context menu opened by keyboard and any item except 'background' activated
|
|
@@ -562,11 +561,11 @@ export class ContextualMenu extends Component {
|
|
|
562
561
|
this.toggleOpen();
|
|
563
562
|
break;
|
|
564
563
|
case 'insert_column':
|
|
565
|
-
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
564
|
+
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
566
565
|
this.toggleOpen();
|
|
567
566
|
break;
|
|
568
567
|
case 'insert_row':
|
|
569
|
-
insertRowWithAnalytics(editorAnalyticsAPI
|
|
568
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
570
569
|
index: selectionRect.bottom,
|
|
571
570
|
moveCursorToInsertedRow: true
|
|
572
571
|
})(state, dispatch);
|
|
@@ -196,7 +196,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
196
196
|
scrollableElement,
|
|
197
197
|
boundariesElement,
|
|
198
198
|
isTableScalingEnabled,
|
|
199
|
-
tableDuplicateCellColouring,
|
|
200
199
|
shouldUseIncreasedScalingPercent,
|
|
201
200
|
isTableFixedColumnWidthsOptionEnabled,
|
|
202
201
|
ariaNotifyPlugin,
|
|
@@ -218,7 +217,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
218
217
|
const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
219
218
|
const hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
220
219
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
221
|
-
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled,
|
|
220
|
+
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
|
|
222
221
|
const {
|
|
223
222
|
menuItems,
|
|
224
223
|
menuCallback
|
|
@@ -24,6 +24,7 @@ const FloatingDragMenu = ({
|
|
|
24
24
|
api,
|
|
25
25
|
isCommentEditor
|
|
26
26
|
}) => {
|
|
27
|
+
var _getEditorFeatureFlag;
|
|
27
28
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
@@ -34,9 +35,8 @@ const FloatingDragMenu = ({
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
const {
|
|
37
|
-
tableDuplicateCellColouring = false,
|
|
38
38
|
tableWithFixedColumnWidthsOption = false
|
|
39
|
-
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
39
|
+
} = (_getEditorFeatureFlag = getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) !== null && _getEditorFeatureFlag !== void 0 ? _getEditorFeatureFlag : {};
|
|
40
40
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
41
41
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
42
42
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
@@ -72,7 +72,6 @@ const FloatingDragMenu = ({
|
|
|
72
72
|
boundariesElement: boundariesElement,
|
|
73
73
|
scrollableElement: scrollableElement,
|
|
74
74
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
75
|
-
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
76
75
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
77
76
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
78
77
|
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
@@ -157,8 +157,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
157
157
|
const {
|
|
158
158
|
editorView,
|
|
159
159
|
insertRowButtonIndex,
|
|
160
|
-
editorAnalyticsAPI
|
|
161
|
-
getEditorFeatureFlags
|
|
160
|
+
editorAnalyticsAPI
|
|
162
161
|
} = this.props;
|
|
163
162
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
164
163
|
event.preventDefault();
|
|
@@ -166,8 +165,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
166
165
|
state,
|
|
167
166
|
dispatch
|
|
168
167
|
} = editorView;
|
|
169
|
-
|
|
170
|
-
insertRowWithAnalytics(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, {
|
|
168
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.BUTTON, {
|
|
171
169
|
index: insertRowButtonIndex,
|
|
172
170
|
moveCursorToInsertedRow: true
|
|
173
171
|
})(state, dispatch);
|
|
@@ -185,7 +183,6 @@ export class FloatingInsertButton extends React.Component {
|
|
|
185
183
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
186
184
|
event.preventDefault();
|
|
187
185
|
const {
|
|
188
|
-
tableDuplicateCellColouring = false,
|
|
189
186
|
tableWithFixedColumnWidthsOption = false
|
|
190
187
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
191
188
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
@@ -193,7 +190,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
193
190
|
state,
|
|
194
191
|
dispatch
|
|
195
192
|
} = editorView;
|
|
196
|
-
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
193
|
+
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
197
194
|
}
|
|
198
195
|
}
|
|
199
196
|
}
|
|
@@ -72,7 +72,7 @@ const defaultSelectionRect = {
|
|
|
72
72
|
right: 0,
|
|
73
73
|
bottom: 0
|
|
74
74
|
};
|
|
75
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false,
|
|
75
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, ariaNotifyPlugin, isCommentEditor = false) => {
|
|
76
76
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
77
77
|
const {
|
|
78
78
|
selection
|
|
@@ -178,12 +178,12 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
178
178
|
iconFallback: iconFallback,
|
|
179
179
|
onClick: (state, dispatch) => {
|
|
180
180
|
if (direction === 'row') {
|
|
181
|
-
insertRowWithAnalytics(editorAnalyticsAPI
|
|
181
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
182
182
|
index: (index !== null && index !== void 0 ? index : 0) + offset,
|
|
183
183
|
moveCursorToInsertedRow: true
|
|
184
184
|
})(state, dispatch);
|
|
185
185
|
} else {
|
|
186
|
-
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
186
|
+
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
187
187
|
}
|
|
188
188
|
return true;
|
|
189
189
|
},
|
|
@@ -21,10 +21,9 @@ function addColumnAtCustomStep(column) {
|
|
|
21
21
|
}
|
|
22
22
|
export function addColumnAt(api) {
|
|
23
23
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var isCommentEditor = arguments.length > 5 ? arguments[5] : undefined;
|
|
24
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 2 ? arguments[2] : undefined;
|
|
25
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 3 ? arguments[3] : undefined;
|
|
26
|
+
var isCommentEditor = arguments.length > 4 ? arguments[4] : undefined;
|
|
28
27
|
return function (column) {
|
|
29
28
|
var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
30
29
|
var view = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -33,7 +32,7 @@ export function addColumnAt(api) {
|
|
|
33
32
|
if (allowAddColumnCustomStep) {
|
|
34
33
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
35
34
|
} else {
|
|
36
|
-
updatedTr = addColumnAtPMUtils(column
|
|
35
|
+
updatedTr = addColumnAtPMUtils(column)(updatedTr);
|
|
37
36
|
}
|
|
38
37
|
var table = findTable(updatedTr.selection);
|
|
39
38
|
if (table) {
|
|
@@ -57,10 +56,9 @@ export function addColumnAt(api) {
|
|
|
57
56
|
// Command to add a column before the column with the selection.
|
|
58
57
|
export var addColumnBefore = function addColumnBefore(api) {
|
|
59
58
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
59
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
60
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
61
|
+
var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
64
62
|
return function (state, dispatch, view) {
|
|
65
63
|
var table = findTable(state.selection);
|
|
66
64
|
if (!table) {
|
|
@@ -68,7 +66,7 @@ export var addColumnBefore = function addColumnBefore(api) {
|
|
|
68
66
|
}
|
|
69
67
|
if (dispatch) {
|
|
70
68
|
var rect = selectedRect(state);
|
|
71
|
-
dispatch(addColumnAt(api, isTableScalingEnabled,
|
|
69
|
+
dispatch(addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
72
70
|
}
|
|
73
71
|
return true;
|
|
74
72
|
};
|
|
@@ -76,7 +74,7 @@ export var addColumnBefore = function addColumnBefore(api) {
|
|
|
76
74
|
|
|
77
75
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
78
76
|
// Command to add a column after the column with the selection.
|
|
79
|
-
export var addColumnAfter = function addColumnAfter(api, isTableScalingEnabled,
|
|
77
|
+
export var addColumnAfter = function addColumnAfter(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
80
78
|
return function (state, dispatch, view) {
|
|
81
79
|
var table = findTable(state.selection);
|
|
82
80
|
if (!table) {
|
|
@@ -84,20 +82,19 @@ export var addColumnAfter = function addColumnAfter(api, isTableScalingEnabled,
|
|
|
84
82
|
}
|
|
85
83
|
if (dispatch) {
|
|
86
84
|
var rect = selectedRect(state);
|
|
87
|
-
dispatch(addColumnAt(api, isTableScalingEnabled,
|
|
85
|
+
dispatch(addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
88
86
|
}
|
|
89
87
|
return true;
|
|
90
88
|
};
|
|
91
89
|
};
|
|
92
90
|
export var insertColumn = function insertColumn(api) {
|
|
93
91
|
var isTableScalingEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
var isCommentEditor = arguments.length > 5 ? arguments[5] : undefined;
|
|
92
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 2 ? arguments[2] : undefined;
|
|
93
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 3 ? arguments[3] : undefined;
|
|
94
|
+
var isCommentEditor = arguments.length > 4 ? arguments[4] : undefined;
|
|
98
95
|
return function (column) {
|
|
99
96
|
return function (state, dispatch, view) {
|
|
100
|
-
var tr = addColumnAt(api, isTableScalingEnabled,
|
|
97
|
+
var tr = addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
101
98
|
var table = findTable(tr.selection);
|
|
102
99
|
if (!table) {
|
|
103
100
|
return false;
|
|
@@ -111,7 +108,7 @@ export var insertColumn = function insertColumn(api) {
|
|
|
111
108
|
};
|
|
112
109
|
};
|
|
113
110
|
};
|
|
114
|
-
export var insertRow = function insertRow(row, moveCursorToTheNewRow
|
|
111
|
+
export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
115
112
|
return function (state, dispatch) {
|
|
116
113
|
// Don't clone the header row
|
|
117
114
|
var headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
@@ -122,7 +119,7 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBack
|
|
|
122
119
|
if (row === 0 && headerRowEnabled) {
|
|
123
120
|
return false;
|
|
124
121
|
}
|
|
125
|
-
var tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined
|
|
122
|
+
var tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined)(state.tr);
|
|
126
123
|
var table = findTable(tr.selection);
|
|
127
124
|
if (!table) {
|
|
128
125
|
return false;
|
|
@@ -161,7 +161,6 @@ export var addRowAroundSelection = function addRowAroundSelection(editorAnalytic
|
|
|
161
161
|
};
|
|
162
162
|
};
|
|
163
163
|
export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyticsAPI) {
|
|
164
|
-
var isCellbackgroundDuplicated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
165
164
|
return function (inputMethod, options) {
|
|
166
165
|
return withEditorAnalyticsAPI(function (state) {
|
|
167
166
|
var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
|
|
@@ -179,7 +178,7 @@ export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyt
|
|
|
179
178
|
},
|
|
180
179
|
eventType: EVENT_TYPE.TRACK
|
|
181
180
|
};
|
|
182
|
-
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow
|
|
181
|
+
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
183
182
|
};
|
|
184
183
|
};
|
|
185
184
|
export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api) {
|
|
@@ -219,10 +218,9 @@ export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthBySt
|
|
|
219
218
|
};
|
|
220
219
|
export var insertColumnWithAnalytics = function insertColumnWithAnalytics(api, editorAnalyticsAPI) {
|
|
221
220
|
var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var isCommentEditor = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
221
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
222
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
223
|
+
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
226
224
|
return function (inputMethod, position) {
|
|
227
225
|
return withEditorAnalyticsAPI(function (state) {
|
|
228
226
|
var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
|
|
@@ -240,7 +238,7 @@ export var insertColumnWithAnalytics = function insertColumnWithAnalytics(api, e
|
|
|
240
238
|
},
|
|
241
239
|
eventType: EVENT_TYPE.TRACK
|
|
242
240
|
};
|
|
243
|
-
})(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled,
|
|
241
|
+
})(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(position));
|
|
244
242
|
};
|
|
245
243
|
};
|
|
246
244
|
export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -59,7 +59,7 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
59
59
|
* from `@atlaskit/editor-core`.
|
|
60
60
|
*/
|
|
61
61
|
var tablesPlugin = function tablesPlugin(_ref) {
|
|
62
|
-
var _api$analytics, _api$accessibilityUti, _options$getEditorFea,
|
|
62
|
+
var _api$analytics, _api$accessibilityUti, _options$getEditorFea, _api$analytics2;
|
|
63
63
|
var options = _ref.config,
|
|
64
64
|
api = _ref.api;
|
|
65
65
|
var editorViewRef = {
|
|
@@ -76,7 +76,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
76
76
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
77
77
|
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
78
78
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
79
|
-
var isCellBackgroundDuplicated = (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
|
|
80
79
|
return {
|
|
81
80
|
name: 'table',
|
|
82
81
|
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
@@ -262,7 +261,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
262
261
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
263
262
|
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
264
263
|
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
265
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl,
|
|
264
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
266
265
|
}
|
|
267
266
|
}, {
|
|
268
267
|
name: 'tableSelectionKeymap',
|
|
@@ -14,12 +14,11 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
14
14
|
var isFullWidthEnabled = arguments.length > 7 ? arguments[7] : undefined;
|
|
15
15
|
var pluginInjectionApi = arguments.length > 8 ? arguments[8] : undefined;
|
|
16
16
|
var getIntl = arguments.length > 9 ? arguments[9] : undefined;
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var isTableResizingEnabled = arguments.length > 15 ? arguments[15] : undefined;
|
|
17
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
18
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 11 ? arguments[11] : undefined;
|
|
19
|
+
var isCommentEditor = arguments.length > 12 ? arguments[12] : undefined;
|
|
20
|
+
var isChromelessEditor = arguments.length > 13 ? arguments[13] : undefined;
|
|
21
|
+
var isTableResizingEnabled = arguments.length > 14 ? arguments[14] : undefined;
|
|
23
22
|
var list = {};
|
|
24
23
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
25
24
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
@@ -31,12 +30,12 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
31
30
|
// Add row/column shortcuts
|
|
32
31
|
bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
33
32
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
34
|
-
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(api, isTableScalingEnabled,
|
|
35
|
-
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(api, isTableScalingEnabled,
|
|
33
|
+
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
34
|
+
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
36
35
|
bindKeymapWithCommand(addRowBeforeVO.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
37
36
|
bindKeymapWithCommand(addRowAfterVO.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
38
|
-
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(api, isTableScalingEnabled,
|
|
39
|
-
bindKeymapWithCommand(addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled,
|
|
37
|
+
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
38
|
+
bindKeymapWithCommand(addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
40
39
|
if (dragAndDropEnabled) {
|
|
41
40
|
// Move row/column shortcuts
|
|
42
41
|
/**
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -135,10 +135,9 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
135
135
|
var _pluginState$pluginCo, _pluginState$pluginCo2;
|
|
136
136
|
var formatMessage = _ref2.formatMessage;
|
|
137
137
|
var isTableScalingEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var isCommentEditor = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
138
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
139
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
140
|
+
var isCommentEditor = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
142
141
|
var top = initialSelectionRect.top,
|
|
143
142
|
bottom = initialSelectionRect.bottom,
|
|
144
143
|
right = initialSelectionRect.right,
|
|
@@ -153,7 +152,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
153
152
|
var selectionRect = getClosestSelectionRect(state);
|
|
154
153
|
var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
155
154
|
if (index) {
|
|
156
|
-
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
155
|
+
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
157
156
|
}
|
|
158
157
|
return true;
|
|
159
158
|
},
|
|
@@ -381,8 +380,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
381
380
|
};
|
|
382
381
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
383
382
|
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
384
|
-
var
|
|
385
|
-
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
383
|
+
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
|
|
386
384
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor) : [];
|
|
387
385
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
388
386
|
|
|
@@ -469,15 +467,14 @@ var separator = function separator(hidden) {
|
|
|
469
467
|
var getCellItems = function getCellItems(state, view, _ref3, getEditorContainerWidth, api, editorAnalyticsAPI) {
|
|
470
468
|
var formatMessage = _ref3.formatMessage;
|
|
471
469
|
var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
472
|
-
var
|
|
473
|
-
var
|
|
474
|
-
var
|
|
475
|
-
var isCommentEditor = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
470
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
471
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
472
|
+
var isCommentEditor = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
476
473
|
var initialSelectionRect = getClosestSelectionRect(state);
|
|
477
474
|
if (initialSelectionRect) {
|
|
478
475
|
var cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
479
476
|
formatMessage: formatMessage
|
|
480
|
-
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
477
|
+
}, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
481
478
|
return [cellOptions, separator(cellOptions.hidden)];
|
|
482
479
|
}
|
|
483
480
|
return [];
|
|
@@ -475,8 +475,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
475
475
|
_getPluginState11$isT = _getPluginState11.isTableScalingEnabled,
|
|
476
476
|
isTableScalingEnabled = _getPluginState11$isT === void 0 ? false : _getPluginState11$isT;
|
|
477
477
|
var _ref3 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
478
|
-
_ref3$tableDuplicateC = _ref3.tableDuplicateCellColouring,
|
|
479
|
-
tableDuplicateCellColouring = _ref3$tableDuplicateC === void 0 ? false : _ref3$tableDuplicateC,
|
|
480
478
|
_ref3$tableWithFixedC = _ref3.tableWithFixedColumnWidthsOption,
|
|
481
479
|
tableWithFixedColumnWidthsOption = _ref3$tableWithFixedC === void 0 ? false : _ref3$tableWithFixedC;
|
|
482
480
|
// context menu opened by keyboard and any item except 'background' activated
|
|
@@ -524,11 +522,11 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
524
522
|
_this.toggleOpen();
|
|
525
523
|
break;
|
|
526
524
|
case 'insert_column':
|
|
527
|
-
insertColumnWithAnalytics(_this.props.api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
525
|
+
insertColumnWithAnalytics(_this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
528
526
|
_this.toggleOpen();
|
|
529
527
|
break;
|
|
530
528
|
case 'insert_row':
|
|
531
|
-
insertRowWithAnalytics(editorAnalyticsAPI
|
|
529
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
532
530
|
index: selectionRect.bottom,
|
|
533
531
|
moveCursorToInsertedRow: true
|
|
534
532
|
})(state, dispatch);
|
|
@@ -200,7 +200,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
200
200
|
scrollableElement = _ref.scrollableElement,
|
|
201
201
|
boundariesElement = _ref.boundariesElement,
|
|
202
202
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
203
|
-
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
204
203
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
205
204
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
206
205
|
ariaNotifyPlugin = _ref.ariaNotifyPlugin,
|
|
@@ -218,7 +217,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
218
217
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
219
218
|
var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
220
219
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
221
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled,
|
|
220
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, ariaNotifyPlugin, isCommentEditor);
|
|
222
221
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
223
222
|
menuItems = _convertToDropdownIte.menuItems,
|
|
224
223
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -5,6 +5,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
5
5
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
6
|
import DragMenu from './DragMenu';
|
|
7
7
|
var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
8
|
+
var _getEditorFeatureFlag;
|
|
8
9
|
var mountPoint = _ref.mountPoint,
|
|
9
10
|
boundariesElement = _ref.boundariesElement,
|
|
10
11
|
scrollableElement = _ref.scrollableElement,
|
|
@@ -32,9 +33,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
32
33
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
|
-
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
36
|
-
_ref2$tableDuplicateC = _ref2.tableDuplicateCellColouring,
|
|
37
|
-
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
|
|
36
|
+
var _ref2 = (_getEditorFeatureFlag = getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) !== null && _getEditorFeatureFlag !== void 0 ? _getEditorFeatureFlag : {},
|
|
38
37
|
_ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
|
|
39
38
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC;
|
|
40
39
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
@@ -72,7 +71,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
72
71
|
boundariesElement: boundariesElement,
|
|
73
72
|
scrollableElement: scrollableElement,
|
|
74
73
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
75
|
-
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
76
74
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
77
75
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
78
76
|
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
@@ -170,14 +170,12 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
170
170
|
var _this$props3 = this.props,
|
|
171
171
|
editorView = _this$props3.editorView,
|
|
172
172
|
insertRowButtonIndex = _this$props3.insertRowButtonIndex,
|
|
173
|
-
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI
|
|
174
|
-
getEditorFeatureFlags = _this$props3.getEditorFeatureFlags;
|
|
173
|
+
editorAnalyticsAPI = _this$props3.editorAnalyticsAPI;
|
|
175
174
|
if (typeof insertRowButtonIndex !== 'undefined') {
|
|
176
175
|
event.preventDefault();
|
|
177
176
|
var state = editorView.state,
|
|
178
177
|
dispatch = editorView.dispatch;
|
|
179
|
-
|
|
180
|
-
insertRowWithAnalytics(editorAnalyticsAPI, featureFlags && featureFlags.tableDuplicateCellColouring)(INPUT_METHOD.BUTTON, {
|
|
178
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.BUTTON, {
|
|
181
179
|
index: insertRowButtonIndex,
|
|
182
180
|
moveCursorToInsertedRow: true
|
|
183
181
|
})(state, dispatch);
|
|
@@ -196,14 +194,12 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
196
194
|
if (typeof insertColumnButtonIndex !== 'undefined') {
|
|
197
195
|
event.preventDefault();
|
|
198
196
|
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
199
|
-
_ref$tableDuplicateCe = _ref.tableDuplicateCellColouring,
|
|
200
|
-
tableDuplicateCellColouring = _ref$tableDuplicateCe === void 0 ? false : _ref$tableDuplicateCe,
|
|
201
197
|
_ref$tableWithFixedCo = _ref.tableWithFixedColumnWidthsOption,
|
|
202
198
|
tableWithFixedColumnWidthsOption = _ref$tableWithFixedCo === void 0 ? false : _ref$tableWithFixedCo;
|
|
203
199
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
204
200
|
var state = editorView.state,
|
|
205
201
|
dispatch = editorView.dispatch;
|
|
206
|
-
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
202
|
+
insertColumnWithAnalytics(this.props.api, editorAnalyticsAPI, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
|
|
207
203
|
}
|
|
208
204
|
}
|
|
209
205
|
}]);
|
|
@@ -78,11 +78,10 @@ var defaultSelectionRect = {
|
|
|
78
78
|
export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, api, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired) {
|
|
79
79
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
80
80
|
var isTableScalingEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var isCommentEditor = arguments.length > 16 && arguments[16] !== undefined ? arguments[16] : false;
|
|
81
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
82
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
|
|
83
|
+
var ariaNotifyPlugin = arguments.length > 14 ? arguments[14] : undefined;
|
|
84
|
+
var isCommentEditor = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
|
|
86
85
|
var selection = editorView.state.selection;
|
|
87
86
|
var _getTablePluginState = getTablePluginState(editorView.state),
|
|
88
87
|
getIntl = _getTablePluginState.getIntl;
|
|
@@ -193,12 +192,12 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
193
192
|
iconFallback: iconFallback,
|
|
194
193
|
onClick: function onClick(state, dispatch) {
|
|
195
194
|
if (direction === 'row') {
|
|
196
|
-
insertRowWithAnalytics(editorAnalyticsAPI
|
|
195
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
197
196
|
index: (index !== null && index !== void 0 ? index : 0) + offset,
|
|
198
197
|
moveCursorToInsertedRow: true
|
|
199
198
|
})(state, dispatch);
|
|
200
199
|
} else {
|
|
201
|
-
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled,
|
|
200
|
+
insertColumnWithAnalytics(api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.TABLE_CONTEXT_MENU, (index !== null && index !== void 0 ? index : 0) + offset)(state, dispatch, editorView);
|
|
202
201
|
}
|
|
203
202
|
return true;
|
|
204
203
|
},
|
|
@@ -4,10 +4,10 @@ import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { PluginInjectionAPI } from '../types';
|
|
7
|
-
export declare function addColumnAt(api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean,
|
|
8
|
-
export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean,
|
|
9
|
-
export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean,
|
|
10
|
-
export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean,
|
|
11
|
-
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean
|
|
7
|
+
export declare function addColumnAt(api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
8
|
+
export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
|
|
9
|
+
export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
|
|
10
|
+
export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (column: number) => Command;
|
|
11
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
12
12
|
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
|
|
13
13
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|