@atlaskit/editor-plugin-block-controls 2.13.21 → 2.13.22

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
+ ## 2.13.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#167184](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167184)
8
+ [`2b558a2fe0420`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2b558a2fe0420) -
9
+ ED-25780 Layout column drag handle is not shown for macros and empty code snippet
10
+
3
11
  ## 2.13.21
4
12
 
5
13
  ### Patch Changes
@@ -14,13 +14,19 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
14
14
  }
15
15
  return false;
16
16
  };
17
+ var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
18
+ if (node && node.type.name === 'paragraph') {
19
+ var _node$firstChild;
20
+ return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
21
+ }
22
+ return false;
23
+ };
17
24
  var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
18
25
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
19
26
  var foundNonEmptyNode = false;
20
27
  for (var i = 0; i < node.childCount; i++) {
21
- var _child$firstChild;
22
28
  var child = node.child(i);
23
- if (child.content.size && ((_child$firstChild = child.firstChild) === null || _child$firstChild === void 0 ? void 0 : _child$firstChild.type.name) !== 'placeholder') {
29
+ if (!isEmptyParagraphOrPlaceholder(child)) {
24
30
  foundNonEmptyNode = true;
25
31
  break;
26
32
  }
@@ -8,13 +8,19 @@ const isEmptyNestedParagraphOrHeading = target => {
8
8
  }
9
9
  return false;
10
10
  };
11
+ const isEmptyParagraphOrPlaceholder = node => {
12
+ if (node && node.type.name === 'paragraph') {
13
+ var _node$firstChild;
14
+ return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
15
+ }
16
+ return false;
17
+ };
11
18
  const isLayoutColumnWithoutContent = node => {
12
19
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
13
20
  let foundNonEmptyNode = false;
14
21
  for (let i = 0; i < node.childCount; i++) {
15
- var _child$firstChild;
16
22
  const child = node.child(i);
17
- if (child.content.size && ((_child$firstChild = child.firstChild) === null || _child$firstChild === void 0 ? void 0 : _child$firstChild.type.name) !== 'placeholder') {
23
+ if (!isEmptyParagraphOrPlaceholder(child)) {
18
24
  foundNonEmptyNode = true;
19
25
  break;
20
26
  }
@@ -8,13 +8,19 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
8
8
  }
9
9
  return false;
10
10
  };
11
+ var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
12
+ if (node && node.type.name === 'paragraph') {
13
+ var _node$firstChild;
14
+ return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
15
+ }
16
+ return false;
17
+ };
11
18
  var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
12
19
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
13
20
  var foundNonEmptyNode = false;
14
21
  for (var i = 0; i < node.childCount; i++) {
15
- var _child$firstChild;
16
22
  var child = node.child(i);
17
- if (child.content.size && ((_child$firstChild = child.firstChild) === null || _child$firstChild === void 0 ? void 0 : _child$firstChild.type.name) !== 'placeholder') {
23
+ if (!isEmptyParagraphOrPlaceholder(child)) {
18
24
  foundNonEmptyNode = true;
19
25
  break;
20
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.13.21",
3
+ "version": "2.13.22",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",