@atlaskit/editor-plugin-selection 1.2.0 → 1.2.2

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,97 +1,141 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#92552](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92552)
14
+ [`7cd874b858c8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7cd874b858c8) -
15
+ Check target elements are actually HTMLElement rather than typecasting.
16
+
3
17
  ## 1.2.0
4
18
 
5
19
  ### Minor Changes
6
20
 
7
- - [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934) [`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) - bumped editor-prosemirror version to 4.0.0
21
+ - [#91934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91934)
22
+ [`b76a78c6a199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b76a78c6a199) -
23
+ bumped editor-prosemirror version to 4.0.0
8
24
 
9
25
  ### Patch Changes
10
26
 
11
- - Updated dependencies
27
+ - Updated dependencies
12
28
 
13
29
  ## 1.1.3
14
30
 
15
31
  ### Patch Changes
16
32
 
17
- - [#90897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90897) [`f7d77187a439`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f7d77187a439) - [ux] [ED-22841] Adjust isCollpasedExpand function to allow for the new singlePlayerExpand plugin which replaces the standard expand when livePage and the `platform.editor.single-player-expand` feature flag is enabled.
33
+ - [#90897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90897)
34
+ [`f7d77187a439`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f7d77187a439) -
35
+ [ux] [ED-22841] Adjust isCollpasedExpand function to allow for the new singlePlayerExpand plugin
36
+ which replaces the standard expand when livePage and the `platform.editor.single-player-expand`
37
+ feature flag is enabled.
18
38
 
19
39
  ## 1.1.2
20
40
 
21
41
  ### Patch Changes
22
42
 
23
- - [#89247](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89247) [`a65b4a0870d8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a65b4a0870d8) - The internal composition of this package has changed. There is no expected change in behavior.
43
+ - [#89247](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89247)
44
+ [`a65b4a0870d8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a65b4a0870d8) -
45
+ The internal composition of this package has changed. There is no expected change in behavior.
24
46
 
25
47
  ## 1.1.1
26
48
 
27
49
  ### Patch Changes
28
50
 
29
- - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
51
+ - [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
52
+ [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
53
+ Upgrade Typescript from `4.9.5` to `5.4.2`
30
54
 
31
55
  ## 1.1.0
32
56
 
33
57
  ### Minor Changes
34
58
 
35
- - [#75042](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75042) [`ce823f018248`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ce823f018248) - [ux] ED-21987 Diverge expands in live pages so that they are not multiplayer, and are closed by default.
59
+ - [#75042](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75042)
60
+ [`ce823f018248`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ce823f018248) -
61
+ [ux] ED-21987 Diverge expands in live pages so that they are not multiplayer, and are closed by
62
+ default.
36
63
 
37
64
  ### Patch Changes
38
65
 
39
- - Updated dependencies
66
+ - Updated dependencies
40
67
 
41
68
  ## 1.0.2
42
69
 
43
70
  ### Patch Changes
44
71
 
45
- - Updated dependencies
72
+ - Updated dependencies
46
73
 
47
74
  ## 1.0.1
48
75
 
49
76
  ### Patch Changes
50
77
 
51
- - [#70261](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70261) [`a92879d672c6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a92879d672c6) - [ux] ED-21620: Corrected the selection functions for atom nodes that are triggered on pressing the right and left arrow keys.
78
+ - [#70261](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70261)
79
+ [`a92879d672c6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a92879d672c6) -
80
+ [ux] ED-21620: Corrected the selection functions for atom nodes that are triggered on pressing
81
+ the right and left arrow keys.
52
82
 
53
83
  ## 1.0.0
54
84
 
55
85
  ### Major Changes
56
86
 
57
- - [#72386](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72386) [`0c52b0be40c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c52b0be40c1) - This changeset exists to bump all editor plugins that currently don't have a major version. This is to address an issue with Jira plugin consumption.
87
+ - [#72386](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72386)
88
+ [`0c52b0be40c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c52b0be40c1) -
89
+ This changeset exists to bump all editor plugins that currently don't have a major version. This
90
+ is to address an issue with Jira plugin consumption.
58
91
 
59
92
  ## 0.2.2
60
93
 
61
94
  ### Patch Changes
62
95
 
63
- - [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572) [`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) - Upgrading @atlaskit/editor-prosemirror dependency
96
+ - [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572)
97
+ [`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) -
98
+ Upgrading @atlaskit/editor-prosemirror dependency
64
99
 
65
100
  ## 0.2.1
66
101
 
67
102
  ### Patch Changes
68
103
 
69
- - Updated dependencies
104
+ - Updated dependencies
70
105
 
71
106
  ## 0.2.0
72
107
 
73
108
  ### Minor Changes
74
109
 
75
- - [#65084](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65084) [`609bca09a972`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/609bca09a972) - expose selection as part of the shared state
110
+ - [#65084](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65084)
111
+ [`609bca09a972`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/609bca09a972) -
112
+ expose selection as part of the shared state
76
113
 
77
114
  ### Patch Changes
78
115
 
79
- - Updated dependencies
116
+ - Updated dependencies
80
117
 
81
118
  ## 0.1.3
82
119
 
83
120
  ### Patch Changes
84
121
 
85
- - [#63289](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63289) [`f75faa16e84d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f75faa16e84d) - [ux] ED-20209: Fixed selection behaviour for Atomic and empty+selectable nodes and updated related tests.
122
+ - [#63289](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63289)
123
+ [`f75faa16e84d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f75faa16e84d) -
124
+ [ux] ED-20209: Fixed selection behaviour for Atomic and empty+selectable nodes and updated
125
+ related tests.
86
126
 
87
127
  ## 0.1.2
88
128
 
89
129
  ### Patch Changes
90
130
 
91
- - [#61696](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61696) [`fcc2b35ad97b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fcc2b35ad97b) - ED-21505: Added better selections and highlights for MBE nodes on Editor
131
+ - [#61696](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61696)
132
+ [`fcc2b35ad97b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fcc2b35ad97b) -
133
+ ED-21505: Added better selections and highlights for MBE nodes on Editor
92
134
 
93
135
  ## 0.1.1
94
136
 
95
137
  ### Patch Changes
96
138
 
97
- - [#57079](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/57079) [`d15db1b00c5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d15db1b00c5a) - [ED-21267] Improve arrow navigation across MultiBodiedExtensions
139
+ - [#57079](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/57079)
140
+ [`d15db1b00c5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d15db1b00c5a) -
141
+ [ED-21267] Improve arrow navigation across MultiBodiedExtensions
@@ -89,12 +89,12 @@ function getLayoutModeFromTargetNode(node) {
89
89
  return layout;
90
90
  }
91
91
  var isIgnoredClick = exports.isIgnoredClick = function isIgnoredClick(elem) {
92
- if (elem.nodeName === 'BUTTON' || elem.closest('button')) {
92
+ if ((elem === null || elem === void 0 ? void 0 : elem.nodeName) === 'BUTTON' || elem !== null && elem !== void 0 && elem.closest('button')) {
93
93
  return true;
94
94
  }
95
95
 
96
96
  // check if we're clicking an image caption placeholder
97
- if (elem.closest("[data-id=\"".concat(_mediaSingle.CAPTION_PLACEHOLDER_ID, "\"]"))) {
97
+ if (elem !== null && elem !== void 0 && elem.closest("[data-id=\"".concat(_mediaSingle.CAPTION_PLACEHOLDER_ID, "\"]"))) {
98
98
  return true;
99
99
  }
100
100
 
@@ -116,7 +116,7 @@ var isIgnoredClick = exports.isIgnoredClick = function isIgnoredClick(elem) {
116
116
 
117
117
  // Check if unsupported node selection
118
118
  // (without this, selection requires double clicking in FF due to posAtCoords differences)
119
- if (elem.closest(".".concat(_styles.UnsupportedSharedCssClassName.BLOCK_CONTAINER))) {
119
+ if (elem !== null && elem !== void 0 && elem.closest(".".concat(_styles.UnsupportedSharedCssClassName.BLOCK_CONTAINER))) {
120
120
  return true;
121
121
  }
122
122
  return false;
@@ -10,6 +10,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
10
10
  var _utils = require("@atlaskit/editor-prosemirror/utils");
11
11
  var _view2 = require("@atlaskit/editor-prosemirror/view");
12
12
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _actions = require("../gap-cursor/actions");
14
15
  var _direction = require("../gap-cursor/direction");
15
16
  var _utils2 = require("../gap-cursor/utils");
@@ -112,8 +113,14 @@ var plugin = new _safePlugin.SafePlugin({
112
113
  left: event.clientX,
113
114
  top: event.clientY
114
115
  });
115
- if (!posAtCoords || (0, _utils2.isIgnoredClick)(event.target)) {
116
- return false;
116
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
117
+ if (!posAtCoords || (0, _utils2.isIgnoredClick)(event.target instanceof HTMLElement ? event.target : null)) {
118
+ return false;
119
+ }
120
+ } else {
121
+ if (!posAtCoords || (0, _utils2.isIgnoredClick)(event.target)) {
122
+ return false;
123
+ }
117
124
  }
118
125
  var isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
119
126
  if (isInsideTheTarget) {
@@ -76,12 +76,12 @@ export function getLayoutModeFromTargetNode(node) {
76
76
  return layout;
77
77
  }
78
78
  export const isIgnoredClick = elem => {
79
- if (elem.nodeName === 'BUTTON' || elem.closest('button')) {
79
+ if ((elem === null || elem === void 0 ? void 0 : elem.nodeName) === 'BUTTON' || elem !== null && elem !== void 0 && elem.closest('button')) {
80
80
  return true;
81
81
  }
82
82
 
83
83
  // check if we're clicking an image caption placeholder
84
- if (elem.closest(`[data-id="${CAPTION_PLACEHOLDER_ID}"]`)) {
84
+ if (elem !== null && elem !== void 0 && elem.closest(`[data-id="${CAPTION_PLACEHOLDER_ID}"]`)) {
85
85
  return true;
86
86
  }
87
87
 
@@ -103,7 +103,7 @@ export const isIgnoredClick = elem => {
103
103
 
104
104
  // Check if unsupported node selection
105
105
  // (without this, selection requires double clicking in FF due to posAtCoords differences)
106
- if (elem.closest(`.${UnsupportedSharedCssClassName.BLOCK_CONTAINER}`)) {
106
+ if (elem !== null && elem !== void 0 && elem.closest(`.${UnsupportedSharedCssClassName.BLOCK_CONTAINER}`)) {
107
107
  return true;
108
108
  }
109
109
  return false;
@@ -4,6 +4,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { deleteNode } from '../gap-cursor/actions';
8
9
  import { Direction } from '../gap-cursor/direction';
9
10
  import { getLayoutModeFromTargetNode, isIgnoredClick } from '../gap-cursor/utils';
@@ -110,8 +111,14 @@ const plugin = new SafePlugin({
110
111
  left: event.clientX,
111
112
  top: event.clientY
112
113
  });
113
- if (!posAtCoords || isIgnoredClick(event.target)) {
114
- return false;
114
+ if (getBooleanFF('platform.editor.explicit-html-element-check')) {
115
+ if (!posAtCoords || isIgnoredClick(event.target instanceof HTMLElement ? event.target : null)) {
116
+ return false;
117
+ }
118
+ } else {
119
+ if (!posAtCoords || isIgnoredClick(event.target)) {
120
+ return false;
121
+ }
115
122
  }
116
123
  const isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
117
124
  if (isInsideTheTarget) {
@@ -80,12 +80,12 @@ export function getLayoutModeFromTargetNode(node) {
80
80
  return layout;
81
81
  }
82
82
  export var isIgnoredClick = function isIgnoredClick(elem) {
83
- if (elem.nodeName === 'BUTTON' || elem.closest('button')) {
83
+ if ((elem === null || elem === void 0 ? void 0 : elem.nodeName) === 'BUTTON' || elem !== null && elem !== void 0 && elem.closest('button')) {
84
84
  return true;
85
85
  }
86
86
 
87
87
  // check if we're clicking an image caption placeholder
88
- if (elem.closest("[data-id=\"".concat(CAPTION_PLACEHOLDER_ID, "\"]"))) {
88
+ if (elem !== null && elem !== void 0 && elem.closest("[data-id=\"".concat(CAPTION_PLACEHOLDER_ID, "\"]"))) {
89
89
  return true;
90
90
  }
91
91
 
@@ -107,7 +107,7 @@ export var isIgnoredClick = function isIgnoredClick(elem) {
107
107
 
108
108
  // Check if unsupported node selection
109
109
  // (without this, selection requires double clicking in FF due to posAtCoords differences)
110
- if (elem.closest(".".concat(UnsupportedSharedCssClassName.BLOCK_CONTAINER))) {
110
+ if (elem !== null && elem !== void 0 && elem.closest(".".concat(UnsupportedSharedCssClassName.BLOCK_CONTAINER))) {
111
111
  return true;
112
112
  }
113
113
  return false;
@@ -4,6 +4,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { deleteNode } from '../gap-cursor/actions';
8
9
  import { Direction } from '../gap-cursor/direction';
9
10
  import { getLayoutModeFromTargetNode, isIgnoredClick } from '../gap-cursor/utils';
@@ -106,8 +107,14 @@ var plugin = new SafePlugin({
106
107
  left: event.clientX,
107
108
  top: event.clientY
108
109
  });
109
- if (!posAtCoords || isIgnoredClick(event.target)) {
110
- return false;
110
+ if (getBooleanFF('platform.editor.explicit-html-element-check')) {
111
+ if (!posAtCoords || isIgnoredClick(event.target instanceof HTMLElement ? event.target : null)) {
112
+ return false;
113
+ }
114
+ } else {
115
+ if (!posAtCoords || isIgnoredClick(event.target)) {
116
+ return false;
117
+ }
111
118
  }
112
119
  var isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
113
120
  if (isInsideTheTarget) {
@@ -4,5 +4,5 @@ export declare const isLeftCursor: (side: Side) => side is Side.LEFT;
4
4
  export declare function getMediaNearPos(doc: PMNode, $pos: ResolvedPos, schema: Schema, dir?: number): PMNode | null;
5
5
  export declare const isTextBlockNearPos: (doc: PMNode, schema: Schema, $pos: ResolvedPos, dir: number) => boolean;
6
6
  export declare function getLayoutModeFromTargetNode(node: PMNode): string;
7
- export declare const isIgnoredClick: (elem: HTMLElement) => boolean;
7
+ export declare const isIgnoredClick: (elem: HTMLElement | null) => boolean | null;
8
8
  export declare const getComputedStyleForLayoutMode: (dom: HTMLElement, node: PMNode | undefined | null, style: CSSStyleDeclaration) => CSSStyleDeclaration;
@@ -4,5 +4,5 @@ export declare const isLeftCursor: (side: Side) => side is Side.LEFT;
4
4
  export declare function getMediaNearPos(doc: PMNode, $pos: ResolvedPos, schema: Schema, dir?: number): PMNode | null;
5
5
  export declare const isTextBlockNearPos: (doc: PMNode, schema: Schema, $pos: ResolvedPos, dir: number) => boolean;
6
6
  export declare function getLayoutModeFromTargetNode(node: PMNode): string;
7
- export declare const isIgnoredClick: (elem: HTMLElement) => boolean;
7
+ export declare const isIgnoredClick: (elem: HTMLElement | null) => boolean | null;
8
8
  export declare const getComputedStyleForLayoutMode: (dom: HTMLElement, node: PMNode | undefined | null, style: CSSStyleDeclaration) => CSSStyleDeclaration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,9 +21,9 @@
21
21
  "runReact18": false
22
22
  },
23
23
  "dependencies": {
24
- "@atlaskit/editor-common": "^78.31.0",
24
+ "@atlaskit/editor-common": "^79.0.0",
25
25
  "@atlaskit/editor-prosemirror": "4.0.0",
26
- "@atlaskit/editor-shared-styles": "^2.9.0",
26
+ "@atlaskit/editor-shared-styles": "^2.10.0",
27
27
  "@atlaskit/editor-tables": "^2.7.0",
28
28
  "@atlaskit/platform-feature-flags": "^0.2.4",
29
29
  "@babel/runtime": "^7.0.0"
@@ -84,6 +84,9 @@
84
84
  },
85
85
  "platform.editor.single-player-expand": {
86
86
  "type": "boolean"
87
+ },
88
+ "platform.editor.explicit-html-element-check": {
89
+ "type": "boolean"
87
90
  }
88
91
  }
89
92
  }