@atlaskit/editor-plugin-block-controls 9.0.15 → 9.0.17
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 +14 -0
- package/dist/cjs/blockControlsPlugin.js +3 -4
- package/dist/cjs/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/cjs/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/cjs/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/cjs/pm-plugins/main.js +8 -8
- package/dist/cjs/pm-plugins/utils/getSelection.js +3 -3
- package/dist/cjs/ui/drag-handle.js +18 -10
- package/dist/cjs/ui/drop-target.js +12 -4
- package/dist/cjs/ui/global-styles.js +3 -1
- package/dist/cjs/ui/quick-insert-button.js +6 -2
- package/dist/cjs/ui/visibility-container.js +2 -0
- package/dist/es2019/blockControlsPlugin.js +3 -4
- package/dist/es2019/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/es2019/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/es2019/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/es2019/pm-plugins/main.js +8 -8
- package/dist/es2019/pm-plugins/utils/getSelection.js +3 -3
- package/dist/es2019/ui/drag-handle.js +18 -10
- package/dist/es2019/ui/drop-target.js +12 -4
- package/dist/es2019/ui/global-styles.js +3 -1
- package/dist/es2019/ui/quick-insert-button.js +6 -2
- package/dist/es2019/ui/visibility-container.js +2 -0
- package/dist/esm/blockControlsPlugin.js +3 -4
- package/dist/esm/editor-commands/move-node-with-block-menu.js +2 -2
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/editor-commands/utils/move-node-utils.js +4 -4
- package/dist/esm/pm-plugins/handle-mouse-down.js +3 -3
- package/dist/esm/pm-plugins/handle-mouse-over.js +5 -3
- package/dist/esm/pm-plugins/main.js +8 -8
- package/dist/esm/pm-plugins/utils/getSelection.js +3 -3
- package/dist/esm/ui/drag-handle.js +18 -10
- package/dist/esm/ui/drop-target.js +12 -4
- package/dist/esm/ui/global-styles.js +3 -1
- package/dist/esm/ui/quick-insert-button.js +6 -2
- package/dist/esm/ui/visibility-container.js +2 -0
- package/package.json +2 -2
|
@@ -304,7 +304,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
304
304
|
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
305
305
|
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
306
306
|
// This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
|
|
307
|
-
if (browser.webkit &&
|
|
307
|
+
if (browser.webkit && editorExperiment('platform_editor_block_menu', true)) {
|
|
308
308
|
mappedPos = tr.mapping.mapResult(activeNode.pos);
|
|
309
309
|
isActiveNodeDeleted = mappedPos.deleted;
|
|
310
310
|
} else {
|
|
@@ -631,7 +631,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
631
631
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && findHandleDec(decorations, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos).length === 0 ? null : latestActiveNode;
|
|
632
632
|
}
|
|
633
633
|
let isMenuOpenNew = isMenuOpen;
|
|
634
|
-
if (
|
|
634
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
635
635
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
636
636
|
isMenuOpenNew = false;
|
|
637
637
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
@@ -653,9 +653,9 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
653
653
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
654
654
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
655
655
|
isMenuOpen: isMenuOpenNew,
|
|
656
|
-
menuTriggerBy: flags.toolbarFlagsEnabled ||
|
|
656
|
+
menuTriggerBy: flags.toolbarFlagsEnabled || editorExperiment('platform_editor_block_menu', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
657
657
|
menuTriggerByNode: editorExperiment('platform_synced_block', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
658
|
-
blockMenuOptions:
|
|
658
|
+
blockMenuOptions: editorExperiment('platform_editor_block_menu', true) ? {
|
|
659
659
|
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,
|
|
660
660
|
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,
|
|
661
661
|
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
|
|
@@ -890,12 +890,12 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
893
|
-
const isDragHandle = event.target.closest(
|
|
893
|
+
const isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
894
894
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
895
895
|
}
|
|
896
896
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
897
897
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
898
|
-
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) &&
|
|
898
|
+
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) && editorExperiment('platform_editor_block_menu', true);
|
|
899
899
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
900
900
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
901
901
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -918,12 +918,12 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
921
|
-
const isDragHandle = event.target.closest(
|
|
921
|
+
const isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
922
922
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
923
923
|
}
|
|
924
924
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
925
925
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
926
|
-
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) &&
|
|
926
|
+
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) && editorExperiment('platform_editor_block_menu', true);
|
|
927
927
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
928
928
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
929
929
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -4,7 +4,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import {
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
export const getInlineNodePos = (doc, start, nodeSize) => {
|
|
9
9
|
const $startPos = doc.resolve(start);
|
|
10
10
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -91,7 +91,7 @@ export const newGetSelection = (doc, selectionEmpty, start) => {
|
|
|
91
91
|
const isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
92
92
|
const nodeSize = node ? node.nodeSize : 1;
|
|
93
93
|
const nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
94
|
-
if (
|
|
94
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
95
95
|
var _doc$nodeAt;
|
|
96
96
|
// if mediaGroup only has a single child, we want to select the child
|
|
97
97
|
if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
|
|
@@ -135,7 +135,7 @@ export const newGetSelection = (doc, selectionEmpty, start) => {
|
|
|
135
135
|
return new TextSelection(doc.resolve(inlineNodePos), doc.resolve(inlineNodeEndPos));
|
|
136
136
|
};
|
|
137
137
|
export const getSelection = (tr, start, api) => {
|
|
138
|
-
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) ||
|
|
138
|
+
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || editorExperiment('platform_editor_block_menu', true)) {
|
|
139
139
|
return newGetSelection(tr.doc, tr.selection.empty, start);
|
|
140
140
|
}
|
|
141
141
|
return oldGetSelection(tr, start);
|
|
@@ -1032,7 +1032,7 @@ export const DragHandle = ({
|
|
|
1032
1032
|
setDragHandleDisabled(false);
|
|
1033
1033
|
}
|
|
1034
1034
|
}, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNodeValue, view]);
|
|
1035
|
-
const dragHandleMessage =
|
|
1035
|
+
const dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
|
|
1036
1036
|
br: jsx("br", null)
|
|
1037
1037
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
1038
1038
|
|
|
@@ -1120,15 +1120,15 @@ export const DragHandle = ({
|
|
|
1120
1120
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1121
1121
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1122
1122
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1123
|
-
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,
|
|
1123
|
+
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, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) && dragHandleButtonDenseModeStyles],
|
|
1124
1124
|
ref: buttonRef
|
|
1125
1125
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1126
1126
|
,
|
|
1127
1127
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1128
1128
|
onMouseDown: expValEqualsNoExposure('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1129
|
-
onMouseUp:
|
|
1130
|
-
onClick:
|
|
1131
|
-
onKeyDown:
|
|
1129
|
+
onMouseUp: editorExperiment('platform_editor_block_menu', true) ? handleMouseUp : undefined,
|
|
1130
|
+
onClick: editorExperiment('platform_editor_block_menu', true) ? handleOnClickNew : handleOnClick,
|
|
1131
|
+
onKeyDown: editorExperiment('platform_editor_block_menu', true) ? handleKeyDownNew : handleKeyDown
|
|
1132
1132
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1133
1133
|
,
|
|
1134
1134
|
onDrop: handleOnDrop,
|
|
@@ -1137,7 +1137,7 @@ export const DragHandle = ({
|
|
|
1137
1137
|
"data-blocks-drag-handle": expValEqualsNoExposure('confluence_remix_icon_right_side', 'isEnabled', true) || undefined,
|
|
1138
1138
|
"data-testid": "block-ctrl-drag-handle",
|
|
1139
1139
|
"aria-label": dragHandleAriaLabel,
|
|
1140
|
-
onBlur:
|
|
1140
|
+
onBlur: editorExperiment('platform_editor_block_menu', true) ? () => setIsFocused(false) : undefined
|
|
1141
1141
|
}, jsx(Box, {
|
|
1142
1142
|
xcss: iconWrapperStyles
|
|
1143
1143
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
@@ -1151,7 +1151,9 @@ export const DragHandle = ({
|
|
|
1151
1151
|
const stickyWithTooltip = () => jsx(Box
|
|
1152
1152
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1153
1153
|
, {
|
|
1154
|
-
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1154
|
+
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1155
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1156
|
+
,
|
|
1155
1157
|
xcss: [dragHandleContainerStyles],
|
|
1156
1158
|
as: "span",
|
|
1157
1159
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1162,7 +1164,9 @@ export const DragHandle = ({
|
|
|
1162
1164
|
helpDescriptors: helpDescriptors
|
|
1163
1165
|
}),
|
|
1164
1166
|
ignoreTooltipPointerEvents: true,
|
|
1165
|
-
position: 'top'
|
|
1167
|
+
position: 'top'
|
|
1168
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1169
|
+
,
|
|
1166
1170
|
onShow: () => {
|
|
1167
1171
|
var _api$accessibilityUti;
|
|
1168
1172
|
api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(message, {
|
|
@@ -1175,7 +1179,9 @@ export const DragHandle = ({
|
|
|
1175
1179
|
const stickyWithoutTooltip = () => jsx(Box
|
|
1176
1180
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1177
1181
|
, {
|
|
1178
|
-
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1182
|
+
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1183
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1184
|
+
,
|
|
1179
1185
|
xcss: [dragHandleContainerStyles],
|
|
1180
1186
|
as: "span",
|
|
1181
1187
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1188,7 +1194,9 @@ export const DragHandle = ({
|
|
|
1188
1194
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
1189
1195
|
helpDescriptors: helpDescriptors
|
|
1190
1196
|
}),
|
|
1191
|
-
ignoreTooltipPointerEvents: true
|
|
1197
|
+
ignoreTooltipPointerEvents: true
|
|
1198
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1199
|
+
,
|
|
1192
1200
|
onShow: () => {
|
|
1193
1201
|
var _api$accessibilityUti2;
|
|
1194
1202
|
api === null || api === void 0 ? void 0 : (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 ? void 0 : _api$accessibilityUti2.actions.ariaNotify(message, {
|
|
@@ -235,8 +235,12 @@ export const DropTarget = props => {
|
|
|
235
235
|
[EDITOR_BLOCK_CONTROLS_DROP_TARGET_ZINDEX]: layers.navigation()
|
|
236
236
|
};
|
|
237
237
|
const isShowInlineDropTarget = shouldAllowInlineDropTarget(isNestedDropTarget, nextNode, isSameLayout, activeNode, parentNode);
|
|
238
|
-
return jsx(Fragment, null, jsx(HoverZone
|
|
239
|
-
|
|
238
|
+
return jsx(Fragment, null, jsx(HoverZone
|
|
239
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
240
|
+
, {
|
|
241
|
+
onDragEnter: () => setIsDraggedOver(true)
|
|
242
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
243
|
+
,
|
|
240
244
|
onDragLeave: () => setIsDraggedOver(false),
|
|
241
245
|
onDrop: onDrop,
|
|
242
246
|
node: prevNode,
|
|
@@ -259,8 +263,12 @@ export const DropTarget = props => {
|
|
|
259
263
|
"data-testid": "block-ctrl-drop-indicator"
|
|
260
264
|
}, jsx(DropIndicator, {
|
|
261
265
|
edge: "bottom"
|
|
262
|
-
}))), dropTargetStyle !== 'remainingHeight' && jsx(HoverZone
|
|
263
|
-
|
|
266
|
+
}))), dropTargetStyle !== 'remainingHeight' && jsx(HoverZone
|
|
267
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
268
|
+
, {
|
|
269
|
+
onDragEnter: () => setIsDraggedOver(true)
|
|
270
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
271
|
+
,
|
|
264
272
|
onDragLeave: () => setIsDraggedOver(false),
|
|
265
273
|
onDrop: onDrop,
|
|
266
274
|
node: nextNode,
|
|
@@ -555,7 +555,9 @@ export const GlobalStylesWrapper = ({
|
|
|
555
555
|
const isDragging = expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true) ? isDraggingFromState : false;
|
|
556
556
|
const shouldRenderAnchors = isCSSAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
557
557
|
const toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
558
|
-
return jsx(Global
|
|
558
|
+
return jsx(Global
|
|
559
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
560
|
+
, {
|
|
559
561
|
styles: [globalStyles(), globalDnDStyle, expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
560
562
|
exposure: true
|
|
561
563
|
}) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
@@ -337,7 +337,9 @@ export const TypeAheadControl = ({
|
|
|
337
337
|
}, jsx(Pressable, {
|
|
338
338
|
testId: "editor-quick-insert-button",
|
|
339
339
|
type: "button",
|
|
340
|
-
"aria-label": formatMessage(messages.insert)
|
|
340
|
+
"aria-label": formatMessage(messages.insert)
|
|
341
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
342
|
+
,
|
|
341
343
|
xcss: [stickyButtonStyles, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) && stickyButtonDenseModeStyles],
|
|
342
344
|
onClick: handleQuickInsert,
|
|
343
345
|
onMouseDown: handleMouseDown
|
|
@@ -349,7 +351,9 @@ export const TypeAheadControl = ({
|
|
|
349
351
|
return jsx(Box
|
|
350
352
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
351
353
|
, {
|
|
352
|
-
style: positionStyles
|
|
354
|
+
style: positionStyles
|
|
355
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
356
|
+
,
|
|
353
357
|
xcss: [containerStaticStyles]
|
|
354
358
|
}, jsx("span", {
|
|
355
359
|
css: [tooltipContainerStyles, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && fg('platform_editor_table_sticky_header_patch_6') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && fg('platform_editor_table_sticky_header_patch_6') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
@@ -112,6 +112,8 @@ export const VisibilityContainer = ({
|
|
|
112
112
|
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
113
113
|
}, children);
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
115
117
|
return jsx(Box, {
|
|
116
118
|
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
|
|
117
119
|
}, children);
|
|
@@ -6,7 +6,6 @@ import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
|
6
6
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
10
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
12
11
|
import { mapPreservedSelection as _mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
@@ -61,7 +60,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
|
-
if (
|
|
63
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
65
64
|
pmPlugins.push({
|
|
66
65
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
67
66
|
plugin: createSelectionPreservationPlugin(api)
|
|
@@ -102,7 +101,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
102
101
|
return function (_ref4) {
|
|
103
102
|
var _api$userIntent, _api$blockControls, _options$anchorName, _api$blockControls2;
|
|
104
103
|
var tr = _ref4.tr;
|
|
105
|
-
if (!
|
|
104
|
+
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
106
105
|
return tr;
|
|
107
106
|
}
|
|
108
107
|
var currMeta = tr.getMeta(key);
|
|
@@ -335,7 +334,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
335
334
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
336
335
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
337
336
|
}
|
|
338
|
-
if (
|
|
337
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
339
338
|
var _selectionPreservatio;
|
|
340
339
|
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
341
340
|
}
|
|
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
6
|
-
import {
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
7
|
import { key } from '../pm-plugins/main';
|
|
8
8
|
import { mapPreservedSelection } from '../pm-plugins/utils/selection';
|
|
9
9
|
import { moveNode } from './move-node';
|
|
@@ -23,7 +23,7 @@ export var moveNodeWithBlockMenu = function moveNodeWithBlockMenu(api, direction
|
|
|
23
23
|
return function (_ref) {
|
|
24
24
|
var _api$blockControls$sh;
|
|
25
25
|
var tr = _ref.tr;
|
|
26
|
-
if (!
|
|
26
|
+
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
27
27
|
return tr;
|
|
28
28
|
}
|
|
29
29
|
var preservedSelection = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
@@ -437,7 +437,7 @@ export var moveNode = function moveNode(api) {
|
|
|
437
437
|
}));
|
|
438
438
|
if (
|
|
439
439
|
// when move node via block menu, we need to keep the focus on block menu popup, so don't move focus to editor in this scenario
|
|
440
|
-
!(inputMethod === INPUT_METHOD.BLOCK_MENU &&
|
|
440
|
+
!(inputMethod === INPUT_METHOD.BLOCK_MENU && editorExperiment('platform_editor_block_menu', true))) {
|
|
441
441
|
api === null || api === void 0 || api.core.actions.focus();
|
|
442
442
|
}
|
|
443
443
|
var $mappedTo = tr.doc.resolve(mappedTo);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
import { createPreservedSelection } from '../../pm-plugins/utils/selection';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -28,7 +28,7 @@ export var getNodeBoundsFromSelection = function getNodeBoundsFromSelection(sele
|
|
|
28
28
|
// Special case: if a media node (file) is selected, we need to get the parent mediaGroup
|
|
29
29
|
// This handles the case where clicking on a file creates a NodeSelection of the media node
|
|
30
30
|
// but we want to move the entire mediaGroup that wraps it
|
|
31
|
-
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' &&
|
|
31
|
+
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file' && editorExperiment('platform_editor_block_menu', true)) {
|
|
32
32
|
// The media node is wrapped in a mediaGroup, so we need to get the parent position
|
|
33
33
|
var mediaGroupPos = selection.$from.pos - 1;
|
|
34
34
|
var mediaGroupNode = selection.$from.doc.nodeAt(mediaGroupPos);
|
|
@@ -53,7 +53,7 @@ export var getNodeBoundsFromSelection = function getNodeBoundsFromSelection(sele
|
|
|
53
53
|
export var getPosWhenMoveNodeUp = function getPosWhenMoveNodeUp($currentNodePos, currentNodePos) {
|
|
54
54
|
var nodeIndex = $currentNodePos.index();
|
|
55
55
|
var nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
|
|
56
|
-
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' &&
|
|
56
|
+
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn' && editorExperiment('platform_editor_block_menu', true)) {
|
|
57
57
|
return -1;
|
|
58
58
|
}
|
|
59
59
|
return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
|
|
@@ -67,7 +67,7 @@ export var getPosWhenMoveNodeDown = function getPosWhenMoveNodeDown(_ref) {
|
|
|
67
67
|
return -1;
|
|
68
68
|
}
|
|
69
69
|
var nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
70
|
-
if (
|
|
70
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
71
71
|
var nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
72
72
|
// if move empty line down to another empty line, move to the position of the next empty line
|
|
73
73
|
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
export var handleMouseDown = function handleMouseDown(api) {
|
|
5
5
|
return function (view, event) {
|
|
6
6
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -28,7 +28,7 @@ export var handleMouseDown = function handleMouseDown(api) {
|
|
|
28
28
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name3 = rootNode.type.name) !== null && _rootNode$type$name3 !== void 0 ? _rootNode$type$name3 : '', undefined, rootPos, '', (_rootNode$type$name4 = rootNode.type.name) !== null && _rootNode$type$name4 !== void 0 ? _rootNode$type$name4 : ''));
|
|
29
29
|
}
|
|
30
30
|
} else {
|
|
31
|
-
var isDragHandle = event.target.closest(
|
|
31
|
+
var isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle]') !== null;
|
|
32
32
|
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
33
33
|
var tr = _ref.tr;
|
|
34
34
|
api === null || api === void 0 || api.blockControls.commands.setSelectedViaDragHandle(isDragHandle)({
|
|
@@ -38,7 +38,7 @@ export var handleMouseDown = function handleMouseDown(api) {
|
|
|
38
38
|
* When block menu is enabled, reset intent back to 'default' as editor-plugin-block-menu sets the user intent to 'blockMenuOpen', and setting here
|
|
39
39
|
* causes flickering as this runs before editor-plugin-block-menu.
|
|
40
40
|
*/
|
|
41
|
-
if (
|
|
41
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
42
42
|
// if target is drag handle, block menu will be opened
|
|
43
43
|
if (!isDragHandle) {
|
|
44
44
|
var _api$userIntent;
|
|
@@ -61,7 +61,9 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// If the editor view is not in focus when the block menu is open, do not update the drag handle
|
|
64
|
-
if (!view.hasFocus() && isMenuOpen &&
|
|
64
|
+
if (!view.hasFocus() && isMenuOpen && editorExperiment('platform_editor_block_menu', true, {
|
|
65
|
+
exposure: true
|
|
66
|
+
})) {
|
|
65
67
|
return false;
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -189,7 +191,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
189
191
|
if (nodeType) {
|
|
190
192
|
// platform_editor_controls note: enables quick insert
|
|
191
193
|
if (toolbarFlagsEnabled) {
|
|
192
|
-
if (
|
|
194
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
193
195
|
var _selectionPreservatio;
|
|
194
196
|
var preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
195
197
|
var selection = preservedSelection || view.state.selection;
|
|
@@ -210,7 +212,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
210
212
|
var _api$core3, _api$blockControls5;
|
|
211
213
|
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
212
214
|
}
|
|
213
|
-
if (
|
|
215
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
214
216
|
var _api$userIntent;
|
|
215
217
|
if (isMenuOpen && originalAnchorName && (api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'blockMenuOpen') {
|
|
216
218
|
var _api$core4, _api$blockControls6;
|
|
@@ -306,7 +306,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
306
306
|
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
307
307
|
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
308
308
|
// This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
|
|
309
|
-
if (browser.webkit &&
|
|
309
|
+
if (browser.webkit && editorExperiment('platform_editor_block_menu', true)) {
|
|
310
310
|
_mappedPos = tr.mapping.mapResult(activeNode.pos);
|
|
311
311
|
isActiveNodeDeleted = _mappedPos.deleted;
|
|
312
312
|
} else {
|
|
@@ -724,7 +724,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
724
724
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && findHandleDec(decorations, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos).length === 0 ? null : latestActiveNode;
|
|
725
725
|
}
|
|
726
726
|
var isMenuOpenNew = isMenuOpen;
|
|
727
|
-
if (
|
|
727
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
728
728
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
729
729
|
isMenuOpenNew = false;
|
|
730
730
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
@@ -746,9 +746,9 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
746
746
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
747
747
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
748
748
|
isMenuOpen: isMenuOpenNew,
|
|
749
|
-
menuTriggerBy: flags.toolbarFlagsEnabled ||
|
|
749
|
+
menuTriggerBy: flags.toolbarFlagsEnabled || editorExperiment('platform_editor_block_menu', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
750
750
|
menuTriggerByNode: editorExperiment('platform_synced_block', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
751
|
-
blockMenuOptions:
|
|
751
|
+
blockMenuOptions: editorExperiment('platform_editor_block_menu', true) ? {
|
|
752
752
|
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,
|
|
753
753
|
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,
|
|
754
754
|
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
|
|
@@ -980,12 +980,12 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
983
|
-
var isDragHandle = event.target.closest(
|
|
983
|
+
var isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
984
984
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
985
985
|
}
|
|
986
986
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
987
987
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
988
|
-
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) &&
|
|
988
|
+
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) && editorExperiment('platform_editor_block_menu', true);
|
|
989
989
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
990
990
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
991
991
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle && !isBlockMenuOpen) {
|
|
@@ -1007,12 +1007,12 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
1009
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
1010
|
-
var _isDragHandle = event.target.closest(
|
|
1010
|
+
var _isDragHandle = event.target.closest(editorExperiment('platform_editor_block_menu', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
1011
1011
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(_isDragHandle));
|
|
1012
1012
|
}
|
|
1013
1013
|
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
1014
1014
|
var _api$blockControls$sh4, _api$blockControls$sh5;
|
|
1015
|
-
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) &&
|
|
1015
|
+
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) && editorExperiment('platform_editor_block_menu', true);
|
|
1016
1016
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
1017
1017
|
// in this scenario, isSelectedViaDragHandle should not be set to false
|
|
1018
1018
|
if (api !== null && api !== void 0 && (_api$blockControls$sh5 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh5 !== void 0 && _api$blockControls$sh5.isSelectedViaDragHandle && !_isBlockMenuOpen) {
|
|
@@ -4,7 +4,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import {
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
export var getInlineNodePos = function getInlineNodePos(doc, start, nodeSize) {
|
|
9
9
|
var $startPos = doc.resolve(start);
|
|
10
10
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -90,7 +90,7 @@ export var newGetSelection = function newGetSelection(doc, selectionEmpty, start
|
|
|
90
90
|
var isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
91
91
|
var nodeSize = node ? node.nodeSize : 1;
|
|
92
92
|
var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
|
|
93
|
-
if (
|
|
93
|
+
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
94
94
|
var _doc$nodeAt;
|
|
95
95
|
// if mediaGroup only has a single child, we want to select the child
|
|
96
96
|
if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
|
|
@@ -135,7 +135,7 @@ export var newGetSelection = function newGetSelection(doc, selectionEmpty, start
|
|
|
135
135
|
return new TextSelection(doc.resolve(inlineNodePos), doc.resolve(inlineNodeEndPos));
|
|
136
136
|
};
|
|
137
137
|
export var getSelection = function getSelection(tr, start, api) {
|
|
138
|
-
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) ||
|
|
138
|
+
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) || editorExperiment('platform_editor_block_menu', true)) {
|
|
139
139
|
return newGetSelection(tr.doc, tr.selection.empty, start);
|
|
140
140
|
}
|
|
141
141
|
return oldGetSelection(tr, start);
|
|
@@ -1044,7 +1044,7 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1044
1044
|
setDragHandleDisabled(false);
|
|
1045
1045
|
}
|
|
1046
1046
|
}, [api === null || api === void 0 ? void 0 : api.blockControls.sharedState, isMultiSelect, isShiftDown, isTopLevelNodeValue, view]);
|
|
1047
|
-
var dragHandleMessage =
|
|
1047
|
+
var dragHandleMessage = editorExperiment('platform_editor_block_menu', true) ? formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
|
|
1048
1048
|
br: jsx("br", null)
|
|
1049
1049
|
}) : formatMessage(blockControlsMessages.dragToMove);
|
|
1050
1050
|
|
|
@@ -1133,15 +1133,15 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1133
1133
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1134
1134
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1135
1135
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1136
|
-
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,
|
|
1136
|
+
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, editorExperiment('platform_editor_block_menu', true) && isFocused && keyboardFocusedDragHandleStyles, editorExperiment('platform_editor_block_menu', true) ? focusedStyles : focusedStylesOld, (expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) && dragHandleButtonDenseModeStyles],
|
|
1137
1137
|
ref: buttonRef
|
|
1138
1138
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1139
1139
|
,
|
|
1140
1140
|
style: !editorExperiment('platform_editor_controls', 'variant1') ? editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld : {},
|
|
1141
1141
|
onMouseDown: expValEqualsNoExposure('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1142
|
-
onMouseUp:
|
|
1143
|
-
onClick:
|
|
1144
|
-
onKeyDown:
|
|
1142
|
+
onMouseUp: editorExperiment('platform_editor_block_menu', true) ? handleMouseUp : undefined,
|
|
1143
|
+
onClick: editorExperiment('platform_editor_block_menu', true) ? handleOnClickNew : handleOnClick,
|
|
1144
|
+
onKeyDown: editorExperiment('platform_editor_block_menu', true) ? handleKeyDownNew : handleKeyDown
|
|
1145
1145
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1146
1146
|
,
|
|
1147
1147
|
onDrop: handleOnDrop,
|
|
@@ -1150,7 +1150,7 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1150
1150
|
"data-blocks-drag-handle": expValEqualsNoExposure('confluence_remix_icon_right_side', 'isEnabled', true) || undefined,
|
|
1151
1151
|
"data-testid": "block-ctrl-drag-handle",
|
|
1152
1152
|
"aria-label": dragHandleAriaLabel,
|
|
1153
|
-
onBlur:
|
|
1153
|
+
onBlur: editorExperiment('platform_editor_block_menu', true) ? function () {
|
|
1154
1154
|
return setIsFocused(false);
|
|
1155
1155
|
} : undefined
|
|
1156
1156
|
}, jsx(Box, {
|
|
@@ -1169,7 +1169,9 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1169
1169
|
return jsx(Box
|
|
1170
1170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1171
1171
|
, {
|
|
1172
|
-
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1172
|
+
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1173
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1174
|
+
,
|
|
1173
1175
|
xcss: [dragHandleContainerStyles],
|
|
1174
1176
|
as: "span",
|
|
1175
1177
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1180,7 +1182,9 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1180
1182
|
helpDescriptors: helpDescriptors
|
|
1181
1183
|
}),
|
|
1182
1184
|
ignoreTooltipPointerEvents: true,
|
|
1183
|
-
position: 'top'
|
|
1185
|
+
position: 'top'
|
|
1186
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1187
|
+
,
|
|
1184
1188
|
onShow: function onShow() {
|
|
1185
1189
|
var _api$accessibilityUti;
|
|
1186
1190
|
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
@@ -1195,7 +1199,9 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1195
1199
|
return jsx(Box
|
|
1196
1200
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1197
1201
|
, {
|
|
1198
|
-
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1202
|
+
style: editorExperiment('platform_editor_block_control_optimise_render', true) ? positionStyles : positionStylesOld
|
|
1203
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1204
|
+
,
|
|
1199
1205
|
xcss: [dragHandleContainerStyles],
|
|
1200
1206
|
as: "span",
|
|
1201
1207
|
testId: "block-ctrl-drag-handle-container"
|
|
@@ -1210,7 +1216,9 @@ export var DragHandle = function DragHandle(_ref3) {
|
|
|
1210
1216
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
1211
1217
|
helpDescriptors: helpDescriptors
|
|
1212
1218
|
}),
|
|
1213
|
-
ignoreTooltipPointerEvents: true
|
|
1219
|
+
ignoreTooltipPointerEvents: true
|
|
1220
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1221
|
+
,
|
|
1214
1222
|
onShow: function onShow() {
|
|
1215
1223
|
var _api$accessibilityUti2;
|
|
1216
1224
|
api === null || api === void 0 || (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 || _api$accessibilityUti2.actions.ariaNotify(message, {
|