@atlaskit/editor-core 187.4.2 → 187.4.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,17 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6255c2ad1c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6255c2ad1c9) - [ux] Adds ability to open Assets datasource dialog using the slash command in the editor, behind a feature flag
8
+
9
+ ## 187.4.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`eba71a21f88`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eba71a21f88) - [ED-19204] Let ProseMirror handle selections targeting empty paragraphs on root
14
+
3
15
  ## 187.4.2
4
16
 
5
17
  ### Patch Changes
@@ -14,6 +14,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
14
14
  if (isValidPosition($pos)) {
15
15
  return $pos;
16
16
  }
17
+
18
+ // We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
19
+ var currentPosIndex = $pos.index();
20
+ if (currentPosIndex === 0) {
21
+ return null;
22
+ }
23
+ var previousIndex = currentPosIndex - 1;
24
+ var $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
25
+ if (isValidPosition($previousPos)) {
26
+ return $previousPos;
27
+ }
17
28
  return null;
18
29
  }
19
30
  if (isValidPosition($pos)) {
@@ -49,9 +60,18 @@ function findNextSelectionPosition(_ref) {
49
60
  return null;
50
61
  }
51
62
  var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
63
+ var _$head$parent;
52
64
  if ($anchor.pos === $head.pos) {
53
65
  return null;
54
66
  }
67
+ if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
68
+ return null;
69
+ }
70
+
71
+ // If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
72
+ if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
73
+ return null;
74
+ }
55
75
  var $nextHeadPosition = findNextSelectionPosition({
56
76
  $targetHead: $head,
57
77
  $anchor: $anchor,
@@ -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.4.2";
9
+ var version = "187.4.7";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.4.2",
3
+ "version": "187.4.7",
4
4
  "sideEffects": false
5
5
  }
@@ -10,6 +10,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
10
10
  if (isValidPosition($pos)) {
11
11
  return $pos;
12
12
  }
13
+
14
+ // We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
15
+ const currentPosIndex = $pos.index();
16
+ if (currentPosIndex === 0) {
17
+ return null;
18
+ }
19
+ const previousIndex = currentPosIndex - 1;
20
+ const $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
21
+ if (isValidPosition($previousPos)) {
22
+ return $previousPos;
23
+ }
13
24
  return null;
14
25
  }
15
26
  if (isValidPosition($pos)) {
@@ -46,9 +57,18 @@ function findNextSelectionPosition({
46
57
  return null;
47
58
  }
48
59
  export const onCreateSelectionBetween = (view, $anchor, $head) => {
60
+ var _$head$parent;
49
61
  if ($anchor.pos === $head.pos) {
50
62
  return null;
51
63
  }
64
+ if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
65
+ return null;
66
+ }
67
+
68
+ // If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
69
+ if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
70
+ return null;
71
+ }
52
72
  const $nextHeadPosition = findNextSelectionPosition({
53
73
  $targetHead: $head,
54
74
  $anchor,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.4.2";
2
+ export const version = "187.4.7";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.4.2",
3
+ "version": "187.4.7",
4
4
  "sideEffects": false
5
5
  }
@@ -8,6 +8,17 @@ function findEmptySelectableParentNodePosition($pos, isValidPosition) {
8
8
  if (isValidPosition($pos)) {
9
9
  return $pos;
10
10
  }
11
+
12
+ // We can not use `$pos.before()` because ProseMirror throws an error when depth is zero.
13
+ var currentPosIndex = $pos.index();
14
+ if (currentPosIndex === 0) {
15
+ return null;
16
+ }
17
+ var previousIndex = currentPosIndex - 1;
18
+ var $previousPos = $pos.doc.resolve($pos.posAtIndex(previousIndex));
19
+ if (isValidPosition($previousPos)) {
20
+ return $previousPos;
21
+ }
11
22
  return null;
12
23
  }
13
24
  if (isValidPosition($pos)) {
@@ -43,9 +54,18 @@ function findNextSelectionPosition(_ref) {
43
54
  return null;
44
55
  }
45
56
  export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
57
+ var _$head$parent;
46
58
  if ($anchor.pos === $head.pos) {
47
59
  return null;
48
60
  }
61
+ if ($anchor.depth === $head.depth && $anchor.sameParent($head)) {
62
+ return null;
63
+ }
64
+
65
+ // If the head is targeting a paragraph on root, then let ProseMirror handle the text selection
66
+ if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
67
+ return null;
68
+ }
49
69
  var $nextHeadPosition = findNextSelectionPosition({
50
70
  $targetHead: $head,
51
71
  $anchor: $anchor,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.4.2";
2
+ export var version = "187.4.7";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.4.2",
3
+ "version": "187.4.7",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.4.2",
3
+ "version": "187.4.7",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -257,6 +257,10 @@
257
257
  "platform.linking-platform.datasource-jira_issues": {
258
258
  "type": "boolean",
259
259
  "referenceOnly": "true"
260
+ },
261
+ "platform.linking-platform.datasource-assets_objects": {
262
+ "type": "boolean",
263
+ "referenceOnly": "true"
260
264
  }
261
265
  }
262
266
  }