@atlaskit/editor-plugin-table 7.19.11 → 7.20.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 +28 -0
- package/dist/cjs/commands/column-resize.js +1 -1
- package/dist/cjs/commands/selection.js +25 -4
- package/dist/cjs/nodeviews/table.js +2 -4
- package/dist/cjs/plugin.js +59 -56
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/cjs/pm-plugins/keymap.js +6 -6
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/cjs/toolbar.js +8 -5
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +5 -3
- package/dist/cjs/ui/TableFloatingControls/index.js +8 -2
- package/dist/cjs/utils/drag-menu.js +5 -1
- package/dist/es2019/commands/column-resize.js +2 -2
- package/dist/es2019/commands/selection.js +25 -4
- package/dist/es2019/nodeviews/table.js +3 -5
- package/dist/es2019/plugin.js +11 -7
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +18 -3
- package/dist/es2019/pm-plugins/keymap.js +7 -7
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/es2019/toolbar.js +8 -5
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +6 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +9 -3
- package/dist/es2019/utils/drag-menu.js +6 -2
- package/dist/esm/commands/column-resize.js +2 -2
- package/dist/esm/commands/selection.js +25 -4
- package/dist/esm/nodeviews/table.js +3 -5
- package/dist/esm/plugin.js +60 -57
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/esm/pm-plugins/keymap.js +7 -7
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/esm/toolbar.js +8 -5
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -4
- package/dist/esm/ui/TableFloatingControls/index.js +9 -3
- package/dist/esm/utils/drag-menu.js +5 -1
- package/dist/types/commands/selection.d.ts +4 -2
- package/dist/types/nodeviews/table.d.ts +1 -2
- package/dist/types/nodeviews/types.d.ts +1 -3
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types/pm-plugins/main.d.ts +1 -2
- package/dist/types/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/utils/drag-menu.d.ts +2 -1
- package/dist/types-ts4.5/commands/selection.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -3
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -1
- package/package.json +8 -5
- package/src/commands/column-resize.ts +2 -2
- package/src/commands/selection.ts +49 -4
- package/src/nodeviews/table.tsx +3 -10
- package/src/nodeviews/types.ts +1 -3
- package/src/plugin.tsx +8 -7
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +43 -3
- package/src/pm-plugins/keymap.ts +23 -7
- package/src/pm-plugins/main.ts +3 -4
- package/src/pm-plugins/table-selection-keymap.ts +18 -6
- package/src/toolbar.tsx +7 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +7 -0
- package/src/ui/FloatingDragMenu/index.tsx +9 -2
- package/src/ui/TableFloatingControls/index.tsx +12 -4
- package/src/utils/drag-menu.ts +8 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
1
2
|
import { GapCursorSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
2
3
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -79,7 +80,7 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
|
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
export var selectColumns = function selectColumns(editorSelectionAPI) {
|
|
83
|
+
export var selectColumns = function selectColumns(editorSelectionAPI, ariaNotify, getIntl) {
|
|
83
84
|
return function () {
|
|
84
85
|
var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
85
86
|
return function (state, dispatch) {
|
|
@@ -94,13 +95,23 @@ export var selectColumns = function selectColumns(editorSelectionAPI) {
|
|
|
94
95
|
})(state, dispatch);
|
|
95
96
|
}
|
|
96
97
|
if (table && rect) {
|
|
97
|
-
|
|
98
|
+
var selectColumnCommand = selectColumn(rect.left, undefined, triggeredByKeyboard)(state, dispatch);
|
|
99
|
+
var map = TableMap.get(table.node);
|
|
100
|
+
if (ariaNotify && getIntl) {
|
|
101
|
+
ariaNotify(getIntl().formatMessage(messages.columnSelected, {
|
|
102
|
+
index: rect.left + 1,
|
|
103
|
+
total: map.width
|
|
104
|
+
}), {
|
|
105
|
+
priority: 'important'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return selectColumnCommand;
|
|
98
109
|
}
|
|
99
110
|
return false;
|
|
100
111
|
};
|
|
101
112
|
};
|
|
102
113
|
};
|
|
103
|
-
export var selectRows = function selectRows(editorSelectionAPI) {
|
|
114
|
+
export var selectRows = function selectRows(editorSelectionAPI, ariaNotify, getIntl) {
|
|
104
115
|
return function () {
|
|
105
116
|
var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
106
117
|
return function (state, dispatch) {
|
|
@@ -115,7 +126,17 @@ export var selectRows = function selectRows(editorSelectionAPI) {
|
|
|
115
126
|
})(state, dispatch);
|
|
116
127
|
}
|
|
117
128
|
if (table && rect) {
|
|
118
|
-
|
|
129
|
+
var selectRowCommand = selectRow(rect.top, undefined, triggeredByKeyboard)(state, dispatch);
|
|
130
|
+
var map = TableMap.get(table.node);
|
|
131
|
+
if (ariaNotify && getIntl) {
|
|
132
|
+
ariaNotify(getIntl().formatMessage(messages.rowSelected, {
|
|
133
|
+
index: rect.top + 1,
|
|
134
|
+
total: map.height
|
|
135
|
+
}), {
|
|
136
|
+
priority: 'important'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return selectRowCommand;
|
|
119
140
|
}
|
|
120
141
|
return false;
|
|
121
142
|
};
|
|
@@ -17,7 +17,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
|
17
17
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
18
18
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
|
-
import {
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
21
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
22
22
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
23
23
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -68,7 +68,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
68
68
|
function TableView(props) {
|
|
69
69
|
var _this;
|
|
70
70
|
_classCallCheck(this, TableView);
|
|
71
|
-
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props
|
|
71
|
+
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
|
|
72
72
|
_defineProperty(_assertThisInitialized(_this), "getNode", function () {
|
|
73
73
|
return _this.node;
|
|
74
74
|
});
|
|
@@ -125,7 +125,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
125
125
|
key: "render",
|
|
126
126
|
value: function render(props, forwardRef) {
|
|
127
127
|
var _this3 = this;
|
|
128
|
-
if (
|
|
128
|
+
if (fg('platform.editor.table.use-shared-state-hook')) {
|
|
129
129
|
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
130
130
|
forwardRef: forwardRef,
|
|
131
131
|
getNode: this.getNode,
|
|
@@ -291,7 +291,6 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
291
291
|
var _getPluginConfig = getPluginConfig(pluginConfig),
|
|
292
292
|
allowColumnResizing = _getPluginConfig.allowColumnResizing,
|
|
293
293
|
allowControls = _getPluginConfig.allowControls;
|
|
294
|
-
var hasIntlContext = true;
|
|
295
294
|
return new TableView({
|
|
296
295
|
node: node,
|
|
297
296
|
view: view,
|
|
@@ -312,7 +311,6 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
312
311
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
313
312
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
314
313
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
315
|
-
hasIntlContext: hasIntlContext,
|
|
316
314
|
pluginInjectionApi: pluginInjectionApi
|
|
317
315
|
}).init();
|
|
318
316
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -13,7 +13,7 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
13
13
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
14
14
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
15
15
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
16
|
-
import {
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
import { insertTableWithSize } from './commands/insert';
|
|
18
18
|
import { pluginConfig } from './create-plugin-config';
|
|
19
19
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
@@ -52,7 +52,7 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
52
52
|
* from `@atlaskit/editor-core`.
|
|
53
53
|
*/
|
|
54
54
|
var tablesPlugin = function tablesPlugin(_ref) {
|
|
55
|
-
var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
55
|
+
var _api$analytics, _api$accessibilityUti, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
56
56
|
var options = _ref.config,
|
|
57
57
|
api = _ref.api;
|
|
58
58
|
var editorViewRef = {
|
|
@@ -65,8 +65,9 @@ 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 ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
68
69
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
69
|
-
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && isTableFixedColumnWidthsOptionEnabled &&
|
|
70
|
+
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && isTableFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
70
71
|
var isCellBackgroundDuplicated = (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableDuplicateCellColouring) || false;
|
|
71
72
|
return {
|
|
72
73
|
name: 'table',
|
|
@@ -202,18 +203,19 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
202
203
|
}
|
|
203
204
|
}, {
|
|
204
205
|
name: 'tableSelectionKeymap',
|
|
205
|
-
plugin: function plugin() {
|
|
206
|
-
|
|
206
|
+
plugin: function plugin(_ref8) {
|
|
207
|
+
var getIntl = _ref8.getIntl;
|
|
208
|
+
return tableSelectionKeymapPlugin(api, getIntl);
|
|
207
209
|
}
|
|
208
210
|
}, {
|
|
209
211
|
name: 'tableEditing',
|
|
210
212
|
plugin: function plugin() {
|
|
211
|
-
var
|
|
212
|
-
dragAndDropEnabled =
|
|
213
|
+
var _ref9 = options || {},
|
|
214
|
+
dragAndDropEnabled = _ref9.dragAndDropEnabled;
|
|
213
215
|
return tableEditing({
|
|
214
|
-
reportFixedTable: function reportFixedTable(
|
|
215
|
-
var tr =
|
|
216
|
-
reason =
|
|
216
|
+
reportFixedTable: function reportFixedTable(_ref10) {
|
|
217
|
+
var tr = _ref10.tr,
|
|
218
|
+
reason = _ref10.reason;
|
|
217
219
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
218
220
|
action: TABLE_ACTION.FIXED,
|
|
219
221
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -229,53 +231,53 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
229
231
|
}
|
|
230
232
|
}, {
|
|
231
233
|
name: 'tableStickyHeaders',
|
|
232
|
-
plugin: function plugin(
|
|
233
|
-
var dispatch =
|
|
234
|
-
eventDispatcher =
|
|
234
|
+
plugin: function plugin(_ref11) {
|
|
235
|
+
var dispatch = _ref11.dispatch,
|
|
236
|
+
eventDispatcher = _ref11.eventDispatcher;
|
|
235
237
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, function () {
|
|
236
238
|
return [];
|
|
237
239
|
}) : undefined;
|
|
238
240
|
}
|
|
239
241
|
}, {
|
|
240
242
|
name: 'tableDragAndDrop',
|
|
241
|
-
plugin: function plugin(
|
|
242
|
-
var dispatch =
|
|
243
|
+
plugin: function plugin(_ref12) {
|
|
244
|
+
var dispatch = _ref12.dispatch;
|
|
243
245
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : undefined;
|
|
244
246
|
}
|
|
245
247
|
}, {
|
|
246
248
|
name: 'tableViewModeSort',
|
|
247
249
|
plugin: function plugin() {
|
|
248
|
-
return
|
|
250
|
+
return api !== null && api !== void 0 && api.editorViewMode && fg('platform.editor.table.live-pages-sorting_4malx') ? createViewModeSortPlugin(api.editorViewMode) : undefined;
|
|
249
251
|
}
|
|
250
252
|
}, {
|
|
251
253
|
name: 'tableLocalId',
|
|
252
|
-
plugin: function plugin(
|
|
253
|
-
var dispatch =
|
|
254
|
+
plugin: function plugin(_ref13) {
|
|
255
|
+
var dispatch = _ref13.dispatch;
|
|
254
256
|
return createTableLocalIdPlugin(dispatch);
|
|
255
257
|
}
|
|
256
258
|
}, {
|
|
257
259
|
name: 'tableWidth',
|
|
258
|
-
plugin: function plugin(
|
|
260
|
+
plugin: function plugin(_ref14) {
|
|
259
261
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
260
|
-
var dispatchAnalyticsEvent =
|
|
261
|
-
dispatch =
|
|
262
|
+
var dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent,
|
|
263
|
+
dispatch = _ref14.dispatch;
|
|
262
264
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
263
265
|
}
|
|
264
266
|
},
|
|
265
267
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
266
268
|
{
|
|
267
269
|
name: 'tableOverflowAnalyticsPlugin',
|
|
268
|
-
plugin: function plugin(
|
|
270
|
+
plugin: function plugin(_ref15) {
|
|
269
271
|
var _options$tableResizin;
|
|
270
|
-
var dispatch =
|
|
271
|
-
dispatchAnalyticsEvent =
|
|
272
|
+
var dispatch = _ref15.dispatch,
|
|
273
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
272
274
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
273
275
|
}
|
|
274
276
|
}, {
|
|
275
277
|
name: 'tableAnalyticsPlugin',
|
|
276
|
-
plugin: function plugin(
|
|
277
|
-
var dispatch =
|
|
278
|
-
dispatchAnalyticsEvent =
|
|
278
|
+
plugin: function plugin(_ref16) {
|
|
279
|
+
var dispatch = _ref16.dispatch,
|
|
280
|
+
dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
|
|
279
281
|
return createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent);
|
|
280
282
|
}
|
|
281
283
|
}, {
|
|
@@ -306,12 +308,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
306
308
|
}
|
|
307
309
|
return plugins;
|
|
308
310
|
},
|
|
309
|
-
contentComponent: function contentComponent(
|
|
310
|
-
var editorView =
|
|
311
|
-
popupsMountPoint =
|
|
312
|
-
popupsBoundariesElement =
|
|
313
|
-
popupsScrollableElement =
|
|
314
|
-
dispatchAnalyticsEvent =
|
|
311
|
+
contentComponent: function contentComponent(_ref17) {
|
|
312
|
+
var editorView = _ref17.editorView,
|
|
313
|
+
popupsMountPoint = _ref17.popupsMountPoint,
|
|
314
|
+
popupsBoundariesElement = _ref17.popupsBoundariesElement,
|
|
315
|
+
popupsScrollableElement = _ref17.popupsScrollableElement,
|
|
316
|
+
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
315
317
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
316
318
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
317
319
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -325,35 +327,35 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
325
327
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
326
328
|
dragAndDropState: dragAndDropPluginKey
|
|
327
329
|
},
|
|
328
|
-
render: function render(
|
|
329
|
-
var resizingPluginState =
|
|
330
|
-
stickyHeadersState =
|
|
331
|
-
tablePluginState =
|
|
332
|
-
tableWidthPluginState =
|
|
333
|
-
dragAndDropState =
|
|
330
|
+
render: function render(_ref18) {
|
|
331
|
+
var resizingPluginState = _ref18.tableResizingPluginState,
|
|
332
|
+
stickyHeadersState = _ref18.stickyHeadersState,
|
|
333
|
+
tablePluginState = _ref18.tablePluginState,
|
|
334
|
+
tableWidthPluginState = _ref18.tableWidthPluginState,
|
|
335
|
+
dragAndDropState = _ref18.dragAndDropState;
|
|
334
336
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
335
337
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
336
338
|
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
337
339
|
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
338
340
|
var isResizing = isColumnResizing || isTableResizing;
|
|
339
341
|
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
340
|
-
var
|
|
341
|
-
tableNode =
|
|
342
|
-
tablePos =
|
|
343
|
-
targetCellPosition =
|
|
344
|
-
isContextualMenuOpen =
|
|
345
|
-
tableRef =
|
|
346
|
-
pluginConfig =
|
|
347
|
-
insertColumnButtonIndex =
|
|
348
|
-
insertRowButtonIndex =
|
|
349
|
-
isHeaderColumnEnabled =
|
|
350
|
-
isHeaderRowEnabled =
|
|
351
|
-
isDragAndDropEnabled =
|
|
352
|
-
tableWrapperTarget =
|
|
353
|
-
isCellMenuOpenByKeyboard =
|
|
342
|
+
var _ref19 = tablePluginState,
|
|
343
|
+
tableNode = _ref19.tableNode,
|
|
344
|
+
tablePos = _ref19.tablePos,
|
|
345
|
+
targetCellPosition = _ref19.targetCellPosition,
|
|
346
|
+
isContextualMenuOpen = _ref19.isContextualMenuOpen,
|
|
347
|
+
tableRef = _ref19.tableRef,
|
|
348
|
+
pluginConfig = _ref19.pluginConfig,
|
|
349
|
+
insertColumnButtonIndex = _ref19.insertColumnButtonIndex,
|
|
350
|
+
insertRowButtonIndex = _ref19.insertRowButtonIndex,
|
|
351
|
+
isHeaderColumnEnabled = _ref19.isHeaderColumnEnabled,
|
|
352
|
+
isHeaderRowEnabled = _ref19.isHeaderRowEnabled,
|
|
353
|
+
isDragAndDropEnabled = _ref19.isDragAndDropEnabled,
|
|
354
|
+
tableWrapperTarget = _ref19.tableWrapperTarget,
|
|
355
|
+
isCellMenuOpenByKeyboard = _ref19.isCellMenuOpenByKeyboard;
|
|
354
356
|
var allowControls = pluginConfig.allowControls;
|
|
355
357
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
356
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef ||
|
|
358
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard && fg('platform.editor.a11y-table-context-menu_y4c9c')) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
357
359
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
358
360
|
editorView: editorView,
|
|
359
361
|
tableNode: tableNode,
|
|
@@ -409,7 +411,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
409
411
|
stickyHeaders: stickyHeader,
|
|
410
412
|
pluginConfig: pluginConfig,
|
|
411
413
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
412
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
414
|
+
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
415
|
+
ariaNotifyPlugin: ariaNotifyPlugin
|
|
413
416
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
414
417
|
editorView: editorView,
|
|
415
418
|
selection: editorView.state.selection,
|
|
@@ -434,8 +437,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
434
437
|
}));
|
|
435
438
|
},
|
|
436
439
|
pluginsOptions: {
|
|
437
|
-
quickInsert: function quickInsert(
|
|
438
|
-
var formatMessage =
|
|
440
|
+
quickInsert: function quickInsert(_ref20) {
|
|
441
|
+
var formatMessage = _ref20.formatMessage;
|
|
439
442
|
return [{
|
|
440
443
|
id: 'table',
|
|
441
444
|
title: formatMessage(messages.table),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
5
|
import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
5
6
|
import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo } from '../../utils';
|
|
@@ -36,7 +37,7 @@ export var clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(
|
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
|
-
export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnalyticsAPI) {
|
|
40
|
+
export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl) {
|
|
40
41
|
return function (inputMethod, sourceType, sourceIndexes, targetIndex, tr) {
|
|
41
42
|
return withEditorAnalyticsAPI(function (_ref2) {
|
|
42
43
|
var selection = _ref2.selection;
|
|
@@ -66,12 +67,25 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
|
|
|
66
67
|
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
67
68
|
if (dispatch) {
|
|
68
69
|
moveSource(sourceType, sourceIndexes, targetIndex, tr)(state, dispatch);
|
|
70
|
+
// Only considering single row/column movement for screen reader as only single row/column selection is supported via keyboard atm.
|
|
71
|
+
if ((inputMethod === INPUT_METHOD.TABLE_CONTEXT_MENU || INPUT_METHOD.SHORTCUT) && sourceIndexes.length === 1 && ariaNotify && getIntl) {
|
|
72
|
+
var direction = sourceIndexes[0] > targetIndex ? -1 : 1; // -1 for left/up , 1 for right/down
|
|
73
|
+
var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection),
|
|
74
|
+
totalRowCount = _getSelectedTableInfo3.totalRowCount,
|
|
75
|
+
totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
|
|
76
|
+
ariaNotify(getIntl().formatMessage(sourceType === 'table-row' ? direction > 0 ? messages.rowMovedDown : messages.rowMovedUp : direction > 0 ? messages.columnMovedRight : messages.columnMovedLeft, {
|
|
77
|
+
index: targetIndex + 1,
|
|
78
|
+
total: sourceType === 'table-row' ? totalRowCount : totalColumnCount
|
|
79
|
+
}), {
|
|
80
|
+
priority: 'important'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
69
83
|
}
|
|
70
84
|
return true;
|
|
71
85
|
});
|
|
72
86
|
};
|
|
73
87
|
};
|
|
74
|
-
export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI) {
|
|
88
|
+
export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotify, getIntl) {
|
|
75
89
|
return function (sourceType, direction) {
|
|
76
90
|
return function (state, dispatch) {
|
|
77
91
|
var selection = state.selection;
|
|
@@ -85,14 +99,14 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
|
|
|
85
99
|
if (selectedIndexes.length === 0) {
|
|
86
100
|
return false;
|
|
87
101
|
}
|
|
88
|
-
var
|
|
89
|
-
totalRowCount =
|
|
90
|
-
totalColumnCount =
|
|
102
|
+
var _getSelectedTableInfo4 = getSelectedTableInfo(selection),
|
|
103
|
+
totalRowCount = _getSelectedTableInfo4.totalRowCount,
|
|
104
|
+
totalColumnCount = _getSelectedTableInfo4.totalColumnCount;
|
|
91
105
|
if (!canMove(sourceType, direction, isRow ? totalRowCount : totalColumnCount, selection, selectionRect)) {
|
|
92
106
|
return false;
|
|
93
107
|
}
|
|
94
108
|
var targetIndex = getTargetIndex(selectedIndexes, direction);
|
|
95
|
-
return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
109
|
+
return moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotify, getIntl)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
96
110
|
};
|
|
97
111
|
};
|
|
98
112
|
};
|
|
@@ -101,9 +115,9 @@ export var cloneSourceWithAnalytics = function cloneSourceWithAnalytics(editorAn
|
|
|
101
115
|
return withEditorAnalyticsAPI(function (_ref3) {
|
|
102
116
|
var selection = _ref3.selection;
|
|
103
117
|
var direction = sourceIndexes[0] > targetIndex ? -1 : 1;
|
|
104
|
-
var
|
|
105
|
-
totalRowCount =
|
|
106
|
-
totalColumnCount =
|
|
118
|
+
var _getSelectedTableInfo5 = getSelectedTableInfo(selection),
|
|
119
|
+
totalRowCount = _getSelectedTableInfo5.totalRowCount,
|
|
120
|
+
totalColumnCount = _getSelectedTableInfo5.totalColumnCount;
|
|
107
121
|
return {
|
|
108
122
|
action: sourceType === 'table-row' ? TABLE_ACTION.CLONED_ROW : TABLE_ACTION.CLONED_COLUMN,
|
|
109
123
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -2,7 +2,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, addRowAfter, addRowAfterVO, addRowBefore, addRowBeforeVO, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, focusToContextMenuTrigger, 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
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
@@ -31,7 +31,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
31
31
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
32
32
|
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
33
33
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
34
|
-
if (
|
|
34
|
+
if (fg('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
|
|
35
35
|
bindKeymapWithCommand(addRowBeforeVO.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
36
36
|
bindKeymapWithCommand(addRowAfterVO.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
37
37
|
bindKeymapWithCommand(addColumnBeforeVO.common, addColumnBeforeCommand(isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
@@ -46,10 +46,10 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
46
46
|
* See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1), list);
|
|
50
|
-
bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1), list);
|
|
51
|
-
bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1), list);
|
|
52
|
-
bindKeymapWithCommand(moveColumnRight.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', 1), list);
|
|
49
|
+
bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', 1), list);
|
|
50
|
+
bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-row', -1), list);
|
|
51
|
+
bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', -1), list);
|
|
52
|
+
bindKeymapWithCommand(moveColumnRight.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)('table-column', 1), list);
|
|
53
53
|
|
|
54
54
|
// Delete row/column shortcuts
|
|
55
55
|
bindKeymapWithCommand(deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent), list);
|
|
@@ -75,7 +75,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
75
75
|
ariaNotify: ariaNotifyPlugin,
|
|
76
76
|
getIntl: getIntl
|
|
77
77
|
}), list);
|
|
78
|
-
if (
|
|
78
|
+
if (fg('platform.editor.a11y-table-context-menu_y4c9c')) {
|
|
79
79
|
bindKeymapWithCommand(focusToContextMenuTrigger.common, setFocusToCellMenu(), list);
|
|
80
80
|
}
|
|
81
81
|
return keymap(list);
|
|
@@ -9,7 +9,7 @@ import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
11
11
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
|
-
import {
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
14
14
|
import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
15
15
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
@@ -199,7 +199,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
// If a partial paste of nested expand, paste only nested-expand's content */
|
|
202
|
-
if (
|
|
202
|
+
if (fg('platform.editor.transform-slice-for-nested-expand')) {
|
|
203
203
|
slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
|
|
204
204
|
}
|
|
205
205
|
return slice;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { bindKeymapArrayWithCommand, bindKeymapWithCommand, moveLeft, moveRight, selectColumn, selectRow, selectTable, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
3
|
import { arrowLeftFromTable, arrowRightFromTable, modASelectTable, selectColumns, selectRows, shiftArrowUpFromTable } from '../commands/selection';
|
|
4
|
-
export function tableSelectionKeymapPlugin(
|
|
4
|
+
export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
|
|
5
|
+
var _pluginInjectionApi$a;
|
|
5
6
|
var list = {};
|
|
7
|
+
var editorSelectionAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.selection;
|
|
8
|
+
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
6
9
|
bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
|
|
7
10
|
bindKeymapWithCommand(moveLeft.common, arrowLeftFromTable(editorSelectionAPI)(), list);
|
|
8
|
-
bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI)(true), list);
|
|
9
|
-
bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI)(true), list);
|
|
11
|
+
bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
12
|
+
bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
|
|
10
13
|
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
|
11
14
|
bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
|
|
12
15
|
return keymap(list);
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -364,7 +364,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
364
364
|
return element;
|
|
365
365
|
};
|
|
366
366
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
|
|
367
|
-
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) : [];
|
|
367
|
+
var alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.fullWidthEnabled) : [];
|
|
368
368
|
var isCellBackgroundDuplicated = getEditorFeatureFlags().tableDuplicateCellColouring || false;
|
|
369
369
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
370
370
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled) : [];
|
|
@@ -580,7 +580,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
580
580
|
}
|
|
581
581
|
return false;
|
|
582
582
|
};
|
|
583
|
-
export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) {
|
|
583
|
+
export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
584
584
|
var formatMessage = _ref6.formatMessage;
|
|
585
585
|
var tableObject = findTable(editorState.selection);
|
|
586
586
|
if (!tableObject) {
|
|
@@ -613,7 +613,7 @@ export var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editor
|
|
|
613
613
|
title: formatMessage(layoutToMessages[value]),
|
|
614
614
|
selected: normaliseAlignment(currentLayout) === value,
|
|
615
615
|
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB, CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED)
|
|
616
|
-
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) && {
|
|
616
|
+
}, isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) && {
|
|
617
617
|
disabled: value !== 'center'
|
|
618
618
|
});
|
|
619
619
|
});
|
|
@@ -643,7 +643,7 @@ export var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmen
|
|
|
643
643
|
return icon.value === normaliseAlignment(selectedAlignment);
|
|
644
644
|
});
|
|
645
645
|
};
|
|
646
|
-
export var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent) {
|
|
646
|
+
export var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
647
647
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
648
648
|
lineLength = _getEditorContainerWi.lineLength;
|
|
649
649
|
var tableContainerWidth = getTableContainerWidth(selectedNode);
|
|
@@ -655,7 +655,10 @@ export var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode
|
|
|
655
655
|
var scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
|
|
656
656
|
tableContainerWidth = tableContainerWidth * scalePercent;
|
|
657
657
|
}
|
|
658
|
-
|
|
658
|
+
|
|
659
|
+
// If fixed-width editor, we disable 'left-alignment' when table width is 760px.
|
|
660
|
+
// tableContainerWidth +1 here because tableContainerWidth is 759 in fixed-width editor
|
|
661
|
+
if (selectedNode && !isFullWidthEditor && lineLength && tableContainerWidth + 1 >= lineLength) {
|
|
659
662
|
return true;
|
|
660
663
|
}
|
|
661
664
|
return false;
|
|
@@ -196,7 +196,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
196
196
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
197
197
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
198
198
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
199
|
-
tableSortColumnReorder = _ref.tableSortColumnReorder
|
|
199
|
+
tableSortColumnReorder = _ref.tableSortColumnReorder,
|
|
200
|
+
ariaNotifyPlugin = _ref.ariaNotifyPlugin;
|
|
200
201
|
var state = editorView.state,
|
|
201
202
|
dispatch = editorView.dispatch;
|
|
202
203
|
var selection = state.selection;
|
|
@@ -210,7 +211,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
210
211
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
211
212
|
var hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
212
213
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
213
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
|
|
214
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder, ariaNotifyPlugin);
|
|
214
215
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
|
|
215
216
|
menuItems = _convertToDropdownIte.menuItems,
|
|
216
217
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
7
7
|
import DragMenu from './DragMenu';
|
|
8
8
|
var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
@@ -20,7 +20,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
20
20
|
stickyHeaders = _ref.stickyHeaders,
|
|
21
21
|
pluginConfig = _ref.pluginConfig,
|
|
22
22
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
23
|
-
getEditorFeatureFlags = _ref.getEditorFeatureFlags
|
|
23
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
24
|
+
ariaNotifyPlugin = _ref.ariaNotifyPlugin;
|
|
24
25
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
@@ -37,7 +38,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
37
38
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
|
|
38
39
|
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
39
40
|
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
40
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
41
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
41
42
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
42
43
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
43
44
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -75,7 +76,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
75
76
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
76
77
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
77
78
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
78
|
-
tableSortColumnReorder: tableSortColumnReorder
|
|
79
|
+
tableSortColumnReorder: tableSortColumnReorder,
|
|
80
|
+
ariaNotifyPlugin: ariaNotifyPlugin
|
|
79
81
|
}));
|
|
80
82
|
};
|
|
81
83
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|