@atlaskit/editor-plugin-selection 30.0.8 → 30.0.10

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,20 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 30.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 30.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [`cbe7f7f57f1c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cbe7f7f57f1c6) -
14
+ EDITOR-10030: Behind the `platform_editor_improve_inp_batch_2` experiment, the gap cursor click
15
+ handler checks for ignored clicks before calling `posAtCoords`, so ignored clicks no longer force
16
+ a synchronous layout.
17
+
3
18
  ## 30.0.8
4
19
 
5
20
  ### Patch Changes
@@ -12,6 +12,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _utils = require("@atlaskit/editor-prosemirror/utils");
13
13
  var _view2 = require("@atlaskit/editor-prosemirror/view");
14
14
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
15
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
15
16
  var _types = require("../types");
16
17
  var _gapCursorPluginKey = require("./gap-cursor-plugin-key");
17
18
  var _actions2 = require("./gap-cursor/actions");
@@ -100,11 +101,21 @@ var plugin = new _safePlugin.SafePlugin({
100
101
  },
101
102
  handleClick: function handleClick(view, nodePos, event) {
102
103
  var _$pos$parent;
104
+ var target = event.target instanceof HTMLElement ? event.target : null;
105
+ // Check the experiment first so the control group runs isIgnoredClick once, after
106
+ // posAtCoords, exactly as before.
107
+ var checkIgnoredClickFirst = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_2');
108
+ if (checkIgnoredClickFirst && target && (0, _utils2.isIgnoredClick)(target)) {
109
+ return false;
110
+ }
111
+
112
+ // posAtCoords reads layout (elementFromPoint, caret position and client rects), so only
113
+ // call it once nothing cheaper can rule the click out.
103
114
  var posAtCoords = view.posAtCoords({
104
115
  left: event.clientX,
105
116
  top: event.clientY
106
117
  });
107
- if (!posAtCoords || (0, _utils2.isIgnoredClick)(event.target instanceof HTMLElement ? event.target : null)) {
118
+ if (!posAtCoords || !checkIgnoredClickFirst && (0, _utils2.isIgnoredClick)(target)) {
108
119
  return false;
109
120
  }
110
121
  var isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
@@ -6,6 +6,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
10
  import { selectionPluginKey } from '../types';
10
11
  import { gapCursorPluginKey } from './gap-cursor-plugin-key';
11
12
  import { deleteNode } from './gap-cursor/actions';
@@ -97,11 +98,21 @@ const plugin = new SafePlugin({
97
98
  },
98
99
  handleClick(view, nodePos, event) {
99
100
  var _$pos$parent;
101
+ const target = event.target instanceof HTMLElement ? event.target : null;
102
+ // Check the experiment first so the control group runs isIgnoredClick once, after
103
+ // posAtCoords, exactly as before.
104
+ const checkIgnoredClickFirst = isExperimentEnabled('platform_editor_improve_inp_batch_2');
105
+ if (checkIgnoredClickFirst && target && isIgnoredClick(target)) {
106
+ return false;
107
+ }
108
+
109
+ // posAtCoords reads layout (elementFromPoint, caret position and client rects), so only
110
+ // call it once nothing cheaper can rule the click out.
100
111
  const posAtCoords = view.posAtCoords({
101
112
  left: event.clientX,
102
113
  top: event.clientY
103
114
  });
104
- if (!posAtCoords || isIgnoredClick(event.target instanceof HTMLElement ? event.target : null)) {
115
+ if (!posAtCoords || !checkIgnoredClickFirst && isIgnoredClick(target)) {
105
116
  return false;
106
117
  }
107
118
  const isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
@@ -6,6 +6,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
10
  import { selectionPluginKey } from '../types';
10
11
  import { gapCursorPluginKey } from './gap-cursor-plugin-key';
11
12
  import { deleteNode } from './gap-cursor/actions';
@@ -94,11 +95,21 @@ var plugin = new SafePlugin({
94
95
  },
95
96
  handleClick: function handleClick(view, nodePos, event) {
96
97
  var _$pos$parent;
98
+ var target = event.target instanceof HTMLElement ? event.target : null;
99
+ // Check the experiment first so the control group runs isIgnoredClick once, after
100
+ // posAtCoords, exactly as before.
101
+ var checkIgnoredClickFirst = isExperimentEnabled('platform_editor_improve_inp_batch_2');
102
+ if (checkIgnoredClickFirst && target && isIgnoredClick(target)) {
103
+ return false;
104
+ }
105
+
106
+ // posAtCoords reads layout (elementFromPoint, caret position and client rects), so only
107
+ // call it once nothing cheaper can rule the click out.
97
108
  var posAtCoords = view.posAtCoords({
98
109
  left: event.clientX,
99
110
  top: event.clientY
100
111
  });
101
- if (!posAtCoords || isIgnoredClick(event.target instanceof HTMLElement ? event.target : null)) {
112
+ if (!posAtCoords || !checkIgnoredClickFirst && isIgnoredClick(target)) {
102
113
  return false;
103
114
  }
104
115
  var isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "30.0.8",
3
+ "version": "30.0.10",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,17 +25,18 @@
25
25
  "@atlaskit/editor-prosemirror": "^9.0.0",
26
26
  "@atlaskit/editor-shared-styles": "^5.0.0",
27
27
  "@atlaskit/editor-tables": "^3.2.0",
28
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
28
29
  "@atlaskit/primitives": "^22.6.0",
29
- "@atlaskit/tmp-editor-statsig": "^253.0.0",
30
+ "@atlaskit/tmp-editor-statsig": "^254.0.0",
30
31
  "@atlaskit/tokens": "^20.9.0",
31
32
  "@babel/runtime": "^7.0.0"
32
33
  },
33
34
  "peerDependencies": {
34
- "@atlaskit/editor-common": "^134.5.0",
35
+ "@atlaskit/editor-common": "^134.7.0",
35
36
  "react": "^18.2.0 || ^19.2.0"
36
37
  },
37
38
  "devDependencies": {
38
- "@atlaskit/editor-common": "^134.5.0",
39
+ "@atlaskit/editor-common": "^134.7.0",
39
40
  "react": "^19.2.0"
40
41
  }
41
42
  }