@atlaskit/editor-plugin-block-controls 2.17.1 → 2.17.3
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 +19 -0
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -0
- package/dist/cjs/pm-plugins/utils/getSelection.js +1 -2
- package/dist/cjs/ui/drag-handle.js +2 -2
- package/dist/cjs/ui/drop-target.js +1 -2
- package/dist/cjs/ui/global-styles.js +1 -1
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +3 -1
- package/dist/es2019/pm-plugins/utils/getSelection.js +1 -2
- package/dist/es2019/ui/drag-handle.js +2 -2
- package/dist/es2019/ui/drop-target.js +1 -2
- package/dist/es2019/ui/global-styles.js +1 -1
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +3 -1
- package/dist/esm/pm-plugins/utils/getSelection.js +1 -2
- package/dist/esm/ui/drag-handle.js +2 -2
- package/dist/esm/ui/drop-target.js +1 -2
- package/dist/esm/ui/global-styles.js +1 -1
- package/package.json +2 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#101344](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101344)
|
|
8
|
+
[`8e96b4a88757b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e96b4a88757b) -
|
|
9
|
+
[ED-26175] clean up FG platform_editor_elements_dnd_ed_23674
|
|
10
|
+
|
|
11
|
+
## 2.17.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#100925](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100925)
|
|
16
|
+
[`9fcb0cd204385`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9fcb0cd204385) -
|
|
17
|
+
[ED-26170] Remove feature gate platform_editor_element_dnd_nested_fix_patch_2
|
|
18
|
+
- [#101222](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101222)
|
|
19
|
+
[`361cf34435b08`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/361cf34435b08) -
|
|
20
|
+
[ED-26172] clean up FG platform_editor_element_dnd_nested_fix_patch_4
|
|
21
|
+
|
|
3
22
|
## 2.17.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -215,7 +215,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
215
215
|
mappedTo = tr.mapping.map(to);
|
|
216
216
|
tr.insert(mappedTo, _nodeCopy); // insert the content at the new position
|
|
217
217
|
}
|
|
218
|
-
tr = inputMethod === _analytics.INPUT_METHOD.DRAG_AND_DROP
|
|
218
|
+
tr = inputMethod === _analytics.INPUT_METHOD.DRAG_AND_DROP ? (0, _getSelection.setCursorPositionAtMovedNode)(tr, mappedTo) : (0, _getSelection.selectNode)(tr, mappedTo, node.type.name);
|
|
219
219
|
tr.setMeta(_main.key, {
|
|
220
220
|
nodeMoved: true
|
|
221
221
|
});
|
|
@@ -38,9 +38,8 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
38
38
|
var key = (0, _uuid.default)();
|
|
39
39
|
return _view.Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
40
40
|
var element = document.createElement('span');
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
element.style.display = (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
41
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
42
|
+
element.style.display = 'block';
|
|
44
43
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
45
44
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
46
45
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -34,6 +34,8 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
|
|
|
34
34
|
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H5_TOP_ADJUSTMENT, "px");
|
|
35
35
|
} else if (type === 'heading-6') {
|
|
36
36
|
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H6_TOP_ADJUSTMENT, "px");
|
|
37
|
+
} else if (type === 'paragraph') {
|
|
38
|
+
return "".concat(dom.offsetTop + _consts.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, "px");
|
|
37
39
|
} else {
|
|
38
40
|
return "".concat(dom.offsetTop, "px");
|
|
39
41
|
}
|
|
@@ -7,7 +7,6 @@ exports.setCursorPositionAtMovedNode = exports.selectNode = exports.getSelection
|
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(tr, start, nodeSize) {
|
|
12
11
|
var $startPos = tr.doc.resolve(start);
|
|
13
12
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -82,7 +81,7 @@ var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = functi
|
|
|
82
81
|
var selection;
|
|
83
82
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
84
83
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
85
|
-
if (isNodeSelection &&
|
|
84
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
86
85
|
selection = new _selection.GapCursorSelection(tr.doc.resolve(start + node.nodeSize), _selection.Side.RIGHT);
|
|
87
86
|
} else {
|
|
88
87
|
var _getInlineNodePos2 = getInlineNodePos(tr, start, nodeSize),
|
|
@@ -305,12 +305,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
305
305
|
if (supportsAnchor) {
|
|
306
306
|
return {
|
|
307
307
|
left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(anchorName, " right) + anchor(").concat(anchorName, " left))/2 - ").concat(_consts.DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
|
|
308
|
-
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") :
|
|
308
|
+
top: (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)")
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
return {
|
|
312
312
|
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),
|
|
313
|
-
top: (0,
|
|
313
|
+
top: (0, _dragHandlePositions.getTopPosition)(dom, nodeType)
|
|
314
314
|
};
|
|
315
315
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos, isLayoutColumn]);
|
|
316
316
|
var _useState5 = (0, _react.useState)({
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
15
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
16
15
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -195,7 +194,7 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
|
|
|
195
194
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
196
195
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
197
196
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
198
|
-
|
|
197
|
+
dropTargetMarginTopStyles]
|
|
199
198
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
200
199
|
,
|
|
201
200
|
style: dynamicStyle,
|
|
@@ -222,6 +222,6 @@ var blockCardWithoutLayout = (0, _react.css)({
|
|
|
222
222
|
});
|
|
223
223
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
224
224
|
return (0, _react.jsx)(_react.Global, {
|
|
225
|
-
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
225
|
+
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
226
226
|
});
|
|
227
227
|
};
|
|
@@ -209,7 +209,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
209
209
|
mappedTo = tr.mapping.map(to);
|
|
210
210
|
tr.insert(mappedTo, nodeCopy); // insert the content at the new position
|
|
211
211
|
}
|
|
212
|
-
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP
|
|
212
|
+
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP ? setCursorPositionAtMovedNode(tr, mappedTo) : selectNode(tr, mappedTo, node.type.name);
|
|
213
213
|
tr.setMeta(key, {
|
|
214
214
|
nodeMoved: true
|
|
215
215
|
});
|
|
@@ -29,9 +29,8 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
29
29
|
const key = uuid();
|
|
30
30
|
return Decoration.widget(pos, (view, getPosUnsafe) => {
|
|
31
31
|
const element = document.createElement('span');
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
element.style.display = fg('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
32
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
33
|
+
element.style.display = 'block';
|
|
35
34
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
36
35
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
37
36
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
2
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
3
3
|
export const getTopPosition = (dom, type) => {
|
|
4
4
|
if (!dom) {
|
|
5
5
|
return 'auto';
|
|
@@ -28,6 +28,8 @@ export const getTopPosition = (dom, type) => {
|
|
|
28
28
|
return `${dom.offsetTop - DRAG_HANDLE_H5_TOP_ADJUSTMENT}px`;
|
|
29
29
|
} else if (type === 'heading-6') {
|
|
30
30
|
return `${dom.offsetTop - DRAG_HANDLE_H6_TOP_ADJUSTMENT}px`;
|
|
31
|
+
} else if (type === 'paragraph') {
|
|
32
|
+
return `${dom.offsetTop + DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT}px`;
|
|
31
33
|
} else {
|
|
32
34
|
return `${dom.offsetTop}px`;
|
|
33
35
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export const getInlineNodePos = (tr, start, nodeSize) => {
|
|
6
5
|
const $startPos = tr.doc.resolve(start);
|
|
7
6
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -77,7 +76,7 @@ export const setCursorPositionAtMovedNode = (tr, start) => {
|
|
|
77
76
|
let selection;
|
|
78
77
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
79
78
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
80
|
-
if (isNodeSelection &&
|
|
79
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
81
80
|
selection = new GapCursorSelection(tr.doc.resolve(start + node.nodeSize), Side.RIGHT);
|
|
82
81
|
} else {
|
|
83
82
|
const {
|
|
@@ -289,12 +289,12 @@ export const DragHandle = ({
|
|
|
289
289
|
if (supportsAnchor) {
|
|
290
290
|
return {
|
|
291
291
|
left: isEdgeCase ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((anchor(${anchorName} right) + anchor(${anchorName} left))/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
292
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${anchorName} top) - ${DRAG_HANDLE_WIDTH}px)` :
|
|
292
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${anchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)`
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
return {
|
|
296
296
|
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
297
|
-
top:
|
|
297
|
+
top: getTopPosition(dom, nodeType)
|
|
298
298
|
};
|
|
299
299
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos, isLayoutColumn]);
|
|
300
300
|
const [positionStyles, setPositionStyles] = useState({
|
|
@@ -7,7 +7,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
12
11
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
12
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -185,7 +184,7 @@ export const DropTarget = ({
|
|
|
185
184
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
186
185
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
187
186
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
188
|
-
|
|
187
|
+
dropTargetMarginTopStyles]
|
|
189
188
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
190
189
|
,
|
|
191
190
|
style: dynamicStyle,
|
|
@@ -266,6 +266,6 @@ const blockCardWithoutLayout = css({
|
|
|
266
266
|
});
|
|
267
267
|
export const GlobalStylesWrapper = () => {
|
|
268
268
|
return jsx(Global, {
|
|
269
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
269
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
270
270
|
});
|
|
271
271
|
};
|
|
@@ -209,7 +209,7 @@ export var moveNode = function moveNode(api) {
|
|
|
209
209
|
mappedTo = tr.mapping.map(to);
|
|
210
210
|
tr.insert(mappedTo, _nodeCopy); // insert the content at the new position
|
|
211
211
|
}
|
|
212
|
-
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP
|
|
212
|
+
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP ? setCursorPositionAtMovedNode(tr, mappedTo) : selectNode(tr, mappedTo, node.type.name);
|
|
213
213
|
tr.setMeta(key, {
|
|
214
214
|
nodeMoved: true
|
|
215
215
|
});
|
|
@@ -31,9 +31,8 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
31
31
|
var key = uuid();
|
|
32
32
|
return Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
33
33
|
var element = document.createElement('span');
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
element.style.display = fg('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
34
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
35
|
+
element.style.display = 'block';
|
|
37
36
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
38
37
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
39
38
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
2
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
3
3
|
export var getTopPosition = function getTopPosition(dom, type) {
|
|
4
4
|
if (!dom) {
|
|
5
5
|
return 'auto';
|
|
@@ -28,6 +28,8 @@ export var getTopPosition = function getTopPosition(dom, type) {
|
|
|
28
28
|
return "".concat(dom.offsetTop - DRAG_HANDLE_H5_TOP_ADJUSTMENT, "px");
|
|
29
29
|
} else if (type === 'heading-6') {
|
|
30
30
|
return "".concat(dom.offsetTop - DRAG_HANDLE_H6_TOP_ADJUSTMENT, "px");
|
|
31
|
+
} else if (type === 'paragraph') {
|
|
32
|
+
return "".concat(dom.offsetTop + DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT, "px");
|
|
31
33
|
} else {
|
|
32
34
|
return "".concat(dom.offsetTop, "px");
|
|
33
35
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export var getInlineNodePos = function getInlineNodePos(tr, start, nodeSize) {
|
|
6
5
|
var $startPos = tr.doc.resolve(start);
|
|
7
6
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -76,7 +75,7 @@ export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(
|
|
|
76
75
|
var selection;
|
|
77
76
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
78
77
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
79
|
-
if (isNodeSelection &&
|
|
78
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
80
79
|
selection = new GapCursorSelection(tr.doc.resolve(start + node.nodeSize), Side.RIGHT);
|
|
81
80
|
} else {
|
|
82
81
|
var _getInlineNodePos2 = getInlineNodePos(tr, start, nodeSize),
|
|
@@ -296,12 +296,12 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
296
296
|
if (supportsAnchor) {
|
|
297
297
|
return {
|
|
298
298
|
left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(anchorName, " right) + anchor(").concat(anchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
299
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") :
|
|
299
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)")
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
return {
|
|
303
303
|
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
304
|
-
top:
|
|
304
|
+
top: getTopPosition(dom, nodeType)
|
|
305
305
|
};
|
|
306
306
|
}, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos, isLayoutColumn]);
|
|
307
307
|
var _useState5 = useState({
|
|
@@ -9,7 +9,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
13
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -187,7 +186,7 @@ export var DropTarget = function DropTarget(_ref3) {
|
|
|
187
186
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
188
187
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
189
188
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
190
|
-
|
|
189
|
+
dropTargetMarginTopStyles]
|
|
191
190
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
192
191
|
,
|
|
193
192
|
style: dynamicStyle,
|
|
@@ -215,6 +215,6 @@ var blockCardWithoutLayout = css({
|
|
|
215
215
|
});
|
|
216
216
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
217
217
|
return jsx(Global, {
|
|
218
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
218
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
219
219
|
});
|
|
220
220
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.3.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.33.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.5.0",
|
|
53
53
|
"@atlaskit/tooltip": "^19.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -109,9 +109,6 @@
|
|
|
109
109
|
"platform_editor_elements_drag_and_drop_ed_23189": {
|
|
110
110
|
"type": "boolean"
|
|
111
111
|
},
|
|
112
|
-
"platform_editor_elements_dnd_ed_23674": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
112
|
"platform_editor_element_drag_and_drop_ed_23873": {
|
|
116
113
|
"type": "boolean"
|
|
117
114
|
},
|
|
@@ -124,15 +121,9 @@
|
|
|
124
121
|
"platform_editor_element_drag_and_drop_ed_24885": {
|
|
125
122
|
"type": "boolean"
|
|
126
123
|
},
|
|
127
|
-
"platform_editor_element_dnd_nested_fix_patch_2": {
|
|
128
|
-
"type": "boolean"
|
|
129
|
-
},
|
|
130
124
|
"platform_editor_element_dnd_nested_fix_patch_3": {
|
|
131
125
|
"type": "boolean"
|
|
132
126
|
},
|
|
133
|
-
"platform_editor_element_dnd_nested_fix_patch_4": {
|
|
134
|
-
"type": "boolean"
|
|
135
|
-
},
|
|
136
127
|
"platform_editor_element_dnd_nested_fix_patch_5": {
|
|
137
128
|
"type": "boolean"
|
|
138
129
|
},
|