@atlaskit/editor-core 187.41.1 → 187.41.3

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,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.41.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`85b6a5da67a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85b6a5da67a) - [ux] Fix [Regression] keyboard selections within actions are unpredictable
8
+
3
9
  ## 187.41.1
4
10
 
5
11
  ### Patch Changes
@@ -10,7 +10,7 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
10
10
  if ($pos.pos + 1 > doc.content.size) {
11
11
  return null;
12
12
  }
13
- if ($pos.depth === 0) {
13
+ if ($pos.nodeBefore !== null) {
14
14
  if (isValidPosition($pos)) {
15
15
  return $pos;
16
16
  }
@@ -26,8 +26,20 @@ var isCollpasedExpand = function isCollpasedExpand(node) {
26
26
  var isBodiedExtension = function isBodiedExtension(node) {
27
27
  return Boolean(node && ['bodiedExtension'].includes(node.type.name));
28
28
  };
29
+
30
+ /**
31
+ * ED-19861 - [Regression] keyboard selections within action items are unpredicatable
32
+ * Table was added to the list of problematic nodes because the desired behaviour when Shift+Up from outside the
33
+ * table is to select the table node itself, rather than the table cell content. Previously this behaviour was handled
34
+ * in `packages/editor/editor-core/src/plugins/selection/pm-plugins/events/create-selection-between.ts` but there was
35
+ * a bug in `create-selection-between` which after fixing the bug that code was no longer handling table selection
36
+ * correctly, so to fix that table was added here.
37
+ */
38
+ var isTable = function isTable(node) {
39
+ return Boolean(node && ['table'].includes(node.type.name));
40
+ };
29
41
  var isProblematicNode = function isProblematicNode(node) {
30
- return isCollpasedExpand(node) || isBodiedExtension(node);
42
+ return isCollpasedExpand(node) || isBodiedExtension(node) || isTable(node);
31
43
  };
32
44
  var findFixedProblematicNodePosition = function findFixedProblematicNodePosition(doc, $head, direction) {
33
45
  if ($head.pos === 0 || $head.depth === 0) {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.41.1";
9
+ var version = "187.41.3";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -6,7 +6,7 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
6
6
  if ($pos.pos + 1 > doc.content.size) {
7
7
  return null;
8
8
  }
9
- if ($pos.depth === 0) {
9
+ if ($pos.nodeBefore !== null) {
10
10
  if (isValidPosition($pos)) {
11
11
  return $pos;
12
12
  }
@@ -21,8 +21,20 @@ const isCollpasedExpand = node => {
21
21
  const isBodiedExtension = node => {
22
22
  return Boolean(node && ['bodiedExtension'].includes(node.type.name));
23
23
  };
24
+
25
+ /**
26
+ * ED-19861 - [Regression] keyboard selections within action items are unpredicatable
27
+ * Table was added to the list of problematic nodes because the desired behaviour when Shift+Up from outside the
28
+ * table is to select the table node itself, rather than the table cell content. Previously this behaviour was handled
29
+ * in `packages/editor/editor-core/src/plugins/selection/pm-plugins/events/create-selection-between.ts` but there was
30
+ * a bug in `create-selection-between` which after fixing the bug that code was no longer handling table selection
31
+ * correctly, so to fix that table was added here.
32
+ */
33
+ const isTable = node => {
34
+ return Boolean(node && ['table'].includes(node.type.name));
35
+ };
24
36
  const isProblematicNode = node => {
25
- return isCollpasedExpand(node) || isBodiedExtension(node);
37
+ return isCollpasedExpand(node) || isBodiedExtension(node) || isTable(node);
26
38
  };
27
39
  const findFixedProblematicNodePosition = (doc, $head, direction) => {
28
40
  if ($head.pos === 0 || $head.depth === 0) {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.41.1";
2
+ export const version = "187.41.3";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -4,7 +4,7 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
4
4
  if ($pos.pos + 1 > doc.content.size) {
5
5
  return null;
6
6
  }
7
- if ($pos.depth === 0) {
7
+ if ($pos.nodeBefore !== null) {
8
8
  if (isValidPosition($pos)) {
9
9
  return $pos;
10
10
  }
@@ -21,8 +21,20 @@ var isCollpasedExpand = function isCollpasedExpand(node) {
21
21
  var isBodiedExtension = function isBodiedExtension(node) {
22
22
  return Boolean(node && ['bodiedExtension'].includes(node.type.name));
23
23
  };
24
+
25
+ /**
26
+ * ED-19861 - [Regression] keyboard selections within action items are unpredicatable
27
+ * Table was added to the list of problematic nodes because the desired behaviour when Shift+Up from outside the
28
+ * table is to select the table node itself, rather than the table cell content. Previously this behaviour was handled
29
+ * in `packages/editor/editor-core/src/plugins/selection/pm-plugins/events/create-selection-between.ts` but there was
30
+ * a bug in `create-selection-between` which after fixing the bug that code was no longer handling table selection
31
+ * correctly, so to fix that table was added here.
32
+ */
33
+ var isTable = function isTable(node) {
34
+ return Boolean(node && ['table'].includes(node.type.name));
35
+ };
24
36
  var isProblematicNode = function isProblematicNode(node) {
25
- return isCollpasedExpand(node) || isBodiedExtension(node);
37
+ return isCollpasedExpand(node) || isBodiedExtension(node) || isTable(node);
26
38
  };
27
39
  var findFixedProblematicNodePosition = function findFixedProblematicNodePosition(doc, $head, direction) {
28
40
  if ($head.pos === 0 || $head.depth === 0) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.41.1";
2
+ export var version = "187.41.3";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.41.1",
3
+ "version": "187.41.3",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"