@atlaskit/editor-plugin-block-controls 31.0.1 → 31.0.2
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 +8 -0
- package/dist/cjs/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/cjs/pm-plugins/main.js +11 -13
- package/dist/cjs/ui/drag-handle.js +13 -1
- package/dist/cjs/ui/drop-target.js +3 -6
- package/dist/cjs/ui/quick-insert-button.js +17 -1
- package/dist/es2019/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/es2019/pm-plugins/main.js +11 -13
- package/dist/es2019/ui/consts.js +3 -3
- package/dist/es2019/ui/drag-handle.js +13 -1
- package/dist/es2019/ui/drop-target.js +3 -6
- package/dist/es2019/ui/quick-insert-button.js +17 -1
- package/dist/esm/pm-plugins/decorations-find-surrounding-nodes.js +2 -3
- package/dist/esm/pm-plugins/main.js +11 -13
- package/dist/esm/ui/consts.js +3 -3
- package/dist/esm/ui/drag-handle.js +13 -1
- package/dist/esm/ui/drop-target.js +3 -6
- package/dist/esm/ui/quick-insert-button.js +17 -1
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 31.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`18fdc5aa80389`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/18fdc5aa80389) -
|
|
8
|
+
Remove unused feature gate registrations and leftover names from past gate cleanups. No behaviour
|
|
9
|
+
change.
|
|
10
|
+
|
|
3
11
|
## 31.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findSurroundingNodes = void 0;
|
|
7
7
|
var IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
|
|
8
|
-
var
|
|
8
|
+
var BLOCK_LEAF_NODES = ['blockCard', 'rule', 'extension', 'syncBlock'];
|
|
9
9
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -19,10 +19,9 @@ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
|
19
19
|
*/
|
|
20
20
|
var _findSurroundingNodes = exports.findSurroundingNodes = function findSurroundingNodes(state, $pos, nodeType) {
|
|
21
21
|
var depth = $pos.depth;
|
|
22
|
-
var blockLeafNodeList = blockLeafNodeNext;
|
|
23
22
|
|
|
24
23
|
// special cases like hr rule here
|
|
25
|
-
if (
|
|
24
|
+
if (BLOCK_LEAF_NODES.includes(nodeType || '') || $pos.pos === 0) {
|
|
26
25
|
var _parent = $pos.node(depth);
|
|
27
26
|
var _node = $pos.nodeAfter;
|
|
28
27
|
var _index = $pos.index();
|
|
@@ -191,19 +191,19 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
191
191
|
var activeNode = currentState.activeNode,
|
|
192
192
|
decorations = currentState.decorations,
|
|
193
193
|
isResizerResizing = currentState.isResizerResizing,
|
|
194
|
-
multiSelectDnD = currentState.multiSelectDnD
|
|
194
|
+
multiSelectDnD = currentState.multiSelectDnD,
|
|
195
|
+
isMenuOpen = currentState.isMenuOpen,
|
|
196
|
+
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
195
197
|
var surfaceNodePositions = currentState.surfaceNodePositions;
|
|
196
198
|
var editorHeight = currentState.editorHeight,
|
|
197
199
|
editorWidthLeft = currentState.editorWidthLeft,
|
|
198
200
|
editorWidthRight = currentState.editorWidthRight,
|
|
199
201
|
isDragging = currentState.isDragging,
|
|
200
|
-
isMenuOpen = currentState.isMenuOpen,
|
|
201
202
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
202
203
|
menuTriggerByNode = currentState.menuTriggerByNode,
|
|
203
204
|
blockMenuOptions = currentState.blockMenuOptions,
|
|
204
205
|
isPMDragging = currentState.isPMDragging,
|
|
205
|
-
lastDragCancelled = currentState.lastDragCancelled
|
|
206
|
-
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
206
|
+
lastDragCancelled = currentState.lastDragCancelled;
|
|
207
207
|
var isActiveNodeDeleted = false;
|
|
208
208
|
var _getTrMetadata = (0, _transactions.getTrMetadata)(tr, flags),
|
|
209
209
|
from = _getTrMetadata.from,
|
|
@@ -863,7 +863,6 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
863
863
|
var _latestActiveNode13, _latestActiveNode14;
|
|
864
864
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && (0, _decorationsDragHandle.findHandleDec)(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
865
865
|
}
|
|
866
|
-
var isMenuOpenNew = isMenuOpen;
|
|
867
866
|
var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
868
867
|
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
869
868
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -871,7 +870,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
871
870
|
var mappedRoot = tr.mapping.mapResult((_menuTriggerByNode$ro = menuTriggerByNode.rootPos) !== null && _menuTriggerByNode$ro !== void 0 ? _menuTriggerByNode$ro : menuTriggerByNode.pos, 1);
|
|
872
871
|
if (mapped.deleted || mappedRoot.deleted || !((_newState$doc$nodeAt4 = newState.doc.nodeAt(mapped.pos)) !== null && _newState$doc$nodeAt4 !== void 0 && _newState$doc$nodeAt4.isBlock)) {
|
|
873
872
|
nextMenuTriggerByNode = undefined;
|
|
874
|
-
|
|
873
|
+
isMenuOpen = false;
|
|
875
874
|
} else {
|
|
876
875
|
nextMenuTriggerByNode = _objectSpread(_objectSpread({}, menuTriggerByNode), {}, {
|
|
877
876
|
pos: mapped.pos,
|
|
@@ -880,16 +879,15 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
880
879
|
}
|
|
881
880
|
}
|
|
882
881
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
883
|
-
|
|
882
|
+
isMenuOpen = false;
|
|
884
883
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
885
884
|
var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
886
|
-
|
|
885
|
+
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
887
886
|
}
|
|
888
|
-
var isSelectedViaDragHandleNew;
|
|
889
887
|
if (flags.toolbarFlagsEnabled) {
|
|
890
|
-
|
|
888
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
891
889
|
} else {
|
|
892
|
-
|
|
890
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && flags.toolbarFlagsEnabled && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
893
891
|
}
|
|
894
892
|
return {
|
|
895
893
|
decorations: decorations,
|
|
@@ -897,7 +895,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
897
895
|
activeNode: newActiveNode,
|
|
898
896
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
899
897
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
900
|
-
isMenuOpen:
|
|
898
|
+
isMenuOpen: isMenuOpen,
|
|
901
899
|
menuTriggerBy: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.anchorName) || menuTriggerBy,
|
|
902
900
|
menuTriggerByNode: nextMenuTriggerByNode,
|
|
903
901
|
blockMenuOptions: {
|
|
@@ -913,7 +911,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
913
911
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging,
|
|
914
912
|
multiSelectDnD: multiSelectDnD,
|
|
915
913
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
916
|
-
isSelectedViaDragHandle:
|
|
914
|
+
isSelectedViaDragHandle: isSelectedViaDragHandle
|
|
917
915
|
};
|
|
918
916
|
};
|
|
919
917
|
var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
@@ -212,6 +212,18 @@ var tooltipContainerStyles = (0, _react2.css)({
|
|
|
212
212
|
display: 'block',
|
|
213
213
|
zIndex: 100 // card = 100
|
|
214
214
|
});
|
|
215
|
+
var tooltipContainerStylesStickyHeaderWithMask = (0, _react2.css)({
|
|
216
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
217
|
+
top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
218
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
219
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
220
|
+
top: '0'
|
|
221
|
+
},
|
|
222
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
223
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
224
|
+
top: '0'
|
|
225
|
+
}
|
|
226
|
+
});
|
|
215
227
|
var tooltipContainerStylesImprovedStickyHeaderWithMask = (0, _react2.css)({
|
|
216
228
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
217
229
|
top: "".concat(_consts.STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
@@ -1076,7 +1088,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1076
1088
|
as: "span",
|
|
1077
1089
|
testId: "block-ctrl-drag-handle-container"
|
|
1078
1090
|
}, (0, _react2.jsx)("span", {
|
|
1079
|
-
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1091
|
+
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && ((0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMask : tooltipContainerStylesStickyHeaderWithMask), !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1080
1092
|
}, (0, _react2.jsx)(_Tooltip.default, {
|
|
1081
1093
|
content: tooltipContent,
|
|
1082
1094
|
ignoreTooltipPointerEvents: true,
|
|
@@ -73,10 +73,7 @@ var nestedDropZoneStyle = (0, _react2.css)({
|
|
|
73
73
|
right: '4px',
|
|
74
74
|
width: 'unset'
|
|
75
75
|
});
|
|
76
|
-
var
|
|
77
|
-
var getEnableDropZone = function getEnableDropZone() {
|
|
78
|
-
return enableDropZoneNext;
|
|
79
|
-
};
|
|
76
|
+
var ENABLE_DROP_ZONE = ['paragraph', 'mediaSingle', 'heading', 'codeBlock', 'decisionList', 'bulletList', 'orderedList', 'taskList', 'extension', 'blockCard', 'syncBlock'];
|
|
80
77
|
|
|
81
78
|
// This z index is used in container like layout
|
|
82
79
|
var fullHeightStyleAdjustZIndexStyle = (0, _react2.css)({
|
|
@@ -130,7 +127,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
130
127
|
var hoverZoneUpperStyle = (0, _react.useMemo)(function () {
|
|
131
128
|
var heightStyleOffset = "var(--editor-block-controls-drop-indicator-gap, 0)/2";
|
|
132
129
|
var transformOffset = "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0)");
|
|
133
|
-
var heightStyle = anchorName &&
|
|
130
|
+
var heightStyle = anchorName && ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '') ? (0, _anchorUtils.isAnchorSupported)() ? "calc(anchor-size(".concat(anchorName, " height)/2 + ").concat(heightStyleOffset, ")") : "calc(".concat(((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchorName)) || 0) / 2, "px + ").concat(heightStyleOffset, ")") : '4px';
|
|
134
131
|
var transform = position === 'upper' ? "translateY(calc(-100% + ".concat(transformOffset, "))") : "translateY(".concat(transformOffset, ")");
|
|
135
132
|
return (0, _react2.css)({
|
|
136
133
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
@@ -155,7 +152,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
155
152
|
var _anchorName = node ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : (0, _decorationsCommon.getNodeAnchor)(node) : '';
|
|
156
153
|
var top = 'unset';
|
|
157
154
|
if (_anchorName) {
|
|
158
|
-
var enabledDropZone =
|
|
155
|
+
var enabledDropZone = ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
159
156
|
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
160
157
|
top = enabledDropZone ? "calc(anchor(".concat(_anchorName, " 50%))") : "calc(anchor(".concat(_anchorName, " bottom) - 4px)");
|
|
161
158
|
} else if (anchorRectCache) {
|
|
@@ -90,6 +90,13 @@ var tooltipContainerStyles = (0, _react2.css)({
|
|
|
90
90
|
display: 'block',
|
|
91
91
|
zIndex: 'card'
|
|
92
92
|
});
|
|
93
|
+
var tooltipContainerStylesStickyHeader = (0, _react2.css)({
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
95
|
+
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
96
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
97
|
+
top: _table.tableControlsSpacing
|
|
98
|
+
}
|
|
99
|
+
});
|
|
93
100
|
var tooltipContainerImprovedStylesStickyHeader = (0, _react2.css)({
|
|
94
101
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
95
102
|
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
@@ -113,6 +120,15 @@ var tooltipContainerImprovedStylesStickyHeader = (0, _react2.css)({
|
|
|
113
120
|
}
|
|
114
121
|
});
|
|
115
122
|
|
|
123
|
+
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
124
|
+
var tooltipContainerStylesStickyHeaderWithMarksFix = (0, _react2.css)({
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
126
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-quick-insert-container]):has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
128
|
+
top: _table.tableControlsSpacing
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
116
132
|
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
117
133
|
var tooltipContainerStylesImprovedStickyHeaderWithMarksFix = (0, _react2.css)({
|
|
118
134
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
@@ -381,7 +397,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
381
397
|
,
|
|
382
398
|
xcss: [containerStaticStyles]
|
|
383
399
|
}, (0, _react2.jsx)("span", {
|
|
384
|
-
css: [tooltipContainerStyles, tooltipContainerImprovedStylesStickyHeader, tooltipContainerStylesImprovedStickyHeaderWithMarksFix]
|
|
400
|
+
css: [tooltipContainerStyles, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
385
401
|
}, tooltipPressable()));
|
|
386
402
|
};
|
|
387
403
|
var QuickInsertWithVisibility = exports.QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref6) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
|
|
2
|
-
const
|
|
2
|
+
const BLOCK_LEAF_NODES = ['blockCard', 'rule', 'extension', 'syncBlock'];
|
|
3
3
|
const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,10 +13,9 @@ const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
|
13
13
|
*/
|
|
14
14
|
export const findSurroundingNodes = (state, $pos, nodeType) => {
|
|
15
15
|
const depth = $pos.depth;
|
|
16
|
-
const blockLeafNodeList = blockLeafNodeNext;
|
|
17
16
|
|
|
18
17
|
// special cases like hr rule here
|
|
19
|
-
if (
|
|
18
|
+
if (BLOCK_LEAF_NODES.includes(nodeType || '') || $pos.pos === 0) {
|
|
20
19
|
const parent = $pos.node(depth);
|
|
21
20
|
const node = $pos.nodeAfter;
|
|
22
21
|
const index = $pos.index();
|
|
@@ -177,7 +177,9 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
177
177
|
activeNode,
|
|
178
178
|
decorations,
|
|
179
179
|
isResizerResizing,
|
|
180
|
-
multiSelectDnD
|
|
180
|
+
multiSelectDnD,
|
|
181
|
+
isMenuOpen,
|
|
182
|
+
isSelectedViaDragHandle
|
|
181
183
|
} = currentState;
|
|
182
184
|
const {
|
|
183
185
|
surfaceNodePositions
|
|
@@ -187,13 +189,11 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
187
189
|
editorWidthLeft,
|
|
188
190
|
editorWidthRight,
|
|
189
191
|
isDragging,
|
|
190
|
-
isMenuOpen,
|
|
191
192
|
menuTriggerBy,
|
|
192
193
|
menuTriggerByNode,
|
|
193
194
|
blockMenuOptions,
|
|
194
195
|
isPMDragging,
|
|
195
|
-
lastDragCancelled
|
|
196
|
-
isSelectedViaDragHandle
|
|
196
|
+
lastDragCancelled
|
|
197
197
|
} = currentState;
|
|
198
198
|
let isActiveNodeDeleted = false;
|
|
199
199
|
const {
|
|
@@ -765,7 +765,6 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
765
765
|
var _latestActiveNode13, _latestActiveNode14;
|
|
766
766
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !isExperimentEnabled('platform_editor_block_control_migration') && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
767
767
|
}
|
|
768
|
-
let isMenuOpenNew = isMenuOpen;
|
|
769
768
|
let nextMenuTriggerByNode = (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
770
769
|
if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
771
770
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -773,7 +772,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
773
772
|
const mappedRoot = tr.mapping.mapResult((_menuTriggerByNode$ro = menuTriggerByNode.rootPos) !== null && _menuTriggerByNode$ro !== void 0 ? _menuTriggerByNode$ro : menuTriggerByNode.pos, 1);
|
|
774
773
|
if (mapped.deleted || mappedRoot.deleted || !((_newState$doc$nodeAt4 = newState.doc.nodeAt(mapped.pos)) !== null && _newState$doc$nodeAt4 !== void 0 && _newState$doc$nodeAt4.isBlock)) {
|
|
775
774
|
nextMenuTriggerByNode = undefined;
|
|
776
|
-
|
|
775
|
+
isMenuOpen = false;
|
|
777
776
|
} else {
|
|
778
777
|
nextMenuTriggerByNode = {
|
|
779
778
|
...menuTriggerByNode,
|
|
@@ -783,16 +782,15 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
783
782
|
}
|
|
784
783
|
}
|
|
785
784
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
786
|
-
|
|
785
|
+
isMenuOpen = false;
|
|
787
786
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
788
787
|
const isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
789
|
-
|
|
788
|
+
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
790
789
|
}
|
|
791
|
-
let isSelectedViaDragHandleNew;
|
|
792
790
|
if (flags.toolbarFlagsEnabled) {
|
|
793
|
-
|
|
791
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
794
792
|
} else {
|
|
795
|
-
|
|
793
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && flags.toolbarFlagsEnabled && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
796
794
|
}
|
|
797
795
|
return {
|
|
798
796
|
decorations,
|
|
@@ -800,7 +798,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
800
798
|
activeNode: newActiveNode,
|
|
801
799
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
802
800
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
803
|
-
isMenuOpen
|
|
801
|
+
isMenuOpen,
|
|
804
802
|
menuTriggerBy: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.anchorName) || menuTriggerBy,
|
|
805
803
|
menuTriggerByNode: nextMenuTriggerByNode,
|
|
806
804
|
blockMenuOptions: {
|
|
@@ -816,7 +814,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
816
814
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging,
|
|
817
815
|
multiSelectDnD,
|
|
818
816
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
819
|
-
isSelectedViaDragHandle
|
|
817
|
+
isSelectedViaDragHandle
|
|
820
818
|
};
|
|
821
819
|
};
|
|
822
820
|
export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true) => {
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
|
|
2
|
-
import { breakoutResizableNodes
|
|
2
|
+
import { breakoutResizableNodes, getBreakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
4
4
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -56,7 +56,7 @@ export const dragHandleGap = (nodeType, parentNodeType) => {
|
|
|
56
56
|
if (isExperimentEnabled('platform_editor_lovability_resize_extensions')) {
|
|
57
57
|
breakoutResizableNodesList = getBreakoutResizableNodes();
|
|
58
58
|
} else {
|
|
59
|
-
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [...
|
|
59
|
+
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [...breakoutResizableNodes, 'rule', 'panel'] : breakoutResizableNodes;
|
|
60
60
|
}
|
|
61
61
|
if (breakoutResizableNodesList.includes(nodeType)) {
|
|
62
62
|
if (nodeType === 'layoutSection') {
|
|
@@ -80,7 +80,7 @@ export const rootElementGap = nodeType => {
|
|
|
80
80
|
if (isExperimentEnabled('platform_editor_lovability_resize_extensions')) {
|
|
81
81
|
breakoutResizableNodesList = getBreakoutResizableNodes();
|
|
82
82
|
} else {
|
|
83
|
-
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [...
|
|
83
|
+
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [...breakoutResizableNodes, 'rule', 'panel'] : breakoutResizableNodes;
|
|
84
84
|
}
|
|
85
85
|
if (nodeTypeExcludeList.includes(nodeType) || breakoutResizableNodesList.includes(nodeType)) {
|
|
86
86
|
if (nodeType === 'layoutSection') {
|
|
@@ -206,6 +206,18 @@ const tooltipContainerStyles = css({
|
|
|
206
206
|
display: 'block',
|
|
207
207
|
zIndex: 100 // card = 100
|
|
208
208
|
});
|
|
209
|
+
const tooltipContainerStylesStickyHeaderWithMask = css({
|
|
210
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
211
|
+
top: `${STICKY_CONTROLS_TOP_MARGIN}px`,
|
|
212
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
213
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
214
|
+
top: '0'
|
|
215
|
+
},
|
|
216
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
217
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
218
|
+
top: '0'
|
|
219
|
+
}
|
|
220
|
+
});
|
|
209
221
|
const tooltipContainerStylesImprovedStickyHeaderWithMask = css({
|
|
210
222
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
211
223
|
top: `${STICKY_CONTROLS_TOP_MARGIN}px`,
|
|
@@ -1058,7 +1070,7 @@ export const DragHandle = ({
|
|
|
1058
1070
|
as: "span",
|
|
1059
1071
|
testId: "block-ctrl-drag-handle-container"
|
|
1060
1072
|
}, jsx("span", {
|
|
1061
|
-
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1073
|
+
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMask : tooltipContainerStylesStickyHeaderWithMask), !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1062
1074
|
}, jsx(Tooltip, {
|
|
1063
1075
|
content: tooltipContent,
|
|
1064
1076
|
ignoreTooltipPointerEvents: true,
|
|
@@ -61,10 +61,7 @@ const nestedDropZoneStyle = css({
|
|
|
61
61
|
right: '4px',
|
|
62
62
|
width: 'unset'
|
|
63
63
|
});
|
|
64
|
-
const
|
|
65
|
-
const getEnableDropZone = () => {
|
|
66
|
-
return enableDropZoneNext;
|
|
67
|
-
};
|
|
64
|
+
const ENABLE_DROP_ZONE = ['paragraph', 'mediaSingle', 'heading', 'codeBlock', 'decisionList', 'bulletList', 'orderedList', 'taskList', 'extension', 'blockCard', 'syncBlock'];
|
|
68
65
|
|
|
69
66
|
// This z index is used in container like layout
|
|
70
67
|
const fullHeightStyleAdjustZIndexStyle = css({
|
|
@@ -116,7 +113,7 @@ const HoverZone = ({
|
|
|
116
113
|
const hoverZoneUpperStyle = useMemo(() => {
|
|
117
114
|
const heightStyleOffset = `var(--editor-block-controls-drop-indicator-gap, 0)/2`;
|
|
118
115
|
const transformOffset = `var(${EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET}, 0)`;
|
|
119
|
-
const heightStyle = anchorName &&
|
|
116
|
+
const heightStyle = anchorName && ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '') ? isAnchorSupported() ? `calc(anchor-size(${anchorName} height)/2 + ${heightStyleOffset})` : `calc(${((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchorName)) || 0) / 2}px + ${heightStyleOffset})` : '4px';
|
|
120
117
|
const transform = position === 'upper' ? `translateY(calc(-100% + ${transformOffset}))` : `translateY(${transformOffset})`;
|
|
121
118
|
return css({
|
|
122
119
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
@@ -141,7 +138,7 @@ const HoverZone = ({
|
|
|
141
138
|
const anchorName = node ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : getNodeAnchor(node) : '';
|
|
142
139
|
let top = 'unset';
|
|
143
140
|
if (anchorName) {
|
|
144
|
-
const enabledDropZone =
|
|
141
|
+
const enabledDropZone = ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
145
142
|
if (isAnchorSupported()) {
|
|
146
143
|
top = enabledDropZone ? `calc(anchor(${anchorName} 50%))` : `calc(anchor(${anchorName} bottom) - 4px)`;
|
|
147
144
|
} else if (anchorRectCache) {
|
|
@@ -80,6 +80,13 @@ const tooltipContainerStyles = css({
|
|
|
80
80
|
display: 'block',
|
|
81
81
|
zIndex: 'card'
|
|
82
82
|
});
|
|
83
|
+
const tooltipContainerStylesStickyHeader = css({
|
|
84
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
85
|
+
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
86
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
87
|
+
top: tableControlsSpacing
|
|
88
|
+
}
|
|
89
|
+
});
|
|
83
90
|
const tooltipContainerImprovedStylesStickyHeader = css({
|
|
84
91
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
85
92
|
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
@@ -103,6 +110,15 @@ const tooltipContainerImprovedStylesStickyHeader = css({
|
|
|
103
110
|
}
|
|
104
111
|
});
|
|
105
112
|
|
|
113
|
+
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
114
|
+
const tooltipContainerStylesStickyHeaderWithMarksFix = css({
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
116
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-quick-insert-container]):has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
118
|
+
top: tableControlsSpacing
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
106
122
|
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
107
123
|
const tooltipContainerStylesImprovedStickyHeaderWithMarksFix = css({
|
|
108
124
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
@@ -376,7 +392,7 @@ export const TypeAheadControl = ({
|
|
|
376
392
|
,
|
|
377
393
|
xcss: [containerStaticStyles]
|
|
378
394
|
}, jsx("span", {
|
|
379
|
-
css: [tooltipContainerStyles, tooltipContainerImprovedStylesStickyHeader, tooltipContainerStylesImprovedStickyHeaderWithMarksFix]
|
|
395
|
+
css: [tooltipContainerStyles, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
380
396
|
}, tooltipPressable()));
|
|
381
397
|
};
|
|
382
398
|
export const QuickInsertWithVisibility = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var IGNORE_NODES = ['tableRow', 'listItem', 'caption', 'media'];
|
|
2
|
-
var
|
|
2
|
+
var BLOCK_LEAF_NODES = ['blockCard', 'rule', 'extension', 'syncBlock'];
|
|
3
3
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,10 +13,9 @@ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
|
13
13
|
*/
|
|
14
14
|
var _findSurroundingNodes = function findSurroundingNodes(state, $pos, nodeType) {
|
|
15
15
|
var depth = $pos.depth;
|
|
16
|
-
var blockLeafNodeList = blockLeafNodeNext;
|
|
17
16
|
|
|
18
17
|
// special cases like hr rule here
|
|
19
|
-
if (
|
|
18
|
+
if (BLOCK_LEAF_NODES.includes(nodeType || '') || $pos.pos === 0) {
|
|
20
19
|
var _parent = $pos.node(depth);
|
|
21
20
|
var _node = $pos.nodeAfter;
|
|
22
21
|
var _index = $pos.index();
|
|
@@ -184,19 +184,19 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
184
184
|
var activeNode = currentState.activeNode,
|
|
185
185
|
decorations = currentState.decorations,
|
|
186
186
|
isResizerResizing = currentState.isResizerResizing,
|
|
187
|
-
multiSelectDnD = currentState.multiSelectDnD
|
|
187
|
+
multiSelectDnD = currentState.multiSelectDnD,
|
|
188
|
+
isMenuOpen = currentState.isMenuOpen,
|
|
189
|
+
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
188
190
|
var surfaceNodePositions = currentState.surfaceNodePositions;
|
|
189
191
|
var editorHeight = currentState.editorHeight,
|
|
190
192
|
editorWidthLeft = currentState.editorWidthLeft,
|
|
191
193
|
editorWidthRight = currentState.editorWidthRight,
|
|
192
194
|
isDragging = currentState.isDragging,
|
|
193
|
-
isMenuOpen = currentState.isMenuOpen,
|
|
194
195
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
195
196
|
menuTriggerByNode = currentState.menuTriggerByNode,
|
|
196
197
|
blockMenuOptions = currentState.blockMenuOptions,
|
|
197
198
|
isPMDragging = currentState.isPMDragging,
|
|
198
|
-
lastDragCancelled = currentState.lastDragCancelled
|
|
199
|
-
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
199
|
+
lastDragCancelled = currentState.lastDragCancelled;
|
|
200
200
|
var isActiveNodeDeleted = false;
|
|
201
201
|
var _getTrMetadata = getTrMetadata(tr, flags),
|
|
202
202
|
from = _getTrMetadata.from,
|
|
@@ -856,7 +856,6 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
856
856
|
var _latestActiveNode13, _latestActiveNode14;
|
|
857
857
|
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !isExperimentEnabled('platform_editor_block_control_migration') && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
858
858
|
}
|
|
859
|
-
var isMenuOpenNew = isMenuOpen;
|
|
860
859
|
var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
861
860
|
if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
862
861
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -864,7 +863,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
864
863
|
var mappedRoot = tr.mapping.mapResult((_menuTriggerByNode$ro = menuTriggerByNode.rootPos) !== null && _menuTriggerByNode$ro !== void 0 ? _menuTriggerByNode$ro : menuTriggerByNode.pos, 1);
|
|
865
864
|
if (mapped.deleted || mappedRoot.deleted || !((_newState$doc$nodeAt4 = newState.doc.nodeAt(mapped.pos)) !== null && _newState$doc$nodeAt4 !== void 0 && _newState$doc$nodeAt4.isBlock)) {
|
|
866
865
|
nextMenuTriggerByNode = undefined;
|
|
867
|
-
|
|
866
|
+
isMenuOpen = false;
|
|
868
867
|
} else {
|
|
869
868
|
nextMenuTriggerByNode = _objectSpread(_objectSpread({}, menuTriggerByNode), {}, {
|
|
870
869
|
pos: mapped.pos,
|
|
@@ -873,16 +872,15 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
873
872
|
}
|
|
874
873
|
}
|
|
875
874
|
if (meta !== null && meta !== void 0 && meta.closeMenu) {
|
|
876
|
-
|
|
875
|
+
isMenuOpen = false;
|
|
877
876
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
878
877
|
var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
879
|
-
|
|
878
|
+
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
880
879
|
}
|
|
881
|
-
var isSelectedViaDragHandleNew;
|
|
882
880
|
if (flags.toolbarFlagsEnabled) {
|
|
883
|
-
|
|
881
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
884
882
|
} else {
|
|
885
|
-
|
|
883
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && flags.toolbarFlagsEnabled && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
886
884
|
}
|
|
887
885
|
return {
|
|
888
886
|
decorations: decorations,
|
|
@@ -890,7 +888,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
890
888
|
activeNode: newActiveNode,
|
|
891
889
|
activeDropTargetNode: currentActiveDropTargetNode,
|
|
892
890
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
893
|
-
isMenuOpen:
|
|
891
|
+
isMenuOpen: isMenuOpen,
|
|
894
892
|
menuTriggerBy: (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.anchorName) || menuTriggerBy,
|
|
895
893
|
menuTriggerByNode: nextMenuTriggerByNode,
|
|
896
894
|
blockMenuOptions: {
|
|
@@ -906,7 +904,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
906
904
|
isPMDragging: (_meta$isPMDragging = meta === null || meta === void 0 ? void 0 : meta.isPMDragging) !== null && _meta$isPMDragging !== void 0 ? _meta$isPMDragging : isPMDragging,
|
|
907
905
|
multiSelectDnD: multiSelectDnD,
|
|
908
906
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
909
|
-
isSelectedViaDragHandle:
|
|
907
|
+
isSelectedViaDragHandle: isSelectedViaDragHandle
|
|
910
908
|
};
|
|
911
909
|
};
|
|
912
910
|
export { _apply as apply };
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
var _dropTargetMarginMap;
|
|
4
4
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
|
|
5
|
-
import { breakoutResizableNodes
|
|
5
|
+
import { breakoutResizableNodes, getBreakoutResizableNodes } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -61,7 +61,7 @@ export var dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
|
61
61
|
if (isExperimentEnabled('platform_editor_lovability_resize_extensions')) {
|
|
62
62
|
breakoutResizableNodesList = getBreakoutResizableNodes();
|
|
63
63
|
} else {
|
|
64
|
-
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [].concat(_toConsumableArray(
|
|
64
|
+
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [].concat(_toConsumableArray(breakoutResizableNodes), ['rule', 'panel']) : breakoutResizableNodes;
|
|
65
65
|
}
|
|
66
66
|
if (breakoutResizableNodesList.includes(nodeType)) {
|
|
67
67
|
if (nodeType === 'layoutSection') {
|
|
@@ -85,7 +85,7 @@ export var rootElementGap = function rootElementGap(nodeType) {
|
|
|
85
85
|
if (isExperimentEnabled('platform_editor_lovability_resize_extensions')) {
|
|
86
86
|
breakoutResizableNodesList = getBreakoutResizableNodes();
|
|
87
87
|
} else {
|
|
88
|
-
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [].concat(_toConsumableArray(
|
|
88
|
+
breakoutResizableNodesList = expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) ? [].concat(_toConsumableArray(breakoutResizableNodes), ['rule', 'panel']) : breakoutResizableNodes;
|
|
89
89
|
}
|
|
90
90
|
if (nodeTypeExcludeList.includes(nodeType) || breakoutResizableNodesList.includes(nodeType)) {
|
|
91
91
|
if (nodeType === 'layoutSection') {
|
|
@@ -208,6 +208,18 @@ var tooltipContainerStyles = css({
|
|
|
208
208
|
display: 'block',
|
|
209
209
|
zIndex: 100 // card = 100
|
|
210
210
|
});
|
|
211
|
+
var tooltipContainerStylesStickyHeaderWithMask = css({
|
|
212
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
213
|
+
top: "".concat(STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
214
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
215
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
216
|
+
top: '0'
|
|
217
|
+
},
|
|
218
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
219
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
220
|
+
top: '0'
|
|
221
|
+
}
|
|
222
|
+
});
|
|
211
223
|
var tooltipContainerStylesImprovedStickyHeaderWithMask = css({
|
|
212
224
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
213
225
|
top: "".concat(STICKY_CONTROLS_TOP_MARGIN, "px"),
|
|
@@ -1072,7 +1084,7 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
1072
1084
|
as: "span",
|
|
1073
1085
|
testId: "block-ctrl-drag-handle-container"
|
|
1074
1086
|
}, jsx("span", {
|
|
1075
|
-
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesImprovedStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1087
|
+
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMask : tooltipContainerStylesStickyHeaderWithMask), !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1076
1088
|
}, jsx(Tooltip, {
|
|
1077
1089
|
content: tooltipContent,
|
|
1078
1090
|
ignoreTooltipPointerEvents: true,
|
|
@@ -63,10 +63,7 @@ var nestedDropZoneStyle = css({
|
|
|
63
63
|
right: '4px',
|
|
64
64
|
width: 'unset'
|
|
65
65
|
});
|
|
66
|
-
var
|
|
67
|
-
var getEnableDropZone = function getEnableDropZone() {
|
|
68
|
-
return enableDropZoneNext;
|
|
69
|
-
};
|
|
66
|
+
var ENABLE_DROP_ZONE = ['paragraph', 'mediaSingle', 'heading', 'codeBlock', 'decisionList', 'bulletList', 'orderedList', 'taskList', 'extension', 'blockCard', 'syncBlock'];
|
|
70
67
|
|
|
71
68
|
// This z index is used in container like layout
|
|
72
69
|
var fullHeightStyleAdjustZIndexStyle = css({
|
|
@@ -120,7 +117,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
120
117
|
var hoverZoneUpperStyle = useMemo(function () {
|
|
121
118
|
var heightStyleOffset = "var(--editor-block-controls-drop-indicator-gap, 0)/2";
|
|
122
119
|
var transformOffset = "var(".concat(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, ", 0)");
|
|
123
|
-
var heightStyle = anchorName &&
|
|
120
|
+
var heightStyle = anchorName && ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '') ? isAnchorSupported() ? "calc(anchor-size(".concat(anchorName, " height)/2 + ").concat(heightStyleOffset, ")") : "calc(".concat(((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchorName)) || 0) / 2, "px + ").concat(heightStyleOffset, ")") : '4px';
|
|
124
121
|
var transform = position === 'upper' ? "translateY(calc(-100% + ".concat(transformOffset, "))") : "translateY(".concat(transformOffset, ")");
|
|
125
122
|
return css({
|
|
126
123
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
@@ -145,7 +142,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
145
142
|
var _anchorName = node ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : getNodeAnchor(node) : '';
|
|
146
143
|
var top = 'unset';
|
|
147
144
|
if (_anchorName) {
|
|
148
|
-
var enabledDropZone =
|
|
145
|
+
var enabledDropZone = ENABLE_DROP_ZONE.includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
149
146
|
if (isAnchorSupported()) {
|
|
150
147
|
top = enabledDropZone ? "calc(anchor(".concat(_anchorName, " 50%))") : "calc(anchor(".concat(_anchorName, " bottom) - 4px)");
|
|
151
148
|
} else if (anchorRectCache) {
|
|
@@ -84,6 +84,13 @@ var tooltipContainerStyles = css({
|
|
|
84
84
|
display: 'block',
|
|
85
85
|
zIndex: 'card'
|
|
86
86
|
});
|
|
87
|
+
var tooltipContainerStylesStickyHeader = css({
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
89
|
+
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
90
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
91
|
+
top: tableControlsSpacing
|
|
92
|
+
}
|
|
93
|
+
});
|
|
87
94
|
var tooltipContainerImprovedStylesStickyHeader = css({
|
|
88
95
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
89
96
|
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
@@ -107,6 +114,15 @@ var tooltipContainerImprovedStylesStickyHeader = css({
|
|
|
107
114
|
}
|
|
108
115
|
});
|
|
109
116
|
|
|
117
|
+
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
118
|
+
var tooltipContainerStylesStickyHeaderWithMarksFix = css({
|
|
119
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
120
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-quick-insert-container]):has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
122
|
+
top: tableControlsSpacing
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
110
126
|
// We need this to work around adjacent breakout marks wrapping the controls widget decorations
|
|
111
127
|
var tooltipContainerStylesImprovedStickyHeaderWithMarksFix = css({
|
|
112
128
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
@@ -375,7 +391,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref2) {
|
|
|
375
391
|
,
|
|
376
392
|
xcss: [containerStaticStyles]
|
|
377
393
|
}, jsx("span", {
|
|
378
|
-
css: [tooltipContainerStyles, tooltipContainerImprovedStylesStickyHeader, tooltipContainerStylesImprovedStickyHeaderWithMarksFix]
|
|
394
|
+
css: [tooltipContainerStyles, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
379
395
|
}, tooltipPressable()));
|
|
380
396
|
};
|
|
381
397
|
export var QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref6) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "31.0.
|
|
3
|
+
"version": "31.0.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -82,9 +82,6 @@
|
|
|
82
82
|
"platform_editor_ease_of_use_metrics": {
|
|
83
83
|
"type": "boolean"
|
|
84
84
|
},
|
|
85
|
-
"platform_editor_content_mode_button_mvp": {
|
|
86
|
-
"type": "boolean"
|
|
87
|
-
},
|
|
88
85
|
"platform_editor_maui_jira_updates": {
|
|
89
86
|
"type": "boolean"
|
|
90
87
|
},
|