@atlaskit/editor-plugin-block-controls 2.22.0 → 2.22.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 +14 -0
- package/dist/cjs/editor-commands/move-node.js +83 -27
- package/dist/cjs/editor-commands/move-to-layout.js +4 -4
- package/dist/cjs/ui/drag-handle.js +6 -0
- package/dist/es2019/editor-commands/move-node.js +84 -24
- package/dist/es2019/editor-commands/move-to-layout.js +4 -4
- package/dist/es2019/ui/drag-handle.js +6 -0
- package/dist/esm/editor-commands/move-node.js +84 -28
- package/dist/esm/editor-commands/move-to-layout.js +4 -4
- package/dist/esm/ui/drag-handle.js +6 -0
- package/dist/types/blockControlsPluginType.d.ts +2 -0
- package/dist/types/editor-commands/move-to-layout.d.ts +1 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/move-to-layout.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.22.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.22.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#110750](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110750)
|
|
14
|
+
[`d561f93940973`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d561f93940973) -
|
|
15
|
+
Add a11y support to rearrange layout column
|
|
16
|
+
|
|
3
17
|
## 2.22.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -89,6 +89,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
89
89
|
return function (state) {
|
|
90
90
|
var isParentNodeOfTypeLayout;
|
|
91
91
|
var shouldEnableNestedDndA11y = (0, _experiments.editorExperiment)('nested-dnd', true);
|
|
92
|
+
var selection = state.selection;
|
|
92
93
|
if (shouldEnableNestedDndA11y) {
|
|
93
94
|
isParentNodeOfTypeLayout = !!(0, _utils2.findParentNodeOfType)([state.schema.nodes.layoutSection])(state.selection);
|
|
94
95
|
}
|
|
@@ -98,43 +99,98 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
98
99
|
var $pos = state.doc.resolve(currentNodePos);
|
|
99
100
|
var moveToPos = -1;
|
|
100
101
|
var nodeIndex = $pos.index();
|
|
102
|
+
var isLayoutColumnSelected = selection instanceof _state.NodeSelection && selection.node.type.name === 'layoutColumn';
|
|
101
103
|
if (direction === _consts.DIRECTION.LEFT && shouldEnableNestedDndA11y) {
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
if (isLayoutColumnSelected && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility')) {
|
|
105
|
+
var _$pos$nodeBefore, _api$core;
|
|
106
|
+
moveToPos = selection.from - (((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.nodeSize) || 1);
|
|
107
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
108
|
+
var _api$blockControls;
|
|
109
|
+
var tr = _ref2.tr;
|
|
110
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.moveToLayout(currentNodePos, moveToPos, {
|
|
111
|
+
selectMovedNode: true
|
|
112
|
+
})({
|
|
113
|
+
tr: tr
|
|
114
|
+
});
|
|
115
|
+
return tr;
|
|
116
|
+
});
|
|
117
|
+
return true;
|
|
118
|
+
} else {
|
|
119
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
105
122
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
123
|
+
// get the previous layoutSection node
|
|
124
|
+
var index = $pos.index($pos.depth - 1);
|
|
125
|
+
var grandParent = $pos.node($pos.depth - 1);
|
|
126
|
+
var previousNode = grandParent ? grandParent.maybeChild(index - 1) : null;
|
|
127
|
+
moveToPos = $pos.start() - ((previousNode === null || previousNode === void 0 ? void 0 : previousNode.nodeSize) || 1);
|
|
128
|
+
}
|
|
111
129
|
} else if (direction === _consts.DIRECTION.RIGHT && shouldEnableNestedDndA11y) {
|
|
112
|
-
if (
|
|
113
|
-
|
|
130
|
+
if (isLayoutColumnSelected && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility')) {
|
|
131
|
+
var _api$core2;
|
|
132
|
+
var _index = $pos.index($pos.depth);
|
|
133
|
+
var parent = $pos.node($pos.depth);
|
|
134
|
+
// get the next layoutColumn node
|
|
135
|
+
var nextNode = parent ? parent.maybeChild(_index + 1) : null;
|
|
136
|
+
|
|
137
|
+
// if the current node is the last node, don't do anything
|
|
138
|
+
if (_index >= parent.childCount - 1) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
var moveToEnd = _index === parent.childCount - 2;
|
|
142
|
+
moveToPos = moveToEnd ? $pos.before() : selection.to + ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.nodeSize) || 1);
|
|
143
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
|
|
144
|
+
var _api$blockControls2;
|
|
145
|
+
var tr = _ref3.tr;
|
|
146
|
+
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(currentNodePos, moveToPos, {
|
|
147
|
+
moveToEnd: moveToEnd,
|
|
148
|
+
selectMovedNode: true
|
|
149
|
+
})({
|
|
150
|
+
tr: tr
|
|
151
|
+
});
|
|
152
|
+
return tr;
|
|
153
|
+
});
|
|
154
|
+
return true;
|
|
155
|
+
} else {
|
|
156
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
moveToPos = $pos.after($pos.depth) + 1;
|
|
114
160
|
}
|
|
115
|
-
moveToPos = $pos.after($pos.depth) + 1;
|
|
116
161
|
} else if (direction === _consts.DIRECTION.UP) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
162
|
+
if (isLayoutColumnSelected && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility')) {
|
|
163
|
+
moveToPos = $pos.start() - 1;
|
|
164
|
+
} else {
|
|
165
|
+
var nodeBefore = $pos.depth > 1 && nodeIndex === 0 && shouldEnableNestedDndA11y ? $pos.node($pos.depth) : $pos.nodeBefore;
|
|
166
|
+
if (nodeBefore) {
|
|
167
|
+
moveToPos = currentNodePos - nodeBefore.nodeSize;
|
|
168
|
+
}
|
|
120
169
|
}
|
|
121
170
|
} else {
|
|
122
171
|
var endOfDoc = $pos.end();
|
|
123
172
|
var nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
173
|
+
if (nodeAfterPos > endOfDoc) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (isLayoutColumnSelected && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility')) {
|
|
177
|
+
moveToPos = state.selection.$from.end() + 1;
|
|
178
|
+
} else {
|
|
179
|
+
var nodeAfter = state.doc.nodeAt(nodeAfterPos);
|
|
180
|
+
if (nodeAfter) {
|
|
181
|
+
// if not the last node, move to the end of the next node
|
|
182
|
+
moveToPos = nodeAfterPos + nodeAfter.nodeSize;
|
|
183
|
+
}
|
|
128
184
|
}
|
|
129
185
|
}
|
|
130
186
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
131
187
|
|
|
132
188
|
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
133
|
-
var shouldMoveNode = shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth : moveToPos > -1;
|
|
189
|
+
var shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
|
|
134
190
|
if (shouldMoveNode) {
|
|
135
|
-
var _api$
|
|
136
|
-
api === null || api === void 0 || (_api$
|
|
137
|
-
var tr =
|
|
191
|
+
var _api$core3;
|
|
192
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref4) {
|
|
193
|
+
var tr = _ref4.tr;
|
|
138
194
|
moveNode(api)(currentNodePos, moveToPos, _analytics.INPUT_METHOD.SHORTCUT, formatMessage)({
|
|
139
195
|
tr: tr
|
|
140
196
|
});
|
|
@@ -143,10 +199,10 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
143
199
|
});
|
|
144
200
|
return true;
|
|
145
201
|
} else if (nodeType) {
|
|
146
|
-
var _api$
|
|
202
|
+
var _api$core4;
|
|
147
203
|
// If the node is first/last one, only select the node
|
|
148
|
-
api === null || api === void 0 || (_api$
|
|
149
|
-
var tr =
|
|
204
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(function (_ref5) {
|
|
205
|
+
var tr = _ref5.tr;
|
|
150
206
|
(0, _getSelection.selectNode)(tr, currentNodePos, nodeType);
|
|
151
207
|
tr.scrollIntoView();
|
|
152
208
|
return tr;
|
|
@@ -161,8 +217,8 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
161
217
|
return function (start, to) {
|
|
162
218
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.DRAG_AND_DROP;
|
|
163
219
|
var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
|
|
164
|
-
return function (
|
|
165
|
-
var tr =
|
|
220
|
+
return function (_ref6) {
|
|
221
|
+
var tr = _ref6.tr;
|
|
166
222
|
var isMultiSelect = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true, {
|
|
167
223
|
exposure: true
|
|
168
224
|
});
|
|
@@ -43,7 +43,7 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
};
|
|
46
|
-
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api) {
|
|
46
|
+
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api, selectMovedNode) {
|
|
47
47
|
var isSameLayout = (0, _validation.isInSameLayout)($originalFrom, $originalTo);
|
|
48
48
|
var sourceContentEndPos = -1;
|
|
49
49
|
if ((0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true)) {
|
|
@@ -64,7 +64,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
64
64
|
tr.delete(from, sourceContentEndPos);
|
|
65
65
|
var mappedTo = tr.mapping.map(to);
|
|
66
66
|
tr.insert(mappedTo, sourceContent);
|
|
67
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
67
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') || selectMovedNode) {
|
|
68
68
|
tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
69
69
|
}
|
|
70
70
|
(0, _fireAnalytics.attachMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
@@ -317,12 +317,12 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
317
317
|
}
|
|
318
318
|
if (toNode.type === layoutSection) {
|
|
319
319
|
var toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
|
|
320
|
-
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api);
|
|
320
|
+
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
321
321
|
} else if (toNode.type === layoutColumn) {
|
|
322
322
|
var toLayout = $to.parent;
|
|
323
323
|
var toLayoutPos = to - $to.parentOffset - 1;
|
|
324
324
|
var _toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
|
|
325
|
-
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, _toPos, tr, $sourceFrom, $to, api);
|
|
325
|
+
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, _toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
326
326
|
} else {
|
|
327
327
|
var toNodeWithoutBreakout = toNode;
|
|
328
328
|
|
|
@@ -417,6 +417,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
417
417
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true) && nodeType === 'layoutColumn') {
|
|
418
418
|
helpDescriptors = (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility') ? [{
|
|
419
419
|
description: formatMessage(_messages.blockControlsMessages.dragToRearrange)
|
|
420
|
+
}, {
|
|
421
|
+
description: formatMessage(_messages.blockControlsMessages.moveUp),
|
|
422
|
+
keymap: _keymaps.dragToMoveUp
|
|
423
|
+
}, {
|
|
424
|
+
description: formatMessage(_messages.blockControlsMessages.moveDown),
|
|
425
|
+
keymap: _keymaps.dragToMoveDown
|
|
420
426
|
}, {
|
|
421
427
|
description: formatMessage(_messages.blockControlsMessages.moveLeft),
|
|
422
428
|
keymap: _keymaps.dragToMoveLeft
|
|
@@ -5,7 +5,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
5
5
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
6
6
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import { Selection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -84,6 +84,9 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
84
84
|
return state => {
|
|
85
85
|
let isParentNodeOfTypeLayout;
|
|
86
86
|
const shouldEnableNestedDndA11y = editorExperiment('nested-dnd', true);
|
|
87
|
+
const {
|
|
88
|
+
selection
|
|
89
|
+
} = state;
|
|
87
90
|
if (shouldEnableNestedDndA11y) {
|
|
88
91
|
isParentNodeOfTypeLayout = !!findParentNodeOfType([state.schema.nodes.layoutSection])(state.selection);
|
|
89
92
|
}
|
|
@@ -93,42 +96,99 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
93
96
|
const $pos = state.doc.resolve(currentNodePos);
|
|
94
97
|
let moveToPos = -1;
|
|
95
98
|
const nodeIndex = $pos.index();
|
|
99
|
+
const isLayoutColumnSelected = selection instanceof NodeSelection && selection.node.type.name === 'layoutColumn';
|
|
96
100
|
if (direction === DIRECTION.LEFT && shouldEnableNestedDndA11y) {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
102
|
+
var _$pos$nodeBefore, _api$core;
|
|
103
|
+
moveToPos = selection.from - (((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.nodeSize) || 1);
|
|
104
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
105
|
+
tr
|
|
106
|
+
}) => {
|
|
107
|
+
var _api$blockControls, _api$blockControls$co;
|
|
108
|
+
api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$co = _api$blockControls.commands) === null || _api$blockControls$co === void 0 ? void 0 : _api$blockControls$co.moveToLayout(currentNodePos, moveToPos, {
|
|
109
|
+
selectMovedNode: true
|
|
110
|
+
})({
|
|
111
|
+
tr
|
|
112
|
+
});
|
|
113
|
+
return tr;
|
|
114
|
+
});
|
|
115
|
+
return true;
|
|
116
|
+
} else {
|
|
117
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
100
120
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
// get the previous layoutSection node
|
|
122
|
+
const index = $pos.index($pos.depth - 1);
|
|
123
|
+
const grandParent = $pos.node($pos.depth - 1);
|
|
124
|
+
const previousNode = grandParent ? grandParent.maybeChild(index - 1) : null;
|
|
125
|
+
moveToPos = $pos.start() - ((previousNode === null || previousNode === void 0 ? void 0 : previousNode.nodeSize) || 1);
|
|
126
|
+
}
|
|
106
127
|
} else if (direction === DIRECTION.RIGHT && shouldEnableNestedDndA11y) {
|
|
107
|
-
if (
|
|
108
|
-
|
|
128
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
129
|
+
var _api$core2;
|
|
130
|
+
const index = $pos.index($pos.depth);
|
|
131
|
+
const parent = $pos.node($pos.depth);
|
|
132
|
+
// get the next layoutColumn node
|
|
133
|
+
const nextNode = parent ? parent.maybeChild(index + 1) : null;
|
|
134
|
+
|
|
135
|
+
// if the current node is the last node, don't do anything
|
|
136
|
+
if (index >= parent.childCount - 1) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
const moveToEnd = index === parent.childCount - 2;
|
|
140
|
+
moveToPos = moveToEnd ? $pos.before() : selection.to + ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.nodeSize) || 1);
|
|
141
|
+
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
|
|
142
|
+
tr
|
|
143
|
+
}) => {
|
|
144
|
+
var _api$blockControls2, _api$blockControls2$c;
|
|
145
|
+
api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$c = _api$blockControls2.commands) === null || _api$blockControls2$c === void 0 ? void 0 : _api$blockControls2$c.moveToLayout(currentNodePos, moveToPos, {
|
|
146
|
+
moveToEnd,
|
|
147
|
+
selectMovedNode: true
|
|
148
|
+
})({
|
|
149
|
+
tr
|
|
150
|
+
});
|
|
151
|
+
return tr;
|
|
152
|
+
});
|
|
153
|
+
return true;
|
|
154
|
+
} else {
|
|
155
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
moveToPos = $pos.after($pos.depth) + 1;
|
|
109
159
|
}
|
|
110
|
-
moveToPos = $pos.after($pos.depth) + 1;
|
|
111
160
|
} else if (direction === DIRECTION.UP) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
161
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
162
|
+
moveToPos = $pos.start() - 1;
|
|
163
|
+
} else {
|
|
164
|
+
const nodeBefore = $pos.depth > 1 && nodeIndex === 0 && shouldEnableNestedDndA11y ? $pos.node($pos.depth) : $pos.nodeBefore;
|
|
165
|
+
if (nodeBefore) {
|
|
166
|
+
moveToPos = currentNodePos - nodeBefore.nodeSize;
|
|
167
|
+
}
|
|
115
168
|
}
|
|
116
169
|
} else {
|
|
117
170
|
const endOfDoc = $pos.end();
|
|
118
171
|
const nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
172
|
+
if (nodeAfterPos > endOfDoc) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
176
|
+
moveToPos = state.selection.$from.end() + 1;
|
|
177
|
+
} else {
|
|
178
|
+
const nodeAfter = state.doc.nodeAt(nodeAfterPos);
|
|
179
|
+
if (nodeAfter) {
|
|
180
|
+
// if not the last node, move to the end of the next node
|
|
181
|
+
moveToPos = nodeAfterPos + nodeAfter.nodeSize;
|
|
182
|
+
}
|
|
123
183
|
}
|
|
124
184
|
}
|
|
125
185
|
const nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
126
186
|
|
|
127
187
|
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
128
|
-
const shouldMoveNode = shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth : moveToPos > -1;
|
|
188
|
+
const shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
|
|
129
189
|
if (shouldMoveNode) {
|
|
130
|
-
var _api$
|
|
131
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
190
|
+
var _api$core3;
|
|
191
|
+
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(({
|
|
132
192
|
tr
|
|
133
193
|
}) => {
|
|
134
194
|
moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT, formatMessage)({
|
|
@@ -139,9 +199,9 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
139
199
|
});
|
|
140
200
|
return true;
|
|
141
201
|
} else if (nodeType) {
|
|
142
|
-
var _api$
|
|
202
|
+
var _api$core4;
|
|
143
203
|
// If the node is first/last one, only select the node
|
|
144
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
204
|
+
api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions.execute(({
|
|
145
205
|
tr
|
|
146
206
|
}) => {
|
|
147
207
|
selectNode(tr, currentNodePos, nodeType);
|
|
@@ -38,7 +38,7 @@ const createNewLayout = (schema, layoutContents) => {
|
|
|
38
38
|
}
|
|
39
39
|
return null;
|
|
40
40
|
};
|
|
41
|
-
const moveToExistingLayout = (toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api) => {
|
|
41
|
+
const moveToExistingLayout = (toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api, selectMovedNode) => {
|
|
42
42
|
const isSameLayout = isInSameLayout($originalFrom, $originalTo);
|
|
43
43
|
let sourceContentEndPos = -1;
|
|
44
44
|
if (editorExperiment('platform_editor_element_drag_and_drop_multiselect', true)) {
|
|
@@ -59,7 +59,7 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceContent, from, to, tr
|
|
|
59
59
|
tr.delete(from, sourceContentEndPos);
|
|
60
60
|
const mappedTo = tr.mapping.map(to);
|
|
61
61
|
tr.insert(mappedTo, sourceContent);
|
|
62
|
-
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
62
|
+
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1') || selectMovedNode) {
|
|
63
63
|
tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
64
64
|
}
|
|
65
65
|
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
@@ -310,12 +310,12 @@ export const moveToLayout = api => (from, to, options) => ({
|
|
|
310
310
|
}
|
|
311
311
|
if (toNode.type === layoutSection) {
|
|
312
312
|
const toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
|
|
313
|
-
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api);
|
|
313
|
+
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
314
314
|
} else if (toNode.type === layoutColumn) {
|
|
315
315
|
const toLayout = $to.parent;
|
|
316
316
|
const toLayoutPos = to - $to.parentOffset - 1;
|
|
317
317
|
const toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
|
|
318
|
-
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api);
|
|
318
|
+
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
319
319
|
} else {
|
|
320
320
|
let toNodeWithoutBreakout = toNode;
|
|
321
321
|
|
|
@@ -397,6 +397,12 @@ export const DragHandle = ({
|
|
|
397
397
|
if (editorExperiment('advanced_layouts', true) && nodeType === 'layoutColumn') {
|
|
398
398
|
helpDescriptors = fg('platform_editor_advanced_layouts_accessibility') ? [{
|
|
399
399
|
description: formatMessage(blockControlsMessages.dragToRearrange)
|
|
400
|
+
}, {
|
|
401
|
+
description: formatMessage(blockControlsMessages.moveUp),
|
|
402
|
+
keymap: dragToMoveUp
|
|
403
|
+
}, {
|
|
404
|
+
description: formatMessage(blockControlsMessages.moveDown),
|
|
405
|
+
keymap: dragToMoveDown
|
|
400
406
|
}, {
|
|
401
407
|
description: formatMessage(blockControlsMessages.moveLeft),
|
|
402
408
|
keymap: dragToMoveLeft
|
|
@@ -8,7 +8,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
8
8
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
9
9
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
11
|
-
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
+
import { Selection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -83,6 +83,7 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
83
83
|
return function (state) {
|
|
84
84
|
var isParentNodeOfTypeLayout;
|
|
85
85
|
var shouldEnableNestedDndA11y = editorExperiment('nested-dnd', true);
|
|
86
|
+
var selection = state.selection;
|
|
86
87
|
if (shouldEnableNestedDndA11y) {
|
|
87
88
|
isParentNodeOfTypeLayout = !!findParentNodeOfType([state.schema.nodes.layoutSection])(state.selection);
|
|
88
89
|
}
|
|
@@ -92,43 +93,98 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
92
93
|
var $pos = state.doc.resolve(currentNodePos);
|
|
93
94
|
var moveToPos = -1;
|
|
94
95
|
var nodeIndex = $pos.index();
|
|
96
|
+
var isLayoutColumnSelected = selection instanceof NodeSelection && selection.node.type.name === 'layoutColumn';
|
|
95
97
|
if (direction === DIRECTION.LEFT && shouldEnableNestedDndA11y) {
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
99
|
+
var _$pos$nodeBefore, _api$core;
|
|
100
|
+
moveToPos = selection.from - (((_$pos$nodeBefore = $pos.nodeBefore) === null || _$pos$nodeBefore === void 0 ? void 0 : _$pos$nodeBefore.nodeSize) || 1);
|
|
101
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
102
|
+
var _api$blockControls;
|
|
103
|
+
var tr = _ref2.tr;
|
|
104
|
+
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.commands) === null || _api$blockControls === void 0 || _api$blockControls.moveToLayout(currentNodePos, moveToPos, {
|
|
105
|
+
selectMovedNode: true
|
|
106
|
+
})({
|
|
107
|
+
tr: tr
|
|
108
|
+
});
|
|
109
|
+
return tr;
|
|
110
|
+
});
|
|
111
|
+
return true;
|
|
112
|
+
} else {
|
|
113
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
99
116
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
117
|
+
// get the previous layoutSection node
|
|
118
|
+
var index = $pos.index($pos.depth - 1);
|
|
119
|
+
var grandParent = $pos.node($pos.depth - 1);
|
|
120
|
+
var previousNode = grandParent ? grandParent.maybeChild(index - 1) : null;
|
|
121
|
+
moveToPos = $pos.start() - ((previousNode === null || previousNode === void 0 ? void 0 : previousNode.nodeSize) || 1);
|
|
122
|
+
}
|
|
105
123
|
} else if (direction === DIRECTION.RIGHT && shouldEnableNestedDndA11y) {
|
|
106
|
-
if (
|
|
107
|
-
|
|
124
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
125
|
+
var _api$core2;
|
|
126
|
+
var _index = $pos.index($pos.depth);
|
|
127
|
+
var parent = $pos.node($pos.depth);
|
|
128
|
+
// get the next layoutColumn node
|
|
129
|
+
var nextNode = parent ? parent.maybeChild(_index + 1) : null;
|
|
130
|
+
|
|
131
|
+
// if the current node is the last node, don't do anything
|
|
132
|
+
if (_index >= parent.childCount - 1) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
var moveToEnd = _index === parent.childCount - 2;
|
|
136
|
+
moveToPos = moveToEnd ? $pos.before() : selection.to + ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.nodeSize) || 1);
|
|
137
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
|
|
138
|
+
var _api$blockControls2;
|
|
139
|
+
var tr = _ref3.tr;
|
|
140
|
+
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(currentNodePos, moveToPos, {
|
|
141
|
+
moveToEnd: moveToEnd,
|
|
142
|
+
selectMovedNode: true
|
|
143
|
+
})({
|
|
144
|
+
tr: tr
|
|
145
|
+
});
|
|
146
|
+
return tr;
|
|
147
|
+
});
|
|
148
|
+
return true;
|
|
149
|
+
} else {
|
|
150
|
+
if ($pos.depth < 2 || !isParentNodeOfTypeLayout) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
moveToPos = $pos.after($pos.depth) + 1;
|
|
108
154
|
}
|
|
109
|
-
moveToPos = $pos.after($pos.depth) + 1;
|
|
110
155
|
} else if (direction === DIRECTION.UP) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
156
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
157
|
+
moveToPos = $pos.start() - 1;
|
|
158
|
+
} else {
|
|
159
|
+
var nodeBefore = $pos.depth > 1 && nodeIndex === 0 && shouldEnableNestedDndA11y ? $pos.node($pos.depth) : $pos.nodeBefore;
|
|
160
|
+
if (nodeBefore) {
|
|
161
|
+
moveToPos = currentNodePos - nodeBefore.nodeSize;
|
|
162
|
+
}
|
|
114
163
|
}
|
|
115
164
|
} else {
|
|
116
165
|
var endOfDoc = $pos.end();
|
|
117
166
|
var nodeAfterPos = $pos.posAtIndex($pos.index() + 1);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
167
|
+
if (nodeAfterPos > endOfDoc) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (isLayoutColumnSelected && fg('platform_editor_advanced_layouts_accessibility')) {
|
|
171
|
+
moveToPos = state.selection.$from.end() + 1;
|
|
172
|
+
} else {
|
|
173
|
+
var nodeAfter = state.doc.nodeAt(nodeAfterPos);
|
|
174
|
+
if (nodeAfter) {
|
|
175
|
+
// if not the last node, move to the end of the next node
|
|
176
|
+
moveToPos = nodeAfterPos + nodeAfter.nodeSize;
|
|
177
|
+
}
|
|
122
178
|
}
|
|
123
179
|
}
|
|
124
180
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
125
181
|
|
|
126
182
|
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
127
|
-
var shouldMoveNode = shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth : moveToPos > -1;
|
|
183
|
+
var shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $pos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
|
|
128
184
|
if (shouldMoveNode) {
|
|
129
|
-
var _api$
|
|
130
|
-
api === null || api === void 0 || (_api$
|
|
131
|
-
var tr =
|
|
185
|
+
var _api$core3;
|
|
186
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref4) {
|
|
187
|
+
var tr = _ref4.tr;
|
|
132
188
|
moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT, formatMessage)({
|
|
133
189
|
tr: tr
|
|
134
190
|
});
|
|
@@ -137,10 +193,10 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
137
193
|
});
|
|
138
194
|
return true;
|
|
139
195
|
} else if (nodeType) {
|
|
140
|
-
var _api$
|
|
196
|
+
var _api$core4;
|
|
141
197
|
// If the node is first/last one, only select the node
|
|
142
|
-
api === null || api === void 0 || (_api$
|
|
143
|
-
var tr =
|
|
198
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(function (_ref5) {
|
|
199
|
+
var tr = _ref5.tr;
|
|
144
200
|
selectNode(tr, currentNodePos, nodeType);
|
|
145
201
|
tr.scrollIntoView();
|
|
146
202
|
return tr;
|
|
@@ -155,8 +211,8 @@ export var moveNode = function moveNode(api) {
|
|
|
155
211
|
return function (start, to) {
|
|
156
212
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : INPUT_METHOD.DRAG_AND_DROP;
|
|
157
213
|
var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
|
|
158
|
-
return function (
|
|
159
|
-
var tr =
|
|
214
|
+
return function (_ref6) {
|
|
215
|
+
var tr = _ref6.tr;
|
|
160
216
|
var isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true, {
|
|
161
217
|
exposure: true
|
|
162
218
|
});
|
|
@@ -37,7 +37,7 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
};
|
|
40
|
-
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api) {
|
|
40
|
+
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceContent, from, to, tr, $originalFrom, $originalTo, api, selectMovedNode) {
|
|
41
41
|
var isSameLayout = isInSameLayout($originalFrom, $originalTo);
|
|
42
42
|
var sourceContentEndPos = -1;
|
|
43
43
|
if (editorExperiment('platform_editor_element_drag_and_drop_multiselect', true)) {
|
|
@@ -58,7 +58,7 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
58
58
|
tr.delete(from, sourceContentEndPos);
|
|
59
59
|
var mappedTo = tr.mapping.map(to);
|
|
60
60
|
tr.insert(mappedTo, sourceContent);
|
|
61
|
-
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
61
|
+
if (!fg('platform_editor_advanced_layouts_post_fix_patch_1') || selectMovedNode) {
|
|
62
62
|
tr.setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
63
63
|
}
|
|
64
64
|
attachMoveNodeAnalytics(tr, INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api);
|
|
@@ -311,12 +311,12 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
311
311
|
}
|
|
312
312
|
if (toNode.type === layoutSection) {
|
|
313
313
|
var toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize - 1 : to + 1;
|
|
314
|
-
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api);
|
|
314
|
+
return moveToExistingLayout(toNode, to, fromContentWithoutBreakout, $sourceFrom.pos, toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
315
315
|
} else if (toNode.type === layoutColumn) {
|
|
316
316
|
var toLayout = $to.parent;
|
|
317
317
|
var toLayoutPos = to - $to.parentOffset - 1;
|
|
318
318
|
var _toPos = options !== null && options !== void 0 && options.moveToEnd ? to + toNode.nodeSize : to;
|
|
319
|
-
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, _toPos, tr, $sourceFrom, $to, api);
|
|
319
|
+
return moveToExistingLayout(toLayout, toLayoutPos, fromContentWithoutBreakout, $sourceFrom.pos, _toPos, tr, $sourceFrom, $to, api, options === null || options === void 0 ? void 0 : options.selectMovedNode);
|
|
320
320
|
} else {
|
|
321
321
|
var toNodeWithoutBreakout = toNode;
|
|
322
322
|
|
|
@@ -408,6 +408,12 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
408
408
|
if (editorExperiment('advanced_layouts', true) && nodeType === 'layoutColumn') {
|
|
409
409
|
helpDescriptors = fg('platform_editor_advanced_layouts_accessibility') ? [{
|
|
410
410
|
description: formatMessage(blockControlsMessages.dragToRearrange)
|
|
411
|
+
}, {
|
|
412
|
+
description: formatMessage(blockControlsMessages.moveUp),
|
|
413
|
+
keymap: dragToMoveUp
|
|
414
|
+
}, {
|
|
415
|
+
description: formatMessage(blockControlsMessages.moveDown),
|
|
416
|
+
keymap: dragToMoveDown
|
|
411
417
|
}, {
|
|
412
418
|
description: formatMessage(blockControlsMessages.moveLeft),
|
|
413
419
|
keymap: dragToMoveLeft
|
|
@@ -65,9 +65,11 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
65
65
|
* @param from position of the node to be moved
|
|
66
66
|
* @param to position of the layout/layout column/node to move the node to
|
|
67
67
|
* @param options moveToEnd: move the node to after the layout/layout column/another node
|
|
68
|
+
* @param options selectMovedNode: select the moved node after moving it
|
|
68
69
|
*/
|
|
69
70
|
moveToLayout: (start: number, to: number, options?: {
|
|
70
71
|
moveToEnd?: boolean;
|
|
72
|
+
selectMovedNode?: boolean;
|
|
71
73
|
}) => EditorCommand;
|
|
72
74
|
moveNode: MoveNode;
|
|
73
75
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
@@ -2,4 +2,5 @@ import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common
|
|
|
2
2
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
3
|
export declare const moveToLayout: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (from: number, to: number, options?: {
|
|
4
4
|
moveToEnd?: boolean;
|
|
5
|
+
selectMovedNode?: boolean;
|
|
5
6
|
}) => EditorCommand;
|
|
@@ -65,9 +65,11 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
65
65
|
* @param from position of the node to be moved
|
|
66
66
|
* @param to position of the layout/layout column/node to move the node to
|
|
67
67
|
* @param options moveToEnd: move the node to after the layout/layout column/another node
|
|
68
|
+
* @param options selectMovedNode: select the moved node after moving it
|
|
68
69
|
*/
|
|
69
70
|
moveToLayout: (start: number, to: number, options?: {
|
|
70
71
|
moveToEnd?: boolean;
|
|
72
|
+
selectMovedNode?: boolean;
|
|
71
73
|
}) => EditorCommand;
|
|
72
74
|
moveNode: MoveNode;
|
|
73
75
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
@@ -2,4 +2,5 @@ import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common
|
|
|
2
2
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
3
|
export declare const moveToLayout: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (from: number, to: number, options?: {
|
|
4
4
|
moveToEnd?: boolean;
|
|
5
|
+
selectMovedNode?: boolean;
|
|
5
6
|
}) => EditorCommand;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.2.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.4.0",
|
|
50
|
-
"@atlaskit/theme": "^
|
|
50
|
+
"@atlaskit/theme": "^15.0.0",
|
|
51
51
|
"@atlaskit/tmp-editor-statsig": "^2.43.0",
|
|
52
52
|
"@atlaskit/tokens": "^3.3.0",
|
|
53
53
|
"@atlaskit/tooltip": "^19.1.0",
|