@atlaskit/editor-plugin-block-controls 7.1.1 → 7.2.0
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 +12 -0
- package/dist/cjs/blockControlsPlugin.js +2 -1
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/ui/drag-handle.js +31 -19
- package/dist/es2019/blockControlsPlugin.js +2 -1
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/ui/drag-handle.js +29 -19
- package/dist/esm/blockControlsPlugin.js +2 -1
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/ui/drag-handle.js +31 -19
- package/dist/types/blockControlsPluginType.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0778701e62192`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0778701e62192) -
|
|
8
|
+
[ux] ED-29424 Focus first menu item when block menu is opened and remove decorations when delete
|
|
9
|
+
button unmounts
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 7.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -117,7 +117,8 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
117
117
|
moveDown = _canMoveNodeUpOrDown.moveDown;
|
|
118
118
|
toggleMenuMeta = _objectSpread(_objectSpread({}, toggleMenuMeta), {}, {
|
|
119
119
|
moveUp: moveUp,
|
|
120
|
-
moveDown: moveDown
|
|
120
|
+
moveDown: moveDown,
|
|
121
|
+
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? options === null || options === void 0 ? void 0 : options.openedViaKeyboard : undefined
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
@@ -240,7 +240,7 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
240
240
|
return nodeDecAtActivePos;
|
|
241
241
|
};
|
|
242
242
|
var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
243
|
-
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
243
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
244
244
|
var activeNode = currentState.activeNode,
|
|
245
245
|
decorations = currentState.decorations,
|
|
246
246
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -544,7 +544,8 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
544
544
|
menuTriggerBy: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
545
545
|
blockMenuOptions: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
546
546
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
547
|
-
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown
|
|
547
|
+
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
548
|
+
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
548
549
|
} : undefined,
|
|
549
550
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
550
551
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -275,7 +275,7 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
275
275
|
return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
|
|
276
276
|
};
|
|
277
277
|
var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
278
|
-
var _api$core2, _api$blockControls4, _api$analytics2, _api$
|
|
278
|
+
var _api$core2, _api$blockControls4, _api$analytics2, _api$core4, _api$core6, _api$blockControls6, _api$userIntent2;
|
|
279
279
|
var view = _ref.view,
|
|
280
280
|
api = _ref.api,
|
|
281
281
|
formatMessage = _ref.formatMessage,
|
|
@@ -361,7 +361,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
361
361
|
if (_consts2.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
362
362
|
var _api$blockControls;
|
|
363
363
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
364
|
-
anchorName: anchorName
|
|
364
|
+
anchorName: anchorName,
|
|
365
|
+
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
365
366
|
})({
|
|
366
367
|
tr: tr
|
|
367
368
|
});
|
|
@@ -369,7 +370,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
369
370
|
} else if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
370
371
|
var _api$blockControls2;
|
|
371
372
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
|
|
372
|
-
anchorName: anchorName
|
|
373
|
+
anchorName: anchorName,
|
|
374
|
+
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
373
375
|
})({
|
|
374
376
|
tr: tr
|
|
375
377
|
});
|
|
@@ -437,33 +439,43 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
437
439
|
});
|
|
438
440
|
return tr;
|
|
439
441
|
});
|
|
440
|
-
} else if (
|
|
441
|
-
|
|
442
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
443
|
+
return pressed;
|
|
444
|
+
})) {
|
|
445
|
+
// If not trying to press shortcut keys,
|
|
446
|
+
// return focus to editor to resume editing from caret position
|
|
447
|
+
view.focus();
|
|
448
|
+
}
|
|
449
|
+
}, [getPos, api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
450
|
+
var handleKeyDownNew = (0, _react.useCallback)(function (e) {
|
|
451
|
+
// allow user to use spacebar to select the node
|
|
452
|
+
if (e.key === 'Enter' || !e.repeat && e.key === ' ') {
|
|
453
|
+
var _api$core5;
|
|
442
454
|
if (document.activeElement !== buttonRef.current) {
|
|
443
455
|
return;
|
|
444
456
|
}
|
|
445
457
|
e.preventDefault();
|
|
446
458
|
e.stopPropagation();
|
|
447
|
-
|
|
448
|
-
api === null || api === void 0 || (_api$
|
|
449
|
-
var _api$blockControls5, _api$userIntent
|
|
459
|
+
var startPos = getPos();
|
|
460
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref4) {
|
|
461
|
+
var _api$blockControls5, _api$userIntent;
|
|
450
462
|
var tr = _ref4.tr;
|
|
451
|
-
var startPos = getPos();
|
|
452
463
|
if (startPos === undefined) {
|
|
453
464
|
return tr;
|
|
454
465
|
}
|
|
455
466
|
tr = (0, _getSelection.selectNode)(tr, startPos, nodeType);
|
|
467
|
+
!isMultiSelect && tr.setMeta(_main.key, {
|
|
468
|
+
pos: startPos
|
|
469
|
+
});
|
|
456
470
|
api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.toggleBlockMenu({
|
|
457
|
-
anchorName: anchorName
|
|
471
|
+
anchorName: anchorName,
|
|
472
|
+
openedViaKeyboard: true
|
|
458
473
|
})({
|
|
459
474
|
tr: tr
|
|
460
475
|
});
|
|
461
476
|
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen')({
|
|
462
477
|
tr: tr
|
|
463
478
|
});
|
|
464
|
-
api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setSelectedViaDragHandle(true)({
|
|
465
|
-
tr: tr
|
|
466
|
-
});
|
|
467
479
|
return tr;
|
|
468
480
|
});
|
|
469
481
|
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
@@ -473,7 +485,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
473
485
|
// return focus to editor to resume editing from caret position
|
|
474
486
|
view.focus();
|
|
475
487
|
}
|
|
476
|
-
}, [getPos, api === null || api === void 0 || (_api$
|
|
488
|
+
}, [getPos, api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands, api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands, nodeType, isMultiSelect, anchorName, view]);
|
|
477
489
|
(0, _react.useEffect)(function () {
|
|
478
490
|
var element = buttonRef.current;
|
|
479
491
|
if (!element) {
|
|
@@ -491,8 +503,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
491
503
|
var _api$blockControls$sh2;
|
|
492
504
|
var nativeSetDragImage = _ref5.nativeSetDragImage;
|
|
493
505
|
if (isMultiSelect) {
|
|
494
|
-
var _api$
|
|
495
|
-
api === null || api === void 0 || (_api$
|
|
506
|
+
var _api$core7;
|
|
507
|
+
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref6) {
|
|
496
508
|
var tr = _ref6.tr;
|
|
497
509
|
var handlePos = getPos();
|
|
498
510
|
if (typeof handlePos !== 'number') {
|
|
@@ -605,11 +617,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
605
617
|
});
|
|
606
618
|
},
|
|
607
619
|
onDragStart: function onDragStart() {
|
|
608
|
-
var _api$
|
|
620
|
+
var _api$core8;
|
|
609
621
|
if (start === undefined) {
|
|
610
622
|
return;
|
|
611
623
|
}
|
|
612
|
-
api === null || api === void 0 || (_api$
|
|
624
|
+
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (_ref8) {
|
|
613
625
|
var _api$blockControls$sh3, _api$blockControls8, _api$analytics3;
|
|
614
626
|
var tr = _ref8.tr;
|
|
615
627
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
@@ -923,7 +935,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
923
935
|
style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
924
936
|
onClick: handleOnClick,
|
|
925
937
|
onMouseDown: handleMouseDown,
|
|
926
|
-
onKeyDown: handleKeyDown
|
|
938
|
+
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
927
939
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
928
940
|
,
|
|
929
941
|
onDrop: handleOnDrop,
|
|
@@ -110,7 +110,8 @@ export const blockControlsPlugin = ({
|
|
|
110
110
|
toggleMenuMeta = {
|
|
111
111
|
...toggleMenuMeta,
|
|
112
112
|
moveUp,
|
|
113
|
-
moveDown
|
|
113
|
+
moveDown,
|
|
114
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? options === null || options === void 0 ? void 0 : options.openedViaKeyboard : undefined
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
117
|
tr.setMeta(key, {
|
|
@@ -234,7 +234,7 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
|
|
|
234
234
|
return nodeDecAtActivePos;
|
|
235
235
|
};
|
|
236
236
|
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
|
|
237
|
-
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
237
|
+
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
238
238
|
let {
|
|
239
239
|
activeNode,
|
|
240
240
|
decorations,
|
|
@@ -542,7 +542,8 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
542
542
|
menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
543
543
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
544
544
|
canMoveUp: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.moveUp) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
545
|
-
canMoveDown: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown
|
|
545
|
+
canMoveDown: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
546
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
546
547
|
} : undefined,
|
|
547
548
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
548
549
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -280,7 +280,7 @@ export const DragHandle = ({
|
|
|
280
280
|
isTopLevelNode = true,
|
|
281
281
|
anchorRectCache
|
|
282
282
|
}) => {
|
|
283
|
-
var _api$core2, _api$blockControls4, _api$analytics2, _api$
|
|
283
|
+
var _api$core2, _api$blockControls4, _api$analytics2, _api$core4, _api$core6, _api$blockControls6, _api$userIntent2;
|
|
284
284
|
const buttonRef = useRef(null);
|
|
285
285
|
const [dragHandleSelected, setDragHandleSelected] = useState(false);
|
|
286
286
|
const [dragHandleDisabled, setDragHandleDisabled] = useState(false);
|
|
@@ -341,7 +341,8 @@ export const DragHandle = ({
|
|
|
341
341
|
if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
342
342
|
var _api$blockControls;
|
|
343
343
|
api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
344
|
-
anchorName
|
|
344
|
+
anchorName,
|
|
345
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
345
346
|
})({
|
|
346
347
|
tr
|
|
347
348
|
});
|
|
@@ -349,7 +350,8 @@ export const DragHandle = ({
|
|
|
349
350
|
} else if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
350
351
|
var _api$blockControls2;
|
|
351
352
|
api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.toggleBlockMenu({
|
|
352
|
-
anchorName
|
|
353
|
+
anchorName,
|
|
354
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
353
355
|
})({
|
|
354
356
|
tr
|
|
355
357
|
});
|
|
@@ -418,34 +420,42 @@ export const DragHandle = ({
|
|
|
418
420
|
});
|
|
419
421
|
return tr;
|
|
420
422
|
});
|
|
421
|
-
} else if (
|
|
422
|
-
|
|
423
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(pressed => pressed)) {
|
|
424
|
+
// If not trying to press shortcut keys,
|
|
425
|
+
// return focus to editor to resume editing from caret position
|
|
426
|
+
view.focus();
|
|
427
|
+
}
|
|
428
|
+
}, [getPos, api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
429
|
+
const handleKeyDownNew = useCallback(e => {
|
|
430
|
+
// allow user to use spacebar to select the node
|
|
431
|
+
if (e.key === 'Enter' || !e.repeat && e.key === ' ') {
|
|
432
|
+
var _api$core5;
|
|
423
433
|
if (document.activeElement !== buttonRef.current) {
|
|
424
434
|
return;
|
|
425
435
|
}
|
|
426
436
|
e.preventDefault();
|
|
427
437
|
e.stopPropagation();
|
|
428
|
-
|
|
429
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
438
|
+
const startPos = getPos();
|
|
439
|
+
api === null || api === void 0 ? void 0 : (_api$core5 = api.core) === null || _api$core5 === void 0 ? void 0 : _api$core5.actions.execute(({
|
|
430
440
|
tr
|
|
431
441
|
}) => {
|
|
432
|
-
var _api$blockControls5, _api$userIntent
|
|
433
|
-
const startPos = getPos();
|
|
442
|
+
var _api$blockControls5, _api$userIntent;
|
|
434
443
|
if (startPos === undefined) {
|
|
435
444
|
return tr;
|
|
436
445
|
}
|
|
437
446
|
tr = selectNode(tr, startPos, nodeType);
|
|
447
|
+
!isMultiSelect && tr.setMeta(key, {
|
|
448
|
+
pos: startPos
|
|
449
|
+
});
|
|
438
450
|
api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu({
|
|
439
|
-
anchorName
|
|
451
|
+
anchorName,
|
|
452
|
+
openedViaKeyboard: true
|
|
440
453
|
})({
|
|
441
454
|
tr
|
|
442
455
|
});
|
|
443
456
|
api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen')({
|
|
444
457
|
tr
|
|
445
458
|
});
|
|
446
|
-
api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.setSelectedViaDragHandle(true)({
|
|
447
|
-
tr
|
|
448
|
-
});
|
|
449
459
|
return tr;
|
|
450
460
|
});
|
|
451
461
|
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(pressed => pressed)) {
|
|
@@ -453,7 +463,7 @@ export const DragHandle = ({
|
|
|
453
463
|
// return focus to editor to resume editing from caret position
|
|
454
464
|
view.focus();
|
|
455
465
|
}
|
|
456
|
-
}, [getPos, api === null || api === void 0 ? void 0 : (_api$
|
|
466
|
+
}, [getPos, api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands, api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands, nodeType, isMultiSelect, anchorName, view]);
|
|
457
467
|
useEffect(() => {
|
|
458
468
|
const element = buttonRef.current;
|
|
459
469
|
if (!element) {
|
|
@@ -470,8 +480,8 @@ export const DragHandle = ({
|
|
|
470
480
|
}) => {
|
|
471
481
|
var _api$blockControls$sh2;
|
|
472
482
|
if (isMultiSelect) {
|
|
473
|
-
var _api$
|
|
474
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
483
|
+
var _api$core7;
|
|
484
|
+
api === null || api === void 0 ? void 0 : (_api$core7 = api.core) === null || _api$core7 === void 0 ? void 0 : _api$core7.actions.execute(({
|
|
475
485
|
tr
|
|
476
486
|
}) => {
|
|
477
487
|
const handlePos = getPos();
|
|
@@ -590,11 +600,11 @@ export const DragHandle = ({
|
|
|
590
600
|
});
|
|
591
601
|
},
|
|
592
602
|
onDragStart() {
|
|
593
|
-
var _api$
|
|
603
|
+
var _api$core8;
|
|
594
604
|
if (start === undefined) {
|
|
595
605
|
return;
|
|
596
606
|
}
|
|
597
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
607
|
+
api === null || api === void 0 ? void 0 : (_api$core8 = api.core) === null || _api$core8 === void 0 ? void 0 : _api$core8.actions.execute(({
|
|
598
608
|
tr
|
|
599
609
|
}) => {
|
|
600
610
|
var _api$blockControls$sh3, _api$blockControls8, _api$analytics3;
|
|
@@ -913,7 +923,7 @@ export const DragHandle = ({
|
|
|
913
923
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
914
924
|
onClick: handleOnClick,
|
|
915
925
|
onMouseDown: handleMouseDown,
|
|
916
|
-
onKeyDown: handleKeyDown
|
|
926
|
+
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
917
927
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
918
928
|
,
|
|
919
929
|
onDrop: handleOnDrop,
|
|
@@ -110,7 +110,8 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
110
110
|
moveDown = _canMoveNodeUpOrDown.moveDown;
|
|
111
111
|
toggleMenuMeta = _objectSpread(_objectSpread({}, toggleMenuMeta), {}, {
|
|
112
112
|
moveUp: moveUp,
|
|
113
|
-
moveDown: moveDown
|
|
113
|
+
moveDown: moveDown,
|
|
114
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? options === null || options === void 0 ? void 0 : options.openedViaKeyboard : undefined
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
@@ -233,7 +233,7 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
233
233
|
return nodeDecAtActivePos;
|
|
234
234
|
};
|
|
235
235
|
var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
236
|
-
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
236
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
237
237
|
var activeNode = currentState.activeNode,
|
|
238
238
|
decorations = currentState.decorations,
|
|
239
239
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -537,7 +537,8 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
537
537
|
menuTriggerBy: editorExperiment('platform_editor_controls', 'variant1') || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
538
538
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
539
539
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
540
|
-
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown
|
|
540
|
+
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
541
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
541
542
|
} : undefined,
|
|
542
543
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
543
544
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -272,7 +272,7 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
272
272
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
273
273
|
};
|
|
274
274
|
export var DragHandle = function DragHandle(_ref) {
|
|
275
|
-
var _api$core2, _api$blockControls4, _api$analytics2, _api$
|
|
275
|
+
var _api$core2, _api$blockControls4, _api$analytics2, _api$core4, _api$core6, _api$blockControls6, _api$userIntent2;
|
|
276
276
|
var view = _ref.view,
|
|
277
277
|
api = _ref.api,
|
|
278
278
|
formatMessage = _ref.formatMessage,
|
|
@@ -358,7 +358,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
358
358
|
if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
359
359
|
var _api$blockControls;
|
|
360
360
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
361
|
-
anchorName: anchorName
|
|
361
|
+
anchorName: anchorName,
|
|
362
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
362
363
|
})({
|
|
363
364
|
tr: tr
|
|
364
365
|
});
|
|
@@ -366,7 +367,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
366
367
|
} else if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
367
368
|
var _api$blockControls2;
|
|
368
369
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
|
|
369
|
-
anchorName: anchorName
|
|
370
|
+
anchorName: anchorName,
|
|
371
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
370
372
|
})({
|
|
371
373
|
tr: tr
|
|
372
374
|
});
|
|
@@ -434,33 +436,43 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
434
436
|
});
|
|
435
437
|
return tr;
|
|
436
438
|
});
|
|
437
|
-
} else if (
|
|
438
|
-
|
|
439
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
440
|
+
return pressed;
|
|
441
|
+
})) {
|
|
442
|
+
// If not trying to press shortcut keys,
|
|
443
|
+
// return focus to editor to resume editing from caret position
|
|
444
|
+
view.focus();
|
|
445
|
+
}
|
|
446
|
+
}, [getPos, api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
447
|
+
var handleKeyDownNew = useCallback(function (e) {
|
|
448
|
+
// allow user to use spacebar to select the node
|
|
449
|
+
if (e.key === 'Enter' || !e.repeat && e.key === ' ') {
|
|
450
|
+
var _api$core5;
|
|
439
451
|
if (document.activeElement !== buttonRef.current) {
|
|
440
452
|
return;
|
|
441
453
|
}
|
|
442
454
|
e.preventDefault();
|
|
443
455
|
e.stopPropagation();
|
|
444
|
-
|
|
445
|
-
api === null || api === void 0 || (_api$
|
|
446
|
-
var _api$blockControls5, _api$userIntent
|
|
456
|
+
var startPos = getPos();
|
|
457
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref4) {
|
|
458
|
+
var _api$blockControls5, _api$userIntent;
|
|
447
459
|
var tr = _ref4.tr;
|
|
448
|
-
var startPos = getPos();
|
|
449
460
|
if (startPos === undefined) {
|
|
450
461
|
return tr;
|
|
451
462
|
}
|
|
452
463
|
tr = selectNode(tr, startPos, nodeType);
|
|
464
|
+
!isMultiSelect && tr.setMeta(key, {
|
|
465
|
+
pos: startPos
|
|
466
|
+
});
|
|
453
467
|
api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.toggleBlockMenu({
|
|
454
|
-
anchorName: anchorName
|
|
468
|
+
anchorName: anchorName,
|
|
469
|
+
openedViaKeyboard: true
|
|
455
470
|
})({
|
|
456
471
|
tr: tr
|
|
457
472
|
});
|
|
458
473
|
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen')({
|
|
459
474
|
tr: tr
|
|
460
475
|
});
|
|
461
|
-
api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setSelectedViaDragHandle(true)({
|
|
462
|
-
tr: tr
|
|
463
|
-
});
|
|
464
476
|
return tr;
|
|
465
477
|
});
|
|
466
478
|
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
@@ -470,7 +482,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
470
482
|
// return focus to editor to resume editing from caret position
|
|
471
483
|
view.focus();
|
|
472
484
|
}
|
|
473
|
-
}, [getPos, api === null || api === void 0 || (_api$
|
|
485
|
+
}, [getPos, api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands, api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands, nodeType, isMultiSelect, anchorName, view]);
|
|
474
486
|
useEffect(function () {
|
|
475
487
|
var element = buttonRef.current;
|
|
476
488
|
if (!element) {
|
|
@@ -488,8 +500,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
488
500
|
var _api$blockControls$sh2;
|
|
489
501
|
var nativeSetDragImage = _ref5.nativeSetDragImage;
|
|
490
502
|
if (isMultiSelect) {
|
|
491
|
-
var _api$
|
|
492
|
-
api === null || api === void 0 || (_api$
|
|
503
|
+
var _api$core7;
|
|
504
|
+
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref6) {
|
|
493
505
|
var tr = _ref6.tr;
|
|
494
506
|
var handlePos = getPos();
|
|
495
507
|
if (typeof handlePos !== 'number') {
|
|
@@ -602,11 +614,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
602
614
|
});
|
|
603
615
|
},
|
|
604
616
|
onDragStart: function onDragStart() {
|
|
605
|
-
var _api$
|
|
617
|
+
var _api$core8;
|
|
606
618
|
if (start === undefined) {
|
|
607
619
|
return;
|
|
608
620
|
}
|
|
609
|
-
api === null || api === void 0 || (_api$
|
|
621
|
+
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (_ref8) {
|
|
610
622
|
var _api$blockControls$sh3, _api$blockControls8, _api$analytics3;
|
|
611
623
|
var tr = _ref8.tr;
|
|
612
624
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
@@ -920,7 +932,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
920
932
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
921
933
|
onClick: handleOnClick,
|
|
922
934
|
onMouseDown: handleMouseDown,
|
|
923
|
-
onKeyDown: handleKeyDown
|
|
935
|
+
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
924
936
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
925
937
|
,
|
|
926
938
|
onDrop: handleOnDrop,
|
|
@@ -41,6 +41,7 @@ export interface PluginState {
|
|
|
41
41
|
blockMenuOptions?: {
|
|
42
42
|
canMoveDown?: boolean;
|
|
43
43
|
canMoveUp?: boolean;
|
|
44
|
+
openedViaKeyboard?: boolean;
|
|
44
45
|
};
|
|
45
46
|
decorations: DecorationSet;
|
|
46
47
|
editorHeight: number;
|
|
@@ -71,6 +72,7 @@ export type BlockControlsSharedState = {
|
|
|
71
72
|
blockMenuOptions?: {
|
|
72
73
|
canMoveDown?: boolean;
|
|
73
74
|
canMoveUp?: boolean;
|
|
75
|
+
openedViaKeyboard?: boolean;
|
|
74
76
|
};
|
|
75
77
|
isDragging: boolean;
|
|
76
78
|
isEditing?: boolean;
|
|
@@ -124,6 +126,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
124
126
|
toggleBlockMenu: (options?: {
|
|
125
127
|
anchorName?: string;
|
|
126
128
|
closeMenu?: boolean;
|
|
129
|
+
openedViaKeyboard?: boolean;
|
|
127
130
|
}) => EditorCommand;
|
|
128
131
|
};
|
|
129
132
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -22,6 +22,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
22
22
|
blockMenuOptions: {
|
|
23
23
|
canMoveUp: any;
|
|
24
24
|
canMoveDown: any;
|
|
25
|
+
openedViaKeyboard: any;
|
|
25
26
|
} | undefined;
|
|
26
27
|
editorHeight: any;
|
|
27
28
|
editorWidthLeft: any;
|
|
@@ -44,6 +45,7 @@ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin
|
|
|
44
45
|
blockMenuOptions: {
|
|
45
46
|
canMoveUp: any;
|
|
46
47
|
canMoveDown: any;
|
|
48
|
+
openedViaKeyboard: any;
|
|
47
49
|
} | undefined;
|
|
48
50
|
editorHeight: any;
|
|
49
51
|
editorWidthLeft: any;
|
|
@@ -41,6 +41,7 @@ export interface PluginState {
|
|
|
41
41
|
blockMenuOptions?: {
|
|
42
42
|
canMoveDown?: boolean;
|
|
43
43
|
canMoveUp?: boolean;
|
|
44
|
+
openedViaKeyboard?: boolean;
|
|
44
45
|
};
|
|
45
46
|
decorations: DecorationSet;
|
|
46
47
|
editorHeight: number;
|
|
@@ -71,6 +72,7 @@ export type BlockControlsSharedState = {
|
|
|
71
72
|
blockMenuOptions?: {
|
|
72
73
|
canMoveDown?: boolean;
|
|
73
74
|
canMoveUp?: boolean;
|
|
75
|
+
openedViaKeyboard?: boolean;
|
|
74
76
|
};
|
|
75
77
|
isDragging: boolean;
|
|
76
78
|
isEditing?: boolean;
|
|
@@ -124,6 +126,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
124
126
|
toggleBlockMenu: (options?: {
|
|
125
127
|
anchorName?: string;
|
|
126
128
|
closeMenu?: boolean;
|
|
129
|
+
openedViaKeyboard?: boolean;
|
|
127
130
|
}) => EditorCommand;
|
|
128
131
|
};
|
|
129
132
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -22,6 +22,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
22
22
|
blockMenuOptions: {
|
|
23
23
|
canMoveUp: any;
|
|
24
24
|
canMoveDown: any;
|
|
25
|
+
openedViaKeyboard: any;
|
|
25
26
|
} | undefined;
|
|
26
27
|
editorHeight: any;
|
|
27
28
|
editorWidthLeft: any;
|
|
@@ -44,6 +45,7 @@ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin
|
|
|
44
45
|
blockMenuOptions: {
|
|
45
46
|
canMoveUp: any;
|
|
46
47
|
canMoveDown: any;
|
|
48
|
+
openedViaKeyboard: any;
|
|
47
49
|
} | undefined;
|
|
48
50
|
editorHeight: any;
|
|
49
51
|
editorWidthLeft: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^51.2.0",
|
|
32
32
|
"@atlaskit/editor-plugin-accessibility-utils": "^6.0.0",
|
|
33
|
-
"@atlaskit/editor-plugin-analytics": "^6.
|
|
33
|
+
"@atlaskit/editor-plugin-analytics": "^6.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-editor-disabled": "^6.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-interaction": "^8.0.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^3.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@atlaskit/editor-common": "^110.
|
|
67
|
+
"@atlaskit/editor-common": "^110.4.0",
|
|
68
68
|
"react": "^18.2.0",
|
|
69
69
|
"react-dom": "^18.2.0",
|
|
70
70
|
"react-intl-next": "npm:react-intl@^5.18.1"
|