@atlaskit/editor-plugin-block-controls 7.5.1 → 7.5.3
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 +15 -0
- package/dist/cjs/editor-commands/move-node.js +2 -5
- package/dist/cjs/editor-commands/move-to-layout.js +1 -1
- package/dist/cjs/ui/drag-handle.js +2 -17
- package/dist/es2019/editor-commands/move-node.js +2 -5
- package/dist/es2019/editor-commands/move-to-layout.js +1 -1
- package/dist/es2019/ui/drag-handle.js +2 -17
- package/dist/esm/editor-commands/move-node.js +2 -5
- package/dist/esm/editor-commands/move-to-layout.js +1 -1
- package/dist/esm/ui/drag-handle.js +2 -17
- package/package.json +7 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3b9ebe635ab0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b9ebe635ab0a) -
|
|
8
|
+
Cleanup of platform_editor_draghandle_safari_scroll_fix
|
|
9
|
+
|
|
10
|
+
## 7.5.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`75b45f2248329`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/75b45f2248329) -
|
|
15
|
+
FG cleanup platform_editor_elements_dnd_multi_select_patch_2
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 7.5.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -260,13 +260,10 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
260
260
|
}
|
|
261
261
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
262
262
|
var shouldMoveNode = false;
|
|
263
|
-
if (moveToPos > -1
|
|
263
|
+
if (moveToPos > -1) {
|
|
264
264
|
var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
265
265
|
var isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
266
266
|
shouldMoveNode = isDestDepthSameAsSource || isSourceLayoutColumn;
|
|
267
|
-
} else {
|
|
268
|
-
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
269
|
-
shouldMoveNode = moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn';
|
|
270
267
|
}
|
|
271
268
|
var _expandSelectionBound = (0, _selection.expandSelectionBounds)($currentNodePos, selection.$to),
|
|
272
269
|
$newAnchor = _expandSelectionBound.$anchor,
|
|
@@ -318,7 +315,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
318
315
|
return function (_ref7) {
|
|
319
316
|
var _api$blockControls$co, _api$accessibilityUti;
|
|
320
317
|
var tr = _ref7.tr;
|
|
321
|
-
if (!api ||
|
|
318
|
+
if (!api || start < 0 || to < 0) {
|
|
322
319
|
return tr;
|
|
323
320
|
}
|
|
324
321
|
var handleNode = tr.doc.nodeAt(start);
|
|
@@ -321,7 +321,7 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// we don't want to remove marks when moving/re-ordering layoutSection
|
|
324
|
-
var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true)
|
|
324
|
+
var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true));
|
|
325
325
|
var fromContentBeforeBreakoutMarksRemoved = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
|
|
326
326
|
|
|
327
327
|
// remove breakout from source content
|
|
@@ -441,20 +441,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
441
441
|
});
|
|
442
442
|
view.focus();
|
|
443
443
|
}, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
|
|
444
|
-
|
|
445
|
-
// TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
|
|
446
|
-
// as expected with a node selection. This workaround sets the selection to the node on mouseDown,
|
|
447
|
-
// but ensures the preview is generated correctly.
|
|
448
|
-
var handleMouseDown = (0, _react.useCallback)(function () {
|
|
449
|
-
if ((0, _experiments.editorExperiment)('advanced_layouts', true) && !(0, _platformFeatureFlags.fg)('platform_editor_draghandle_safari_scroll_fix')) {
|
|
450
|
-
var _buttonRef$current;
|
|
451
|
-
// prevent native drag and drop.
|
|
452
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
453
|
-
if (!isLayoutColumn) {
|
|
454
|
-
return undefined;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}, [isLayoutColumn]);
|
|
458
444
|
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
459
445
|
// allow user to use spacebar to select the node
|
|
460
446
|
if (!e.repeat && e.key === ' ') {
|
|
@@ -847,8 +833,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
847
833
|
(0, _react.useEffect)(function () {
|
|
848
834
|
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
849
835
|
var id = requestAnimationFrame(function () {
|
|
850
|
-
var _buttonRef$
|
|
851
|
-
(_buttonRef$
|
|
836
|
+
var _buttonRef$current;
|
|
837
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
852
838
|
});
|
|
853
839
|
return function () {
|
|
854
840
|
cancelAnimationFrame(id);
|
|
@@ -972,7 +958,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
972
958
|
,
|
|
973
959
|
style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
974
960
|
onClick: handleOnClick,
|
|
975
|
-
onMouseDown: handleMouseDown,
|
|
976
961
|
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
977
962
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
978
963
|
,
|
|
@@ -260,13 +260,10 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
260
260
|
}
|
|
261
261
|
const nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
262
262
|
let shouldMoveNode = false;
|
|
263
|
-
if (moveToPos > -1
|
|
263
|
+
if (moveToPos > -1) {
|
|
264
264
|
const isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
265
265
|
const isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
266
266
|
shouldMoveNode = isDestDepthSameAsSource || isSourceLayoutColumn;
|
|
267
|
-
} else {
|
|
268
|
-
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
269
|
-
shouldMoveNode = moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn';
|
|
270
267
|
}
|
|
271
268
|
const {
|
|
272
269
|
$anchor: $newAnchor,
|
|
@@ -319,7 +316,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
319
316
|
tr
|
|
320
317
|
}) => {
|
|
321
318
|
var _api$blockControls$co2, _api$accessibilityUti;
|
|
322
|
-
if (!api ||
|
|
319
|
+
if (!api || start < 0 || to < 0) {
|
|
323
320
|
return tr;
|
|
324
321
|
}
|
|
325
322
|
const handleNode = tr.doc.nodeAt(start);
|
|
@@ -308,7 +308,7 @@ export const moveToLayout = api => (from, to, options) => ({
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
// we don't want to remove marks when moving/re-ordering layoutSection
|
|
311
|
-
const shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true)
|
|
311
|
+
const shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true));
|
|
312
312
|
const fromContentBeforeBreakoutMarksRemoved = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
|
|
313
313
|
|
|
314
314
|
// remove breakout from source content
|
|
@@ -418,20 +418,6 @@ export const DragHandle = ({
|
|
|
418
418
|
});
|
|
419
419
|
view.focus();
|
|
420
420
|
}, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
|
|
421
|
-
|
|
422
|
-
// TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
|
|
423
|
-
// as expected with a node selection. This workaround sets the selection to the node on mouseDown,
|
|
424
|
-
// but ensures the preview is generated correctly.
|
|
425
|
-
const handleMouseDown = useCallback(() => {
|
|
426
|
-
if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
|
|
427
|
-
var _buttonRef$current;
|
|
428
|
-
// prevent native drag and drop.
|
|
429
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
430
|
-
if (!isLayoutColumn) {
|
|
431
|
-
return undefined;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}, [isLayoutColumn]);
|
|
435
421
|
const handleKeyDown = useCallback(e => {
|
|
436
422
|
// allow user to use spacebar to select the node
|
|
437
423
|
if (!e.repeat && e.key === ' ') {
|
|
@@ -833,8 +819,8 @@ export const DragHandle = ({
|
|
|
833
819
|
useEffect(() => {
|
|
834
820
|
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
835
821
|
const id = requestAnimationFrame(() => {
|
|
836
|
-
var _buttonRef$
|
|
837
|
-
(_buttonRef$
|
|
822
|
+
var _buttonRef$current;
|
|
823
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
838
824
|
});
|
|
839
825
|
return () => {
|
|
840
826
|
cancelAnimationFrame(id);
|
|
@@ -957,7 +943,6 @@ export const DragHandle = ({
|
|
|
957
943
|
,
|
|
958
944
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
959
945
|
onClick: handleOnClick,
|
|
960
|
-
onMouseDown: handleMouseDown,
|
|
961
946
|
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
962
947
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
963
948
|
,
|
|
@@ -254,13 +254,10 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
254
254
|
}
|
|
255
255
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
256
256
|
var shouldMoveNode = false;
|
|
257
|
-
if (moveToPos > -1
|
|
257
|
+
if (moveToPos > -1) {
|
|
258
258
|
var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
259
259
|
var isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
260
260
|
shouldMoveNode = isDestDepthSameAsSource || isSourceLayoutColumn;
|
|
261
|
-
} else {
|
|
262
|
-
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
263
|
-
shouldMoveNode = moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn';
|
|
264
261
|
}
|
|
265
262
|
var _expandSelectionBound = expandSelectionBounds($currentNodePos, selection.$to),
|
|
266
263
|
$newAnchor = _expandSelectionBound.$anchor,
|
|
@@ -312,7 +309,7 @@ export var moveNode = function moveNode(api) {
|
|
|
312
309
|
return function (_ref7) {
|
|
313
310
|
var _api$blockControls$co, _api$accessibilityUti;
|
|
314
311
|
var tr = _ref7.tr;
|
|
315
|
-
if (!api ||
|
|
312
|
+
if (!api || start < 0 || to < 0) {
|
|
316
313
|
return tr;
|
|
317
314
|
}
|
|
318
315
|
var handleNode = tr.doc.nodeAt(start);
|
|
@@ -315,7 +315,7 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
// we don't want to remove marks when moving/re-ordering layoutSection
|
|
318
|
-
var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true)
|
|
318
|
+
var shouldRemoveMarks = !($sourceFrom.node().type === layoutSection && editorExperiment('platform_editor_element_drag_and_drop_multiselect', true));
|
|
319
319
|
var fromContentBeforeBreakoutMarksRemoved = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true) ? tr.doc.slice($sourceFrom.pos, sourceTo).content : $sourceFrom.nodeAfter;
|
|
320
320
|
|
|
321
321
|
// remove breakout from source content
|
|
@@ -438,20 +438,6 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
438
438
|
});
|
|
439
439
|
view.focus();
|
|
440
440
|
}, [isMultiSelect, api, view, dragHandleSelected, getPos, isTopLevelNode, nodeType, anchorName]);
|
|
441
|
-
|
|
442
|
-
// TODO: ED-26959 - This needs to be investigated further. Drag preview generation is not always working
|
|
443
|
-
// as expected with a node selection. This workaround sets the selection to the node on mouseDown,
|
|
444
|
-
// but ensures the preview is generated correctly.
|
|
445
|
-
var handleMouseDown = useCallback(function () {
|
|
446
|
-
if (editorExperiment('advanced_layouts', true) && !fg('platform_editor_draghandle_safari_scroll_fix')) {
|
|
447
|
-
var _buttonRef$current;
|
|
448
|
-
// prevent native drag and drop.
|
|
449
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
450
|
-
if (!isLayoutColumn) {
|
|
451
|
-
return undefined;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}, [isLayoutColumn]);
|
|
455
441
|
var handleKeyDown = useCallback(function (e) {
|
|
456
442
|
// allow user to use spacebar to select the node
|
|
457
443
|
if (!e.repeat && e.key === ' ') {
|
|
@@ -844,8 +830,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
844
830
|
useEffect(function () {
|
|
845
831
|
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
846
832
|
var id = requestAnimationFrame(function () {
|
|
847
|
-
var _buttonRef$
|
|
848
|
-
(_buttonRef$
|
|
833
|
+
var _buttonRef$current;
|
|
834
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
849
835
|
});
|
|
850
836
|
return function () {
|
|
851
837
|
cancelAnimationFrame(id);
|
|
@@ -969,7 +955,6 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
969
955
|
,
|
|
970
956
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
971
957
|
onClick: handleOnClick,
|
|
972
|
-
onMouseDown: handleMouseDown,
|
|
973
958
|
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
974
959
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
975
960
|
,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-interaction": "^9.0.0",
|
|
37
|
-
"@atlaskit/editor-plugin-limited-mode": "^3.
|
|
37
|
+
"@atlaskit/editor-plugin-limited-mode": "^3.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-metrics": "^7.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-quick-insert": "^6.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
54
|
-
"@atlaskit/primitives": "^16.
|
|
54
|
+
"@atlaskit/primitives": "^16.1.0",
|
|
55
55
|
"@atlaskit/theme": "^21.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
57
|
-
"@atlaskit/tokens": "^7.
|
|
58
|
-
"@atlaskit/tooltip": "^20.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^13.27.0",
|
|
57
|
+
"@atlaskit/tokens": "^7.1.0",
|
|
58
|
+
"@atlaskit/tooltip": "^20.7.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
60
60
|
"@emotion/react": "^11.7.1",
|
|
61
61
|
"@popperjs/core": "^2.11.8",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"uuid": "^3.1.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@atlaskit/editor-common": "^110.
|
|
68
|
+
"@atlaskit/editor-common": "^110.22.0",
|
|
69
69
|
"react": "^18.2.0",
|
|
70
70
|
"react-dom": "^18.2.0",
|
|
71
71
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -124,15 +124,9 @@
|
|
|
124
124
|
"platform_editor_ease_of_use_metrics": {
|
|
125
125
|
"type": "boolean"
|
|
126
126
|
},
|
|
127
|
-
"platform_editor_elements_dnd_multi_select_patch_2": {
|
|
128
|
-
"type": "boolean"
|
|
129
|
-
},
|
|
130
127
|
"platform_editor_multi_body_extension_extensibility": {
|
|
131
128
|
"type": "boolean"
|
|
132
129
|
},
|
|
133
|
-
"platform_editor_elements_dnd_multi_select_patch_3": {
|
|
134
|
-
"type": "boolean"
|
|
135
|
-
},
|
|
136
130
|
"platform_editor_drag_and_drop_perf_analytics": {
|
|
137
131
|
"type": "boolean"
|
|
138
132
|
},
|
|
@@ -154,9 +148,6 @@
|
|
|
154
148
|
"platform_editor_breakout_resizing_widget_fix": {
|
|
155
149
|
"type": "boolean"
|
|
156
150
|
},
|
|
157
|
-
"platform_editor_draghandle_safari_scroll_fix": {
|
|
158
|
-
"type": "boolean"
|
|
159
|
-
},
|
|
160
151
|
"platform_editor_content_mode_button_mvp": {
|
|
161
152
|
"type": "boolean"
|
|
162
153
|
},
|