@atlaskit/editor-plugin-block-controls 3.1.7 → 3.1.8

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.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#120895](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120895)
8
+ [`d38911e66c554`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d38911e66c554) -
9
+ Select nodes on drag
10
+
3
11
  ## 3.1.7
4
12
 
5
13
  ### Patch Changes
@@ -307,11 +307,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
307
307
  if (typeof handlePos !== 'number') {
308
308
  return tr;
309
309
  }
310
- if (!tr.selection.empty && handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to) {
310
+ var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
311
+ var newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
312
+ if (!tr.selection.empty && ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
311
313
  var _api$blockControls4;
312
314
  api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
313
315
  tr: tr
314
316
  });
317
+ } else if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_select_node_on_drag')) {
318
+ tr = (0, _getSelection.selectNode)(tr, handlePos, nodeType);
315
319
  }
316
320
  return tr;
317
321
  });
@@ -287,11 +287,15 @@ export const DragHandle = ({
287
287
  if (typeof handlePos !== 'number') {
288
288
  return tr;
289
289
  }
290
- if (!tr.selection.empty && handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to) {
290
+ const oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
291
+ const newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
292
+ if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
291
293
  var _api$blockControls4;
292
294
  api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.setMultiSelectPositions()({
293
295
  tr
294
296
  });
297
+ } else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
298
+ tr = selectNode(tr, handlePos, nodeType);
295
299
  }
296
300
  return tr;
297
301
  });
@@ -302,11 +302,15 @@ export var DragHandle = function DragHandle(_ref) {
302
302
  if (typeof handlePos !== 'number') {
303
303
  return tr;
304
304
  }
305
- if (!tr.selection.empty && handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to) {
305
+ var oldHandlePosCheck = handlePos >= tr.selection.$from.start() - 1 && handlePos <= tr.selection.to;
306
+ var newHandlePosCheck = handlePos >= (tr.selection.$from.depth ? tr.selection.$from.before() : tr.selection.from) && handlePos < tr.selection.to;
307
+ if (!tr.selection.empty && (fg('platform_editor_elements_dnd_multi_select_patch_1') ? newHandlePosCheck : oldHandlePosCheck)) {
306
308
  var _api$blockControls4;
307
309
  api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.setMultiSelectPositions()({
308
310
  tr: tr
309
311
  });
312
+ } else if (fg('platform_editor_elements_dnd_select_node_on_drag')) {
313
+ tr = selectNode(tr, handlePos, nodeType);
310
314
  }
311
315
  return tr;
312
316
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.1.7",
3
+ "version": "3.1.8",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -159,6 +159,9 @@
159
159
  },
160
160
  "platform_editor_elements_dnd_multi_select_patch_1": {
161
161
  "type": "boolean"
162
+ },
163
+ "platform_editor_elements_dnd_select_node_on_drag": {
164
+ "type": "boolean"
162
165
  }
163
166
  }
164
167
  }