@atlaskit/editor-plugin-expand 2.7.0 → 2.7.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 2.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#141778](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141778)
8
+ [`1c6f578277694`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1c6f578277694) -
9
+ ED-24870 & ED-24864 - Add the logic to gate the nested media in quotes functionality behind the
10
+ nest-media-and-codeblock-in-quote experiment. Also adjust the logic so the nested expands are now
11
+ behind the nested-expand-in-expand experiment.
12
+
13
+ ## 2.7.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#142108](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142108)
18
+ [`a1776d86877fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a1776d86877fe) -
19
+ ED-24864 ED-24931 Add logic to handle dragging expands inside and outside of eachother, converting
20
+ them to and from nested expands when required. Also add experiment gating for nested-dnd.
21
+
3
22
  ## 2.7.0
4
23
 
5
24
  ### Minor Changes
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.containsClass = containsClass;
8
8
  exports.createPlugin = void 0;
9
- exports.handleDraggingOfNestedExpand = handleDraggingOfNestedExpand;
9
+ exports.handleExpandDrag = handleExpandDrag;
10
10
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
11
  var _selection = require("@atlaskit/editor-common/selection");
12
12
  var _styles = require("@atlaskit/editor-common/styles");
13
13
  var _utils = require("@atlaskit/editor-prosemirror/utils");
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
15
16
  var _commands = require("../commands");
16
17
  var _nodeviews = _interopRequireDefault(require("../nodeviews"));
17
18
  var _utils2 = require("../utils");
@@ -64,7 +65,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
64
65
  }),
65
66
  handleDrop: function handleDrop(view, event, slice, moved) {
66
67
  if ((0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_drag_fix')) {
67
- return handleDraggingOfNestedExpand(view, event, slice);
68
+ return handleExpandDrag(view, event, slice);
68
69
  }
69
70
  return false;
70
71
  }
@@ -96,20 +97,28 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
96
97
  };
97
98
 
98
99
  /**
99
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
100
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
100
101
  */
101
- function handleDraggingOfNestedExpand(view, event, slice) {
102
- var _slice$content$firstC;
102
+ function handleExpandDrag(view, event, slice) {
103
103
  var state = view.state,
104
104
  dispatch = view.dispatch;
105
105
  var tr = state.tr;
106
106
  var selection = state.selection;
107
107
  var from = selection.from,
108
108
  to = selection.to;
109
- var supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
109
+ var sliceContainsExpand = false;
110
+ var sliceContainsNestedExpand = false;
111
+ slice.content.forEach(function (node) {
112
+ if (node.type === state.schema.nodes.expand) {
113
+ sliceContainsExpand = true;
114
+ } else if (node.type === state.schema.nodes.nestedExpand) {
115
+ sliceContainsNestedExpand = true;
116
+ }
117
+ });
110
118
 
111
- // Check if the contents of the dragged slice contain a nested expand node.
112
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
119
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
120
+ // Also not handling expands with nested expands for now.
121
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
113
122
  return false;
114
123
  }
115
124
  var dropPos = view.posAtCoords({
@@ -120,22 +129,34 @@ function handleDraggingOfNestedExpand(view, event, slice) {
120
129
  return false;
121
130
  }
122
131
  var resolvedPos = state.doc.resolve(dropPos.pos);
123
-
124
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
125
- if (resolvedPos.depth > 1) {
126
- var parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
127
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
128
- if (!supportedDropLocations.includes(parentNodeType)) {
129
- return false;
132
+ var dropLocationNodeType = resolvedPos.node().type;
133
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
134
+ var nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
135
+ var isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
136
+ if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
137
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
138
+ event.preventDefault();
139
+ return true;
130
140
  }
131
141
  }
132
- var updatedSlice = (0, _utils2.transformSliceNestedExpandToExpand)(slice, state.schema);
133
- if (updatedSlice.eq(slice)) {
142
+ var updatedSlice = slice;
143
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
144
+ updatedSlice = (0, _utils2.transformSliceExpandToNestedExpand)(slice);
145
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
146
+ updatedSlice = (0, _utils2.transformSliceNestedExpandToExpand)(slice, state.schema);
147
+ }
148
+ if (!updatedSlice || updatedSlice.eq(slice)) {
134
149
  return false;
135
150
  }
136
151
 
137
152
  // The drop position will be affected when the original slice is deleted from the document.
138
153
  var updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
154
+
155
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
156
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
157
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
158
+ updatedDropPos = updatedDropPos - 1;
159
+ }
139
160
  tr.delete(from, to);
140
161
  tr.insert(updatedDropPos, updatedSlice.content);
141
162
  dispatch(tr);
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "findExpand", {
9
9
  return _transforms.findExpand;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "transformSliceExpandToNestedExpand", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _transforms.transformSliceExpandToNestedExpand;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "transformSliceNestedExpandToExpand", {
13
19
  enumerable: true,
14
20
  get: function get() {
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.containsClass = containsClass;
8
8
  exports.createPlugin = void 0;
9
- exports.handleDraggingOfNestedExpand = handleDraggingOfNestedExpand;
9
+ exports.handleExpandDrag = handleExpandDrag;
10
10
  exports.pluginKey = void 0;
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _selection = require("@atlaskit/editor-common/selection");
13
13
  var _styles = require("@atlaskit/editor-common/styles");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
17
  var _nodeViews = _interopRequireDefault(require("../node-views"));
17
18
  var _utils = require("../utils");
18
19
  var pluginKey = exports.pluginKey = new _state.PluginKey('expandPlugin');
@@ -62,7 +63,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
62
63
  }),
63
64
  handleDrop: function handleDrop(view, event, slice, moved) {
64
65
  if ((0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_drag_fix')) {
65
- return handleDraggingOfNestedExpand(view, event, slice);
66
+ return handleExpandDrag(view, event, slice);
66
67
  }
67
68
  return false;
68
69
  }
@@ -78,20 +79,28 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
78
79
  };
79
80
 
80
81
  /**
81
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
82
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
82
83
  */
83
- function handleDraggingOfNestedExpand(view, event, slice) {
84
- var _slice$content$firstC;
84
+ function handleExpandDrag(view, event, slice) {
85
85
  var state = view.state,
86
86
  dispatch = view.dispatch;
87
87
  var tr = state.tr;
88
88
  var selection = state.selection;
89
89
  var from = selection.from,
90
90
  to = selection.to;
91
- var supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
91
+ var sliceContainsExpand = false;
92
+ var sliceContainsNestedExpand = false;
93
+ slice.content.forEach(function (node) {
94
+ if (node.type === state.schema.nodes.expand) {
95
+ sliceContainsExpand = true;
96
+ } else if (node.type === state.schema.nodes.nestedExpand) {
97
+ sliceContainsNestedExpand = true;
98
+ }
99
+ });
92
100
 
93
- // Check if the contents of the dragged slice contain a nested expand node.
94
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
101
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
102
+ // Also not handling expands with nested expands for now.
103
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
95
104
  return false;
96
105
  }
97
106
  var dropPos = view.posAtCoords({
@@ -102,22 +111,34 @@ function handleDraggingOfNestedExpand(view, event, slice) {
102
111
  return false;
103
112
  }
104
113
  var resolvedPos = state.doc.resolve(dropPos.pos);
105
-
106
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
107
- if (resolvedPos.depth > 1) {
108
- var parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
109
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
110
- if (!supportedDropLocations.includes(parentNodeType)) {
111
- return false;
114
+ var dropLocationNodeType = resolvedPos.node().type;
115
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
116
+ var nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
117
+ var isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
118
+ if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
119
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
120
+ event.preventDefault();
121
+ return true;
112
122
  }
113
123
  }
114
- var updatedSlice = (0, _utils.transformSliceNestedExpandToExpand)(slice, state.schema);
115
- if (updatedSlice.eq(slice)) {
124
+ var updatedSlice = slice;
125
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
126
+ updatedSlice = (0, _utils.transformSliceExpandToNestedExpand)(slice);
127
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
128
+ updatedSlice = (0, _utils.transformSliceNestedExpandToExpand)(slice, state.schema);
129
+ }
130
+ if (!updatedSlice || updatedSlice.eq(slice)) {
116
131
  return false;
117
132
  }
118
133
 
119
134
  // The drop position will be affected when the original slice is deleted from the document.
120
135
  var updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
136
+
137
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
138
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
139
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
140
+ updatedDropPos = updatedDropPos - 1;
141
+ }
121
142
  tr.delete(from, to);
122
143
  tr.insert(updatedDropPos, updatedSlice.content);
123
144
  dispatch(tr);
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "findExpand", {
10
10
  }
11
11
  });
12
12
  exports.findParentExpandNode = void 0;
13
+ Object.defineProperty(exports, "transformSliceExpandToNestedExpand", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _transforms.transformSliceExpandToNestedExpand;
17
+ }
18
+ });
13
19
  Object.defineProperty(exports, "transformSliceNestedExpandToExpand", {
14
20
  enumerable: true,
15
21
  get: function get() {
@@ -3,9 +3,10 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
3
3
  import { expandClassNames } from '@atlaskit/editor-common/styles';
4
4
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import { setExpandRef } from '../commands';
7
8
  import ExpandNodeView from '../nodeviews';
8
- import { findExpand, transformSliceNestedExpandToExpand } from '../utils';
9
+ import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
9
10
  import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
10
11
  export function containsClass(element, className) {
11
12
  var _element$classList;
@@ -48,7 +49,7 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
48
49
  }),
49
50
  handleDrop(view, event, slice, moved) {
50
51
  if (fg('platform_editor_nest_nested_expand_drag_fix')) {
51
- return handleDraggingOfNestedExpand(view, event, slice);
52
+ return handleExpandDrag(view, event, slice);
52
53
  }
53
54
  return false;
54
55
  }
@@ -82,10 +83,9 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
82
83
  };
83
84
 
84
85
  /**
85
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
86
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
86
87
  */
87
- export function handleDraggingOfNestedExpand(view, event, slice) {
88
- var _slice$content$firstC;
88
+ export function handleExpandDrag(view, event, slice) {
89
89
  const {
90
90
  state,
91
91
  dispatch
@@ -98,13 +98,22 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
98
98
  from,
99
99
  to
100
100
  } = selection;
101
- const supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
101
+ let sliceContainsExpand = false;
102
+ let sliceContainsNestedExpand = false;
103
+ slice.content.forEach(node => {
104
+ if (node.type === state.schema.nodes.expand) {
105
+ sliceContainsExpand = true;
106
+ } else if (node.type === state.schema.nodes.nestedExpand) {
107
+ sliceContainsNestedExpand = true;
108
+ }
109
+ });
102
110
 
103
- // Check if the contents of the dragged slice contain a nested expand node.
104
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
111
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
112
+ // Also not handling expands with nested expands for now.
113
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
105
114
  return false;
106
115
  }
107
- const dropPos = view.posAtCoords({
116
+ let dropPos = view.posAtCoords({
108
117
  left: event.clientX,
109
118
  top: event.clientY
110
119
  });
@@ -112,22 +121,34 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
112
121
  return false;
113
122
  }
114
123
  const resolvedPos = state.doc.resolve(dropPos.pos);
115
-
116
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
117
- if (resolvedPos.depth > 1) {
118
- const parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
119
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
120
- if (!supportedDropLocations.includes(parentNodeType)) {
121
- return false;
124
+ const dropLocationNodeType = resolvedPos.node().type;
125
+ const dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
126
+ const nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
127
+ const isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
128
+ if (editorExperiment('nested-expand-in-expand', false)) {
129
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
130
+ event.preventDefault();
131
+ return true;
122
132
  }
123
133
  }
124
- const updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
125
- if (updatedSlice.eq(slice)) {
134
+ let updatedSlice = slice;
135
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
136
+ updatedSlice = transformSliceExpandToNestedExpand(slice);
137
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
138
+ updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
139
+ }
140
+ if (!updatedSlice || updatedSlice.eq(slice)) {
126
141
  return false;
127
142
  }
128
143
 
129
144
  // The drop position will be affected when the original slice is deleted from the document.
130
- const updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
145
+ let updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
146
+
147
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
148
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
149
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
150
+ updatedDropPos = updatedDropPos - 1;
151
+ }
131
152
  tr.delete(from, to);
132
153
  tr.insert(updatedDropPos, updatedSlice.content);
133
154
  dispatch(tr);
@@ -1 +1 @@
1
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
1
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
@@ -3,8 +3,9 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
3
3
  import { expandClassNames } from '@atlaskit/editor-common/styles';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import ExpandNodeView from '../node-views';
7
- import { transformSliceNestedExpandToExpand } from '../utils';
8
+ import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
8
9
  export const pluginKey = new PluginKey('expandPlugin');
9
10
  export function containsClass(element, className) {
10
11
  var _element$classList;
@@ -45,7 +46,7 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
45
46
  }),
46
47
  handleDrop(view, event, slice, moved) {
47
48
  if (fg('platform_editor_nest_nested_expand_drag_fix')) {
48
- return handleDraggingOfNestedExpand(view, event, slice);
49
+ return handleExpandDrag(view, event, slice);
49
50
  }
50
51
  return false;
51
52
  }
@@ -61,10 +62,9 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
61
62
  };
62
63
 
63
64
  /**
64
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
65
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
65
66
  */
66
- export function handleDraggingOfNestedExpand(view, event, slice) {
67
- var _slice$content$firstC;
67
+ export function handleExpandDrag(view, event, slice) {
68
68
  const {
69
69
  state,
70
70
  dispatch
@@ -77,13 +77,22 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
77
77
  from,
78
78
  to
79
79
  } = selection;
80
- const supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
80
+ let sliceContainsExpand = false;
81
+ let sliceContainsNestedExpand = false;
82
+ slice.content.forEach(node => {
83
+ if (node.type === state.schema.nodes.expand) {
84
+ sliceContainsExpand = true;
85
+ } else if (node.type === state.schema.nodes.nestedExpand) {
86
+ sliceContainsNestedExpand = true;
87
+ }
88
+ });
81
89
 
82
- // Check if the contents of the dragged slice contain a nested expand node.
83
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
90
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
91
+ // Also not handling expands with nested expands for now.
92
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
84
93
  return false;
85
94
  }
86
- const dropPos = view.posAtCoords({
95
+ let dropPos = view.posAtCoords({
87
96
  left: event.clientX,
88
97
  top: event.clientY
89
98
  });
@@ -91,22 +100,34 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
91
100
  return false;
92
101
  }
93
102
  const resolvedPos = state.doc.resolve(dropPos.pos);
94
-
95
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
96
- if (resolvedPos.depth > 1) {
97
- const parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
98
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
99
- if (!supportedDropLocations.includes(parentNodeType)) {
100
- return false;
103
+ const dropLocationNodeType = resolvedPos.node().type;
104
+ const dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
105
+ const nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
106
+ const isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
107
+ if (editorExperiment('nested-expand-in-expand', false)) {
108
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
109
+ event.preventDefault();
110
+ return true;
101
111
  }
102
112
  }
103
- const updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
104
- if (updatedSlice.eq(slice)) {
113
+ let updatedSlice = slice;
114
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
115
+ updatedSlice = transformSliceExpandToNestedExpand(slice);
116
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
117
+ updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
118
+ }
119
+ if (!updatedSlice || updatedSlice.eq(slice)) {
105
120
  return false;
106
121
  }
107
122
 
108
123
  // The drop position will be affected when the original slice is deleted from the document.
109
- const updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
124
+ let updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
125
+
126
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
127
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
128
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
129
+ updatedDropPos = updatedDropPos - 1;
130
+ }
110
131
  tr.delete(from, to);
111
132
  tr.insert(updatedDropPos, updatedSlice.content);
112
133
  dispatch(tr);
@@ -1,5 +1,5 @@
1
1
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
3
3
  export const findParentExpandNode = state => {
4
4
  return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
5
5
  };
@@ -3,9 +3,10 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
3
3
  import { expandClassNames } from '@atlaskit/editor-common/styles';
4
4
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import { setExpandRef } from '../commands';
7
8
  import ExpandNodeView from '../nodeviews';
8
- import { findExpand, transformSliceNestedExpandToExpand } from '../utils';
9
+ import { findExpand, transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
9
10
  import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
10
11
  export function containsClass(element, className) {
11
12
  var _element$classList;
@@ -55,7 +56,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
55
56
  }),
56
57
  handleDrop: function handleDrop(view, event, slice, moved) {
57
58
  if (fg('platform_editor_nest_nested_expand_drag_fix')) {
58
- return handleDraggingOfNestedExpand(view, event, slice);
59
+ return handleExpandDrag(view, event, slice);
59
60
  }
60
61
  return false;
61
62
  }
@@ -87,20 +88,28 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
87
88
  };
88
89
 
89
90
  /**
90
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
91
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
91
92
  */
92
- export function handleDraggingOfNestedExpand(view, event, slice) {
93
- var _slice$content$firstC;
93
+ export function handleExpandDrag(view, event, slice) {
94
94
  var state = view.state,
95
95
  dispatch = view.dispatch;
96
96
  var tr = state.tr;
97
97
  var selection = state.selection;
98
98
  var from = selection.from,
99
99
  to = selection.to;
100
- var supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
100
+ var sliceContainsExpand = false;
101
+ var sliceContainsNestedExpand = false;
102
+ slice.content.forEach(function (node) {
103
+ if (node.type === state.schema.nodes.expand) {
104
+ sliceContainsExpand = true;
105
+ } else if (node.type === state.schema.nodes.nestedExpand) {
106
+ sliceContainsNestedExpand = true;
107
+ }
108
+ });
101
109
 
102
- // Check if the contents of the dragged slice contain a nested expand node.
103
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
110
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
111
+ // Also not handling expands with nested expands for now.
112
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
104
113
  return false;
105
114
  }
106
115
  var dropPos = view.posAtCoords({
@@ -111,22 +120,34 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
111
120
  return false;
112
121
  }
113
122
  var resolvedPos = state.doc.resolve(dropPos.pos);
114
-
115
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
116
- if (resolvedPos.depth > 1) {
117
- var parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
118
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
119
- if (!supportedDropLocations.includes(parentNodeType)) {
120
- return false;
123
+ var dropLocationNodeType = resolvedPos.node().type;
124
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
125
+ var nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
126
+ var isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
127
+ if (editorExperiment('nested-expand-in-expand', false)) {
128
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
129
+ event.preventDefault();
130
+ return true;
121
131
  }
122
132
  }
123
- var updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
124
- if (updatedSlice.eq(slice)) {
133
+ var updatedSlice = slice;
134
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
135
+ updatedSlice = transformSliceExpandToNestedExpand(slice);
136
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
137
+ updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
138
+ }
139
+ if (!updatedSlice || updatedSlice.eq(slice)) {
125
140
  return false;
126
141
  }
127
142
 
128
143
  // The drop position will be affected when the original slice is deleted from the document.
129
144
  var updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
145
+
146
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
147
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
148
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
149
+ updatedDropPos = updatedDropPos - 1;
150
+ }
130
151
  tr.delete(from, to);
131
152
  tr.insert(updatedDropPos, updatedSlice.content);
132
153
  dispatch(tr);
@@ -1 +1 @@
1
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
1
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
@@ -3,8 +3,9 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
3
3
  import { expandClassNames } from '@atlaskit/editor-common/styles';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
7
  import ExpandNodeView from '../node-views';
7
- import { transformSliceNestedExpandToExpand } from '../utils';
8
+ import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '../utils';
8
9
  export var pluginKey = new PluginKey('expandPlugin');
9
10
  export function containsClass(element, className) {
10
11
  var _element$classList;
@@ -52,7 +53,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
52
53
  }),
53
54
  handleDrop: function handleDrop(view, event, slice, moved) {
54
55
  if (fg('platform_editor_nest_nested_expand_drag_fix')) {
55
- return handleDraggingOfNestedExpand(view, event, slice);
56
+ return handleExpandDrag(view, event, slice);
56
57
  }
57
58
  return false;
58
59
  }
@@ -68,20 +69,28 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
68
69
  };
69
70
 
70
71
  /**
71
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
72
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
72
73
  */
73
- export function handleDraggingOfNestedExpand(view, event, slice) {
74
- var _slice$content$firstC;
74
+ export function handleExpandDrag(view, event, slice) {
75
75
  var state = view.state,
76
76
  dispatch = view.dispatch;
77
77
  var tr = state.tr;
78
78
  var selection = state.selection;
79
79
  var from = selection.from,
80
80
  to = selection.to;
81
- var supportedDropLocations = [state.schema.nodes.doc, state.schema.nodes.layoutSection, state.schema.nodes.layoutColumn];
81
+ var sliceContainsExpand = false;
82
+ var sliceContainsNestedExpand = false;
83
+ slice.content.forEach(function (node) {
84
+ if (node.type === state.schema.nodes.expand) {
85
+ sliceContainsExpand = true;
86
+ } else if (node.type === state.schema.nodes.nestedExpand) {
87
+ sliceContainsNestedExpand = true;
88
+ }
89
+ });
82
90
 
83
- // Check if the contents of the dragged slice contain a nested expand node.
84
- if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) !== state.schema.nodes.nestedExpand) {
91
+ // Check if the contents of the dragged slice contain a nested expand node or expand node.
92
+ // Also not handling expands with nested expands for now.
93
+ if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
85
94
  return false;
86
95
  }
87
96
  var dropPos = view.posAtCoords({
@@ -92,22 +101,34 @@ export function handleDraggingOfNestedExpand(view, event, slice) {
92
101
  return false;
93
102
  }
94
103
  var resolvedPos = state.doc.resolve(dropPos.pos);
95
-
96
- // If not dropping into the root of the document, check if the parent node type of the drop location is supported.
97
- if (resolvedPos.depth > 1) {
98
- var parentNodeType = resolvedPos.node(resolvedPos.depth - 1).type;
99
- // If you're not dropping into a doc or layoutSection, don't transform the nested expand, return false and allow default behaviour.
100
- if (!supportedDropLocations.includes(parentNodeType)) {
101
- return false;
104
+ var dropLocationNodeType = resolvedPos.node().type;
105
+ var dropLocationParentNodeType = resolvedPos.depth > 0 ? resolvedPos.node(resolvedPos.depth - 1).type : dropLocationNodeType;
106
+ var nodesWithNestedExpandSupport = [state.schema.nodes.expand, state.schema.nodes.tableHeader, state.schema.nodes.tableCell];
107
+ var isNodeAtDropPosInsideNodesWithNestedExpandSupport = nodesWithNestedExpandSupport.includes(dropLocationNodeType) || nodesWithNestedExpandSupport.includes(dropLocationParentNodeType);
108
+ if (editorExperiment('nested-expand-in-expand', false)) {
109
+ if ((sliceContainsExpand || sliceContainsNestedExpand) && (dropLocationNodeType === state.schema.nodes.expand || dropLocationParentNodeType === state.schema.nodes.expand)) {
110
+ event.preventDefault();
111
+ return true;
102
112
  }
103
113
  }
104
- var updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
105
- if (updatedSlice.eq(slice)) {
114
+ var updatedSlice = slice;
115
+ if (sliceContainsExpand && isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
116
+ updatedSlice = transformSliceExpandToNestedExpand(slice);
117
+ } else if (sliceContainsNestedExpand && !isNodeAtDropPosInsideNodesWithNestedExpandSupport) {
118
+ updatedSlice = transformSliceNestedExpandToExpand(slice, state.schema);
119
+ }
120
+ if (!updatedSlice || updatedSlice.eq(slice)) {
106
121
  return false;
107
122
  }
108
123
 
109
124
  // The drop position will be affected when the original slice is deleted from the document.
110
125
  var updatedDropPos = dropPos.pos > from ? dropPos.pos - updatedSlice.content.size : dropPos.pos;
126
+
127
+ // Adjust the drop position to place the slice before the node at the position the cursor is pointing at, except when the drop location is the document node.
128
+ // Otherwise causes weird behaviour with tables & quotes, splits them apart. Only do this for nested expand slice transformed to expand.
129
+ if (dropLocationNodeType !== state.schema.nodes.doc && !sliceContainsExpand) {
130
+ updatedDropPos = updatedDropPos - 1;
131
+ }
111
132
  tr.delete(from, to);
112
133
  tr.insert(updatedDropPos, updatedSlice.content);
113
134
  dispatch(tr);
@@ -1,5 +1,5 @@
1
1
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand } from '@atlaskit/editor-common/transforms';
3
3
  export var findParentExpandNode = function findParentExpandNode(state) {
4
4
  return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
5
5
  };
@@ -8,6 +8,6 @@ import type { ExpandPlugin } from '../../types';
8
8
  export declare function containsClass(element: Element | null, className: string): boolean;
9
9
  export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
10
  /**
11
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
11
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
12
12
  */
13
- export declare function handleDraggingOfNestedExpand(view: EditorView, event: DragEvent, slice: Slice): boolean;
13
+ export declare function handleExpandDrag(view: EditorView, event: DragEvent, slice: Slice): boolean;
@@ -1 +1 @@
1
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
1
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
@@ -10,6 +10,6 @@ export declare const pluginKey: PluginKey<any>;
10
10
  export declare function containsClass(element: Element | null, className: string): boolean;
11
11
  export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
12
  /**
13
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
13
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
14
14
  */
15
- export declare function handleDraggingOfNestedExpand(view: EditorView, event: DragEvent, slice: Slice): boolean;
15
+ export declare function handleExpandDrag(view: EditorView, event: DragEvent, slice: Slice): boolean;
@@ -1,4 +1,4 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
3
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
4
4
  export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
@@ -8,6 +8,6 @@ import type { ExpandPlugin } from '../../types';
8
8
  export declare function containsClass(element: Element | null, className: string): boolean;
9
9
  export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
10
  /**
11
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
11
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
12
12
  */
13
- export declare function handleDraggingOfNestedExpand(view: EditorView, event: DragEvent, slice: Slice): boolean;
13
+ export declare function handleExpandDrag(view: EditorView, event: DragEvent, slice: Slice): boolean;
@@ -1 +1 @@
1
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
1
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
@@ -10,6 +10,6 @@ export declare const pluginKey: PluginKey<any>;
10
10
  export declare function containsClass(element: Element | null, className: string): boolean;
11
11
  export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
12
  /**
13
- * As the nestedExpand node is not supported outside of the expand node, it must be converted to an expand node when dragged outside of the expand node.
13
+ * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
14
14
  */
15
- export declare function handleDraggingOfNestedExpand(view: EditorView, event: DragEvent, slice: Slice): boolean;
15
+ export declare function handleExpandDrag(view: EditorView, event: DragEvent, slice: Slice): boolean;
@@ -1,4 +1,4 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
- export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
3
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenNestedExpand, transformSliceNestedExpandToExpand, transformSliceExpandToNestedExpand, } from '@atlaskit/editor-common/transforms';
4
4
  export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,6 +44,7 @@
44
44
  "@atlaskit/editor-tables": "^2.8.0",
45
45
  "@atlaskit/icon": "^22.18.0",
46
46
  "@atlaskit/platform-feature-flags": "^0.3.0",
47
+ "@atlaskit/tmp-editor-statsig": "^2.1.8",
47
48
  "@atlaskit/tooltip": "^18.7.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "@emotion/react": "^11.7.1",
@@ -59,7 +60,7 @@
59
60
  "@atlaskit/editor-plugin-content-insertion": "^1.8.0",
60
61
  "@atlaskit/editor-plugin-guideline": "^1.2.0",
61
62
  "@atlaskit/editor-plugin-quick-insert": "^1.3.0",
62
- "@atlaskit/editor-plugin-table": "^7.26.0",
63
+ "@atlaskit/editor-plugin-table": "^7.27.0",
63
64
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
64
65
  "@atlaskit/editor-plugin-width": "^1.3.0",
65
66
  "@testing-library/react": "^12.1.5",