@atlaskit/editor-plugin-table 7.31.1 → 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 +17 -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 +12 -19
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +8 -12
- package/dist/cjs/ui/FloatingDragMenu/index.js +3 -8
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -7
- package/dist/cjs/utils/drag-menu.js +7 -9
- 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 +3 -11
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +8 -10
- package/dist/es2019/ui/FloatingDragMenu/index.js +3 -6
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -6
- package/dist/es2019/utils/drag-menu.js +4 -4
- 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 +12 -19
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +8 -12
- package/dist/esm/ui/FloatingDragMenu/index.js +3 -8
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -7
- package/dist/esm/utils/drag-menu.js +7 -9
- 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 -2
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -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 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -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 +8 -15
- package/src/ui/FloatingDragMenu/DragMenu.tsx +5 -17
- package/src/ui/FloatingDragMenu/index.tsx +1 -7
- package/src/ui/FloatingDragMenu/styles.ts +4 -6
- package/src/ui/FloatingInsertButton/index.tsx +5 -10
- package/src/utils/drag-menu.ts +5 -11
|
@@ -19,14 +19,14 @@ function addColumnAtCustomStep(column) {
|
|
|
19
19
|
return tr;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
export function addColumnAt(api, isTableScalingEnabled = false,
|
|
22
|
+
export function addColumnAt(api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
23
23
|
return (column, allowAddColumnCustomStep = false, view) => {
|
|
24
24
|
return tr => {
|
|
25
25
|
let updatedTr = tr;
|
|
26
26
|
if (allowAddColumnCustomStep) {
|
|
27
27
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
28
28
|
} else {
|
|
29
|
-
updatedTr = addColumnAtPMUtils(column
|
|
29
|
+
updatedTr = addColumnAtPMUtils(column)(updatedTr);
|
|
30
30
|
}
|
|
31
31
|
const table = findTable(updatedTr.selection);
|
|
32
32
|
if (table) {
|
|
@@ -48,33 +48,33 @@ export function addColumnAt(api, isTableScalingEnabled = false, isCellBackground
|
|
|
48
48
|
|
|
49
49
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
50
50
|
// Command to add a column before the column with the selection.
|
|
51
|
-
export const addColumnBefore = (api, isTableScalingEnabled = false,
|
|
51
|
+
export const addColumnBefore = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
|
|
52
52
|
const table = findTable(state.selection);
|
|
53
53
|
if (!table) {
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
if (dispatch) {
|
|
57
57
|
let rect = selectedRect(state);
|
|
58
|
-
dispatch(addColumnAt(api, isTableScalingEnabled,
|
|
58
|
+
dispatch(addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
64
64
|
// Command to add a column after the column with the selection.
|
|
65
|
-
export const addColumnAfter = (api, isTableScalingEnabled,
|
|
65
|
+
export const addColumnAfter = (api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => (state, dispatch, view) => {
|
|
66
66
|
const table = findTable(state.selection);
|
|
67
67
|
if (!table) {
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
70
|
if (dispatch) {
|
|
71
71
|
let rect = selectedRect(state);
|
|
72
|
-
dispatch(addColumnAt(api, isTableScalingEnabled,
|
|
72
|
+
dispatch(addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
73
73
|
}
|
|
74
74
|
return true;
|
|
75
75
|
};
|
|
76
|
-
export const insertColumn = (api, isTableScalingEnabled = false,
|
|
77
|
-
let tr = addColumnAt(api, isTableScalingEnabled,
|
|
76
|
+
export const insertColumn = (api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => column => (state, dispatch, view) => {
|
|
77
|
+
let tr = addColumnAt(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
78
78
|
const table = findTable(tr.selection);
|
|
79
79
|
if (!table) {
|
|
80
80
|
return false;
|
|
@@ -86,7 +86,7 @@ export const insertColumn = (api, isTableScalingEnabled = false, isCellBackgroun
|
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
};
|
|
89
|
-
export const insertRow = (row, moveCursorToTheNewRow
|
|
89
|
+
export const insertRow = (row, moveCursorToTheNewRow) => (state, dispatch) => {
|
|
90
90
|
// Don't clone the header row
|
|
91
91
|
const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
92
92
|
const clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0;
|
|
@@ -96,7 +96,7 @@ export const insertRow = (row, moveCursorToTheNewRow, isCellBackgroundDuplicated
|
|
|
96
96
|
if (row === 0 && headerRowEnabled) {
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
|
-
const tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined
|
|
99
|
+
const tr = clonePreviousRow ? copyPreviousRow(state.schema)(row)(state.tr) : addRowAt(row, undefined)(state.tr);
|
|
100
100
|
const table = findTable(tr.selection);
|
|
101
101
|
if (!table) {
|
|
102
102
|
return false;
|
|
@@ -148,7 +148,7 @@ export const addRowAroundSelection = editorAnalyticsAPI => side => (state, dispa
|
|
|
148
148
|
moveCursorToInsertedRow: false
|
|
149
149
|
})(state, dispatch);
|
|
150
150
|
};
|
|
151
|
-
export const insertRowWithAnalytics =
|
|
151
|
+
export const insertRowWithAnalytics = editorAnalyticsAPI => (inputMethod, options) => withEditorAnalyticsAPI(state => {
|
|
152
152
|
const {
|
|
153
153
|
totalRowCount,
|
|
154
154
|
totalColumnCount
|
|
@@ -165,7 +165,7 @@ export const insertRowWithAnalytics = (editorAnalyticsAPI, isCellbackgroundDupli
|
|
|
165
165
|
},
|
|
166
166
|
eventType: EVENT_TYPE.TRACK
|
|
167
167
|
};
|
|
168
|
-
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow
|
|
168
|
+
})(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
|
|
169
169
|
export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) => (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
|
|
170
170
|
const {
|
|
171
171
|
table,
|
|
@@ -201,7 +201,7 @@ export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) =>
|
|
|
201
201
|
getIntl: getIntl,
|
|
202
202
|
api
|
|
203
203
|
}));
|
|
204
|
-
export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false,
|
|
204
|
+
export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
|
|
205
205
|
const {
|
|
206
206
|
totalRowCount,
|
|
207
207
|
totalColumnCount
|
|
@@ -218,7 +218,7 @@ export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalin
|
|
|
218
218
|
},
|
|
219
219
|
eventType: EVENT_TYPE.TRACK
|
|
220
220
|
};
|
|
221
|
-
})(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled,
|
|
221
|
+
})(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(position));
|
|
222
222
|
export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect, isHeaderRowRequired) => withEditorAnalyticsAPI(({
|
|
223
223
|
selection
|
|
224
224
|
}) => {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -57,7 +57,7 @@ const tablesPlugin = ({
|
|
|
57
57
|
config: options,
|
|
58
58
|
api
|
|
59
59
|
}) => {
|
|
60
|
-
var _api$analytics, _api$accessibilityUti, _options$getEditorFea,
|
|
60
|
+
var _api$analytics, _api$accessibilityUti, _options$getEditorFea, _api$analytics2;
|
|
61
61
|
const editorViewRef = {
|
|
62
62
|
current: null
|
|
63
63
|
};
|
|
@@ -72,7 +72,6 @@ const tablesPlugin = ({
|
|
|
72
72
|
const isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
73
73
|
const 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
|
|
74
74
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
75
|
-
const isCellBackgroundDuplicated = (options === null || options === void 0 ? void 0 : (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
|
|
76
75
|
return {
|
|
77
76
|
name: 'table',
|
|
78
77
|
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
@@ -258,7 +257,7 @@ const tablesPlugin = ({
|
|
|
258
257
|
isChromelessEditor = false,
|
|
259
258
|
tableResizingEnabled = false
|
|
260
259
|
} = options || {};
|
|
261
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl,
|
|
260
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
262
261
|
}
|
|
263
262
|
}, {
|
|
264
263
|
name: 'tableSelectionKeymap',
|
|
@@ -7,7 +7,7 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
7
7
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
8
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
9
9
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
|
-
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl,
|
|
10
|
+
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
11
11
|
var _pluginInjectionApi$a;
|
|
12
12
|
const list = {};
|
|
13
13
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
@@ -20,12 +20,12 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
20
20
|
// Add row/column shortcuts
|
|
21
21
|
bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
22
22
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
23
|
-
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(api, isTableScalingEnabled,
|
|
24
|
-
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(api, isTableScalingEnabled,
|
|
23
|
+
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
24
|
+
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
25
25
|
bindKeymapWithCommand(addRowBeforeVO.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
26
26
|
bindKeymapWithCommand(addRowAfterVO.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
27
|
-
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(api, isTableScalingEnabled,
|
|
28
|
-
bindKeymapWithCommand(addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled,
|
|
27
|
+
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
28
|
+
bindKeymapWithCommand(addColumnAfterVO.common, addColumnAfterCommand(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
29
29
|
if (dragAndDropEnabled) {
|
|
30
30
|
// Move row/column shortcuts
|
|
31
31
|
/**
|
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 [];
|
|
@@ -450,16 +450,10 @@ export class ContextualMenu extends Component {
|
|
|
450
450
|
});
|
|
451
451
|
_defineProperty(this, "createOriginalContextMenuItems", () => {
|
|
452
452
|
let items = [];
|
|
453
|
-
const {
|
|
454
|
-
getEditorFeatureFlags
|
|
455
|
-
} = this.props;
|
|
456
|
-
const {
|
|
457
|
-
tableSortColumnReorder = false
|
|
458
|
-
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
459
453
|
const sortColumnItems = this.createSortColumnItems();
|
|
460
454
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
461
455
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
462
|
-
|
|
456
|
+
sortColumnItems && items.push(...sortColumnItems);
|
|
463
457
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
464
458
|
items.push(this.createInsertColumnItem());
|
|
465
459
|
items.push(this.createInsertRowItem());
|
|
@@ -467,7 +461,6 @@ export class ContextualMenu extends Component {
|
|
|
467
461
|
items.push(this.createDeleteRowItem());
|
|
468
462
|
items.push(...this.createMergeSplitCellItems());
|
|
469
463
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
470
|
-
!tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
471
464
|
items.push(this.createClearCellsItem());
|
|
472
465
|
return [{
|
|
473
466
|
items
|
|
@@ -519,7 +512,6 @@ export class ContextualMenu extends Component {
|
|
|
519
512
|
isTableScalingEnabled = false
|
|
520
513
|
} = getPluginState(state);
|
|
521
514
|
const {
|
|
522
|
-
tableDuplicateCellColouring = false,
|
|
523
515
|
tableWithFixedColumnWidthsOption = false
|
|
524
516
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
525
517
|
// context menu opened by keyboard and any item except 'background' activated
|
|
@@ -569,11 +561,11 @@ export class ContextualMenu extends Component {
|
|
|
569
561
|
this.toggleOpen();
|
|
570
562
|
break;
|
|
571
563
|
case 'insert_column':
|
|
572
|
-
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);
|
|
573
565
|
this.toggleOpen();
|
|
574
566
|
break;
|
|
575
567
|
case 'insert_row':
|
|
576
|
-
insertRowWithAnalytics(editorAnalyticsAPI
|
|
568
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
577
569
|
index: selectionRect.bottom,
|
|
578
570
|
moveCursorToInsertedRow: true
|
|
579
571
|
})(state, dispatch);
|
|
@@ -92,18 +92,18 @@ const MapDragMenuOptionIdToMessage = {
|
|
|
92
92
|
plural: null
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
const getGroupedDragMenuConfig =
|
|
95
|
+
const getGroupedDragMenuConfig = () => {
|
|
96
96
|
let groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
|
|
97
97
|
const sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
98
|
-
|
|
98
|
+
groupedDragMenuConfig.unshift(sortColumnItems);
|
|
99
99
|
return groupedDragMenuConfig;
|
|
100
100
|
};
|
|
101
101
|
const elementBeforeIconStyles = xcss({
|
|
102
102
|
marginRight: 'space.negative.075',
|
|
103
103
|
display: 'flex'
|
|
104
104
|
});
|
|
105
|
-
const convertToDropdownItems = (dragMenuConfig, formatMessage,
|
|
106
|
-
const groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
105
|
+
const convertToDropdownItems = (dragMenuConfig, formatMessage, selectionRect) => {
|
|
106
|
+
const groupedDragMenuConfig = getGroupedDragMenuConfig();
|
|
107
107
|
let menuItemsArr = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
108
108
|
let menuCallback = {};
|
|
109
109
|
dragMenuConfig.forEach(item => {
|
|
@@ -196,10 +196,8 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
196
196
|
scrollableElement,
|
|
197
197
|
boundariesElement,
|
|
198
198
|
isTableScalingEnabled,
|
|
199
|
-
tableDuplicateCellColouring,
|
|
200
199
|
shouldUseIncreasedScalingPercent,
|
|
201
200
|
isTableFixedColumnWidthsOptionEnabled,
|
|
202
|
-
tableSortColumnReorder,
|
|
203
201
|
ariaNotifyPlugin,
|
|
204
202
|
isCommentEditor
|
|
205
203
|
}) => {
|
|
@@ -219,11 +217,11 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
219
217
|
const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
220
218
|
const hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
221
219
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
222
|
-
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);
|
|
223
221
|
const {
|
|
224
222
|
menuItems,
|
|
225
223
|
menuCallback
|
|
226
|
-
} = convertToDropdownItems(dragMenuConfig, formatMessage,
|
|
224
|
+
} = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect);
|
|
227
225
|
const handleSubMenuRef = ref => {
|
|
228
226
|
const parent = closestElement(editorView.dom, '.fabric-editor-popup-scroll-parent');
|
|
229
227
|
if (!(parent && ref)) {
|
|
@@ -274,7 +272,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
274
272
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
275
273
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
276
274
|
,
|
|
277
|
-
css: dragMenuBackgroundColorStyles(
|
|
275
|
+
css: dragMenuBackgroundColorStyles()
|
|
278
276
|
}, jsx("div", {
|
|
279
277
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
280
278
|
css: cellColourPreviewStyles(background)
|
|
@@ -477,7 +475,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
477
475
|
return null;
|
|
478
476
|
}
|
|
479
477
|
if (allowBackgroundColor) {
|
|
480
|
-
|
|
478
|
+
menuItems[1].items.unshift(createBackgroundColorMenuItem());
|
|
481
479
|
}
|
|
482
480
|
|
|
483
481
|
// If first row, add toggle for Header row, default is true
|
|
@@ -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,10 +35,8 @@ const FloatingDragMenu = ({
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
tableSortColumnReorder = false
|
|
40
|
-
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
38
|
+
tableWithFixedColumnWidthsOption = false
|
|
39
|
+
} = (_getEditorFeatureFlag = getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags()) !== null && _getEditorFeatureFlag !== void 0 ? _getEditorFeatureFlag : {};
|
|
41
40
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (tableWithFixedColumnWidthsOption || isCommentEditor);
|
|
42
41
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
43
42
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
@@ -73,10 +72,8 @@ const FloatingDragMenu = ({
|
|
|
73
72
|
boundariesElement: boundariesElement,
|
|
74
73
|
scrollableElement: scrollableElement,
|
|
75
74
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
76
|
-
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
77
75
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
78
76
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
79
|
-
tableSortColumnReorder: tableSortColumnReorder,
|
|
80
77
|
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
81
78
|
api: api,
|
|
82
79
|
isCommentEditor: isCommentEditor || false
|
|
@@ -12,14 +12,14 @@ export const cellColourPreviewStyles = selectedColor => css({
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
15
|
-
export const dragMenuBackgroundColorStyles = (
|
|
15
|
+
export const dragMenuBackgroundColorStyles = () => css`
|
|
16
16
|
.${ClassName.DRAG_SUBMENU} {
|
|
17
17
|
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
18
18
|
background: ${"var(--ds-surface-overlay, white)"};
|
|
19
19
|
box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
|
|
20
20
|
display: block;
|
|
21
21
|
position: absolute;
|
|
22
|
-
top: ${
|
|
22
|
+
top: ${TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
|
|
23
23
|
left: ${dragMenuDropdownWidth}px;
|
|
24
24
|
padding: ${"var(--ds-space-100, 8px)"};
|
|
25
25
|
|
|
@@ -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
|
},
|
|
@@ -256,6 +256,6 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
256
256
|
keymap: keymap && tooltip(keymap)
|
|
257
257
|
}))];
|
|
258
258
|
let allConfigs = [...restConfigs];
|
|
259
|
-
|
|
259
|
+
allConfigs.unshift(...sortConfigs);
|
|
260
260
|
return allConfigs.filter(Boolean);
|
|
261
261
|
};
|
|
@@ -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',
|