@atlaskit/editor-plugin-block-controls 20.0.2 → 20.1.0
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 +25 -0
- package/dist/cjs/blockControlsPlugin.js +53 -17
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/editor-commands/show-drag-handle.js +17 -5
- package/dist/cjs/pm-plugins/decorations-anchor.js +3 -2
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +3 -2
- package/dist/cjs/pm-plugins/decorations-drop-target.js +3 -2
- package/dist/cjs/pm-plugins/decorations-surface-anchor.js +72 -0
- package/dist/cjs/pm-plugins/handle-mouse-down.js +2 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +4 -3
- package/dist/cjs/pm-plugins/handle-sparse-mouse-over.js +125 -0
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
- package/dist/cjs/pm-plugins/main.js +68 -56
- package/dist/cjs/pm-plugins/sparse-surfaces.js +49 -0
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +1 -1
- package/dist/cjs/pm-plugins/utils/sparse-surface-candidates.js +419 -0
- package/dist/cjs/pm-plugins/utils/sparse-surfaces-mapping.js +108 -0
- package/dist/cjs/pm-plugins/utils/sparse-surfaces-state.js +53 -0
- package/dist/cjs/pm-plugins/utils/sparse-surfaces-view.js +134 -0
- package/dist/cjs/pm-plugins/utils/surface-viewport.js +223 -0
- package/dist/cjs/pm-plugins/utils/transactions.js +5 -0
- package/dist/cjs/pm-plugins/utils/validation.js +1 -1
- package/dist/cjs/ui/block-controls-left-surfaces.js +31 -25
- package/dist/cjs/ui/block-controls-right-surfaces.js +31 -25
- package/dist/cjs/ui/block-controls-surface-context.js +1 -0
- package/dist/cjs/ui/block-controls-surface-drag-handle-registration.js +6 -7
- package/dist/cjs/ui/block-controls-surface-drag-handle.js +6 -2
- package/dist/cjs/ui/consts.js +1 -1
- package/dist/cjs/ui/drag-handle.js +6 -4
- package/dist/cjs/ui/drop-target-layout.js +3 -2
- package/dist/cjs/ui/drop-target.js +4 -3
- package/dist/cjs/ui/global-styles.js +70 -28
- package/dist/cjs/ui/inline-drop-target.js +6 -5
- package/dist/cjs/ui/use-block-controls-surface-drag-source.js +1 -1
- package/dist/cjs/ui/utils/anchor-name.js +2 -1
- package/dist/cjs/ui/utils/dom-attr-name.js +3 -2
- package/dist/cjs/ui/utils/get-surface-placement.js +2 -1
- package/dist/cjs/ui/utils/partition-components-by-persistence.js +1 -1
- package/dist/cjs/ui/visibility-container.js +1 -1
- package/dist/es2019/blockControlsPlugin.js +42 -8
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/editor-commands/show-drag-handle.js +14 -2
- package/dist/es2019/entry-points/block-decoration-utils-anchor-name.js +1 -0
- package/dist/es2019/entry-points/block-decoration-utils-consts.js +1 -0
- package/dist/es2019/entry-points/block-decoration-utils-dom-attr-name.js +1 -0
- package/dist/es2019/entry-points/block-decoration-utils-drag-handle-positions.js +1 -0
- package/dist/es2019/entry-points/block-decoration-utils-visibility-container.js +1 -0
- package/dist/es2019/entry-points/block-decoration-utils-widget-positions.js +1 -0
- package/dist/es2019/entry-points/blockControlsPlugin.js +1 -0
- package/dist/es2019/pm-plugins/decorations-anchor.js +3 -2
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +3 -2
- package/dist/es2019/pm-plugins/decorations-drop-target.js +3 -2
- package/dist/es2019/pm-plugins/decorations-surface-anchor.js +56 -0
- package/dist/es2019/pm-plugins/handle-mouse-down.js +2 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +4 -3
- package/dist/es2019/pm-plugins/handle-sparse-mouse-over.js +116 -0
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
- package/dist/es2019/pm-plugins/main.js +72 -56
- package/dist/es2019/pm-plugins/sparse-surfaces.js +37 -0
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +1 -1
- package/dist/es2019/pm-plugins/utils/sparse-surface-candidates.js +305 -0
- package/dist/es2019/pm-plugins/utils/sparse-surfaces-mapping.js +78 -0
- package/dist/es2019/pm-plugins/utils/sparse-surfaces-state.js +39 -0
- package/dist/es2019/pm-plugins/utils/sparse-surfaces-view.js +121 -0
- package/dist/es2019/pm-plugins/utils/surface-viewport.js +192 -0
- package/dist/es2019/pm-plugins/utils/transactions.js +5 -0
- package/dist/es2019/pm-plugins/utils/update-selection.js +1 -2
- package/dist/es2019/pm-plugins/utils/validation.js +1 -1
- package/dist/es2019/ui/block-controls-left-surfaces.js +21 -14
- package/dist/es2019/ui/block-controls-right-surfaces.js +21 -14
- package/dist/es2019/ui/block-controls-surface-context.js +1 -0
- package/dist/es2019/ui/block-controls-surface-drag-handle-registration.js +4 -5
- package/dist/es2019/ui/block-controls-surface-drag-handle.js +6 -2
- package/dist/es2019/ui/consts.js +1 -1
- package/dist/es2019/ui/drag-handle.js +6 -4
- package/dist/es2019/ui/drop-target-layout.js +3 -2
- package/dist/es2019/ui/drop-target.js +4 -3
- package/dist/es2019/ui/global-styles.js +68 -29
- package/dist/es2019/ui/inline-drop-target.js +7 -5
- package/dist/es2019/ui/use-block-controls-surface-drag-source.js +1 -1
- package/dist/es2019/ui/utils/anchor-name.js +2 -1
- package/dist/es2019/ui/utils/dom-attr-name.js +3 -2
- package/dist/es2019/ui/utils/get-surface-placement.js +2 -1
- package/dist/es2019/ui/utils/partition-components-by-persistence.js +1 -1
- package/dist/es2019/ui/visibility-container.js +1 -1
- package/dist/esm/blockControlsPlugin.js +53 -17
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/editor-commands/show-drag-handle.js +17 -5
- package/dist/esm/entry-points/block-decoration-utils-anchor-name.js +1 -0
- package/dist/esm/entry-points/block-decoration-utils-consts.js +1 -0
- package/dist/esm/entry-points/block-decoration-utils-dom-attr-name.js +1 -0
- package/dist/esm/entry-points/block-decoration-utils-drag-handle-positions.js +1 -0
- package/dist/esm/entry-points/block-decoration-utils-visibility-container.js +1 -0
- package/dist/esm/entry-points/block-decoration-utils-widget-positions.js +1 -0
- package/dist/esm/entry-points/blockControlsPlugin.js +1 -0
- package/dist/esm/pm-plugins/decorations-anchor.js +3 -2
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +3 -2
- package/dist/esm/pm-plugins/decorations-drop-target.js +3 -2
- package/dist/esm/pm-plugins/decorations-surface-anchor.js +65 -0
- package/dist/esm/pm-plugins/handle-mouse-down.js +2 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +4 -3
- package/dist/esm/pm-plugins/handle-sparse-mouse-over.js +119 -0
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +1 -1
- package/dist/esm/pm-plugins/main.js +68 -56
- package/dist/esm/pm-plugins/sparse-surfaces.js +43 -0
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +1 -1
- package/dist/esm/pm-plugins/utils/sparse-surface-candidates.js +413 -0
- package/dist/esm/pm-plugins/utils/sparse-surfaces-mapping.js +101 -0
- package/dist/esm/pm-plugins/utils/sparse-surfaces-state.js +46 -0
- package/dist/esm/pm-plugins/utils/sparse-surfaces-view.js +127 -0
- package/dist/esm/pm-plugins/utils/surface-viewport.js +217 -0
- package/dist/esm/pm-plugins/utils/transactions.js +5 -0
- package/dist/esm/pm-plugins/utils/update-selection.js +1 -2
- package/dist/esm/pm-plugins/utils/validation.js +1 -1
- package/dist/esm/ui/block-controls-left-surfaces.js +33 -27
- package/dist/esm/ui/block-controls-right-surfaces.js +33 -27
- package/dist/esm/ui/block-controls-surface-context.js +1 -0
- package/dist/esm/ui/block-controls-surface-drag-handle-registration.js +7 -8
- package/dist/esm/ui/block-controls-surface-drag-handle.js +6 -2
- package/dist/esm/ui/consts.js +1 -1
- package/dist/esm/ui/drag-handle.js +6 -4
- package/dist/esm/ui/drop-target-layout.js +3 -2
- package/dist/esm/ui/drop-target.js +4 -3
- package/dist/esm/ui/global-styles.js +71 -29
- package/dist/esm/ui/inline-drop-target.js +7 -5
- package/dist/esm/ui/use-block-controls-surface-drag-source.js +1 -1
- package/dist/esm/ui/utils/anchor-name.js +2 -1
- package/dist/esm/ui/utils/dom-attr-name.js +3 -2
- package/dist/esm/ui/utils/get-surface-placement.js +2 -1
- package/dist/esm/ui/utils/partition-components-by-persistence.js +1 -1
- package/dist/esm/ui/visibility-container.js +1 -1
- package/dist/types/blockControlsPluginType.d.ts +11 -4
- package/dist/types/pm-plugins/decorations-surface-anchor.d.ts +22 -0
- package/dist/types/pm-plugins/handle-sparse-mouse-over.d.ts +5 -0
- package/dist/types/pm-plugins/main.d.ts +2 -9
- package/dist/types/pm-plugins/sparse-surfaces.d.ts +8 -0
- package/dist/types/pm-plugins/utils/sparse-surface-candidates.d.ts +89 -0
- package/dist/types/pm-plugins/utils/sparse-surfaces-mapping.d.ts +20 -0
- package/dist/types/pm-plugins/utils/sparse-surfaces-state.d.ts +27 -0
- package/dist/types/pm-plugins/utils/sparse-surfaces-view.d.ts +15 -0
- package/dist/types/pm-plugins/utils/surface-viewport.d.ts +10 -0
- package/dist/types/ui/inline-drop-target.d.ts +4 -0
- package/dist/types/ui/utils/get-surface-placement.d.ts +3 -2
- package/package.json +7 -7
- package/dist/cjs/pm-plugins/utils/surface-node-positions.js +0 -100
- package/dist/es2019/pm-plugins/utils/surface-node-positions.js +0 -78
- package/dist/esm/pm-plugins/utils/surface-node-positions.js +0 -93
- package/dist/types/pm-plugins/utils/surface-node-positions.d.ts +0 -14
|
@@ -14,7 +14,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
var getBlockControlsSurfaceDragHandleComponents = exports.getBlockControlsSurfaceDragHandleComponents = function getBlockControlsSurfaceDragHandleComponents(_ref) {
|
|
16
16
|
var api = _ref.api;
|
|
17
|
-
return [{
|
|
17
|
+
return [_objectSpread(_objectSpread({
|
|
18
18
|
component: function component(_ref2) {
|
|
19
19
|
var surfaceContext = _ref2.surfaceContext;
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement(_blockControlsSurfaceDragHandle.BlockControlsSurfaceDragHandle, {
|
|
@@ -26,12 +26,11 @@ var getBlockControlsSurfaceDragHandleComponents = exports.getBlockControlsSurfac
|
|
|
26
26
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
27
27
|
surfaceContext = _ref3.surfaceContext;
|
|
28
28
|
var context = surfaceContext === null || surfaceContext === void 0 ? void 0 : surfaceContext.get(_blockControlUiContext.BLOCK_CONTROL_UI_CONTEXT);
|
|
29
|
-
return !(context !== null && context !== void 0 && context.activeNode) || context.targetNode.pos !== context.activeNode.pos;
|
|
30
|
-
}
|
|
31
|
-
|
|
29
|
+
return !(context !== null && context !== void 0 && context.activeNode) || context.targetNode.pos !== context.activeNode.pos || context.activeControlKey !== undefined && context.activeControlKey !== _surfaceKeys.BLOCK_CONTROLS_DRAG_HANDLE.key;
|
|
30
|
+
}
|
|
31
|
+
}, _surfaceKeys.BLOCK_CONTROLS_DRAG_HANDLE), {}, {
|
|
32
32
|
parents: [_objectSpread(_objectSpread({}, _surfaceKeys.BLOCK_CONTROLS_LEFT_GROUP), {}, {
|
|
33
33
|
rank: 200
|
|
34
|
-
})]
|
|
35
|
-
|
|
36
|
-
}];
|
|
34
|
+
})]
|
|
35
|
+
})];
|
|
37
36
|
};
|
|
@@ -124,7 +124,11 @@ var BlockControlsSurfaceDragHandle = exports.BlockControlsSurfaceDragHandle = fu
|
|
|
124
124
|
return !isTopLevelNode || $anchor.depth > _consts.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH;
|
|
125
125
|
}, [api, isLayoutColumn, isShiftDown, isTopLevelNode, view]);
|
|
126
126
|
var getAnchorName = (0, _react.useCallback)(function () {
|
|
127
|
-
var _ref2, _ref3, _dom$getAttribute, _dom$closest;
|
|
127
|
+
var _api$blockControls$sh2, _ref2, _ref3, _dom$getAttribute, _dom$closest;
|
|
128
|
+
var surfaceAnchor = posRef.current === undefined ? undefined : api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 || (_api$blockControls$sh2 = _api$blockControls$sh2.surfaceAnchors) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.get(posRef.current);
|
|
129
|
+
if (surfaceAnchor) {
|
|
130
|
+
return surfaceAnchor;
|
|
131
|
+
}
|
|
128
132
|
if (activeNodeAnchorName) {
|
|
129
133
|
return activeNodeAnchorName;
|
|
130
134
|
}
|
|
@@ -138,7 +142,7 @@ var BlockControlsSurfaceDragHandle = exports.BlockControlsSurfaceDragHandle = fu
|
|
|
138
142
|
}
|
|
139
143
|
var anchorAttrName = (0, _domAttrName.getAnchorAttrName)();
|
|
140
144
|
return (_ref2 = (_ref3 = (_dom$getAttribute = dom.getAttribute(anchorAttrName)) !== null && _dom$getAttribute !== void 0 ? _dom$getAttribute : dom.getAttribute(_domAttrName.NODE_ANCHOR_ATTR_NAME)) !== null && _ref3 !== void 0 ? _ref3 : (_dom$closest = dom.closest("[".concat(anchorAttrName, "]"))) === null || _dom$closest === void 0 ? void 0 : _dom$closest.getAttribute(anchorAttrName)) !== null && _ref2 !== void 0 ? _ref2 : '';
|
|
141
|
-
}, [activeNodeAnchorName, view]);
|
|
145
|
+
}, [activeNodeAnchorName, api, view]);
|
|
142
146
|
(0, _react.useLayoutEffect)(function () {
|
|
143
147
|
var element = buttonRef.current;
|
|
144
148
|
if (!view || !element) {
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -11,9 +11,9 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
13
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
14
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
16
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
17
17
|
var _dropTargetMarginMap;
|
|
18
18
|
var ACTIVE_DRAG_HANDLE_ATTR = exports.ACTIVE_DRAG_HANDLE_ATTR = 'data-active-drag-handle';
|
|
19
19
|
var ACTIVE_QUICK_INSERT_ATTR = exports.ACTIVE_QUICK_INSERT_ATTR = 'data-active-quick-insert';
|
|
@@ -26,9 +26,9 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
26
26
|
var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
|
|
27
27
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/utils/set-custom-native-drag-preview");
|
|
28
28
|
var _primitives = require("@atlaskit/primitives");
|
|
29
|
+
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
29
30
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
31
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
31
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
32
32
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
33
33
|
var _decorationsCommon = require("../pm-plugins/decorations-common");
|
|
34
34
|
var _main = require("../pm-plugins/main");
|
|
@@ -740,10 +740,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
740
740
|
});
|
|
741
741
|
}, [anchorName, api, getPos, nodeType, start, view]);
|
|
742
742
|
var calculatePositionOld = (0, _react.useCallback)(function () {
|
|
743
|
+
var _$pos$nodeAfter;
|
|
743
744
|
var pos = getPos();
|
|
744
|
-
var $pos =
|
|
745
|
+
var $pos = typeof pos === 'number' ? view.state.doc.resolve(pos) : undefined;
|
|
745
746
|
var parentPos = $pos && $pos.depth ? $pos.before() : undefined;
|
|
746
747
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
748
|
+
var nodeTypeWithLevel = $pos !== null && $pos !== void 0 && (_$pos$nodeAfter = $pos.nodeAfter) !== null && _$pos$nodeAfter !== void 0 && _$pos$nodeAfter.isBlock ? (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) : nodeType;
|
|
747
749
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
748
750
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
749
751
|
var safeAnchorName = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _anchorName.refreshAnchorName)({
|
|
@@ -801,13 +803,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
801
803
|
var bottom = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, _consts2.ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME) : {};
|
|
802
804
|
return _objectSpread({
|
|
803
805
|
left: isEdgeCase ? "calc(".concat(anchorStart, " + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((".concat(anchorRight, " + ").concat(anchorLeft, ")/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(".concat(anchorStart, " - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
804
|
-
top: (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(".concat(anchorTop, " - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(".concat(anchorStart, " + ").concat((0, _consts2.topPositionAdjustment)(
|
|
806
|
+
top: (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(".concat(anchorTop, " - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(".concat(anchorStart, " + ").concat((0, _consts2.topPositionAdjustment)(nodeTypeWithLevel, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
805
807
|
}, bottom);
|
|
806
808
|
}
|
|
807
809
|
var height = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
808
810
|
return _objectSpread({
|
|
809
811
|
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),
|
|
810
|
-
top: (0, _dragHandlePositions.getTopPosition)(dom,
|
|
812
|
+
top: (0, _dragHandlePositions.getTopPosition)(dom, nodeTypeWithLevel)
|
|
811
813
|
}, height);
|
|
812
814
|
}, [anchorName, getPos, view, nodeType, blockCardWidth, macroInteractionUpdates, anchorRectCache, isTopLevelNodeValue, isLayoutColumn]);
|
|
813
815
|
var isReliableAnchorEnabled = (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true);
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
14
15
|
var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
|
|
15
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -128,7 +129,7 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
128
129
|
}, isDraggedOver ? (0, _react2.jsx)(_box.DropIndicator, {
|
|
129
130
|
edge: "right",
|
|
130
131
|
gap: "-".concat(DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH, "px")
|
|
131
|
-
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) && (0, _react2.jsx)("div", {
|
|
132
|
+
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _react2.jsx)("div", {
|
|
132
133
|
"data-testid": "block-ctrl-drop-hint",
|
|
133
134
|
css: dropTargetLayoutHintStyle
|
|
134
135
|
}));
|
|
@@ -243,7 +244,7 @@ var DropTargetLayoutNativeAnchorSupport = exports.DropTargetLayoutNativeAnchorSu
|
|
|
243
244
|
}, isDraggedOver ? (0, _react2.jsx)(_box.DropIndicator, {
|
|
244
245
|
edge: "right",
|
|
245
246
|
gap: "-".concat(DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH, "px")
|
|
246
|
-
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) && (0, _react2.jsx)("div", {
|
|
247
|
+
}) : (isActiveAnchor || (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _react2.jsx)("div", {
|
|
247
248
|
"data-testid": "block-ctrl-drop-hint",
|
|
248
249
|
css: dropTargetLayoutHintStyle
|
|
249
250
|
}));
|
|
@@ -12,11 +12,12 @@ var _react = require("react");
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
14
14
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
16
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
16
17
|
var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
|
|
17
18
|
var _constants = require("@atlaskit/theme/constants");
|
|
18
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
19
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
21
|
var _decorationsCommon = require("../pm-plugins/decorations-common");
|
|
21
22
|
var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
|
|
22
23
|
var _anchorUtils = require("../pm-plugins/utils/anchor-utils");
|
|
@@ -95,7 +96,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
95
96
|
var ref = (0, _react.useRef)(null);
|
|
96
97
|
var isRemainingheight = dropTargetStyle === 'remainingHeight';
|
|
97
98
|
var anchorName = (0, _react.useMemo)(function () {
|
|
98
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
99
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
99
100
|
if (node && typeof pos === 'number') {
|
|
100
101
|
var posOffset = position === 'upper' ? -node.nodeSize : 0;
|
|
101
102
|
return (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos + posOffset)) || '';
|
|
@@ -149,7 +150,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
149
150
|
// only apply upper drop zone
|
|
150
151
|
if (isRemainingheight && position === 'upper') {
|
|
151
152
|
// previous node
|
|
152
|
-
var _anchorName = node ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos || -1)) || '' : (0, _decorationsCommon.getNodeAnchor)(node) : '';
|
|
153
|
+
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) : '';
|
|
153
154
|
var top = 'unset';
|
|
154
155
|
if (_anchorName) {
|
|
155
156
|
var enabledDropZone = getEnableDropZone().includes((node === null || node === void 0 ? void 0 : node.type.name) || '');
|
|
@@ -13,8 +13,8 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
|
13
13
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
15
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
16
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
16
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
17
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
18
|
var _consts = require("./consts");
|
|
19
19
|
var _domAttrName = require("./utils/dom-attr-name");
|
|
20
20
|
/**
|
|
@@ -376,17 +376,70 @@ var staticControlsAnchorStyles = (0, _react.css)({
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
});
|
|
379
|
+
var sparseSurfaceAnchorName = 'var(--block-controls-surface-anchor-name)';
|
|
379
380
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
*/
|
|
384
|
-
var surfaceAnchorStyles = (0, _react.css)({
|
|
381
|
+
// Inner node-view boxes own the visible geometry for these nodes. The root arm keeps a sparse
|
|
382
|
+
// marker useful when a node view has not mounted its inner box yet.
|
|
383
|
+
var sparseSurfaceAnchorStyles = (0, _react.css)({
|
|
385
384
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
386
|
-
'.ProseMirror':
|
|
387
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-
|
|
388
|
-
|
|
389
|
-
|
|
385
|
+
'.ProseMirror': {
|
|
386
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
387
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="blockCard"]:has(.datasourceView-content-inner-wrap) .datasourceView-content-inner-wrap': {
|
|
388
|
+
anchorName: sparseSurfaceAnchorName
|
|
389
|
+
},
|
|
390
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
391
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="blockCard"]:not(:has(.datasourceView-content-inner-wrap))': {
|
|
392
|
+
anchorName: sparseSurfaceAnchorName
|
|
393
|
+
},
|
|
394
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
395
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="bodiedExtension"]:has(.extension-container[data-layout]) .extension-container[data-layout]': {
|
|
396
|
+
anchorName: sparseSurfaceAnchorName
|
|
397
|
+
},
|
|
398
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
399
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="bodiedExtension"]:not(:has(.extension-container[data-layout]))': {
|
|
400
|
+
anchorName: sparseSurfaceAnchorName
|
|
401
|
+
},
|
|
402
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
403
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="embedCard"]:has(.rich-media-item) .rich-media-item': {
|
|
404
|
+
anchorName: sparseSurfaceAnchorName
|
|
405
|
+
},
|
|
406
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
407
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="embedCard"]:not(:has(.rich-media-item))': {
|
|
408
|
+
anchorName: sparseSurfaceAnchorName
|
|
409
|
+
},
|
|
410
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
411
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="extension"]:has(.extension-container[data-layout]) .extension-container[data-layout]': {
|
|
412
|
+
anchorName: sparseSurfaceAnchorName
|
|
413
|
+
},
|
|
414
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
415
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="extension"]:not(:has(.extension-container[data-layout]))': {
|
|
416
|
+
anchorName: sparseSurfaceAnchorName
|
|
417
|
+
},
|
|
418
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
419
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="mediaSingle"]:has(.resizer-item) .resizer-item': {
|
|
420
|
+
anchorName: sparseSurfaceAnchorName
|
|
421
|
+
},
|
|
422
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
423
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="mediaSingle"]:not(:has(.resizer-item))': {
|
|
424
|
+
anchorName: sparseSurfaceAnchorName
|
|
425
|
+
},
|
|
426
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
427
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="multiBodiedExtension"]:has(.extension-container[data-layout]) .extension-container[data-layout]': {
|
|
428
|
+
anchorName: sparseSurfaceAnchorName
|
|
429
|
+
},
|
|
430
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
431
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="multiBodiedExtension"]:not(:has(.extension-container[data-layout]))': {
|
|
432
|
+
anchorName: sparseSurfaceAnchorName
|
|
433
|
+
},
|
|
434
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
435
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="table"]:has(.resizer-item) .resizer-item': {
|
|
436
|
+
anchorName: sparseSurfaceAnchorName
|
|
437
|
+
},
|
|
438
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
439
|
+
'[data-block-controls-surface-anchor][data-block-controls-surface-node-type="table"]:not(:has(.resizer-item))': {
|
|
440
|
+
anchorName: sparseSurfaceAnchorName
|
|
441
|
+
}
|
|
442
|
+
}
|
|
390
443
|
});
|
|
391
444
|
|
|
392
445
|
// Styles applied to nodes with anchors when dragging
|
|
@@ -426,33 +479,22 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
426
479
|
};
|
|
427
480
|
}),
|
|
428
481
|
isDraggingFromState = _useSharedPluginState.isDragging;
|
|
429
|
-
var
|
|
482
|
+
var sparseSurfacesEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration');
|
|
483
|
+
var isDragging = sparseSurfacesEnabled || (0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true) ? isDraggingFromState : false;
|
|
430
484
|
var shouldRenderAnchors = (0, _styles.isCSSAnchorSupported)() && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
431
|
-
|
|
432
|
-
// The surfaces anchor to blocks they render against rather than only to the hovered one, so they
|
|
433
|
-
// need a name on every node. Added alongside whichever conditional rule applies rather than
|
|
434
|
-
// replacing it: this one matches only non-active nodes, so the two sets are disjoint.
|
|
435
|
-
//
|
|
436
|
-
// The migration check is what scopes this. Unlike the surfaces, this component renders for every
|
|
437
|
-
// editor, so without it the rule would name anchors on documents that have no surface to anchor.
|
|
438
|
-
var shouldRenderSurfaceAnchors =
|
|
439
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning -- browser capability, not a flag: an anchor name is meaningless where `anchor()` cannot resolve
|
|
440
|
-
Boolean((0, _styles.isCSSAnchorSupported)()) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration');
|
|
485
|
+
var sparseSurfaceAnchorsEnabled = Boolean((0, _styles.isCSSAnchorSupported)()) && sparseSurfacesEnabled;
|
|
441
486
|
var toolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
442
487
|
return (0, _react.jsx)(_react.Global
|
|
443
488
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
444
489
|
, {
|
|
445
|
-
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
490
|
+
styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
446
491
|
exposure: true
|
|
447
|
-
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
492
|
+
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
448
493
|
// platform_editor_controls note: this allows drag handles to render on empty lines
|
|
449
|
-
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone, (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
494
|
+
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && (((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) && (0, _expValEquals.expValEquals)('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
450
495
|
// dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
|
|
451
496
|
// staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
|
|
452
497
|
// shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
|
|
453
|
-
shouldRenderAnchors ? isDragging ? dragAnchorStyles : staticControlsAnchorStyles : false : shouldRenderAnchors && (isDragging ? dragAnchorStyles : dragHandlerAnchorStyles),
|
|
454
|
-
// Last so that, at equal specificity, the surfaces' own anchor names are the ones that
|
|
455
|
-
// stand. It cannot overlap the active-node rules above, which this selector excludes.
|
|
456
|
-
shouldRenderSurfaceAnchors && surfaceAnchorStyles]
|
|
498
|
+
shouldRenderAnchors ? isDragging ? dragAnchorStyles : staticControlsAnchorStyles : false : shouldRenderAnchors && (isDragging ? dragAnchorStyles : dragHandlerAnchorStyles), sparseSurfaceAnchorsEnabled && sparseSurfaceAnchorStyles]
|
|
457
499
|
});
|
|
458
500
|
};
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
14
15
|
var _elementAdapter = require("@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter");
|
|
15
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -100,7 +101,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
100
101
|
isDraggedOver = _useState2[0],
|
|
101
102
|
setIsDraggedOver = _useState2[1];
|
|
102
103
|
var anchorName = (0, _react.useMemo)(function () {
|
|
103
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
104
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
104
105
|
var _getPos;
|
|
105
106
|
return nextNode ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode, (_getPos = getPos()) !== null && _getPos !== void 0 ? _getPos : -1)) || '' : '';
|
|
106
107
|
}
|
|
@@ -133,7 +134,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
133
134
|
innerContainerWidth = "calc(var(--ak-editor--line-length) * ".concat(percentageWidth, ")");
|
|
134
135
|
}
|
|
135
136
|
} else if (nextNode.type.name === 'table' && nextNode.firstChild) {
|
|
136
|
-
var tableWidthAnchor = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? typeof nextNodePos === 'number' ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '' : '' : (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
137
|
+
var tableWidthAnchor = (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') ? typeof nextNodePos === 'number' ? (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '' : '' : (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
137
138
|
var isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
|
|
138
139
|
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
139
140
|
innerContainerWidth = isNumberColumnEnabled ? "calc(anchor-size(".concat(tableWidthAnchor, " width) + ").concat(TABLE_NUMBERED_COLUMN_WIDTH, "px)") : "anchor-size(".concat(tableWidthAnchor, " width)");
|
|
@@ -146,7 +147,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
146
147
|
innerContainerWidth = "min(".concat(nextNode.attrs.width, "px, ").concat(innerContainerWidth, ")");
|
|
147
148
|
}
|
|
148
149
|
} else if (nextNode.type.name === 'mediaSingle' && nextNode.firstChild) {
|
|
149
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
150
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
150
151
|
var _nextNode$firstChild;
|
|
151
152
|
// check pos is a number
|
|
152
153
|
if (typeof nextNodePos === 'number' && ((_nextNode$firstChild = nextNode.firstChild) === null || _nextNode$firstChild === void 0 ? void 0 : _nextNode$firstChild.type.name) === 'media') {
|
|
@@ -161,7 +162,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
161
162
|
var heightTargetAnchorName = targetAnchorName;
|
|
162
163
|
if (nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
163
164
|
if (isLeftPosition) {
|
|
164
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
165
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
165
166
|
if (typeof nextNodePos === 'number') {
|
|
166
167
|
heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.firstChild, nextNodePos + 1)) || '';
|
|
167
168
|
} else {
|
|
@@ -171,7 +172,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
171
172
|
heightTargetAnchorName = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
172
173
|
}
|
|
173
174
|
} else {
|
|
174
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
175
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
175
176
|
if (typeof nextNodePos === 'number') {
|
|
176
177
|
var lastNodeStartPos = nextNode.content.size - nextNode.lastChild.nodeSize;
|
|
177
178
|
heightTargetAnchorName = (api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(nextNode.lastChild, lastNodeStartPos + 1)) || '';
|
|
@@ -15,8 +15,8 @@ var _activeAnchorTracker = require("../pm-plugins/utils/active-anchor-tracker");
|
|
|
15
15
|
var _analytics2 = require("../pm-plugins/utils/analytics");
|
|
16
16
|
var _collapsedHeading = require("../pm-plugins/utils/collapsed-heading");
|
|
17
17
|
var _getSelection = require("../pm-plugins/utils/getSelection");
|
|
18
|
-
var _dragPreview = require("./drag-preview");
|
|
19
18
|
var _blockControlsSurfaceDragHandleUtils = require("./block-controls-surface-drag-handle-utils");
|
|
19
|
+
var _dragPreview = require("./drag-preview");
|
|
20
20
|
var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
|
|
21
21
|
/**
|
|
22
22
|
* Registry surface drag source. This intentionally duplicates the stable widget handle's drag
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.refreshAnchorName = void 0;
|
|
7
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
7
8
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var _decorationsAnchor = require("../../pm-plugins/decorations-anchor");
|
|
9
10
|
var _main = require("../../pm-plugins/main");
|
|
@@ -16,7 +17,7 @@ var refreshAnchorName = exports.refreshAnchorName = function refreshAnchorName(_
|
|
|
16
17
|
view = _ref.view,
|
|
17
18
|
anchorName = _ref.anchorName;
|
|
18
19
|
var newAnchorName = anchorName || '';
|
|
19
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
20
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
20
21
|
return newAnchorName;
|
|
21
22
|
}
|
|
22
23
|
var pos = getPos();
|
|
@@ -4,17 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getTypeNameFromDom = exports.getTypeNameAttrName = exports.getAnchorAttrName = exports.NODE_NODE_TYPE_ATTR_NAME = exports.NODE_ANCHOR_ATTR_NAME = void 0;
|
|
7
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
7
8
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var NODE_ANCHOR_ATTR_NAME = exports.NODE_ANCHOR_ATTR_NAME = 'data-node-anchor';
|
|
9
10
|
var NODE_NODE_TYPE_ATTR_NAME = exports.NODE_NODE_TYPE_ATTR_NAME = 'data-prosemirror-node-name';
|
|
10
11
|
var getAnchorAttrName = exports.getAnchorAttrName = function getAnchorAttrName() {
|
|
11
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
12
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
12
13
|
return NODE_ANCHOR_ATTR_NAME;
|
|
13
14
|
}
|
|
14
15
|
return 'data-drag-handler-anchor-name';
|
|
15
16
|
};
|
|
16
17
|
var getTypeNameAttrName = exports.getTypeNameAttrName = function getTypeNameAttrName() {
|
|
17
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
18
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
18
19
|
return NODE_NODE_TYPE_ATTR_NAME;
|
|
19
20
|
}
|
|
20
21
|
return 'data-drag-handler-node-type';
|
|
@@ -105,6 +105,7 @@ var INVALID_ANCHOR_FALLBACK_TOP = "-".concat(INVALID_ANCHOR_OFFSCREEN_PX, "px");
|
|
|
105
105
|
var INVALID_ANCHOR_FALLBACK_BOTTOM = "".concat(INVALID_ANCHOR_OFFSCREEN_PX, "px");
|
|
106
106
|
var getAnchoredSurfacePlacement = exports.getAnchoredSurfacePlacement = function getAnchoredSurfacePlacement(_ref3) {
|
|
107
107
|
var anchorName = _ref3.anchorName,
|
|
108
|
+
layout = _ref3.layout,
|
|
108
109
|
nodeType = _ref3.nodeType,
|
|
109
110
|
nodeTypeWithLevel = _ref3.nodeTypeWithLevel,
|
|
110
111
|
parentNodeType = _ref3.parentNodeType,
|
|
@@ -131,7 +132,7 @@ var getAnchoredSurfacePlacement = exports.getAnchoredSurfacePlacement = function
|
|
|
131
132
|
} : {}), {}, {
|
|
132
133
|
left: side === 'right' ? "calc(anchor(".concat(anchorName, " right) + ").concat(gap, "px)") : "anchor(".concat(anchorName, " left)"),
|
|
133
134
|
positionAnchor: anchorName,
|
|
134
|
-
top: "calc(anchor(".concat(anchorName, " top, ").concat(INVALID_ANCHOR_FALLBACK_TOP, ") + ").concat((0, _consts.topPositionAdjustment)(nodeTypeWithLevel), "px)"),
|
|
135
|
+
top: "calc(anchor(".concat(anchorName, " top, ").concat(INVALID_ANCHOR_FALLBACK_TOP, ") + ").concat((0, _consts.topPositionAdjustment)(nodeTypeWithLevel, layout), "px)"),
|
|
135
136
|
// The left side grows away from the node without knowing its own width, so it pulls itself
|
|
136
137
|
// back past its own box and the gap. The right side grows into the margin, so the gap is
|
|
137
138
|
// already folded into `left` above.
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.partitionComponentsByPersistence = void 0;
|
|
7
7
|
var _blockControlUiContext = require("@atlaskit/editor-common/block-controls/block-control-ui-context");
|
|
8
|
-
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
9
8
|
var _createSurfaceContext = require("@atlaskit/editor-ui-control-model/create-surface-context");
|
|
9
|
+
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
10
10
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
11
11
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
12
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -13,8 +13,8 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
15
|
var _primitives = require("@atlaskit/primitives");
|
|
16
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
16
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
17
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
19
|
/**
|
|
20
20
|
* @jsxRuntime classic
|
|
@@ -14,12 +14,14 @@ import { moveNode } from './editor-commands/move-node';
|
|
|
14
14
|
import { moveNodeWithBlockMenu } from './editor-commands/move-node-with-block-menu';
|
|
15
15
|
import { moveToLayout } from './editor-commands/move-to-layout';
|
|
16
16
|
import { canMoveNodeUpOrDown } from './editor-commands/utils/move-node-utils';
|
|
17
|
+
import { getNodeTypeWithLevel } from './pm-plugins/decorations-common';
|
|
17
18
|
import { firstNodeDecPlugin } from './pm-plugins/first-node-dec-plugin';
|
|
18
19
|
import { createInteractionTrackingPlugin, interactionTrackingPluginKey } from './pm-plugins/interaction-tracking/pm-plugin';
|
|
19
20
|
import { createPlugin, key } from './pm-plugins/main';
|
|
20
21
|
import { startPreservingSelection, stopPreservingSelection } from './pm-plugins/selection-preservation/editor-commands';
|
|
21
22
|
import { selectionPreservationPluginKey } from './pm-plugins/selection-preservation/plugin-key';
|
|
22
23
|
import { createSelectionPreservationPlugin } from './pm-plugins/selection-preservation/pm-plugin';
|
|
24
|
+
import { createSparseSurfacesPlugin, sparseSurfacesKey } from './pm-plugins/sparse-surfaces';
|
|
23
25
|
import { expandAndUpdateSelection } from './pm-plugins/utils/expand-and-update-selection';
|
|
24
26
|
import { selectNode } from './pm-plugins/utils/getSelection';
|
|
25
27
|
import { BlockControlsLeftSurfaces } from './ui/block-controls-left-surfaces';
|
|
@@ -36,7 +38,6 @@ export const blockControlsPlugin = ({
|
|
|
36
38
|
const rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
|
|
37
39
|
const quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
|
|
38
40
|
const registryBlockControlsEnabled = isExperimentEnabled('platform_editor_block_control_migration');
|
|
39
|
-
const legacyBlockControlsEnabled = !registryBlockControlsEnabled;
|
|
40
41
|
if (registryBlockControlsEnabled) {
|
|
41
42
|
var _api$uiControlRegistr, _api$uiControlRegistr2;
|
|
42
43
|
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register([BLOCK_CONTROLS_LEFT_SURFACE, {
|
|
@@ -140,8 +141,14 @@ export const blockControlsPlugin = ({
|
|
|
140
141
|
plugin: ({
|
|
141
142
|
getIntl,
|
|
142
143
|
nodeViewPortalProviderAPI
|
|
143
|
-
}) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled &&
|
|
144
|
+
}) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, registryBlockControlsEnabled ? [] : nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled && !registryBlockControlsEnabled)
|
|
144
145
|
}];
|
|
146
|
+
if (registryBlockControlsEnabled) {
|
|
147
|
+
pmPlugins.push({
|
|
148
|
+
name: 'blockControlsSparseSurfaces',
|
|
149
|
+
plugin: () => createSparseSurfacesPlugin(api)
|
|
150
|
+
});
|
|
151
|
+
}
|
|
145
152
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
146
153
|
pmPlugins.push({
|
|
147
154
|
name: 'blockControlsInteractionTrackingPlugin',
|
|
@@ -158,7 +165,7 @@ export const blockControlsPlugin = ({
|
|
|
158
165
|
// Not registered under the registry migration: the decoration puts an inline
|
|
159
166
|
// `margin-top: 0` on the first document node, which fights features that render their own
|
|
160
167
|
// content above it — a leading show-diff widget is left flush against the node below.
|
|
161
|
-
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) &&
|
|
168
|
+
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && !registryBlockControlsEnabled) {
|
|
162
169
|
pmPlugins.push({
|
|
163
170
|
name: 'firstNodeDec',
|
|
164
171
|
plugin: firstNodeDecPlugin
|
|
@@ -205,10 +212,34 @@ export const blockControlsPlugin = ({
|
|
|
205
212
|
});
|
|
206
213
|
return tr;
|
|
207
214
|
},
|
|
215
|
+
showControlAtPosition: (pos, control, options) => ({
|
|
216
|
+
tr
|
|
217
|
+
}) => {
|
|
218
|
+
const node = tr.doc.nodeAt(pos);
|
|
219
|
+
if (!node) {
|
|
220
|
+
return tr;
|
|
221
|
+
}
|
|
222
|
+
const anchorName = api === null || api === void 0 ? void 0 : api.core.actions.getAnchorIdForNode(node, pos);
|
|
223
|
+
if (!anchorName) {
|
|
224
|
+
return tr;
|
|
225
|
+
}
|
|
226
|
+
const currMeta = tr.getMeta(key);
|
|
227
|
+
tr.setMeta(key, {
|
|
228
|
+
...currMeta,
|
|
229
|
+
activeNode: {
|
|
230
|
+
pos,
|
|
231
|
+
anchorName,
|
|
232
|
+
controlKey: control.key,
|
|
233
|
+
nodeType: getNodeTypeWithLevel(node),
|
|
234
|
+
handleOptions: options
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return tr;
|
|
238
|
+
},
|
|
208
239
|
toggleBlockMenu: options => ({
|
|
209
240
|
tr
|
|
210
241
|
}) => {
|
|
211
|
-
var _api$userIntent, _api$userIntent$share, _api$blockControls2, _api$blockControls2$s, _options$anchorName, _api$blockControls3, _api$blockControls3$s;
|
|
242
|
+
var _api$userIntent, _api$userIntent$share, _api$blockControls2, _api$blockControls2$s, _options$triggerByNod, _options$anchorName, _api$blockControls3, _api$blockControls3$s;
|
|
212
243
|
const currMeta = tr.getMeta(key);
|
|
213
244
|
const currentUserIntent = api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent;
|
|
214
245
|
const isMenuCurrentlyOpen = api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$s = _api$blockControls2.sharedState.currentState()) === null || _api$blockControls2$s === void 0 ? void 0 : _api$blockControls2$s.isMenuOpen;
|
|
@@ -234,8 +265,9 @@ export const blockControlsPlugin = ({
|
|
|
234
265
|
return tr;
|
|
235
266
|
}
|
|
236
267
|
|
|
237
|
-
// Do not open
|
|
238
|
-
|
|
268
|
+
// Do not open the block menu for layout columns. Anchor resolution can lag behind
|
|
269
|
+
// a migrated surface click, so prefer the explicit node metadata when available.
|
|
270
|
+
if ((options === null || options === void 0 ? void 0 : (_options$triggerByNod = options.triggerByNode) === null || _options$triggerByNod === void 0 ? void 0 : _options$triggerByNod.nodeType) === 'layoutColumn' || options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
239
271
|
if (currentUserIntent === 'blockMenuOpen') {
|
|
240
272
|
var _api$userIntent3;
|
|
241
273
|
api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
@@ -436,8 +468,10 @@ export const blockControlsPlugin = ({
|
|
|
436
468
|
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
|
|
437
469
|
};
|
|
438
470
|
if (registryBlockControlsEnabled) {
|
|
439
|
-
|
|
440
|
-
sharedState.surfaceNodePositions =
|
|
471
|
+
const surfaces = sparseSurfacesKey.getState(editorState);
|
|
472
|
+
sharedState.surfaceNodePositions = surfaces === null || surfaces === void 0 ? void 0 : surfaces.candidates.positions;
|
|
473
|
+
sharedState.surfaceAnchors = surfaces === null || surfaces === void 0 ? void 0 : surfaces.anchors;
|
|
474
|
+
sharedState.surfaceActiveNodes = surfaces === null || surfaces === void 0 ? void 0 : surfaces.activeNodesByPosition;
|
|
441
475
|
}
|
|
442
476
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
443
477
|
var _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4;
|
|
@@ -13,8 +13,8 @@ import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestTo
|
|
|
13
13
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
17
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
18
|
import { key } from '../pm-plugins/main';
|
|
19
19
|
import { attachMoveNodeAnalytics, getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
20
20
|
import { isCollapsedHeading, updateCollapsedHeadingAfterMove } from '../pm-plugins/utils/collapsed-heading';
|