@atlaskit/editor-plugin-block-controls 8.10.1 → 8.10.3

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,24 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 8.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5d27d5dc155ff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5d27d5dc155ff) -
8
+ Editor-5020: Fix the column drop hint not visible inside sync block
9
+ - Updated dependencies
10
+
11
+ ## 8.10.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [`31ee998a097db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/31ee998a097db) -
16
+ Replace expValEquals/expValEqualsNoExposure with editorExperiment for platform_synced_block
17
+ experiment checks
18
+ - [`07a6b579ea15d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/07a6b579ea15d) -
19
+ remove unused dependencies
20
+ - Updated dependencies
21
+
3
22
  ## 8.10.1
4
23
 
5
24
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getActiveDropTargetDecorations = exports.canMoveNodeOrSliceToPos = void 0;
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
+ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
9
10
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
12
  var _decorationsCommon = require("./decorations-common");
@@ -211,23 +212,45 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
211
212
  pos: root.pos
212
213
  };
213
214
  }
215
+ var anchorEmitNodeWithPos = rootNodeWithPos;
214
216
  if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
215
- var _isSameLayout = $activeNodePos && (0, _validation.isInSameLayout)($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
217
+ if ((0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_synced_block_patch_6', 'isEnabled', true)) {
218
+ var schema = rootNodeWithPos.node.type.schema;
219
+ var layoutSection = schema.nodes.layoutSection;
220
+ var isLayoutSectionChildOfRoot = (0, _utils2.findChildrenByType)(rootNodeWithPos.node, layoutSection, false).length > 0;
221
+ if (isLayoutSectionChildOfRoot) {
222
+ // if node has layoutSection as a child, get the layoutSection node and pos
223
+ for (var ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
224
+ if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
225
+ anchorEmitNodeWithPos = {
226
+ node: $toPos.node(ancestorDepth),
227
+ pos: $toPos.before(ancestorDepth)
228
+ };
229
+ break;
230
+ }
231
+ }
232
+ } else {
233
+ anchorEmitNodeWithPos = rootNodeWithPos;
234
+ }
235
+ } else {
236
+ anchorEmitNodeWithPos = rootNodeWithPos;
237
+ }
238
+ var _isSameLayout = $activeNodePos && (0, _validation.isInSameLayout)($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
216
239
  var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && (0, _experiments.editorExperiment)('platform_synced_block', true);
217
- if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
218
- var layoutSectionNode = rootNodeWithPos.node;
240
+ if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
241
+ var layoutSectionNode = anchorEmitNodeWithPos.node;
219
242
  if (layoutSectionNode.childCount < (0, _consts.maxLayoutColumnSupported)() || _isSameLayout) {
220
243
  layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
221
244
  if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
222
245
  ) {
223
- var currentPos = rootNodeWithPos.pos + childPos + 1;
246
+ var currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
224
247
  if (existingDecsPos.includes(currentPos)) {
225
248
  // if the decoration already exists, we don't add it again.
226
249
  decsToRemove = decsToRemove.filter(function (dec) {
227
250
  return dec.from !== currentPos;
228
251
  });
229
252
  } else {
230
- decsToAdd.push((0, _decorationsDropTarget.createLayoutDropTargetDecoration)(rootNodeWithPos.pos + childPos + 1, {
253
+ decsToAdd.push((0, _decorationsDropTarget.createLayoutDropTargetDecoration)(anchorEmitNodeWithPos.pos + childPos + 1, {
231
254
  api: api,
232
255
  parent: parent,
233
256
  formatMessage: formatMessage
@@ -239,7 +262,7 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
239
262
  }
240
263
  }
241
264
  }
242
- _activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : (0, _decorationsCommon.getNodeAnchor)(rootNodeWithPos.node));
265
+ _activeAnchorTracker.defaultActiveAnchorTracker.emit((0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : (0, _decorationsCommon.getNodeAnchor)(anchorEmitNodeWithPos.node));
243
266
  return {
244
267
  decsToAdd: decsToAdd,
245
268
  decsToRemove: decsToRemove
@@ -643,7 +643,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref3) {
643
643
  tr: tr
644
644
  });
645
645
  var rootPos = (0, _experiments.editorExperiment)('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
646
- var triggerByNode = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? {
646
+ var triggerByNode = (0, _experiments.editorExperiment)('platform_synced_block', true) ? {
647
647
  nodeType: nodeType,
648
648
  pos: startPos,
649
649
  rootPos: rootPos
@@ -1,5 +1,6 @@
1
1
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
2
2
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
+ import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { getNodeAnchor } from './decorations-common';
@@ -194,21 +195,45 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
194
195
  pos: root.pos
195
196
  };
196
197
  }
198
+ let anchorEmitNodeWithPos = rootNodeWithPos;
197
199
  if (editorExperiment('advanced_layouts', true)) {
198
- const isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
200
+ if (expValEquals('platform_synced_block', 'isEnabled', true) && expValEquals('platform_synced_block_patch_6', 'isEnabled', true)) {
201
+ const schema = rootNodeWithPos.node.type.schema;
202
+ const {
203
+ layoutSection
204
+ } = schema.nodes;
205
+ const isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
206
+ if (isLayoutSectionChildOfRoot) {
207
+ // if node has layoutSection as a child, get the layoutSection node and pos
208
+ for (let ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
209
+ if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
210
+ anchorEmitNodeWithPos = {
211
+ node: $toPos.node(ancestorDepth),
212
+ pos: $toPos.before(ancestorDepth)
213
+ };
214
+ break;
215
+ }
216
+ }
217
+ } else {
218
+ anchorEmitNodeWithPos = rootNodeWithPos;
219
+ }
220
+ } else {
221
+ anchorEmitNodeWithPos = rootNodeWithPos;
222
+ }
223
+ const isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
199
224
  const hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && editorExperiment('platform_synced_block', true);
200
- if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
201
- const layoutSectionNode = rootNodeWithPos.node;
225
+ if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
226
+ const layoutSectionNode = anchorEmitNodeWithPos.node;
202
227
  if (layoutSectionNode.childCount < maxLayoutColumnSupported() || isSameLayout) {
203
228
  layoutSectionNode.descendants((childNode, childPos, parent, index) => {
204
229
  if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
205
230
  ) {
206
- const currentPos = rootNodeWithPos.pos + childPos + 1;
231
+ const currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
207
232
  if (existingDecsPos.includes(currentPos)) {
208
233
  // if the decoration already exists, we don't add it again.
209
234
  decsToRemove = decsToRemove.filter(dec => dec.from !== currentPos);
210
235
  } else {
211
- decsToAdd.push(createLayoutDropTargetDecoration(rootNodeWithPos.pos + childPos + 1, {
236
+ decsToAdd.push(createLayoutDropTargetDecoration(anchorEmitNodeWithPos.pos + childPos + 1, {
212
237
  api,
213
238
  parent,
214
239
  formatMessage
@@ -220,7 +245,7 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
220
245
  }
221
246
  }
222
247
  }
223
- defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : getNodeAnchor(rootNodeWithPos.node));
248
+ defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : getNodeAnchor(anchorEmitNodeWithPos.node));
224
249
  return {
225
250
  decsToAdd,
226
251
  decsToRemove
@@ -623,7 +623,7 @@ export const DragHandle = ({
623
623
  tr
624
624
  });
625
625
  const rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
626
- const triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
626
+ const triggerByNode = editorExperiment('platform_synced_block', true) ? {
627
627
  nodeType,
628
628
  pos: startPos,
629
629
  rootPos
@@ -1,5 +1,6 @@
1
1
  import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
2
2
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
+ import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { getNodeAnchor } from './decorations-common';
@@ -206,23 +207,45 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
206
207
  pos: root.pos
207
208
  };
208
209
  }
210
+ var anchorEmitNodeWithPos = rootNodeWithPos;
209
211
  if (editorExperiment('advanced_layouts', true)) {
210
- var _isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(rootNodeWithPos.pos));
212
+ if (expValEquals('platform_synced_block', 'isEnabled', true) && expValEquals('platform_synced_block_patch_6', 'isEnabled', true)) {
213
+ var schema = rootNodeWithPos.node.type.schema;
214
+ var layoutSection = schema.nodes.layoutSection;
215
+ var isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
216
+ if (isLayoutSectionChildOfRoot) {
217
+ // if node has layoutSection as a child, get the layoutSection node and pos
218
+ for (var ancestorDepth = $toPos.depth; ancestorDepth >= 1; ancestorDepth--) {
219
+ if ($toPos.node(ancestorDepth).type.name === 'layoutSection') {
220
+ anchorEmitNodeWithPos = {
221
+ node: $toPos.node(ancestorDepth),
222
+ pos: $toPos.before(ancestorDepth)
223
+ };
224
+ break;
225
+ }
226
+ }
227
+ } else {
228
+ anchorEmitNodeWithPos = rootNodeWithPos;
229
+ }
230
+ } else {
231
+ anchorEmitNodeWithPos = rootNodeWithPos;
232
+ }
233
+ var _isSameLayout = $activeNodePos && isInSameLayout($activeNodePos, state.doc.resolve(anchorEmitNodeWithPos.pos));
211
234
  var hasUnsupportedContent = UNSUPPORTED_LAYOUT_CONTENT.includes((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) || '') && editorExperiment('platform_synced_block', true);
212
- if (rootNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
213
- var layoutSectionNode = rootNodeWithPos.node;
235
+ if (anchorEmitNodeWithPos.node.type.name === 'layoutSection' && !hasUnsupportedContent) {
236
+ var layoutSectionNode = anchorEmitNodeWithPos.node;
214
237
  if (layoutSectionNode.childCount < maxLayoutColumnSupported() || _isSameLayout) {
215
238
  layoutSectionNode.descendants(function (childNode, childPos, parent, index) {
216
239
  if (childNode.type.name === 'layoutColumn' && (parent === null || parent === void 0 ? void 0 : parent.type.name) === 'layoutSection' && index !== 0 // Not the first node
217
240
  ) {
218
- var currentPos = rootNodeWithPos.pos + childPos + 1;
241
+ var currentPos = anchorEmitNodeWithPos.pos + childPos + 1;
219
242
  if (existingDecsPos.includes(currentPos)) {
220
243
  // if the decoration already exists, we don't add it again.
221
244
  decsToRemove = decsToRemove.filter(function (dec) {
222
245
  return dec.from !== currentPos;
223
246
  });
224
247
  } else {
225
- decsToAdd.push(createLayoutDropTargetDecoration(rootNodeWithPos.pos + childPos + 1, {
248
+ decsToAdd.push(createLayoutDropTargetDecoration(anchorEmitNodeWithPos.pos + childPos + 1, {
226
249
  api: api,
227
250
  parent: parent,
228
251
  formatMessage: formatMessage
@@ -234,7 +257,7 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
234
257
  }
235
258
  }
236
259
  }
237
- defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(rootNodeWithPos.node, rootNodeWithPos.pos) || '' : getNodeAnchor(rootNodeWithPos.node));
260
+ defaultActiveAnchorTracker.emit(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? api.core.actions.getAnchorIdForNode(anchorEmitNodeWithPos.node, anchorEmitNodeWithPos.pos) || '' : getNodeAnchor(anchorEmitNodeWithPos.node));
238
261
  return {
239
262
  decsToAdd: decsToAdd,
240
263
  decsToRemove: decsToRemove
@@ -640,7 +640,7 @@ export var DragHandle = function DragHandle(_ref3) {
640
640
  tr: tr
641
641
  });
642
642
  var rootPos = editorExperiment('platform_synced_block', true) ? tr.doc.resolve(startPos).before(1) : undefined;
643
- var triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
643
+ var triggerByNode = editorExperiment('platform_synced_block', true) ? {
644
644
  nodeType: nodeType,
645
645
  pos: startPos,
646
646
  rootPos: rootPos
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "8.10.1",
3
+ "version": "8.10.3",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,6 @@
28
28
  ],
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^52.2.0",
32
31
  "@atlaskit/browser-apis": "^0.0.1",
33
32
  "@atlaskit/button": "^23.10.0",
34
33
  "@atlaskit/editor-plugin-accessibility-utils": "^7.0.0",
@@ -39,7 +38,7 @@
39
38
  "@atlaskit/editor-plugin-interaction": "^14.0.0",
40
39
  "@atlaskit/editor-plugin-limited-mode": "^4.0.0",
41
40
  "@atlaskit/editor-plugin-metrics": "^8.0.0",
42
- "@atlaskit/editor-plugin-quick-insert": "^7.4.0",
41
+ "@atlaskit/editor-plugin-quick-insert": "^7.5.0",
43
42
  "@atlaskit/editor-plugin-selection": "^7.0.0",
44
43
  "@atlaskit/editor-plugin-toolbar": "^4.1.0",
45
44
  "@atlaskit/editor-plugin-type-ahead": "^7.0.0",
@@ -57,7 +56,7 @@
57
56
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
58
57
  "@atlaskit/primitives": "^18.0.0",
59
58
  "@atlaskit/theme": "^22.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^34.0.0",
59
+ "@atlaskit/tmp-editor-statsig": "^35.2.0",
61
60
  "@atlaskit/tokens": "^11.0.0",
62
61
  "@atlaskit/tooltip": "^20.14.0",
63
62
  "@babel/runtime": "^7.0.0",
@@ -68,7 +67,7 @@
68
67
  "uuid": "^3.1.0"
69
68
  },
70
69
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^111.28.0",
70
+ "@atlaskit/editor-common": "^111.30.0",
72
71
  "react": "^18.2.0",
73
72
  "react-dom": "^18.2.0",
74
73
  "react-intl-next": "npm:react-intl@^5.18.1"