@atlaskit/editor-plugin-table 10.9.6 → 10.9.7
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 +8 -0
- package/dist/cjs/nodeviews/TableComponent.js +5 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/es2019/nodeviews/TableComponent.js +5 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/esm/nodeviews/TableComponent.js +5 -0
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/package.json +5 -2
- package/src/nodeviews/TableComponent.tsx +5 -0
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +5 -3
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.9.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146244](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146244)
|
|
8
|
+
[`a87bc29b0ab36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a87bc29b0ab36) -
|
|
9
|
+
[ED-27681] Fix a bug where resize table column and then resize table cannot be undone
|
|
10
|
+
|
|
3
11
|
## 10.9.6
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -254,6 +254,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
254
254
|
)(state.tr);
|
|
255
255
|
if (!isUserTriggered) {
|
|
256
256
|
(0, _collab.tintDirtyTransaction)(tr);
|
|
257
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_table_resizing_undo')) {
|
|
258
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
259
|
+
// as a consequence of another action
|
|
260
|
+
tr.setMeta('addToHistory', false);
|
|
261
|
+
}
|
|
257
262
|
}
|
|
258
263
|
dispatch(tr);
|
|
259
264
|
});
|
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _columnWidth = require("../../transforms/column-width");
|
|
14
15
|
var _nodes = require("../../utils/nodes");
|
|
15
16
|
var _misc = require("../utils/misc");
|
|
@@ -177,9 +178,9 @@ var scaleTable = exports.scaleTable = function scaleTable(tableRef, options, dom
|
|
|
177
178
|
}
|
|
178
179
|
if (resizeState) {
|
|
179
180
|
tr = (0, _columnWidth.updateColumnWidths)(resizeState, node, start, api)(tr);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_table_resizing_undo')) {
|
|
182
|
+
tr.setMeta('addToHistory', false);
|
|
183
|
+
}
|
|
183
184
|
if (tr.docChanged) {
|
|
184
185
|
tr.setMeta('scrollIntoView', false);
|
|
185
186
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -248,6 +248,11 @@ class TableComponent extends React.Component {
|
|
|
248
248
|
)(state.tr);
|
|
249
249
|
if (!isUserTriggered) {
|
|
250
250
|
tintDirtyTransaction(tr);
|
|
251
|
+
if (fg('platform_editor_fix_table_resizing_undo')) {
|
|
252
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
253
|
+
// as a consequence of another action
|
|
254
|
+
tr.setMeta('addToHistory', false);
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
257
|
dispatch(tr);
|
|
253
258
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
5
6
|
import { getTableWidth } from '../../utils/nodes';
|
|
6
7
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -163,9 +164,9 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
|
|
|
163
164
|
}
|
|
164
165
|
if (resizeState) {
|
|
165
166
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
168
|
+
tr.setMeta('addToHistory', false);
|
|
169
|
+
}
|
|
169
170
|
if (tr.docChanged) {
|
|
170
171
|
tr.setMeta('scrollIntoView', false);
|
|
171
172
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -248,6 +248,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
248
248
|
)(state.tr);
|
|
249
249
|
if (!isUserTriggered) {
|
|
250
250
|
tintDirtyTransaction(tr);
|
|
251
|
+
if (fg('platform_editor_fix_table_resizing_undo')) {
|
|
252
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
253
|
+
// as a consequence of another action
|
|
254
|
+
tr.setMeta('addToHistory', false);
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
257
|
dispatch(tr);
|
|
253
258
|
});
|
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
8
9
|
import { getTableWidth } from '../../utils/nodes';
|
|
9
10
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -169,9 +170,9 @@ export var scaleTable = function scaleTable(tableRef, options, domAtPos, api) {
|
|
|
169
170
|
}
|
|
170
171
|
if (resizeState) {
|
|
171
172
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
174
|
+
tr.setMeta('addToHistory', false);
|
|
175
|
+
}
|
|
175
176
|
if (tr.docChanged) {
|
|
176
177
|
tr.setMeta('scrollIntoView', false);
|
|
177
178
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.9.
|
|
3
|
+
"version": "10.9.7",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
33
|
"@atlaskit/button": "^23.0.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
|
-
"@atlaskit/editor-common": "^103.
|
|
35
|
+
"@atlaskit/editor-common": "^103.17.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
@@ -206,6 +206,9 @@
|
|
|
206
206
|
},
|
|
207
207
|
"platform_editor_controls_patch_6": {
|
|
208
208
|
"type": "boolean"
|
|
209
|
+
},
|
|
210
|
+
"platform_editor_fix_table_resizing_undo": {
|
|
211
|
+
"type": "boolean"
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
}
|
|
@@ -1308,6 +1308,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1308
1308
|
|
|
1309
1309
|
if (!isUserTriggered) {
|
|
1310
1310
|
tintDirtyTransaction(tr);
|
|
1311
|
+
if (fg('platform_editor_fix_table_resizing_undo')) {
|
|
1312
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
1313
|
+
// as a consequence of another action
|
|
1314
|
+
tr.setMeta('addToHistory', false);
|
|
1315
|
+
}
|
|
1311
1316
|
}
|
|
1312
1317
|
|
|
1313
1318
|
dispatch(tr);
|
|
@@ -4,6 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
|
|
8
9
|
import type { PluginInjectionAPI } from '../../../types';
|
|
9
10
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
@@ -267,9 +268,10 @@ export const scaleTable =
|
|
|
267
268
|
|
|
268
269
|
if (resizeState) {
|
|
269
270
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
|
|
272
|
+
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
273
|
+
tr.setMeta('addToHistory', false);
|
|
274
|
+
}
|
|
273
275
|
|
|
274
276
|
if (tr.docChanged) {
|
|
275
277
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -107,7 +107,7 @@ export const ColumnControls = ({
|
|
|
107
107
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
108
108
|
|
|
109
109
|
const rowControlStickyTop = 45;
|
|
110
|
-
const marginTop = hasHeaderRow && stickyTop !== undefined ?
|
|
110
|
+
const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop ?? 0 : 0;
|
|
111
111
|
|
|
112
112
|
const handleClick = useCallback(
|
|
113
113
|
(event: MouseEvent) => {
|
|
@@ -103,10 +103,10 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
103
103
|
const newPos =
|
|
104
104
|
selection.head > pos
|
|
105
105
|
? // Selection is after table
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
// nodeSize - 3 will move the position inside last table cell
|
|
107
|
+
Selection.near(doc.resolve(pos + ($pos.parent.nodeSize - 3)), -1)
|
|
108
108
|
: // Selection is before table
|
|
109
|
-
|
|
109
|
+
Selection.near($pos);
|
|
110
110
|
editorView.dispatch(tr.setSelection(newPos));
|
|
111
111
|
}
|
|
112
112
|
selectRow(index, event.shiftKey);
|