@atlaskit/editor-plugin-block-controls 2.4.1 → 2.5.0

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,17 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#151707](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151707)
8
+ [`e20a1b9e9ead0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e20a1b9e9ead0) -
9
+ ED-25277 1 Port "nest-media-and-codeblock-in-quote" changes in drop target v2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 2.4.1
4
16
 
5
17
  ### Patch Changes
@@ -120,6 +120,8 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
120
120
  return;
121
121
  }
122
122
 
123
+ // This should be moved to platform/packages/editor/editor-plugin-block-controls/src/utils/validation.ts
124
+ // Since we are moved to drop-target-v2
123
125
  // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
124
126
  if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
125
127
  var _api$blockControls;
@@ -8,6 +8,7 @@ exports.canMoveNodeToIndex = canMoveNodeToIndex;
8
8
  exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isExpand = exports.isDoc = void 0;
9
9
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
12
  var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
12
13
  var _nodeType$schema$node = nodeType.schema.nodes,
13
14
  tableCell = _nodeType$schema$node.tableCell,
@@ -70,6 +71,22 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
70
71
  });
71
72
  function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
72
73
  var srcNodeType = srcNode.type;
74
+ var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
75
+ var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
76
+
77
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
78
+ if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
79
+ if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
80
+ return false;
81
+ }
82
+ }
83
+
84
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
85
+ if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
86
+ if (parentNodeType === 'expand' && (activeNodeType === 'expand' || activeNodeType === 'nestedExpand')) {
87
+ return false;
88
+ }
89
+ }
73
90
  if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
74
91
  if (memoizedTransformExpandToNestedExpand(srcNode)) {
75
92
  srcNodeType = srcNodeType.schema.nodes.nestedExpand;
@@ -103,6 +103,8 @@ export const DropTarget = ({
103
103
  return;
104
104
  }
105
105
 
106
+ // This should be moved to platform/packages/editor/editor-plugin-block-controls/src/utils/validation.ts
107
+ // Since we are moved to drop-target-v2
106
108
  // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
107
109
  if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
108
110
  var _api$blockControls;
@@ -1,5 +1,6 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  export const isInsideTable = nodeType => {
4
5
  const {
5
6
  tableCell,
@@ -64,6 +65,22 @@ export const memoizedTransformExpandToNestedExpand = memoizeOne(node => {
64
65
  });
65
66
  export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
66
67
  let srcNodeType = srcNode.type;
68
+ const parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
69
+ const activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
70
+
71
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
72
+ if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
73
+ if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
79
+ if (editorExperiment('nested-expand-in-expand', false)) {
80
+ if (parentNodeType === 'expand' && (activeNodeType === 'expand' || activeNodeType === 'nestedExpand')) {
81
+ return false;
82
+ }
83
+ }
67
84
  if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
68
85
  if (memoizedTransformExpandToNestedExpand(srcNode)) {
69
86
  srcNodeType = srcNodeType.schema.nodes.nestedExpand;
@@ -112,6 +112,8 @@ export var DropTarget = function DropTarget(_ref3) {
112
112
  return;
113
113
  }
114
114
 
115
+ // This should be moved to platform/packages/editor/editor-plugin-block-controls/src/utils/validation.ts
116
+ // Since we are moved to drop-target-v2
115
117
  // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
116
118
  if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
117
119
  var _api$blockControls;
@@ -1,5 +1,6 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  export var isInsideTable = function isInsideTable(nodeType) {
4
5
  var _nodeType$schema$node = nodeType.schema.nodes,
5
6
  tableCell = _nodeType$schema$node.tableCell,
@@ -62,6 +63,22 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
62
63
  });
63
64
  export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode) {
64
65
  var srcNodeType = srcNode.type;
66
+ var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
67
+ var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
68
+
69
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
70
+ if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
71
+ if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
72
+ return false;
73
+ }
74
+ }
75
+
76
+ // Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
77
+ if (editorExperiment('nested-expand-in-expand', false)) {
78
+ if (parentNodeType === 'expand' && (activeNodeType === 'expand' || activeNodeType === 'nestedExpand')) {
79
+ return false;
80
+ }
81
+ }
65
82
  if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
66
83
  if (memoizedTransformExpandToNestedExpand(srcNode)) {
67
84
  srcNodeType = srcNodeType.schema.nodes.nestedExpand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
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
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/adf-schema": "^40.9.4",
34
- "@atlaskit/editor-common": "^93.3.0",
34
+ "@atlaskit/editor-common": "^93.4.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.9.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",