@atlaskit/editor-plugin-table 7.16.1 → 7.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/commands/insert.js +14 -2
- package/dist/cjs/nodeviews/TableComponent.js +4 -2
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +1 -0
- package/dist/cjs/nodeviews/TableContainer.js +73 -34
- package/dist/cjs/nodeviews/TableResizer.js +4 -1
- package/dist/cjs/nodeviews/table.js +7 -4
- package/dist/cjs/plugin.js +12 -3
- package/dist/cjs/pm-plugins/keymap.js +1 -13
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/es2019/commands/insert.js +15 -3
- package/dist/es2019/nodeviews/TableComponent.js +5 -2
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +1 -0
- package/dist/es2019/nodeviews/TableContainer.js +52 -11
- package/dist/es2019/nodeviews/TableResizer.js +4 -1
- package/dist/es2019/nodeviews/table.js +7 -4
- package/dist/es2019/plugin.js +11 -3
- package/dist/es2019/pm-plugins/keymap.js +4 -14
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/esm/commands/insert.js +15 -3
- package/dist/esm/nodeviews/TableComponent.js +4 -2
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +1 -0
- package/dist/esm/nodeviews/TableContainer.js +74 -35
- package/dist/esm/nodeviews/TableResizer.js +4 -1
- package/dist/esm/nodeviews/table.js +7 -4
- package/dist/esm/plugin.js +12 -3
- package/dist/esm/pm-plugins/keymap.js +4 -16
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/types/commands/insert.d.ts +3 -2
- package/dist/types/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/nodeviews/TableContainer.d.ts +7 -5
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/commands/insert.d.ts +3 -2
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +7 -5
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/package.json +5 -5
- package/src/commands/insert.ts +26 -18
- package/src/nodeviews/TableComponent.tsx +3 -0
- package/src/nodeviews/TableComponentWithSharedState.tsx +1 -0
- package/src/nodeviews/TableContainer.tsx +76 -13
- package/src/nodeviews/TableResizer.tsx +11 -1
- package/src/nodeviews/table.tsx +4 -1
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +18 -8
- package/src/pm-plugins/keymap.ts +4 -25
- package/src/pm-plugins/main.ts +1 -0
package/dist/es2019/plugin.js
CHANGED
|
@@ -101,7 +101,13 @@ const tablesPlugin = ({
|
|
|
101
101
|
node,
|
|
102
102
|
options: {
|
|
103
103
|
selectNodeInserted: false,
|
|
104
|
-
analyticsPayload
|
|
104
|
+
analyticsPayload: {
|
|
105
|
+
...analyticsPayload,
|
|
106
|
+
attributes: {
|
|
107
|
+
...analyticsPayload.attributes,
|
|
108
|
+
localId: node.attrs.localId
|
|
109
|
+
}
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
107
113
|
}
|
|
@@ -429,13 +435,15 @@ const tablesPlugin = ({
|
|
|
429
435
|
var _api$table;
|
|
430
436
|
// see comment on tablesPlugin.getSharedState on usage
|
|
431
437
|
const tableState = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
432
|
-
const
|
|
438
|
+
const tableNode = createTableWithWidth(options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled)(state.schema);
|
|
439
|
+
const tr = insert(tableNode);
|
|
433
440
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
434
441
|
action: ACTION.INSERTED,
|
|
435
442
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
436
443
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
437
444
|
attributes: {
|
|
438
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
445
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
446
|
+
localId: tableNode.attrs.localId
|
|
439
447
|
},
|
|
440
448
|
eventType: EVENT_TYPE.TRACK
|
|
441
449
|
})(tr);
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
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';
|
|
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';
|
|
6
|
-
import {
|
|
6
|
+
import { goToNextCell, moveCursorBackward } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
|
-
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
9
|
+
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
-
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
12
|
-
const createTableWithAnalytics = (isTableScalingEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) => withEditorAnalyticsAPI({
|
|
13
|
-
action: ACTION.INSERTED,
|
|
14
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
15
|
-
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
16
|
-
attributes: {
|
|
17
|
-
inputMethod: INPUT_METHOD.SHORTCUT
|
|
18
|
-
},
|
|
19
|
-
eventType: EVENT_TYPE.TRACK
|
|
20
|
-
})(editorAnalyticsAPI)(createTable(isTableScalingEnabled, isFullWidthModeEnabled));
|
|
21
11
|
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl) {
|
|
22
12
|
var _pluginInjectionApi$a;
|
|
23
13
|
const list = {};
|
|
24
14
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
25
15
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
26
16
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
27
|
-
bindKeymapWithCommand(toggleTable.common,
|
|
17
|
+
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
28
18
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
29
19
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
30
20
|
|
|
@@ -257,7 +257,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
257
257
|
return false;
|
|
258
258
|
},
|
|
259
259
|
nodeViews: {
|
|
260
|
-
table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi),
|
|
260
|
+
table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled),
|
|
261
261
|
tableRow: (node, view, getPos) => new TableRow(node, view, getPos, eventDispatcher),
|
|
262
262
|
tableCell: (node, view, getPos) => new TableCell(node, view, getPos, eventDispatcher),
|
|
263
263
|
tableHeader: (node, view, getPos) => new TableCell(node, view, getPos, eventDispatcher)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// #region Imports
|
|
2
2
|
import { AddColumnStep } from '@atlaskit/custom-steps';
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -134,11 +134,23 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBack
|
|
|
134
134
|
return true;
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
export var createTable = function createTable(isTableScalingEnabled, isFullWidthModeEnabled) {
|
|
137
|
+
export var createTable = function createTable(isTableScalingEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) {
|
|
138
138
|
return function (state, dispatch) {
|
|
139
139
|
var table = createTableWithWidth(isTableScalingEnabled, isFullWidthModeEnabled)(state.schema);
|
|
140
140
|
if (dispatch) {
|
|
141
|
-
|
|
141
|
+
var tr = safeInsert(table)(state.tr).scrollIntoView();
|
|
142
|
+
if (editorAnalyticsAPI) {
|
|
143
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
144
|
+
action: ACTION.INSERTED,
|
|
145
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
146
|
+
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
147
|
+
attributes: {
|
|
148
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
149
|
+
},
|
|
150
|
+
eventType: EVENT_TYPE.TRACK
|
|
151
|
+
})(tr);
|
|
152
|
+
}
|
|
153
|
+
dispatch(tr);
|
|
142
154
|
}
|
|
143
155
|
return true;
|
|
144
156
|
};
|
|
@@ -645,7 +645,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
645
645
|
pluginInjectionApi = _this$props11.pluginInjectionApi,
|
|
646
646
|
isDragAndDropEnabled = _this$props11.isDragAndDropEnabled,
|
|
647
647
|
getEditorFeatureFlags = _this$props11.getEditorFeatureFlags,
|
|
648
|
-
isTableScalingEnabled = _this$props11.isTableScalingEnabled
|
|
648
|
+
isTableScalingEnabled = _this$props11.isTableScalingEnabled,
|
|
649
|
+
isTableAlignmentEnabled = _this$props11.isTableAlignmentEnabled;
|
|
649
650
|
var _this$props12 = this.props,
|
|
650
651
|
isInDanger = _this$props12.isInDanger,
|
|
651
652
|
hoveredRows = _this$props12.hoveredRows,
|
|
@@ -754,7 +755,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
754
755
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
|
|
755
756
|
isResizing: isResizing,
|
|
756
757
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
757
|
-
isWholeTableInDanger: isWholeTableInDanger
|
|
758
|
+
isWholeTableInDanger: isWholeTableInDanger,
|
|
759
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
758
760
|
}, /*#__PURE__*/React.createElement("div", {
|
|
759
761
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
760
762
|
"data-testid": "sticky-sentinel-top"
|
|
@@ -62,6 +62,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
62
62
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
63
63
|
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
64
64
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
65
|
+
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
65
66
|
tableActive: tableActive,
|
|
66
67
|
ordering: ordering,
|
|
67
68
|
isResizing: isResizing,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { forwardRef, useCallback, useRef, useState } from 'react';
|
|
2
|
+
import React, { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
@@ -21,19 +21,57 @@ export var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
21
|
"data-testid": "table-container"
|
|
22
22
|
}, children);
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
var centerAlignStyle = {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center'
|
|
27
|
+
};
|
|
28
|
+
var leftAlignStyle = {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
justifyContent: 'flex-start'
|
|
31
|
+
};
|
|
32
|
+
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
33
|
+
var node = _ref2.node,
|
|
34
|
+
children = _ref2.children;
|
|
35
|
+
var alignment = node.attrs.layout;
|
|
36
|
+
var style = useMemo(function () {
|
|
37
|
+
return alignment === 'align-start' ? leftAlignStyle : centerAlignStyle;
|
|
38
|
+
}, [alignment]);
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
"data-testid": "table-alignment-container",
|
|
41
|
+
style: style
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
44
|
+
var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_ref3) {
|
|
45
|
+
var isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
46
|
+
node = _ref3.node,
|
|
47
|
+
children = _ref3.children;
|
|
48
|
+
if (!isTableAlignmentEnabled) {
|
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
"data-testid": "table-alignment-container",
|
|
51
|
+
style: {
|
|
52
|
+
display: 'flex',
|
|
53
|
+
justifyContent: 'center'
|
|
54
|
+
}
|
|
55
|
+
}, children);
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/React.createElement(AlignmentTableContainer, {
|
|
58
|
+
node: node
|
|
59
|
+
}, children);
|
|
60
|
+
};
|
|
61
|
+
export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
62
|
+
var children = _ref4.children,
|
|
63
|
+
className = _ref4.className,
|
|
64
|
+
node = _ref4.node,
|
|
65
|
+
containerWidth = _ref4.containerWidth,
|
|
66
|
+
editorView = _ref4.editorView,
|
|
67
|
+
getPos = _ref4.getPos,
|
|
68
|
+
tableRef = _ref4.tableRef,
|
|
69
|
+
isResizing = _ref4.isResizing,
|
|
70
|
+
pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
71
|
+
tableWrapperHeight = _ref4.tableWrapperHeight,
|
|
72
|
+
isWholeTableInDanger = _ref4.isWholeTableInDanger,
|
|
73
|
+
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
74
|
+
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled;
|
|
37
75
|
var containerRef = useRef(null);
|
|
38
76
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
39
77
|
var _useState = useState(false),
|
|
@@ -115,6 +153,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
115
153
|
displayGuideline: displayGuideline,
|
|
116
154
|
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
117
155
|
displayGapCursor: displayGapCursor,
|
|
156
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
118
157
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
119
158
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
120
159
|
pluginInjectionApi: pluginInjectionApi,
|
|
@@ -122,11 +161,9 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
122
161
|
onResizeStop: onResizeStop
|
|
123
162
|
};
|
|
124
163
|
var isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
125
|
-
return /*#__PURE__*/React.createElement(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
justifyContent: 'center'
|
|
129
|
-
}
|
|
164
|
+
return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
|
|
165
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
166
|
+
node: node
|
|
130
167
|
}, /*#__PURE__*/React.createElement("div", {
|
|
131
168
|
style: {
|
|
132
169
|
width: tableWidthRef.current,
|
|
@@ -146,21 +183,22 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
146
183
|
node: node
|
|
147
184
|
}, children))));
|
|
148
185
|
});
|
|
149
|
-
export var TableContainer = function TableContainer(
|
|
150
|
-
var children =
|
|
151
|
-
node =
|
|
152
|
-
className =
|
|
153
|
-
editorWidth =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
186
|
+
export var TableContainer = function TableContainer(_ref5) {
|
|
187
|
+
var children = _ref5.children,
|
|
188
|
+
node = _ref5.node,
|
|
189
|
+
className = _ref5.className,
|
|
190
|
+
editorWidth = _ref5.containerWidth.width,
|
|
191
|
+
editorView = _ref5.editorView,
|
|
192
|
+
getPos = _ref5.getPos,
|
|
193
|
+
tableRef = _ref5.tableRef,
|
|
194
|
+
isNested = _ref5.isNested,
|
|
195
|
+
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
196
|
+
isResizing = _ref5.isResizing,
|
|
197
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
198
|
+
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
199
|
+
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
200
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
201
|
+
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled;
|
|
164
202
|
if (isTableResizingEnabled && !isNested) {
|
|
165
203
|
return /*#__PURE__*/React.createElement(ResizableTableContainer, {
|
|
166
204
|
className: className,
|
|
@@ -173,7 +211,8 @@ export var TableContainer = function TableContainer(_ref3) {
|
|
|
173
211
|
isResizing: isResizing,
|
|
174
212
|
pluginInjectionApi: pluginInjectionApi,
|
|
175
213
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
176
|
-
isWholeTableInDanger: isWholeTableInDanger
|
|
214
|
+
isWholeTableInDanger: isWholeTableInDanger,
|
|
215
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
177
216
|
}, children);
|
|
178
217
|
}
|
|
179
218
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -19,6 +19,7 @@ import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
|
19
19
|
import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
20
20
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
21
21
|
import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
|
|
22
|
+
import { normaliseAlignment } from '../utils/alignment';
|
|
22
23
|
import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
|
|
23
24
|
import { defaultGuidelines, defaultGuidelinesForPreserveTable } from '../utils/guidelines';
|
|
24
25
|
import { defaultSnappingWidths, defaultTablePreserveSnappingWidths, findClosestSnap } from '../utils/snapping';
|
|
@@ -88,6 +89,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
88
89
|
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
89
90
|
displayGapCursor = _ref.displayGapCursor,
|
|
90
91
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
92
|
+
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
91
93
|
isWholeTableInDanger = _ref.isWholeTableInDanger,
|
|
92
94
|
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
93
95
|
var currentGap = useRef(0);
|
|
@@ -355,6 +357,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
355
357
|
(_updateTooltip$curren = updateTooltip.current) === null || _updateTooltip$curren === void 0 || _updateTooltip$curren.call(updateTooltip);
|
|
356
358
|
}
|
|
357
359
|
}, [width]);
|
|
360
|
+
var resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === 'center' ? 2 : 1;
|
|
358
361
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
|
|
359
362
|
ref: resizerRef,
|
|
360
363
|
enable: handles,
|
|
@@ -365,7 +368,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
365
368
|
handleResizeStart: handleResizeStart,
|
|
366
369
|
handleResize: scheduleResize,
|
|
367
370
|
handleResizeStop: handleResizeStop,
|
|
368
|
-
resizeRatio:
|
|
371
|
+
resizeRatio: resizeRatio,
|
|
369
372
|
minWidth: resizerMinWidth,
|
|
370
373
|
maxWidth: maxWidth,
|
|
371
374
|
snapGap: TABLE_SNAP_GAP,
|
|
@@ -169,7 +169,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
169
169
|
},
|
|
170
170
|
editorView: props.view,
|
|
171
171
|
render: function render(pluginStates) {
|
|
172
|
-
var _props$options;
|
|
172
|
+
var _props$options, _props$options2;
|
|
173
173
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
174
174
|
tableWidthPluginState = pluginStates.tableWidthPluginState,
|
|
175
175
|
pluginState = pluginStates.pluginState,
|
|
@@ -201,8 +201,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
201
201
|
isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
|
|
202
202
|
isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
|
|
203
203
|
isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
|
|
204
|
-
isTableScalingEnabled: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.isTableScalingEnabled // this.options?.isTableScalingEnabled
|
|
204
|
+
isTableScalingEnabled: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.isTableScalingEnabled // this.options?.isTableScalingEnabled same as TableOptions.isTableScalingEnabled same as pluginState.isTableScalingEnabled
|
|
205
205
|
,
|
|
206
|
+
isTableAlignmentEnabled: (_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.isTableAlignmentEnabled,
|
|
206
207
|
tableActive: tableActive,
|
|
207
208
|
ordering: pluginState.ordering,
|
|
208
209
|
isResizing: isResizing,
|
|
@@ -277,7 +278,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
277
278
|
return TableView;
|
|
278
279
|
}(ReactNodeView);
|
|
279
280
|
export { TableView as default };
|
|
280
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi) {
|
|
281
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled) {
|
|
281
282
|
var _getPluginState2 = getPluginState(view.state),
|
|
282
283
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
283
284
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
@@ -302,7 +303,9 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
302
303
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
303
304
|
isTableResizingEnabled: isTableResizingEnabled,
|
|
304
305
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
305
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
306
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
307
|
+
// same as options.isTableScalingEnabled
|
|
308
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
306
309
|
},
|
|
307
310
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
308
311
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
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; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
|
|
3
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
@@ -103,7 +106,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
103
106
|
node: node,
|
|
104
107
|
options: {
|
|
105
108
|
selectNodeInserted: false,
|
|
106
|
-
analyticsPayload: analyticsPayload
|
|
109
|
+
analyticsPayload: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
110
|
+
attributes: _objectSpread(_objectSpread({}, analyticsPayload.attributes), {}, {
|
|
111
|
+
localId: node.attrs.localId
|
|
112
|
+
})
|
|
113
|
+
})
|
|
107
114
|
}
|
|
108
115
|
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
109
116
|
};
|
|
@@ -428,13 +435,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
428
435
|
var _api$table;
|
|
429
436
|
// see comment on tablesPlugin.getSharedState on usage
|
|
430
437
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
431
|
-
var
|
|
438
|
+
var tableNode = createTableWithWidth(options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled)(state.schema);
|
|
439
|
+
var tr = insert(tableNode);
|
|
432
440
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
433
441
|
action: ACTION.INSERTED,
|
|
434
442
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
435
443
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
436
444
|
attributes: {
|
|
437
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
445
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
446
|
+
localId: tableNode.attrs.localId
|
|
438
447
|
},
|
|
439
448
|
eventType: EVENT_TYPE.TRACK
|
|
440
449
|
})(tr);
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
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';
|
|
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';
|
|
6
|
-
import {
|
|
6
|
+
import { goToNextCell, moveCursorBackward } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
|
-
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
9
|
+
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
-
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
12
|
-
var createTableWithAnalytics = function createTableWithAnalytics(isTableScalingEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) {
|
|
13
|
-
return withEditorAnalyticsAPI({
|
|
14
|
-
action: ACTION.INSERTED,
|
|
15
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
16
|
-
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
17
|
-
attributes: {
|
|
18
|
-
inputMethod: INPUT_METHOD.SHORTCUT
|
|
19
|
-
},
|
|
20
|
-
eventType: EVENT_TYPE.TRACK
|
|
21
|
-
})(editorAnalyticsAPI)(createTable(isTableScalingEnabled, isFullWidthModeEnabled));
|
|
22
|
-
};
|
|
23
11
|
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
24
12
|
var _pluginInjectionApi$a;
|
|
25
13
|
var isTableScalingEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -30,7 +18,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
30
18
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
31
19
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
32
20
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
33
|
-
bindKeymapWithCommand(toggleTable.common,
|
|
21
|
+
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
34
22
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
35
23
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
36
24
|
|
|
@@ -253,7 +253,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
253
253
|
},
|
|
254
254
|
nodeViews: {
|
|
255
255
|
table: function table(node, view, getPos) {
|
|
256
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi);
|
|
256
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled);
|
|
257
257
|
},
|
|
258
258
|
tableRow: function tableRow(node, view, getPos) {
|
|
259
259
|
return new TableRow(node, view, getPos, eventDispatcher);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -7,5 +8,5 @@ export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Comma
|
|
|
7
8
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
9
|
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
10
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
|
-
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
|
+
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null) => Command;
|
|
11
12
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -24,25 +24,27 @@ type ResizableTableContainerProps = {
|
|
|
24
24
|
tableRef: HTMLTableElement;
|
|
25
25
|
isResizing?: boolean;
|
|
26
26
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
|
-
isTableScalingEnabled?: boolean;
|
|
28
27
|
tableWrapperHeight?: number;
|
|
29
28
|
isWholeTableInDanger?: boolean;
|
|
29
|
+
isTableScalingEnabled?: boolean;
|
|
30
|
+
isTableAlignmentEnabled?: boolean;
|
|
30
31
|
};
|
|
31
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi,
|
|
32
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableAlignmentEnabled, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
32
33
|
type TableContainerProps = {
|
|
33
34
|
node: PMNode;
|
|
34
35
|
className: string;
|
|
35
36
|
containerWidth: EditorContainerWidth;
|
|
36
|
-
isTableResizingEnabled: boolean | undefined;
|
|
37
37
|
editorView: EditorView;
|
|
38
38
|
getPos: () => number | undefined;
|
|
39
39
|
tableRef: HTMLTableElement;
|
|
40
40
|
isNested: boolean;
|
|
41
41
|
isResizing?: boolean;
|
|
42
42
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
43
|
-
isTableScalingEnabled?: boolean;
|
|
44
43
|
tableWrapperHeight?: number;
|
|
45
44
|
isWholeTableInDanger?: boolean;
|
|
45
|
+
isTableResizingEnabled: boolean | undefined;
|
|
46
|
+
isTableScalingEnabled?: boolean;
|
|
47
|
+
isTableAlignmentEnabled?: boolean;
|
|
46
48
|
};
|
|
47
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth },
|
|
49
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableAlignmentEnabled, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
48
50
|
export {};
|
|
@@ -19,11 +19,12 @@ interface TableResizerProps {
|
|
|
19
19
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
20
20
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
|
+
isTableAlignmentEnabled?: boolean;
|
|
22
23
|
isWholeTableInDanger?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
25
26
|
onResizeStop?: () => void;
|
|
26
27
|
onResizeStart?: () => void;
|
|
27
28
|
}
|
|
28
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isWholeTableInDanger, pluginInjectionApi, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
29
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableAlignmentEnabled, isWholeTableInDanger, pluginInjectionApi, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -32,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
32
32
|
}): boolean;
|
|
33
33
|
destroy(): void;
|
|
34
34
|
}
|
|
35
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
35
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean) => NodeView;
|
|
36
36
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -7,5 +8,5 @@ export declare const addColumnBefore: (isTableScalingEnabled?: boolean) => Comma
|
|
|
7
8
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean) => Command;
|
|
8
9
|
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean) => (column: number) => Command;
|
|
9
10
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
10
|
-
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean) => Command;
|
|
11
|
+
export declare const createTable: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null) => Command;
|
|
11
12
|
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -24,25 +24,27 @@ type ResizableTableContainerProps = {
|
|
|
24
24
|
tableRef: HTMLTableElement;
|
|
25
25
|
isResizing?: boolean;
|
|
26
26
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
|
-
isTableScalingEnabled?: boolean;
|
|
28
27
|
tableWrapperHeight?: number;
|
|
29
28
|
isWholeTableInDanger?: boolean;
|
|
29
|
+
isTableScalingEnabled?: boolean;
|
|
30
|
+
isTableAlignmentEnabled?: boolean;
|
|
30
31
|
};
|
|
31
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi,
|
|
32
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableAlignmentEnabled, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
32
33
|
type TableContainerProps = {
|
|
33
34
|
node: PMNode;
|
|
34
35
|
className: string;
|
|
35
36
|
containerWidth: EditorContainerWidth;
|
|
36
|
-
isTableResizingEnabled: boolean | undefined;
|
|
37
37
|
editorView: EditorView;
|
|
38
38
|
getPos: () => number | undefined;
|
|
39
39
|
tableRef: HTMLTableElement;
|
|
40
40
|
isNested: boolean;
|
|
41
41
|
isResizing?: boolean;
|
|
42
42
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
43
|
-
isTableScalingEnabled?: boolean;
|
|
44
43
|
tableWrapperHeight?: number;
|
|
45
44
|
isWholeTableInDanger?: boolean;
|
|
45
|
+
isTableResizingEnabled: boolean | undefined;
|
|
46
|
+
isTableScalingEnabled?: boolean;
|
|
47
|
+
isTableAlignmentEnabled?: boolean;
|
|
46
48
|
};
|
|
47
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth },
|
|
49
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableAlignmentEnabled, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
48
50
|
export {};
|
|
@@ -19,11 +19,12 @@ interface TableResizerProps {
|
|
|
19
19
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
20
20
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
|
+
isTableAlignmentEnabled?: boolean;
|
|
22
23
|
isWholeTableInDanger?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
25
26
|
onResizeStop?: () => void;
|
|
26
27
|
onResizeStart?: () => void;
|
|
27
28
|
}
|
|
28
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isWholeTableInDanger, pluginInjectionApi, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
29
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, onResizeStop, onResizeStart, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, isTableScalingEnabled, isTableAlignmentEnabled, isWholeTableInDanger, pluginInjectionApi, }: PropsWithChildren<TableResizerImprovementProps>) => JSX.Element;
|
|
29
30
|
export {};
|