@atlaskit/editor-plugin-block-controls 9.1.13 → 9.1.16
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 +23 -0
- package/dist/cjs/editor-commands/move-node.js +1 -2
- package/dist/cjs/pm-plugins/decorations-anchor.js +3 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +39 -6
- package/dist/cjs/ui/consts.js +6 -2
- package/dist/cjs/ui/drag-handle.js +2 -2
- package/dist/es2019/editor-commands/move-node.js +1 -2
- package/dist/es2019/pm-plugins/decorations-anchor.js +3 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +39 -6
- package/dist/es2019/ui/consts.js +5 -1
- package/dist/es2019/ui/drag-handle.js +2 -2
- package/dist/esm/editor-commands/move-node.js +1 -2
- package/dist/esm/pm-plugins/decorations-anchor.js +3 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +39 -6
- package/dist/esm/ui/consts.js +5 -1
- package/dist/esm/ui/drag-handle.js +2 -2
- package/dist/types/ui/consts.d.ts +2 -1
- package/dist/types-ts4.5/ui/consts.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 9.1.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.1.15
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`0eb1eed9871ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0eb1eed9871ef) -
|
|
14
|
+
[ux] [EDITOR-6279] update the block menu experiment's code check to also check jira. this fixes
|
|
15
|
+
the transform behaviour on a moved node in jira.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 9.1.14
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`7acd06d35fdd1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7acd06d35fdd1) -
|
|
23
|
+
Editor-5933: Fixed unable to create synced block from embed
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 9.1.13
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -19,7 +19,6 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
19
19
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
20
20
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
21
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
23
22
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
23
|
var _main = require("../pm-plugins/main");
|
|
25
24
|
var _analytics2 = require("../pm-plugins/utils/analytics");
|
|
@@ -333,7 +332,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
333
332
|
tr: tr
|
|
334
333
|
});
|
|
335
334
|
}
|
|
336
|
-
var preservedSelection = (0,
|
|
335
|
+
var preservedSelection = (0, _experiments.editorExperiment)('platform_editor_block_menu', true) ? api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection : undefined;
|
|
337
336
|
if (preservedSelection) {
|
|
338
337
|
var $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
|
|
339
338
|
var expandedRange = $from.blockRange(preservedSelection.$to);
|
|
@@ -46,7 +46,9 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
46
46
|
if (isLegacyContentMacroExtension) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
-
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout)
|
|
49
|
+
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout) && !(0, _experiments.editorExperiment)('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
50
|
+
exposure: true
|
|
51
|
+
}) ? true : ignore_nodes.includes(node.type.name);
|
|
50
52
|
};
|
|
51
53
|
var getPositionBeforeNodeAtPos = function getPositionBeforeNodeAtPos(state, pos) {
|
|
52
54
|
if (pos <= 0 || pos >= state.doc.nodeSize - 2) {
|
|
@@ -142,6 +142,36 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
142
142
|
rootElement = parentElement;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
+
|
|
146
|
+
// When platform_editor_fix_selection_wrapped_media_embed is enabled, a wrapped mediaSingle/embedCard and the
|
|
147
|
+
// paragraph(s) it floats next to both have anchor decorations. If the hovered rootElement
|
|
148
|
+
// is a paragraph whose adjacent DOM sibling is a wrapped mediaSingle/embedCard with an
|
|
149
|
+
// anchor, redirect the handle to the media node so only one handle shows (ED-26959).
|
|
150
|
+
// We check previousElementSibling (wrap-left: media precedes text in DOM) and
|
|
151
|
+
// nextElementSibling (wrap-right: media follows text in DOM).
|
|
152
|
+
// This must happen before anchorName is read so the correct node's handle is shown.
|
|
153
|
+
if ((0, _experiments.editorExperiment)('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
154
|
+
exposure: true
|
|
155
|
+
})) {
|
|
156
|
+
var _rootNodeType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
|
|
157
|
+
if (_rootNodeType === 'paragraph') {
|
|
158
|
+
var isWrappedMediaEmbedSibling = function isWrappedMediaEmbedSibling(sibling) {
|
|
159
|
+
if (!sibling || !sibling.getAttribute((0, _domAttrName.getAnchorAttrName)())) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
var siblingType = isNativeAnchorSupported ? (0, _domAttrName.getTypeNameFromDom)(sibling) : sibling.getAttribute('data-drag-handler-node-type');
|
|
163
|
+
var siblingLayout = sibling.getAttribute('layout') || '';
|
|
164
|
+
return (siblingType === 'mediaSingle' || siblingType === 'embedCard') && ['wrap-left', 'wrap-right'].includes(siblingLayout);
|
|
165
|
+
};
|
|
166
|
+
var prevSibling = rootElement.previousElementSibling;
|
|
167
|
+
var nextSibling = rootElement.nextElementSibling;
|
|
168
|
+
if (prevSibling && isWrappedMediaEmbedSibling(prevSibling)) {
|
|
169
|
+
rootElement = prevSibling;
|
|
170
|
+
} else if (nextSibling && isWrappedMediaEmbedSibling(nextSibling)) {
|
|
171
|
+
rootElement = nextSibling;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
145
175
|
var anchorName;
|
|
146
176
|
if ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
147
177
|
anchorName = rootElement.getAttribute((0, _domAttrName.getAnchorAttrName)());
|
|
@@ -160,12 +190,15 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
160
190
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
161
191
|
return false;
|
|
162
192
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
193
|
+
if (!(0, _experiments.editorExperiment)('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
194
|
+
exposure: true
|
|
195
|
+
})) {
|
|
196
|
+
// We want to exclude handles from showing for wrapped nodes
|
|
197
|
+
// TODO: ED-26959 - We should be able remove these check if we decided to
|
|
198
|
+
// go we not decoration for wrapped image solution.
|
|
199
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
169
202
|
}
|
|
170
203
|
var parentRootElement = rootElement.parentElement;
|
|
171
204
|
var pos;
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_SYNCED_BLOCK_GAP = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
|
|
7
|
+
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER = exports.STICKY_CONTROLS_TOP_MARGIN = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = exports.DRAG_HANDLE_SYNCED_BLOCK_GAP = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -29,6 +29,7 @@ var DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
|
29
29
|
var DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
30
30
|
var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
31
31
|
var DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = 0;
|
|
32
|
+
var DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = exports.DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = 8;
|
|
32
33
|
|
|
33
34
|
/** We only want to shift-select nodes that are at the top level of a document.
|
|
34
35
|
* This is because funky things happen when selecting inside of tableCells, but we
|
|
@@ -106,13 +107,16 @@ var getNestedNodeLeftPaddingMargin = exports.getNestedNodeLeftPaddingMargin = fu
|
|
|
106
107
|
return "".concat(_styles.DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
|
-
var topPositionAdjustment = exports.topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
110
|
+
var topPositionAdjustment = exports.topPositionAdjustment = function topPositionAdjustment(nodeType, layout) {
|
|
110
111
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
111
112
|
switch (nodeType) {
|
|
112
113
|
case 'layoutSection':
|
|
113
114
|
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
114
115
|
}
|
|
115
116
|
}
|
|
117
|
+
if ((nodeType === 'mediaSingle' || nodeType === 'embedCard') && layout && ['wrap-left', 'wrap-right'].includes(layout) && (0, _experiments.editorExperiment)('platform_editor_fix_selection_wrapped_media_embed', true)) {
|
|
118
|
+
return DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT;
|
|
119
|
+
}
|
|
116
120
|
switch (nodeType) {
|
|
117
121
|
case 'rule':
|
|
118
122
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
@@ -855,7 +855,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
855
855
|
var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
856
856
|
return _objectSpread({
|
|
857
857
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
858
|
-
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start)+ ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
858
|
+
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
859
859
|
}, bottom);
|
|
860
860
|
}
|
|
861
861
|
var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -901,7 +901,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
901
901
|
var bottom = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlBottomCSSValue)(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
902
902
|
return _objectSpread({
|
|
903
903
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(_consts2.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts2.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
904
|
-
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
904
|
+
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(_styles.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat((0, _consts2.topPositionAdjustment)((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && (0, _decorationsCommon.getNodeTypeWithLevel)($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
905
905
|
}, bottom);
|
|
906
906
|
}
|
|
907
907
|
var height = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _dragHandlePositions.getControlHeightCSSValue)((0, _dragHandlePositions.getNodeHeight)(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(_consts2.DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -11,7 +11,6 @@ import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
|
11
11
|
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
15
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
15
|
import { key } from '../pm-plugins/main';
|
|
17
16
|
import { attachMoveNodeAnalytics, getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
@@ -334,7 +333,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
334
333
|
tr
|
|
335
334
|
});
|
|
336
335
|
}
|
|
337
|
-
const preservedSelection =
|
|
336
|
+
const preservedSelection = editorExperiment('platform_editor_block_menu', true) ? api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection : undefined;
|
|
338
337
|
if (preservedSelection) {
|
|
339
338
|
const $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
|
|
340
339
|
const expandedRange = $from.blockRange(preservedSelection.$to);
|
|
@@ -38,7 +38,9 @@ const shouldIgnoreNode = (node, ignore_nodes, depth, parent) => {
|
|
|
38
38
|
if (isLegacyContentMacroExtension) {
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
|
-
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout)
|
|
41
|
+
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout) && !editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
42
|
+
exposure: true
|
|
43
|
+
}) ? true : ignore_nodes.includes(node.type.name);
|
|
42
44
|
};
|
|
43
45
|
const getPositionBeforeNodeAtPos = (state, pos) => {
|
|
44
46
|
if (pos <= 0 || pos >= state.doc.nodeSize - 2) {
|
|
@@ -134,6 +134,36 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
134
134
|
rootElement = parentElement;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
|
|
138
|
+
// When platform_editor_fix_selection_wrapped_media_embed is enabled, a wrapped mediaSingle/embedCard and the
|
|
139
|
+
// paragraph(s) it floats next to both have anchor decorations. If the hovered rootElement
|
|
140
|
+
// is a paragraph whose adjacent DOM sibling is a wrapped mediaSingle/embedCard with an
|
|
141
|
+
// anchor, redirect the handle to the media node so only one handle shows (ED-26959).
|
|
142
|
+
// We check previousElementSibling (wrap-left: media precedes text in DOM) and
|
|
143
|
+
// nextElementSibling (wrap-right: media follows text in DOM).
|
|
144
|
+
// This must happen before anchorName is read so the correct node's handle is shown.
|
|
145
|
+
if (editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
146
|
+
exposure: true
|
|
147
|
+
})) {
|
|
148
|
+
const rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
|
|
149
|
+
if (rootNodeType === 'paragraph') {
|
|
150
|
+
const isWrappedMediaEmbedSibling = sibling => {
|
|
151
|
+
if (!sibling || !sibling.getAttribute(getAnchorAttrName())) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const siblingType = isNativeAnchorSupported ? getTypeNameFromDom(sibling) : sibling.getAttribute('data-drag-handler-node-type');
|
|
155
|
+
const siblingLayout = sibling.getAttribute('layout') || '';
|
|
156
|
+
return (siblingType === 'mediaSingle' || siblingType === 'embedCard') && ['wrap-left', 'wrap-right'].includes(siblingLayout);
|
|
157
|
+
};
|
|
158
|
+
const prevSibling = rootElement.previousElementSibling;
|
|
159
|
+
const nextSibling = rootElement.nextElementSibling;
|
|
160
|
+
if (prevSibling && isWrappedMediaEmbedSibling(prevSibling)) {
|
|
161
|
+
rootElement = prevSibling;
|
|
162
|
+
} else if (nextSibling && isWrappedMediaEmbedSibling(nextSibling)) {
|
|
163
|
+
rootElement = nextSibling;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
137
167
|
let anchorName;
|
|
138
168
|
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
139
169
|
anchorName = rootElement.getAttribute(getAnchorAttrName());
|
|
@@ -152,12 +182,15 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
152
182
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
153
183
|
return false;
|
|
154
184
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
185
|
+
if (!editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
186
|
+
exposure: true
|
|
187
|
+
})) {
|
|
188
|
+
// We want to exclude handles from showing for wrapped nodes
|
|
189
|
+
// TODO: ED-26959 - We should be able remove these check if we decided to
|
|
190
|
+
// go we not decoration for wrapped image solution.
|
|
191
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
161
194
|
}
|
|
162
195
|
const parentRootElement = rootElement.parentElement;
|
|
163
196
|
let pos;
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -20,6 +20,7 @@ export const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
|
20
20
|
export const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
21
21
|
export const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
22
22
|
export const DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = 0;
|
|
23
|
+
export const DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = 8;
|
|
23
24
|
|
|
24
25
|
/** We only want to shift-select nodes that are at the top level of a document.
|
|
25
26
|
* This is because funky things happen when selecting inside of tableCells, but we
|
|
@@ -97,13 +98,16 @@ export const getNestedNodeLeftPaddingMargin = nodeType => {
|
|
|
97
98
|
return `${DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP}px`;
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
|
-
export const topPositionAdjustment = nodeType => {
|
|
101
|
+
export const topPositionAdjustment = (nodeType, layout) => {
|
|
101
102
|
if (editorExperiment('advanced_layouts', true)) {
|
|
102
103
|
switch (nodeType) {
|
|
103
104
|
case 'layoutSection':
|
|
104
105
|
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
105
106
|
}
|
|
106
107
|
}
|
|
108
|
+
if ((nodeType === 'mediaSingle' || nodeType === 'embedCard') && layout && ['wrap-left', 'wrap-right'].includes(layout) && editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true)) {
|
|
109
|
+
return DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT;
|
|
110
|
+
}
|
|
107
111
|
switch (nodeType) {
|
|
108
112
|
case 'rule':
|
|
109
113
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
@@ -833,7 +833,7 @@ export const DragHandle = ({
|
|
|
833
833
|
const bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
834
834
|
return {
|
|
835
835
|
left: isEdgeCase ? `calc(anchor(${safeAnchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((anchor(${safeAnchorName} right) + anchor(${safeAnchorName} left))/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(anchor(${safeAnchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
836
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start)+ ${topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType)}px)`,
|
|
836
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || '')}px)`,
|
|
837
837
|
...bottom
|
|
838
838
|
};
|
|
839
839
|
}
|
|
@@ -881,7 +881,7 @@ export const DragHandle = ({
|
|
|
881
881
|
const bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
882
882
|
return {
|
|
883
883
|
left: isEdgeCase ? `calc(anchor(${safeAnchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((anchor(${safeAnchorName} right) + anchor(${safeAnchorName} left))/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(anchor(${safeAnchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
884
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType)}px)`,
|
|
884
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || '')}px)`,
|
|
885
885
|
...bottom
|
|
886
886
|
};
|
|
887
887
|
}
|
|
@@ -14,7 +14,6 @@ import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
|
14
14
|
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
15
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
18
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
18
|
import { key } from '../pm-plugins/main';
|
|
20
19
|
import { attachMoveNodeAnalytics, getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
@@ -327,7 +326,7 @@ export var moveNode = function moveNode(api) {
|
|
|
327
326
|
tr: tr
|
|
328
327
|
});
|
|
329
328
|
}
|
|
330
|
-
var preservedSelection =
|
|
329
|
+
var preservedSelection = editorExperiment('platform_editor_block_menu', true) ? api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection : undefined;
|
|
331
330
|
if (preservedSelection) {
|
|
332
331
|
var $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
|
|
333
332
|
var expandedRange = $from.blockRange(preservedSelection.$to);
|
|
@@ -39,7 +39,9 @@ var shouldIgnoreNode = function shouldIgnoreNode(node, ignore_nodes, depth, pare
|
|
|
39
39
|
if (isLegacyContentMacroExtension) {
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
|
-
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout)
|
|
42
|
+
return (isEmbedCard || isMediaSingle) && ['wrap-right', 'wrap-left'].includes(node.attrs.layout) && !editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
43
|
+
exposure: true
|
|
44
|
+
}) ? true : ignore_nodes.includes(node.type.name);
|
|
43
45
|
};
|
|
44
46
|
var getPositionBeforeNodeAtPos = function getPositionBeforeNodeAtPos(state, pos) {
|
|
45
47
|
if (pos <= 0 || pos >= state.doc.nodeSize - 2) {
|
|
@@ -135,6 +135,36 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
135
135
|
rootElement = parentElement;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
// When platform_editor_fix_selection_wrapped_media_embed is enabled, a wrapped mediaSingle/embedCard and the
|
|
140
|
+
// paragraph(s) it floats next to both have anchor decorations. If the hovered rootElement
|
|
141
|
+
// is a paragraph whose adjacent DOM sibling is a wrapped mediaSingle/embedCard with an
|
|
142
|
+
// anchor, redirect the handle to the media node so only one handle shows (ED-26959).
|
|
143
|
+
// We check previousElementSibling (wrap-left: media precedes text in DOM) and
|
|
144
|
+
// nextElementSibling (wrap-right: media follows text in DOM).
|
|
145
|
+
// This must happen before anchorName is read so the correct node's handle is shown.
|
|
146
|
+
if (editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
147
|
+
exposure: true
|
|
148
|
+
})) {
|
|
149
|
+
var _rootNodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootElement) : rootElement.getAttribute('data-drag-handler-node-type');
|
|
150
|
+
if (_rootNodeType === 'paragraph') {
|
|
151
|
+
var isWrappedMediaEmbedSibling = function isWrappedMediaEmbedSibling(sibling) {
|
|
152
|
+
if (!sibling || !sibling.getAttribute(getAnchorAttrName())) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
var siblingType = isNativeAnchorSupported ? getTypeNameFromDom(sibling) : sibling.getAttribute('data-drag-handler-node-type');
|
|
156
|
+
var siblingLayout = sibling.getAttribute('layout') || '';
|
|
157
|
+
return (siblingType === 'mediaSingle' || siblingType === 'embedCard') && ['wrap-left', 'wrap-right'].includes(siblingLayout);
|
|
158
|
+
};
|
|
159
|
+
var prevSibling = rootElement.previousElementSibling;
|
|
160
|
+
var nextSibling = rootElement.nextElementSibling;
|
|
161
|
+
if (prevSibling && isWrappedMediaEmbedSibling(prevSibling)) {
|
|
162
|
+
rootElement = prevSibling;
|
|
163
|
+
} else if (nextSibling && isWrappedMediaEmbedSibling(nextSibling)) {
|
|
164
|
+
rootElement = nextSibling;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
138
168
|
var anchorName;
|
|
139
169
|
if (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
140
170
|
anchorName = rootElement.getAttribute(getAnchorAttrName());
|
|
@@ -153,12 +183,15 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
153
183
|
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.anchorName) === anchorName) {
|
|
154
184
|
return false;
|
|
155
185
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
186
|
+
if (!editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true, {
|
|
187
|
+
exposure: true
|
|
188
|
+
})) {
|
|
189
|
+
// We want to exclude handles from showing for wrapped nodes
|
|
190
|
+
// TODO: ED-26959 - We should be able remove these check if we decided to
|
|
191
|
+
// go we not decoration for wrapped image solution.
|
|
192
|
+
if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '')) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
162
195
|
}
|
|
163
196
|
var parentRootElement = rootElement.parentElement;
|
|
164
197
|
var pos;
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -22,6 +22,7 @@ export var DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
|
22
22
|
export var DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
23
23
|
export var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
24
24
|
export var DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = 0;
|
|
25
|
+
export var DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = 8;
|
|
25
26
|
|
|
26
27
|
/** We only want to shift-select nodes that are at the top level of a document.
|
|
27
28
|
* This is because funky things happen when selecting inside of tableCells, but we
|
|
@@ -99,13 +100,16 @@ export var getNestedNodeLeftPaddingMargin = function getNestedNodeLeftPaddingMar
|
|
|
99
100
|
return "".concat(DRAG_HANDLE_WIDTH + DRAG_HANDLE_NARROW_GAP, "px");
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
103
|
+
export var topPositionAdjustment = function topPositionAdjustment(nodeType, layout) {
|
|
103
104
|
if (editorExperiment('advanced_layouts', true)) {
|
|
104
105
|
switch (nodeType) {
|
|
105
106
|
case 'layoutSection':
|
|
106
107
|
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
107
108
|
}
|
|
108
109
|
}
|
|
110
|
+
if ((nodeType === 'mediaSingle' || nodeType === 'embedCard') && layout && ['wrap-left', 'wrap-right'].includes(layout) && editorExperiment('platform_editor_fix_selection_wrapped_media_embed', true)) {
|
|
111
|
+
return DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT;
|
|
112
|
+
}
|
|
109
113
|
switch (nodeType) {
|
|
110
114
|
case 'rule':
|
|
111
115
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
@@ -851,7 +851,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
851
851
|
var bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
852
852
|
return _objectSpread({
|
|
853
853
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
854
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start)+ ").concat(topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
854
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
855
855
|
}, bottom);
|
|
856
856
|
}
|
|
857
857
|
var height = editorExperiment('platform_editor_controls', 'variant1') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -897,7 +897,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
897
897
|
var bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn) : {};
|
|
898
898
|
return _objectSpread({
|
|
899
899
|
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
900
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType), "px)")
|
|
900
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
901
901
|
}, bottom);
|
|
902
902
|
}
|
|
903
903
|
var height = editorExperiment('platform_editor_controls', 'variant1') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -16,6 +16,7 @@ export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
|
16
16
|
export declare const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
17
17
|
export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
18
18
|
export declare const DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = 0;
|
|
19
|
+
export declare const DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = 8;
|
|
19
20
|
/** We only want to shift-select nodes that are at the top level of a document.
|
|
20
21
|
* This is because funky things happen when selecting inside of tableCells, but we
|
|
21
22
|
* also want to avoid heavily nested cases to descope potential corner cases.
|
|
@@ -35,7 +36,7 @@ export declare const QUICK_INSERT_LEFT_OFFSET = 16;
|
|
|
35
36
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
36
37
|
export declare const rootElementGap: (nodeType: string) => number;
|
|
37
38
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "24px" | "8px" | "16px" | "20px" | "28px" | "40px";
|
|
38
|
-
export declare const topPositionAdjustment: (nodeType: string) => number;
|
|
39
|
+
export declare const topPositionAdjustment: (nodeType: string, layout?: string) => number;
|
|
39
40
|
export declare const dropTargetMarginMap: {
|
|
40
41
|
[key: number]: string;
|
|
41
42
|
};
|
|
@@ -16,6 +16,7 @@ export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
|
16
16
|
export declare const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
17
17
|
export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
18
18
|
export declare const DRAG_HANDLE_PARAGRAPH_SMALL_TOP_ADJUSTMENT = 0;
|
|
19
|
+
export declare const DRAG_HANDLE_WRAPPED_MEDIA_EMBED_TOP_ADJUSTMENT = 8;
|
|
19
20
|
/** We only want to shift-select nodes that are at the top level of a document.
|
|
20
21
|
* This is because funky things happen when selecting inside of tableCells, but we
|
|
21
22
|
* also want to avoid heavily nested cases to descope potential corner cases.
|
|
@@ -35,7 +36,7 @@ export declare const QUICK_INSERT_LEFT_OFFSET = 16;
|
|
|
35
36
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
36
37
|
export declare const rootElementGap: (nodeType: string) => number;
|
|
37
38
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "24px" | "8px" | "16px" | "20px" | "28px" | "40px";
|
|
38
|
-
export declare const topPositionAdjustment: (nodeType: string) => number;
|
|
39
|
+
export declare const topPositionAdjustment: (nodeType: string, layout?: string) => number;
|
|
39
40
|
export declare const dropTargetMarginMap: {
|
|
40
41
|
[key: number]: string;
|
|
41
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.16",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^19.0.0",
|
|
58
58
|
"@atlaskit/theme": "^23.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^61.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^13.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^21.1.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|