@atlaskit/editor-core 150.0.0 → 150.0.1

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
+ ## 150.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`52aed763767`](https://bitbucket.org/atlassian/atlassian-frontend/commits/52aed763767) - [ED-13879] deletes a placeholder text node when opening a typeahead
8
+
3
9
  ## 150.0.0
4
10
 
5
11
  ### Major Changes
@@ -25,9 +25,26 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
25
25
  }
26
26
  });
27
27
  var selection = tr.selection;
28
- var isTextRangeSelection = selection instanceof _prosemirrorState.TextSelection && selection.$cursor === null;
29
- var nextTr = isTextRangeSelection ? tr.deleteSelection() : tr;
30
- return nextTr;
28
+
29
+ if (!(selection instanceof _prosemirrorState.TextSelection)) {
30
+ return tr;
31
+ }
32
+
33
+ if (!selection.$cursor) {
34
+ tr.deleteSelection();
35
+ return tr;
36
+ } // Search & Destroy placeholder
37
+
38
+
39
+ var cursorPos = selection.$cursor.pos;
40
+ var nodeAtCursor = tr.doc.nodeAt(cursorPos);
41
+ var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
42
+
43
+ if (nodeAtCursor && isPlaceholderAtCursorPosition) {
44
+ tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
45
+ }
46
+
47
+ return tr;
31
48
  };
32
49
  };
33
50
 
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.nextMajorVersion = exports.version = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "150.0.0";
9
+ var version = "150.0.1";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "150.0.0",
3
+ "version": "150.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -17,7 +17,24 @@ export const openTypeAheadAtCursor = ({
17
17
  const {
18
18
  selection
19
19
  } = tr;
20
- const isTextRangeSelection = selection instanceof TextSelection && selection.$cursor === null;
21
- const nextTr = isTextRangeSelection ? tr.deleteSelection() : tr;
22
- return nextTr;
20
+
21
+ if (!(selection instanceof TextSelection)) {
22
+ return tr;
23
+ }
24
+
25
+ if (!selection.$cursor) {
26
+ tr.deleteSelection();
27
+ return tr;
28
+ } // Search & Destroy placeholder
29
+
30
+
31
+ const cursorPos = selection.$cursor.pos;
32
+ const nodeAtCursor = tr.doc.nodeAt(cursorPos);
33
+ const isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
34
+
35
+ if (nodeAtCursor && isPlaceholderAtCursorPosition) {
36
+ tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
37
+ }
38
+
39
+ return tr;
23
40
  };
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "150.0.0";
2
+ export const version = "150.0.1";
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": "150.0.0",
3
+ "version": "150.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -15,8 +15,25 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
15
15
  }
16
16
  });
17
17
  var selection = tr.selection;
18
- var isTextRangeSelection = selection instanceof TextSelection && selection.$cursor === null;
19
- var nextTr = isTextRangeSelection ? tr.deleteSelection() : tr;
20
- return nextTr;
18
+
19
+ if (!(selection instanceof TextSelection)) {
20
+ return tr;
21
+ }
22
+
23
+ if (!selection.$cursor) {
24
+ tr.deleteSelection();
25
+ return tr;
26
+ } // Search & Destroy placeholder
27
+
28
+
29
+ var cursorPos = selection.$cursor.pos;
30
+ var nodeAtCursor = tr.doc.nodeAt(cursorPos);
31
+ var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
32
+
33
+ if (nodeAtCursor && isPlaceholderAtCursorPosition) {
34
+ tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
35
+ }
36
+
37
+ return tr;
21
38
  };
22
39
  };
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "150.0.0";
2
+ export var version = "150.0.1";
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": "150.0.0",
3
+ "version": "150.0.1",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "150.0.0",
3
+ "version": "150.0.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"