@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 +19 -0
- package/dist/cjs/legacyExpand/pm-plugins/main.js +38 -17
- package/dist/cjs/legacyExpand/utils.js +6 -0
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +38 -17
- package/dist/cjs/singlePlayerExpand/utils.js +6 -0
- package/dist/es2019/legacyExpand/pm-plugins/main.js +40 -19
- package/dist/es2019/legacyExpand/utils.js +1 -1
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +40 -19
- package/dist/es2019/singlePlayerExpand/utils.js +1 -1
- package/dist/esm/legacyExpand/pm-plugins/main.js +38 -17
- package/dist/esm/legacyExpand/utils.js +1 -1
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +38 -17
- package/dist/esm/singlePlayerExpand/utils.js +1 -1
- package/dist/types/legacyExpand/pm-plugins/main.d.ts +2 -2
- package/dist/types/legacyExpand/utils.d.ts +1 -1
- package/dist/types/singlePlayerExpand/pm-plugins/main.d.ts +2 -2
- package/dist/types/singlePlayerExpand/utils.d.ts +1 -1
- package/dist/types-ts4.5/legacyExpand/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/legacyExpand/utils.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/singlePlayerExpand/utils.d.ts +1 -1
- package/package.json +3 -2
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.
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
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 =
|
|
133
|
-
if (
|
|
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.
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
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 =
|
|
115
|
-
if (
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
|
|
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
|
-
|
|
125
|
-
if (
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
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
|
-
|
|
104
|
-
if (
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
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 =
|
|
124
|
-
if (
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
|
|
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 =
|
|
105
|
-
if (
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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.
|
|
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.
|
|
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",
|