@atlaskit/editor-plugin-block-controls 1.3.11 → 1.3.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,13 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 1.3.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#101305](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101305)
8
+ [`8df2f2cd6748`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8df2f2cd6748) -
9
+ Refactor drop target to use Pragmatic DnD indicator package
10
+
3
11
  ## 1.3.11
4
12
 
5
13
  ### Patch Changes
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DROP_TARGET_LINE_WIDTH = exports.DROP_TARGET_CIRCLE_DIAMETER = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_NODE_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
6
+ exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_NODE_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_BORDER_RADIUS = void 0;
7
7
  var DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_HEIGHT = 24;
8
8
  var DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_WIDTH = 12;
9
9
  var DRAG_HANDLE_BORDER_RADIUS = exports.DRAG_HANDLE_BORDER_RADIUS = 4;
10
- var DRAG_HANDLE_NODE_GAP = exports.DRAG_HANDLE_NODE_GAP = 12;
11
- var DROP_TARGET_LINE_WIDTH = exports.DROP_TARGET_LINE_WIDTH = 2;
12
- var DROP_TARGET_CIRCLE_DIAMETER = exports.DROP_TARGET_CIRCLE_DIAMETER = 8;
10
+ var DRAG_HANDLE_NODE_GAP = exports.DRAG_HANDLE_NODE_GAP = 12;
@@ -8,41 +8,14 @@ exports.DropTarget = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
+ var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
11
12
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
12
- var _colors = require("@atlaskit/theme/colors");
13
- var _consts = require("./consts");
14
13
  /** @jsx jsx */
15
14
 
16
- var styleHighlighted = (0, _react2.css)({
15
+ var styleDropTarget = (0, _react2.css)({
17
16
  height: "var(--ds-space-100, 8px)",
18
- marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", _consts.DROP_TARGET_LINE_WIDTH, "px)"),
19
- marginLeft: "var(--ds-space-negative-100, -8px)",
20
- top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 1px)"),
21
- //1px to help clear expand node margin
22
- position: 'relative',
23
- borderBottom: "solid ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")"), " ", _consts.DROP_TARGET_LINE_WIDTH, "px"),
24
- "&:before": {
25
- content: '""',
26
- width: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
27
- height: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
28
- marginTop: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
29
- borderRadius: '50%',
30
- border: "solid ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")"), " ", _consts.DROP_TARGET_LINE_WIDTH, "px"),
31
- backgroundColor: "var(--ds-background-input, white)",
32
- display: 'block',
33
- position: 'absolute',
34
- bottom: "".concat(-(_consts.DROP_TARGET_CIRCLE_DIAMETER + _consts.DROP_TARGET_LINE_WIDTH) / 2, "px"),
35
- boxSizing: 'border-box'
36
- }
37
- });
38
- var styleDisabled = (0, _react2.css)({
39
- height: "var(--ds-space-100, 8px)",
40
- marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", _consts.DROP_TARGET_LINE_WIDTH, "px)"),
41
- position: 'relative',
42
- borderBottom: "solid transparent ".concat(_consts.DROP_TARGET_LINE_WIDTH, "px"),
43
- "&:before": {
44
- border: "solid transparent ".concat(_consts.DROP_TARGET_LINE_WIDTH, "px")
45
- }
17
+ marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", ")"),
18
+ position: 'relative'
46
19
  });
47
20
  var DropTarget = exports.DropTarget = function DropTarget(_ref) {
48
21
  var api = _ref.api,
@@ -91,8 +64,13 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref) {
91
64
  return (
92
65
  // Note: Firefox has trouble with using a button element as the handle for drag and drop
93
66
  (0, _react2.jsx)("div", {
94
- css: isDraggedOver ? styleHighlighted : styleDisabled,
67
+ css: styleDropTarget,
95
68
  ref: ref
96
- })
69
+ },
70
+ //4px gap to clear expand node border
71
+ isDraggedOver && (0, _react2.jsx)(_box.DropIndicator, {
72
+ edge: "bottom",
73
+ gap: "4px"
74
+ }))
97
75
  );
98
76
  };
@@ -1,6 +1,4 @@
1
1
  export const DRAG_HANDLE_HEIGHT = 24;
2
2
  export const DRAG_HANDLE_WIDTH = 12;
3
3
  export const DRAG_HANDLE_BORDER_RADIUS = 4;
4
- export const DRAG_HANDLE_NODE_GAP = 12;
5
- export const DROP_TARGET_LINE_WIDTH = 2;
6
- export const DROP_TARGET_CIRCLE_DIAMETER = 8;
4
+ export const DRAG_HANDLE_NODE_GAP = 12;
@@ -1,39 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
+ import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
4
5
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
- import { B300 } from '@atlaskit/theme/colors';
6
- import { DROP_TARGET_CIRCLE_DIAMETER, DROP_TARGET_LINE_WIDTH } from './consts';
7
- const styleHighlighted = css({
6
+ const styleDropTarget = css({
8
7
  height: "var(--ds-space-100, 8px)",
9
- marginTop: `calc(${"var(--ds-space-negative-100, -8px)"} - ${DROP_TARGET_LINE_WIDTH}px)`,
10
- marginLeft: "var(--ds-space-negative-100, -8px)",
11
- top: `calc(${"var(--ds-space-100, 8px)"} / 2 - 1px)`,
12
- //1px to help clear expand node margin
13
- position: 'relative',
14
- borderBottom: `solid ${`var(--ds-border-selected, ${B300})`} ${DROP_TARGET_LINE_WIDTH}px`,
15
- "&:before": {
16
- content: '""',
17
- width: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
18
- height: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
19
- marginTop: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
20
- borderRadius: '50%',
21
- border: `solid ${`var(--ds-border-selected, ${B300})`} ${DROP_TARGET_LINE_WIDTH}px`,
22
- backgroundColor: "var(--ds-background-input, white)",
23
- display: 'block',
24
- position: 'absolute',
25
- bottom: `${-(DROP_TARGET_CIRCLE_DIAMETER + DROP_TARGET_LINE_WIDTH) / 2}px`,
26
- boxSizing: 'border-box'
27
- }
28
- });
29
- const styleDisabled = css({
30
- height: "var(--ds-space-100, 8px)",
31
- marginTop: `calc(${"var(--ds-space-negative-100, -8px)"} - ${DROP_TARGET_LINE_WIDTH}px)`,
32
- position: 'relative',
33
- borderBottom: `solid transparent ${DROP_TARGET_LINE_WIDTH}px`,
34
- "&:before": {
35
- border: `solid transparent ${DROP_TARGET_LINE_WIDTH}px`
36
- }
8
+ marginTop: `calc(${"var(--ds-space-negative-100, -8px)"})`,
9
+ position: 'relative'
37
10
  });
38
11
  export const DropTarget = ({
39
12
  api,
@@ -76,8 +49,13 @@ export const DropTarget = ({
76
49
  return (
77
50
  // Note: Firefox has trouble with using a button element as the handle for drag and drop
78
51
  jsx("div", {
79
- css: isDraggedOver ? styleHighlighted : styleDisabled,
52
+ css: styleDropTarget,
80
53
  ref: ref
81
- })
54
+ },
55
+ //4px gap to clear expand node border
56
+ isDraggedOver && jsx(DropIndicator, {
57
+ edge: "bottom",
58
+ gap: "4px"
59
+ }))
82
60
  );
83
61
  };
@@ -1,6 +1,4 @@
1
1
  export var DRAG_HANDLE_HEIGHT = 24;
2
2
  export var DRAG_HANDLE_WIDTH = 12;
3
3
  export var DRAG_HANDLE_BORDER_RADIUS = 4;
4
- export var DRAG_HANDLE_NODE_GAP = 12;
5
- export var DROP_TARGET_LINE_WIDTH = 2;
6
- export var DROP_TARGET_CIRCLE_DIAMETER = 8;
4
+ export var DRAG_HANDLE_NODE_GAP = 12;
@@ -2,39 +2,12 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /** @jsx jsx */
3
3
  import { useEffect, useRef, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
+ import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
5
6
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
6
- import { B300 } from '@atlaskit/theme/colors';
7
- import { DROP_TARGET_CIRCLE_DIAMETER, DROP_TARGET_LINE_WIDTH } from './consts';
8
- var styleHighlighted = css({
7
+ var styleDropTarget = css({
9
8
  height: "var(--ds-space-100, 8px)",
10
- marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", DROP_TARGET_LINE_WIDTH, "px)"),
11
- marginLeft: "var(--ds-space-negative-100, -8px)",
12
- top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 1px)"),
13
- //1px to help clear expand node margin
14
- position: 'relative',
15
- borderBottom: "solid ".concat("var(--ds-border-selected, ".concat(B300, ")"), " ", DROP_TARGET_LINE_WIDTH, "px"),
16
- "&:before": {
17
- content: '""',
18
- width: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
19
- height: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
20
- marginTop: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
21
- borderRadius: '50%',
22
- border: "solid ".concat("var(--ds-border-selected, ".concat(B300, ")"), " ", DROP_TARGET_LINE_WIDTH, "px"),
23
- backgroundColor: "var(--ds-background-input, white)",
24
- display: 'block',
25
- position: 'absolute',
26
- bottom: "".concat(-(DROP_TARGET_CIRCLE_DIAMETER + DROP_TARGET_LINE_WIDTH) / 2, "px"),
27
- boxSizing: 'border-box'
28
- }
29
- });
30
- var styleDisabled = css({
31
- height: "var(--ds-space-100, 8px)",
32
- marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", DROP_TARGET_LINE_WIDTH, "px)"),
33
- position: 'relative',
34
- borderBottom: "solid transparent ".concat(DROP_TARGET_LINE_WIDTH, "px"),
35
- "&:before": {
36
- border: "solid transparent ".concat(DROP_TARGET_LINE_WIDTH, "px")
37
- }
9
+ marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", ")"),
10
+ position: 'relative'
38
11
  });
39
12
  export var DropTarget = function DropTarget(_ref) {
40
13
  var api = _ref.api,
@@ -83,8 +56,13 @@ export var DropTarget = function DropTarget(_ref) {
83
56
  return (
84
57
  // Note: Firefox has trouble with using a button element as the handle for drag and drop
85
58
  jsx("div", {
86
- css: isDraggedOver ? styleHighlighted : styleDisabled,
59
+ css: styleDropTarget,
87
60
  ref: ref
88
- })
61
+ },
62
+ //4px gap to clear expand node border
63
+ isDraggedOver && jsx(DropIndicator, {
64
+ edge: "bottom",
65
+ gap: "4px"
66
+ }))
89
67
  );
90
68
  };
@@ -2,5 +2,3 @@ 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_NODE_GAP = 12;
5
- export declare const DROP_TARGET_LINE_WIDTH = 2;
6
- export declare const DROP_TARGET_CIRCLE_DIAMETER = 8;
@@ -2,5 +2,3 @@ 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_NODE_GAP = 12;
5
- export declare const DROP_TARGET_LINE_WIDTH = 2;
6
- export declare const DROP_TARGET_CIRCLE_DIAMETER = 8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/editor-prosemirror": "4.0.1",
36
36
  "@atlaskit/icon": "^22.2.0",
37
37
  "@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
38
- "@atlaskit/theme": "^12.8.0",
38
+ "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
39
39
  "@atlaskit/tokens": "^1.48.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "@emotion/react": "^11.7.1"