@atlaskit/editor-plugin-table 8.3.0 → 8.4.0

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,19 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 8.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#168172](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168172)
8
+ [`fa404ae4155f2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fa404ae4155f2) -
9
+ [ux] [ED-25523] This change is adding experiment based gating to the drag and drop logic for
10
+ nested tables. We only allow nesting tables one level deep via drag and drop if the experiment is
11
+ active. Else, you cannot drag and drop a table into another table.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 8.3.0
4
18
 
5
19
  ### Minor Changes
@@ -280,8 +280,8 @@ var insertTableWithNestingSupport = exports.insertTableWithNestingSupport = func
280
280
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
281
281
  if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
282
282
  exposure: true
283
- }) || (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(tr.selection) > 1) {
284
- var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(schema.nodes.table)(tr.selection);
283
+ }) || (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(tr.selection.$from) > 1) {
284
+ var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(schema.nodes.table)(tr.selection.$from);
285
285
  if (!positionAfterTopTable) {
286
286
  return tr;
287
287
  }
@@ -569,9 +569,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
569
569
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
570
570
  if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
571
571
  exposure: true
572
- }) || (0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection) > 1) {
572
+ }) || (0, _nesting.getParentOfTypeCount)(state.schema.nodes.table)(state.selection.$from) > 1) {
573
573
  // Nesting is too deep insert table after the top parent table
574
- var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(state.schema.nodes.table)(state.selection);
574
+ var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(state.schema.nodes.table)(state.selection.$from);
575
575
  tr = (0, _utils.safeInsert)(tableNode, positionAfterTopTable)(tr);
576
576
  tr.scrollIntoView();
577
577
  } else {
@@ -240,8 +240,8 @@ export const insertTableWithNestingSupport = ({
240
240
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
241
241
  if (editorExperiment('nested-tables-in-tables', false, {
242
242
  exposure: true
243
- }) || getParentOfTypeCount(schema.nodes.table)(tr.selection) > 1) {
244
- const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(tr.selection);
243
+ }) || getParentOfTypeCount(schema.nodes.table)(tr.selection.$from) > 1) {
244
+ const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(tr.selection.$from);
245
245
  if (!positionAfterTopTable) {
246
246
  return tr;
247
247
  }
@@ -564,9 +564,9 @@ const tablesPlugin = ({
564
564
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
565
565
  if (editorExperiment('nested-tables-in-tables', false, {
566
566
  exposure: true
567
- }) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
567
+ }) || getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1) {
568
568
  // Nesting is too deep insert table after the top parent table
569
- const positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
569
+ const positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection.$from);
570
570
  tr = safeInsert(tableNode, positionAfterTopTable)(tr);
571
571
  tr.scrollIntoView();
572
572
  } else {
@@ -272,8 +272,8 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
272
272
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
273
273
  if (editorExperiment('nested-tables-in-tables', false, {
274
274
  exposure: true
275
- }) || getParentOfTypeCount(schema.nodes.table)(tr.selection) > 1) {
276
- var positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(tr.selection);
275
+ }) || getParentOfTypeCount(schema.nodes.table)(tr.selection.$from) > 1) {
276
+ var positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(tr.selection.$from);
277
277
  if (!positionAfterTopTable) {
278
278
  return tr;
279
279
  }
@@ -562,9 +562,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
562
562
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
563
563
  if (editorExperiment('nested-tables-in-tables', false, {
564
564
  exposure: true
565
- }) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
565
+ }) || getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1) {
566
566
  // Nesting is too deep insert table after the top parent table
567
- var positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
567
+ var positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection.$from);
568
568
  tr = safeInsert(tableNode, positionAfterTopTable)(tr);
569
569
  tr.scrollIntoView();
570
570
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^46.1.0",
31
31
  "@atlaskit/button": "^20.3.0",
32
32
  "@atlaskit/custom-steps": "^0.9.0",
33
- "@atlaskit/editor-common": "^95.10.0",
33
+ "@atlaskit/editor-common": "^95.11.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
@@ -397,10 +397,10 @@ export const insertTableWithNestingSupport: InsertTableWithNestingSupportCommand
397
397
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
398
398
  if (
399
399
  editorExperiment('nested-tables-in-tables', false, { exposure: true }) ||
400
- getParentOfTypeCount(schema.nodes.table)(tr.selection) > 1
400
+ getParentOfTypeCount(schema.nodes.table)(tr.selection.$from) > 1
401
401
  ) {
402
402
  const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(
403
- tr.selection,
403
+ tr.selection.$from,
404
404
  );
405
405
  if (!positionAfterTopTable) {
406
406
  return tr;
package/src/plugin.tsx CHANGED
@@ -805,12 +805,12 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
805
805
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
806
806
  if (
807
807
  editorExperiment('nested-tables-in-tables', false, { exposure: true }) ||
808
- getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1
808
+ getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1
809
809
  ) {
810
810
  // Nesting is too deep insert table after the top parent table
811
811
  const positionAfterTopTable = getPositionAfterTopParentNodeOfType(
812
812
  state.schema.nodes.table,
813
- )(state.selection);
813
+ )(state.selection.$from);
814
814
  tr = safeInsert(tableNode, positionAfterTopTable)(tr);
815
815
  tr.scrollIntoView();
816
816
  } else {