@atlaskit/editor-plugin-table 24.4.5 → 24.4.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 24.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 24.4.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`d86bd1324d82b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d86bd1324d82b) -
14
+ Fix table cell selection when moving a table with the keyboard shortcut behind the
15
+ `platform_editor_fix_table_move_shortcut` experiment.
16
+ - Updated dependencies
17
+
3
18
  ## 24.4.5
4
19
 
5
20
  ### Patch Changes
@@ -21,6 +21,7 @@ var _table = require("@atlaskit/editor-common/table");
21
21
  var _model = require("@atlaskit/editor-prosemirror/model");
22
22
  var _state = require("@atlaskit/editor-prosemirror/state");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
+ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
24
25
  var _tableMap = require("@atlaskit/editor-tables/table-map");
25
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -143,6 +144,10 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
143
144
 
144
145
  // Only proceed if we have both a node and table, and the table isn't already inside the node
145
146
  if (node && this.table && !node.contains(this.table)) {
147
+ // Patch to prevent selection collapsing when moving the table down with ctrl + shift + down
148
+ var selectionBeforeMove = this.view.state.selection;
149
+ var shouldPreserveCellSelection = (0, _expValEquals.expValEquals)('platform_editor_fix_table_move_shortcut', 'isEnabled', true) && selectionBeforeMove instanceof _cellSelection.CellSelection;
150
+
146
151
  // Store the current ignoreMutation handler so we can restore it later
147
152
  oldIgnoreMutation = this.ignoreMutation;
148
153
 
@@ -154,7 +159,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
154
159
  if (!isSelectionMutation) {
155
160
  mutationsIgnored = true;
156
161
  }
157
- return !isSelectionMutation;
162
+ return !isSelectionMutation || shouldPreserveCellSelection && _this2.view.state.selection.eq(selectionBeforeMove);
158
163
  };
159
164
 
160
165
  // Store the current selection state if there is a visible selection
@@ -7,6 +7,7 @@ import { isTableInContentMode } from '@atlaskit/editor-common/table';
7
7
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
8
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
10
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
10
11
  import { TableMap } from '@atlaskit/editor-tables/table-map';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -113,6 +114,10 @@ export default class TableView extends ReactNodeView {
113
114
 
114
115
  // Only proceed if we have both a node and table, and the table isn't already inside the node
115
116
  if (node && this.table && !node.contains(this.table)) {
117
+ // Patch to prevent selection collapsing when moving the table down with ctrl + shift + down
118
+ const selectionBeforeMove = this.view.state.selection;
119
+ const shouldPreserveCellSelection = expValEquals('platform_editor_fix_table_move_shortcut', 'isEnabled', true) && selectionBeforeMove instanceof CellSelection;
120
+
116
121
  // Store the current ignoreMutation handler so we can restore it later
117
122
  oldIgnoreMutation = this.ignoreMutation;
118
123
 
@@ -124,7 +129,7 @@ export default class TableView extends ReactNodeView {
124
129
  if (!isSelectionMutation) {
125
130
  mutationsIgnored = true;
126
131
  }
127
- return !isSelectionMutation;
132
+ return !isSelectionMutation || shouldPreserveCellSelection && this.view.state.selection.eq(selectionBeforeMove);
128
133
  };
129
134
 
130
135
  // Store the current selection state if there is a visible selection
@@ -17,6 +17,7 @@ import { isTableInContentMode } from '@atlaskit/editor-common/table';
17
17
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
18
18
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
19
19
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
20
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
20
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
21
22
  import { fg } from '@atlaskit/platform-feature-flags';
22
23
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -136,6 +137,10 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
136
137
 
137
138
  // Only proceed if we have both a node and table, and the table isn't already inside the node
138
139
  if (node && this.table && !node.contains(this.table)) {
140
+ // Patch to prevent selection collapsing when moving the table down with ctrl + shift + down
141
+ var selectionBeforeMove = this.view.state.selection;
142
+ var shouldPreserveCellSelection = expValEquals('platform_editor_fix_table_move_shortcut', 'isEnabled', true) && selectionBeforeMove instanceof CellSelection;
143
+
139
144
  // Store the current ignoreMutation handler so we can restore it later
140
145
  oldIgnoreMutation = this.ignoreMutation;
141
146
 
@@ -147,7 +152,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
147
152
  if (!isSelectionMutation) {
148
153
  mutationsIgnored = true;
149
154
  }
150
- return !isSelectionMutation;
155
+ return !isSelectionMutation || shouldPreserveCellSelection && _this2.view.state.selection.eq(selectionBeforeMove);
151
156
  };
152
157
 
153
158
  // Store the current selection state if there is a visible selection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "24.4.5",
3
+ "version": "24.4.7",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^12.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^12.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^14.0.0",
32
- "@atlaskit/editor-plugin-extension": "15.0.26",
32
+ "@atlaskit/editor-plugin-extension": "15.0.27",
33
33
  "@atlaskit/editor-plugin-guideline": "^12.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^22.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^9.0.0",
@@ -51,8 +51,8 @@
51
51
  "@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
54
- "@atlaskit/primitives": "^20.6.0",
55
- "@atlaskit/tmp-editor-statsig": "^125.0.0",
54
+ "@atlaskit/primitives": "^21.0.0",
55
+ "@atlaskit/tmp-editor-statsig": "^125.2.0",
56
56
  "@atlaskit/toggle": "^17.1.0",
57
57
  "@atlaskit/tokens": "^15.8.0",
58
58
  "@atlaskit/tooltip": "^23.1.0",