@atlaskit/editor-plugin-block-controls 9.1.6 → 9.1.8
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/drag-handle.js +37 -14
- package/dist/cjs/ui/visibility-container.js +6 -2
- package/dist/es2019/ui/drag-handle.js +28 -2
- package/dist/es2019/ui/visibility-container.js +6 -2
- package/dist/esm/ui/drag-handle.js +37 -14
- package/dist/esm/ui/visibility-container.js +6 -2
- package/dist/types/ui/visibility-container.d.ts +2 -1
- package/dist/types-ts4.5/ui/visibility-container.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 9.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.1.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c82f7b4cbe1fd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c82f7b4cbe1fd) -
|
|
14
|
+
Fix drag handle keyboard accessibility: Shift+Ctrl+H now correctly shows and focuses the drag
|
|
15
|
+
handle for keyboard users when mouse is outside the editor. Gated behind
|
|
16
|
+
platform_editor_drag_handle_keyboard_a11y experiment.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 9.1.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1097,9 +1097,31 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1097
1097
|
"data-blocks-drag-handle": (0, _platformFeatureFlags.fg)('confluence_remix_button_right_side_block_fg') || undefined,
|
|
1098
1098
|
"data-testid": "block-ctrl-drag-handle",
|
|
1099
1099
|
"aria-label": dragHandleAriaLabel,
|
|
1100
|
-
onBlur:
|
|
1101
|
-
|
|
1102
|
-
|
|
1100
|
+
onBlur: function onBlur() {
|
|
1101
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
1102
|
+
setIsFocused(false);
|
|
1103
|
+
}
|
|
1104
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true)) {
|
|
1105
|
+
var _pos = getPos();
|
|
1106
|
+
if (_pos !== undefined) {
|
|
1107
|
+
var _api$core8;
|
|
1108
|
+
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (_ref0) {
|
|
1109
|
+
var tr = _ref0.tr;
|
|
1110
|
+
tr.setMeta(_main.key, {
|
|
1111
|
+
activeNode: {
|
|
1112
|
+
pos: _pos,
|
|
1113
|
+
anchorName: anchorName,
|
|
1114
|
+
nodeType: nodeType,
|
|
1115
|
+
handleOptions: {
|
|
1116
|
+
isFocused: false
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
return tr;
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1103
1125
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
1104
1126
|
xcss: iconWrapperStyles
|
|
1105
1127
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -1179,16 +1201,16 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1179
1201
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
1180
1202
|
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
1181
1203
|
};
|
|
1182
|
-
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(
|
|
1183
|
-
var view =
|
|
1184
|
-
api =
|
|
1185
|
-
formatMessage =
|
|
1186
|
-
getPos =
|
|
1187
|
-
anchorName =
|
|
1188
|
-
nodeType =
|
|
1189
|
-
handleOptions =
|
|
1190
|
-
isTopLevelNode =
|
|
1191
|
-
anchorRectCache =
|
|
1204
|
+
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref1) {
|
|
1205
|
+
var view = _ref1.view,
|
|
1206
|
+
api = _ref1.api,
|
|
1207
|
+
formatMessage = _ref1.formatMessage,
|
|
1208
|
+
getPos = _ref1.getPos,
|
|
1209
|
+
anchorName = _ref1.anchorName,
|
|
1210
|
+
nodeType = _ref1.nodeType,
|
|
1211
|
+
handleOptions = _ref1.handleOptions,
|
|
1212
|
+
isTopLevelNode = _ref1.isTopLevelNode,
|
|
1213
|
+
anchorRectCache = _ref1.anchorRectCache;
|
|
1192
1214
|
var rightSideControlsEnabled = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls'], function (states) {
|
|
1193
1215
|
var _states$blockControls2, _states$blockControls3;
|
|
1194
1216
|
return {
|
|
@@ -1202,7 +1224,8 @@ var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragH
|
|
|
1202
1224
|
var isLayoutColumn = nodeType === 'layoutColumn';
|
|
1203
1225
|
return (0, _react2.jsx)(_visibilityContainer.VisibilityContainer, {
|
|
1204
1226
|
api: api,
|
|
1205
|
-
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined
|
|
1227
|
+
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined,
|
|
1228
|
+
forceVisibleOnMouseOut: (0, _expValEquals.expValEquals)('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true) && !!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused)
|
|
1206
1229
|
}, (0, _react2.jsx)(DragHandle, {
|
|
1207
1230
|
view: view,
|
|
1208
1231
|
api: api,
|
|
@@ -53,7 +53,8 @@ var hiddenStylesCSS = (0, _react2.css)({
|
|
|
53
53
|
var VisibilityContainer = exports.VisibilityContainer = function VisibilityContainer(_ref) {
|
|
54
54
|
var api = _ref.api,
|
|
55
55
|
children = _ref.children,
|
|
56
|
-
controlSide = _ref.controlSide
|
|
56
|
+
controlSide = _ref.controlSide,
|
|
57
|
+
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut;
|
|
57
58
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['typeAhead', 'blockControls', 'editorViewMode', 'userIntent'], function (states) {
|
|
58
59
|
var _states$typeAheadStat, _states$blockControls, _states$blockControls2, _states$blockControls3, _states$editorViewMod, _states$userIntentSta, _states$blockControls4;
|
|
59
60
|
return {
|
|
@@ -83,7 +84,10 @@ var VisibilityContainer = exports.VisibilityContainer = function VisibilityConta
|
|
|
83
84
|
// button stays visible when the user moves from the block toward the button (e.g. in edit/live
|
|
84
85
|
// pages), avoiding flicker as the mouse crosses boundaries.
|
|
85
86
|
var hideOnMouseOut = isMouseOut;
|
|
86
|
-
|
|
87
|
+
// When forceVisibleOnMouseOut is true (e.g. drag handle focused via keyboard Shift+Ctrl+H),
|
|
88
|
+
// override the mouse-out condition so the control stays visible regardless of mouse position.
|
|
89
|
+
var shouldHideWhenMouseOut = forceVisibleOnMouseOut ? false : hideOnMouseOut;
|
|
90
|
+
var shouldHideImmediate = isTypeAheadOpen || isEditing || shouldHideWhenMouseOut || userIntent === 'aiStreaming' || sideHidden;
|
|
87
91
|
|
|
88
92
|
// Delay hiding the right control in view mode to reduce flickering when moving from block
|
|
89
93
|
// toward the right-edge button (avoids rapid show/hide as mouse crosses boundaries).
|
|
@@ -1078,7 +1078,32 @@ export const DragHandle = ({
|
|
|
1078
1078
|
"data-blocks-drag-handle": fg('confluence_remix_button_right_side_block_fg') || undefined,
|
|
1079
1079
|
"data-testid": "block-ctrl-drag-handle",
|
|
1080
1080
|
"aria-label": dragHandleAriaLabel,
|
|
1081
|
-
onBlur:
|
|
1081
|
+
onBlur: () => {
|
|
1082
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
1083
|
+
setIsFocused(false);
|
|
1084
|
+
}
|
|
1085
|
+
if (expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true)) {
|
|
1086
|
+
const pos = getPos();
|
|
1087
|
+
if (pos !== undefined) {
|
|
1088
|
+
var _api$core8;
|
|
1089
|
+
api === null || api === void 0 ? void 0 : (_api$core8 = api.core) === null || _api$core8 === void 0 ? void 0 : _api$core8.actions.execute(({
|
|
1090
|
+
tr
|
|
1091
|
+
}) => {
|
|
1092
|
+
tr.setMeta(key, {
|
|
1093
|
+
activeNode: {
|
|
1094
|
+
pos,
|
|
1095
|
+
anchorName,
|
|
1096
|
+
nodeType,
|
|
1097
|
+
handleOptions: {
|
|
1098
|
+
isFocused: false
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
return tr;
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1082
1107
|
}, jsx(Box, {
|
|
1083
1108
|
xcss: iconWrapperStyles
|
|
1084
1109
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -1174,7 +1199,8 @@ export const DragHandleWithVisibility = ({
|
|
|
1174
1199
|
const isLayoutColumn = nodeType === 'layoutColumn';
|
|
1175
1200
|
return jsx(VisibilityContainer, {
|
|
1176
1201
|
api: api,
|
|
1177
|
-
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined
|
|
1202
|
+
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined,
|
|
1203
|
+
forceVisibleOnMouseOut: expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true) && !!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused)
|
|
1178
1204
|
}, jsx(DragHandle, {
|
|
1179
1205
|
view: view,
|
|
1180
1206
|
api: api,
|
|
@@ -42,7 +42,8 @@ const hiddenStylesCSS = css({
|
|
|
42
42
|
export const VisibilityContainer = ({
|
|
43
43
|
api,
|
|
44
44
|
children,
|
|
45
|
-
controlSide
|
|
45
|
+
controlSide,
|
|
46
|
+
forceVisibleOnMouseOut
|
|
46
47
|
}) => {
|
|
47
48
|
const {
|
|
48
49
|
isTypeAheadOpen,
|
|
@@ -74,7 +75,10 @@ export const VisibilityContainer = ({
|
|
|
74
75
|
// button stays visible when the user moves from the block toward the button (e.g. in edit/live
|
|
75
76
|
// pages), avoiding flicker as the mouse crosses boundaries.
|
|
76
77
|
const hideOnMouseOut = isMouseOut;
|
|
77
|
-
|
|
78
|
+
// When forceVisibleOnMouseOut is true (e.g. drag handle focused via keyboard Shift+Ctrl+H),
|
|
79
|
+
// override the mouse-out condition so the control stays visible regardless of mouse position.
|
|
80
|
+
const shouldHideWhenMouseOut = forceVisibleOnMouseOut ? false : hideOnMouseOut;
|
|
81
|
+
const shouldHideImmediate = isTypeAheadOpen || isEditing || shouldHideWhenMouseOut || userIntent === 'aiStreaming' || sideHidden;
|
|
78
82
|
|
|
79
83
|
// Delay hiding the right control in view mode to reduce flickering when moving from block
|
|
80
84
|
// toward the right-edge button (avoids rapid show/hide as mouse crosses boundaries).
|
|
@@ -1093,9 +1093,31 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1093
1093
|
"data-blocks-drag-handle": fg('confluence_remix_button_right_side_block_fg') || undefined,
|
|
1094
1094
|
"data-testid": "block-ctrl-drag-handle",
|
|
1095
1095
|
"aria-label": dragHandleAriaLabel,
|
|
1096
|
-
onBlur:
|
|
1097
|
-
|
|
1098
|
-
|
|
1096
|
+
onBlur: function onBlur() {
|
|
1097
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
1098
|
+
setIsFocused(false);
|
|
1099
|
+
}
|
|
1100
|
+
if (expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true)) {
|
|
1101
|
+
var _pos = getPos();
|
|
1102
|
+
if (_pos !== undefined) {
|
|
1103
|
+
var _api$core8;
|
|
1104
|
+
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (_ref0) {
|
|
1105
|
+
var tr = _ref0.tr;
|
|
1106
|
+
tr.setMeta(key, {
|
|
1107
|
+
activeNode: {
|
|
1108
|
+
pos: _pos,
|
|
1109
|
+
anchorName: anchorName,
|
|
1110
|
+
nodeType: nodeType,
|
|
1111
|
+
handleOptions: {
|
|
1112
|
+
isFocused: false
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
return tr;
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1099
1121
|
}, jsx(Box, {
|
|
1100
1122
|
xcss: iconWrapperStyles
|
|
1101
1123
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -1175,16 +1197,16 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1175
1197
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
1176
1198
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
1177
1199
|
};
|
|
1178
|
-
export var DragHandleWithVisibility = function DragHandleWithVisibility(
|
|
1179
|
-
var view =
|
|
1180
|
-
api =
|
|
1181
|
-
formatMessage =
|
|
1182
|
-
getPos =
|
|
1183
|
-
anchorName =
|
|
1184
|
-
nodeType =
|
|
1185
|
-
handleOptions =
|
|
1186
|
-
isTopLevelNode =
|
|
1187
|
-
anchorRectCache =
|
|
1200
|
+
export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref1) {
|
|
1201
|
+
var view = _ref1.view,
|
|
1202
|
+
api = _ref1.api,
|
|
1203
|
+
formatMessage = _ref1.formatMessage,
|
|
1204
|
+
getPos = _ref1.getPos,
|
|
1205
|
+
anchorName = _ref1.anchorName,
|
|
1206
|
+
nodeType = _ref1.nodeType,
|
|
1207
|
+
handleOptions = _ref1.handleOptions,
|
|
1208
|
+
isTopLevelNode = _ref1.isTopLevelNode,
|
|
1209
|
+
anchorRectCache = _ref1.anchorRectCache;
|
|
1188
1210
|
var rightSideControlsEnabled = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
1189
1211
|
var _states$blockControls2, _states$blockControls3;
|
|
1190
1212
|
return {
|
|
@@ -1198,7 +1220,8 @@ export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref0) {
|
|
|
1198
1220
|
var isLayoutColumn = nodeType === 'layoutColumn';
|
|
1199
1221
|
return jsx(VisibilityContainer, {
|
|
1200
1222
|
api: api,
|
|
1201
|
-
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined
|
|
1223
|
+
controlSide: rightSideControlsEnabled && !isLayoutColumn ? 'left' : undefined,
|
|
1224
|
+
forceVisibleOnMouseOut: expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true) && !!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused)
|
|
1202
1225
|
}, jsx(DragHandle, {
|
|
1203
1226
|
view: view,
|
|
1204
1227
|
api: api,
|
|
@@ -42,7 +42,8 @@ var hiddenStylesCSS = css({
|
|
|
42
42
|
export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
43
43
|
var api = _ref.api,
|
|
44
44
|
children = _ref.children,
|
|
45
|
-
controlSide = _ref.controlSide
|
|
45
|
+
controlSide = _ref.controlSide,
|
|
46
|
+
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut;
|
|
46
47
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['typeAhead', 'blockControls', 'editorViewMode', 'userIntent'], function (states) {
|
|
47
48
|
var _states$typeAheadStat, _states$blockControls, _states$blockControls2, _states$blockControls3, _states$editorViewMod, _states$userIntentSta, _states$blockControls4;
|
|
48
49
|
return {
|
|
@@ -72,7 +73,10 @@ export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
|
72
73
|
// button stays visible when the user moves from the block toward the button (e.g. in edit/live
|
|
73
74
|
// pages), avoiding flicker as the mouse crosses boundaries.
|
|
74
75
|
var hideOnMouseOut = isMouseOut;
|
|
75
|
-
|
|
76
|
+
// When forceVisibleOnMouseOut is true (e.g. drag handle focused via keyboard Shift+Ctrl+H),
|
|
77
|
+
// override the mouse-out condition so the control stays visible regardless of mouse position.
|
|
78
|
+
var shouldHideWhenMouseOut = forceVisibleOnMouseOut ? false : hideOnMouseOut;
|
|
79
|
+
var shouldHideImmediate = isTypeAheadOpen || isEditing || shouldHideWhenMouseOut || userIntent === 'aiStreaming' || sideHidden;
|
|
76
80
|
|
|
77
81
|
// Delay hiding the right control in view mode to reduce flickering when moving from block
|
|
78
82
|
// toward the right-edge button (avoids rapid show/hide as mouse crosses boundaries).
|
|
@@ -10,6 +10,7 @@ interface VisibilityContainerProps {
|
|
|
10
10
|
api?: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
controlSide?: 'left' | 'right';
|
|
13
|
+
forceVisibleOnMouseOut?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare const VisibilityContainer: ({ api, children, controlSide, }: VisibilityContainerProps) => jsx.JSX.Element;
|
|
15
|
+
export declare const VisibilityContainer: ({ api, children, controlSide, forceVisibleOnMouseOut, }: VisibilityContainerProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -10,6 +10,7 @@ interface VisibilityContainerProps {
|
|
|
10
10
|
api?: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
controlSide?: 'left' | 'right';
|
|
13
|
+
forceVisibleOnMouseOut?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare const VisibilityContainer: ({ api, children, controlSide, }: VisibilityContainerProps) => jsx.JSX.Element;
|
|
15
|
+
export declare const VisibilityContainer: ({ api, children, controlSide, forceVisibleOnMouseOut, }: VisibilityContainerProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.8",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^18.1.0",
|
|
58
58
|
"@atlaskit/theme": "^23.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^56.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^12.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^21.1.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|