@atlaskit/editor-plugin-type-ahead 1.8.0 → 1.8.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,14 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#132619](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132619)
8
+ [`492710c431738`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/492710c431738) -
9
+ [ux] [EO2024-22] Fix typeahead interaction when node or table selection
10
+ - Updated dependencies
11
+
3
12
  ## 1.8.0
4
13
 
5
14
  ### Minor Changes
@@ -35,7 +35,8 @@ var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAhe
35
35
  query: query
36
36
  })(tr);
37
37
  var selection = tr.selection;
38
- if (!(selection instanceof _state.TextSelection || selection instanceof _selection.GapCursorSelection)) {
38
+ var isInline = selection instanceof _state.NodeSelection && selection.node.type.isInline;
39
+ if (!(selection instanceof _state.TextSelection || selection instanceof _selection.GapCursorSelection || selection instanceof _state.NodeSelection)) {
39
40
  return tr;
40
41
  }
41
42
  if (selection instanceof _selection.GapCursorSelection) {
@@ -45,6 +46,13 @@ var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAhe
45
46
  tr.delete(tr.selection.from - 1, tr.selection.from);
46
47
  } else {
47
48
  var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
49
+ if (selection instanceof _state.NodeSelection) {
50
+ if (isInline) {
51
+ tr.deleteSelection();
52
+ return tr;
53
+ }
54
+ return tr;
55
+ }
48
56
  if (!selection.$cursor) {
49
57
  tr.deleteSelection();
50
58
  return tr;
@@ -1,5 +1,5 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { ACTIONS } from '../pm-plugins/actions';
4
4
  import { pluginKey } from '../pm-plugins/key';
5
5
  export const openTypeAhead = props => tr => {
@@ -32,7 +32,8 @@ export const openTypeAheadAtCursor = ({
32
32
  const {
33
33
  selection
34
34
  } = tr;
35
- if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection)) {
35
+ const isInline = selection instanceof NodeSelection && selection.node.type.isInline;
36
+ if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection || selection instanceof NodeSelection)) {
36
37
  return tr;
37
38
  }
38
39
  if (selection instanceof GapCursorSelection) {
@@ -42,6 +43,13 @@ export const openTypeAheadAtCursor = ({
42
43
  tr.delete(tr.selection.from - 1, tr.selection.from);
43
44
  } else {
44
45
  var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
46
+ if (selection instanceof NodeSelection) {
47
+ if (isInline) {
48
+ tr.deleteSelection();
49
+ return tr;
50
+ }
51
+ return tr;
52
+ }
45
53
  if (!selection.$cursor) {
46
54
  tr.deleteSelection();
47
55
  return tr;
@@ -1,5 +1,5 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { ACTIONS } from '../pm-plugins/actions';
4
4
  import { pluginKey } from '../pm-plugins/key';
5
5
  export var openTypeAhead = function openTypeAhead(props) {
@@ -29,7 +29,8 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
29
29
  query: query
30
30
  })(tr);
31
31
  var selection = tr.selection;
32
- if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection)) {
32
+ var isInline = selection instanceof NodeSelection && selection.node.type.isInline;
33
+ if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection || selection instanceof NodeSelection)) {
33
34
  return tr;
34
35
  }
35
36
  if (selection instanceof GapCursorSelection) {
@@ -39,6 +40,13 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
39
40
  tr.delete(tr.selection.from - 1, tr.selection.from);
40
41
  } else {
41
42
  var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
43
+ if (selection instanceof NodeSelection) {
44
+ if (isInline) {
45
+ tr.deleteSelection();
46
+ return tr;
47
+ }
48
+ return tr;
49
+ }
42
50
  if (!selection.$cursor) {
43
51
  tr.deleteSelection();
44
52
  return tr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,14 +33,14 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^40.8.1",
36
- "@atlaskit/editor-common": "^87.12.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.7.0",
36
+ "@atlaskit/editor-common": "^88.0.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.8.0",
38
38
  "@atlaskit/editor-prosemirror": "5.0.1",
39
39
  "@atlaskit/editor-shared-styles": "^2.13.0",
40
40
  "@atlaskit/menu": "^2.12.0",
41
41
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
42
42
  "@atlaskit/theme": "^13.0.0",
43
- "@atlaskit/tokens": "^1.58.0",
43
+ "@atlaskit/tokens": "^1.59.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
46
46
  "lodash": "^4.17.21",