@atlaskit/editor-plugin-block-controls 7.7.0 → 7.7.1

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,12 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 7.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`27d4ba93d0702`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/27d4ba93d0702) -
8
+ EDITOR-3201 disable layout drop targets for sync blocks
9
+
3
10
  ## 7.7.0
4
11
 
5
12
  ### Minor Changes
@@ -24,6 +24,7 @@ var PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [].concat(PARENT_WITH_END_DROP_TARG
24
24
  * List of node types that does not allow drop targets at before or after the node.
25
25
  */
26
26
  var NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
27
+ var UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
27
28
  var isContainerNode = function isContainerNode(node) {
28
29
  if ((0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true)) {
29
30
  return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
@@ -212,7 +213,8 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
212
213
  }
213
214
  if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
214
215
  var _isSameLayout = $activeNodePos && (0, _validation.isInSameLayout)($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
215
- if (rootNodeWithPos.node.type.name === 'layoutSection') {
216
+ var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true);
217
+ if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
216
218
  var layoutSectionNode = rootNodeWithPos.node;
217
219
  if (layoutSectionNode.childCount < (0, _consts.maxLayoutColumnSupported)() || _isSameLayout) {
218
220
  layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.shouldAllowInlineDropTarget = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
9
10
  var _checkMediaLayout = require("./check-media-layout");
10
11
  var _consts = require("./consts");
12
+ var syncedBlockTypes = ['syncBlock', 'bodiedSyncBlock'];
11
13
  var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
12
14
  var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
13
15
  var activeNode = arguments.length > 3 ? arguments[3] : undefined;
@@ -20,6 +22,9 @@ var shouldAllowInlineDropTarget = exports.shouldAllowInlineDropTarget = function
20
22
  if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
21
23
  return false;
22
24
  }
25
+ if ((syncedBlockTypes.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') || syncedBlockTypes.includes((node === null || node === void 0 ? void 0 : node.type.name) || '')) && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true)) {
26
+ return false;
27
+ }
23
28
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
24
29
  return node.childCount < (0, _consts.maxLayoutColumnSupported)() || isSameLayout;
25
30
  }
@@ -19,6 +19,7 @@ const PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [...PARENT_WITH_END_DROP_TARGET,
19
19
  * List of node types that does not allow drop targets at before or after the node.
20
20
  */
21
21
  const NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
22
+ const UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
22
23
  const isContainerNode = node => {
23
24
  if (expValEquals('platform_synced_block', 'isEnabled', true)) {
24
25
  return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
@@ -195,7 +196,8 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
195
196
  }
196
197
  if (editorExperiment('advanced_layouts', true)) {
197
198
  const isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
198
- if (rootNodeWithPos.node.type.name === 'layoutSection') {
199
+ const hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && expValEquals('platform_synced_block', 'isEnabled', true);
200
+ if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
199
201
  const layoutSectionNode = rootNodeWithPos.node;
200
202
  if (layoutSectionNode.childCount < maxLayoutColumnSupported() || isSameLayout) {
201
203
  layoutSectionNode.descendants((childNode, childPos, parent, index) => {
@@ -1,7 +1,9 @@
1
1
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { isWrappedMedia } from './check-media-layout';
4
5
  import { maxLayoutColumnSupported } from './consts';
6
+ const syncedBlockTypes = ['syncBlock', 'bodiedSyncBlock'];
5
7
  export const shouldAllowInlineDropTarget = (isNested, node,
6
8
  /**
7
9
  * Is the active node in the same layout as the target node
@@ -16,6 +18,9 @@ isSameLayout = false, activeNode) => {
16
18
  if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
17
19
  return false;
18
20
  }
21
+ if ((syncedBlockTypes.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') || syncedBlockTypes.includes((node === null || node === void 0 ? void 0 : node.type.name) || '')) && expValEquals('platform_synced_block', 'isEnabled', true)) {
22
+ return false;
23
+ }
19
24
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
20
25
  return node.childCount < maxLayoutColumnSupported() || isSameLayout;
21
26
  }
@@ -19,6 +19,7 @@ var PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK = [].concat(PARENT_WITH_END_DROP_TARG
19
19
  * List of node types that does not allow drop targets at before or after the node.
20
20
  */
21
21
  var NODE_WITH_NO_PARENT_POS = ['tableCell', 'tableHeader', 'layoutColumn'];
22
+ var UNSUPPORTED_LAYOUT_CONTENT = ['syncBlock', 'bodiedSyncBlock'];
22
23
  var isContainerNode = function isContainerNode(node) {
23
24
  if (expValEquals('platform_synced_block', 'isEnabled', true)) {
24
25
  return PARENT_WITH_END_DROP_TARGET_SYNC_BLOCK.includes(node.type.name);
@@ -207,7 +208,8 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
207
208
  }
208
209
  if (editorExperiment('advanced_layouts', true)) {
209
210
  var _isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
210
- if (rootNodeWithPos.node.type.name === 'layoutSection') {
211
+ var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && expValEquals('platform_synced_block', 'isEnabled', true);
212
+ if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
211
213
  var layoutSectionNode = rootNodeWithPos.node;
212
214
  if (layoutSectionNode.childCount < maxLayoutColumnSupported() || _isSameLayout) {
213
215
  layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
@@ -1,7 +1,9 @@
1
1
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { isWrappedMedia } from './check-media-layout';
4
5
  import { maxLayoutColumnSupported } from './consts';
6
+ var syncedBlockTypes = ['syncBlock', 'bodiedSyncBlock'];
5
7
  export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
6
8
  var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7
9
  var activeNode = arguments.length > 3 ? arguments[3] : undefined;
@@ -14,6 +16,9 @@ export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(is
14
16
  if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
15
17
  return false;
16
18
  }
19
+ if ((syncedBlockTypes.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') || syncedBlockTypes.includes((node === null || node === void 0 ? void 0 : node.type.name) || '')) && expValEquals('platform_synced_block', 'isEnabled', true)) {
20
+ return false;
21
+ }
17
22
  if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
18
23
  return node.childCount < maxLayoutColumnSupported() || isSameLayout;
19
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "7.7.0",
3
+ "version": "7.7.1",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",