@atlaskit/editor-plugin-block-controls 3.3.15 → 3.3.16

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
+ ## 3.3.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#127305](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127305)
8
+ [`d73df5795b977`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d73df5795b977) -
9
+ Fix range error
10
+
3
11
  ## 3.3.15
4
12
 
5
13
  ### Patch Changes
@@ -275,9 +275,15 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
275
275
  }
276
276
  }
277
277
  var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
278
-
279
- // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
280
- var shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
278
+ var shouldMoveNode = false;
279
+ if (moveToPos > -1 && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_2')) {
280
+ var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
281
+ var isSourceLayoutColumn = nodeType === 'layoutColumn';
282
+ shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
283
+ } else {
284
+ // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
285
+ shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_accessibility');
286
+ }
281
287
  var _expandSelectionBound = (0, _selection.expandSelectionBounds)($currentNodePos, selection.$to),
282
288
  $newAnchor = _expandSelectionBound.$anchor,
283
289
  $newHead = _expandSelectionBound.$head;
@@ -340,7 +346,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
340
346
  return function (_ref7) {
341
347
  var _api$blockControls$co;
342
348
  var tr = _ref7.tr;
343
- if (!api) {
349
+ if (!api || (start < 0 || to < 0) && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_2')) {
344
350
  return tr;
345
351
  }
346
352
  var handleNode = tr.doc.nodeAt(start);
@@ -275,9 +275,15 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
275
275
  }
276
276
  }
277
277
  const nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
278
-
279
- // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
280
- const shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
278
+ let shouldMoveNode = false;
279
+ if (moveToPos > -1 && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
280
+ const isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
281
+ const isSourceLayoutColumn = nodeType === 'layoutColumn';
282
+ shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && fg('platform_editor_advanced_layouts_accessibility');
283
+ } else {
284
+ // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
285
+ shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
286
+ }
281
287
  const {
282
288
  $anchor: $newAnchor,
283
289
  $head: $newHead
@@ -341,7 +347,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
341
347
  tr
342
348
  }) => {
343
349
  var _api$blockControls$co2;
344
- if (!api) {
350
+ if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
345
351
  return tr;
346
352
  }
347
353
  const handleNode = tr.doc.nodeAt(start);
@@ -269,9 +269,15 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
269
269
  }
270
270
  }
271
271
  var nodeType = (_state$doc$nodeAt = state.doc.nodeAt(currentNodePos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.type.name;
272
-
273
- // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
274
- var shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
272
+ var shouldMoveNode = false;
273
+ if (moveToPos > -1 && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
274
+ var isDestDepthSameAsSource = $currentNodePos.depth === state.doc.resolve(moveToPos).depth;
275
+ var isSourceLayoutColumn = nodeType === 'layoutColumn';
276
+ shouldMoveNode = (shouldEnableNestedDndA11y ? isDestDepthSameAsSource || isSourceLayoutColumn : true) || isSourceLayoutColumn && fg('platform_editor_advanced_layouts_accessibility');
277
+ } else {
278
+ // only move the node if the destination is at the same depth, not support moving a nested node to a parent node
279
+ shouldMoveNode = (shouldEnableNestedDndA11y ? moveToPos > -1 && $currentNodePos.depth === state.doc.resolve(moveToPos).depth || nodeType === 'layoutColumn' : moveToPos > -1) || nodeType === 'layoutColumn' && fg('platform_editor_advanced_layouts_accessibility');
280
+ }
275
281
  var _expandSelectionBound = expandSelectionBounds($currentNodePos, selection.$to),
276
282
  $newAnchor = _expandSelectionBound.$anchor,
277
283
  $newHead = _expandSelectionBound.$head;
@@ -334,7 +340,7 @@ export var moveNode = function moveNode(api) {
334
340
  return function (_ref7) {
335
341
  var _api$blockControls$co;
336
342
  var tr = _ref7.tr;
337
- if (!api) {
343
+ if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
338
344
  return tr;
339
345
  }
340
346
  var handleNode = tr.doc.nodeAt(start);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.3.15",
3
+ "version": "3.3.16",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^47.6.0",
36
- "@atlaskit/editor-common": "^102.9.0",
36
+ "@atlaskit/editor-common": "^102.10.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
39
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
@@ -169,6 +169,9 @@
169
169
  },
170
170
  "platform_editor_drag_layout_column_into_nodes": {
171
171
  "type": "boolean"
172
+ },
173
+ "platform_editor_elements_dnd_multi_select_patch_2": {
174
+ "type": "boolean"
172
175
  }
173
176
  }
174
177
  }