@atlaskit/editor-plugin-table 7.16.15 → 7.16.17
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 +29 -0
- package/dist/cjs/commands-with-analytics.js +66 -41
- package/dist/cjs/nodeviews/TableContainer.js +14 -12
- package/dist/cjs/nodeviews/TableResizer.js +12 -13
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/keymap.js +6 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
- package/dist/cjs/toolbar.js +23 -48
- package/dist/cjs/ui/TableFloatingControls/index.js +2 -2
- package/dist/cjs/ui/icons/index.js +0 -7
- package/dist/cjs/utils/snapping.js +2 -2
- package/dist/es2019/commands-with-analytics.js +29 -6
- package/dist/es2019/nodeviews/TableContainer.js +17 -13
- package/dist/es2019/nodeviews/TableResizer.js +11 -12
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/toolbar.js +22 -48
- package/dist/es2019/ui/TableFloatingControls/index.js +2 -2
- package/dist/es2019/ui/icons/index.js +0 -1
- package/dist/es2019/utils/snapping.js +3 -3
- package/dist/esm/commands-with-analytics.js +66 -41
- package/dist/esm/nodeviews/TableContainer.js +15 -13
- package/dist/esm/nodeviews/TableResizer.js +14 -15
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/keymap.js +7 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/esm/toolbar.js +24 -49
- package/dist/esm/ui/TableFloatingControls/index.js +2 -2
- package/dist/esm/ui/icons/index.js +0 -1
- package/dist/esm/utils/snapping.js +3 -3
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/commands-with-analytics.d.ts +7 -4
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/toolbar.d.ts +2 -3
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -0
- package/dist/types/ui/icons/index.d.ts +0 -1
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +7 -4
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +2 -3
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/icons/index.d.ts +0 -1
- package/package.json +10 -4
- package/src/commands-with-analytics.ts +80 -40
- package/src/nodeviews/TableContainer.tsx +24 -14
- package/src/nodeviews/TableResizer.tsx +17 -9
- package/src/plugin.tsx +5 -2
- package/src/pm-plugins/keymap.ts +30 -0
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/toolbar.tsx +29 -55
- package/src/ui/TableFloatingControls/index.tsx +17 -16
- package/src/ui/icons/index.ts +0 -1
- package/src/utils/snapping.ts +4 -4
- package/dist/cjs/ui/icons/DisplayModeIcon.js +0 -46
- package/dist/es2019/ui/icons/DisplayModeIcon.js +0 -39
- package/dist/esm/ui/icons/DisplayModeIcon.js +0 -39
- package/dist/types/ui/icons/DisplayModeIcon.d.ts +0 -4
- package/dist/types-ts4.5/ui/icons/DisplayModeIcon.d.ts +0 -4
- package/src/ui/icons/DisplayModeIcon.tsx +0 -41
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
6
|
-
import { akEditorDefaultLayoutWidth,
|
|
7
|
-
import {
|
|
7
|
+
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
|
|
8
9
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
9
10
|
import { TableCssClassName as ClassName } from '../types';
|
|
11
|
+
import { ALIGN_CENTER, ALIGN_START } from '../utils/alignment';
|
|
10
12
|
import { TableResizer } from './TableResizer';
|
|
11
13
|
export var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
12
14
|
var className = _ref.className,
|
|
@@ -40,25 +42,25 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
40
42
|
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
41
43
|
getPos = _ref2.getPos,
|
|
42
44
|
editorView = _ref2.editorView;
|
|
43
|
-
var alignment = node.attrs.layout;
|
|
45
|
+
var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
44
46
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table']),
|
|
45
47
|
tableState = _useSharedPluginState.tableState;
|
|
46
48
|
useEffect(function () {
|
|
47
49
|
if (tableState && editorView && getPos) {
|
|
48
50
|
var wasFullWidthModeEnabled = tableState.wasFullWidthModeEnabled,
|
|
49
51
|
isFullWidthModeEnabled = tableState.isFullWidthModeEnabled;
|
|
50
|
-
|
|
52
|
+
var state = editorView.state,
|
|
53
|
+
dispatch = editorView.dispatch;
|
|
54
|
+
if (wasFullWidthModeEnabled && isFullWidthModeEnabled !== undefined && !isFullWidthModeEnabled && alignment !== ALIGN_CENTER && node.attrs.width > akEditorDefaultLayoutWidth) {
|
|
55
|
+
var _pluginInjectionApi$a;
|
|
51
56
|
var pos = getPos && getPos();
|
|
52
57
|
if (typeof pos !== 'number') {
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
55
|
-
|
|
60
|
+
setTableAlignmentWithTableContentWithPosWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(ALIGN_CENTER, alignment, {
|
|
56
61
|
pos: pos,
|
|
57
62
|
node: node
|
|
58
|
-
})(
|
|
59
|
-
if (tr) {
|
|
60
|
-
editorView.dispatch(tr);
|
|
61
|
-
}
|
|
63
|
+
}, INPUT_METHOD.AUTO, CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED)(state, dispatch);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -171,8 +173,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
171
173
|
})) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
|
|
172
174
|
}, [pluginInjectionApi, editorView]);
|
|
173
175
|
var attachAnalyticsEvent = useCallback(function (payload) {
|
|
174
|
-
var _pluginInjectionApi$
|
|
175
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
176
|
+
var _pluginInjectionApi$a2;
|
|
177
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.attachAnalyticsEvent(payload);
|
|
176
178
|
}, [pluginInjectionApi]);
|
|
177
179
|
var displayGapCursor = useCallback(function (toggle) {
|
|
178
180
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
@@ -192,13 +194,13 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
192
194
|
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
193
195
|
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
194
196
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
195
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth -
|
|
197
|
+
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
196
198
|
} else {
|
|
197
199
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
198
200
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
199
201
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
200
202
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
201
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth -
|
|
203
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
202
204
|
}
|
|
203
205
|
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
204
206
|
if (!isResizing) {
|
|
@@ -5,7 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
|
-
import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
10
10
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -16,7 +16,8 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
16
16
|
import { akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
17
17
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
18
18
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
|
-
import {
|
|
19
|
+
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
|
|
20
|
+
import { updateWidthToWidest } from '../commands/misc';
|
|
20
21
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
21
22
|
import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
22
23
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
@@ -92,7 +93,7 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
|
|
|
92
93
|
});
|
|
93
94
|
};
|
|
94
95
|
export var TableResizer = function TableResizer(_ref) {
|
|
95
|
-
var _findTable, _editorView$state;
|
|
96
|
+
var _findTable, _editorView$state, _pluginInjectionApi$a2;
|
|
96
97
|
var children = _ref.children,
|
|
97
98
|
width = _ref.width,
|
|
98
99
|
maxWidth = _ref.maxWidth,
|
|
@@ -165,33 +166,31 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
165
166
|
if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
|
|
166
167
|
// We don't want to switch alignment in Full-width editor
|
|
167
168
|
isResizing.current) {
|
|
169
|
+
var _pluginInjectionApi$a;
|
|
168
170
|
var tableNodeWithPos = {
|
|
169
171
|
pos: pos,
|
|
170
172
|
node: node
|
|
171
173
|
};
|
|
172
|
-
|
|
173
|
-
if (_tr) {
|
|
174
|
-
dispatch(_tr);
|
|
175
|
-
}
|
|
174
|
+
setTableAlignmentWithTableContentWithPosWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(ALIGN_CENTER, ALIGN_START, tableNodeWithPos, INPUT_METHOD.AUTO, CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED)(state, dispatch);
|
|
176
175
|
return true;
|
|
177
176
|
}
|
|
178
177
|
return false;
|
|
179
|
-
}, [
|
|
178
|
+
}, [isTableAlignmentEnabled, lineLength, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions]);
|
|
180
179
|
useEffect(function () {
|
|
181
180
|
return function () {
|
|
182
181
|
// only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
|
|
183
182
|
// deleted this table
|
|
184
183
|
if (isResizing.current) {
|
|
185
184
|
var dispatch = editorView.dispatch,
|
|
186
|
-
|
|
185
|
+
_tr = editorView.state.tr;
|
|
187
186
|
displayGapCursor(true);
|
|
188
187
|
displayGuideline([]);
|
|
189
|
-
|
|
188
|
+
_tr.setMeta(tableWidthPluginKey, {
|
|
190
189
|
resizing: false,
|
|
191
190
|
tableLocalId: '',
|
|
192
191
|
tableRef: null
|
|
193
192
|
});
|
|
194
|
-
dispatch(
|
|
193
|
+
dispatch(_tr);
|
|
195
194
|
}
|
|
196
195
|
};
|
|
197
196
|
}, [editorView, displayGuideline, displayGapCursor]);
|
|
@@ -305,13 +304,13 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
305
304
|
dispatch(tr);
|
|
306
305
|
if (getBooleanFF('platform.editor.a11y-table-resizing_uapcv')) {
|
|
307
306
|
if (delta.width < 0) {
|
|
308
|
-
var _pluginInjectionApi$
|
|
309
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
307
|
+
var _pluginInjectionApi$a3;
|
|
308
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a3 === void 0 || _pluginInjectionApi$a3.actions.ariaNotify(formatMessage(messages.tableSizeDecreaseScreenReaderInformation, {
|
|
310
309
|
newWidth: newWidth
|
|
311
310
|
}));
|
|
312
311
|
} else if (delta.width > 0) {
|
|
313
|
-
var _pluginInjectionApi$
|
|
314
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
312
|
+
var _pluginInjectionApi$a4;
|
|
313
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a4 === void 0 || _pluginInjectionApi$a4.actions.ariaNotify(formatMessage(messages.tableSizeIncreaseScreenReaderInformation, {
|
|
315
314
|
newWidth: newWidth
|
|
316
315
|
}));
|
|
317
316
|
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -65,7 +65,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
68
|
-
var
|
|
68
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
69
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
69
70
|
return {
|
|
70
71
|
name: 'table',
|
|
71
72
|
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
@@ -464,7 +465,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
464
465
|
},
|
|
465
466
|
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
|
|
466
467
|
return editorViewRef.current;
|
|
467
|
-
}, options, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
468
|
+
}, options, isTableScalingWithFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
468
469
|
}
|
|
469
470
|
};
|
|
470
471
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -29,6 +29,12 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
29
29
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
30
30
|
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(isTableScalingEnabled, shouldUseIncreasedScalingPercent), list);
|
|
31
31
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(isTableScalingEnabled, shouldUseIncreasedScalingPercent), list);
|
|
32
|
+
if (getBooleanFF('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
|
|
33
|
+
bindKeymapWithCommand(addRowBeforeVO.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
34
|
+
bindKeymapWithCommand(addRowAfterVO.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
35
|
+
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(isTableScalingEnabled), list);
|
|
36
|
+
bindKeymapWithCommand(addColumnAfterVO.common, addColumnAfterCommand(isTableScalingEnabled), list);
|
|
37
|
+
}
|
|
32
38
|
if (dragAndDropEnabled) {
|
|
33
39
|
// Move row/column shortcuts
|
|
34
40
|
/**
|
|
@@ -2,7 +2,7 @@ import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atla
|
|
|
2
2
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { getBreakpoint, mapBreakpointToLayoutMaxWidth } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { calcTableColumnWidths, containsClassName } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { akEditorFullWidthLayoutWidth,
|
|
5
|
+
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { hasTableBeenResized } from './colgroup';
|
|
7
7
|
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ export function getLayoutSize(tableLayout) {
|
|
|
12
12
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
13
13
|
var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
|
|
14
14
|
if (isFullWidthModeEnabled) {
|
|
15
|
-
return containerWidth ? Math.min(containerWidth -
|
|
15
|
+
return containerWidth ? Math.min(containerWidth - akEditorGutterPaddingDynamic() * 2, akEditorFullWidthLayoutWidth) : akEditorFullWidthLayoutWidth;
|
|
16
16
|
}
|
|
17
17
|
var calculatedTableWidth = calcTableWidth(tableLayout, containerWidth, true);
|
|
18
18
|
if (calculatedTableWidth !== 'inherit') {
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
+
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
11
11
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
@@ -24,7 +24,7 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
24
24
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
25
25
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
26
26
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
|
|
27
|
-
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics,
|
|
27
|
+
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleFixedColumnWidthsOptionAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
|
|
28
28
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
29
29
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
30
30
|
import { getNewResizeStateFromSelectedColumns } from './pm-plugins/table-resizing/utils/resize-state';
|
|
@@ -32,13 +32,23 @@ import { pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
|
32
32
|
import { canMergeCells } from './transforms';
|
|
33
33
|
import { TableCssClassName } from './types';
|
|
34
34
|
import { FloatingAlignmentButtons } from './ui/FloatingAlignmentButtons/FloatingAlignmentButtons';
|
|
35
|
-
import { DisplayModeIcon } from './ui/icons';
|
|
36
35
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, isTableNested } from './utils';
|
|
37
36
|
import { normaliseAlignment } from './utils/alignment';
|
|
38
37
|
export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
39
38
|
var formatMessage = _ref.formatMessage;
|
|
39
|
+
var isTableScalingWithFixedColumnWidthsOptionShown = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
40
|
+
var areTableColumnWidthsFixed = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
40
41
|
var optionItem = getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'item-checkbox' : 'item';
|
|
41
42
|
var options = [{
|
|
43
|
+
id: 'editor.table.lockColumnWidths',
|
|
44
|
+
title: formatMessage(messages.lockColumnWidths),
|
|
45
|
+
onClick: toggleFixedColumnWidthsOptionAnalytics(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
|
|
46
|
+
selected: areTableColumnWidthsFixed,
|
|
47
|
+
hidden: !isTableScalingWithFixedColumnWidthsOptionShown,
|
|
48
|
+
domItemOptions: {
|
|
49
|
+
type: optionItem
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
42
52
|
id: 'editor.table.headerRow',
|
|
43
53
|
title: formatMessage(messages.headerRow),
|
|
44
54
|
onClick: toggleHeaderRowWithAnalytics(editorAnalyticsAPI),
|
|
@@ -86,7 +96,8 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
|
|
|
86
96
|
hidden: options.every(function (option) {
|
|
87
97
|
return option.hidden;
|
|
88
98
|
}),
|
|
89
|
-
options: options
|
|
99
|
+
options: options,
|
|
100
|
+
dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined
|
|
90
101
|
};
|
|
91
102
|
} else {
|
|
92
103
|
return {
|
|
@@ -97,7 +108,8 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
|
|
|
97
108
|
hidden: options.every(function (option) {
|
|
98
109
|
return option.hidden;
|
|
99
110
|
}),
|
|
100
|
-
options: options
|
|
111
|
+
options: options,
|
|
112
|
+
dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined
|
|
101
113
|
};
|
|
102
114
|
}
|
|
103
115
|
};
|
|
@@ -311,7 +323,8 @@ export var getClosestSelectionOrTableRect = function getClosestSelectionOrTableR
|
|
|
311
323
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : tableRect;
|
|
312
324
|
};
|
|
313
325
|
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options) {
|
|
314
|
-
var
|
|
326
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
327
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
315
328
|
return function (config) {
|
|
316
329
|
return function (state, intl) {
|
|
317
330
|
var tableObject = findTable(state.selection);
|
|
@@ -323,9 +336,11 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
323
336
|
var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
|
|
324
337
|
if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
|
|
325
338
|
var nodeType = state.schema.nodes.table;
|
|
326
|
-
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
327
|
-
var alignmentMenu;
|
|
328
339
|
var isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
340
|
+
var isTableScalingWithFixedColumnWidthsOptionShown = isTableScalingWithFixedColumnWidthsOptionEnabled && !isNested;
|
|
341
|
+
var areTableColumWidthsFixed = tableObject.node.attrs.displayMode === 'fixed';
|
|
342
|
+
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
343
|
+
var alignmentMenu;
|
|
329
344
|
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
|
|
330
345
|
var cellItems;
|
|
331
346
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, shouldUseIncreasedScalingPercent);
|
|
@@ -441,23 +456,6 @@ var getCellItems = function getCellItems(state, view, _ref3, getEditorContainerW
|
|
|
441
456
|
}
|
|
442
457
|
return [];
|
|
443
458
|
};
|
|
444
|
-
export var getLockBtnConfig = function getLockBtnConfig(editorAnalyticsAPI) {
|
|
445
|
-
return function (state, dispatch, editorView) {
|
|
446
|
-
var selectionOrTableRect = getClosestSelectionOrTableRect(state);
|
|
447
|
-
if (!editorView || !selectionOrTableRect) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
var tr = state.tr;
|
|
451
|
-
var table = findTable(tr.selection);
|
|
452
|
-
if (!table) {
|
|
453
|
-
return false;
|
|
454
|
-
} else {
|
|
455
|
-
var displayMode = table.node.attrs.displayMode;
|
|
456
|
-
toggleTableLockWithAnalytics(editorAnalyticsAPI)(displayMode, INPUT_METHOD.FLOATING_TB)(state, dispatch);
|
|
457
|
-
return true;
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
};
|
|
461
459
|
export var getDistributeConfig = function getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
462
460
|
var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
463
461
|
return function (state, dispatch, editorView) {
|
|
@@ -488,29 +486,6 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
488
486
|
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled);
|
|
489
487
|
var wouldChange = (_newResizeStateWithAn2 = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn2 !== void 0 ? _newResizeStateWithAn2 : false;
|
|
490
488
|
var items = [];
|
|
491
|
-
var isNested = pluginState.tablePos && isTableNested(editorState, pluginState.tablePos);
|
|
492
|
-
var isTableScalingLockBtnEnabled = !isNested && isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
493
|
-
if (isTableScalingLockBtnEnabled) {
|
|
494
|
-
var _pluginState$tableNod;
|
|
495
|
-
var areColumnWidthsLocked = (pluginState === null || pluginState === void 0 || (_pluginState$tableNod = pluginState.tableNode) === null || _pluginState$tableNod === void 0 ? void 0 : _pluginState$tableNod.attrs.displayMode) === 'fixed';
|
|
496
|
-
var title = areColumnWidthsLocked ? formatMessage(messages.unlockColumnWidths) : formatMessage(messages.lockColumnWidths);
|
|
497
|
-
items.push({
|
|
498
|
-
id: 'editor.table.lockColumns',
|
|
499
|
-
type: 'button',
|
|
500
|
-
title: title,
|
|
501
|
-
icon: function icon() {
|
|
502
|
-
return jsx(DisplayModeIcon, {
|
|
503
|
-
size: "medium",
|
|
504
|
-
label: title
|
|
505
|
-
});
|
|
506
|
-
},
|
|
507
|
-
onClick: function onClick(state, dispatch, view) {
|
|
508
|
-
return getLockBtnConfig(editorAnalyticsAPI)(state, dispatch, view);
|
|
509
|
-
},
|
|
510
|
-
selected: areColumnWidthsLocked,
|
|
511
|
-
testId: 'table-lock-column-widths-btn'
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
489
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns && pluginState.isDragAndDropEnabled) {
|
|
515
490
|
items.push({
|
|
516
491
|
id: 'editor.table.distributeColumns',
|
|
@@ -623,7 +598,7 @@ export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editor
|
|
|
623
598
|
icon: icon,
|
|
624
599
|
title: formatMessage(layoutToMessages[value]),
|
|
625
600
|
selected: normaliseAlignment(currentLayout) === value,
|
|
626
|
-
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB)
|
|
601
|
+
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB, CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED)
|
|
627
602
|
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth) && {
|
|
628
603
|
disabled: value !== 'center'
|
|
629
604
|
});
|
|
@@ -88,7 +88,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
88
88
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
89
89
|
stickyTop: stickyTop,
|
|
90
90
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
91
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
91
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, !getBooleanFF('platform.editor.drag-and-drop_wmv9t') && (getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
92
92
|
editorView: editorView,
|
|
93
93
|
tableRef: tableRef,
|
|
94
94
|
isInDanger: isInDanger,
|
|
@@ -99,7 +99,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
99
99
|
tableRef: tableRef,
|
|
100
100
|
isInDanger: isInDanger,
|
|
101
101
|
isResizing: isResizing
|
|
102
|
-
}), /*#__PURE__*/React.createElement(DragControls, {
|
|
102
|
+
})), /*#__PURE__*/React.createElement(DragControls, {
|
|
103
103
|
tableRef: tableRef,
|
|
104
104
|
tableNode: tableNode,
|
|
105
105
|
hoveredCell: hoveredCell,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
-
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
5
4
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
6
5
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
7
6
|
export { SplitCellIcon } from './SplitCellIcon';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
|
|
3
|
-
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth,
|
|
3
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
var numberOfLanesInDefaultLayoutWidth = 12;
|
|
5
5
|
var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
|
|
6
6
|
return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
|
|
@@ -19,7 +19,7 @@ export var calculateDefaultTablePreserveSnappings = function calculateDefaultTab
|
|
|
19
19
|
innerGuidelines: false,
|
|
20
20
|
breakoutPoints: false
|
|
21
21
|
};
|
|
22
|
-
var dynamicFullWidthLine = editorContainerWith -
|
|
22
|
+
var dynamicFullWidthLine = editorContainerWith - akEditorGutterPaddingDynamic() * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - akEditorGutterPaddingDynamic() * 2;
|
|
23
23
|
var guides = [dynamicFullWidthLine - lengthOffset];
|
|
24
24
|
if (!exclude.breakoutPoints) {
|
|
25
25
|
guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
@@ -37,7 +37,7 @@ export var defaultTablePreserveSnappingWidths = function defaultTablePreserveSna
|
|
|
37
37
|
innerGuidelines: false,
|
|
38
38
|
breakoutPoints: false
|
|
39
39
|
};
|
|
40
|
-
return editorContainerWidth -
|
|
40
|
+
return editorContainerWidth - akEditorGutterPaddingDynamic() * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
* Table layout toggle logic
|
|
5
5
|
* default -> wide -> full-width -> default
|
|
6
6
|
*/
|
|
7
|
-
export declare const getNextLayout: (currentLayout: TableLayout) => "
|
|
7
|
+
export declare const getNextLayout: (currentLayout: TableLayout) => "wide" | "default" | "full-width";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next/src/types';
|
|
2
2
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
|
-
import { INPUT_METHOD
|
|
4
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/src/analytics/types/table-events';
|
|
6
7
|
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
|
+
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/dist/types/utils';
|
|
7
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
8
|
-
import type
|
|
10
|
+
import { type Rect } from '@atlaskit/editor-tables/table-map';
|
|
9
11
|
import type { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
|
|
10
12
|
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, RowInsertPosition } from './types';
|
|
11
13
|
export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
|
|
@@ -28,5 +30,6 @@ export declare const toggleTableLayoutWithAnalytics: (editorAnalyticsAPI: Editor
|
|
|
28
30
|
export declare const sortColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex: number, sortOrder: SortOrder) => Command;
|
|
29
31
|
export declare const distributeColumnsWidthsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, { resizeState, table, attributes }: ResizeStateWithAnalytics) => Command;
|
|
30
32
|
export declare const wrapTableInExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const setTableAlignmentWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: TableLayout, inputMethod: INPUT_METHOD.FLOATING_TB) => Command;
|
|
33
|
+
export declare const toggleFixedColumnWidthsOptionAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, inputMethod: INPUT_METHOD.FLOATING_TB) => Command;
|
|
34
|
+
export declare const setTableAlignmentWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: TableLayout, inputMethod: INPUT_METHOD.FLOATING_TB, reason: CHANGE_ALIGNMENT_REASON) => Command;
|
|
35
|
+
export declare const setTableAlignmentWithTableContentWithPosWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: AlignmentOptions | null, tableNodeWithPos: NodeWithPos, inputMethod: INPUT_METHOD.AUTO, reason: CHANGE_ALIGNMENT_REASON) => Command;
|
|
@@ -23,7 +23,7 @@ export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeS
|
|
|
23
23
|
export declare const evenSelectedColumnsWidths: (resizeState: ResizeState, rect: Rect) => ResizeState;
|
|
24
24
|
export declare const bulkColumnsResize: (resizeState: ResizeState, columnsIndexes: number[], sourceColumnIndex: number) => ResizeState;
|
|
25
25
|
export declare const areColumnsEven: (resizeState: ResizeState) => boolean;
|
|
26
|
-
export declare const normaliseTableLayout: (input: string | undefined | null) => "
|
|
26
|
+
export declare const normaliseTableLayout: (input: string | undefined | null) => "wide" | "default" | "full-width";
|
|
27
27
|
export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
|
|
28
28
|
node: Node;
|
|
29
29
|
offset: number;
|
package/dist/types/toolbar.d.ts
CHANGED
|
@@ -7,12 +7,11 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
7
7
|
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
import type { TablePluginOptions } from './plugin';
|
|
9
9
|
import type { AlignmentOptions, PluginConfig, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
|
|
10
|
-
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
10
|
+
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingWithFixedColumnWidthsOptionShown?: boolean, areTableColumnWidthsFixed?: boolean) => FloatingToolbarItem<Command>;
|
|
11
11
|
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => FloatingToolbarDropdown<Command>;
|
|
12
12
|
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
13
13
|
export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
|
|
14
|
-
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
15
|
-
export declare const getLockBtnConfig: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
14
|
+
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, isTableScalingWithFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
16
15
|
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => Command;
|
|
17
16
|
type AlignmentIcon = {
|
|
18
17
|
id?: string;
|
|
@@ -116,6 +116,7 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
116
116
|
to: number;
|
|
117
117
|
mark: import("prosemirror-model").Mark;
|
|
118
118
|
}) => boolean;
|
|
119
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
119
120
|
};
|
|
120
121
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
121
122
|
pluginConfiguration?: {
|
|
@@ -216,6 +217,7 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
216
217
|
to: number;
|
|
217
218
|
mark: import("prosemirror-model").Mark;
|
|
218
219
|
}) => boolean;
|
|
220
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
219
221
|
};
|
|
220
222
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
221
223
|
pluginConfiguration?: {
|
|
@@ -97,6 +97,7 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
97
97
|
to: number;
|
|
98
98
|
mark: import("prosemirror-model").Mark;
|
|
99
99
|
}) => boolean;
|
|
100
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
100
101
|
};
|
|
101
102
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
102
103
|
pluginConfiguration?: {
|
|
@@ -197,6 +198,7 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
197
198
|
to: number;
|
|
198
199
|
mark: import("prosemirror-model").Mark;
|
|
199
200
|
}) => boolean;
|
|
201
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
200
202
|
};
|
|
201
203
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
202
204
|
pluginConfiguration?: {
|
|
@@ -308,6 +310,7 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
308
310
|
to: number;
|
|
309
311
|
mark: import("prosemirror-model").Mark;
|
|
310
312
|
}) => boolean;
|
|
313
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
311
314
|
};
|
|
312
315
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
313
316
|
pluginConfiguration?: {
|
|
@@ -408,6 +411,7 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
|
|
|
408
411
|
to: number;
|
|
409
412
|
mark: import("prosemirror-model").Mark;
|
|
410
413
|
}) => boolean;
|
|
414
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
411
415
|
};
|
|
412
416
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
413
417
|
pluginConfiguration?: {
|
|
@@ -125,6 +125,7 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
125
125
|
to: number;
|
|
126
126
|
mark: import("prosemirror-model").Mark;
|
|
127
127
|
}) => boolean;
|
|
128
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
128
129
|
};
|
|
129
130
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
130
131
|
pluginConfiguration?: {
|
|
@@ -225,6 +226,7 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
|
|
|
225
226
|
to: number;
|
|
226
227
|
mark: import("prosemirror-model").Mark;
|
|
227
228
|
}) => boolean;
|
|
229
|
+
isRemoteReplaceDocumentTransaction: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
228
230
|
};
|
|
229
231
|
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
230
232
|
pluginConfiguration?: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
-
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
5
4
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
6
5
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
7
6
|
export { SplitCellIcon } from './SplitCellIcon';
|
|
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
* Table layout toggle logic
|
|
5
5
|
* default -> wide -> full-width -> default
|
|
6
6
|
*/
|
|
7
|
-
export declare const getNextLayout: (currentLayout: TableLayout) => "
|
|
7
|
+
export declare const getNextLayout: (currentLayout: TableLayout) => "wide" | "default" | "full-width";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next/src/types';
|
|
2
2
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
|
-
import { INPUT_METHOD
|
|
4
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/src/analytics/types/table-events';
|
|
6
7
|
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
|
+
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/dist/types/utils';
|
|
7
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
8
|
-
import type
|
|
10
|
+
import { type Rect } from '@atlaskit/editor-tables/table-map';
|
|
9
11
|
import type { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
|
|
10
12
|
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, RowInsertPosition } from './types';
|
|
11
13
|
export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
|
|
@@ -28,5 +30,6 @@ export declare const toggleTableLayoutWithAnalytics: (editorAnalyticsAPI: Editor
|
|
|
28
30
|
export declare const sortColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex: number, sortOrder: SortOrder) => Command;
|
|
29
31
|
export declare const distributeColumnsWidthsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, { resizeState, table, attributes }: ResizeStateWithAnalytics) => Command;
|
|
30
32
|
export declare const wrapTableInExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const setTableAlignmentWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: TableLayout, inputMethod: INPUT_METHOD.FLOATING_TB) => Command;
|
|
33
|
+
export declare const toggleFixedColumnWidthsOptionAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, inputMethod: INPUT_METHOD.FLOATING_TB) => Command;
|
|
34
|
+
export declare const setTableAlignmentWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: TableLayout, inputMethod: INPUT_METHOD.FLOATING_TB, reason: CHANGE_ALIGNMENT_REASON) => Command;
|
|
35
|
+
export declare const setTableAlignmentWithTableContentWithPosWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (newAlignment: AlignmentOptions, previousAlignment: AlignmentOptions | null, tableNodeWithPos: NodeWithPos, inputMethod: INPUT_METHOD.AUTO, reason: CHANGE_ALIGNMENT_REASON) => Command;
|