@atlaskit/editor-plugin-block-controls 7.2.4 → 7.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/ui/block-menu.js +10 -64
- package/dist/cjs/ui/drag-handle.js +22 -5
- package/dist/es2019/ui/block-menu.js +10 -65
- package/dist/es2019/ui/drag-handle.js +17 -5
- package/dist/esm/ui/block-menu.js +10 -64
- package/dist/esm/ui/drag-handle.js +22 -5
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0b4cd77e72217`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b4cd77e72217) -
|
|
8
|
+
clean up references to platform_editor_controls_performance_fixes
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.2.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`e3ca1a4b9b932`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3ca1a4b9b932) -
|
|
16
|
+
[ux] ED-29489 Remove focus ring when drag handle is clicked and fix menu closing on menu open
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 7.2.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,7 +11,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
11
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
12
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
14
|
var _blockMenuItems = require("./block-menu-items");
|
|
16
15
|
var _consts = require("./consts");
|
|
17
16
|
var _domAttrName = require("./utils/dom-attr-name");
|
|
@@ -95,70 +94,17 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
95
94
|
if (isMenuOpen) {
|
|
96
95
|
return null;
|
|
97
96
|
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return /*#__PURE__*/_react.default.createElement(BlockMenuContent, {
|
|
103
|
-
editorView: editorView,
|
|
104
|
-
mountPoint: mountPoint,
|
|
105
|
-
boundariesElement: boundariesElement,
|
|
106
|
-
scrollableElement: scrollableElement,
|
|
107
|
-
api: api,
|
|
108
|
-
menuTriggerBy: menuTriggerBy,
|
|
109
|
-
formatMessage: formatMessage
|
|
110
|
-
});
|
|
97
|
+
if (!menuTriggerBy) {
|
|
98
|
+
return null;
|
|
111
99
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var handleOpenChange = function handleOpenChange(payload) {
|
|
116
|
-
if (!(payload !== null && payload !== void 0 && payload.isOpen)) {
|
|
117
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
118
|
-
closeMenu: true
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
var onMenuItemActivated = function onMenuItemActivated(_ref4) {
|
|
123
|
-
var item = _ref4.item;
|
|
124
|
-
if (editorView) {
|
|
125
|
-
var _menuItemsCallback2, _menuItemsCallback2$c;
|
|
126
|
-
(_menuItemsCallback2 = _blockMenuItems.menuItemsCallback[item.value.name]) === null || _menuItemsCallback2 === void 0 || (_menuItemsCallback2$c = _menuItemsCallback2.call(_blockMenuItems.menuItemsCallback, api, formatMessage)) === null || _menuItemsCallback2$c === void 0 || _menuItemsCallback2$c(editorView.state, editorView.dispatch, editorView);
|
|
127
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
128
|
-
closeMenu: true
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
133
|
-
alignX: 'left',
|
|
134
|
-
alignY: 'start'
|
|
135
|
-
// Ignored via go/ees005
|
|
136
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
137
|
-
,
|
|
138
|
-
target: targetHandleRef,
|
|
139
|
-
mountTo: undefined,
|
|
140
|
-
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
141
|
-
forcePlacement: true,
|
|
142
|
-
stick: true,
|
|
143
|
-
offset: [-6, 8]
|
|
144
|
-
}, /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownMenu, {
|
|
145
|
-
mountTo: mountPoint,
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(BlockMenuContent, {
|
|
101
|
+
editorView: editorView,
|
|
102
|
+
mountPoint: mountPoint,
|
|
146
103
|
boundariesElement: boundariesElement,
|
|
147
|
-
scrollableElement: scrollableElement
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
153
|
-
},
|
|
154
|
-
items: items,
|
|
155
|
-
isOpen: true,
|
|
156
|
-
fitWidth: _consts.BLOCK_MENU_WIDTH,
|
|
157
|
-
section: {
|
|
158
|
-
hasSeparator: true
|
|
159
|
-
},
|
|
160
|
-
onOpenChange: handleOpenChange,
|
|
161
|
-
onItemActivated: onMenuItemActivated
|
|
162
|
-
}));
|
|
104
|
+
scrollableElement: scrollableElement,
|
|
105
|
+
api: api,
|
|
106
|
+
menuTriggerBy: menuTriggerBy,
|
|
107
|
+
formatMessage: formatMessage
|
|
108
|
+
});
|
|
163
109
|
};
|
|
164
110
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(BlockMenu);
|
|
@@ -127,9 +127,6 @@ var dragHandleButtonStyles = (0, _react2.css)({
|
|
|
127
127
|
'&:active': {
|
|
128
128
|
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
129
129
|
},
|
|
130
|
-
'&:focus': {
|
|
131
|
-
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
132
|
-
},
|
|
133
130
|
'&:disabled': {
|
|
134
131
|
color: "var(--ds-icon-disabled, #8993A4)",
|
|
135
132
|
backgroundColor: 'transparent'
|
|
@@ -184,6 +181,19 @@ var dragHandleButtonStylesOld = (0, _react2.css)({
|
|
|
184
181
|
backgroundColor: "var(--ds-background-disabled, transparent)"
|
|
185
182
|
}
|
|
186
183
|
});
|
|
184
|
+
var focusedStylesOld = (0, _react2.css)({
|
|
185
|
+
'&:focus': {
|
|
186
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
var focusedStyles = (0, _react2.css)({
|
|
190
|
+
'&:focus-visible': {
|
|
191
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
var keyboardFocusedDragHandleStyles = (0, _react2.css)({
|
|
195
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
196
|
+
});
|
|
187
197
|
var dragHandleContainerStyles = (0, _primitives.xcss)({
|
|
188
198
|
position: 'absolute',
|
|
189
199
|
boxSizing: 'border-box'
|
|
@@ -309,6 +319,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
309
319
|
_useState0 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
310
320
|
positionStylesOld = _useState0[0],
|
|
311
321
|
setPositionStylesOld = _useState0[1];
|
|
322
|
+
var _useState1 = (0, _react.useState)(Boolean(handleOptions === null || handleOptions === void 0 ? void 0 : handleOptions.isFocused)),
|
|
323
|
+
_useState10 = (0, _slicedToArray2.default)(_useState1, 2),
|
|
324
|
+
isFocused = _useState10[0],
|
|
325
|
+
setIsFocused = _useState10[1];
|
|
312
326
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['featureFlags'], function (states) {
|
|
313
327
|
var _states$featureFlagsS;
|
|
314
328
|
return {
|
|
@@ -941,7 +955,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
941
955
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
942
956
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
943
957
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
944
|
-
_browser.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],
|
|
958
|
+
_browser.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) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? focusedStyles : focusedStylesOld],
|
|
945
959
|
ref: buttonRef
|
|
946
960
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
947
961
|
,
|
|
@@ -955,7 +969,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
955
969
|
disabled: dragHandleDisabled,
|
|
956
970
|
"data-editor-block-ctrl-drag-handle": true,
|
|
957
971
|
"data-testid": "block-ctrl-drag-handle",
|
|
958
|
-
"aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
|
|
972
|
+
"aria-label": (0, _expValEquals.expValEquals)('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
973
|
+
onBlur: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? function () {
|
|
974
|
+
return setIsFocused(false);
|
|
975
|
+
} : undefined
|
|
959
976
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
960
977
|
xcss: iconWrapperStyles
|
|
961
978
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -4,7 +4,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
6
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { getBlockMenuItems, menuItemsCallback } from './block-menu-items';
|
|
9
8
|
import { BLOCK_MENU_WIDTH } from './consts';
|
|
10
9
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
@@ -93,71 +92,17 @@ const BlockMenu = ({
|
|
|
93
92
|
if (isMenuOpen) {
|
|
94
93
|
return null;
|
|
95
94
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
101
|
-
editorView: editorView,
|
|
102
|
-
mountPoint: mountPoint,
|
|
103
|
-
boundariesElement: boundariesElement,
|
|
104
|
-
scrollableElement: scrollableElement,
|
|
105
|
-
api: api,
|
|
106
|
-
menuTriggerBy: menuTriggerBy,
|
|
107
|
-
formatMessage: formatMessage
|
|
108
|
-
});
|
|
95
|
+
if (!menuTriggerBy) {
|
|
96
|
+
return null;
|
|
109
97
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const handleOpenChange = payload => {
|
|
114
|
-
if (!(payload !== null && payload !== void 0 && payload.isOpen)) {
|
|
115
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
116
|
-
closeMenu: true
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const onMenuItemActivated = ({
|
|
121
|
-
item
|
|
122
|
-
}) => {
|
|
123
|
-
if (editorView) {
|
|
124
|
-
var _menuItemsCallback2, _menuItemsCallback2$c;
|
|
125
|
-
(_menuItemsCallback2 = menuItemsCallback[item.value.name]) === null || _menuItemsCallback2 === void 0 ? void 0 : (_menuItemsCallback2$c = _menuItemsCallback2.call(menuItemsCallback, api, formatMessage)) === null || _menuItemsCallback2$c === void 0 ? void 0 : _menuItemsCallback2$c(editorView.state, editorView.dispatch, editorView);
|
|
126
|
-
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
127
|
-
closeMenu: true
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
return /*#__PURE__*/React.createElement(Popup, {
|
|
132
|
-
alignX: 'left',
|
|
133
|
-
alignY: 'start'
|
|
134
|
-
// Ignored via go/ees005
|
|
135
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
136
|
-
,
|
|
137
|
-
target: targetHandleRef,
|
|
138
|
-
mountTo: undefined,
|
|
139
|
-
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
140
|
-
forcePlacement: true,
|
|
141
|
-
stick: true,
|
|
142
|
-
offset: [-6, 8]
|
|
143
|
-
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
144
|
-
mountTo: mountPoint,
|
|
98
|
+
return /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
99
|
+
editorView: editorView,
|
|
100
|
+
mountPoint: mountPoint,
|
|
145
101
|
boundariesElement: boundariesElement,
|
|
146
|
-
scrollableElement: scrollableElement
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
type: ArrowKeyNavigationType.MENU
|
|
152
|
-
},
|
|
153
|
-
items: items,
|
|
154
|
-
isOpen: true,
|
|
155
|
-
fitWidth: BLOCK_MENU_WIDTH,
|
|
156
|
-
section: {
|
|
157
|
-
hasSeparator: true
|
|
158
|
-
},
|
|
159
|
-
onOpenChange: handleOpenChange,
|
|
160
|
-
onItemActivated: onMenuItemActivated
|
|
161
|
-
}));
|
|
102
|
+
scrollableElement: scrollableElement,
|
|
103
|
+
api: api,
|
|
104
|
+
menuTriggerBy: menuTriggerBy,
|
|
105
|
+
formatMessage: formatMessage
|
|
106
|
+
});
|
|
162
107
|
};
|
|
163
108
|
export default injectIntl(BlockMenu);
|
|
@@ -119,9 +119,6 @@ const dragHandleButtonStyles = css({
|
|
|
119
119
|
'&:active': {
|
|
120
120
|
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
121
121
|
},
|
|
122
|
-
'&:focus': {
|
|
123
|
-
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #388BFF)"}`
|
|
124
|
-
},
|
|
125
122
|
'&:disabled': {
|
|
126
123
|
color: "var(--ds-icon-disabled, #8993A4)",
|
|
127
124
|
backgroundColor: 'transparent'
|
|
@@ -179,6 +176,19 @@ const dragHandleButtonStylesOld = css({
|
|
|
179
176
|
backgroundColor: "var(--ds-background-disabled, transparent)"
|
|
180
177
|
}
|
|
181
178
|
});
|
|
179
|
+
const focusedStylesOld = css({
|
|
180
|
+
'&:focus': {
|
|
181
|
+
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #388BFF)"}`
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const focusedStyles = css({
|
|
185
|
+
'&:focus-visible': {
|
|
186
|
+
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #388BFF)"}`
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const keyboardFocusedDragHandleStyles = css({
|
|
190
|
+
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #388BFF)"}`
|
|
191
|
+
});
|
|
182
192
|
const dragHandleContainerStyles = xcss({
|
|
183
193
|
position: 'absolute',
|
|
184
194
|
boxSizing: 'border-box'
|
|
@@ -289,6 +299,7 @@ export const DragHandle = ({
|
|
|
289
299
|
const [positionStylesOld, setPositionStylesOld] = useState({
|
|
290
300
|
display: 'none'
|
|
291
301
|
});
|
|
302
|
+
const [isFocused, setIsFocused] = useState(Boolean(handleOptions === null || handleOptions === void 0 ? void 0 : handleOptions.isFocused));
|
|
292
303
|
const {
|
|
293
304
|
macroInteractionUpdates
|
|
294
305
|
} = useSharedPluginStateWithSelector(api, ['featureFlags'], states => {
|
|
@@ -929,7 +940,7 @@ export const DragHandle = ({
|
|
|
929
940
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
930
941
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
931
942
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
932
|
-
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],
|
|
943
|
+
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) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? focusedStyles : focusedStylesOld],
|
|
933
944
|
ref: buttonRef
|
|
934
945
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
935
946
|
,
|
|
@@ -943,7 +954,8 @@ export const DragHandle = ({
|
|
|
943
954
|
disabled: dragHandleDisabled,
|
|
944
955
|
"data-editor-block-ctrl-drag-handle": true,
|
|
945
956
|
"data-testid": "block-ctrl-drag-handle",
|
|
946
|
-
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
|
|
957
|
+
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
958
|
+
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? () => setIsFocused(false) : undefined
|
|
947
959
|
}, jsx(Box, {
|
|
948
960
|
xcss: iconWrapperStyles
|
|
949
961
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -4,7 +4,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
6
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { getBlockMenuItems, menuItemsCallback } from './block-menu-items';
|
|
9
8
|
import { BLOCK_MENU_WIDTH } from './consts';
|
|
10
9
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
@@ -87,70 +86,17 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
87
86
|
if (isMenuOpen) {
|
|
88
87
|
return null;
|
|
89
88
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
95
|
-
editorView: editorView,
|
|
96
|
-
mountPoint: mountPoint,
|
|
97
|
-
boundariesElement: boundariesElement,
|
|
98
|
-
scrollableElement: scrollableElement,
|
|
99
|
-
api: api,
|
|
100
|
-
menuTriggerBy: menuTriggerBy,
|
|
101
|
-
formatMessage: formatMessage
|
|
102
|
-
});
|
|
89
|
+
if (!menuTriggerBy) {
|
|
90
|
+
return null;
|
|
103
91
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var handleOpenChange = function handleOpenChange(payload) {
|
|
108
|
-
if (!(payload !== null && payload !== void 0 && payload.isOpen)) {
|
|
109
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
110
|
-
closeMenu: true
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var onMenuItemActivated = function onMenuItemActivated(_ref4) {
|
|
115
|
-
var item = _ref4.item;
|
|
116
|
-
if (editorView) {
|
|
117
|
-
var _menuItemsCallback2, _menuItemsCallback2$c;
|
|
118
|
-
(_menuItemsCallback2 = menuItemsCallback[item.value.name]) === null || _menuItemsCallback2 === void 0 || (_menuItemsCallback2$c = _menuItemsCallback2.call(menuItemsCallback, api, formatMessage)) === null || _menuItemsCallback2$c === void 0 || _menuItemsCallback2$c(editorView.state, editorView.dispatch, editorView);
|
|
119
|
-
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.toggleBlockMenu({
|
|
120
|
-
closeMenu: true
|
|
121
|
-
}));
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
return /*#__PURE__*/React.createElement(Popup, {
|
|
125
|
-
alignX: 'left',
|
|
126
|
-
alignY: 'start'
|
|
127
|
-
// Ignored via go/ees005
|
|
128
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
129
|
-
,
|
|
130
|
-
target: targetHandleRef,
|
|
131
|
-
mountTo: undefined,
|
|
132
|
-
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
133
|
-
forcePlacement: true,
|
|
134
|
-
stick: true,
|
|
135
|
-
offset: [-6, 8]
|
|
136
|
-
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
137
|
-
mountTo: mountPoint,
|
|
92
|
+
return /*#__PURE__*/React.createElement(BlockMenuContent, {
|
|
93
|
+
editorView: editorView,
|
|
94
|
+
mountPoint: mountPoint,
|
|
138
95
|
boundariesElement: boundariesElement,
|
|
139
|
-
scrollableElement: scrollableElement
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
type: ArrowKeyNavigationType.MENU
|
|
145
|
-
},
|
|
146
|
-
items: items,
|
|
147
|
-
isOpen: true,
|
|
148
|
-
fitWidth: BLOCK_MENU_WIDTH,
|
|
149
|
-
section: {
|
|
150
|
-
hasSeparator: true
|
|
151
|
-
},
|
|
152
|
-
onOpenChange: handleOpenChange,
|
|
153
|
-
onItemActivated: onMenuItemActivated
|
|
154
|
-
}));
|
|
96
|
+
scrollableElement: scrollableElement,
|
|
97
|
+
api: api,
|
|
98
|
+
menuTriggerBy: menuTriggerBy,
|
|
99
|
+
formatMessage: formatMessage
|
|
100
|
+
});
|
|
155
101
|
};
|
|
156
102
|
export default injectIntl(BlockMenu);
|
|
@@ -124,9 +124,6 @@ var dragHandleButtonStyles = css({
|
|
|
124
124
|
'&:active': {
|
|
125
125
|
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
126
126
|
},
|
|
127
|
-
'&:focus': {
|
|
128
|
-
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
129
|
-
},
|
|
130
127
|
'&:disabled': {
|
|
131
128
|
color: "var(--ds-icon-disabled, #8993A4)",
|
|
132
129
|
backgroundColor: 'transparent'
|
|
@@ -181,6 +178,19 @@ var dragHandleButtonStylesOld = css({
|
|
|
181
178
|
backgroundColor: "var(--ds-background-disabled, transparent)"
|
|
182
179
|
}
|
|
183
180
|
});
|
|
181
|
+
var focusedStylesOld = css({
|
|
182
|
+
'&:focus': {
|
|
183
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
var focusedStyles = css({
|
|
187
|
+
'&:focus-visible': {
|
|
188
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
var keyboardFocusedDragHandleStyles = css({
|
|
192
|
+
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #388BFF)")
|
|
193
|
+
});
|
|
184
194
|
var dragHandleContainerStyles = xcss({
|
|
185
195
|
position: 'absolute',
|
|
186
196
|
boxSizing: 'border-box'
|
|
@@ -306,6 +316,10 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
306
316
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
307
317
|
positionStylesOld = _useState0[0],
|
|
308
318
|
setPositionStylesOld = _useState0[1];
|
|
319
|
+
var _useState1 = useState(Boolean(handleOptions === null || handleOptions === void 0 ? void 0 : handleOptions.isFocused)),
|
|
320
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
321
|
+
isFocused = _useState10[0],
|
|
322
|
+
setIsFocused = _useState10[1];
|
|
309
323
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
|
|
310
324
|
var _states$featureFlagsS;
|
|
311
325
|
return {
|
|
@@ -938,7 +952,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
938
952
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
939
953
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
940
954
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
941
|
-
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],
|
|
955
|
+
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) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) && isFocused && keyboardFocusedDragHandleStyles, expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? focusedStyles : focusedStylesOld],
|
|
942
956
|
ref: buttonRef
|
|
943
957
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
944
958
|
,
|
|
@@ -952,7 +966,10 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
952
966
|
disabled: dragHandleDisabled,
|
|
953
967
|
"data-editor-block-ctrl-drag-handle": true,
|
|
954
968
|
"data-testid": "block-ctrl-drag-handle",
|
|
955
|
-
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : ''
|
|
969
|
+
"aria-label": expValEquals('platform_editor_drag_handle_aria_label', 'isEnabled', true) ? dragHandleAriaLabel : '',
|
|
970
|
+
onBlur: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? function () {
|
|
971
|
+
return setIsFocused(false);
|
|
972
|
+
} : undefined
|
|
956
973
|
}, jsx(Box, {
|
|
957
974
|
xcss: iconWrapperStyles
|
|
958
975
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^51.2.0",
|
|
32
32
|
"@atlaskit/editor-plugin-accessibility-utils": "^6.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^6.1.0",
|
|
34
|
-
"@atlaskit/editor-plugin-editor-disabled": "^6.
|
|
34
|
+
"@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-interaction": "^8.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-limited-mode": "^3.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-metrics": "^7.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-quick-insert": "^6.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
41
|
-
"@atlaskit/editor-plugin-type-ahead": "^6.
|
|
41
|
+
"@atlaskit/editor-plugin-type-ahead": "^6.4.0",
|
|
42
42
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-width": "^7.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
46
46
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
47
|
-
"@atlaskit/icon": "^28.
|
|
47
|
+
"@atlaskit/icon": "^28.5.0",
|
|
48
48
|
"@atlaskit/link": "^3.2.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
53
53
|
"@atlaskit/primitives": "^14.15.0",
|
|
54
54
|
"@atlaskit/theme": "^21.0.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^13.9.0",
|
|
56
56
|
"@atlaskit/tokens": "^6.4.0",
|
|
57
57
|
"@atlaskit/tooltip": "^20.5.0",
|
|
58
58
|
"@babel/runtime": "^7.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.10.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"
|