@atlaskit/editor-plugin-block-controls 7.10.0 → 7.10.1
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 +8 -0
- package/dist/cjs/blockControlsPlugin.js +1 -1
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/ui/drag-handle.js +6 -6
- package/dist/es2019/blockControlsPlugin.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/es2019/ui/drag-handle.js +6 -6
- package/dist/esm/blockControlsPlugin.js +1 -1
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/esm/ui/drag-handle.js +6 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7583860e8637f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7583860e8637f) -
|
|
8
|
+
EDITOR-3621 Clean up platform_editor_block_menu_keyboard_navigation feature gate
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 7.10.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -133,7 +133,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
133
133
|
toggleMenuMeta = _objectSpread(_objectSpread({}, toggleMenuMeta), {}, {
|
|
134
134
|
moveUp: moveUp,
|
|
135
135
|
moveDown: moveDown,
|
|
136
|
-
openedViaKeyboard:
|
|
136
|
+
openedViaKeyboard: options === null || options === void 0 ? void 0 : options.openedViaKeyboard
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
@@ -560,7 +560,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
560
560
|
blockMenuOptions: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
561
561
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
562
562
|
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
563
|
-
openedViaKeyboard: (
|
|
563
|
+
openedViaKeyboard: (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
|
|
564
564
|
} : undefined,
|
|
565
565
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
566
566
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -772,7 +772,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
772
772
|
}
|
|
773
773
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
774
774
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
775
|
-
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
775
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
|
|
776
776
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
777
777
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
778
778
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -799,7 +799,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
799
799
|
}
|
|
800
800
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
801
801
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
802
|
-
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
802
|
+
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true);
|
|
803
803
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
804
804
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
805
805
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !_isBlockMenuOpen) {
|
|
@@ -501,7 +501,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
501
501
|
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.toggleBlockMenu({
|
|
502
502
|
anchorName: anchorName,
|
|
503
503
|
triggerByNode: triggerByNode,
|
|
504
|
-
openedViaKeyboard:
|
|
504
|
+
openedViaKeyboard: false
|
|
505
505
|
})({
|
|
506
506
|
tr: tr
|
|
507
507
|
});
|
|
@@ -511,7 +511,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
511
511
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
512
512
|
anchorName: anchorName,
|
|
513
513
|
triggerByNode: triggerByNode,
|
|
514
|
-
openedViaKeyboard:
|
|
514
|
+
openedViaKeyboard: false
|
|
515
515
|
})({
|
|
516
516
|
tr: tr
|
|
517
517
|
});
|
|
@@ -744,7 +744,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
744
744
|
} else {
|
|
745
745
|
var domAtPos = view.domAtPos.bind(view);
|
|
746
746
|
var previewContent = [];
|
|
747
|
-
expandedSlice.content.descendants(function (node, pos
|
|
747
|
+
expandedSlice.content.descendants(function (node, pos) {
|
|
748
748
|
// Get the dom element of the node
|
|
749
749
|
//eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
750
750
|
var nodeDomElement = (0, _utils.findDomRefAtPos)(sliceFrom + pos, domAtPos);
|
|
@@ -1075,13 +1075,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1075
1075
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1076
1076
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1077
1077
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1078
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) &&
|
|
1078
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? focusedStyles : focusedStylesOld, (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') && dragHandleButtonDenseModeStyles],
|
|
1079
1079
|
ref: buttonRef
|
|
1080
1080
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1081
1081
|
,
|
|
1082
1082
|
style: !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1083
1083
|
onClick: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? handleOnClickNew : handleOnClick,
|
|
1084
|
-
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
1084
|
+
onKeyDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
1085
1085
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1086
1086
|
,
|
|
1087
1087
|
onDrop: handleOnDrop,
|
|
@@ -1089,7 +1089,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1089
1089
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1090
1090
|
"data-testid": "block-ctrl-drag-handle",
|
|
1091
1091
|
"aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
1092
|
-
onBlur: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)
|
|
1092
|
+
onBlur: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? function () {
|
|
1093
1093
|
return setIsFocused(false);
|
|
1094
1094
|
} : undefined
|
|
1095
1095
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
@@ -126,7 +126,7 @@ export const blockControlsPlugin = ({
|
|
|
126
126
|
...toggleMenuMeta,
|
|
127
127
|
moveUp,
|
|
128
128
|
moveDown,
|
|
129
|
-
openedViaKeyboard:
|
|
129
|
+
openedViaKeyboard: options === null || options === void 0 ? void 0 : options.openedViaKeyboard
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
tr.setMeta(key, {
|
|
@@ -558,7 +558,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
558
558
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
559
559
|
canMoveUp: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
560
560
|
canMoveDown: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
561
|
-
openedViaKeyboard:
|
|
561
|
+
openedViaKeyboard: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
|
|
562
562
|
} : undefined,
|
|
563
563
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
564
564
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -776,7 +776,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
776
776
|
}
|
|
777
777
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
778
778
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
779
|
-
const isBlockMenuOpen = (api === null || api === void 0 ? void 0 : (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
779
|
+
const isBlockMenuOpen = (api === null || api === void 0 ? void 0 : (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
780
780
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
781
781
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
782
782
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -804,7 +804,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
804
804
|
}
|
|
805
805
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
806
806
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
807
|
-
const isBlockMenuOpen = (api === null || api === void 0 ? void 0 : (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
807
|
+
const isBlockMenuOpen = (api === null || api === void 0 ? void 0 : (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
808
808
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
809
809
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
810
810
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -480,7 +480,7 @@ export const DragHandle = ({
|
|
|
480
480
|
api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.toggleBlockMenu({
|
|
481
481
|
anchorName,
|
|
482
482
|
triggerByNode,
|
|
483
|
-
openedViaKeyboard:
|
|
483
|
+
openedViaKeyboard: false
|
|
484
484
|
})({
|
|
485
485
|
tr
|
|
486
486
|
});
|
|
@@ -490,7 +490,7 @@ export const DragHandle = ({
|
|
|
490
490
|
api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu({
|
|
491
491
|
anchorName,
|
|
492
492
|
triggerByNode,
|
|
493
|
-
openedViaKeyboard:
|
|
493
|
+
openedViaKeyboard: false
|
|
494
494
|
})({
|
|
495
495
|
tr
|
|
496
496
|
});
|
|
@@ -727,7 +727,7 @@ export const DragHandle = ({
|
|
|
727
727
|
} else {
|
|
728
728
|
const domAtPos = view.domAtPos.bind(view);
|
|
729
729
|
const previewContent = [];
|
|
730
|
-
expandedSlice.content.descendants((node, pos
|
|
730
|
+
expandedSlice.content.descendants((node, pos) => {
|
|
731
731
|
// Get the dom element of the node
|
|
732
732
|
//eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
733
733
|
const nodeDomElement = findDomRefAtPos(sliceFrom + pos, domAtPos);
|
|
@@ -1063,13 +1063,13 @@ export const DragHandle = ({
|
|
|
1063
1063
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1064
1064
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1065
1065
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1066
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) &&
|
|
1066
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? focusedStyles : focusedStylesOld, expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') && dragHandleButtonDenseModeStyles],
|
|
1067
1067
|
ref: buttonRef
|
|
1068
1068
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1069
1069
|
,
|
|
1070
1070
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1071
1071
|
onClick: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? handleOnClickNew : handleOnClick,
|
|
1072
|
-
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
1072
|
+
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
1073
1073
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1074
1074
|
,
|
|
1075
1075
|
onDrop: handleOnDrop,
|
|
@@ -1077,7 +1077,7 @@ export const DragHandle = ({
|
|
|
1077
1077
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1078
1078
|
"data-testid": "block-ctrl-drag-handle",
|
|
1079
1079
|
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
1080
|
-
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
1080
|
+
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? () => setIsFocused(false) : undefined
|
|
1081
1081
|
}, jsx(Box, {
|
|
1082
1082
|
xcss: iconWrapperStyles
|
|
1083
1083
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -126,7 +126,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
126
126
|
toggleMenuMeta = _objectSpread(_objectSpread({}, toggleMenuMeta), {}, {
|
|
127
127
|
moveUp: moveUp,
|
|
128
128
|
moveDown: moveDown,
|
|
129
|
-
openedViaKeyboard:
|
|
129
|
+
openedViaKeyboard: options === null || options === void 0 ? void 0 : options.openedViaKeyboard
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
@@ -553,7 +553,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
553
553
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
554
554
|
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
555
555
|
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
556
|
-
openedViaKeyboard:
|
|
556
|
+
openedViaKeyboard: (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard
|
|
557
557
|
} : undefined,
|
|
558
558
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
559
559
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -766,7 +766,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
766
766
|
}
|
|
767
767
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
768
768
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
769
|
-
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
769
|
+
var isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
770
770
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
771
771
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
772
772
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -793,7 +793,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
793
793
|
}
|
|
794
794
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
795
795
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
796
|
-
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
796
|
+
var _isBlockMenuOpen = (api === null || api === void 0 || (_api$blockControls$sh4 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh4 === void 0 ? void 0 : _api$blockControls$sh4.isMenuOpen) && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true);
|
|
797
797
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
798
798
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
799
799
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !_isBlockMenuOpen) {
|
|
@@ -498,7 +498,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
498
498
|
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.toggleBlockMenu({
|
|
499
499
|
anchorName: anchorName,
|
|
500
500
|
triggerByNode: triggerByNode,
|
|
501
|
-
openedViaKeyboard:
|
|
501
|
+
openedViaKeyboard: false
|
|
502
502
|
})({
|
|
503
503
|
tr: tr
|
|
504
504
|
});
|
|
@@ -508,7 +508,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
508
508
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
509
509
|
anchorName: anchorName,
|
|
510
510
|
triggerByNode: triggerByNode,
|
|
511
|
-
openedViaKeyboard:
|
|
511
|
+
openedViaKeyboard: false
|
|
512
512
|
})({
|
|
513
513
|
tr: tr
|
|
514
514
|
});
|
|
@@ -741,7 +741,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
741
741
|
} else {
|
|
742
742
|
var domAtPos = view.domAtPos.bind(view);
|
|
743
743
|
var previewContent = [];
|
|
744
|
-
expandedSlice.content.descendants(function (node, pos
|
|
744
|
+
expandedSlice.content.descendants(function (node, pos) {
|
|
745
745
|
// Get the dom element of the node
|
|
746
746
|
//eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
747
747
|
var nodeDomElement = findDomRefAtPos(sliceFrom + pos, domAtPos);
|
|
@@ -1072,13 +1072,13 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
1072
1072
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1073
1073
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1074
1074
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1075
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) &&
|
|
1075
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? focusedStyles : focusedStylesOld, expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') && dragHandleButtonDenseModeStyles],
|
|
1076
1076
|
ref: buttonRef
|
|
1077
1077
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1078
1078
|
,
|
|
1079
1079
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1080
1080
|
onClick: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? handleOnClickNew : handleOnClick,
|
|
1081
|
-
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
1081
|
+
onKeyDown: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? handleKeyDownNew : handleKeyDown
|
|
1082
1082
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1083
1083
|
,
|
|
1084
1084
|
onDrop: handleOnDrop,
|
|
@@ -1086,7 +1086,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
1086
1086
|
"data-editor-block-ctrl-drag-handle": true,
|
|
1087
1087
|
"data-testid": "block-ctrl-drag-handle",
|
|
1088
1088
|
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
1089
|
-
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)
|
|
1089
|
+
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? function () {
|
|
1090
1090
|
return setIsFocused(false);
|
|
1091
1091
|
} : undefined
|
|
1092
1092
|
}, jsx(Box, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.10.
|
|
3
|
+
"version": "7.10.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
55
55
|
"@atlaskit/primitives": "^16.4.0",
|
|
56
56
|
"@atlaskit/theme": "^21.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^14.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^14.1.0",
|
|
58
58
|
"@atlaskit/tokens": "^8.4.0",
|
|
59
59
|
"@atlaskit/tooltip": "^20.10.0",
|
|
60
60
|
"@babel/runtime": "^7.0.0",
|