@atlaskit/editor-plugin-block-controls 1.3.10 → 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,14 @@
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
+
3
12
  ## 1.3.10
4
13
 
5
14
  ### 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
  }
@@ -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';
@@ -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
  }
@@ -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';
@@ -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
  }
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "1.3.10",
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",