@atlaskit/editor-plugin-block-controls 2.13.5 → 2.13.7

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.13.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#160954](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160954)
8
+ [`3d5a71c2d5e22`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d5a71c2d5e22) -
9
+ Fix issue with zindex on DnD psudo-element
10
+
11
+ ## 2.13.6
12
+
13
+ ### Patch Changes
14
+
15
+ - [#160415](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160415)
16
+ [`9dd7911f0fb16`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9dd7911f0fb16) -
17
+ [ux] [ED-25057] Implement drag handle for layout column (position, hover zone, selection)
18
+ - Updated dependencies
19
+
3
20
  ## 2.13.5
4
21
 
5
22
  ### Patch Changes
@@ -9,8 +9,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
+ var _advancedLayoutsFlags = require("../utils/advanced-layouts-flags");
12
13
  var _decorationsCommon = require("./decorations-common");
13
- var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
14
+ var IGNORE_NODES = (0, _advancedLayoutsFlags.isPreRelease2)() ? ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'] : ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
14
15
  var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
15
16
  var shouldDescendIntoNode = exports.shouldDescendIntoNode = function shouldDescendIntoNode(node) {
16
17
  // Optimisation to avoid drawing node decorations for empty table cells
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.handleMouseOver = void 0;
7
+ var _whitespace = require("@atlaskit/editor-common/whitespace");
7
8
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
10
+ var _advancedLayoutsFlags = require("../utils/advanced-layouts-flags");
9
11
  var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
10
12
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
11
13
  var _target$parentElement;
@@ -13,6 +15,12 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
13
15
  }
14
16
  return false;
15
17
  };
18
+ var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(target) {
19
+ var _target$textContent;
20
+ return target instanceof HTMLDivElement && (target === null || target === void 0 ? void 0 : target.getAttribute('data-drag-handler-node-type')) === 'layoutColumn' &&
21
+ // Remove placeholder text
22
+ ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.replace(new RegExp(_whitespace.ZERO_WIDTH_SPACE, 'g'), '')) === '';
23
+ };
16
24
  var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, event, api) {
17
25
  var _api$blockControls, _target$classList;
18
26
  var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
@@ -37,6 +45,11 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
37
45
  }
38
46
  var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
39
47
  var parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
48
+
49
+ // Don't show drag handle when there is no content/only placeholder in layout column
50
+ if ((0, _advancedLayoutsFlags.isPreRelease2)() && isLayoutColumnWithoutContent(rootElement)) {
51
+ return false;
52
+ }
40
53
  // We want to exlude handles from showing for direct decendant of table nodes (i.e. nodes in cells)
41
54
  if (parentElement && parentElementType === 'table' && (0, _experiments.editorExperiment)('nested-dnd', true) && (0, _experiments.editorExperiment)('table-nested-dnd', false, {
42
55
  exposure: true
@@ -23,6 +23,7 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
23
23
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
24
24
  var _main = require("../pm-plugins/main");
25
25
  var _utils = require("../utils");
26
+ var _advancedLayoutsFlags = require("../utils/advanced-layouts-flags");
26
27
  var _dragHandlePositions = require("../utils/drag-handle-positions");
27
28
  var _consts = require("./consts");
28
29
  var _dragPreview = require("./drag-preview");
@@ -64,6 +65,9 @@ var dragHandleButtonStyles = (0, _react2.css)({
64
65
  outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
65
66
  }
66
67
  });
68
+ var layoutColumnDragHandleStyles = (0, _react2.css)({
69
+ transform: 'rotate(90deg)'
70
+ });
67
71
  var selectedStyles = (0, _react2.css)({
68
72
  backgroundColor: "var(--ds-background-selected, #E9F2FF)",
69
73
  color: "var(--ds-icon-selected, #0C66E4)"
@@ -277,14 +281,16 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
277
281
  innerContainer = dom.querySelector('.datasourceView-content-inner-wrap');
278
282
  }
279
283
  }
284
+ var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
285
+ var isLayoutColumn = nodeType === 'layoutColumn';
280
286
  if (supportsAnchor) {
281
287
  return {
282
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType, parentNodeType), "px)"),
283
- top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
288
+ left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _advancedLayoutsFlags.isPreRelease2)() && 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)"),
289
+ top: (0, _advancedLayoutsFlags.isPreRelease2)() && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px)") : (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _consts.topPositionAdjustment)(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
284
290
  };
285
291
  }
286
292
  return {
287
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
293
+ left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
288
294
  top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
289
295
  };
290
296
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
@@ -396,7 +402,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
396
402
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
397
403
  (0, _react2.jsx)("button", {
398
404
  type: "button",
399
- css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
405
+ css: [dragHandleButtonStyles, (0, _advancedLayoutsFlags.isPreRelease2)() && nodeType === 'layoutColumn' && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
400
406
  ref: buttonRef
401
407
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
402
408
  ,
@@ -37,7 +37,7 @@ var extendedHoverZone = function extendedHoverZone() {
37
37
  background: 'transparent',
38
38
  cursor: 'default',
39
39
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
40
- zIndex: (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
40
+ zIndex: -1
41
41
  }
42
42
  },
43
43
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -83,7 +83,7 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
83
83
  height: '100%',
84
84
  cursor: 'default',
85
85
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
86
- zIndex: (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
86
+ zIndex: -1
87
87
  },
88
88
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
89
89
  '&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > [data-drag-handler-anchor-name]::after': {
@@ -97,6 +97,22 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
97
97
  height: '100%',
98
98
  cursor: 'default',
99
99
  zIndex: 1
100
+ },
101
+ // hover zone for layout column should be placed near the top of the column (where drag handle is)
102
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
103
+ '&& [data-drag-handler-anchor-name][data-layout-column]::after': {
104
+ content: '""',
105
+ position: 'absolute',
106
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
107
+ top: "".concat(-_consts.DRAG_HANDLE_WIDTH / 2, "px"),
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
109
+ left: 0,
110
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
111
+ width: '100%',
112
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
113
+ height: "".concat(_consts.DRAG_HANDLE_WIDTH, "px"),
114
+ cursor: 'default',
115
+ zIndex: 1
100
116
  }
101
117
  },
102
118
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -190,10 +206,28 @@ var withRelativePosStyle = (0, _react.css)({
190
206
  }
191
207
  }
192
208
  });
209
+ var withAnchorNameZindexStyle = (0, _react.css)({
210
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
211
+ '.ProseMirror': {
212
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
213
+ '&& [data-drag-handler-anchor-name]': {
214
+ zIndex: 1
215
+ }
216
+ }
217
+ });
218
+ var withAnchorNameZindexNestedStyle = (0, _react.css)({
219
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
220
+ '.ProseMirror': {
221
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
222
+ '&& [data-drag-handler-anchor-depth="0"][data-drag-handler-anchor-name]': {
223
+ zIndex: 1
224
+ }
225
+ }
226
+ });
193
227
  var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
194
228
  return (0, _react.jsx)(_react.Global, {
195
229
  styles: [globalStyles(), (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, (0, _experiments.editorExperiment)('platform_editor_empty_line_prompt', true, {
196
230
  exposure: false
197
- }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles] : undefined]
231
+ }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
198
232
  });
199
233
  };
@@ -14,6 +14,8 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
14
14
  return "".concat(dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0), "px");
15
15
  } else if (type === 'rule') {
16
16
  return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
17
+ } else if (type === 'layoutColumn') {
18
+ return "".concat(-_consts.DRAG_HANDLE_WIDTH, "px");
17
19
  } else {
18
20
  return "".concat(dom.offsetTop, "px");
19
21
  }
@@ -23,7 +25,7 @@ var getLeftPosition = exports.getLeftPosition = function getLeftPosition(dom, ty
23
25
  return 'auto';
24
26
  }
25
27
  if (!innerContainer) {
26
- return "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
28
+ return type === 'layoutColumn' ? "".concat(dom.offsetLeft + dom.clientWidth / 2 - _consts.DRAG_HANDLE_HEIGHT / 2, "px") : "".concat(dom.offsetLeft - (0, _consts.dragHandleGap)(type, parentType) - _consts.DRAG_HANDLE_WIDTH, "px");
27
29
  }
28
30
 
29
31
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
@@ -47,9 +47,9 @@ var getSelection = exports.getSelection = function getSelection(tr, start) {
47
47
  var $startPos = tr.doc.resolve(start);
48
48
  var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
49
49
  var isBlockQuoteWithMedia = nodeName === 'blockquote' && isNodeWithMedia(tr, start, nodeSize);
50
-
51
- // decisionList node is not selectable, but we want to select the whole node not just text
52
- if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia || nodeName === 'decisionList') {
50
+ if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia ||
51
+ // decisionList/layoutColumn node is not selectable, but we want to select the whole node not just text
52
+ ['decisionList', 'layoutColumn'].includes(nodeName || '')) {
53
53
  return new _state.NodeSelection($startPos);
54
54
  } else if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
55
55
  var $mediaStartPos = tr.doc.resolve(start + 1);
@@ -1,8 +1,9 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
4
5
  import { getNestedDepth, getNodeAnchor, TYPE_NODE_DEC } from './decorations-common';
5
- const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
6
+ const IGNORE_NODES = isPreRelease2() ? ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'] : ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
6
7
  const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
7
8
  export const shouldDescendIntoNode = node => {
8
9
  // Optimisation to avoid drawing node decorations for empty table cells
@@ -1,5 +1,7 @@
1
+ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
1
2
  import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
3
5
  const isEmptyNestedParagraphOrHeading = target => {
4
6
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
5
7
  var _target$parentElement;
@@ -7,6 +9,12 @@ const isEmptyNestedParagraphOrHeading = target => {
7
9
  }
8
10
  return false;
9
11
  };
12
+ const isLayoutColumnWithoutContent = target => {
13
+ var _target$textContent;
14
+ return target instanceof HTMLDivElement && (target === null || target === void 0 ? void 0 : target.getAttribute('data-drag-handler-node-type')) === 'layoutColumn' &&
15
+ // Remove placeholder text
16
+ ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.replace(new RegExp(ZERO_WIDTH_SPACE, 'g'), '')) === '';
17
+ };
10
18
  export const handleMouseOver = (view, event, api) => {
11
19
  var _api$blockControls, _target$classList;
12
20
  const {
@@ -32,6 +40,11 @@ export const handleMouseOver = (view, event, api) => {
32
40
  }
33
41
  const parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
34
42
  const parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
43
+
44
+ // Don't show drag handle when there is no content/only placeholder in layout column
45
+ if (isPreRelease2() && isLayoutColumnWithoutContent(rootElement)) {
46
+ return false;
47
+ }
35
48
  // We want to exlude handles from showing for direct decendant of table nodes (i.e. nodes in cells)
36
49
  if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true) && editorExperiment('table-nested-dnd', false, {
37
50
  exposure: true
@@ -19,6 +19,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
19
  import Tooltip from '@atlaskit/tooltip';
20
20
  import { key } from '../pm-plugins/main';
21
21
  import { getNestedNodePosition, selectNode } from '../utils';
22
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
22
23
  import { getLeftPosition, getTopPosition } from '../utils/drag-handle-positions';
23
24
  import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, topPositionAdjustment } from './consts';
24
25
  import { dragPreview } from './drag-preview';
@@ -53,6 +54,9 @@ const dragHandleButtonStyles = css({
53
54
  outline: `2px solid ${"var(--ds-border-focused, #388BFF)"}`
54
55
  }
55
56
  });
57
+ const layoutColumnDragHandleStyles = css({
58
+ transform: 'rotate(90deg)'
59
+ });
56
60
  const selectedStyles = css({
57
61
  backgroundColor: "var(--ds-background-selected, #E9F2FF)",
58
62
  color: "var(--ds-icon-selected, #0C66E4)"
@@ -261,14 +265,16 @@ export const DragHandle = ({
261
265
  innerContainer = dom.querySelector('.datasourceView-content-inner-wrap');
262
266
  }
263
267
  }
268
+ const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
269
+ const isLayoutColumn = nodeType === 'layoutColumn';
264
270
  if (supportsAnchor) {
265
271
  return {
266
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
267
- top: fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
272
+ left: isEdgeCase ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : isPreRelease2() && 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)`,
273
+ top: isPreRelease2() && isLayoutColumn ? `calc(anchor(${anchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : fg('platform_editor_elements_dnd_ed_23674') ? `calc(anchor(${anchorName} start) + ${topPositionAdjustment(nodeType)}px)` : anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
268
274
  };
269
275
  }
270
276
  return {
271
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
277
+ left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
272
278
  top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
273
279
  };
274
280
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
@@ -376,7 +382,7 @@ export const DragHandle = ({
376
382
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
377
383
  jsx("button", {
378
384
  type: "button",
379
- css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
385
+ css: [dragHandleButtonStyles, isPreRelease2() && nodeType === 'layoutColumn' && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
380
386
  ref: buttonRef
381
387
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
382
388
  ,
@@ -6,7 +6,7 @@
6
6
  import { css, Global, jsx } from '@emotion/react';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
- import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from './consts';
9
+ import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, DRAG_HANDLE_WIDTH } from './consts';
10
10
  import { emptyBlockExperimentGlobalStyles } from './empty-block-experiment/global-styles';
11
11
  const extendedHoverZone = () => css({
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
@@ -27,7 +27,7 @@ const extendedHoverZone = () => css({
27
27
  background: 'transparent',
28
28
  cursor: 'default',
29
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
30
- zIndex: fg('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
30
+ zIndex: -1
31
31
  }
32
32
  },
33
33
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -71,7 +71,7 @@ const extendedHoverZoneNested = () => css({
71
71
  height: '100%',
72
72
  cursor: 'default',
73
73
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
74
- zIndex: fg('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
74
+ zIndex: -1
75
75
  },
76
76
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
77
77
  '&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > [data-drag-handler-anchor-name]::after': {
@@ -85,6 +85,22 @@ const extendedHoverZoneNested = () => css({
85
85
  height: '100%',
86
86
  cursor: 'default',
87
87
  zIndex: 1
88
+ },
89
+ // hover zone for layout column should be placed near the top of the column (where drag handle is)
90
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
91
+ '&& [data-drag-handler-anchor-name][data-layout-column]::after': {
92
+ content: '""',
93
+ position: 'absolute',
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
95
+ top: `${-DRAG_HANDLE_WIDTH / 2}px`,
96
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
97
+ left: 0,
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
99
+ width: '100%',
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
101
+ height: `${DRAG_HANDLE_WIDTH}px`,
102
+ cursor: 'default',
103
+ zIndex: 1
88
104
  }
89
105
  },
90
106
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -193,10 +209,28 @@ const withRelativePosStyle = css({
193
209
  }
194
210
  }
195
211
  });
212
+ const withAnchorNameZindexStyle = css({
213
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
214
+ '.ProseMirror': {
215
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
216
+ '&& [data-drag-handler-anchor-name]': {
217
+ zIndex: 1
218
+ }
219
+ }
220
+ });
221
+ const withAnchorNameZindexNestedStyle = css({
222
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
223
+ '.ProseMirror': {
224
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
225
+ '&& [data-drag-handler-anchor-depth="0"][data-drag-handler-anchor-name]': {
226
+ zIndex: 1
227
+ }
228
+ }
229
+ });
196
230
  export const GlobalStylesWrapper = () => {
197
231
  return jsx(Global, {
198
232
  styles: [globalStyles(), editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, editorExperiment('platform_editor_empty_line_prompt', true, {
199
233
  exposure: false
200
- }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles] : undefined]
234
+ }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
201
235
  });
202
236
  };
@@ -1,4 +1,4 @@
1
- import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
1
+ import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
2
  export const getTopPosition = (dom, type) => {
3
3
  if (!dom) {
4
4
  return 'auto';
@@ -8,6 +8,8 @@ export const getTopPosition = (dom, type) => {
8
8
  return `${dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0)}px`;
9
9
  } else if (type === 'rule') {
10
10
  return `${dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT}px`;
11
+ } else if (type === 'layoutColumn') {
12
+ return `${-DRAG_HANDLE_WIDTH}px`;
11
13
  } else {
12
14
  return `${dom.offsetTop}px`;
13
15
  }
@@ -17,7 +19,7 @@ export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdat
17
19
  return 'auto';
18
20
  }
19
21
  if (!innerContainer) {
20
- return `${dom.offsetLeft - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH}px`;
22
+ return type === 'layoutColumn' ? `${dom.offsetLeft + dom.clientWidth / 2 - DRAG_HANDLE_HEIGHT / 2}px` : `${dom.offsetLeft - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH}px`;
21
23
  }
22
24
 
23
25
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
@@ -41,9 +41,9 @@ export const getSelection = (tr, start) => {
41
41
  const $startPos = tr.doc.resolve(start);
42
42
  const nodeName = node === null || node === void 0 ? void 0 : node.type.name;
43
43
  const isBlockQuoteWithMedia = nodeName === 'blockquote' && isNodeWithMedia(tr, start, nodeSize);
44
-
45
- // decisionList node is not selectable, but we want to select the whole node not just text
46
- if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia || nodeName === 'decisionList') {
44
+ if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia ||
45
+ // decisionList/layoutColumn node is not selectable, but we want to select the whole node not just text
46
+ ['decisionList', 'layoutColumn'].includes(nodeName || '')) {
47
47
  return new NodeSelection($startPos);
48
48
  } else if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
49
49
  const $mediaStartPos = tr.doc.resolve(start + 1);
@@ -2,8 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
5
6
  import { getNestedDepth, getNodeAnchor, TYPE_NODE_DEC } from './decorations-common';
6
- var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
7
+ var IGNORE_NODES = isPreRelease2() ? ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption'] : ['tableCell', 'tableHeader', 'tableRow', 'listItem', 'caption', 'layoutColumn'];
7
8
  var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
8
9
  export var shouldDescendIntoNode = function shouldDescendIntoNode(node) {
9
10
  // Optimisation to avoid drawing node decorations for empty table cells
@@ -1,5 +1,7 @@
1
+ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
1
2
  import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
3
5
  var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
4
6
  if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
5
7
  var _target$parentElement;
@@ -7,6 +9,12 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
7
9
  }
8
10
  return false;
9
11
  };
12
+ var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(target) {
13
+ var _target$textContent;
14
+ return target instanceof HTMLDivElement && (target === null || target === void 0 ? void 0 : target.getAttribute('data-drag-handler-node-type')) === 'layoutColumn' &&
15
+ // Remove placeholder text
16
+ ((_target$textContent = target.textContent) === null || _target$textContent === void 0 ? void 0 : _target$textContent.replace(new RegExp(ZERO_WIDTH_SPACE, 'g'), '')) === '';
17
+ };
10
18
  export var handleMouseOver = function handleMouseOver(view, event, api) {
11
19
  var _api$blockControls, _target$classList;
12
20
  var _ref = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
@@ -31,6 +39,11 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
31
39
  }
32
40
  var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
33
41
  var parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
42
+
43
+ // Don't show drag handle when there is no content/only placeholder in layout column
44
+ if (isPreRelease2() && isLayoutColumnWithoutContent(rootElement)) {
45
+ return false;
46
+ }
34
47
  // We want to exlude handles from showing for direct decendant of table nodes (i.e. nodes in cells)
35
48
  if (parentElement && parentElementType === 'table' && editorExperiment('nested-dnd', true) && editorExperiment('table-nested-dnd', false, {
36
49
  exposure: true
@@ -21,6 +21,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
21
21
  import Tooltip from '@atlaskit/tooltip';
22
22
  import { key } from '../pm-plugins/main';
23
23
  import { getNestedNodePosition, selectNode } from '../utils';
24
+ import { isPreRelease2 } from '../utils/advanced-layouts-flags';
24
25
  import { getLeftPosition, getTopPosition } from '../utils/drag-handle-positions';
25
26
  import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, topPositionAdjustment } from './consts';
26
27
  import { dragPreview } from './drag-preview';
@@ -55,6 +56,9 @@ var dragHandleButtonStyles = css({
55
56
  outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
56
57
  }
57
58
  });
59
+ var layoutColumnDragHandleStyles = css({
60
+ transform: 'rotate(90deg)'
61
+ });
58
62
  var selectedStyles = css({
59
63
  backgroundColor: "var(--ds-background-selected, #E9F2FF)",
60
64
  color: "var(--ds-icon-selected, #0C66E4)"
@@ -268,14 +272,16 @@ export var DragHandle = function DragHandle(_ref) {
268
272
  innerContainer = dom.querySelector('.datasourceView-content-inner-wrap');
269
273
  }
270
274
  }
275
+ var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
276
+ var isLayoutColumn = nodeType === 'layoutColumn';
271
277
  if (supportsAnchor) {
272
278
  return {
273
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
274
- top: fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
279
+ left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : isPreRelease2() && 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)"),
280
+ top: isPreRelease2() && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
275
281
  };
276
282
  }
277
283
  return {
278
- left: (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
284
+ left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates, parentNodeType),
279
285
  top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
280
286
  };
281
287
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates, getPos]);
@@ -387,7 +393,7 @@ export var DragHandle = function DragHandle(_ref) {
387
393
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
388
394
  jsx("button", {
389
395
  type: "button",
390
- css: [dragHandleButtonStyles, dragHandleSelected && selectedStyles],
396
+ css: [dragHandleButtonStyles, isPreRelease2() && nodeType === 'layoutColumn' && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
391
397
  ref: buttonRef
392
398
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
393
399
  ,
@@ -7,7 +7,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
7
  import { css, Global, jsx } from '@emotion/react';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
- import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from './consts';
10
+ import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, DRAG_HANDLE_WIDTH } from './consts';
11
11
  import { emptyBlockExperimentGlobalStyles } from './empty-block-experiment/global-styles';
12
12
  var extendedHoverZone = function extendedHoverZone() {
13
13
  return css({
@@ -29,7 +29,7 @@ var extendedHoverZone = function extendedHoverZone() {
29
29
  background: 'transparent',
30
30
  cursor: 'default',
31
31
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
32
- zIndex: fg('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
32
+ zIndex: -1
33
33
  }
34
34
  },
35
35
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -75,7 +75,7 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
75
75
  height: '100%',
76
76
  cursor: 'default',
77
77
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
78
- zIndex: fg('platform_editor_element_dnd_nested_fix_patch_3') ? 1 : -1
78
+ zIndex: -1
79
79
  },
80
80
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
81
81
  '&& :is(.pm-table-cell-content-wrap, .pm-table-header-content-wrap) > [data-drag-handler-anchor-name]::after': {
@@ -89,6 +89,22 @@ var extendedHoverZoneNested = function extendedHoverZoneNested() {
89
89
  height: '100%',
90
90
  cursor: 'default',
91
91
  zIndex: 1
92
+ },
93
+ // hover zone for layout column should be placed near the top of the column (where drag handle is)
94
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
95
+ '&& [data-drag-handler-anchor-name][data-layout-column]::after': {
96
+ content: '""',
97
+ position: 'absolute',
98
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
99
+ top: "".concat(-DRAG_HANDLE_WIDTH / 2, "px"),
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
101
+ left: 0,
102
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
103
+ width: '100%',
104
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
105
+ height: "".concat(DRAG_HANDLE_WIDTH, "px"),
106
+ cursor: 'default',
107
+ zIndex: 1
92
108
  }
93
109
  },
94
110
  // TODO - ED-23995 this style override needs to be moved to the Rule styles after FF cleanup - packages/editor/editor-common/src/styles/shared/rule.ts
@@ -182,10 +198,28 @@ var withRelativePosStyle = css({
182
198
  }
183
199
  }
184
200
  });
201
+ var withAnchorNameZindexStyle = css({
202
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
203
+ '.ProseMirror': {
204
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
205
+ '&& [data-drag-handler-anchor-name]': {
206
+ zIndex: 1
207
+ }
208
+ }
209
+ });
210
+ var withAnchorNameZindexNestedStyle = css({
211
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
212
+ '.ProseMirror': {
213
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
214
+ '&& [data-drag-handler-anchor-depth="0"][data-drag-handler-anchor-name]': {
215
+ zIndex: 1
216
+ }
217
+ }
218
+ });
185
219
  export var GlobalStylesWrapper = function GlobalStylesWrapper() {
186
220
  return jsx(Global, {
187
221
  styles: [globalStyles(), editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, editorExperiment('platform_editor_empty_line_prompt', true, {
188
222
  exposure: false
189
- }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles] : undefined]
223
+ }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_2') ? withFormatInLayoutStyleFix : undefined, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
190
224
  });
191
225
  };
@@ -1,4 +1,4 @@
1
- import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
1
+ import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
2
  export var getTopPosition = function getTopPosition(dom, type) {
3
3
  if (!dom) {
4
4
  return 'auto';
@@ -8,6 +8,8 @@ export var getTopPosition = function getTopPosition(dom, type) {
8
8
  return "".concat(dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0), "px");
9
9
  } else if (type === 'rule') {
10
10
  return "".concat(dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
11
+ } else if (type === 'layoutColumn') {
12
+ return "".concat(-DRAG_HANDLE_WIDTH, "px");
11
13
  } else {
12
14
  return "".concat(dom.offsetTop, "px");
13
15
  }
@@ -17,7 +19,7 @@ export var getLeftPosition = function getLeftPosition(dom, type, innerContainer,
17
19
  return 'auto';
18
20
  }
19
21
  if (!innerContainer) {
20
- return "".concat(dom.offsetLeft - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH, "px");
22
+ return type === 'layoutColumn' ? "".concat(dom.offsetLeft + dom.clientWidth / 2 - DRAG_HANDLE_HEIGHT / 2, "px") : "".concat(dom.offsetLeft - dragHandleGap(type, parentType) - DRAG_HANDLE_WIDTH, "px");
21
23
  }
22
24
 
23
25
  // There is a showMacroInteractionDesignUpdates prop in extension node wrapper that can add a relative span under the top level div
@@ -41,9 +41,9 @@ export var getSelection = function getSelection(tr, start) {
41
41
  var $startPos = tr.doc.resolve(start);
42
42
  var nodeName = node === null || node === void 0 ? void 0 : node.type.name;
43
43
  var isBlockQuoteWithMedia = nodeName === 'blockquote' && isNodeWithMedia(tr, start, nodeSize);
44
-
45
- // decisionList node is not selectable, but we want to select the whole node not just text
46
- if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia || nodeName === 'decisionList') {
44
+ if (isNodeSelection && nodeName !== 'blockquote' || isBlockQuoteWithMedia ||
45
+ // decisionList/layoutColumn node is not selectable, but we want to select the whole node not just text
46
+ ['decisionList', 'layoutColumn'].includes(nodeName || '')) {
47
47
  return new NodeSelection($startPos);
48
48
  } else if (nodeName === 'mediaGroup' && (node === null || node === void 0 ? void 0 : node.childCount) === 1) {
49
49
  var $mediaStartPos = tr.doc.resolve(start + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.13.5",
3
+ "version": "2.13.7",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,12 +31,12 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/adf-schema": "^44.2.0",
34
- "@atlaskit/editor-common": "^94.12.0",
34
+ "@atlaskit/editor-common": "^94.13.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
39
- "@atlaskit/editor-plugin-quick-insert": "^1.6.0",
39
+ "@atlaskit/editor-plugin-quick-insert": "^1.7.0",
40
40
  "@atlaskit/editor-plugin-width": "^1.3.0",
41
41
  "@atlaskit/editor-prosemirror": "6.0.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.2.0",
@@ -48,8 +48,8 @@
48
48
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
49
49
  "@atlaskit/primitives": "^13.0.0",
50
50
  "@atlaskit/theme": "^14.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^2.11.0",
52
- "@atlaskit/tokens": "^2.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^2.12.0",
52
+ "@atlaskit/tokens": "^2.2.0",
53
53
  "@atlaskit/tooltip": "^18.8.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",