@atlaskit/editor-plugin-selection 2.2.6 → 2.2.7

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-selection
2
2
 
3
+ ## 2.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#163309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163309)
8
+ [`23a8b88475991`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/23a8b88475991) -
9
+ Clean up of FG platform_editor_fix_drag_and_drop_lists
10
+
3
11
  ## 2.2.6
4
12
 
5
13
  ### Patch Changes
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.onCreateSelectionBetween = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
8
  var DOC_START_POS = 0;
10
9
  function isNodeContentEmpty(maybeNode) {
11
10
  return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
@@ -52,23 +51,16 @@ function findNextSelectionPosition(_ref) {
52
51
 
53
52
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
54
53
  var maybeNode = null;
55
- if ((0, _platformFeatureFlags.fg)('platform_editor_fix_drag_and_drop_lists')) {
56
- // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
57
- // and $head which are based on a transformed document, but only provides the original
58
- // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
59
- if ($targetHead.pos >= doc.nodeSize) {
60
- maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
61
- } else if ($targetHead.pos !== DOC_START_POS) {
62
- var justBeforeHeadPos = $targetHead.pos - 1;
63
- var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
64
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
65
- }
66
- } else {
67
- if ($targetHead.pos !== DOC_START_POS) {
68
- var _justBeforeHeadPos = $targetHead.pos - 1;
69
- var _$resolvedJustBeforeHeadPos = doc.resolve(_justBeforeHeadPos);
70
- maybeNode = _$resolvedJustBeforeHeadPos.nodeAfter;
71
- }
54
+
55
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
56
+ // and $head which are based on a transformed document, but only provides the original
57
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
58
+ if ($targetHead.pos >= doc.nodeSize) {
59
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
60
+ } else if ($targetHead.pos !== DOC_START_POS) {
61
+ var justBeforeHeadPos = $targetHead.pos - 1;
62
+ var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
63
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
72
64
  }
73
65
  if (maybeNode === null) {
74
66
  maybeNode = $targetHead.nodeAfter;
@@ -1,5 +1,4 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  const DOC_START_POS = 0;
4
3
  function isNodeContentEmpty(maybeNode) {
5
4
  return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
@@ -49,23 +48,16 @@ function findNextSelectionPosition({
49
48
 
50
49
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
51
50
  let maybeNode = null;
52
- if (fg('platform_editor_fix_drag_and_drop_lists')) {
53
- // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
54
- // and $head which are based on a transformed document, but only provides the original
55
- // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
56
- if ($targetHead.pos >= doc.nodeSize) {
57
- maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
58
- } else if ($targetHead.pos !== DOC_START_POS) {
59
- const justBeforeHeadPos = $targetHead.pos - 1;
60
- const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
61
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
62
- }
63
- } else {
64
- if ($targetHead.pos !== DOC_START_POS) {
65
- const justBeforeHeadPos = $targetHead.pos - 1;
66
- const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
67
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
68
- }
51
+
52
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
53
+ // and $head which are based on a transformed document, but only provides the original
54
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
55
+ if ($targetHead.pos >= doc.nodeSize) {
56
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
57
+ } else if ($targetHead.pos !== DOC_START_POS) {
58
+ const justBeforeHeadPos = $targetHead.pos - 1;
59
+ const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
60
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
69
61
  }
70
62
  if (maybeNode === null) {
71
63
  maybeNode = $targetHead.nodeAfter;
@@ -1,5 +1,4 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  var DOC_START_POS = 0;
4
3
  function isNodeContentEmpty(maybeNode) {
5
4
  return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
@@ -46,23 +45,16 @@ function findNextSelectionPosition(_ref) {
46
45
 
47
46
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
48
47
  var maybeNode = null;
49
- if (fg('platform_editor_fix_drag_and_drop_lists')) {
50
- // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
51
- // and $head which are based on a transformed document, but only provides the original
52
- // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
53
- if ($targetHead.pos >= doc.nodeSize) {
54
- maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
55
- } else if ($targetHead.pos !== DOC_START_POS) {
56
- var justBeforeHeadPos = $targetHead.pos - 1;
57
- var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
58
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
59
- }
60
- } else {
61
- if ($targetHead.pos !== DOC_START_POS) {
62
- var _justBeforeHeadPos = $targetHead.pos - 1;
63
- var _$resolvedJustBeforeHeadPos = doc.resolve(_justBeforeHeadPos);
64
- maybeNode = _$resolvedJustBeforeHeadPos.nodeAfter;
65
- }
48
+
49
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
50
+ // and $head which are based on a transformed document, but only provides the original
51
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
52
+ if ($targetHead.pos >= doc.nodeSize) {
53
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
54
+ } else if ($targetHead.pos !== DOC_START_POS) {
55
+ var justBeforeHeadPos = $targetHead.pos - 1;
56
+ var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
57
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
66
58
  }
67
59
  if (maybeNode === null) {
68
60
  maybeNode = $targetHead.nodeAfter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,13 +20,13 @@
20
20
  "runReact18": true
21
21
  },
22
22
  "dependencies": {
23
- "@atlaskit/editor-common": "^106.0.0",
23
+ "@atlaskit/editor-common": "^106.1.0",
24
24
  "@atlaskit/editor-plugin-interaction": "^1.1.0",
25
25
  "@atlaskit/editor-prosemirror": "7.0.0",
26
26
  "@atlaskit/editor-shared-styles": "^3.4.0",
27
27
  "@atlaskit/editor-tables": "^2.9.0",
28
28
  "@atlaskit/platform-feature-flags": "^1.1.0",
29
- "@atlaskit/tmp-editor-statsig": "^5.2.0",
29
+ "@atlaskit/tmp-editor-statsig": "^5.6.0",
30
30
  "@atlaskit/tokens": "^4.9.0",
31
31
  "@babel/runtime": "^7.0.0"
32
32
  },
@@ -85,9 +85,6 @@
85
85
  "platform-editor-single-player-expand": {
86
86
  "type": "boolean"
87
87
  },
88
- "platform_editor_fix_drag_and_drop_lists": {
89
- "type": "boolean"
90
- },
91
88
  "platform_editor_nested_tables_gap_cursor": {
92
89
  "type": "boolean"
93
90
  },