@atlaskit/editor-plugin-block-controls 31.1.19 → 32.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/blockControlsPlugin.js +11 -17
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +11 -47
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/cjs/pm-plugins/main.js +27 -30
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/cjs/pm-plugins/utils/transactions.js +1 -1
- package/dist/cjs/ui/drag-handle.js +38 -173
- package/dist/cjs/ui/global-styles.js +3 -3
- package/dist/es2019/blockControlsPlugin.js +9 -15
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +5 -9
- package/dist/es2019/pm-plugins/main.js +29 -32
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/es2019/pm-plugins/utils/transactions.js +1 -1
- package/dist/es2019/ui/drag-handle.js +16 -151
- package/dist/es2019/ui/global-styles.js +3 -3
- package/dist/esm/blockControlsPlugin.js +11 -17
- package/dist/esm/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/esm/pm-plugins/main.js +27 -30
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/esm/pm-plugins/utils/transactions.js +1 -1
- package/dist/esm/ui/drag-handle.js +40 -175
- package/dist/esm/ui/global-styles.js +3 -3
- package/package.json +20 -20
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.DragHandleWithVisibility = exports.DragHandle = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _react = require("react");
|
|
12
11
|
var _react2 = require("@emotion/react");
|
|
13
12
|
var _bindEventListener = require("bind-event-listener");
|
|
@@ -98,11 +97,6 @@ var buttonWrapperStylesPatch = (0, _react2.css)({
|
|
|
98
97
|
paddingRight: _constants.akEditorTableToolbarSize
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
|
-
|
|
102
|
-
// update color to match quick insert button for new editor controls
|
|
103
|
-
var dragHandleColor = (0, _react2.css)({
|
|
104
|
-
color: "var(--ds-icon-subtle, #505258)"
|
|
105
|
-
});
|
|
106
100
|
var dragHandleButtonStyles = (0, _react2.css)({
|
|
107
101
|
display: 'flex',
|
|
108
102
|
boxSizing: 'border-box',
|
|
@@ -117,8 +111,7 @@ var dragHandleButtonStyles = (0, _react2.css)({
|
|
|
117
111
|
background: 'transparent',
|
|
118
112
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
119
113
|
borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
|
|
120
|
-
|
|
121
|
-
color: "var(--ds-icon, #292A2E)",
|
|
114
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
122
115
|
cursor: 'grab',
|
|
123
116
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
124
117
|
zIndex: _consts.DRAG_HANDLE_ZINDEX,
|
|
@@ -147,52 +140,6 @@ var dragHandleButtonScaledStyles = (0, _react2.css)({
|
|
|
147
140
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
148
141
|
width: (0, _constants.relativeSizeToBaseFontSize)(_dragHandle.DRAG_HANDLE_WIDTH)
|
|
149
142
|
});
|
|
150
|
-
var dragHandleButtonSmallScreenStyles = (0, _react2.css)((0, _defineProperty2.default)({}, "@container editor-area (max-width: ".concat(_constants.akEditorFullPageNarrowBreakout, "px)"), {
|
|
151
|
-
opacity: 0,
|
|
152
|
-
visibility: 'hidden'
|
|
153
|
-
}));
|
|
154
|
-
var dragHandleButtonStylesOld = (0, _react2.css)({
|
|
155
|
-
position: 'absolute',
|
|
156
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
157
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
158
|
-
paddingLeft: '0',
|
|
159
|
-
paddingRight: '0',
|
|
160
|
-
boxSizing: 'border-box',
|
|
161
|
-
display: 'flex',
|
|
162
|
-
flexDirection: 'column',
|
|
163
|
-
justifyContent: 'center',
|
|
164
|
-
alignItems: 'center',
|
|
165
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
166
|
-
height: _consts.DRAG_HANDLE_HEIGHT,
|
|
167
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
168
|
-
width: _dragHandle.DRAG_HANDLE_WIDTH,
|
|
169
|
-
border: 'none',
|
|
170
|
-
background: 'transparent',
|
|
171
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
172
|
-
borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
|
|
173
|
-
// when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
|
|
174
|
-
color: "var(--ds-icon, #292A2E)",
|
|
175
|
-
cursor: 'grab',
|
|
176
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
177
|
-
zIndex: _consts.DRAG_HANDLE_ZINDEX,
|
|
178
|
-
outline: 'none',
|
|
179
|
-
'&:hover': {
|
|
180
|
-
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #0515240F)"
|
|
181
|
-
},
|
|
182
|
-
'&:active': {
|
|
183
|
-
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #0B120E24)"
|
|
184
|
-
},
|
|
185
|
-
'&:focus': {
|
|
186
|
-
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
|
|
187
|
-
},
|
|
188
|
-
'&:disabled': {
|
|
189
|
-
color: "var(--ds-icon-disabled, #080F214A)",
|
|
190
|
-
backgroundColor: 'transparent'
|
|
191
|
-
},
|
|
192
|
-
'&:hover:disabled': {
|
|
193
|
-
backgroundColor: "var(--ds-background-disabled, #0515240F)"
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
143
|
var focusedStyles = (0, _react2.css)({
|
|
197
144
|
'&:focus-visible': {
|
|
198
145
|
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
|
|
@@ -740,11 +687,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
740
687
|
var nodeTypeWithLevel = $pos !== null && $pos !== void 0 && (_$pos$nodeAfter = $pos.nodeAfter) !== null && _$pos$nodeAfter !== void 0 && _$pos$nodeAfter.isBlock ? (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) : nodeType;
|
|
741
688
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
742
689
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
743
|
-
var safeAnchorName = (0,
|
|
690
|
+
var safeAnchorName = (0, _anchorName.refreshAnchorName)({
|
|
744
691
|
getPos: getPos,
|
|
745
692
|
view: view,
|
|
746
693
|
anchorName: anchorName
|
|
747
|
-
})
|
|
694
|
+
});
|
|
748
695
|
var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(safeAnchorName, "\"]"));
|
|
749
696
|
|
|
750
697
|
// Defence-in-depth guard: since the node decoration sets data-active-drag-handle on the
|
|
@@ -792,13 +739,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
792
739
|
edge: 'right',
|
|
793
740
|
safeAnchorName: safeAnchorName
|
|
794
741
|
});
|
|
795
|
-
var bottom = (0,
|
|
742
|
+
var bottom = (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, _consts.ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME);
|
|
796
743
|
return _objectSpread({
|
|
797
744
|
left: isEdgeCase ? "calc(".concat(anchorStart, " + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((".concat(anchorRight, " + ").concat(anchorLeft, ")/2 - ").concat(_consts.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(".concat(anchorStart, " - ").concat(_dragHandle.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
798
745
|
top: (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(".concat(anchorTop, " - ").concat(_dragHandle.DRAG_HANDLE_WIDTH, "px)") : "calc(".concat(anchorStart, " + ").concat((0, _consts.topPositionAdjustment)(nodeTypeWithLevel, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
799
746
|
}, bottom);
|
|
800
747
|
}
|
|
801
|
-
var height = (0,
|
|
748
|
+
var height = (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(_consts.DRAG_HANDLE_HEIGHT), isLayoutColumn);
|
|
802
749
|
return _objectSpread({
|
|
803
750
|
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
804
751
|
top: (0, _dragHandlePositions.getTopPosition)(dom, nodeTypeWithLevel)
|
|
@@ -935,73 +882,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
935
882
|
var dragHandleAriaLabel = formatMessage(_blockControls.messages.dragToMoveClickToOpen, {
|
|
936
883
|
br: ' '
|
|
937
884
|
});
|
|
938
|
-
var helpDescriptors =
|
|
885
|
+
var helpDescriptors = [{
|
|
939
886
|
description: dragHandleMessage
|
|
940
|
-
}, {
|
|
941
|
-
description: formatMessage(_blockControls.messages.moveUp),
|
|
942
|
-
keymap: _keymaps.dragToMoveUp
|
|
943
|
-
}, {
|
|
944
|
-
description: formatMessage(_blockControls.messages.moveDown),
|
|
945
|
-
keymap: _keymaps.dragToMoveDown
|
|
946
|
-
}, {
|
|
947
|
-
description: formatMessage(_blockControls.messages.moveLeft),
|
|
948
|
-
keymap: _keymaps.dragToMoveLeft
|
|
949
|
-
}, {
|
|
950
|
-
description: formatMessage(_blockControls.messages.moveRight),
|
|
951
|
-
keymap: _keymaps.dragToMoveRight
|
|
952
|
-
}] : [{
|
|
953
|
-
description: dragHandleMessage
|
|
954
|
-
}, {
|
|
955
|
-
description: formatMessage(_blockControls.messages.moveUp),
|
|
956
|
-
keymap: _keymaps.dragToMoveUp
|
|
957
|
-
}, {
|
|
958
|
-
description: formatMessage(_blockControls.messages.moveDown),
|
|
959
|
-
keymap: _keymaps.dragToMoveDown
|
|
960
887
|
}];
|
|
961
|
-
var isParentNodeOfTypeLayout;
|
|
962
|
-
if (!isTopLevelNodeValue) {
|
|
963
|
-
var pos = getPos();
|
|
964
|
-
if (typeof pos === 'number') {
|
|
965
|
-
var _$pos$parent;
|
|
966
|
-
var $pos = view.state.doc.resolve(pos);
|
|
967
|
-
isParentNodeOfTypeLayout = ($pos === null || $pos === void 0 || (_$pos$parent = $pos.parent) === null || _$pos$parent === void 0 ? void 0 : _$pos$parent.type.name) === 'layoutColumn';
|
|
968
|
-
}
|
|
969
|
-
if (isParentNodeOfTypeLayout) {
|
|
970
|
-
helpDescriptors = [].concat((0, _toConsumableArray2.default)(helpDescriptors), [{
|
|
971
|
-
description: formatMessage(_blockControls.messages.moveLeft),
|
|
972
|
-
keymap: _keymaps.dragToMoveLeft
|
|
973
|
-
}, {
|
|
974
|
-
description: formatMessage(_blockControls.messages.moveRight),
|
|
975
|
-
keymap: _keymaps.dragToMoveRight
|
|
976
|
-
}]);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
// When advanced layout is on, layout column drag handle show only show 'Drag to move', no shortcuts
|
|
981
|
-
if ((0, _editorExperiment.editorExperiment)('advanced_layouts', true) && nodeType === 'layoutColumn') {
|
|
982
|
-
helpDescriptors = [{
|
|
983
|
-
description: formatMessage(_blockControls.messages.dragToRearrange)
|
|
984
|
-
}, {
|
|
985
|
-
description: formatMessage(_blockControls.messages.moveUp),
|
|
986
|
-
keymap: _keymaps.dragToMoveUp
|
|
987
|
-
}, {
|
|
988
|
-
description: formatMessage(_blockControls.messages.moveDown),
|
|
989
|
-
keymap: _keymaps.dragToMoveDown
|
|
990
|
-
}, {
|
|
991
|
-
description: formatMessage(_blockControls.messages.moveLeft),
|
|
992
|
-
keymap: _keymaps.dragToMoveLeft
|
|
993
|
-
}, {
|
|
994
|
-
description: formatMessage(_blockControls.messages.moveRight),
|
|
995
|
-
keymap: _keymaps.dragToMoveRight
|
|
996
|
-
}];
|
|
997
|
-
}
|
|
998
|
-
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
999
|
-
helpDescriptors = [{
|
|
1000
|
-
description: dragHandleMessage
|
|
1001
|
-
}];
|
|
1002
|
-
}
|
|
1003
888
|
var message = helpDescriptors.map(function (descriptor) {
|
|
1004
|
-
return
|
|
889
|
+
return [descriptor.description];
|
|
1005
890
|
}).join('. ');
|
|
1006
891
|
var handleOnDrop = function handleOnDrop(event) {
|
|
1007
892
|
event.stopPropagation();
|
|
@@ -1013,14 +898,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1013
898
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
1014
899
|
(0, _react2.jsx)("button", {
|
|
1015
900
|
type: "button",
|
|
1016
|
-
css: [
|
|
901
|
+
css: [dragHandleButtonStyles,
|
|
1017
902
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1018
903
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1019
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles,
|
|
1020
|
-
ref: buttonRef
|
|
1021
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1022
|
-
,
|
|
1023
|
-
style: !(0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? positionStylesOld : {},
|
|
904
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, isFocused && keyboardFocusedDragHandleStyles, focusedStyles, dragHandleButtonScaledStyles],
|
|
905
|
+
ref: buttonRef,
|
|
1024
906
|
onMouseDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1025
907
|
onMouseUp: handleMouseUp,
|
|
1026
908
|
onClick: handleOnClickNew,
|
|
@@ -1065,53 +947,36 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1065
947
|
})))
|
|
1066
948
|
);
|
|
1067
949
|
};
|
|
1068
|
-
var stickyWithTooltip = function stickyWithTooltip() {
|
|
1069
|
-
return (0, _react2.jsx)(_box.Box
|
|
1070
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1071
|
-
, {
|
|
1072
|
-
style: positionStylesOld
|
|
1073
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1074
|
-
,
|
|
1075
|
-
xcss: [dragHandleContainerStyles],
|
|
1076
|
-
as: "span",
|
|
1077
|
-
testId: "block-ctrl-drag-handle-container"
|
|
1078
|
-
}, (0, _react2.jsx)("span", {
|
|
1079
|
-
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1080
|
-
}, (0, _react2.jsx)(_Tooltip.default, {
|
|
1081
|
-
content: tooltipContent,
|
|
1082
|
-
ignoreTooltipPointerEvents: true,
|
|
1083
|
-
position: 'top',
|
|
1084
|
-
tag: (0, _fg.fg)('platform-dst-top-layer-tooltip') ? 'span' : 'div'
|
|
1085
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1086
|
-
,
|
|
1087
|
-
onShow: function onShow() {
|
|
1088
|
-
var _api$accessibilityUti;
|
|
1089
|
-
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
1090
|
-
priority: 'important'
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
}, (0, _react2.jsx)("span", {
|
|
1094
|
-
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && buttonWrapperStylesNoBackground, buttonWrapperStylesPatch]
|
|
1095
|
-
}, renderButton()))));
|
|
1096
|
-
};
|
|
1097
|
-
var buttonWithTooltip = function buttonWithTooltip() {
|
|
1098
|
-
return (0, _react2.jsx)(_Tooltip.default, {
|
|
1099
|
-
content: tooltipContent,
|
|
1100
|
-
ignoreTooltipPointerEvents: true
|
|
1101
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1102
|
-
,
|
|
1103
|
-
onShow: function onShow() {
|
|
1104
|
-
var _api$accessibilityUti2;
|
|
1105
|
-
api === null || api === void 0 || (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 || _api$accessibilityUti2.actions.ariaNotify(message, {
|
|
1106
|
-
priority: 'important'
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
}, renderButton());
|
|
1110
|
-
};
|
|
1111
950
|
var tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
|
|
1112
951
|
helpDescriptors: helpDescriptors
|
|
1113
952
|
});
|
|
1114
|
-
return (0,
|
|
953
|
+
return (0, _react2.jsx)(_box.Box
|
|
954
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
955
|
+
, {
|
|
956
|
+
style: positionStylesOld
|
|
957
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
958
|
+
,
|
|
959
|
+
xcss: [dragHandleContainerStyles],
|
|
960
|
+
as: "span",
|
|
961
|
+
testId: "block-ctrl-drag-handle-container"
|
|
962
|
+
}, (0, _react2.jsx)("span", {
|
|
963
|
+
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
964
|
+
}, (0, _react2.jsx)(_Tooltip.default, {
|
|
965
|
+
content: tooltipContent,
|
|
966
|
+
ignoreTooltipPointerEvents: true,
|
|
967
|
+
position: 'top',
|
|
968
|
+
tag: (0, _fg.fg)('platform-dst-top-layer-tooltip') ? 'span' : 'div'
|
|
969
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
970
|
+
,
|
|
971
|
+
onShow: function onShow() {
|
|
972
|
+
var _api$accessibilityUti;
|
|
973
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(message, {
|
|
974
|
+
priority: 'important'
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
}, (0, _react2.jsx)("span", {
|
|
978
|
+
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && buttonWrapperStylesNoBackground, buttonWrapperStylesPatch]
|
|
979
|
+
}, renderButton()))));
|
|
1115
980
|
};
|
|
1116
981
|
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref0) {
|
|
1117
982
|
var view = _ref0.view,
|
|
@@ -40,10 +40,10 @@ var dragHandlerAnchorSelectorNext = "[".concat(_domAttrName.NODE_ANCHOR_ATTR_NAM
|
|
|
40
40
|
*/
|
|
41
41
|
var dragHandlerAnchorSelectorWithTaskExclusion = "[".concat(_domAttrName.NODE_ANCHOR_ATTR_NAME, "]:not([data-prosemirror-node-name=\"tableRow\"], [data-prosemirror-node-name=\"tableCell\"], [data-prosemirror-node-name=\"tableHeader\"], [data-prosemirror-node-name=\"media\"], [data-prosemirror-node-inline=\"true\"], [data-prosemirror-node-name=\"taskList\"] [").concat(_domAttrName.NODE_ANCHOR_ATTR_NAME, "])");
|
|
42
42
|
var gutterPaddingWidth = function gutterPaddingWidth() {
|
|
43
|
-
return
|
|
43
|
+
return "".concat((0, _constants.akEditorGutterPaddingDynamic)(), "px");
|
|
44
44
|
};
|
|
45
45
|
var gutterPaddingLeft = function gutterPaddingLeft() {
|
|
46
|
-
return
|
|
46
|
+
return "-".concat((0, _constants.akEditorGutterPaddingDynamic)(), "px");
|
|
47
47
|
};
|
|
48
48
|
var extendedHoverZone = function extendedHoverZone() {
|
|
49
49
|
return (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".block-ctrl-drag-preview ".concat(dragHandlerAnchorSelector, "::after"), {
|
|
@@ -506,7 +506,7 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
506
506
|
styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
507
507
|
exposure: true
|
|
508
508
|
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
509
|
-
//
|
|
509
|
+
// this allows drag handles to render on empty lines
|
|
510
510
|
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
511
511
|
// dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
|
|
512
512
|
// staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
|
|
@@ -6,7 +6,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
10
9
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
11
10
|
import { mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
12
11
|
import { moveNode } from './editor-commands/move-node';
|
|
@@ -157,18 +156,16 @@ export const blockControlsPlugin = ({
|
|
|
157
156
|
plugin: () => createSparseSurfacesPlugin(api)
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
-
}
|
|
159
|
+
pmPlugins.push({
|
|
160
|
+
name: 'blockControlsInteractionTrackingPlugin',
|
|
161
|
+
plugin: () => createInteractionTrackingPlugin(rightSideControlsEnabled, api)
|
|
162
|
+
});
|
|
166
163
|
pmPlugins.push({
|
|
167
164
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
168
165
|
plugin: createSelectionPreservationPlugin(api)
|
|
169
166
|
});
|
|
170
167
|
|
|
171
|
-
//
|
|
168
|
+
// quick insert rendering fixes
|
|
172
169
|
//
|
|
173
170
|
// Not registered under the registry migration: the decoration puts an inline
|
|
174
171
|
// `margin-top: 0` on the first document node, which fights features that render their own
|
|
@@ -456,7 +453,7 @@ export const blockControlsPlugin = ({
|
|
|
456
453
|
stopPreservingSelection: () => stopPreservingSelection
|
|
457
454
|
},
|
|
458
455
|
getSharedState(editorState) {
|
|
459
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _selectionPreservatio;
|
|
456
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4, _selectionPreservatio;
|
|
460
457
|
if (!editorState) {
|
|
461
458
|
return undefined;
|
|
462
459
|
}
|
|
@@ -480,12 +477,9 @@ export const blockControlsPlugin = ({
|
|
|
480
477
|
sharedState.surfaceAnchors = surfaces === null || surfaces === void 0 ? void 0 : surfaces.anchors;
|
|
481
478
|
sharedState.surfaceActiveNodes = surfaces === null || surfaces === void 0 ? void 0 : surfaces.activeNodesByPosition;
|
|
482
479
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
487
|
-
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
488
|
-
}
|
|
480
|
+
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
481
|
+
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
482
|
+
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
489
483
|
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
490
484
|
return sharedState;
|
|
491
485
|
},
|
|
@@ -3,9 +3,8 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
7
6
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
8
|
-
import {
|
|
7
|
+
import { DragHandleWithVisibility } from '../ui/drag-handle';
|
|
9
8
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
10
9
|
import { renderToMountPoint, unmountFromMountPoint } from './react-root-registry';
|
|
11
10
|
import { getMatchingBlockMarks } from './utils/marks';
|
|
@@ -110,52 +109,17 @@ export const dragHandleDecoration = ({
|
|
|
110
109
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
111
110
|
// due to margins applied to other nodes eg. Headings
|
|
112
111
|
element.style.clear = 'unset';
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// getPos,
|
|
125
|
-
// anchorName,
|
|
126
|
-
// nodeType,
|
|
127
|
-
// handleOptions,
|
|
128
|
-
// isTopLevelNode,
|
|
129
|
-
// }),
|
|
130
|
-
// element,
|
|
131
|
-
// key,
|
|
132
|
-
// );
|
|
133
|
-
|
|
134
|
-
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
135
|
-
renderToMountPoint( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
136
|
-
view,
|
|
137
|
-
api,
|
|
138
|
-
formatMessage,
|
|
139
|
-
getPos,
|
|
140
|
-
anchorName,
|
|
141
|
-
nodeType,
|
|
142
|
-
handleOptions,
|
|
143
|
-
isTopLevelNode,
|
|
144
|
-
anchorRectCache
|
|
145
|
-
}), element);
|
|
146
|
-
} else {
|
|
147
|
-
renderToMountPoint( /*#__PURE__*/createElement(DragHandle, {
|
|
148
|
-
view,
|
|
149
|
-
api,
|
|
150
|
-
formatMessage,
|
|
151
|
-
getPos,
|
|
152
|
-
anchorName,
|
|
153
|
-
nodeType,
|
|
154
|
-
handleOptions,
|
|
155
|
-
isTopLevelNode,
|
|
156
|
-
anchorRectCache
|
|
157
|
-
}), element);
|
|
158
|
-
}
|
|
112
|
+
renderToMountPoint( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
113
|
+
view,
|
|
114
|
+
api,
|
|
115
|
+
formatMessage,
|
|
116
|
+
getPos,
|
|
117
|
+
anchorName,
|
|
118
|
+
nodeType,
|
|
119
|
+
handleOptions,
|
|
120
|
+
isTopLevelNode,
|
|
121
|
+
anchorRectCache
|
|
122
|
+
}), element);
|
|
159
123
|
return element;
|
|
160
124
|
}, widgetSpec);
|
|
161
125
|
};
|
|
@@ -247,7 +247,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
247
247
|
let rootNodeType;
|
|
248
248
|
let rootPos;
|
|
249
249
|
|
|
250
|
-
//
|
|
250
|
+
// enables quick insert
|
|
251
251
|
if (toolbarFlagsEnabled) {
|
|
252
252
|
rootPos = view.state.doc.resolve(pos).before(1);
|
|
253
253
|
if (targetPos !== rootPos) {
|
|
@@ -265,7 +265,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
265
265
|
(_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : getTypeNameFromDom(rootElement);
|
|
266
266
|
if (nodeType) {
|
|
267
267
|
var _api$userIntent2, _api$userIntent2$shar;
|
|
268
|
-
//
|
|
268
|
+
// enables quick insert
|
|
269
269
|
if (toolbarFlagsEnabled) {
|
|
270
270
|
var _selectionPreservatio;
|
|
271
271
|
const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
@@ -4,7 +4,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
6
|
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
8
7
|
import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
|
|
9
8
|
import { handleKeyDown } from './handle-key-down';
|
|
10
9
|
import { handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
|
|
@@ -55,13 +54,10 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
55
54
|
key: interactionTrackingPluginKey,
|
|
56
55
|
state: {
|
|
57
56
|
init() {
|
|
58
|
-
|
|
59
|
-
isEditing: false
|
|
57
|
+
return {
|
|
58
|
+
isEditing: false,
|
|
59
|
+
isMouseOut: false
|
|
60
60
|
};
|
|
61
|
-
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
62
|
-
state.isMouseOut = false;
|
|
63
|
-
}
|
|
64
|
-
return state;
|
|
65
61
|
},
|
|
66
62
|
apply(tr, pluginState) {
|
|
67
63
|
const meta = tr.getMeta(interactionTrackingPluginKey);
|
|
@@ -102,7 +98,7 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
102
98
|
mousemove: (view, event) => handleMouseMove(view, event, rightSideControlsEnabled, api)
|
|
103
99
|
}
|
|
104
100
|
},
|
|
105
|
-
view:
|
|
101
|
+
view: view => {
|
|
106
102
|
const editorContentArea = view.dom.closest('.ak-editor-content-area');
|
|
107
103
|
let unbindMouseEnter;
|
|
108
104
|
let unbindMouseLeave;
|
|
@@ -232,7 +228,7 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
|
|
|
232
228
|
(_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 ? void 0 : _unbindMouseLeave();
|
|
233
229
|
}
|
|
234
230
|
};
|
|
235
|
-
}
|
|
231
|
+
}
|
|
236
232
|
});
|
|
237
233
|
};
|
|
238
234
|
export const getInteractionTrackingState = state => {
|