@atlaskit/editor-plugin-block-controls 3.1.7 → 3.1.9
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 +16 -0
- package/dist/cjs/ui/block-menu-items.js +28 -0
- package/dist/cjs/ui/drag-handle.js +11 -1
- package/dist/es2019/ui/block-menu-items.js +29 -1
- package/dist/es2019/ui/drag-handle.js +11 -1
- package/dist/esm/ui/block-menu-items.js +29 -1
- package/dist/esm/ui/drag-handle.js +11 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121235](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121235)
|
|
8
|
+
[`fd5c842595a2f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd5c842595a2f) -
|
|
9
|
+
[ux] Adds moveLeft and moveRight items to the Block menu and updates the tooltip
|
|
10
|
+
|
|
11
|
+
## 3.1.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#120895](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120895)
|
|
16
|
+
[`d38911e66c554`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d38911e66c554) -
|
|
17
|
+
Select nodes on drag
|
|
18
|
+
|
|
3
19
|
## 3.1.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -10,6 +10,8 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
12
12
|
var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/core/arrow-down"));
|
|
13
|
+
var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/core/arrow-left"));
|
|
14
|
+
var _arrowRight = _interopRequireDefault(require("@atlaskit/icon/core/arrow-right"));
|
|
13
15
|
var _arrowUp = _interopRequireDefault(require("@atlaskit/icon/core/arrow-up"));
|
|
14
16
|
var _moveNode = require("../editor-commands/move-node");
|
|
15
17
|
var _consts = require("../pm-plugins/utils/consts");
|
|
@@ -49,6 +51,32 @@ var getBlockMenuItems = exports.getBlockMenuItems = function getBlockMenuItems(f
|
|
|
49
51
|
elemAfter: (0, _react.jsx)("div", {
|
|
50
52
|
css: _shortcut.shortcutStyle
|
|
51
53
|
}, (0, _keymaps.tooltip)(_keymaps.dragToMoveDown))
|
|
54
|
+
}, {
|
|
55
|
+
content: formatMessage(_messages.blockControlsMessages.moveLeft),
|
|
56
|
+
elemBefore: (0, _react.jsx)(_arrowLeft.default, {
|
|
57
|
+
label: ""
|
|
58
|
+
}),
|
|
59
|
+
value: {
|
|
60
|
+
name: 'moveLeft'
|
|
61
|
+
},
|
|
62
|
+
key: 'move_left',
|
|
63
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
64
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
65
|
+
css: _shortcut.shortcutStyle
|
|
66
|
+
}, (0, _keymaps.tooltip)(_keymaps.dragToMoveLeft))
|
|
67
|
+
}, {
|
|
68
|
+
content: formatMessage(_messages.blockControlsMessages.moveRight),
|
|
69
|
+
elemBefore: (0, _react.jsx)(_arrowRight.default, {
|
|
70
|
+
label: ""
|
|
71
|
+
}),
|
|
72
|
+
value: {
|
|
73
|
+
name: 'moveRight'
|
|
74
|
+
},
|
|
75
|
+
key: 'move_right',
|
|
76
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
77
|
+
elemAfter: (0, _react.jsx)("div", {
|
|
78
|
+
css: _shortcut.shortcutStyle
|
|
79
|
+
}, (0, _keymaps.tooltip)(_keymaps.dragToMoveRight))
|
|
52
80
|
}]
|
|
53
81
|
}];
|
|
54
82
|
};
|
|
@@ -307,11 +307,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
307
307
|
if (typeof handlePos !== 'number') {
|
|
308
308
|
return tr;
|
|
309
309
|
}
|
|
310
|
-
|
|
310
|
+
var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
|
|
311
|
+
var newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
|
|
312
|
+
if (!tr.selection.empty && ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
|
|
311
313
|
var _api$blockControls4;
|
|
312
314
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
|
|
313
315
|
tr: tr
|
|
314
316
|
});
|
|
317
|
+
} else if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_select_node_on_drag')) {
|
|
318
|
+
tr = (0, _getSelection.selectNode)(tr, handlePos, nodeType);
|
|
315
319
|
}
|
|
316
320
|
return tr;
|
|
317
321
|
});
|
|
@@ -616,6 +620,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
616
620
|
description: formatMessage(_messages.blockControlsMessages.dragToMove)
|
|
617
621
|
}];
|
|
618
622
|
}
|
|
623
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
624
|
+
helpDescriptors = [{
|
|
625
|
+
description: formatMessage(_messages.blockControlsMessages.dragToMove)
|
|
626
|
+
}];
|
|
627
|
+
}
|
|
619
628
|
var message = helpDescriptors.map(function (descriptor) {
|
|
620
629
|
return descriptor.keymap ? [descriptor.description, (0, _keymaps.getAriaKeyshortcuts)(descriptor.keymap)] : [descriptor.description];
|
|
621
630
|
}).join('. ');
|
|
@@ -661,6 +670,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
661
670
|
helpDescriptors: helpDescriptors
|
|
662
671
|
}),
|
|
663
672
|
ignoreTooltipPointerEvents: true,
|
|
673
|
+
position: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? 'top' : undefined,
|
|
664
674
|
onShow: function onShow() {
|
|
665
675
|
var _api$accessibilityUti;
|
|
666
676
|
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
|
-
import { dragToMoveDown, dragToMoveUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
9
|
+
import { dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
12
12
|
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
13
|
+
import ArrowLeftIcon from '@atlaskit/icon/core/arrow-left';
|
|
14
|
+
import ArrowRightnIcon from '@atlaskit/icon/core/arrow-right';
|
|
13
15
|
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
14
16
|
import { moveNodeViaShortcut } from '../editor-commands/move-node';
|
|
15
17
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
@@ -41,6 +43,32 @@ export const getBlockMenuItems = formatMessage => {
|
|
|
41
43
|
elemAfter: jsx("div", {
|
|
42
44
|
css: shortcutStyle
|
|
43
45
|
}, tooltip(dragToMoveDown))
|
|
46
|
+
}, {
|
|
47
|
+
content: formatMessage(blockControlsMessages.moveLeft),
|
|
48
|
+
elemBefore: jsx(ArrowLeftIcon, {
|
|
49
|
+
label: ""
|
|
50
|
+
}),
|
|
51
|
+
value: {
|
|
52
|
+
name: 'moveLeft'
|
|
53
|
+
},
|
|
54
|
+
key: 'move_left',
|
|
55
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
56
|
+
elemAfter: jsx("div", {
|
|
57
|
+
css: shortcutStyle
|
|
58
|
+
}, tooltip(dragToMoveLeft))
|
|
59
|
+
}, {
|
|
60
|
+
content: formatMessage(blockControlsMessages.moveRight),
|
|
61
|
+
elemBefore: jsx(ArrowRightnIcon, {
|
|
62
|
+
label: ""
|
|
63
|
+
}),
|
|
64
|
+
value: {
|
|
65
|
+
name: 'moveRight'
|
|
66
|
+
},
|
|
67
|
+
key: 'move_right',
|
|
68
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
69
|
+
elemAfter: jsx("div", {
|
|
70
|
+
css: shortcutStyle
|
|
71
|
+
}, tooltip(dragToMoveRight))
|
|
44
72
|
}]
|
|
45
73
|
}];
|
|
46
74
|
};
|
|
@@ -287,11 +287,15 @@ export const DragHandle = ({
|
|
|
287
287
|
if (typeof handlePos !== 'number') {
|
|
288
288
|
return tr;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
const oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
|
|
291
|
+
const newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
|
|
292
|
+
if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
|
|
291
293
|
var _api$blockControls4;
|
|
292
294
|
api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.setMultiSelectPositions()({
|
|
293
295
|
tr
|
|
294
296
|
});
|
|
297
|
+
} else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
|
|
298
|
+
tr = selectNode(tr, handlePos, nodeType);
|
|
295
299
|
}
|
|
296
300
|
return tr;
|
|
297
301
|
});
|
|
@@ -600,6 +604,11 @@ export const DragHandle = ({
|
|
|
600
604
|
description: formatMessage(blockControlsMessages.dragToMove)
|
|
601
605
|
}];
|
|
602
606
|
}
|
|
607
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
608
|
+
helpDescriptors = [{
|
|
609
|
+
description: formatMessage(blockControlsMessages.dragToMove)
|
|
610
|
+
}];
|
|
611
|
+
}
|
|
603
612
|
const message = helpDescriptors.map(descriptor => {
|
|
604
613
|
return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
|
|
605
614
|
}).join('. ');
|
|
@@ -642,6 +651,7 @@ export const DragHandle = ({
|
|
|
642
651
|
helpDescriptors: helpDescriptors
|
|
643
652
|
}),
|
|
644
653
|
ignoreTooltipPointerEvents: true,
|
|
654
|
+
position: editorExperiment('platform_editor_controls', 'variant1') ? 'top' : undefined,
|
|
645
655
|
onShow: () => {
|
|
646
656
|
var _api$accessibilityUti;
|
|
647
657
|
api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(message, {
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
|
-
import { dragToMoveDown, dragToMoveUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
9
|
+
import { dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
12
12
|
import ArrowDownIcon from '@atlaskit/icon/core/arrow-down';
|
|
13
|
+
import ArrowLeftIcon from '@atlaskit/icon/core/arrow-left';
|
|
14
|
+
import ArrowRightnIcon from '@atlaskit/icon/core/arrow-right';
|
|
13
15
|
import ArrowUpIcon from '@atlaskit/icon/core/arrow-up';
|
|
14
16
|
import { moveNodeViaShortcut } from '../editor-commands/move-node';
|
|
15
17
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
@@ -41,6 +43,32 @@ export var getBlockMenuItems = function getBlockMenuItems(formatMessage) {
|
|
|
41
43
|
elemAfter: jsx("div", {
|
|
42
44
|
css: shortcutStyle
|
|
43
45
|
}, tooltip(dragToMoveDown))
|
|
46
|
+
}, {
|
|
47
|
+
content: formatMessage(blockControlsMessages.moveLeft),
|
|
48
|
+
elemBefore: jsx(ArrowLeftIcon, {
|
|
49
|
+
label: ""
|
|
50
|
+
}),
|
|
51
|
+
value: {
|
|
52
|
+
name: 'moveLeft'
|
|
53
|
+
},
|
|
54
|
+
key: 'move_left',
|
|
55
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
56
|
+
elemAfter: jsx("div", {
|
|
57
|
+
css: shortcutStyle
|
|
58
|
+
}, tooltip(dragToMoveLeft))
|
|
59
|
+
}, {
|
|
60
|
+
content: formatMessage(blockControlsMessages.moveRight),
|
|
61
|
+
elemBefore: jsx(ArrowRightnIcon, {
|
|
62
|
+
label: ""
|
|
63
|
+
}),
|
|
64
|
+
value: {
|
|
65
|
+
name: 'moveRight'
|
|
66
|
+
},
|
|
67
|
+
key: 'move_right',
|
|
68
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
69
|
+
elemAfter: jsx("div", {
|
|
70
|
+
css: shortcutStyle
|
|
71
|
+
}, tooltip(dragToMoveRight))
|
|
44
72
|
}]
|
|
45
73
|
}];
|
|
46
74
|
};
|
|
@@ -302,11 +302,15 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
302
302
|
if (typeof handlePos !== 'number') {
|
|
303
303
|
return tr;
|
|
304
304
|
}
|
|
305
|
-
|
|
305
|
+
var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
|
|
306
|
+
var newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
|
|
307
|
+
if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
|
|
306
308
|
var _api$blockControls4;
|
|
307
309
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
|
|
308
310
|
tr: tr
|
|
309
311
|
});
|
|
312
|
+
} else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
|
|
313
|
+
tr = selectNode(tr, handlePos, nodeType);
|
|
310
314
|
}
|
|
311
315
|
return tr;
|
|
312
316
|
});
|
|
@@ -611,6 +615,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
611
615
|
description: formatMessage(blockControlsMessages.dragToMove)
|
|
612
616
|
}];
|
|
613
617
|
}
|
|
618
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
619
|
+
helpDescriptors = [{
|
|
620
|
+
description: formatMessage(blockControlsMessages.dragToMove)
|
|
621
|
+
}];
|
|
622
|
+
}
|
|
614
623
|
var message = helpDescriptors.map(function (descriptor) {
|
|
615
624
|
return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
|
|
616
625
|
}).join('. ');
|
|
@@ -656,6 +665,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
656
665
|
helpDescriptors: helpDescriptors
|
|
657
666
|
}),
|
|
658
667
|
ignoreTooltipPointerEvents: true,
|
|
668
|
+
position: editorExperiment('platform_editor_controls', 'variant1') ? 'top' : undefined,
|
|
659
669
|
onShow: function onShow() {
|
|
660
670
|
var _api$accessibilityUti;
|
|
661
671
|
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.9",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/primitives": "^14.1.0",
|
|
53
53
|
"@atlaskit/theme": "^17.0.0",
|
|
54
54
|
"@atlaskit/tmp-editor-statsig": "^3.3.0",
|
|
55
|
-
"@atlaskit/tokens": "^4.
|
|
55
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
56
56
|
"@atlaskit/tooltip": "^20.0.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
@@ -159,6 +159,9 @@
|
|
|
159
159
|
},
|
|
160
160
|
"platform_editor_elements_dnd_multi_select_patch_1": {
|
|
161
161
|
"type": "boolean"
|
|
162
|
+
},
|
|
163
|
+
"platform_editor_elements_dnd_select_node_on_drag": {
|
|
164
|
+
"type": "boolean"
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
}
|