@atlaskit/editor-plugin-block-controls 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,23 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`63d659eb3e73d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/63d659eb3e73d) -
8
+ ED-24315 improve a11y for block controls
9
+
3
10
  ## 1.10.1
4
11
 
5
12
  ### Patch Changes
6
13
 
14
+ - [#125984](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125984)
15
+ [`167a210dfd672`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/167a210dfd672) -
16
+ [ux] Update shortcuts for element dnd
7
17
  - [#125542](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125542)
8
18
  [`06bc2f65f892e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/06bc2f65f892e) -
9
19
  ED-24304 resolve range error issue
20
+ - Updated dependencies
10
21
 
11
22
  ## 1.10.0
12
23
 
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.moveNodeViaShortcut = exports.moveNode = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
+ var _messages = require("@atlaskit/editor-common/messages");
10
11
  var _selection = require("@atlaskit/editor-common/selection");
11
12
  var _transforms = require("@atlaskit/editor-common/transforms");
12
13
  var _utils = require("@atlaskit/editor-tables/utils");
@@ -53,7 +54,7 @@ var getCurrentNodePos = function getCurrentNodePos(state) {
53
54
  }
54
55
  return currentNodePos;
55
56
  };
56
- var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShortcut(api, direction) {
57
+ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, formatMessage) {
57
58
  return function (state) {
58
59
  var currentNodePos = getCurrentNodePos(state);
59
60
  if (currentNodePos > -1) {
@@ -79,7 +80,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
79
80
  var _api$core;
80
81
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
81
82
  var tr = _ref2.tr;
82
- moveNode(api)(currentNodePos, moveToPos, _analytics.INPUT_METHOD.SHORTCUT)({
83
+ moveNode(api)(currentNodePos, moveToPos, _analytics.INPUT_METHOD.SHORTCUT, formatMessage)({
83
84
  tr: tr
84
85
  });
85
86
  tr.scrollIntoView();
@@ -104,6 +105,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
104
105
  var moveNode = exports.moveNode = function moveNode(api) {
105
106
  return function (start, to) {
106
107
  var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.DRAG_AND_DROP;
108
+ var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
107
109
  return function (_ref4) {
108
110
  var _node$nodeSize, _api$analytics;
109
111
  var tr = _ref4.tr;
@@ -145,6 +147,13 @@ var moveNode = exports.moveNode = function moveNode(api) {
145
147
  inputMethod: inputMethod
146
148
  })
147
149
  })(tr);
150
+ if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
151
+ var _api$accessibilityUti;
152
+ var movedMessage = to > start ? _messages.blockControlsMessages.movedDown : _messages.blockControlsMessages.movedup;
153
+ api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
154
+ priority: 'important'
155
+ });
156
+ }
148
157
  return tr;
149
158
  };
150
159
  };
@@ -17,7 +17,7 @@ var _dropTarget = require("../ui/drop-target");
17
17
  var _mouseMoveWrapper = require("../ui/mouse-move-wrapper");
18
18
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
19
19
  var NESTED_DEPTH = (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? 100 : 0;
20
- var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(oldState, newState, api) {
20
+ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(oldState, newState, api, formatMessage) {
21
21
  var decs = [];
22
22
  unmountDecorations('data-blocks-drop-target-container');
23
23
  // Decoration state is used to keep track of the position of the drop targets
@@ -48,6 +48,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
48
48
  var dropTargetDec = /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
49
49
  api: api,
50
50
  id: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? pos : index,
51
+ formatMessage: formatMessage,
51
52
  prevNode: prevNode,
52
53
  nextNode: node
53
54
  });
@@ -90,7 +91,8 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
90
91
  element.setAttribute('data-blocks-drop-target-container', 'true');
91
92
  _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
92
93
  api: api,
93
- id: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length
94
+ id: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length,
95
+ formatMessage: formatMessage
94
96
  }), element);
95
97
  return element;
96
98
  }, {
@@ -10,7 +10,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
10
  var _moveNode = require("../commands/move-node");
11
11
  var _showDragHandle = require("../commands/show-drag-handle");
12
12
  var _consts = require("../consts");
13
- function keymapList(api) {
13
+ function keymapList(api, formatMessage) {
14
14
  var keymapList = {};
15
15
  if (api && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
16
16
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.showElementDragHandle.common, function (state, dispatch, view) {
@@ -18,11 +18,11 @@ function keymapList(api) {
18
18
  //we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
19
19
  return true;
20
20
  }, keymapList);
21
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveUp.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.UP), keymapList);
22
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveDown.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.DOWN), keymapList);
21
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveUp.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.UP, formatMessage), keymapList);
22
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.dragToMoveDown.common, (0, _moveNode.moveNodeViaShortcut)(api, _consts.DIRECTION.DOWN, formatMessage), keymapList);
23
23
  }
24
24
  return keymapList;
25
25
  }
26
- var boundKeydownHandler = exports.boundKeydownHandler = function boundKeydownHandler(api) {
27
- return (0, _keymap.keydownHandler)(keymapList(api));
26
+ var boundKeydownHandler = exports.boundKeydownHandler = function boundKeydownHandler(api, formatMessage) {
27
+ return (0, _keymap.keydownHandler)(keymapList(api, formatMessage));
28
28
  };
@@ -184,6 +184,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
184
184
  // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
185
185
  var maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 || (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
186
186
  var redrawDecorations = decorations === _view.DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== editorWidthLeft || (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== editorWidthRight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || isDecsMissing || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
187
+ var _getIntl = getIntl(),
188
+ formatMessage = _getIntl.formatMessage;
187
189
 
188
190
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
189
191
  if (redrawDecorations && !isResizerResizing && api) {
@@ -273,7 +275,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
273
275
  // Add drop targets when node is being dragged
274
276
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
275
277
  if (shouldUpdateDropTargets || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
276
- var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api),
278
+ var _dropTargetDecoration = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage),
277
279
  _decs2 = _dropTargetDecoration.decs,
278
280
  updatedDecorationState = _dropTargetDecoration.decorationState;
279
281
  decorationState = updatedDecorationState;
@@ -298,7 +300,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
298
300
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
299
301
  var shouldShowDragTarget = (meta === null || meta === void 0 ? void 0 : meta.isDragging) && (!tr.docChanged || tr.docChanged && isAnalyticTr);
300
302
  if (shouldShowDragTarget || (0, _dragTargetDebug.isBlocksDragTargetDebug)()) {
301
- var _dropTargetDecoration2 = (0, _decorations.dropTargetDecorations)(oldState, newState, api),
303
+ var _dropTargetDecoration2 = (0, _decorations.dropTargetDecorations)(oldState, newState, api, formatMessage),
302
304
  _decs3 = _dropTargetDecoration2.decs,
303
305
  _updatedDecorationState = _dropTargetDecoration2.decorationState;
304
306
  decorationState = _updatedDecorationState;
@@ -454,11 +456,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
454
456
  return true;
455
457
  }
456
458
  }
457
-
458
- //NOTE: altKey === 'option' on MacOS
459
- if (event.altKey && event.shiftKey && event.ctrlKey && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
459
+ if (event.shiftKey && event.ctrlKey && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873')) {
460
+ var _getIntl2 = getIntl(),
461
+ formatMessage = _getIntl2.formatMessage;
460
462
  //prevent holding down key combo from firing repeatedly
461
- if (!event.repeat && (0, _keymap.boundKeydownHandler)(api)(view, event)) {
463
+ if (!event.repeat && (0, _keymap.boundKeydownHandler)(api, formatMessage)(view, event)) {
462
464
  event.preventDefault();
463
465
  return true;
464
466
  }
@@ -367,27 +367,39 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
367
367
  description: formatMessage(_messages.blockControlsMessages.moveDown),
368
368
  keymap: _keymaps.dragToMoveDown
369
369
  }];
370
+ var message = helpDescriptors.map(function (descriptor) {
371
+ return descriptor.keymap ? [descriptor.description, (0, _keymaps.getAriaKeyshortcuts)(descriptor.keymap)] : [descriptor.description];
372
+ }).join('. ');
370
373
  var renderButton = function renderButton() {
371
- return (0, _react2.jsx)("button", {
372
- type: "button",
373
- css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
374
- ref: buttonRef
375
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
376
- ,
377
- style: (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
378
- onClick: handleOnClick,
379
- onMouseDown: (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
380
- onKeyDown: handleKeyDown,
381
- "data-testid": "block-ctrl-drag-handle"
382
- }, (0, _react2.jsx)(_dragHandler.default, {
383
- label: "",
384
- size: "medium"
385
- }));
374
+ return (
375
+ // eslint-disable-next-line @atlaskit/design-system/no-html-button
376
+ (0, _react2.jsx)("button", {
377
+ type: "button",
378
+ css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
379
+ ref: buttonRef
380
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
381
+ ,
382
+ style: (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
383
+ onClick: handleOnClick,
384
+ onMouseDown: (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
385
+ onKeyDown: handleKeyDown,
386
+ "data-testid": "block-ctrl-drag-handle"
387
+ }, (0, _react2.jsx)(_dragHandler.default, {
388
+ label: "",
389
+ size: "medium"
390
+ }))
391
+ );
386
392
  };
387
393
  return (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873') ? (0, _react2.jsx)(_tooltip.default, {
388
394
  content: (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
389
395
  helpDescriptors: helpDescriptors
390
- })
396
+ }),
397
+ onShow: function onShow() {
398
+ var _api$accessibilityUti;
399
+ api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
400
+ priority: 'important'
401
+ });
402
+ }
391
403
  }, renderButton()) : renderButton();
392
404
  };
393
405
  var DragHandle = exports.DragHandle = (0, _reactIntlNext.injectIntl)(DragHandleInternal);
@@ -79,7 +79,8 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
79
79
  var api = _ref3.api,
80
80
  id = _ref3.id,
81
81
  prevNode = _ref3.prevNode,
82
- nextNode = _ref3.nextNode;
82
+ nextNode = _ref3.nextNode,
83
+ formatMessage = _ref3.formatMessage;
83
84
  var ref = (0, _react.useRef)(null);
84
85
  var _useState = (0, _react.useState)(false),
85
86
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -119,11 +120,11 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
119
120
  if (activeNode && pos !== undefined) {
120
121
  var _api$core, _api$blockControls2;
121
122
  var start = activeNode.pos;
122
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveNode(start, pos));
123
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveNode(start, pos, undefined, formatMessage));
123
124
  }
124
125
  }
125
126
  });
126
- }, [id, api]);
127
+ }, [id, api, formatMessage]);
127
128
  var topTargetMarginStyle = (0, _react.useMemo)(function () {
128
129
  return getDropTargetPositionStyle(prevNode, nextNode);
129
130
  }, [prevNode, nextNode]);
@@ -1,4 +1,5 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
2
3
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
4
  import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
4
5
  import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
@@ -46,7 +47,7 @@ const getCurrentNodePos = state => {
46
47
  }
47
48
  return currentNodePos;
48
49
  };
49
- export const moveNodeViaShortcut = (api, direction) => {
50
+ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
50
51
  return state => {
51
52
  const currentNodePos = getCurrentNodePos(state);
52
53
  if (currentNodePos > -1) {
@@ -73,7 +74,7 @@ export const moveNodeViaShortcut = (api, direction) => {
73
74
  api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
74
75
  tr
75
76
  }) => {
76
- moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT)({
77
+ moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT, formatMessage)({
77
78
  tr
78
79
  });
79
80
  tr.scrollIntoView();
@@ -96,7 +97,7 @@ export const moveNodeViaShortcut = (api, direction) => {
96
97
  return false;
97
98
  };
98
99
  };
99
- export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_DROP) => ({
100
+ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_DROP, formatMessage) => ({
100
101
  tr
101
102
  }) => {
102
103
  var _node$nodeSize, _api$analytics;
@@ -139,5 +140,12 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
139
140
  })
140
141
  }
141
142
  })(tr);
143
+ if (fg('platform_editor_element_drag_and_drop_ed_23873')) {
144
+ var _api$accessibilityUti;
145
+ const movedMessage = to > start ? blockControlsMessages.movedDown : blockControlsMessages.movedup;
146
+ api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
147
+ priority: 'important'
148
+ });
149
+ }
142
150
  return tr;
143
151
  };
@@ -9,7 +9,7 @@ import { DropTarget } from '../ui/drop-target';
9
9
  import { MouseMoveWrapper } from '../ui/mouse-move-wrapper';
10
10
  const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
11
11
  const NESTED_DEPTH = fg('platform_editor_elements_dnd_nested') ? 100 : 0;
12
- export const dropTargetDecorations = (oldState, newState, api) => {
12
+ export const dropTargetDecorations = (oldState, newState, api, formatMessage) => {
13
13
  const decs = [];
14
14
  unmountDecorations('data-blocks-drop-target-container');
15
15
  // Decoration state is used to keep track of the position of the drop targets
@@ -40,6 +40,7 @@ export const dropTargetDecorations = (oldState, newState, api) => {
40
40
  const dropTargetDec = /*#__PURE__*/createElement(DropTarget, {
41
41
  api,
42
42
  id: fg('platform_editor_elements_dnd_nested') ? pos : index,
43
+ formatMessage,
43
44
  prevNode,
44
45
  nextNode: node
45
46
  });
@@ -82,7 +83,8 @@ export const dropTargetDecorations = (oldState, newState, api) => {
82
83
  element.setAttribute('data-blocks-drop-target-container', 'true');
83
84
  ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
84
85
  api,
85
- id: fg('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length
86
+ id: fg('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length,
87
+ formatMessage
86
88
  }), element);
87
89
  return element;
88
90
  }, {
@@ -4,7 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { moveNodeViaShortcut } from '../commands/move-node';
5
5
  import { showDragHandleAtSelection } from '../commands/show-drag-handle';
6
6
  import { DIRECTION } from '../consts';
7
- function keymapList(api) {
7
+ function keymapList(api, formatMessage) {
8
8
  let keymapList = {};
9
9
  if (api && fg('platform_editor_element_drag_and_drop_ed_23873')) {
10
10
  bindKeymapWithCommand(showElementDragHandle.common, (state, dispatch, view) => {
@@ -12,9 +12,9 @@ function keymapList(api) {
12
12
  //we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
13
13
  return true;
14
14
  }, keymapList);
15
- bindKeymapWithCommand(dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP), keymapList);
16
- bindKeymapWithCommand(dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN), keymapList);
15
+ bindKeymapWithCommand(dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP, formatMessage), keymapList);
16
+ bindKeymapWithCommand(dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN, formatMessage), keymapList);
17
17
  }
18
18
  return keymapList;
19
19
  }
20
- export const boundKeydownHandler = api => keydownHandler(keymapList(api));
20
+ export const boundKeydownHandler = (api, formatMessage) => keydownHandler(keymapList(api, formatMessage));
@@ -174,6 +174,9 @@ export const createPlugin = (api, getIntl) => {
174
174
  // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
175
175
  const maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 ? void 0 : (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
176
176
  const redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== editorWidthLeft || (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== editorWidthRight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || isDecsMissing || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
177
+ const {
178
+ formatMessage
179
+ } = getIntl();
177
180
 
178
181
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
179
182
  if (redrawDecorations && !isResizerResizing && api) {
@@ -262,7 +265,7 @@ export const createPlugin = (api, getIntl) => {
262
265
  const {
263
266
  decs,
264
267
  decorationState: updatedDecorationState
265
- } = dropTargetDecorations(oldState, newState, api);
268
+ } = dropTargetDecorations(oldState, newState, api, formatMessage);
266
269
  decorationState = updatedDecorationState;
267
270
  decorations = decorations.add(newState.doc, decs);
268
271
  }
@@ -289,7 +292,7 @@ export const createPlugin = (api, getIntl) => {
289
292
  const {
290
293
  decs,
291
294
  decorationState: updatedDecorationState
292
- } = dropTargetDecorations(oldState, newState, api);
295
+ } = dropTargetDecorations(oldState, newState, api, formatMessage);
293
296
  decorationState = updatedDecorationState;
294
297
  decorations = decorations.add(newState.doc, decs);
295
298
  }
@@ -447,11 +450,12 @@ export const createPlugin = (api, getIntl) => {
447
450
  return true;
448
451
  }
449
452
  }
450
-
451
- //NOTE: altKey === 'option' on MacOS
452
- if (event.altKey && event.shiftKey && event.ctrlKey && fg('platform_editor_element_drag_and_drop_ed_23873')) {
453
+ if (event.shiftKey && event.ctrlKey && fg('platform_editor_element_drag_and_drop_ed_23873')) {
454
+ const {
455
+ formatMessage
456
+ } = getIntl();
453
457
  //prevent holding down key combo from firing repeatedly
454
- if (!event.repeat && boundKeydownHandler(api)(view, event)) {
458
+ if (!event.repeat && boundKeydownHandler(api, formatMessage)(view, event)) {
455
459
  event.preventDefault();
456
460
  return true;
457
461
  }
@@ -9,7 +9,7 @@ import { bind } from 'bind-event-listener';
9
9
  import { injectIntl } from 'react-intl-next';
10
10
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
11
11
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
12
- import { dragToMoveDown, dragToMoveUp, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
12
+ import { dragToMoveDown, dragToMoveUp, getAriaKeyshortcuts, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
13
13
  import { blockControlsMessages } from '@atlaskit/editor-common/messages';
14
14
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
15
15
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
@@ -353,7 +353,12 @@ const DragHandleInternal = ({
353
353
  description: formatMessage(blockControlsMessages.moveDown),
354
354
  keymap: dragToMoveDown
355
355
  }];
356
- const renderButton = () => jsx("button", {
356
+ const message = helpDescriptors.map(descriptor => {
357
+ return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
358
+ }).join('. ');
359
+ const renderButton = () =>
360
+ // eslint-disable-next-line @atlaskit/design-system/no-html-button
361
+ jsx("button", {
357
362
  type: "button",
358
363
  css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
359
364
  ref: buttonRef
@@ -371,7 +376,13 @@ const DragHandleInternal = ({
371
376
  return fg('platform_editor_element_drag_and_drop_ed_23873') ? jsx(Tooltip, {
372
377
  content: jsx(TooltipContentWithMultipleShortcuts, {
373
378
  helpDescriptors: helpDescriptors
374
- })
379
+ }),
380
+ onShow: () => {
381
+ var _api$accessibilityUti;
382
+ api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(message, {
383
+ priority: 'important'
384
+ });
385
+ }
375
386
  }, renderButton()) : renderButton();
376
387
  };
377
388
  export const DragHandle = injectIntl(DragHandleInternal);
@@ -65,7 +65,8 @@ export const DropTarget = ({
65
65
  api,
66
66
  id,
67
67
  prevNode,
68
- nextNode
68
+ nextNode,
69
+ formatMessage
69
70
  }) => {
70
71
  const ref = useRef(null);
71
72
  const [isDraggedOver, setIsDraggedOver] = useState(false);
@@ -104,11 +105,11 @@ export const DropTarget = ({
104
105
  const {
105
106
  pos: start
106
107
  } = activeNode;
107
- api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(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.moveNode(start, pos));
108
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(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.moveNode(start, pos, undefined, formatMessage));
108
109
  }
109
110
  }
110
111
  });
111
- }, [id, api]);
112
+ }, [id, api, formatMessage]);
112
113
  const topTargetMarginStyle = useMemo(() => {
113
114
  return getDropTargetPositionStyle(prevNode, nextNode);
114
115
  }, [prevNode, nextNode]);
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
+ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
5
6
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
6
7
  import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
7
8
  import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
@@ -46,7 +47,7 @@ var getCurrentNodePos = function getCurrentNodePos(state) {
46
47
  }
47
48
  return currentNodePos;
48
49
  };
49
- export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction) {
50
+ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, formatMessage) {
50
51
  return function (state) {
51
52
  var currentNodePos = getCurrentNodePos(state);
52
53
  if (currentNodePos > -1) {
@@ -72,7 +73,7 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction) {
72
73
  var _api$core;
73
74
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
74
75
  var tr = _ref2.tr;
75
- moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT)({
76
+ moveNode(api)(currentNodePos, moveToPos, INPUT_METHOD.SHORTCUT, formatMessage)({
76
77
  tr: tr
77
78
  });
78
79
  tr.scrollIntoView();
@@ -97,6 +98,7 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction) {
97
98
  export var moveNode = function moveNode(api) {
98
99
  return function (start, to) {
99
100
  var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : INPUT_METHOD.DRAG_AND_DROP;
101
+ var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
100
102
  return function (_ref4) {
101
103
  var _node$nodeSize, _api$analytics;
102
104
  var tr = _ref4.tr;
@@ -138,6 +140,13 @@ export var moveNode = function moveNode(api) {
138
140
  inputMethod: inputMethod
139
141
  })
140
142
  })(tr);
143
+ if (fg('platform_editor_element_drag_and_drop_ed_23873')) {
144
+ var _api$accessibilityUti;
145
+ var movedMessage = to > start ? blockControlsMessages.movedDown : blockControlsMessages.movedup;
146
+ api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
147
+ priority: 'important'
148
+ });
149
+ }
141
150
  return tr;
142
151
  };
143
152
  };
@@ -10,7 +10,7 @@ import { DropTarget } from '../ui/drop-target';
10
10
  import { MouseMoveWrapper } from '../ui/mouse-move-wrapper';
11
11
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn'];
12
12
  var NESTED_DEPTH = fg('platform_editor_elements_dnd_nested') ? 100 : 0;
13
- export var dropTargetDecorations = function dropTargetDecorations(oldState, newState, api) {
13
+ export var dropTargetDecorations = function dropTargetDecorations(oldState, newState, api, formatMessage) {
14
14
  var decs = [];
15
15
  unmountDecorations('data-blocks-drop-target-container');
16
16
  // Decoration state is used to keep track of the position of the drop targets
@@ -41,6 +41,7 @@ export var dropTargetDecorations = function dropTargetDecorations(oldState, newS
41
41
  var dropTargetDec = /*#__PURE__*/createElement(DropTarget, {
42
42
  api: api,
43
43
  id: fg('platform_editor_elements_dnd_nested') ? pos : index,
44
+ formatMessage: formatMessage,
44
45
  prevNode: prevNode,
45
46
  nextNode: node
46
47
  });
@@ -83,7 +84,8 @@ export var dropTargetDecorations = function dropTargetDecorations(oldState, newS
83
84
  element.setAttribute('data-blocks-drop-target-container', 'true');
84
85
  ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
85
86
  api: api,
86
- id: fg('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length
87
+ id: fg('platform_editor_elements_dnd_nested') ? lastPos : decorationState.length,
88
+ formatMessage: formatMessage
87
89
  }), element);
88
90
  return element;
89
91
  }, {
@@ -4,7 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { moveNodeViaShortcut } from '../commands/move-node';
5
5
  import { showDragHandleAtSelection } from '../commands/show-drag-handle';
6
6
  import { DIRECTION } from '../consts';
7
- function keymapList(api) {
7
+ function keymapList(api, formatMessage) {
8
8
  var keymapList = {};
9
9
  if (api && fg('platform_editor_element_drag_and_drop_ed_23873')) {
10
10
  bindKeymapWithCommand(showElementDragHandle.common, function (state, dispatch, view) {
@@ -12,11 +12,11 @@ function keymapList(api) {
12
12
  //we always want to handle this shortcut to prevent default browser special char insert when option + alphabetical key is used
13
13
  return true;
14
14
  }, keymapList);
15
- bindKeymapWithCommand(dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP), keymapList);
16
- bindKeymapWithCommand(dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN), keymapList);
15
+ bindKeymapWithCommand(dragToMoveUp.common, moveNodeViaShortcut(api, DIRECTION.UP, formatMessage), keymapList);
16
+ bindKeymapWithCommand(dragToMoveDown.common, moveNodeViaShortcut(api, DIRECTION.DOWN, formatMessage), keymapList);
17
17
  }
18
18
  return keymapList;
19
19
  }
20
- export var boundKeydownHandler = function boundKeydownHandler(api) {
21
- return keydownHandler(keymapList(api));
20
+ export var boundKeydownHandler = function boundKeydownHandler(api, formatMessage) {
21
+ return keydownHandler(keymapList(api, formatMessage));
22
22
  };
@@ -177,6 +177,8 @@ export var createPlugin = function createPlugin(api, getIntl) {
177
177
  // The activeNode is from the previous rendering cycle, and verify if they share the same anchor.
178
178
  var maybeNodeWidthUpdated = (meta === null || meta === void 0 ? void 0 : meta.activeNode) && (meta === null || meta === void 0 || (_meta$activeNode = meta.activeNode) === null || _meta$activeNode === void 0 ? void 0 : _meta$activeNode.nodeType) === 'table' && meta.activeNode.anchorName === (activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName);
179
179
  var redrawDecorations = decorations === DecorationSet.empty || (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== editorHeight || (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== editorWidthLeft || (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== undefined && (meta === null || meta === void 0 ? void 0 : meta.editorWidthRight) !== editorWidthRight || maybeWidthUpdated || nodeCountChanged || maybeNodeWidthUpdated || resizerMeta === false || isDecsMissing || !!(meta !== null && meta !== void 0 && meta.nodeMoved) && tr.docChanged;
180
+ var _getIntl = getIntl(),
181
+ formatMessage = _getIntl.formatMessage;
180
182
 
181
183
  // Draw node and mouseWrapper decorations at top level node if decorations is empty, editor height changes or node is moved
182
184
  if (redrawDecorations && !isResizerResizing && api) {
@@ -266,7 +268,7 @@ export var createPlugin = function createPlugin(api, getIntl) {
266
268
  // Add drop targets when node is being dragged
267
269
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
268
270
  if (shouldUpdateDropTargets || isBlocksDragTargetDebug()) {
269
- var _dropTargetDecoration = dropTargetDecorations(oldState, newState, api),
271
+ var _dropTargetDecoration = dropTargetDecorations(oldState, newState, api, formatMessage),
270
272
  _decs2 = _dropTargetDecoration.decs,
271
273
  updatedDecorationState = _dropTargetDecoration.decorationState;
272
274
  decorationState = updatedDecorationState;
@@ -291,7 +293,7 @@ export var createPlugin = function createPlugin(api, getIntl) {
291
293
  // if the transaction is only for analytics and user is dragging, continue to draw drop targets
292
294
  var shouldShowDragTarget = (meta === null || meta === void 0 ? void 0 : meta.isDragging) && (!tr.docChanged || tr.docChanged && isAnalyticTr);
293
295
  if (shouldShowDragTarget || isBlocksDragTargetDebug()) {
294
- var _dropTargetDecoration2 = dropTargetDecorations(oldState, newState, api),
296
+ var _dropTargetDecoration2 = dropTargetDecorations(oldState, newState, api, formatMessage),
295
297
  _decs3 = _dropTargetDecoration2.decs,
296
298
  _updatedDecorationState = _dropTargetDecoration2.decorationState;
297
299
  decorationState = _updatedDecorationState;
@@ -447,11 +449,11 @@ export var createPlugin = function createPlugin(api, getIntl) {
447
449
  return true;
448
450
  }
449
451
  }
450
-
451
- //NOTE: altKey === 'option' on MacOS
452
- if (event.altKey && event.shiftKey && event.ctrlKey && fg('platform_editor_element_drag_and_drop_ed_23873')) {
452
+ if (event.shiftKey && event.ctrlKey && fg('platform_editor_element_drag_and_drop_ed_23873')) {
453
+ var _getIntl2 = getIntl(),
454
+ formatMessage = _getIntl2.formatMessage;
453
455
  //prevent holding down key combo from firing repeatedly
454
- if (!event.repeat && boundKeydownHandler(api)(view, event)) {
456
+ if (!event.repeat && boundKeydownHandler(api, formatMessage)(view, event)) {
455
457
  event.preventDefault();
456
458
  return true;
457
459
  }
@@ -10,7 +10,7 @@ import { bind } from 'bind-event-listener';
10
10
  import { injectIntl } from 'react-intl-next';
11
11
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
12
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
13
- import { dragToMoveDown, dragToMoveUp, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
13
+ import { dragToMoveDown, dragToMoveUp, getAriaKeyshortcuts, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
14
14
  import { blockControlsMessages } from '@atlaskit/editor-common/messages';
15
15
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
16
16
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
@@ -358,27 +358,39 @@ var DragHandleInternal = function DragHandleInternal(_ref) {
358
358
  description: formatMessage(blockControlsMessages.moveDown),
359
359
  keymap: dragToMoveDown
360
360
  }];
361
+ var message = helpDescriptors.map(function (descriptor) {
362
+ return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
363
+ }).join('. ');
361
364
  var renderButton = function renderButton() {
362
- return jsx("button", {
363
- type: "button",
364
- css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
365
- ref: buttonRef
366
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
367
- ,
368
- style: fg('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
369
- onClick: handleOnClick,
370
- onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
371
- onKeyDown: handleKeyDown,
372
- "data-testid": "block-ctrl-drag-handle"
373
- }, jsx(DragHandlerIcon, {
374
- label: "",
375
- size: "medium"
376
- }));
365
+ return (
366
+ // eslint-disable-next-line @atlaskit/design-system/no-html-button
367
+ jsx("button", {
368
+ type: "button",
369
+ css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
370
+ ref: buttonRef
371
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
372
+ ,
373
+ style: fg('platform_editor_element_drag_and_drop_ed_23896') ? newPositionStyles : positionStyles,
374
+ onClick: handleOnClick,
375
+ onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
376
+ onKeyDown: handleKeyDown,
377
+ "data-testid": "block-ctrl-drag-handle"
378
+ }, jsx(DragHandlerIcon, {
379
+ label: "",
380
+ size: "medium"
381
+ }))
382
+ );
377
383
  };
378
384
  return fg('platform_editor_element_drag_and_drop_ed_23873') ? jsx(Tooltip, {
379
385
  content: jsx(TooltipContentWithMultipleShortcuts, {
380
386
  helpDescriptors: helpDescriptors
381
- })
387
+ }),
388
+ onShow: function onShow() {
389
+ var _api$accessibilityUti;
390
+ api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
391
+ priority: 'important'
392
+ });
393
+ }
382
394
  }, renderButton()) : renderButton();
383
395
  };
384
396
  export var DragHandle = injectIntl(DragHandleInternal);
@@ -71,7 +71,8 @@ export var DropTarget = function DropTarget(_ref3) {
71
71
  var api = _ref3.api,
72
72
  id = _ref3.id,
73
73
  prevNode = _ref3.prevNode,
74
- nextNode = _ref3.nextNode;
74
+ nextNode = _ref3.nextNode,
75
+ formatMessage = _ref3.formatMessage;
75
76
  var ref = useRef(null);
76
77
  var _useState = useState(false),
77
78
  _useState2 = _slicedToArray(_useState, 2),
@@ -111,11 +112,11 @@ export var DropTarget = function DropTarget(_ref3) {
111
112
  if (activeNode && pos !== undefined) {
112
113
  var _api$core, _api$blockControls2;
113
114
  var start = activeNode.pos;
114
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveNode(start, pos));
115
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.moveNode(start, pos, undefined, formatMessage));
115
116
  }
116
117
  }
117
118
  });
118
- }, [id, api]);
119
+ }, [id, api, formatMessage]);
119
120
  var topTargetMarginStyle = useMemo(function () {
120
121
  return getDropTargetPositionStyle(prevNode, nextNode);
121
122
  }, [prevNode, nextNode]);
@@ -1,5 +1,6 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import { DIRECTION } from '../consts';
3
4
  import type { BlockControlsPlugin, MoveNodeMethod } from '../types';
4
- export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION) => Command;
5
- export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod) => EditorCommand;
5
+ export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
6
+ export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
@@ -3,7 +3,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin, HandleOptions } from '../types';
6
- export declare const dropTargetDecorations: (oldState: EditorState, newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>) => {
6
+ export declare const dropTargetDecorations: (oldState: EditorState, newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage']) => {
7
7
  decs: Decoration[];
8
8
  decorationState: {
9
9
  id: number;
@@ -1,3 +1,4 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { BlockControlsPlugin } from '../types';
3
- export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (view: import("prosemirror-view").EditorView, event: KeyboardEvent) => boolean;
4
+ export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: import("prosemirror-view").EditorView, event: KeyboardEvent) => boolean;
@@ -1,5 +1,7 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
+ import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
3
5
  import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -45,11 +47,12 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
45
47
  OptionalPlugin<EditorDisabledPlugin>,
46
48
  OptionalPlugin<WidthPlugin>,
47
49
  OptionalPlugin<FeatureFlagsPlugin>,
48
- OptionalPlugin<AnalyticsPlugin>
50
+ OptionalPlugin<AnalyticsPlugin>,
51
+ OptionalPlugin<AccessibilityUtilsPlugin>
49
52
  ];
50
53
  sharedState: BlockControlsSharedState;
51
54
  commands: {
52
- moveNode: (start: number, to: number, inputMethod?: MoveNodeMethod) => EditorCommand;
55
+ moveNode: (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
53
56
  showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
54
57
  setNodeDragged: (posNumber: number, anchorName: string, nodeType: string) => EditorCommand;
55
58
  };
@@ -1,10 +1,16 @@
1
+ /// <reference types="react" />
1
2
  import { jsx } from '@emotion/react';
3
+ import { type IntlShape } from 'react-intl-next';
2
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
5
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
6
  import type { BlockControlsPlugin } from '../types';
5
- export declare const DropTarget: ({ api, id, prevNode, nextNode, }: {
7
+ export declare const DropTarget: ({ api, id, prevNode, nextNode, formatMessage, }: {
6
8
  api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
7
9
  id: number;
8
10
  prevNode?: PMNode | undefined;
9
11
  nextNode?: PMNode | undefined;
12
+ formatMessage?: {
13
+ (descriptor: import("react-intl-next").MessageDescriptor, values?: Record<string, import("intl-messageformat").PrimitiveType | import("intl-messageformat").FormatXMLElementFn<string, string>> | undefined, opts?: import("intl-messageformat").Options | undefined): string;
14
+ (descriptor: import("react-intl-next").MessageDescriptor, values?: Record<string, string | number | boolean | {} | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray | import("react").ReactPortal | Date | import("intl-messageformat").FormatXMLElementFn<import("react").ReactNode, import("react").ReactNode> | null | undefined> | undefined, opts?: import("intl-messageformat").Options | undefined): import("react").ReactNode;
15
+ } | undefined;
10
16
  }) => jsx.JSX.Element;
@@ -1,5 +1,6 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import { DIRECTION } from '../consts';
3
4
  import type { BlockControlsPlugin, MoveNodeMethod } from '../types';
4
- export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION) => Command;
5
- export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod) => EditorCommand;
5
+ export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
6
+ export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
@@ -3,7 +3,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { BlockControlsPlugin, HandleOptions } from '../types';
6
- export declare const dropTargetDecorations: (oldState: EditorState, newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>) => {
6
+ export declare const dropTargetDecorations: (oldState: EditorState, newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage']) => {
7
7
  decs: Decoration[];
8
8
  decorationState: {
9
9
  id: number;
@@ -1,3 +1,4 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { BlockControlsPlugin } from '../types';
3
- export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (view: import("prosemirror-view").EditorView, event: KeyboardEvent) => boolean;
4
+ export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: import("prosemirror-view").EditorView, event: KeyboardEvent) => boolean;
@@ -1,5 +1,7 @@
1
+ import { type IntlShape } from 'react-intl-next';
1
2
  import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
+ import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
3
5
  import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -45,11 +47,12 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
45
47
  OptionalPlugin<EditorDisabledPlugin>,
46
48
  OptionalPlugin<WidthPlugin>,
47
49
  OptionalPlugin<FeatureFlagsPlugin>,
48
- OptionalPlugin<AnalyticsPlugin>
50
+ OptionalPlugin<AnalyticsPlugin>,
51
+ OptionalPlugin<AccessibilityUtilsPlugin>
49
52
  ];
50
53
  sharedState: BlockControlsSharedState;
51
54
  commands: {
52
- moveNode: (start: number, to: number, inputMethod?: MoveNodeMethod) => EditorCommand;
55
+ moveNode: (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
53
56
  showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
54
57
  setNodeDragged: (posNumber: number, anchorName: string, nodeType: string) => EditorCommand;
55
58
  };
@@ -1,10 +1,16 @@
1
+ /// <reference types="react" />
1
2
  import { jsx } from '@emotion/react';
3
+ import { type IntlShape } from 'react-intl-next';
2
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
5
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
6
  import type { BlockControlsPlugin } from '../types';
5
- export declare const DropTarget: ({ api, id, prevNode, nextNode, }: {
7
+ export declare const DropTarget: ({ api, id, prevNode, nextNode, formatMessage, }: {
6
8
  api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
7
9
  id: number;
8
10
  prevNode?: PMNode | undefined;
9
11
  nextNode?: PMNode | undefined;
12
+ formatMessage?: {
13
+ (descriptor: import("react-intl-next").MessageDescriptor, values?: Record<string, import("intl-messageformat").PrimitiveType | import("intl-messageformat").FormatXMLElementFn<string, string>> | undefined, opts?: import("intl-messageformat").Options | undefined): string;
14
+ (descriptor: import("react-intl-next").MessageDescriptor, values?: Record<string, string | number | boolean | {} | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray | import("react").ReactPortal | Date | import("intl-messageformat").FormatXMLElementFn<import("react").ReactNode, import("react").ReactNode> | null | undefined> | undefined, opts?: import("intl-messageformat").Options | undefined): import("react").ReactNode;
15
+ } | undefined;
10
16
  }) => jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^40.3.0",
35
- "@atlaskit/editor-common": "^87.2.0",
35
+ "@atlaskit/editor-common": "^87.3.0",
36
+ "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
37
  "@atlaskit/editor-plugin-analytics": "^1.6.0",
37
38
  "@atlaskit/editor-plugin-editor-disabled": "^1.2.0",
38
39
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
@@ -40,7 +41,7 @@
40
41
  "@atlaskit/editor-prosemirror": "5.0.1",
41
42
  "@atlaskit/editor-shared-styles": "^2.13.0",
42
43
  "@atlaskit/editor-tables": "^2.8.0",
43
- "@atlaskit/icon": "^22.8.0",
44
+ "@atlaskit/icon": "^22.9.0",
44
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
45
46
  "@atlaskit/pragmatic-drag-and-drop": "^1.2.0",
46
47
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",