@atlaskit/editor-plugin-block-controls 3.3.15 → 3.3.17
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 +17 -0
- package/dist/cjs/editor-commands/move-node.js +10 -4
- package/dist/cjs/ui/consts.js +3 -3
- package/dist/cjs/ui/quick-insert-button.js +3 -6
- package/dist/es2019/editor-commands/move-node.js +10 -4
- package/dist/es2019/ui/consts.js +2 -2
- package/dist/es2019/ui/quick-insert-button.js +4 -7
- package/dist/esm/editor-commands/move-node.js +10 -4
- package/dist/esm/ui/consts.js +2 -2
- package/dist/esm/ui/quick-insert-button.js +4 -7
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types/ui/quick-insert-button.d.ts +1 -1
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/ui/quick-insert-button.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.3.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#128300](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128300)
|
|
8
|
+
[`b26295480eb23`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b26295480eb23) -
|
|
9
|
+
Always add left offset for quick insert to avoid it flicking in and out
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.3.16
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#127305](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127305)
|
|
17
|
+
[`d73df5795b977`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d73df5795b977) -
|
|
18
|
+
Fix range error
|
|
19
|
+
|
|
3
20
|
## 3.3.15
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -275,9 +275,15 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
var shouldMoveNode = false;
|
|
279
|
+
if (moveToPos > -1 && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
280
|
+
var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
281
|
+
var isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
282
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
|
|
283
|
+
} else {
|
|
284
|
+
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
285
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
|
|
286
|
+
}
|
|
281
287
|
var _expandSelectionBound = (0, _selection.expandSelectionBounds)($currentNodePos, selection.$to),
|
|
282
288
|
$newAnchor = _expandSelectionBound.$anchor,
|
|
283
289
|
$newHead = _expandSelectionBound.$head;
|
|
@@ -340,7 +346,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
340
346
|
return function (_ref7) {
|
|
341
347
|
var _api$blockControls$co;
|
|
342
348
|
var tr = _ref7.tr;
|
|
343
|
-
if (!api) {
|
|
349
|
+
if (!api || (start < 0 || to < 0) && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
344
350
|
return tr;
|
|
345
351
|
}
|
|
346
352
|
var handleNode = tr.doc.nodeAt(start);
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,10 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
|
|
7
|
+
exports.topPositionAdjustment = exports.spacingBetweenNodesForPreview = exports.spaceLookupMap = exports.rootElementGap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.QUICK_INSERT_WIDTH = exports.QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_HEIGHT = exports.QUICK_INSERT_DIMENSIONS = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = exports.BLOCK_MENU_WIDTH = exports.BLOCK_MENU_ENABLED = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
11
|
var _dropTargetMarginMap;
|
|
13
12
|
var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
|
|
@@ -41,9 +40,10 @@ var QUICK_INSERT_DIMENSIONS = exports.QUICK_INSERT_DIMENSIONS = {
|
|
|
41
40
|
width: QUICK_INSERT_WIDTH,
|
|
42
41
|
height: QUICK_INSERT_HEIGHT
|
|
43
42
|
};
|
|
43
|
+
var QUICK_INSERT_LEFT_OFFSET = exports.QUICK_INSERT_LEFT_OFFSET = 16;
|
|
44
44
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
45
45
|
var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
46
|
-
if (nodeType === 'layoutSection'
|
|
46
|
+
if (nodeType === 'layoutSection') {
|
|
47
47
|
return DRAG_HANDLE_DEFAULT_GAP + 20;
|
|
48
48
|
}
|
|
49
49
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -58,8 +58,6 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
58
58
|
api = _ref.api,
|
|
59
59
|
formatMessage = _ref.formatMessage,
|
|
60
60
|
getPos = _ref.getPos,
|
|
61
|
-
nodeType = _ref.nodeType,
|
|
62
|
-
anchorName = _ref.anchorName,
|
|
63
61
|
rootAnchorName = _ref.rootAnchorName,
|
|
64
62
|
rootNodeType = _ref.rootNodeType;
|
|
65
63
|
var macroInteractionUpdates = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'featureFlags.macroInteractionUpdates');
|
|
@@ -97,18 +95,17 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
97
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
100
|
-
var neighboringWidthOffset = anchorName === rootAnchorName ? '-16px' : '0px';
|
|
101
98
|
if (supportsAnchor) {
|
|
102
99
|
return {
|
|
103
|
-
left: isEdgeCase ? "calc(anchor(".concat(rootAnchorName, " start) + ").concat((0, _widgetPositions.getLeftPositionForRootElement)(dom, rootNodeType, _consts.QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + ").concat(
|
|
100
|
+
left: isEdgeCase ? "calc(anchor(".concat(rootAnchorName, " start) + ").concat((0, _widgetPositions.getLeftPositionForRootElement)(dom, rootNodeType, _consts.QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(_consts.QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(anchor(".concat(rootAnchorName, " start) - ").concat(_consts.QUICK_INSERT_DIMENSIONS.width, "px - ").concat((0, _consts.rootElementGap)(rootNodeType), "px + -").concat(_consts.QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
104
101
|
top: "calc(anchor(".concat(rootAnchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(rootNodeType), "px)")
|
|
105
102
|
};
|
|
106
103
|
}
|
|
107
104
|
return {
|
|
108
|
-
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _widgetPositions.getLeftPositionForRootElement)(dom, rootNodeType, _consts.QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + ").concat(
|
|
105
|
+
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _widgetPositions.getLeftPositionForRootElement)(dom, rootNodeType, _consts.QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(_consts.QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(".concat((0, _widgetPositions.getLeftPositionForRootElement)(dom, rootNodeType, _consts.QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(_consts.QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
109
106
|
top: (0, _dragHandlePositions.getTopPosition)(dom, rootNodeType)
|
|
110
107
|
};
|
|
111
|
-
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates
|
|
108
|
+
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates]);
|
|
112
109
|
(0, _react.useEffect)(function () {
|
|
113
110
|
var cleanUpTransitionListener;
|
|
114
111
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -275,9 +275,15 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
const nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
let shouldMoveNode = false;
|
|
279
|
+
if (moveToPos > -1 && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
280
|
+
const isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
281
|
+
const isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
282
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && fg('platform_editor_advanced_layouts_accessibility');
|
|
283
|
+
} else {
|
|
284
|
+
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
285
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
|
|
286
|
+
}
|
|
281
287
|
const {
|
|
282
288
|
$anchor: $newAnchor,
|
|
283
289
|
$head: $newHead
|
|
@@ -341,7 +347,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
341
347
|
tr
|
|
342
348
|
}) => {
|
|
343
349
|
var _api$blockControls$co2;
|
|
344
|
-
if (!api) {
|
|
350
|
+
if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
345
351
|
return tr;
|
|
346
352
|
}
|
|
347
353
|
const handleNode = tr.doc.nodeAt(start);
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
3
|
export const DRAG_HANDLE_HEIGHT = 24;
|
|
5
4
|
export const DRAG_HANDLE_WIDTH = 12;
|
|
@@ -32,9 +31,10 @@ export const QUICK_INSERT_DIMENSIONS = {
|
|
|
32
31
|
width: QUICK_INSERT_WIDTH,
|
|
33
32
|
height: QUICK_INSERT_HEIGHT
|
|
34
33
|
};
|
|
34
|
+
export const QUICK_INSERT_LEFT_OFFSET = 16;
|
|
35
35
|
const nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
36
36
|
export const dragHandleGap = (nodeType, parentNodeType) => {
|
|
37
|
-
if (nodeType === 'layoutSection'
|
|
37
|
+
if (nodeType === 'layoutSection') {
|
|
38
38
|
return DRAG_HANDLE_DEFAULT_GAP + 20;
|
|
39
39
|
}
|
|
40
40
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -9,7 +9,7 @@ import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
|
9
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
10
|
import { getTopPosition } from '../pm-plugins/utils/drag-handle-positions';
|
|
11
11
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
12
|
-
import {
|
|
12
|
+
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from './consts';
|
|
13
13
|
import { isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
14
14
|
import { createNewLine } from './utils/editor-commands';
|
|
15
15
|
const buttonStyles = xcss({
|
|
@@ -47,8 +47,6 @@ export const TypeAheadControl = ({
|
|
|
47
47
|
api,
|
|
48
48
|
formatMessage,
|
|
49
49
|
getPos,
|
|
50
|
-
nodeType,
|
|
51
|
-
anchorName,
|
|
52
50
|
rootAnchorName,
|
|
53
51
|
rootNodeType
|
|
54
52
|
}) => {
|
|
@@ -84,18 +82,17 @@ export const TypeAheadControl = ({
|
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
87
|
-
const neighboringWidthOffset = anchorName === rootAnchorName ? '-16px' : '0px';
|
|
88
85
|
if (supportsAnchor) {
|
|
89
86
|
return {
|
|
90
|
-
left: isEdgeCase ? `calc(anchor(${rootAnchorName} start) + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} +
|
|
87
|
+
left: isEdgeCase ? `calc(anchor(${rootAnchorName} start) + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)` : `calc(anchor(${rootAnchorName} start) - ${QUICK_INSERT_DIMENSIONS.width}px - ${rootElementGap(rootNodeType)}px + -${QUICK_INSERT_LEFT_OFFSET}px)`,
|
|
91
88
|
top: `calc(anchor(${rootAnchorName} start) + ${topPositionAdjustment(rootNodeType)}px)`
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
return {
|
|
95
|
-
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} +
|
|
92
|
+
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)` : `calc(${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)`,
|
|
96
93
|
top: getTopPosition(dom, rootNodeType)
|
|
97
94
|
};
|
|
98
|
-
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates
|
|
95
|
+
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates]);
|
|
99
96
|
useEffect(() => {
|
|
100
97
|
let cleanUpTransitionListener;
|
|
101
98
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -269,9 +269,15 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
var shouldMoveNode = false;
|
|
273
|
+
if (moveToPos > -1 && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
274
|
+
var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
|
|
275
|
+
var isSourceLayoutColumn = nodeType === 'layoutColumn';
|
|
276
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && fg('platform_editor_advanced_layouts_accessibility');
|
|
277
|
+
} else {
|
|
278
|
+
// only move the node if the destination is at the same depth, not support moving a nested node to a parent node
|
|
279
|
+
shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
|
|
280
|
+
}
|
|
275
281
|
var _expandSelectionBound = expandSelectionBounds($currentNodePos, selection.$to),
|
|
276
282
|
$newAnchor = _expandSelectionBound.$anchor,
|
|
277
283
|
$newHead = _expandSelectionBound.$head;
|
|
@@ -334,7 +340,7 @@ export var moveNode = function moveNode(api) {
|
|
|
334
340
|
return function (_ref7) {
|
|
335
341
|
var _api$blockControls$co;
|
|
336
342
|
var tr = _ref7.tr;
|
|
337
|
-
if (!api) {
|
|
343
|
+
if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
338
344
|
return tr;
|
|
339
345
|
}
|
|
340
346
|
var handleNode = tr.doc.nodeAt(start);
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _dropTargetMarginMap;
|
|
3
3
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
export var DRAG_HANDLE_HEIGHT = 24;
|
|
7
6
|
export var DRAG_HANDLE_WIDTH = 12;
|
|
@@ -34,9 +33,10 @@ export var QUICK_INSERT_DIMENSIONS = {
|
|
|
34
33
|
width: QUICK_INSERT_WIDTH,
|
|
35
34
|
height: QUICK_INSERT_HEIGHT
|
|
36
35
|
};
|
|
36
|
+
export var QUICK_INSERT_LEFT_OFFSET = 16;
|
|
37
37
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
38
38
|
export var dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
39
|
-
if (nodeType === 'layoutSection'
|
|
39
|
+
if (nodeType === 'layoutSection') {
|
|
40
40
|
return DRAG_HANDLE_DEFAULT_GAP + 20;
|
|
41
41
|
}
|
|
42
42
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -10,7 +10,7 @@ import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
|
10
10
|
import Tooltip from '@atlaskit/tooltip';
|
|
11
11
|
import { getTopPosition } from '../pm-plugins/utils/drag-handle-positions';
|
|
12
12
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
13
|
-
import {
|
|
13
|
+
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from './consts';
|
|
14
14
|
import { isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
15
15
|
import { createNewLine } from './utils/editor-commands';
|
|
16
16
|
var buttonStyles = xcss({
|
|
@@ -48,8 +48,6 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
48
48
|
api = _ref.api,
|
|
49
49
|
formatMessage = _ref.formatMessage,
|
|
50
50
|
getPos = _ref.getPos,
|
|
51
|
-
nodeType = _ref.nodeType,
|
|
52
|
-
anchorName = _ref.anchorName,
|
|
53
51
|
rootAnchorName = _ref.rootAnchorName,
|
|
54
52
|
rootNodeType = _ref.rootNodeType;
|
|
55
53
|
var macroInteractionUpdates = useSharedPluginStateSelector(api, 'featureFlags.macroInteractionUpdates');
|
|
@@ -87,18 +85,17 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
87
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
90
|
-
var neighboringWidthOffset = anchorName === rootAnchorName ? '-16px' : '0px';
|
|
91
88
|
if (supportsAnchor) {
|
|
92
89
|
return {
|
|
93
|
-
left: isEdgeCase ? "calc(anchor(".concat(rootAnchorName, " start) + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + ").concat(
|
|
90
|
+
left: isEdgeCase ? "calc(anchor(".concat(rootAnchorName, " start) + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(anchor(".concat(rootAnchorName, " start) - ").concat(QUICK_INSERT_DIMENSIONS.width, "px - ").concat(rootElementGap(rootNodeType), "px + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
94
91
|
top: "calc(anchor(".concat(rootAnchorName, " start) + ").concat(topPositionAdjustment(rootNodeType), "px)")
|
|
95
92
|
};
|
|
96
93
|
}
|
|
97
94
|
return {
|
|
98
|
-
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + ").concat(
|
|
95
|
+
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(".concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
99
96
|
top: getTopPosition(dom, rootNodeType)
|
|
100
97
|
};
|
|
101
|
-
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates
|
|
98
|
+
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates]);
|
|
102
99
|
useEffect(function () {
|
|
103
100
|
var cleanUpTransitionListener;
|
|
104
101
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -28,6 +28,7 @@ export declare const QUICK_INSERT_DIMENSIONS: {
|
|
|
28
28
|
width: number;
|
|
29
29
|
height: number;
|
|
30
30
|
};
|
|
31
|
+
export declare const QUICK_INSERT_LEFT_OFFSET = 16;
|
|
31
32
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
32
33
|
export declare const rootElementGap: (nodeType: string) => number;
|
|
33
34
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
@@ -13,5 +13,5 @@ type Props = {
|
|
|
13
13
|
rootAnchorName?: string;
|
|
14
14
|
rootNodeType: string;
|
|
15
15
|
};
|
|
16
|
-
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos,
|
|
16
|
+
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, rootAnchorName, rootNodeType, }: Props) => React.JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -28,6 +28,7 @@ export declare const QUICK_INSERT_DIMENSIONS: {
|
|
|
28
28
|
width: number;
|
|
29
29
|
height: number;
|
|
30
30
|
};
|
|
31
|
+
export declare const QUICK_INSERT_LEFT_OFFSET = 16;
|
|
31
32
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
32
33
|
export declare const rootElementGap: (nodeType: string) => number;
|
|
33
34
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
@@ -13,5 +13,5 @@ type Props = {
|
|
|
13
13
|
rootAnchorName?: string;
|
|
14
14
|
rootNodeType: string;
|
|
15
15
|
};
|
|
16
|
-
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos,
|
|
16
|
+
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, rootAnchorName, rootNodeType, }: Props) => React.JSX.Element;
|
|
17
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.17",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
+
"@atlaskit/editor-common": "^102.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -122,9 +122,6 @@
|
|
|
122
122
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
|
-
"platform_editor_advanced_layouts_post_fix_patch_2": {
|
|
126
|
-
"type": "boolean"
|
|
127
|
-
},
|
|
128
125
|
"platform_editor_advanced_layouts_post_fix_patch_3": {
|
|
129
126
|
"type": "boolean"
|
|
130
127
|
},
|
|
@@ -169,6 +166,9 @@
|
|
|
169
166
|
},
|
|
170
167
|
"platform_editor_drag_layout_column_into_nodes": {
|
|
171
168
|
"type": "boolean"
|
|
169
|
+
},
|
|
170
|
+
"platform_editor_elements_dnd_multi_select_patch_2": {
|
|
171
|
+
"type": "boolean"
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|