@atlaskit/editor-plugin-table 10.11.1 → 10.11.2
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 -0
- package/dist/cjs/pm-plugins/commands/delete.js +12 -0
- package/dist/cjs/pm-plugins/transforms/delete-rows.js +13 -0
- package/dist/es2019/pm-plugins/commands/delete.js +12 -0
- package/dist/es2019/pm-plugins/transforms/delete-rows.js +13 -0
- package/dist/esm/pm-plugins/commands/delete.js +12 -0
- package/dist/esm/pm-plugins/transforms/delete-rows.js +13 -0
- package/package.json +2 -2
- package/src/pm-plugins/commands/delete.ts +12 -0
- package/src/pm-plugins/transforms/delete-rows.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161309)
|
|
8
|
+
[`ec4edba1f5f2d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec4edba1f5f2d) -
|
|
9
|
+
Fix selection colour bug after deleting a column or row
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 10.11.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deleteColumnsCommand = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
var _pluginKey = require("../plugin-key");
|
|
7
9
|
var _deleteColumns = require("../transforms/delete-columns");
|
|
8
10
|
var _getAllowAddColumnCustomStep = require("../utils/get-allow-add-column-custom-step");
|
|
9
11
|
var deleteColumnsCommand = exports.deleteColumnsCommand = function deleteColumnsCommand(rect, api) {
|
|
@@ -13,6 +15,16 @@ var deleteColumnsCommand = exports.deleteColumnsCommand = function deleteColumns
|
|
|
13
15
|
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
14
16
|
return function (state, dispatch, view) {
|
|
15
17
|
var tr = (0, _deleteColumns.deleteColumns)(rect, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
18
|
+
// If we delete a column we should also clean up the hover selection
|
|
19
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
|
|
20
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
21
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
22
|
+
data: {
|
|
23
|
+
isInDanger: false,
|
|
24
|
+
isWholeTableInDanger: false
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
16
28
|
if (dispatch) {
|
|
17
29
|
dispatch(tr);
|
|
18
30
|
return true;
|
|
@@ -10,6 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _pluginKey = require("../plugin-key");
|
|
13
15
|
var _merge = require("./merge");
|
|
14
16
|
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; }
|
|
15
17
|
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) { (0, _defineProperty2.default)(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; }
|
|
@@ -116,6 +118,17 @@ var deleteRows = exports.deleteRows = function deleteRows(rect) {
|
|
|
116
118
|
return tr;
|
|
117
119
|
}
|
|
118
120
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
121
|
+
|
|
122
|
+
// If we delete a row we should also clean up the hover selection
|
|
123
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
|
|
124
|
+
tr.setMeta(_pluginKey.pluginKey, {
|
|
125
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
126
|
+
data: {
|
|
127
|
+
isInDanger: false,
|
|
128
|
+
isWholeTableInDanger: false
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
119
132
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
120
133
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
121
134
|
.setSelection(_state.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { pluginKey } from '../plugin-key';
|
|
1
3
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
2
4
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
3
5
|
export const deleteColumnsCommand = (rect, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
|
|
4
6
|
const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
7
|
+
// If we delete a column we should also clean up the hover selection
|
|
8
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
9
|
+
tr.setMeta(pluginKey, {
|
|
10
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
11
|
+
data: {
|
|
12
|
+
isInDanger: false,
|
|
13
|
+
isWholeTableInDanger: false
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
5
17
|
if (dispatch) {
|
|
6
18
|
dispatch(tr);
|
|
7
19
|
return true;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { pluginKey } from '../plugin-key';
|
|
4
6
|
import { mergeEmptyColumns } from './merge';
|
|
5
7
|
export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
6
8
|
const table = findTable(tr.selection);
|
|
@@ -97,6 +99,17 @@ export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
|
97
99
|
return tr;
|
|
98
100
|
}
|
|
99
101
|
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
102
|
+
|
|
103
|
+
// If we delete a row we should also clean up the hover selection
|
|
104
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
105
|
+
tr.setMeta(pluginKey, {
|
|
106
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
107
|
+
data: {
|
|
108
|
+
isInDanger: false,
|
|
109
|
+
isWholeTableInDanger: false
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
100
113
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
101
114
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
102
115
|
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { pluginKey } from '../plugin-key';
|
|
1
3
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
2
4
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
3
5
|
export var deleteColumnsCommand = function deleteColumnsCommand(rect, api) {
|
|
@@ -7,6 +9,16 @@ export var deleteColumnsCommand = function deleteColumnsCommand(rect, api) {
|
|
|
7
9
|
var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
8
10
|
return function (state, dispatch, view) {
|
|
9
11
|
var tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
|
|
12
|
+
// If we delete a column we should also clean up the hover selection
|
|
13
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
14
|
+
tr.setMeta(pluginKey, {
|
|
15
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
16
|
+
data: {
|
|
17
|
+
isInDanger: false,
|
|
18
|
+
isWholeTableInDanger: false
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
10
22
|
if (dispatch) {
|
|
11
23
|
dispatch(tr);
|
|
12
24
|
return true;
|
|
@@ -5,6 +5,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { pluginKey } from '../plugin-key';
|
|
8
10
|
import { mergeEmptyColumns } from './merge';
|
|
9
11
|
export var deleteRows = function deleteRows(rect) {
|
|
10
12
|
var isHeaderRowRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -109,6 +111,17 @@ export var deleteRows = function deleteRows(rect) {
|
|
|
109
111
|
return tr;
|
|
110
112
|
}
|
|
111
113
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
114
|
+
|
|
115
|
+
// If we delete a row we should also clean up the hover selection
|
|
116
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
117
|
+
tr.setMeta(pluginKey, {
|
|
118
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
119
|
+
data: {
|
|
120
|
+
isInDanger: false,
|
|
121
|
+
isWholeTableInDanger: false
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
112
125
|
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
113
126
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
114
127
|
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.11.
|
|
3
|
+
"version": "10.11.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@atlaskit/tmp-editor-statsig": "^5.1.0",
|
|
59
59
|
"@atlaskit/toggle": "^15.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^4.9.0",
|
|
61
|
-
"@atlaskit/tooltip": "^20.
|
|
61
|
+
"@atlaskit/tooltip": "^20.1.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
64
64
|
"classnames": "^2.2.5",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
|
|
4
5
|
import type { PluginInjectionAPI } from '../../types';
|
|
6
|
+
import { pluginKey } from '../plugin-key';
|
|
5
7
|
import { deleteColumns } from '../transforms/delete-columns';
|
|
6
8
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
7
9
|
|
|
@@ -25,6 +27,16 @@ export const deleteColumnsCommand =
|
|
|
25
27
|
shouldUseIncreasedScalingPercent,
|
|
26
28
|
isCommentEditor,
|
|
27
29
|
)(state.tr);
|
|
30
|
+
// If we delete a column we should also clean up the hover selection
|
|
31
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
32
|
+
tr.setMeta(pluginKey, {
|
|
33
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
34
|
+
data: {
|
|
35
|
+
isInDanger: false,
|
|
36
|
+
isWholeTableInDanger: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
28
40
|
if (dispatch) {
|
|
29
41
|
dispatch(tr);
|
|
30
42
|
return true;
|
|
@@ -5,6 +5,9 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
|
|
10
|
+
import { pluginKey } from '../plugin-key';
|
|
8
11
|
|
|
9
12
|
import { mergeEmptyColumns } from './merge';
|
|
10
13
|
|
|
@@ -127,6 +130,17 @@ export const deleteRows =
|
|
|
127
130
|
}
|
|
128
131
|
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
129
132
|
|
|
133
|
+
// If we delete a row we should also clean up the hover selection
|
|
134
|
+
if (fg('platform_editor_remove_slow_table_transactions')) {
|
|
135
|
+
tr.setMeta(pluginKey, {
|
|
136
|
+
type: 'CLEAR_HOVER_SELECTION',
|
|
137
|
+
data: {
|
|
138
|
+
isInDanger: false,
|
|
139
|
+
isWholeTableInDanger: false,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
return (
|
|
131
145
|
tr
|
|
132
146
|
.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|