@atlaskit/editor-plugin-block-controls 1.3.9 → 1.3.11

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
+ ## 1.3.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#100944](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100944)
8
+ [`236b42e205dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/236b42e205dd) -
9
+ Fix drag handle position on media node
10
+ - Updated dependencies
11
+
12
+ ## 1.3.10
13
+
14
+ ### Patch Changes
15
+
16
+ - [#100964](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100964)
17
+ [`d58e7d6f08e4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d58e7d6f08e4) -
18
+ [ux] Tweak CSS styles for drop targets
19
+
3
20
  ## 1.3.9
4
21
 
5
22
  ### Patch Changes
@@ -68,7 +68,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
68
68
  element.style.zIndex = '1';
69
69
  var resizer = meta.dom.querySelector('.resizer-item');
70
70
  if (resizer) {
71
- element.style.left = "".concat(resizer.offsetLeft - parseInt(getComputedStyle(resizer).marginLeft) - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px");
71
+ element.style.left = getComputedStyle(resizer).transform === 'none' ? "".concat(resizer.offsetLeft - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px") : "".concat(resizer.offsetLeft - resizer.offsetWidth / 2 - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px");
72
72
  } else {
73
73
  element.style.left = "".concat(meta.dom.offsetLeft - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px");
74
74
  }
@@ -7,6 +7,6 @@ exports.DROP_TARGET_LINE_WIDTH = exports.DROP_TARGET_CIRCLE_DIAMETER = exports.D
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;
10
11
  var DROP_TARGET_LINE_WIDTH = exports.DROP_TARGET_LINE_WIDTH = 2;
11
- var DROP_TARGET_CIRCLE_DIAMETER = exports.DROP_TARGET_CIRCLE_DIAMETER = 4;
12
- var DRAG_HANDLE_NODE_GAP = exports.DRAG_HANDLE_NODE_GAP = 12;
12
+ var DROP_TARGET_CIRCLE_DIAMETER = exports.DROP_TARGET_CIRCLE_DIAMETER = 8;
@@ -12,7 +12,8 @@ var dragPreview = exports.dragPreview = function dragPreview(container, domRef)
12
12
  var parent = document.createElement('div');
13
13
  // ProseMirror class is required to make sure the cloned dom is styled correctly
14
14
  parent.classList.add('ProseMirror');
15
- var clonedDom = domRef.current.cloneNode(true);
15
+ var resizer = domRef.current.querySelector('.resizer-item');
16
+ var clonedDom = resizer ? resizer.cloneNode(true) : domRef.current.cloneNode(true);
16
17
 
17
18
  // Remove any margin from the cloned element to ensure is doesn't position incorrectly
18
19
  clonedDom.style.marginLeft = '0';
@@ -17,21 +17,22 @@ var styleHighlighted = (0, _react2.css)({
17
17
  height: "var(--ds-space-100, 8px)",
18
18
  marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", _consts.DROP_TARGET_LINE_WIDTH, "px)"),
19
19
  marginLeft: "var(--ds-space-negative-100, -8px)",
20
- top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 2.5px)"),
21
- //2.5px to help clear expand node margin
20
+ top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 1px)"),
21
+ //1px to help clear expand node margin
22
22
  position: 'relative',
23
23
  borderBottom: "solid ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")"), " ", _consts.DROP_TARGET_LINE_WIDTH, "px"),
24
24
  "&:before": {
25
25
  content: '""',
26
26
  width: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
27
27
  height: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
28
- marginTop: "calc(".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, " + ").concat(_consts.DROP_TARGET_LINE_WIDTH, " * 2)px"),
28
+ marginTop: "".concat(_consts.DROP_TARGET_CIRCLE_DIAMETER, "px"),
29
29
  borderRadius: '50%',
30
30
  border: "solid ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")"), " ", _consts.DROP_TARGET_LINE_WIDTH, "px"),
31
31
  backgroundColor: "var(--ds-background-input, white)",
32
32
  display: 'block',
33
33
  position: 'absolute',
34
- bottom: '-5px'
34
+ bottom: "".concat(-(_consts.DROP_TARGET_CIRCLE_DIAMETER + _consts.DROP_TARGET_LINE_WIDTH) / 2, "px"),
35
+ boxSizing: 'border-box'
35
36
  }
36
37
  });
37
38
  var styleDisabled = (0, _react2.css)({
@@ -61,7 +61,7 @@ export const dragHandleDecoration = (oldState, meta, api) => {
61
61
  element.style.zIndex = '1';
62
62
  const resizer = meta.dom.querySelector('.resizer-item');
63
63
  if (resizer) {
64
- element.style.left = `${resizer.offsetLeft - parseInt(getComputedStyle(resizer).marginLeft) - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px`;
64
+ element.style.left = getComputedStyle(resizer).transform === 'none' ? `${resizer.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px` : `${resizer.offsetLeft - resizer.offsetWidth / 2 - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px`;
65
65
  } else {
66
66
  element.style.left = `${meta.dom.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px`;
67
67
  }
@@ -1,6 +1,6 @@
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;
4
5
  export const DROP_TARGET_LINE_WIDTH = 2;
5
- export const DROP_TARGET_CIRCLE_DIAMETER = 4;
6
- export const DRAG_HANDLE_NODE_GAP = 12;
6
+ export const DROP_TARGET_CIRCLE_DIAMETER = 8;
@@ -6,7 +6,8 @@ export const dragPreview = (container, domRef) => {
6
6
  const parent = document.createElement('div');
7
7
  // ProseMirror class is required to make sure the cloned dom is styled correctly
8
8
  parent.classList.add('ProseMirror');
9
- const clonedDom = domRef.current.cloneNode(true);
9
+ const resizer = domRef.current.querySelector('.resizer-item');
10
+ const clonedDom = resizer ? resizer.cloneNode(true) : domRef.current.cloneNode(true);
10
11
 
11
12
  // Remove any margin from the cloned element to ensure is doesn't position incorrectly
12
13
  clonedDom.style.marginLeft = '0';
@@ -8,21 +8,22 @@ const styleHighlighted = css({
8
8
  height: "var(--ds-space-100, 8px)",
9
9
  marginTop: `calc(${"var(--ds-space-negative-100, -8px)"} - ${DROP_TARGET_LINE_WIDTH}px)`,
10
10
  marginLeft: "var(--ds-space-negative-100, -8px)",
11
- top: `calc(${"var(--ds-space-100, 8px)"} / 2 - 2.5px)`,
12
- //2.5px to help clear expand node margin
11
+ top: `calc(${"var(--ds-space-100, 8px)"} / 2 - 1px)`,
12
+ //1px to help clear expand node margin
13
13
  position: 'relative',
14
14
  borderBottom: `solid ${`var(--ds-border-selected, ${B300})`} ${DROP_TARGET_LINE_WIDTH}px`,
15
15
  "&:before": {
16
16
  content: '""',
17
17
  width: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
18
18
  height: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
19
- marginTop: `calc(${DROP_TARGET_CIRCLE_DIAMETER} + ${DROP_TARGET_LINE_WIDTH} * 2)px`,
19
+ marginTop: `${DROP_TARGET_CIRCLE_DIAMETER}px`,
20
20
  borderRadius: '50%',
21
21
  border: `solid ${`var(--ds-border-selected, ${B300})`} ${DROP_TARGET_LINE_WIDTH}px`,
22
22
  backgroundColor: "var(--ds-background-input, white)",
23
23
  display: 'block',
24
24
  position: 'absolute',
25
- bottom: '-5px'
25
+ bottom: `${-(DROP_TARGET_CIRCLE_DIAMETER + DROP_TARGET_LINE_WIDTH) / 2}px`,
26
+ boxSizing: 'border-box'
26
27
  }
27
28
  });
28
29
  const styleDisabled = css({
@@ -61,7 +61,7 @@ export var dragHandleDecoration = function dragHandleDecoration(oldState, meta,
61
61
  element.style.zIndex = '1';
62
62
  var resizer = meta.dom.querySelector('.resizer-item');
63
63
  if (resizer) {
64
- element.style.left = "".concat(resizer.offsetLeft - parseInt(getComputedStyle(resizer).marginLeft) - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px");
64
+ element.style.left = getComputedStyle(resizer).transform === 'none' ? "".concat(resizer.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px") : "".concat(resizer.offsetLeft - resizer.offsetWidth / 2 - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px");
65
65
  } else {
66
66
  element.style.left = "".concat(meta.dom.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px");
67
67
  }
@@ -1,6 +1,6 @@
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;
4
5
  export var DROP_TARGET_LINE_WIDTH = 2;
5
- export var DROP_TARGET_CIRCLE_DIAMETER = 4;
6
- export var DRAG_HANDLE_NODE_GAP = 12;
6
+ export var DROP_TARGET_CIRCLE_DIAMETER = 8;
@@ -6,7 +6,8 @@ export var dragPreview = function dragPreview(container, domRef) {
6
6
  var parent = document.createElement('div');
7
7
  // ProseMirror class is required to make sure the cloned dom is styled correctly
8
8
  parent.classList.add('ProseMirror');
9
- var clonedDom = domRef.current.cloneNode(true);
9
+ var resizer = domRef.current.querySelector('.resizer-item');
10
+ var clonedDom = resizer ? resizer.cloneNode(true) : domRef.current.cloneNode(true);
10
11
 
11
12
  // Remove any margin from the cloned element to ensure is doesn't position incorrectly
12
13
  clonedDom.style.marginLeft = '0';
@@ -9,21 +9,22 @@ var styleHighlighted = css({
9
9
  height: "var(--ds-space-100, 8px)",
10
10
  marginTop: "calc(".concat("var(--ds-space-negative-100, -8px)", " - ", DROP_TARGET_LINE_WIDTH, "px)"),
11
11
  marginLeft: "var(--ds-space-negative-100, -8px)",
12
- top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 2.5px)"),
13
- //2.5px to help clear expand node margin
12
+ top: "calc(".concat("var(--ds-space-100, 8px)", " / 2 - 1px)"),
13
+ //1px to help clear expand node margin
14
14
  position: 'relative',
15
15
  borderBottom: "solid ".concat("var(--ds-border-selected, ".concat(B300, ")"), " ", DROP_TARGET_LINE_WIDTH, "px"),
16
16
  "&:before": {
17
17
  content: '""',
18
18
  width: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
19
19
  height: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
20
- marginTop: "calc(".concat(DROP_TARGET_CIRCLE_DIAMETER, " + ").concat(DROP_TARGET_LINE_WIDTH, " * 2)px"),
20
+ marginTop: "".concat(DROP_TARGET_CIRCLE_DIAMETER, "px"),
21
21
  borderRadius: '50%',
22
22
  border: "solid ".concat("var(--ds-border-selected, ".concat(B300, ")"), " ", DROP_TARGET_LINE_WIDTH, "px"),
23
23
  backgroundColor: "var(--ds-background-input, white)",
24
24
  display: 'block',
25
25
  position: 'absolute',
26
- bottom: '-5px'
26
+ bottom: "".concat(-(DROP_TARGET_CIRCLE_DIAMETER + DROP_TARGET_LINE_WIDTH) / 2, "px"),
27
+ boxSizing: 'border-box'
27
28
  }
28
29
  });
29
30
  var styleDisabled = css({
@@ -1,6 +1,6 @@
1
1
  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
- export declare const DROP_TARGET_LINE_WIDTH = 2;
5
- export declare const DROP_TARGET_CIRCLE_DIAMETER = 4;
6
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;
@@ -1,6 +1,6 @@
1
1
  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
- export declare const DROP_TARGET_LINE_WIDTH = 2;
5
- export declare const DROP_TARGET_CIRCLE_DIAMETER = 4;
6
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.9",
3
+ "version": "1.3.11",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^80.3.0",
34
+ "@atlaskit/editor-common": "^80.4.0",
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",