@atlaskit/editor-plugin-table 22.4.0 → 22.4.1
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 +9 -1
- package/dist/cjs/pm-plugins/main.js +12 -23
- package/dist/cjs/pm-plugins/utils/drag-menu.js +1 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -24
- package/dist/es2019/pm-plugins/main.js +12 -23
- package/dist/es2019/pm-plugins/utils/drag-menu.js +1 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -24
- package/dist/esm/pm-plugins/main.js +12 -23
- package/dist/esm/pm-plugins/utils/drag-menu.js +1 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -24
- package/package.json +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 22.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`538b9b5a2201c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/538b9b5a2201c) -
|
|
8
|
+
Remove platform_editor_enable_table_dnd feature gate refs - fully rolled out (EDITOR-6295)
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 22.4.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
6
14
|
|
|
7
|
-
- [`
|
|
15
|
+
- [`ebab8f80bfc40`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ebab8f80bfc40) -
|
|
8
16
|
Autofix: add explicit package exports (barrel removal)
|
|
9
17
|
|
|
10
18
|
### Patch Changes
|
|
@@ -165,36 +165,25 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
165
165
|
}
|
|
166
166
|
return {
|
|
167
167
|
update: function update(view, prevState) {
|
|
168
|
+
var _pluginInjectionApi$e2;
|
|
168
169
|
var state = view.state,
|
|
169
170
|
dispatch = view.dispatch;
|
|
170
171
|
var selection = state.selection;
|
|
171
172
|
var pluginState = (0, _pluginFactory.getPluginState)(state);
|
|
172
173
|
var tableRef;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
185
|
-
parent.querySelector('table') || undefined;
|
|
186
|
-
}
|
|
174
|
+
var parent = (0, _utils2.findParentDomRefOfType)(state.schema.nodes.table, domAtPos)(selection);
|
|
175
|
+
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
|
|
176
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_update_table_ref_fix')) {
|
|
177
|
+
var _pluginInjectionApi$e3, _pluginInjectionApi$i;
|
|
178
|
+
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
179
|
+
}
|
|
180
|
+
if (shouldSetTableRef) {
|
|
181
|
+
tableRef =
|
|
182
|
+
// Ignored via go/ees005
|
|
183
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
184
|
+
parent.querySelector('table') || undefined;
|
|
187
185
|
}
|
|
188
186
|
if (pluginState.editorHasFocus) {
|
|
189
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_enable_table_dnd')) {
|
|
190
|
-
var _parent = (0, _utils2.findParentDomRefOfType)(state.schema.nodes.table, domAtPos)(selection);
|
|
191
|
-
if (_parent) {
|
|
192
|
-
tableRef =
|
|
193
|
-
// Ignored via go/ees005
|
|
194
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
195
|
-
_parent.querySelector('table') || undefined;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
187
|
var tableNode = (0, _utils3.findTable)(state.selection);
|
|
199
188
|
// when keyboard cursor leaves the table we need to stop column resizing
|
|
200
189
|
var pluginPrevState = (0, _pluginFactory.getPluginState)(prevState);
|
|
@@ -24,7 +24,6 @@ var _tableRowAddBelow = _interopRequireDefault(require("@atlaskit/icon/core/tabl
|
|
|
24
24
|
var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-row-delete"));
|
|
25
25
|
var _tableRowMoveDown = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-down"));
|
|
26
26
|
var _tableRowMoveUp = _interopRequireDefault(require("@atlaskit/icon/core/table-row-move-up"));
|
|
27
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
27
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
28
|
var _toolbar = require("../../ui/toolbar");
|
|
30
29
|
var _commandsWithAnalytics = require("../commands/commands-with-analytics");
|
|
@@ -339,7 +338,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
339
338
|
};
|
|
340
339
|
})));
|
|
341
340
|
var allConfigs = (0, _toConsumableArray2.default)(restConfigs);
|
|
342
|
-
if (isColumnSortingEnabled
|
|
341
|
+
if (isColumnSortingEnabled) {
|
|
343
342
|
allConfigs.unshift.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs));
|
|
344
343
|
}
|
|
345
344
|
return allConfigs.filter(Boolean);
|
|
@@ -23,7 +23,6 @@ var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
|
23
23
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
24
24
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
25
25
|
var _paintBucket = _interopRequireDefault(require("@atlaskit/icon/core/paint-bucket"));
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _primitives = require("@atlaskit/primitives");
|
|
28
27
|
var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
|
|
29
28
|
var _commands = require("../../pm-plugins/commands");
|
|
@@ -388,23 +387,6 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
388
387
|
}))
|
|
389
388
|
);
|
|
390
389
|
};
|
|
391
|
-
var createHeaderRowColumnMenuItemOld = function createHeaderRowColumnMenuItemOld(direction) {
|
|
392
|
-
return direction === 'column' ? {
|
|
393
|
-
key: 'header_column',
|
|
394
|
-
content: formatMessage(_messages.tableMessages.headerColumn),
|
|
395
|
-
value: {
|
|
396
|
-
name: 'header_column'
|
|
397
|
-
},
|
|
398
|
-
elemAfter: (0, _react2.jsx)(HeaderColumnToggle, null)
|
|
399
|
-
} : {
|
|
400
|
-
key: 'header_row',
|
|
401
|
-
content: formatMessage(_messages.tableMessages.headerRow),
|
|
402
|
-
value: {
|
|
403
|
-
name: 'header_row'
|
|
404
|
-
},
|
|
405
|
-
elemAfter: (0, _react2.jsx)(HeaderRowToggle, null)
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
390
|
var createHeaderRowColumnMenuItem = function createHeaderRowColumnMenuItem(direction) {
|
|
409
391
|
if (direction === 'column' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn)) {
|
|
410
392
|
return {
|
|
@@ -552,11 +534,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
552
534
|
// If first row, add toggle for Header row, default is true
|
|
553
535
|
// If first column, add toggle for Header column, default is false
|
|
554
536
|
if (index === 0) {
|
|
555
|
-
if (
|
|
556
|
-
menuItems.push({
|
|
557
|
-
items: [createHeaderRowColumnMenuItemOld(direction)]
|
|
558
|
-
});
|
|
559
|
-
} else if ((pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) && (0, _platformFeatureFlags.fg)('platform_editor_enable_table_dnd')) {
|
|
537
|
+
if (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) {
|
|
560
538
|
var headerRowColumnMenuItem = createHeaderRowColumnMenuItem(direction);
|
|
561
539
|
headerRowColumnMenuItem && menuItems.push({
|
|
562
540
|
items: [headerRowColumnMenuItem]
|
|
@@ -565,7 +543,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
565
543
|
}
|
|
566
544
|
|
|
567
545
|
// All rows, add toggle for numbered rows, default is false
|
|
568
|
-
if (direction === 'row' && (
|
|
546
|
+
if (direction === 'row' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowNumberColumn)) {
|
|
569
547
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
570
548
|
items: [createRowNumbersMenuItem()]
|
|
571
549
|
});
|
|
@@ -152,6 +152,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
152
152
|
}
|
|
153
153
|
return {
|
|
154
154
|
update: (view, prevState) => {
|
|
155
|
+
var _pluginInjectionApi$e3, _pluginInjectionApi$e4;
|
|
155
156
|
const {
|
|
156
157
|
state,
|
|
157
158
|
dispatch
|
|
@@ -161,31 +162,19 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
161
162
|
} = state;
|
|
162
163
|
const pluginState = getPluginState(state);
|
|
163
164
|
let tableRef;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
176
|
-
parent.querySelector('table') || undefined;
|
|
177
|
-
}
|
|
165
|
+
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
166
|
+
let shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.mode) !== 'view';
|
|
167
|
+
if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) && fg('platform_editor_update_table_ref_fix')) {
|
|
168
|
+
var _pluginInjectionApi$e5, _pluginInjectionApi$e6, _pluginInjectionApi$i, _pluginInjectionApi$i2;
|
|
169
|
+
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e5 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e5 === void 0 ? void 0 : (_pluginInjectionApi$e6 = _pluginInjectionApi$e5.sharedState.currentState()) === null || _pluginInjectionApi$e6 === void 0 ? void 0 : _pluginInjectionApi$e6.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
|
|
170
|
+
}
|
|
171
|
+
if (shouldSetTableRef) {
|
|
172
|
+
tableRef =
|
|
173
|
+
// Ignored via go/ees005
|
|
174
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
175
|
+
parent.querySelector('table') || undefined;
|
|
178
176
|
}
|
|
179
177
|
if (pluginState.editorHasFocus) {
|
|
180
|
-
if (!fg('platform_editor_enable_table_dnd')) {
|
|
181
|
-
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
182
|
-
if (parent) {
|
|
183
|
-
tableRef =
|
|
184
|
-
// Ignored via go/ees005
|
|
185
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
186
|
-
parent.querySelector('table') || undefined;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
178
|
const tableNode = findTable(state.selection);
|
|
190
179
|
// when keyboard cursor leaves the table we need to stop column resizing
|
|
191
180
|
const pluginPrevState = getPluginState(prevState);
|
|
@@ -16,7 +16,6 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
16
16
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
17
17
|
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
18
18
|
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
20
|
import { getClosestSelectionRect } from '../../ui/toolbar';
|
|
22
21
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands/commands-with-analytics';
|
|
@@ -287,7 +286,7 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
287
286
|
keymap: keymap && tooltip(keymap)
|
|
288
287
|
}))];
|
|
289
288
|
const allConfigs = [...restConfigs];
|
|
290
|
-
if (isColumnSortingEnabled
|
|
289
|
+
if (isColumnSortingEnabled) {
|
|
291
290
|
allConfigs.unshift(...sortConfigs);
|
|
292
291
|
}
|
|
293
292
|
return allConfigs.filter(Boolean);
|
|
@@ -21,7 +21,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
|
21
21
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
22
22
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
23
23
|
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
24
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
26
25
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
27
26
|
import Toggle from '@atlaskit/toggle';
|
|
@@ -376,23 +375,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
376
375
|
onChange: toggleHeaderRow,
|
|
377
376
|
isChecked: checkIfHeaderRowEnabled(selection)
|
|
378
377
|
}));
|
|
379
|
-
const createHeaderRowColumnMenuItemOld = direction => {
|
|
380
|
-
return direction === 'column' ? {
|
|
381
|
-
key: 'header_column',
|
|
382
|
-
content: formatMessage(messages.headerColumn),
|
|
383
|
-
value: {
|
|
384
|
-
name: 'header_column'
|
|
385
|
-
},
|
|
386
|
-
elemAfter: jsx(HeaderColumnToggle, null)
|
|
387
|
-
} : {
|
|
388
|
-
key: 'header_row',
|
|
389
|
-
content: formatMessage(messages.headerRow),
|
|
390
|
-
value: {
|
|
391
|
-
name: 'header_row'
|
|
392
|
-
},
|
|
393
|
-
elemAfter: jsx(HeaderRowToggle, null)
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
378
|
const createHeaderRowColumnMenuItem = direction => {
|
|
397
379
|
if (direction === 'column' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn)) {
|
|
398
380
|
return {
|
|
@@ -545,11 +527,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
545
527
|
// If first row, add toggle for Header row, default is true
|
|
546
528
|
// If first column, add toggle for Header column, default is false
|
|
547
529
|
if (index === 0) {
|
|
548
|
-
if (
|
|
549
|
-
menuItems.push({
|
|
550
|
-
items: [createHeaderRowColumnMenuItemOld(direction)]
|
|
551
|
-
});
|
|
552
|
-
} else if ((pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) && fg('platform_editor_enable_table_dnd')) {
|
|
530
|
+
if (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) {
|
|
553
531
|
const headerRowColumnMenuItem = createHeaderRowColumnMenuItem(direction);
|
|
554
532
|
headerRowColumnMenuItem && menuItems.push({
|
|
555
533
|
items: [headerRowColumnMenuItem]
|
|
@@ -558,7 +536,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
558
536
|
}
|
|
559
537
|
|
|
560
538
|
// All rows, add toggle for numbered rows, default is false
|
|
561
|
-
if (direction === 'row' && (
|
|
539
|
+
if (direction === 'row' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowNumberColumn)) {
|
|
562
540
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
563
541
|
items: [createRowNumbersMenuItem()]
|
|
564
542
|
});
|
|
@@ -158,36 +158,25 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
158
158
|
}
|
|
159
159
|
return {
|
|
160
160
|
update: function update(view, prevState) {
|
|
161
|
+
var _pluginInjectionApi$e2;
|
|
161
162
|
var state = view.state,
|
|
162
163
|
dispatch = view.dispatch;
|
|
163
164
|
var selection = state.selection;
|
|
164
165
|
var pluginState = getPluginState(state);
|
|
165
166
|
var tableRef;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
178
|
-
parent.querySelector('table') || undefined;
|
|
179
|
-
}
|
|
167
|
+
var parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
168
|
+
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
|
|
169
|
+
if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) && fg('platform_editor_update_table_ref_fix')) {
|
|
170
|
+
var _pluginInjectionApi$e3, _pluginInjectionApi$i;
|
|
171
|
+
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
172
|
+
}
|
|
173
|
+
if (shouldSetTableRef) {
|
|
174
|
+
tableRef =
|
|
175
|
+
// Ignored via go/ees005
|
|
176
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
177
|
+
parent.querySelector('table') || undefined;
|
|
180
178
|
}
|
|
181
179
|
if (pluginState.editorHasFocus) {
|
|
182
|
-
if (!fg('platform_editor_enable_table_dnd')) {
|
|
183
|
-
var _parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
184
|
-
if (_parent) {
|
|
185
|
-
tableRef =
|
|
186
|
-
// Ignored via go/ees005
|
|
187
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
188
|
-
_parent.querySelector('table') || undefined;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
180
|
var tableNode = findTable(state.selection);
|
|
192
181
|
// when keyboard cursor leaves the table we need to stop column resizing
|
|
193
182
|
var pluginPrevState = getPluginState(prevState);
|
|
@@ -17,7 +17,6 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
17
17
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
18
18
|
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
19
19
|
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
21
|
import { getClosestSelectionRect } from '../../ui/toolbar';
|
|
23
22
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands/commands-with-analytics';
|
|
@@ -332,7 +331,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
332
331
|
};
|
|
333
332
|
})));
|
|
334
333
|
var allConfigs = _toConsumableArray(restConfigs);
|
|
335
|
-
if (isColumnSortingEnabled
|
|
334
|
+
if (isColumnSortingEnabled) {
|
|
336
335
|
allConfigs.unshift.apply(allConfigs, _toConsumableArray(sortConfigs));
|
|
337
336
|
}
|
|
338
337
|
return allConfigs.filter(Boolean);
|
|
@@ -23,7 +23,6 @@ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
|
23
23
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
24
24
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
25
25
|
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
26
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
26
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
28
27
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
29
28
|
import Toggle from '@atlaskit/toggle';
|
|
@@ -377,23 +376,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
377
376
|
}))
|
|
378
377
|
);
|
|
379
378
|
};
|
|
380
|
-
var createHeaderRowColumnMenuItemOld = function createHeaderRowColumnMenuItemOld(direction) {
|
|
381
|
-
return direction === 'column' ? {
|
|
382
|
-
key: 'header_column',
|
|
383
|
-
content: formatMessage(messages.headerColumn),
|
|
384
|
-
value: {
|
|
385
|
-
name: 'header_column'
|
|
386
|
-
},
|
|
387
|
-
elemAfter: jsx(HeaderColumnToggle, null)
|
|
388
|
-
} : {
|
|
389
|
-
key: 'header_row',
|
|
390
|
-
content: formatMessage(messages.headerRow),
|
|
391
|
-
value: {
|
|
392
|
-
name: 'header_row'
|
|
393
|
-
},
|
|
394
|
-
elemAfter: jsx(HeaderRowToggle, null)
|
|
395
|
-
};
|
|
396
|
-
};
|
|
397
379
|
var createHeaderRowColumnMenuItem = function createHeaderRowColumnMenuItem(direction) {
|
|
398
380
|
if (direction === 'column' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn)) {
|
|
399
381
|
return {
|
|
@@ -541,11 +523,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
541
523
|
// If first row, add toggle for Header row, default is true
|
|
542
524
|
// If first column, add toggle for Header column, default is false
|
|
543
525
|
if (index === 0) {
|
|
544
|
-
if (
|
|
545
|
-
menuItems.push({
|
|
546
|
-
items: [createHeaderRowColumnMenuItemOld(direction)]
|
|
547
|
-
});
|
|
548
|
-
} else if ((pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) && fg('platform_editor_enable_table_dnd')) {
|
|
526
|
+
if (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderColumn || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowHeaderRow) {
|
|
549
527
|
var headerRowColumnMenuItem = createHeaderRowColumnMenuItem(direction);
|
|
550
528
|
headerRowColumnMenuItem && menuItems.push({
|
|
551
529
|
items: [headerRowColumnMenuItem]
|
|
@@ -554,7 +532,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
554
532
|
}
|
|
555
533
|
|
|
556
534
|
// All rows, add toggle for numbered rows, default is false
|
|
557
|
-
if (direction === 'row' && (
|
|
535
|
+
if (direction === 'row' && (pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.advanced || pluginConfig !== null && pluginConfig !== void 0 && pluginConfig.allowNumberColumn)) {
|
|
558
536
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
559
537
|
items: [createRowNumbersMenuItem()]
|
|
560
538
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "22.4.
|
|
3
|
+
"version": "22.4.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
51
51
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
52
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
52
|
+
"@atlaskit/editor-toolbar": "^1.3.0",
|
|
53
53
|
"@atlaskit/editor-ui-control-model": "^1.1.0",
|
|
54
54
|
"@atlaskit/icon": "^34.5.0",
|
|
55
55
|
"@atlaskit/insm": "^0.4.0",
|
|
@@ -152,9 +152,6 @@
|
|
|
152
152
|
"platform_editor_table_sticky_header_patch_8": {
|
|
153
153
|
"type": "boolean"
|
|
154
154
|
},
|
|
155
|
-
"platform_editor_enable_table_dnd": {
|
|
156
|
-
"type": "boolean"
|
|
157
|
-
},
|
|
158
155
|
"platform_editor_enable_table_scaling": {
|
|
159
156
|
"type": "boolean"
|
|
160
157
|
},
|
|
@@ -164,9 +161,6 @@
|
|
|
164
161
|
"platform_editor_enable_table_update_ref_atlas": {
|
|
165
162
|
"type": "boolean"
|
|
166
163
|
},
|
|
167
|
-
"platform_editor_enable_table_dnd_patch_1": {
|
|
168
|
-
"type": "boolean"
|
|
169
|
-
},
|
|
170
164
|
"platform_editor_update_table_ref_fix": {
|
|
171
165
|
"type": "boolean"
|
|
172
166
|
},
|