@atlaskit/editor-plugin-block-controls 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +8 -1
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/cjs/ui/drag-handle.js +44 -15
- package/dist/cjs/ui/quick-insert-button.js +1 -1
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +7 -0
- package/dist/es2019/ui/consts.js +1 -0
- package/dist/es2019/ui/drag-handle.js +46 -17
- package/dist/es2019/ui/quick-insert-button.js +1 -1
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +7 -0
- package/dist/esm/ui/consts.js +1 -0
- package/dist/esm/ui/drag-handle.js +46 -17
- package/dist/esm/ui/quick-insert-button.js +1 -1
- package/dist/types/pm-plugins/utils/drag-handle-positions.d.ts +1 -0
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils/drag-handle-positions.d.ts +1 -0
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#140783](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140783)
|
|
8
|
+
[`a2d4bdd4841c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2d4bdd4841c5) -
|
|
9
|
+
[ux] Extend drag handle background with gradient to obscure adjacent node controls for contrast
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.10.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.shouldBeSticky = exports.getTopPosition = exports.getNodeHeight = exports.getLeftPosition = exports.getControlHeightCSSValue = exports.getControlBottomCSSValue = void 0;
|
|
6
|
+
exports.shouldMaskNodeControls = exports.shouldBeSticky = exports.getTopPosition = exports.getNodeHeight = exports.getLeftPosition = exports.getControlHeightCSSValue = exports.getControlBottomCSSValue = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
8
9
|
var _consts = require("../../ui/consts");
|
|
9
10
|
var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -72,4 +73,10 @@ var getControlHeightCSSValue = exports.getControlHeightCSSValue = function getCo
|
|
|
72
73
|
} : {
|
|
73
74
|
height: "".concat(nodeHeight || fallbackPxHeight, "px")
|
|
74
75
|
};
|
|
76
|
+
};
|
|
77
|
+
var shouldMaskNodeControls = exports.shouldMaskNodeControls = function shouldMaskNodeControls(nodeType, isTopLevelNode) {
|
|
78
|
+
return (
|
|
79
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
80
|
+
isTopLevelNode && ['table'].includes(nodeType) && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
81
|
+
);
|
|
75
82
|
};
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
|
|
7
|
+
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
10
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -34,6 +34,7 @@ var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJ
|
|
|
34
34
|
* so we allow for some leniency to capture them all. e.g. Table is depth 3.
|
|
35
35
|
*/
|
|
36
36
|
var DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
|
|
37
|
+
var STICKY_CONTROLS_TOP_MARGIN = exports.STICKY_CONTROLS_TOP_MARGIN = 8;
|
|
37
38
|
var QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_HEIGHT = 24;
|
|
38
39
|
var QUICK_INSERT_WIDTH = exports.QUICK_INSERT_WIDTH = 24;
|
|
39
40
|
var QUICK_INSERT_DIMENSIONS = exports.QUICK_INSERT_DIMENSIONS = {
|
|
@@ -47,6 +47,19 @@ var iconWrapperStyles = (0, _primitives.xcss)({
|
|
|
47
47
|
justifyContent: 'center',
|
|
48
48
|
alignItems: 'center'
|
|
49
49
|
});
|
|
50
|
+
var extendedIconWrapperStyles = (0, _react2.css)({
|
|
51
|
+
display: 'flex',
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
background: "var(--ds-surface, #FFFFFF)",
|
|
55
|
+
marginBottom: "var(--ds-space-negative-100, -8px)",
|
|
56
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
57
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
58
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
59
|
+
marginRight: "var(--ds-space-negative-100, -8px)",
|
|
60
|
+
paddingRight: "var(--ds-space-100, 8px)",
|
|
61
|
+
borderRadius: '6px'
|
|
62
|
+
});
|
|
50
63
|
|
|
51
64
|
// update color to match quick insert button for new editor controls
|
|
52
65
|
var dragHandleColor = (0, _react2.css)({
|
|
@@ -136,16 +149,25 @@ var dragHandleContainerStyles = (0, _primitives.xcss)({
|
|
|
136
149
|
boxSizing: 'border-box'
|
|
137
150
|
});
|
|
138
151
|
var tooltipContainerStyles = (0, _react2.css)({
|
|
139
|
-
|
|
140
|
-
|
|
152
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
153
|
+
top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
154
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
155
|
+
bottom: "-".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
156
|
+
position: 'sticky',
|
|
157
|
+
zIndex: 100 // card = 100
|
|
158
|
+
});
|
|
159
|
+
var tooltipContainerStylesWithNodeControls = (0, _react2.css)({
|
|
160
|
+
top: '0',
|
|
161
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
162
|
+
bottom: "-".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
141
163
|
position: 'sticky',
|
|
142
|
-
zIndex:
|
|
164
|
+
zIndex: 100 // card = 100
|
|
143
165
|
});
|
|
144
166
|
var tooltipContainerStylesStickyHeader = (0, _react2.css)({
|
|
145
167
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
146
168
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
147
169
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
148
|
-
top: _styles.tableControlsSpacing
|
|
170
|
+
top: _styles.tableControlsSpacing - _consts.STICKY_CONTROLS_TOP_MARGIN
|
|
149
171
|
}
|
|
150
172
|
});
|
|
151
173
|
|
|
@@ -154,7 +176,7 @@ var tooltipContainerStylesStickyHeaderWithMarksFix = (0, _react2.css)({
|
|
|
154
176
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
155
177
|
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
156
178
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
157
|
-
top: _styles.tableControlsSpacing
|
|
179
|
+
top: _styles.tableControlsSpacing - _consts.STICKY_CONTROLS_TOP_MARGIN
|
|
158
180
|
}
|
|
159
181
|
});
|
|
160
182
|
var dragHandleMultiLineSelectionFixFirefox = (0, _react2.css)({
|
|
@@ -564,13 +586,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
564
586
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
565
587
|
var isSticky = (0, _dragHandlePositions.shouldBeSticky)(nodeType);
|
|
566
588
|
if (supportsAnchor) {
|
|
567
|
-
var bottom = (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
589
|
+
var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
568
590
|
return _objectSpread({
|
|
569
591
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
570
592
|
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)")
|
|
571
593
|
}, bottom);
|
|
572
594
|
}
|
|
573
|
-
var height = (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
595
|
+
var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(_consts.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
574
596
|
return _objectSpread({
|
|
575
597
|
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),
|
|
576
598
|
top: (0, _dragHandlePositions.getTopPosition)(dom, nodeType)
|
|
@@ -712,14 +734,14 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
712
734
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
713
735
|
(0, _react2.jsx)("button", {
|
|
714
736
|
type: "button",
|
|
715
|
-
css: [(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
737
|
+
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
716
738
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
717
739
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
718
740
|
_browser.browser.gecko && (0, _platformFeatureFlags.fg)('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
|
|
719
741
|
ref: buttonRef
|
|
720
742
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
721
743
|
,
|
|
722
|
-
style: !(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') && positionStyles || {},
|
|
744
|
+
style: !((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls')) && positionStyles || {},
|
|
723
745
|
onClick: handleOnClick,
|
|
724
746
|
onMouseDown: handleMouseDown,
|
|
725
747
|
onKeyDown: handleKeyDown
|
|
@@ -730,7 +752,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
730
752
|
"data-editor-block-ctrl-drag-handle": true,
|
|
731
753
|
"data-testid": "block-ctrl-drag-handle"
|
|
732
754
|
}, (0, _react2.jsx)(_primitives.Box, {
|
|
733
|
-
as: "span",
|
|
734
755
|
xcss: iconWrapperStyles
|
|
735
756
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
736
757
|
,
|
|
@@ -752,7 +773,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
752
773
|
as: "span",
|
|
753
774
|
testId: "block-ctrl-drag-handle-container"
|
|
754
775
|
}, (0, _react2.jsx)("span", {
|
|
755
|
-
css: [tooltipContainerStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
776
|
+
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
756
777
|
}, (0, _react2.jsx)(_tooltip.default, {
|
|
757
778
|
content: (0, _react2.jsx)(_keymaps.TooltipContentWithMultipleShortcuts, {
|
|
758
779
|
helpDescriptors: helpDescriptors
|
|
@@ -765,7 +786,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
765
786
|
priority: 'important'
|
|
766
787
|
});
|
|
767
788
|
}
|
|
768
|
-
},
|
|
789
|
+
}, (0, _react2.jsx)("span", {
|
|
790
|
+
css:
|
|
791
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
792
|
+
(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
793
|
+
}, renderButton()))));
|
|
769
794
|
};
|
|
770
795
|
var stickyWithoutTooltip = function stickyWithoutTooltip() {
|
|
771
796
|
return (0, _react2.jsx)(_primitives.Box
|
|
@@ -776,8 +801,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
776
801
|
as: "span",
|
|
777
802
|
testId: "block-ctrl-drag-handle-container"
|
|
778
803
|
}, (0, _react2.jsx)("span", {
|
|
779
|
-
css: [tooltipContainerStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
780
|
-
},
|
|
804
|
+
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
805
|
+
}, (0, _react2.jsx)("span", {
|
|
806
|
+
css:
|
|
807
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
808
|
+
(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
809
|
+
}, renderButton())));
|
|
781
810
|
};
|
|
782
811
|
var buttonWithTooltip = function buttonWithTooltip() {
|
|
783
812
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
@@ -796,7 +825,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
796
825
|
var isTooltip = !dragHandleDisabled && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873');
|
|
797
826
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
798
827
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
799
|
-
return (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
828
|
+
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
800
829
|
};
|
|
801
830
|
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref8) {
|
|
802
831
|
var view = _ref8.view,
|
|
@@ -309,7 +309,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
309
309
|
testId: "editor-quick-insert-button",
|
|
310
310
|
type: "button",
|
|
311
311
|
"aria-label": formatMessage(_messages.blockControlsMessages.insert),
|
|
312
|
-
xcss: [(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ?
|
|
312
|
+
xcss: [(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? stickyButtonStyles : buttonStyles, isTypeAheadOpen && !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') ? disabledStyles : undefined],
|
|
313
313
|
onClick: handleQuickInsert,
|
|
314
314
|
onMouseDown: handleMouseDown,
|
|
315
315
|
isDisabled: !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') && isTypeAheadOpen
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
2
3
|
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
3
4
|
const STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -64,4 +65,10 @@ export const getControlHeightCSSValue = (nodeHeight, isSticky, isTopLevelNode, f
|
|
|
64
65
|
} : {
|
|
65
66
|
height: `${nodeHeight || fallbackPxHeight}px`
|
|
66
67
|
};
|
|
68
|
+
};
|
|
69
|
+
export const shouldMaskNodeControls = (nodeType, isTopLevelNode) => {
|
|
70
|
+
return (
|
|
71
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
72
|
+
isTopLevelNode && ['table'].includes(nodeType) && fg('platform_editor_controls_sticky_controls') && editorExperiment('platform_editor_controls', 'variant1')
|
|
73
|
+
);
|
|
67
74
|
};
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -25,6 +25,7 @@ export const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
|
25
25
|
* so we allow for some leniency to capture them all. e.g. Table is depth 3.
|
|
26
26
|
*/
|
|
27
27
|
export const DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
|
|
28
|
+
export const STICKY_CONTROLS_TOP_MARGIN = 8;
|
|
28
29
|
export const QUICK_INSERT_HEIGHT = 24;
|
|
29
30
|
export const QUICK_INSERT_WIDTH = 24;
|
|
30
31
|
export const QUICK_INSERT_DIMENSIONS = {
|
|
@@ -27,10 +27,10 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
27
27
|
import Tooltip from '@atlaskit/tooltip';
|
|
28
28
|
import { key } from '../pm-plugins/main';
|
|
29
29
|
import { getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
30
|
-
import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
30
|
+
import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, getNodeHeight, getTopPosition, shouldBeSticky, shouldMaskNodeControls } from '../pm-plugins/utils/drag-handle-positions';
|
|
31
31
|
import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
|
|
32
32
|
import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
|
|
33
|
-
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
33
|
+
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, topPositionAdjustment } from './consts';
|
|
34
34
|
import { dragPreview } from './drag-preview';
|
|
35
35
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
36
36
|
import { VisibilityContainer } from './visibility-container';
|
|
@@ -39,6 +39,19 @@ const iconWrapperStyles = xcss({
|
|
|
39
39
|
justifyContent: 'center',
|
|
40
40
|
alignItems: 'center'
|
|
41
41
|
});
|
|
42
|
+
const extendedIconWrapperStyles = css({
|
|
43
|
+
display: 'flex',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
background: "var(--ds-surface, #FFFFFF)",
|
|
47
|
+
marginBottom: "var(--ds-space-negative-100, -8px)",
|
|
48
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
49
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
50
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
51
|
+
marginRight: "var(--ds-space-negative-100, -8px)",
|
|
52
|
+
paddingRight: "var(--ds-space-100, 8px)",
|
|
53
|
+
borderRadius: '6px'
|
|
54
|
+
});
|
|
42
55
|
|
|
43
56
|
// update color to match quick insert button for new editor controls
|
|
44
57
|
const dragHandleColor = css({
|
|
@@ -128,16 +141,25 @@ const dragHandleContainerStyles = xcss({
|
|
|
128
141
|
boxSizing: 'border-box'
|
|
129
142
|
});
|
|
130
143
|
const tooltipContainerStyles = css({
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
145
|
+
top: `${STICKY_CONTROLS_TOP_MARGIN}px`,
|
|
146
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
147
|
+
bottom: `-${STICKY_CONTROLS_TOP_MARGIN}px`,
|
|
148
|
+
position: 'sticky',
|
|
149
|
+
zIndex: 100 // card = 100
|
|
150
|
+
});
|
|
151
|
+
const tooltipContainerStylesWithNodeControls = css({
|
|
152
|
+
top: '0',
|
|
153
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
154
|
+
bottom: `-${STICKY_CONTROLS_TOP_MARGIN}px`,
|
|
133
155
|
position: 'sticky',
|
|
134
|
-
zIndex:
|
|
156
|
+
zIndex: 100 // card = 100
|
|
135
157
|
});
|
|
136
158
|
const tooltipContainerStylesStickyHeader = css({
|
|
137
159
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
138
160
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
139
161
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
140
|
-
top: tableControlsSpacing
|
|
162
|
+
top: tableControlsSpacing - STICKY_CONTROLS_TOP_MARGIN
|
|
141
163
|
}
|
|
142
164
|
});
|
|
143
165
|
|
|
@@ -146,7 +168,7 @@ const tooltipContainerStylesStickyHeaderWithMarksFix = css({
|
|
|
146
168
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
147
169
|
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
148
170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
149
|
-
top: tableControlsSpacing
|
|
171
|
+
top: tableControlsSpacing - STICKY_CONTROLS_TOP_MARGIN
|
|
150
172
|
}
|
|
151
173
|
});
|
|
152
174
|
const dragHandleMultiLineSelectionFixFirefox = css({
|
|
@@ -553,14 +575,14 @@ export const DragHandle = ({
|
|
|
553
575
|
const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
554
576
|
const isSticky = shouldBeSticky(nodeType);
|
|
555
577
|
if (supportsAnchor) {
|
|
556
|
-
const bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
578
|
+
const bottom = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
557
579
|
return {
|
|
558
580
|
left: isEdgeCase ? `calc(anchor(${safeAnchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((anchor(${safeAnchorName} right) + anchor(${safeAnchorName} left))/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(anchor(${safeAnchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
559
581
|
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(nodeType)}px)`,
|
|
560
582
|
...bottom
|
|
561
583
|
};
|
|
562
584
|
}
|
|
563
|
-
const height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, `${DRAG_HANDLE_HEIGHT}`, isLayoutColumn) : {};
|
|
585
|
+
const height = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, `${DRAG_HANDLE_HEIGHT}`, isLayoutColumn) : {};
|
|
564
586
|
return {
|
|
565
587
|
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
566
588
|
top: getTopPosition(dom, nodeType),
|
|
@@ -699,14 +721,14 @@ export const DragHandle = ({
|
|
|
699
721
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
700
722
|
jsx("button", {
|
|
701
723
|
type: "button",
|
|
702
|
-
css: [fg('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
724
|
+
css: [editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
703
725
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
704
726
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
705
727
|
browser.gecko && fg('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
|
|
706
728
|
ref: buttonRef
|
|
707
729
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
708
730
|
,
|
|
709
|
-
style: !fg('platform_editor_controls_sticky_controls') && positionStyles || {},
|
|
731
|
+
style: !(editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls')) && positionStyles || {},
|
|
710
732
|
onClick: handleOnClick,
|
|
711
733
|
onMouseDown: handleMouseDown,
|
|
712
734
|
onKeyDown: handleKeyDown
|
|
@@ -717,7 +739,6 @@ export const DragHandle = ({
|
|
|
717
739
|
"data-editor-block-ctrl-drag-handle": true,
|
|
718
740
|
"data-testid": "block-ctrl-drag-handle"
|
|
719
741
|
}, jsx(Box, {
|
|
720
|
-
as: "span",
|
|
721
742
|
xcss: iconWrapperStyles
|
|
722
743
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
723
744
|
,
|
|
@@ -736,7 +757,7 @@ export const DragHandle = ({
|
|
|
736
757
|
as: "span",
|
|
737
758
|
testId: "block-ctrl-drag-handle-container"
|
|
738
759
|
}, jsx("span", {
|
|
739
|
-
css: [tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
760
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
740
761
|
}, jsx(Tooltip, {
|
|
741
762
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
742
763
|
helpDescriptors: helpDescriptors
|
|
@@ -749,7 +770,11 @@ export const DragHandle = ({
|
|
|
749
770
|
priority: 'important'
|
|
750
771
|
});
|
|
751
772
|
}
|
|
752
|
-
},
|
|
773
|
+
}, jsx("span", {
|
|
774
|
+
css:
|
|
775
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
776
|
+
shouldMaskNodeControls(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
777
|
+
}, renderButton()))));
|
|
753
778
|
const stickyWithoutTooltip = () => jsx(Box
|
|
754
779
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
755
780
|
, {
|
|
@@ -758,8 +783,12 @@ export const DragHandle = ({
|
|
|
758
783
|
as: "span",
|
|
759
784
|
testId: "block-ctrl-drag-handle-container"
|
|
760
785
|
}, jsx("span", {
|
|
761
|
-
css: [tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
762
|
-
},
|
|
786
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
787
|
+
}, jsx("span", {
|
|
788
|
+
css:
|
|
789
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
790
|
+
shouldMaskNodeControls(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
791
|
+
}, renderButton())));
|
|
763
792
|
const buttonWithTooltip = () => jsx(Tooltip, {
|
|
764
793
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
765
794
|
helpDescriptors: helpDescriptors
|
|
@@ -775,7 +804,7 @@ export const DragHandle = ({
|
|
|
775
804
|
const isTooltip = !dragHandleDisabled && fg('platform_editor_element_drag_and_drop_ed_23873');
|
|
776
805
|
const stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
777
806
|
const render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
778
|
-
return fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
807
|
+
return editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
779
808
|
};
|
|
780
809
|
export const DragHandleWithVisibility = ({
|
|
781
810
|
view,
|
|
@@ -299,7 +299,7 @@ export const TypeAheadControl = ({
|
|
|
299
299
|
testId: "editor-quick-insert-button",
|
|
300
300
|
type: "button",
|
|
301
301
|
"aria-label": formatMessage(messages.insert),
|
|
302
|
-
xcss: [fg('platform_editor_controls_sticky_controls') ?
|
|
302
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? stickyButtonStyles : buttonStyles, isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') ? disabledStyles : undefined],
|
|
303
303
|
onClick: handleQuickInsert,
|
|
304
304
|
onMouseDown: handleMouseDown,
|
|
305
305
|
isDisabled: !fg('platform_editor_controls_widget_visibility') && isTypeAheadOpen
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
2
3
|
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
3
4
|
var STICKY_NODES = ['panel', 'table', 'expand', 'layoutSection', 'bodiedExtension'];
|
|
@@ -66,4 +67,10 @@ export var getControlHeightCSSValue = function getControlHeightCSSValue(nodeHeig
|
|
|
66
67
|
} : {
|
|
67
68
|
height: "".concat(nodeHeight || fallbackPxHeight, "px")
|
|
68
69
|
};
|
|
70
|
+
};
|
|
71
|
+
export var shouldMaskNodeControls = function shouldMaskNodeControls(nodeType, isTopLevelNode) {
|
|
72
|
+
return (
|
|
73
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
74
|
+
isTopLevelNode && ['table'].includes(nodeType) && fg('platform_editor_controls_sticky_controls') && editorExperiment('platform_editor_controls', 'variant1')
|
|
75
|
+
);
|
|
69
76
|
};
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -27,6 +27,7 @@ export var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
|
27
27
|
* so we allow for some leniency to capture them all. e.g. Table is depth 3.
|
|
28
28
|
*/
|
|
29
29
|
export var DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
|
|
30
|
+
export var STICKY_CONTROLS_TOP_MARGIN = 8;
|
|
30
31
|
export var QUICK_INSERT_HEIGHT = 24;
|
|
31
32
|
export var QUICK_INSERT_WIDTH = 24;
|
|
32
33
|
export var QUICK_INSERT_DIMENSIONS = {
|
|
@@ -32,10 +32,10 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
32
32
|
import Tooltip from '@atlaskit/tooltip';
|
|
33
33
|
import { key } from '../pm-plugins/main';
|
|
34
34
|
import { getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
35
|
-
import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
35
|
+
import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, getNodeHeight, getTopPosition, shouldBeSticky, shouldMaskNodeControls } from '../pm-plugins/utils/drag-handle-positions';
|
|
36
36
|
import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
|
|
37
37
|
import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
|
|
38
|
-
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
38
|
+
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, topPositionAdjustment } from './consts';
|
|
39
39
|
import { dragPreview } from './drag-preview';
|
|
40
40
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
41
41
|
import { VisibilityContainer } from './visibility-container';
|
|
@@ -44,6 +44,19 @@ var iconWrapperStyles = xcss({
|
|
|
44
44
|
justifyContent: 'center',
|
|
45
45
|
alignItems: 'center'
|
|
46
46
|
});
|
|
47
|
+
var extendedIconWrapperStyles = css({
|
|
48
|
+
display: 'flex',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
background: "var(--ds-surface, #FFFFFF)",
|
|
52
|
+
marginBottom: "var(--ds-space-negative-100, -8px)",
|
|
53
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
54
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
55
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
56
|
+
marginRight: "var(--ds-space-negative-100, -8px)",
|
|
57
|
+
paddingRight: "var(--ds-space-100, 8px)",
|
|
58
|
+
borderRadius: '6px'
|
|
59
|
+
});
|
|
47
60
|
|
|
48
61
|
// update color to match quick insert button for new editor controls
|
|
49
62
|
var dragHandleColor = css({
|
|
@@ -133,16 +146,25 @@ var dragHandleContainerStyles = xcss({
|
|
|
133
146
|
boxSizing: 'border-box'
|
|
134
147
|
});
|
|
135
148
|
var tooltipContainerStyles = css({
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
150
|
+
top: "".concat(STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
151
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
152
|
+
bottom: "-".concat(STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
153
|
+
position: 'sticky',
|
|
154
|
+
zIndex: 100 // card = 100
|
|
155
|
+
});
|
|
156
|
+
var tooltipContainerStylesWithNodeControls = css({
|
|
157
|
+
top: '0',
|
|
158
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
159
|
+
bottom: "-".concat(STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
138
160
|
position: 'sticky',
|
|
139
|
-
zIndex:
|
|
161
|
+
zIndex: 100 // card = 100
|
|
140
162
|
});
|
|
141
163
|
var tooltipContainerStylesStickyHeader = css({
|
|
142
164
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
143
165
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
144
166
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
145
|
-
top: tableControlsSpacing
|
|
167
|
+
top: tableControlsSpacing - STICKY_CONTROLS_TOP_MARGIN
|
|
146
168
|
}
|
|
147
169
|
});
|
|
148
170
|
|
|
@@ -151,7 +173,7 @@ var tooltipContainerStylesStickyHeaderWithMarksFix = css({
|
|
|
151
173
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
152
174
|
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
153
175
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
154
|
-
top: tableControlsSpacing
|
|
176
|
+
top: tableControlsSpacing - STICKY_CONTROLS_TOP_MARGIN
|
|
155
177
|
}
|
|
156
178
|
});
|
|
157
179
|
var dragHandleMultiLineSelectionFixFirefox = css({
|
|
@@ -561,13 +583,13 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
561
583
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
562
584
|
var isSticky = shouldBeSticky(nodeType);
|
|
563
585
|
if (supportsAnchor) {
|
|
564
|
-
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
586
|
+
var bottom = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
565
587
|
return _objectSpread({
|
|
566
588
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
567
589
|
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)")
|
|
568
590
|
}, bottom);
|
|
569
591
|
}
|
|
570
|
-
var height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
592
|
+
var height = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
571
593
|
return _objectSpread({
|
|
572
594
|
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
573
595
|
top: getTopPosition(dom, nodeType)
|
|
@@ -709,14 +731,14 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
709
731
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
710
732
|
jsx("button", {
|
|
711
733
|
type: "button",
|
|
712
|
-
css: [fg('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
734
|
+
css: [editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
713
735
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
714
736
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
715
737
|
browser.gecko && fg('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
|
|
716
738
|
ref: buttonRef
|
|
717
739
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
718
740
|
,
|
|
719
|
-
style: !fg('platform_editor_controls_sticky_controls') && positionStyles || {},
|
|
741
|
+
style: !(editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls')) && positionStyles || {},
|
|
720
742
|
onClick: handleOnClick,
|
|
721
743
|
onMouseDown: handleMouseDown,
|
|
722
744
|
onKeyDown: handleKeyDown
|
|
@@ -727,7 +749,6 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
727
749
|
"data-editor-block-ctrl-drag-handle": true,
|
|
728
750
|
"data-testid": "block-ctrl-drag-handle"
|
|
729
751
|
}, jsx(Box, {
|
|
730
|
-
as: "span",
|
|
731
752
|
xcss: iconWrapperStyles
|
|
732
753
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
733
754
|
,
|
|
@@ -749,7 +770,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
749
770
|
as: "span",
|
|
750
771
|
testId: "block-ctrl-drag-handle-container"
|
|
751
772
|
}, jsx("span", {
|
|
752
|
-
css: [tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
773
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
753
774
|
}, jsx(Tooltip, {
|
|
754
775
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
755
776
|
helpDescriptors: helpDescriptors
|
|
@@ -762,7 +783,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
762
783
|
priority: 'important'
|
|
763
784
|
});
|
|
764
785
|
}
|
|
765
|
-
},
|
|
786
|
+
}, jsx("span", {
|
|
787
|
+
css:
|
|
788
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
789
|
+
shouldMaskNodeControls(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
790
|
+
}, renderButton()))));
|
|
766
791
|
};
|
|
767
792
|
var stickyWithoutTooltip = function stickyWithoutTooltip() {
|
|
768
793
|
return jsx(Box
|
|
@@ -773,8 +798,12 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
773
798
|
as: "span",
|
|
774
799
|
testId: "block-ctrl-drag-handle-container"
|
|
775
800
|
}, jsx("span", {
|
|
776
|
-
css: [tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
777
|
-
},
|
|
801
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNode) ? tooltipContainerStylesWithNodeControls : tooltipContainerStyles, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeader, fg('platform_editor_controls_patch_4') && tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
802
|
+
}, jsx("span", {
|
|
803
|
+
css:
|
|
804
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
805
|
+
shouldMaskNodeControls(nodeType, isTopLevelNode) && extendedIconWrapperStyles
|
|
806
|
+
}, renderButton())));
|
|
778
807
|
};
|
|
779
808
|
var buttonWithTooltip = function buttonWithTooltip() {
|
|
780
809
|
return jsx(Tooltip, {
|
|
@@ -793,7 +822,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
793
822
|
var isTooltip = !dragHandleDisabled && fg('platform_editor_element_drag_and_drop_ed_23873');
|
|
794
823
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
795
824
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
796
|
-
return fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
825
|
+
return editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
797
826
|
};
|
|
798
827
|
export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref8) {
|
|
799
828
|
var view = _ref8.view,
|
|
@@ -303,7 +303,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
303
303
|
testId: "editor-quick-insert-button",
|
|
304
304
|
type: "button",
|
|
305
305
|
"aria-label": formatMessage(messages.insert),
|
|
306
|
-
xcss: [fg('platform_editor_controls_sticky_controls') ?
|
|
306
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? stickyButtonStyles : buttonStyles, isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') ? disabledStyles : undefined],
|
|
307
307
|
onClick: handleQuickInsert,
|
|
308
308
|
onMouseDown: handleMouseDown,
|
|
309
309
|
isDisabled: !fg('platform_editor_controls_widget_visibility') && isTypeAheadOpen
|
|
@@ -9,3 +9,4 @@ export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolea
|
|
|
9
9
|
export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
|
|
10
10
|
height: string;
|
|
11
11
|
};
|
|
12
|
+
export declare const shouldMaskNodeControls: (nodeType: string, isTopLevelNode: boolean) => boolean;
|
|
@@ -22,6 +22,7 @@ export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
|
22
22
|
* so we allow for some leniency to capture them all. e.g. Table is depth 3.
|
|
23
23
|
*/
|
|
24
24
|
export declare const DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
|
|
25
|
+
export declare const STICKY_CONTROLS_TOP_MARGIN = 8;
|
|
25
26
|
export declare const QUICK_INSERT_HEIGHT = 24;
|
|
26
27
|
export declare const QUICK_INSERT_WIDTH = 24;
|
|
27
28
|
export declare const QUICK_INSERT_DIMENSIONS: {
|
|
@@ -9,3 +9,4 @@ export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolea
|
|
|
9
9
|
export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
|
|
10
10
|
height: string;
|
|
11
11
|
};
|
|
12
|
+
export declare const shouldMaskNodeControls: (nodeType: string, isTopLevelNode: boolean) => boolean;
|
|
@@ -22,6 +22,7 @@ export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
|
22
22
|
* so we allow for some leniency to capture them all. e.g. Table is depth 3.
|
|
23
23
|
*/
|
|
24
24
|
export declare const DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
|
|
25
|
+
export declare const STICKY_CONTROLS_TOP_MARGIN = 8;
|
|
25
26
|
export declare const QUICK_INSERT_HEIGHT = 24;
|
|
26
27
|
export declare const QUICK_INSERT_WIDTH = 24;
|
|
27
28
|
export declare const QUICK_INSERT_DIMENSIONS: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.1.0",
|
|
54
54
|
"@atlaskit/primitives": "^14.4.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^4.9.0",
|
|
57
57
|
"@atlaskit/tokens": "^4.7.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.0.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|