@atlaskit/editor-plugin-block-controls 1.5.11 → 1.5.12

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,14 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.5.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#117568](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117568)
8
+ [`b07c3e0b8dbf8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b07c3e0b8dbf8) -
9
+ Update drag handle position on divider node
10
+ - Updated dependencies
11
+
3
12
  ## 1.5.11
4
13
 
5
14
  ### Patch Changes
@@ -82,7 +82,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
82
82
  var _Decoration$node2;
83
83
  var anchorName = "--node-anchor-".concat(node.type.name, "-").concat(index);
84
84
  var style;
85
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
85
+ if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
86
86
  style = "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 ? 'margin-top: 0px;' : '', "; position: relative; z-index: 1;");
87
87
  } else {
88
88
  style = "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 ? 'margin-top: 0px;' : '');
@@ -142,7 +142,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
142
142
  element.style.display = 'inline';
143
143
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
144
144
  element.setAttribute('data-blocks-drag-handle-container', 'true');
145
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
145
+ if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
146
146
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
147
147
  // due to margins applied to other nodes eg. Headings
148
148
  element.style.clear = 'unset';
@@ -3,17 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
6
+ exports.topPositionAdjustment = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
7
7
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
8
8
  var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
9
9
  var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH = 12;
10
10
  var DRAG_HANDLE_BORDER_RADIUS = exports.DRAG_HANDLE_BORDER_RADIUS = 4;
11
11
  var DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_ZINDEX = _editorSharedStyles.akRichMediaResizeZIndex + _editorSharedStyles.akEditorUnitZIndex; //place above legacy resizer
12
12
 
13
+ var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
14
+
13
15
  var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
14
16
  var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType) {
15
17
  if (nodeTypeExcludeList.includes(nodeType)) {
16
18
  return 12;
17
19
  }
18
20
  return 8;
21
+ };
22
+ var topPositionAdjustment = exports.topPositionAdjustment = function topPositionAdjustment(nodeType) {
23
+ switch (nodeType) {
24
+ case 'rule':
25
+ return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
26
+ case 'table':
27
+ return DRAG_HANDLE_HEIGHT;
28
+ default:
29
+ return 0;
30
+ }
19
31
  };
@@ -105,7 +105,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
105
105
  });
106
106
  var resolvedMovingNode = tr.doc.resolve(start);
107
107
  var maybeNode = resolvedMovingNode.nodeAfter;
108
- (0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
108
+ (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
109
109
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
110
110
  eventType: _analytics.EVENT_TYPE.UI,
111
111
  action: _analytics.ACTION.CLICKED,
@@ -242,17 +242,17 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
242
242
  }
243
243
  }
244
244
  if (supportsAnchor) {
245
- return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
245
+ return (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
246
246
  left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat((0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
247
- top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
247
+ 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)")
248
248
  } : {
249
249
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(_consts.DRAG_HANDLE_WIDTH, "px - ").concat((0, _consts.dragHandleGap)(nodeType), "px)"),
250
- top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(_consts.DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
250
+ 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)")
251
251
  };
252
252
  }
253
253
  return {
254
254
  left: (0, _dragHandlePositions.getLeftPosition)(dom, nodeType, innerContainer, macroInteractionUpdates),
255
- top: (0, _dragHandlePositions.getTopPosition)(dom)
255
+ top: (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_ed_23674') ? (0, _dragHandlePositions.getTopPosition)(dom, nodeType) : (0, _dragHandlePositions.getTopPosition)(dom)
256
256
  };
257
257
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
258
258
  return (0, _react2.jsx)("button", {
@@ -263,7 +263,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
263
263
  ,
264
264
  style: positionStyles,
265
265
  onClick: handleOnClick,
266
- onMouseDown: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
266
+ onMouseDown: (0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
267
267
  "data-testid": "block-ctrl-drag-handle"
268
268
  }, (0, _react2.jsx)(_dragHandler.default, {
269
269
  label: "",
@@ -18,19 +18,27 @@ var extendedHoverZone = (0, _react.css)({
18
18
  display: 'none !important'
19
19
  },
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
21
- '[data-drag-handler-anchor-name]::after': {
22
- content: '""',
23
- position: 'absolute',
24
- top: 0,
25
- left: '-100%',
26
- width: '100%',
27
- height: '100%',
28
- background: 'transparent',
29
- cursor: 'default',
30
- zIndex: -1
21
+ '.ProseMirror': {
22
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
23
+ '&& [data-drag-handler-anchor-name]::after': {
24
+ content: '""',
25
+ position: 'absolute',
26
+ top: 0,
27
+ left: '-100%',
28
+ width: '100%',
29
+ height: '100%',
30
+ background: 'transparent',
31
+ cursor: 'default',
32
+ zIndex: -1
33
+ }
31
34
  },
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
32
36
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
33
- '[data-blocks-decoration-container="true"] + *::after': {
37
+ 'hr[data-drag-handler-anchor-name]': {
38
+ overflow: 'visible'
39
+ },
40
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
41
+ '[data-blocks-drag-handle-container="true"] + *::after': {
34
42
  display: 'none'
35
43
  }
36
44
  });
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getTopPosition = exports.getLeftPosition = void 0;
7
7
  var _consts = require("../ui/consts");
8
- var getTopPosition = exports.getTopPosition = function getTopPosition(dom) {
8
+ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type) {
9
9
  if (!dom) {
10
10
  return 'auto';
11
11
  }
12
12
  var table = dom.querySelector('table');
13
13
  if (table) {
14
14
  return "".concat(dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0), "px");
15
+ } else if (type === 'rule') {
16
+ return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
15
17
  } else {
16
18
  return "".concat(dom.offsetTop, "px");
17
19
  }
@@ -1,7 +1,7 @@
1
1
  import { createElement } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { DragHandle } from '../ui/drag-handle';
6
6
  import { DropTarget } from '../ui/drop-target';
7
7
  import { MouseMoveWrapper } from '../ui/mouse-move-wrapper';
@@ -74,7 +74,7 @@ export const nodeDecorations = newState => {
74
74
  newState.doc.descendants((node, pos, _parent, index) => {
75
75
  const anchorName = `--node-anchor-${node.type.name}-${index}`;
76
76
  let style;
77
- if (getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
77
+ if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
78
78
  style = `anchor-name: ${anchorName}; ${pos === 0 ? 'margin-top: 0px;' : ''}; position: relative; z-index: 1;`;
79
79
  } else {
80
80
  style = `anchor-name: ${anchorName}; ${pos === 0 ? 'margin-top: 0px;' : ''}`;
@@ -136,7 +136,7 @@ export const dragHandleDecoration = (pos, anchorName, nodeType, api) => {
136
136
  element.style.display = 'inline';
137
137
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
138
138
  element.setAttribute('data-blocks-drag-handle-container', 'true');
139
- if (getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
139
+ if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
140
140
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
141
141
  // due to margins applied to other nodes eg. Headings
142
142
  element.style.clear = 'unset';
@@ -4,10 +4,22 @@ export const DRAG_HANDLE_WIDTH = 12;
4
4
  export const DRAG_HANDLE_BORDER_RADIUS = 4;
5
5
  export const DRAG_HANDLE_ZINDEX = akRichMediaResizeZIndex + akEditorUnitZIndex; //place above legacy resizer
6
6
 
7
+ export const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
8
+
7
9
  const nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
8
10
  export const dragHandleGap = nodeType => {
9
11
  if (nodeTypeExcludeList.includes(nodeType)) {
10
12
  return 12;
11
13
  }
12
14
  return 8;
15
+ };
16
+ export const topPositionAdjustment = nodeType => {
17
+ switch (nodeType) {
18
+ case 'rule':
19
+ return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
20
+ case 'table':
21
+ return DRAG_HANDLE_HEIGHT;
22
+ default:
23
+ return 0;
24
+ }
13
25
  };
@@ -7,13 +7,13 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
7
7
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
8
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
10
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
12
12
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
13
13
  import { key } from '../pm-plugins/main';
14
14
  import { selectNode } from '../utils';
15
15
  import { getLeftPosition, getTopPosition } from '../utils/drag-handle-positions';
16
- import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap } from './consts';
16
+ import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, topPositionAdjustment } from './consts';
17
17
  import { dragPreview } from './drag-preview';
18
18
  const dragHandleButtonStyles = css({
19
19
  position: 'absolute',
@@ -91,7 +91,7 @@ export const DragHandle = ({
91
91
  });
92
92
  const resolvedMovingNode = tr.doc.resolve(start);
93
93
  const maybeNode = resolvedMovingNode.nodeAfter;
94
- getBooleanFF('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
94
+ fg('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
95
95
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
96
96
  eventType: EVENT_TYPE.UI,
97
97
  action: ACTION.CLICKED,
@@ -231,17 +231,17 @@ export const DragHandle = ({
231
231
  }
232
232
  }
233
233
  if (supportsAnchor) {
234
- return getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
234
+ return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
235
235
  left: hasResizer || isExtension || isEmbedCard ? `calc(anchor(${anchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates)})` : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
236
- top: anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
236
+ 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)`
237
237
  } : {
238
238
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : `calc(anchor(${anchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType)}px)`,
239
- top: anchorName.includes('table') ? `calc(anchor(${anchorName} start) + ${DRAG_HANDLE_HEIGHT}px)` : `anchor(${anchorName} start)`
239
+ 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)`
240
240
  };
241
241
  }
242
242
  return {
243
243
  left: getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
244
- top: getTopPosition(dom)
244
+ top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
245
245
  };
246
246
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
247
247
  return jsx("button", {
@@ -252,7 +252,7 @@ export const DragHandle = ({
252
252
  ,
253
253
  style: positionStyles,
254
254
  onClick: handleOnClick,
255
- onMouseDown: getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
255
+ onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
256
256
  "data-testid": "block-ctrl-drag-handle"
257
257
  }, jsx(DragHandlerIcon, {
258
258
  label: "",
@@ -9,19 +9,27 @@ const extendedHoverZone = css({
9
9
  display: 'none !important'
10
10
  },
11
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
12
- '[data-drag-handler-anchor-name]::after': {
13
- content: '""',
14
- position: 'absolute',
15
- top: 0,
16
- left: '-100%',
17
- width: '100%',
18
- height: '100%',
19
- background: 'transparent',
20
- cursor: 'default',
21
- zIndex: -1
12
+ '.ProseMirror': {
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
14
+ '&& [data-drag-handler-anchor-name]::after': {
15
+ content: '""',
16
+ position: 'absolute',
17
+ top: 0,
18
+ left: '-100%',
19
+ width: '100%',
20
+ height: '100%',
21
+ background: 'transparent',
22
+ cursor: 'default',
23
+ zIndex: -1
24
+ }
22
25
  },
26
+ // 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
23
27
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
24
- '[data-blocks-decoration-container="true"] + *::after': {
28
+ 'hr[data-drag-handler-anchor-name]': {
29
+ overflow: 'visible'
30
+ },
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
32
+ '[data-blocks-drag-handle-container="true"] + *::after': {
25
33
  display: 'none'
26
34
  }
27
35
  });
@@ -1,11 +1,13 @@
1
- import { DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
- export const getTopPosition = dom => {
1
+ import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
+ export const getTopPosition = (dom, type) => {
3
3
  if (!dom) {
4
4
  return 'auto';
5
5
  }
6
6
  const table = dom.querySelector('table');
7
7
  if (table) {
8
8
  return `${dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0)}px`;
9
+ } else if (type === 'rule') {
10
+ return `${dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT}px`;
9
11
  } else {
10
12
  return `${dom.offsetTop}px`;
11
13
  }
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { createElement } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { DragHandle } from '../ui/drag-handle';
7
7
  import { DropTarget } from '../ui/drop-target';
8
8
  import { MouseMoveWrapper } from '../ui/mouse-move-wrapper';
@@ -75,7 +75,7 @@ export var nodeDecorations = function nodeDecorations(newState) {
75
75
  var _Decoration$node2;
76
76
  var anchorName = "--node-anchor-".concat(node.type.name, "-").concat(index);
77
77
  var style;
78
- if (getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
78
+ if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
79
79
  style = "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 ? 'margin-top: 0px;' : '', "; position: relative; z-index: 1;");
80
80
  } else {
81
81
  style = "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 ? 'margin-top: 0px;' : '');
@@ -135,7 +135,7 @@ export var dragHandleDecoration = function dragHandleDecoration(pos, anchorName,
135
135
  element.style.display = 'inline';
136
136
  element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
137
137
  element.setAttribute('data-blocks-drag-handle-container', 'true');
138
- if (getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
138
+ if (fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2')) {
139
139
  // There are times when global clear: "both" styles are applied to this decoration causing jumpiness
140
140
  // due to margins applied to other nodes eg. Headings
141
141
  element.style.clear = 'unset';
@@ -4,10 +4,22 @@ export var DRAG_HANDLE_WIDTH = 12;
4
4
  export var DRAG_HANDLE_BORDER_RADIUS = 4;
5
5
  export var DRAG_HANDLE_ZINDEX = akRichMediaResizeZIndex + akEditorUnitZIndex; //place above legacy resizer
6
6
 
7
+ export var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
8
+
7
9
  var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
8
10
  export var dragHandleGap = function dragHandleGap(nodeType) {
9
11
  if (nodeTypeExcludeList.includes(nodeType)) {
10
12
  return 12;
11
13
  }
12
14
  return 8;
15
+ };
16
+ export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
17
+ switch (nodeType) {
18
+ case 'rule':
19
+ return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
20
+ case 'table':
21
+ return DRAG_HANDLE_HEIGHT;
22
+ default:
23
+ return 0;
24
+ }
13
25
  };
@@ -8,13 +8,13 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
8
8
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
9
9
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
11
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
13
13
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
14
14
  import { key } from '../pm-plugins/main';
15
15
  import { selectNode } from '../utils';
16
16
  import { getLeftPosition, getTopPosition } from '../utils/drag-handle-positions';
17
- import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap } from './consts';
17
+ import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, topPositionAdjustment } from './consts';
18
18
  import { dragPreview } from './drag-preview';
19
19
  var dragHandleButtonStyles = css({
20
20
  position: 'absolute',
@@ -97,7 +97,7 @@ export var DragHandle = function DragHandle(_ref) {
97
97
  });
98
98
  var resolvedMovingNode = tr.doc.resolve(start);
99
99
  var maybeNode = resolvedMovingNode.nodeAfter;
100
- getBooleanFF('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
100
+ fg('platform.editor.elements.drag-and-drop-long-node-scroll') && tr.setMeta('scrollIntoView', false);
101
101
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
102
102
  eventType: EVENT_TYPE.UI,
103
103
  action: ACTION.CLICKED,
@@ -234,17 +234,17 @@ export var DragHandle = function DragHandle(_ref) {
234
234
  }
235
235
  }
236
236
  if (supportsAnchor) {
237
- return getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
237
+ return fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? {
238
238
  left: hasResizer || isExtension || isEmbedCard ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates), ")") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
239
- top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
239
+ 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)")
240
240
  } : {
241
241
  left: hasResizer || isExtension || isBlockCard || isEmbedCard ? getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates) : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType), "px)"),
242
- top: anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
242
+ 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)")
243
243
  };
244
244
  }
245
245
  return {
246
246
  left: getLeftPosition(dom, nodeType, innerContainer, macroInteractionUpdates),
247
- top: getTopPosition(dom)
247
+ top: fg('platform_editor_elements_dnd_ed_23674') ? getTopPosition(dom, nodeType) : getTopPosition(dom)
248
248
  };
249
249
  }, [anchorName, nodeType, view, blockCardWidth, macroInteractionUpdates]);
250
250
  return jsx("button", {
@@ -255,7 +255,7 @@ export var DragHandle = function DragHandle(_ref) {
255
255
  ,
256
256
  style: positionStyles,
257
257
  onClick: handleOnClick,
258
- onMouseDown: getBooleanFF('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
258
+ onMouseDown: fg('platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2') ? handleMouseDownWrapperRemoved : handleMouseDown,
259
259
  "data-testid": "block-ctrl-drag-handle"
260
260
  }, jsx(DragHandlerIcon, {
261
261
  label: "",
@@ -10,19 +10,27 @@ var extendedHoverZone = css({
10
10
  display: 'none !important'
11
11
  },
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
13
- '[data-drag-handler-anchor-name]::after': {
14
- content: '""',
15
- position: 'absolute',
16
- top: 0,
17
- left: '-100%',
18
- width: '100%',
19
- height: '100%',
20
- background: 'transparent',
21
- cursor: 'default',
22
- zIndex: -1
13
+ '.ProseMirror': {
14
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
15
+ '&& [data-drag-handler-anchor-name]::after': {
16
+ content: '""',
17
+ position: 'absolute',
18
+ top: 0,
19
+ left: '-100%',
20
+ width: '100%',
21
+ height: '100%',
22
+ background: 'transparent',
23
+ cursor: 'default',
24
+ zIndex: -1
25
+ }
23
26
  },
27
+ // 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
24
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
25
- '[data-blocks-decoration-container="true"] + *::after': {
29
+ 'hr[data-drag-handler-anchor-name]': {
30
+ overflow: 'visible'
31
+ },
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
33
+ '[data-blocks-drag-handle-container="true"] + *::after': {
26
34
  display: 'none'
27
35
  }
28
36
  });
@@ -1,11 +1,13 @@
1
- import { DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
- export var getTopPosition = function getTopPosition(dom) {
1
+ import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
2
+ export var getTopPosition = function getTopPosition(dom, type) {
3
3
  if (!dom) {
4
4
  return 'auto';
5
5
  }
6
6
  var table = dom.querySelector('table');
7
7
  if (table) {
8
8
  return "".concat(dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0), "px");
9
+ } else if (type === 'rule') {
10
+ return "".concat(dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
9
11
  } else {
10
12
  return "".concat(dom.offsetTop, "px");
11
13
  }
@@ -2,4 +2,6 @@ export declare const DRAG_HANDLE_HEIGHT = 24;
2
2
  export declare const DRAG_HANDLE_WIDTH = 12;
3
3
  export declare const DRAG_HANDLE_BORDER_RADIUS = 4;
4
4
  export declare const DRAG_HANDLE_ZINDEX: number;
5
+ export declare const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT: number;
5
6
  export declare const dragHandleGap: (nodeType: string) => 8 | 12;
7
+ export declare const topPositionAdjustment: (nodeType: string) => number;
@@ -1,2 +1,2 @@
1
- export declare const getTopPosition: (dom: HTMLElement | null) => string;
1
+ export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
2
2
  export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean) => string;
@@ -2,4 +2,6 @@ export declare const DRAG_HANDLE_HEIGHT = 24;
2
2
  export declare const DRAG_HANDLE_WIDTH = 12;
3
3
  export declare const DRAG_HANDLE_BORDER_RADIUS = 4;
4
4
  export declare const DRAG_HANDLE_ZINDEX: number;
5
+ export declare const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT: number;
5
6
  export declare const dragHandleGap: (nodeType: string) => 8 | 12;
7
+ export declare const topPositionAdjustment: (nodeType: string) => number;
@@ -1,2 +1,2 @@
1
- export declare const getTopPosition: (dom: HTMLElement | null) => string;
1
+ export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
2
2
  export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^39.0.3",
35
- "@atlaskit/editor-common": "^84.0.0",
35
+ "@atlaskit/editor-common": "^84.1.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
@@ -119,6 +119,9 @@
119
119
  },
120
120
  "platform.editor.elements.drag-and-drop-ed-23932": {
121
121
  "type": "boolean"
122
+ },
123
+ "platform_editor_elements_dnd_ed_23674": {
124
+ "type": "boolean"
122
125
  }
123
126
  }
124
127
  }