@atlaskit/editor-plugin-table 10.9.8 → 10.9.10

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
+ ## 10.9.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.9.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#144658](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144658)
14
+ [`e59e7f0ae0803`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e59e7f0ae0803) -
15
+ Change to use getDomRefFromSelection utility from editor-common
16
+ - Updated dependencies
17
+
3
18
  ## 10.9.8
4
19
 
5
20
  ### Patch Changes
@@ -201,36 +201,34 @@ var containsNonTableBlockChildren = function containsNonTableBlockChildren(fragm
201
201
  };
202
202
  var transformSliceToRemoveOpenTable = exports.transformSliceToRemoveOpenTable = function transformSliceToRemoveOpenTable(slice, schema) {
203
203
  var _slice$content$firstC4;
204
- if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_paste_wrap_fix')) {
205
- // Case 1: A slice of a block selection inside a nested table
206
- // Prosemirror wraps nested block selections in their respective tables
207
- // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
204
+ // Case 1: A slice of a block selection inside a nested table
205
+ // Prosemirror wraps nested block selections in their respective tables
206
+ // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
208
207
 
209
- // slice starts and ends inside a nested table at the same depth
210
- if (slice.openStart >= 7 && slice.openEnd >= 7) {
211
- var cleaned = slice;
212
- var descendedDepth = 0;
213
- var tableDepthDecrement = 2;
208
+ // slice starts and ends inside a nested table at the same depth
209
+ if (slice.openStart >= 7 && slice.openEnd >= 7) {
210
+ var cleaned = slice;
211
+ var descendedDepth = 0;
212
+ var tableDepthDecrement = 2;
214
213
 
215
- // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
216
- if (isFragmentSingleCellTable(slice.content, schema)) {
217
- var _slice$content$firstC2;
218
- (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 || _slice$content$firstC2.descendants(function (node) {
219
- if (isNodeSingleCellTable(node, schema)) {
220
- descendedDepth += tableDepthDecrement;
221
- } else if (node.type === schema.nodes.table) {
222
- return false;
223
- } else if (containsNonTableBlockChildren(node.content, schema)) {
224
- descendedDepth += tableDepthDecrement;
225
- // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
226
- cleaned = new _model.Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
227
- return false;
228
- }
229
- });
230
- }
231
- if (!cleaned.eq(slice)) {
232
- return cleaned;
233
- }
214
+ // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
215
+ if (isFragmentSingleCellTable(slice.content, schema)) {
216
+ var _slice$content$firstC2;
217
+ (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 || _slice$content$firstC2.descendants(function (node) {
218
+ if (isNodeSingleCellTable(node, schema)) {
219
+ descendedDepth += tableDepthDecrement;
220
+ } else if (node.type === schema.nodes.table) {
221
+ return false;
222
+ } else if (containsNonTableBlockChildren(node.content, schema)) {
223
+ descendedDepth += tableDepthDecrement;
224
+ // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
225
+ cleaned = new _model.Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
226
+ return false;
227
+ }
228
+ });
229
+ }
230
+ if (!cleaned.eq(slice)) {
231
+ return cleaned;
234
232
  }
235
233
  }
236
234
 
@@ -605,7 +605,7 @@ var tablePlugin = function tablePlugin(_ref) {
605
605
  api: api,
606
606
  isOpenedByKeyboard: false,
607
607
  popupsMountPoint: popupsMountPoint,
608
- target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : (0, _getDomRefFromSelection.getDomRefFromSelection)(editorView, _analytics.ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent),
608
+ target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : (0, _getDomRefFromSelection.getDomRefFromSelection)(editorView, _analytics.ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
609
609
  popupsBoundariesElement: popupsBoundariesElement,
610
610
  popupsScrollableElement: popupsScrollableElement
611
611
  }));
@@ -193,36 +193,34 @@ const containsNonTableBlockChildren = (fragment, schema) => {
193
193
  };
194
194
  export const transformSliceToRemoveOpenTable = (slice, schema) => {
195
195
  var _slice$content$firstC8;
196
- if (fg('platform_editor_nested_tables_paste_wrap_fix')) {
197
- // Case 1: A slice of a block selection inside a nested table
198
- // Prosemirror wraps nested block selections in their respective tables
199
- // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
196
+ // Case 1: A slice of a block selection inside a nested table
197
+ // Prosemirror wraps nested block selections in their respective tables
198
+ // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
200
199
 
201
- // slice starts and ends inside a nested table at the same depth
202
- if (slice.openStart >= 7 && slice.openEnd >= 7) {
203
- let cleaned = slice;
204
- let descendedDepth = 0;
205
- const tableDepthDecrement = 2;
200
+ // slice starts and ends inside a nested table at the same depth
201
+ if (slice.openStart >= 7 && slice.openEnd >= 7) {
202
+ let cleaned = slice;
203
+ let descendedDepth = 0;
204
+ const tableDepthDecrement = 2;
206
205
 
207
- // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
208
- if (isFragmentSingleCellTable(slice.content, schema)) {
209
- var _slice$content$firstC2;
210
- (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.descendants(node => {
211
- if (isNodeSingleCellTable(node, schema)) {
212
- descendedDepth += tableDepthDecrement;
213
- } else if (node.type === schema.nodes.table) {
214
- return false;
215
- } else if (containsNonTableBlockChildren(node.content, schema)) {
216
- descendedDepth += tableDepthDecrement;
217
- // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
218
- cleaned = new Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
219
- return false;
220
- }
221
- });
222
- }
223
- if (!cleaned.eq(slice)) {
224
- return cleaned;
225
- }
206
+ // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
207
+ if (isFragmentSingleCellTable(slice.content, schema)) {
208
+ var _slice$content$firstC2;
209
+ (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.descendants(node => {
210
+ if (isNodeSingleCellTable(node, schema)) {
211
+ descendedDepth += tableDepthDecrement;
212
+ } else if (node.type === schema.nodes.table) {
213
+ return false;
214
+ } else if (containsNonTableBlockChildren(node.content, schema)) {
215
+ descendedDepth += tableDepthDecrement;
216
+ // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
217
+ cleaned = new Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
218
+ return false;
219
+ }
220
+ });
221
+ }
222
+ if (!cleaned.eq(slice)) {
223
+ return cleaned;
226
224
  }
227
225
  }
228
226
 
@@ -599,7 +599,7 @@ const tablePlugin = ({
599
599
  api: api,
600
600
  isOpenedByKeyboard: false,
601
601
  popupsMountPoint: popupsMountPoint,
602
- target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent),
602
+ target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
603
603
  popupsBoundariesElement: popupsBoundariesElement,
604
604
  popupsScrollableElement: popupsScrollableElement
605
605
  }));
@@ -194,36 +194,34 @@ var containsNonTableBlockChildren = function containsNonTableBlockChildren(fragm
194
194
  };
195
195
  export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpenTable(slice, schema) {
196
196
  var _slice$content$firstC4;
197
- if (fg('platform_editor_nested_tables_paste_wrap_fix')) {
198
- // Case 1: A slice of a block selection inside a nested table
199
- // Prosemirror wraps nested block selections in their respective tables
200
- // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
197
+ // Case 1: A slice of a block selection inside a nested table
198
+ // Prosemirror wraps nested block selections in their respective tables
199
+ // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
201
200
 
202
- // slice starts and ends inside a nested table at the same depth
203
- if (slice.openStart >= 7 && slice.openEnd >= 7) {
204
- var cleaned = slice;
205
- var descendedDepth = 0;
206
- var tableDepthDecrement = 2;
201
+ // slice starts and ends inside a nested table at the same depth
202
+ if (slice.openStart >= 7 && slice.openEnd >= 7) {
203
+ var cleaned = slice;
204
+ var descendedDepth = 0;
205
+ var tableDepthDecrement = 2;
207
206
 
208
- // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
209
- if (isFragmentSingleCellTable(slice.content, schema)) {
210
- var _slice$content$firstC2;
211
- (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 || _slice$content$firstC2.descendants(function (node) {
212
- if (isNodeSingleCellTable(node, schema)) {
213
- descendedDepth += tableDepthDecrement;
214
- } else if (node.type === schema.nodes.table) {
215
- return false;
216
- } else if (containsNonTableBlockChildren(node.content, schema)) {
217
- descendedDepth += tableDepthDecrement;
218
- // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
219
- cleaned = new Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
220
- return false;
221
- }
222
- });
223
- }
224
- if (!cleaned.eq(slice)) {
225
- return cleaned;
226
- }
207
+ // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
208
+ if (isFragmentSingleCellTable(slice.content, schema)) {
209
+ var _slice$content$firstC2;
210
+ (_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 || _slice$content$firstC2.descendants(function (node) {
211
+ if (isNodeSingleCellTable(node, schema)) {
212
+ descendedDepth += tableDepthDecrement;
213
+ } else if (node.type === schema.nodes.table) {
214
+ return false;
215
+ } else if (containsNonTableBlockChildren(node.content, schema)) {
216
+ descendedDepth += tableDepthDecrement;
217
+ // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
218
+ cleaned = new Slice(node.content, slice.openStart - descendedDepth - tableDepthDecrement, slice.openEnd - descendedDepth - tableDepthDecrement);
219
+ return false;
220
+ }
221
+ });
222
+ }
223
+ if (!cleaned.eq(slice)) {
224
+ return cleaned;
227
225
  }
228
226
  }
229
227
 
@@ -596,7 +596,7 @@ var tablePlugin = function tablePlugin(_ref) {
596
596
  api: api,
597
597
  isOpenedByKeyboard: false,
598
598
  popupsMountPoint: popupsMountPoint,
599
- target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent),
599
+ target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
600
600
  popupsBoundariesElement: popupsBoundariesElement,
601
601
  popupsScrollableElement: popupsScrollableElement
602
602
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.9.8",
3
+ "version": "10.9.10",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,14 +32,14 @@
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.18.0",
35
+ "@atlaskit/editor-common": "^103.19.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",
39
39
  "@atlaskit/editor-plugin-batch-attribute-updates": "^2.1.0",
40
40
  "@atlaskit/editor-plugin-content-insertion": "^2.1.0",
41
41
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
42
- "@atlaskit/editor-plugin-extension": "5.3.0",
42
+ "@atlaskit/editor-plugin-extension": "5.3.1",
43
43
  "@atlaskit/editor-plugin-guideline": "^2.0.0",
44
44
  "@atlaskit/editor-plugin-selection": "^2.1.0",
45
45
  "@atlaskit/editor-plugin-width": "^3.0.0",
@@ -47,14 +47,14 @@
47
47
  "@atlaskit/editor-shared-styles": "^3.4.0",
48
48
  "@atlaskit/editor-tables": "^2.9.0",
49
49
  "@atlaskit/icon": "^25.6.0",
50
- "@atlaskit/menu": "^3.2.0",
50
+ "@atlaskit/menu": "^4.0.0",
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop": "^1.6.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
55
55
  "@atlaskit/primitives": "^14.4.0",
56
56
  "@atlaskit/theme": "^18.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^4.14.0",
57
+ "@atlaskit/tmp-editor-statsig": "^4.15.0",
58
58
  "@atlaskit/toggle": "^15.0.0",
59
59
  "@atlaskit/tokens": "^4.8.0",
60
60
  "@atlaskit/tooltip": "^20.0.0",
@@ -138,9 +138,6 @@
138
138
  "platform_editor_disable_table_lnv": {
139
139
  "type": "boolean"
140
140
  },
141
- "platform_editor_nested_tables_paste_wrap_fix": {
142
- "type": "boolean"
143
- },
144
141
  "nested_table_control_padding_with_css": {
145
142
  "type": "boolean"
146
143
  },
@@ -260,40 +260,38 @@ const containsNonTableBlockChildren = (fragment: Fragment, schema: Schema): bool
260
260
  };
261
261
 
262
262
  export const transformSliceToRemoveOpenTable = (slice: Slice, schema: Schema): Slice => {
263
- if (fg('platform_editor_nested_tables_paste_wrap_fix')) {
264
- // Case 1: A slice of a block selection inside a nested table
265
- // Prosemirror wraps nested block selections in their respective tables
266
- // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
267
-
268
- // slice starts and ends inside a nested table at the same depth
269
- if (slice.openStart >= 7 && slice.openEnd >= 7) {
270
- let cleaned = slice;
271
- let descendedDepth = 0;
272
- const tableDepthDecrement = 2;
273
-
274
- // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
275
- if (isFragmentSingleCellTable(slice.content, schema)) {
276
- slice.content.firstChild?.descendants((node) => {
277
- if (isNodeSingleCellTable(node, schema)) {
278
- descendedDepth += tableDepthDecrement;
279
- } else if (node.type === schema.nodes.table) {
280
- return false;
281
- } else if (containsNonTableBlockChildren(node.content, schema)) {
282
- descendedDepth += tableDepthDecrement;
283
- // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
284
- cleaned = new Slice(
285
- node.content,
286
- slice.openStart - descendedDepth - tableDepthDecrement,
287
- slice.openEnd - descendedDepth - tableDepthDecrement,
288
- );
289
- return false;
290
- }
291
- });
292
- }
263
+ // Case 1: A slice of a block selection inside a nested table
264
+ // Prosemirror wraps nested block selections in their respective tables
265
+ // We are using `safeInsert` to paste nested tables, so we do not want to preserve this wrapping
293
266
 
294
- if (!cleaned.eq(slice)) {
295
- return cleaned;
296
- }
267
+ // slice starts and ends inside a nested table at the same depth
268
+ if (slice.openStart >= 7 && slice.openEnd >= 7) {
269
+ let cleaned = slice;
270
+ let descendedDepth = 0;
271
+ const tableDepthDecrement = 2;
272
+
273
+ // if the slice is a single cell table and contains cells with single cell tables, descend into it until we find textblock children
274
+ if (isFragmentSingleCellTable(slice.content, schema)) {
275
+ slice.content.firstChild?.descendants((node) => {
276
+ if (isNodeSingleCellTable(node, schema)) {
277
+ descendedDepth += tableDepthDecrement;
278
+ } else if (node.type === schema.nodes.table) {
279
+ return false;
280
+ } else if (containsNonTableBlockChildren(node.content, schema)) {
281
+ descendedDepth += tableDepthDecrement;
282
+ // create a new slice with the content of non-table block children and the depth of the nested tables subtracted
283
+ cleaned = new Slice(
284
+ node.content,
285
+ slice.openStart - descendedDepth - tableDepthDecrement,
286
+ slice.openEnd - descendedDepth - tableDepthDecrement,
287
+ );
288
+ return false;
289
+ }
290
+ });
291
+ }
292
+
293
+ if (!cleaned.eq(slice)) {
294
+ return cleaned;
297
295
  }
298
296
  }
299
297
 
@@ -771,7 +771,7 @@ const tablePlugin: TablePlugin = ({ config: options, api }) => {
771
771
  getDomRefFromSelection(
772
772
  editorView,
773
773
  ACTION_SUBJECT_ID.PICKER_TABLE_SIZE,
774
- api?.analytics?.actions.fireAnalyticsEvent,
774
+ api?.analytics?.actions,
775
775
  )
776
776
  }
777
777
  popupsBoundariesElement={popupsBoundariesElement}