@atlaskit/editor-plugin-table 7.7.3 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/commands/display-mode.js +23 -0
- package/dist/cjs/commands/index.js +8 -1
- package/dist/cjs/nodeviews/table.js +2 -1
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +19 -5
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +5 -0
- package/dist/cjs/toolbar.js +43 -12
- package/dist/cjs/ui/icons/DisplayModeIcon.js +46 -0
- package/dist/cjs/ui/icons/index.js +7 -0
- package/dist/es2019/commands/display-mode.js +17 -0
- package/dist/es2019/commands/index.js +2 -1
- package/dist/es2019/nodeviews/table.js +2 -1
- package/dist/es2019/plugin.js +4 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +19 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +5 -0
- package/dist/es2019/toolbar.js +41 -12
- package/dist/es2019/ui/icons/DisplayModeIcon.js +39 -0
- package/dist/es2019/ui/icons/index.js +1 -0
- package/dist/esm/commands/display-mode.js +16 -0
- package/dist/esm/commands/index.js +2 -1
- package/dist/esm/nodeviews/table.js +2 -1
- package/dist/esm/plugin.js +4 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +19 -5
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +5 -0
- package/dist/esm/toolbar.js +44 -13
- package/dist/esm/ui/icons/DisplayModeIcon.js +39 -0
- package/dist/esm/ui/icons/index.js +1 -0
- package/dist/types/commands/display-mode.d.ts +2 -0
- package/dist/types/commands/index.d.ts +1 -0
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +3 -3
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -2
- package/dist/types/toolbar.d.ts +2 -1
- package/dist/types/ui/icons/DisplayModeIcon.d.ts +4 -0
- package/dist/types/ui/icons/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/display-mode.d.ts +2 -0
- package/dist/types-ts4.5/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -2
- package/dist/types-ts4.5/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/ui/icons/DisplayModeIcon.d.ts +4 -0
- package/dist/types-ts4.5/ui/icons/index.d.ts +1 -0
- package/package.json +16 -13
- package/src/commands/display-mode.ts +19 -0
- package/src/commands/index.ts +1 -0
- package/src/commands/toggle.ts +1 -1
- package/src/commands-with-analytics.ts +3 -2
- package/src/nodeviews/table.tsx +1 -0
- package/src/plugin.tsx +15 -2
- package/src/pm-plugins/table-resizing/utils/misc.ts +3 -3
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +35 -7
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +6 -5
- package/src/toolbar.tsx +56 -22
- package/src/transforms/fix-tables.ts +1 -2
- package/src/types.ts +5 -0
- package/src/ui/icons/DisplayModeIcon.tsx +41 -0
- package/src/ui/icons/index.ts +1 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Icon from '@atlaskit/icon';
|
|
4
|
+
export const DisplayModeGlyth = props => {
|
|
5
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
6
|
+
width: "24",
|
|
7
|
+
height: "24",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
11
|
+
}, props), /*#__PURE__*/React.createElement("rect", {
|
|
12
|
+
x: "4",
|
|
13
|
+
y: "5",
|
|
14
|
+
width: "4",
|
|
15
|
+
height: "14",
|
|
16
|
+
rx: "1",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
fillRule: "evenodd",
|
|
20
|
+
clipRule: "evenodd",
|
|
21
|
+
d: "M11 5C10.4477 5 10 5.44772 10 6V9.10102C11.0503 8.02921 12.4424 7.29368 14 7.07089V6C14 5.44772 13.5523 5 13 5H11Z",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
24
|
+
fillRule: "evenodd",
|
|
25
|
+
clipRule: "evenodd",
|
|
26
|
+
d: "M17 5C16.4477 5 16 5.44772 16 6V7.07089C17.5576 7.29368 18.9497 8.02921 20 9.10102V6C20 5.44772 19.5523 5 19 5H17Z",
|
|
27
|
+
fill: "currentColor"
|
|
28
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
fillRule: "evenodd",
|
|
30
|
+
clipRule: "evenodd",
|
|
31
|
+
d: "M21 14C21 17.3137 18.3137 20 15 20C11.6863 20 9 17.3137 9 14C9 10.6863 11.6863 8 15 8C18.3137 8 21 10.6863 21 14ZM12 15C12 14.4477 12.4477 14 13 14V12C13 10.8954 13.8954 10 15 10C16.1046 10 17 10.8954 17 12V14C17.5523 14 18 14.4477 18 15V17C18 17.5523 17.5523 18 17 18H13C12.4477 18 12 17.5523 12 17V15ZM16 14V12C16 11.4477 15.5523 11 15 11C14.4477 11 14 11.4477 14 12V14H16Z",
|
|
32
|
+
fill: "currentColor"
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
export const DisplayModeIcon = props => {
|
|
36
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({
|
|
37
|
+
glyph: DisplayModeGlyth
|
|
38
|
+
}, props));
|
|
39
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
+
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
4
5
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
5
6
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
6
7
|
export { SplitCellIcon } from './SplitCellIcon';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
export var setTableDisplayMode = function setTableDisplayMode(_ref) {
|
|
6
|
+
var tr = _ref.tr;
|
|
7
|
+
var table = findTable(tr.selection);
|
|
8
|
+
if (!table) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
var displayMode = table.node.attrs.displayMode;
|
|
12
|
+
tr.setNodeMarkup(table.pos, tr.doc.type.schema.nodes.table, _objectSpread(_objectSpread({}, table.node.attrs), {}, {
|
|
13
|
+
displayMode: !displayMode || displayMode === 'default' ? 'fixed' : 'default'
|
|
14
|
+
}));
|
|
15
|
+
return tr.setMeta('scrollIntoView', false);
|
|
16
|
+
};
|
|
@@ -5,4 +5,5 @@ export { clearMultipleCells } from './clear';
|
|
|
5
5
|
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest } from './misc';
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
|
-
export { removeDescendantNodes } from './referentiality';
|
|
8
|
+
export { removeDescendantNodes } from './referentiality';
|
|
9
|
+
export { setTableDisplayMode } from './display-mode';
|
|
@@ -34,7 +34,8 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
34
34
|
'data-layout': node.attrs.layout,
|
|
35
35
|
'data-autosize': node.attrs.__autoSize,
|
|
36
36
|
'data-table-local-id': node.attrs.localId || '',
|
|
37
|
-
'data-table-width': node.attrs.width
|
|
37
|
+
'data-table-width': node.attrs.width,
|
|
38
|
+
'data-table-display-mode': node.attrs.displayMode
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
var getInlineWidth = function getInlineWidth(node, options, state, pos) {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
|
|
2
|
+
import { table, tableCell, tableHeader, tableRow, tableStage0 } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
5
5
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
@@ -109,9 +109,10 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
109
109
|
insertTableWithSize: insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
110
110
|
},
|
|
111
111
|
nodes: function nodes() {
|
|
112
|
+
var tableNode = options !== null && options !== void 0 && options.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') ? tableStage0 : table;
|
|
112
113
|
return [{
|
|
113
114
|
name: 'table',
|
|
114
|
-
node:
|
|
115
|
+
node: tableNode
|
|
115
116
|
}, {
|
|
116
117
|
name: 'tableHeader',
|
|
117
118
|
node: tableHeader
|
|
@@ -421,7 +422,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
421
422
|
},
|
|
422
423
|
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
|
|
423
424
|
return editorViewRef.current;
|
|
424
|
-
})(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
425
|
+
}, options)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
425
426
|
}
|
|
426
427
|
};
|
|
427
428
|
};
|
|
@@ -10,8 +10,24 @@ import { growColumn, shrinkColumn, updateAffectedColumn } from './resize-logic';
|
|
|
10
10
|
import { updateColgroup } from './resize-state';
|
|
11
11
|
export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
|
|
12
12
|
var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
13
|
+
// If table resize to show overflowed content, we need to re calculate the resize amount because now offset = amount amount instead of amount * 2
|
|
13
14
|
var scalePercent = 1;
|
|
14
|
-
var resizeAmount
|
|
15
|
+
var resizeAmount;
|
|
16
|
+
if (getBooleanFF('platform.editor.table.colum-resizing-improvements')) {
|
|
17
|
+
var _tableRef$closest;
|
|
18
|
+
// when table initially not overflow, but enter overflow, we need to calculate the resize amount by two part, before and after overflow, before overflow should be double, after should not be double.
|
|
19
|
+
var tableWidth = tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientWidth;
|
|
20
|
+
var tableContainerWidth = (_tableRef$closest = tableRef.closest('.resizer-item')) === null || _tableRef$closest === void 0 ? void 0 : _tableRef$closest.clientWidth;
|
|
21
|
+
var isOverflowed = !!(tableWidth && tableContainerWidth && tableWidth > tableContainerWidth);
|
|
22
|
+
resizeAmount = amount * 2;
|
|
23
|
+
if (isOverflowed) {
|
|
24
|
+
resizeAmount = amount < 0 ? amount : resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2;
|
|
25
|
+
} else {
|
|
26
|
+
resizeAmount = amount > 0 && tableContainerWidth ? resizeAmount - (tableNode.attrs.width + resizeAmount - tableContainerWidth) / 2 : resizeAmount;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
resizeAmount = amount;
|
|
30
|
+
}
|
|
15
31
|
|
|
16
32
|
// This need to be clean up if clean up the FF, we will not need this scale logic because now full table width changed/updated in resizeColumn
|
|
17
33
|
if (isTableScalingEnabled && !getBooleanFF('platform.editor.table.colum-resizing-improvements')) {
|
|
@@ -19,7 +35,7 @@ export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, t
|
|
|
19
35
|
resizeAmount = amount / scalePercent;
|
|
20
36
|
}
|
|
21
37
|
var newState = getBooleanFF('platform.editor.table.colum-resizing-improvements') ? updateAffectedColumn(resizeState, colIndex, resizeAmount) : resizeAmount > 0 ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
|
|
22
|
-
updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled);
|
|
38
|
+
getBooleanFF('platform.editor.table.colum-resizing-improvements') ? updateColgroup(newState, tableRef, tableNode, false) : updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled);
|
|
23
39
|
if (getBooleanFF('platform.editor.table.colum-resizing-improvements')) {
|
|
24
40
|
// use the difference in width from affected column to update overall table width
|
|
25
41
|
var delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
|
|
@@ -30,9 +46,7 @@ export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, t
|
|
|
30
46
|
}
|
|
31
47
|
return newState;
|
|
32
48
|
};
|
|
33
|
-
var updateTable = function updateTable(resizeAmount, tableRef, tableNode
|
|
34
|
-
// isTableScalingEnabled: boolean,
|
|
35
|
-
) {
|
|
49
|
+
var updateTable = function updateTable(resizeAmount, tableRef, tableNode) {
|
|
36
50
|
var currentWidth = getTableContainerElementWidth(tableNode);
|
|
37
51
|
var resizingContainer = tableRef.closest(".".concat(ClassName.TABLE_RESIZER_CONTAINER));
|
|
38
52
|
var resizingItem = resizingContainer === null || resizingContainer === void 0 ? void 0 : resizingContainer.querySelector('.resizer-item');
|
|
@@ -87,6 +87,11 @@ export var getResizeState = function getResizeState(_ref) {
|
|
|
87
87
|
export var updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled) {
|
|
88
88
|
var cols = tableRef.querySelectorAll('col');
|
|
89
89
|
var columnsCount = cols.length;
|
|
90
|
+
/**
|
|
91
|
+
updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
|
|
92
|
+
We don't want to scale the table when resizing columns, only when viewpoint shrinks the table.
|
|
93
|
+
We need to remove !isColumnResizing if we handled auto scale table when mouseUp event.
|
|
94
|
+
* */
|
|
90
95
|
if (isTableScalingEnabled && tableNode) {
|
|
91
96
|
var scalePercent = getTableScalingPercent(tableNode, tableRef);
|
|
92
97
|
state.cols.filter(function (column) {
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -5,6 +5,7 @@ import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
7
7
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
8
9
|
import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
9
10
|
import { closestElement, getChildrenInfo as _getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/editor-common/utils';
|
|
10
11
|
import { findParentDomRefOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -16,7 +17,7 @@ import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal
|
|
|
16
17
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
17
18
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
18
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
|
-
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
|
|
20
|
+
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes, setTableDisplayMode } from './commands';
|
|
20
21
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
|
|
21
22
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
22
23
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
@@ -24,6 +25,7 @@ import { getNewResizeStateFromSelectedColumns } from './pm-plugins/table-resizin
|
|
|
24
25
|
import { pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
25
26
|
import { canMergeCells } from './transforms';
|
|
26
27
|
import { TableCssClassName } from './types';
|
|
28
|
+
import { DisplayModeIcon } from './ui/icons';
|
|
27
29
|
import { FullWidthDisplay } from './ui/TableFullWidthLabel';
|
|
28
30
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from './utils';
|
|
29
31
|
export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
@@ -300,7 +302,7 @@ export var getClosestSelectionOrTableRect = function getClosestSelectionOrTableR
|
|
|
300
302
|
var tableRect = new Rect(0, 0, map.width, map.height);
|
|
301
303
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : tableRect;
|
|
302
304
|
};
|
|
303
|
-
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
305
|
+
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options) {
|
|
304
306
|
return function (config) {
|
|
305
307
|
return function (state, intl) {
|
|
306
308
|
var _tableObject$node$att, _tableObject$node;
|
|
@@ -314,7 +316,9 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
314
316
|
var isTableScalingEnabled = pluginState.isTableScalingEnabled,
|
|
315
317
|
widthToWidest = pluginState.widthToWidest;
|
|
316
318
|
var currentTableNodeLocalId = (_tableObject$node$att = tableObject === null || tableObject === void 0 || (_tableObject$node = tableObject.node) === null || _tableObject$node === void 0 || (_tableObject$node = _tableObject$node.attrs) === null || _tableObject$node === void 0 ? void 0 : _tableObject$node.localId) !== null && _tableObject$node$att !== void 0 ? _tableObject$node$att : '';
|
|
317
|
-
if (isTableScalingEnabled &&
|
|
319
|
+
if (isTableScalingEnabled &&
|
|
320
|
+
// TODO ED-21670: check if need options.isTableScalingEnabled
|
|
321
|
+
isWidthResizing && widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId]) {
|
|
318
322
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
319
323
|
stickyScrollbar = _getEditorFeatureFlag.stickyScrollbar;
|
|
320
324
|
var nodeType = state.schema.nodes.table;
|
|
@@ -362,11 +366,12 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
362
366
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
363
367
|
var _getPluginState2 = getPluginState(state),
|
|
364
368
|
_getPluginState2$isTa = _getPluginState2.isTableScalingEnabled,
|
|
365
|
-
_isTableScalingEnabled = _getPluginState2$isTa === void 0 ? false : _getPluginState2$isTa;
|
|
369
|
+
_isTableScalingEnabled = _getPluginState2$isTa === void 0 ? false : _getPluginState2$isTa; // TODO ED-21670: check if we need options.isTableScalingEnabled and not an acutual state of displayNode attr on the table
|
|
370
|
+
|
|
366
371
|
var cellItems;
|
|
367
372
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled);
|
|
368
373
|
var columnSettingsItems;
|
|
369
|
-
columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, _isTableScalingEnabled) : [];
|
|
374
|
+
columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options, _isTableScalingEnabled) : [];
|
|
370
375
|
var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
|
|
371
376
|
|
|
372
377
|
// Check if we need to show confirm dialog for delete button
|
|
@@ -493,32 +498,58 @@ export var getDistributeConfig = function getDistributeConfig(getEditorContainer
|
|
|
493
498
|
|
|
494
499
|
// this create the button group for distribute column and also fixed column width
|
|
495
500
|
// fixed column button should be in this function call in the future
|
|
496
|
-
var getColumnSettingItems = function getColumnSettingItems(editorState, editorView, _ref4, getEditorContainerWidth, editorAnalyticsAPI) {
|
|
501
|
+
var getColumnSettingItems = function getColumnSettingItems(editorState, editorView, _ref4, getEditorContainerWidth, editorAnalyticsAPI, options) {
|
|
497
502
|
var _newResizeStateWithAn2, _pluginState$pluginCo3;
|
|
498
503
|
var formatMessage = _ref4.formatMessage;
|
|
499
|
-
var isTableScalingEnabled = arguments.length >
|
|
504
|
+
var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
500
505
|
var pluginState = getPluginState(editorState);
|
|
501
506
|
var selectionOrTableRect = getClosestSelectionOrTableRect(editorState);
|
|
502
507
|
if (!selectionOrTableRect || !editorView) {
|
|
503
508
|
return [];
|
|
504
509
|
}
|
|
505
|
-
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled
|
|
510
|
+
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled // TODO ED-21670: Here should be actual state of tableNode's displayMode attr
|
|
511
|
+
);
|
|
506
512
|
var wouldChange = (_newResizeStateWithAn2 = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn2 !== void 0 ? _newResizeStateWithAn2 : false;
|
|
513
|
+
var items = [];
|
|
514
|
+
var isTableScalingLockBtnEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
515
|
+
if (isTableScalingLockBtnEnabled) {
|
|
516
|
+
var _pluginState$tableNod;
|
|
517
|
+
var areColumnWidthsLocked = (pluginState === null || pluginState === void 0 || (_pluginState$tableNod = pluginState.tableNode) === null || _pluginState$tableNod === void 0 ? void 0 : _pluginState$tableNod.attrs.displayMode) === 'fixed';
|
|
518
|
+
var title = areColumnWidthsLocked ? formatMessage(messages.unlockColumnWidths) : formatMessage(messages.lockColumnWidths);
|
|
519
|
+
items.push({
|
|
520
|
+
id: 'editor.table.lockColumns',
|
|
521
|
+
type: 'button',
|
|
522
|
+
title: title,
|
|
523
|
+
icon: function icon() {
|
|
524
|
+
return jsx(DisplayModeIcon, {
|
|
525
|
+
size: "medium",
|
|
526
|
+
label: title
|
|
527
|
+
});
|
|
528
|
+
},
|
|
529
|
+
onClick: editorCommandToPMCommand(setTableDisplayMode),
|
|
530
|
+
selected: areColumnWidthsLocked,
|
|
531
|
+
testId: 'table-lock-column-widths-btn'
|
|
532
|
+
});
|
|
533
|
+
}
|
|
507
534
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns && pluginState.isDragAndDropEnabled) {
|
|
508
|
-
|
|
535
|
+
items.push({
|
|
509
536
|
id: 'editor.table.distributeColumns',
|
|
510
537
|
type: 'button',
|
|
511
538
|
title: formatMessage(messages.distributeColumns),
|
|
512
539
|
icon: DistributeColumnIcon,
|
|
513
540
|
onClick: function onClick(state, dispatch, view) {
|
|
514
|
-
return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled
|
|
541
|
+
return getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled // TODO ED-21670: Maybe here too we an actual state of tableNode's displayMode attr
|
|
542
|
+
)(state, dispatch, view);
|
|
515
543
|
},
|
|
516
544
|
disabled: !wouldChange
|
|
517
|
-
}
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
if (items.length !== 0) {
|
|
548
|
+
items.push({
|
|
518
549
|
type: 'separator'
|
|
519
|
-
}
|
|
550
|
+
});
|
|
520
551
|
}
|
|
521
|
-
return
|
|
552
|
+
return items;
|
|
522
553
|
};
|
|
523
554
|
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI) {
|
|
524
555
|
var _node$attrs;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Icon from '@atlaskit/icon';
|
|
4
|
+
export var DisplayModeGlyth = function DisplayModeGlyth(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
6
|
+
width: "24",
|
|
7
|
+
height: "24",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
11
|
+
}, props), /*#__PURE__*/React.createElement("rect", {
|
|
12
|
+
x: "4",
|
|
13
|
+
y: "5",
|
|
14
|
+
width: "4",
|
|
15
|
+
height: "14",
|
|
16
|
+
rx: "1",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
fillRule: "evenodd",
|
|
20
|
+
clipRule: "evenodd",
|
|
21
|
+
d: "M11 5C10.4477 5 10 5.44772 10 6V9.10102C11.0503 8.02921 12.4424 7.29368 14 7.07089V6C14 5.44772 13.5523 5 13 5H11Z",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
24
|
+
fillRule: "evenodd",
|
|
25
|
+
clipRule: "evenodd",
|
|
26
|
+
d: "M17 5C16.4477 5 16 5.44772 16 6V7.07089C17.5576 7.29368 18.9497 8.02921 20 9.10102V6C20 5.44772 19.5523 5 19 5H17Z",
|
|
27
|
+
fill: "currentColor"
|
|
28
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
fillRule: "evenodd",
|
|
30
|
+
clipRule: "evenodd",
|
|
31
|
+
d: "M21 14C21 17.3137 18.3137 20 15 20C11.6863 20 9 17.3137 9 14C9 10.6863 11.6863 8 15 8C18.3137 8 21 10.6863 21 14ZM12 15C12 14.4477 12.4477 14 13 14V12C13 10.8954 13.8954 10 15 10C16.1046 10 17 10.8954 17 12V14C17.5523 14 18 14.4477 18 15V17C18 17.5523 17.5523 18 17 18H13C12.4477 18 12 17.5523 12 17V15ZM16 14V12C16 11.4477 15.5523 11 15 11C14.4477 11 14 11.4477 14 12V14H16Z",
|
|
32
|
+
fill: "currentColor"
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
export var DisplayModeIcon = function DisplayModeIcon(props) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({
|
|
37
|
+
glyph: DisplayModeGlyth
|
|
38
|
+
}, props));
|
|
39
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
+
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
4
5
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
5
6
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
6
7
|
export { SplitCellIcon } from './SplitCellIcon';
|
|
@@ -6,3 +6,4 @@ export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOr
|
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
8
|
export { removeDescendantNodes } from './referentiality';
|
|
9
|
+
export { setTableDisplayMode } from './display-mode';
|
|
@@ -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) => "default" | "wide" | "full-width";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { CellAttributes
|
|
1
|
+
import type { CellAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { TableOptions } from '../../../nodeviews/types';
|
|
7
|
-
export declare function getLayoutSize(tableLayout:
|
|
7
|
+
export declare function getLayoutSize(tableLayout: 'default' | 'wide' | 'full-width', containerWidth: number | undefined, options: TableOptions): number;
|
|
8
8
|
export declare function getDefaultLayoutMaxWidth(containerWidth?: number): number;
|
|
9
9
|
export declare function pointsAtCell($pos: ResolvedPos): false | PMNode | null;
|
|
10
10
|
export declare function currentColWidth(view: EditorView, cellPos: number, { colspan, colwidth }: CellAttributes): number;
|
|
@@ -13,7 +13,7 @@ interface getTableMaxWidthProps {
|
|
|
13
13
|
table: PMNode;
|
|
14
14
|
tableStart: number;
|
|
15
15
|
state: EditorState;
|
|
16
|
-
layout:
|
|
16
|
+
layout: 'default' | 'wide' | 'full-width';
|
|
17
17
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
18
18
|
}
|
|
19
19
|
export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
2
1
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -23,7 +22,7 @@ export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeS
|
|
|
23
22
|
export declare const evenSelectedColumnsWidths: (resizeState: ResizeState, rect: Rect) => ResizeState;
|
|
24
23
|
export declare const bulkColumnsResize: (resizeState: ResizeState, columnsIndexes: number[], sourceColumnIndex: number) => ResizeState;
|
|
25
24
|
export declare const areColumnsEven: (resizeState: ResizeState) => boolean;
|
|
26
|
-
export declare const normaliseTableLayout: (input: string | undefined | null) =>
|
|
25
|
+
export declare const normaliseTableLayout: (input: string | undefined | null) => "default" | "wide" | "full-width";
|
|
27
26
|
export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
|
|
28
27
|
node: Node;
|
|
29
28
|
offset: number;
|
package/dist/types/toolbar.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import type { Command, FloatingToolbarDropdown, FloatingToolbarHandler, Floating
|
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
|
+
import type { TablePluginOptions } from './plugin';
|
|
6
7
|
import type { PluginConfig, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
|
|
7
8
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
8
9
|
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => FloatingToolbarDropdown<Command>;
|
|
9
10
|
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
10
11
|
export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
|
|
11
|
-
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
12
|
+
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
12
13
|
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => Command;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
+
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
4
5
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
5
6
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
6
7
|
export { SplitCellIcon } from './SplitCellIcon';
|
|
@@ -6,3 +6,4 @@ export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOr
|
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
8
|
export { removeDescendantNodes } from './referentiality';
|
|
9
|
+
export { setTableDisplayMode } from './display-mode';
|
|
@@ -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) => "default" | "wide" | "full-width";
|
|
8
8
|
export declare const toggleHeaderRow: Command;
|
|
9
9
|
export declare const toggleHeaderColumn: Command;
|
|
10
10
|
export declare const toggleNumberColumn: Command;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { CellAttributes
|
|
1
|
+
import type { CellAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { TableOptions } from '../../../nodeviews/types';
|
|
7
|
-
export declare function getLayoutSize(tableLayout:
|
|
7
|
+
export declare function getLayoutSize(tableLayout: 'default' | 'wide' | 'full-width', containerWidth: number | undefined, options: TableOptions): number;
|
|
8
8
|
export declare function getDefaultLayoutMaxWidth(containerWidth?: number): number;
|
|
9
9
|
export declare function pointsAtCell($pos: ResolvedPos): false | PMNode | null;
|
|
10
10
|
export declare function currentColWidth(view: EditorView, cellPos: number, { colspan, colwidth }: CellAttributes): number;
|
|
@@ -13,7 +13,7 @@ interface getTableMaxWidthProps {
|
|
|
13
13
|
table: PMNode;
|
|
14
14
|
tableStart: number;
|
|
15
15
|
state: EditorState;
|
|
16
|
-
layout:
|
|
16
|
+
layout: 'default' | 'wide' | 'full-width';
|
|
17
17
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
18
18
|
}
|
|
19
19
|
export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
2
1
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -23,7 +22,7 @@ export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeS
|
|
|
23
22
|
export declare const evenSelectedColumnsWidths: (resizeState: ResizeState, rect: Rect) => ResizeState;
|
|
24
23
|
export declare const bulkColumnsResize: (resizeState: ResizeState, columnsIndexes: number[], sourceColumnIndex: number) => ResizeState;
|
|
25
24
|
export declare const areColumnsEven: (resizeState: ResizeState) => boolean;
|
|
26
|
-
export declare const normaliseTableLayout: (input: string | undefined | null) =>
|
|
25
|
+
export declare const normaliseTableLayout: (input: string | undefined | null) => "default" | "wide" | "full-width";
|
|
27
26
|
export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
|
|
28
27
|
node: Node;
|
|
29
28
|
offset: number;
|
|
@@ -3,10 +3,11 @@ import type { Command, FloatingToolbarDropdown, FloatingToolbarHandler, Floating
|
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
|
+
import type { TablePluginOptions } from './plugin';
|
|
6
7
|
import type { PluginConfig, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
|
|
7
8
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
8
9
|
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => FloatingToolbarDropdown<Command>;
|
|
9
10
|
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
10
11
|
export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
|
|
11
|
-
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
12
|
+
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
12
13
|
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => Command;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
3
|
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
4
|
+
export { DisplayModeIcon } from './DisplayModeIcon';
|
|
4
5
|
export { MinimisedHandleIcon } from './MinimisedHandle';
|
|
5
6
|
export { MergeCellsIcon } from './MergeCellsIcon';
|
|
6
7
|
export { SplitCellIcon } from './SplitCellIcon';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"runReact18": false
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^35.9.
|
|
32
|
-
"@atlaskit/custom-steps": "^0.0
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
31
|
+
"@atlaskit/adf-schema": "^35.9.2",
|
|
32
|
+
"@atlaskit/custom-steps": "^0.1.0",
|
|
33
|
+
"@atlaskit/editor-common": "^78.31.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.3",
|
|
35
|
-
"@atlaskit/editor-plugin-accessibility-utils": "^1.
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
37
|
-
"@atlaskit/editor-plugin-content-insertion": "^1.
|
|
38
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^1.
|
|
39
|
-
"@atlaskit/editor-plugin-guideline": "^1.
|
|
40
|
-
"@atlaskit/editor-plugin-selection": "^1.
|
|
41
|
-
"@atlaskit/editor-plugin-width": "^1.
|
|
42
|
-
"@atlaskit/editor-prosemirror": "
|
|
35
|
+
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^1.1.0",
|
|
37
|
+
"@atlaskit/editor-plugin-content-insertion": "^1.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
|
|
39
|
+
"@atlaskit/editor-plugin-guideline": "^1.1.0",
|
|
40
|
+
"@atlaskit/editor-plugin-selection": "^1.2.0",
|
|
41
|
+
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
42
|
+
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
44
|
-
"@atlaskit/editor-tables": "^2.
|
|
44
|
+
"@atlaskit/editor-tables": "^2.7.0",
|
|
45
45
|
"@atlaskit/icon": "^22.1.0",
|
|
46
46
|
"@atlaskit/menu": "^2.1.5",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
@@ -136,6 +136,9 @@
|
|
|
136
136
|
"platform.editor.table.cmd-a-select-table": {
|
|
137
137
|
"type": "boolean"
|
|
138
138
|
},
|
|
139
|
+
"platform.editor.table.preserve-widths-with-lock-button": {
|
|
140
|
+
"type": "boolean"
|
|
141
|
+
},
|
|
139
142
|
"platform.editor.table.use-shared-state-hook": {
|
|
140
143
|
"type": "boolean"
|
|
141
144
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
3
|
+
|
|
4
|
+
export const setTableDisplayMode: EditorCommand = ({ tr }) => {
|
|
5
|
+
const table = findTable(tr.selection);
|
|
6
|
+
if (!table) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { displayMode } = table.node.attrs;
|
|
11
|
+
|
|
12
|
+
tr.setNodeMarkup(table.pos, tr.doc.type.schema.nodes.table, {
|
|
13
|
+
...table.node.attrs,
|
|
14
|
+
displayMode:
|
|
15
|
+
!displayMode || displayMode === 'default' ? 'fixed' : 'default',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return tr.setMeta('scrollIntoView', false);
|
|
19
|
+
};
|
package/src/commands/index.ts
CHANGED