@atlaskit/editor-plugin-type-ahead 10.3.0 → 10.3.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,5 +1,25 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 10.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`cf6977530a136`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf6977530a136) -
14
+ Support fullwidth slash / (U+FF0F) as a quick insert trigger for Japanese/CJK keyboard users.
15
+ Japanese keyboards produce the fullwidth slash when pressing the / key, which previously did not
16
+ open the quick insert menu. The fix adds a `customRegex` to the quick-insert typeahead handler
17
+ that matches both ASCII slash `/` and fullwidth slash `/`, and extends the trigger cleanup logic
18
+ in `openTypeAheadAtCursor` to handle `customRegex` alternatives.
19
+ - [`cf6977530a136`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf6977530a136) -
20
+ Add ./commands entry point exposing openTypeAheadAtCursor for test consumption
21
+ - Updated dependencies
22
+
3
23
  ## 10.3.0
4
24
 
5
25
  ### Minor Changes
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@atlaskit/editor-plugin-type-ahead/commands",
3
+ "main": "../dist/cjs/entry-points/commands.js",
4
+ "module": "../dist/esm/entry-points/commands.js",
5
+ "module:es2019": "../dist/es2019/entry-points/commands.js",
6
+ "sideEffects": [
7
+ "*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/commands.d.ts",
10
+ "typesVersions": {
11
+ ">=4.5 <5.9": {
12
+ "*": [
13
+ "../dist/types-ts4.5/entry-points/commands.d.ts"
14
+ ]
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "openTypeAhead", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _openTypeaheadAtCursor.openTypeAhead;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "openTypeAheadAtCursor", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _openTypeaheadAtCursor.openTypeAheadAtCursor;
16
+ }
17
+ });
18
+ var _openTypeaheadAtCursor = require("../pm-plugins/commands/open-typeahead-at-cursor");
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.openTypeAheadAtCursor = exports.openTypeAhead = void 0;
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
10
  var _actions = require("../actions");
10
11
  var _key = require("../key");
11
12
  var openTypeAhead = exports.openTypeAhead = function openTypeAhead(props) {
@@ -49,7 +50,7 @@ var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAhe
49
50
  // delete 1 pos before wherever selection is now - that will delete the empty space
50
51
  tr.delete(tr.selection.from - 1, tr.selection.from);
51
52
  } else {
52
- var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
53
+ var _selection$$head$pare, _selection$$head$pare2, _selection$$head;
53
54
  if (selection instanceof _state.NodeSelection) {
54
55
  if (isInline) {
55
56
  tr.deleteSelection();
@@ -78,7 +79,11 @@ var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAhe
78
79
  // being inserted due to composition by checking if we have the trigger
79
80
  // directly before the typeahead. This should not happen unless it has
80
81
  // been eroneously added because we require whitespace/newline for typeahead.
81
- if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && (_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) {
82
+ // Check if the text ends with the trigger character (or any character matched
83
+ // by customRegex, to support wide-char variants like fullwidth slash /)
84
+ var triggerPattern = (0, _expValEquals.expValEquals)('platform_editor_wide_slash_trigger', 'isEnabled', true) && triggerHandler.customRegex ? new RegExp("(".concat(triggerHandler.customRegex, ")$"), 'u') : null;
85
+ var endsWithTrigger = ((_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) === null || _selection$$head$pare === void 0 ? void 0 : _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) || triggerPattern && triggerPattern.test(selection.$head.parent.textContent);
86
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && endsWithTrigger) {
82
87
  tr.delete(cursorPos - 1, cursorPos);
83
88
  }
84
89
  }
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createPlugin = createPlugin;
7
7
  var _steps = require("@atlaskit/adf-schema/steps");
8
+ var _analytics = require("@atlaskit/editor-common/analytics");
8
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
10
  var _utils = require("@atlaskit/editor-common/utils");
10
11
  var _view = require("@atlaskit/editor-prosemirror/view");
11
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
14
  var _actions = require("./actions");
15
+ var _openTypeaheadAtCursor = require("./commands/open-typeahead-at-cursor");
13
16
  var _constants = require("./constants");
14
17
  var _decorations = require("./decorations");
15
18
  var _isInsertionTransaction = require("./isInsertionTransaction");
@@ -49,6 +52,11 @@ function createPlugin(_ref) {
49
52
  typeAheadHandlers: typeAheadHandlers,
50
53
  popupMountRef: popupMountRef
51
54
  });
55
+
56
+ // Tracks a wide-char trigger handler detected during IME composition (e.g. /).
57
+ // Set by compositionupdate, cleared by compositionend. Used by handleKeyDown
58
+ // to intercept Enter that confirms the composition.
59
+ var pendingWideSlashHandler = null;
52
60
  return new _safePlugin.SafePlugin({
53
61
  key: _key.pluginKey,
54
62
  state: {
@@ -101,8 +109,53 @@ function createPlugin(_ref) {
101
109
  var _pluginKey$getState;
102
110
  return (_pluginKey$getState = _key.pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
103
111
  },
112
+ handleKeyDown: function handleKeyDown(view, event) {
113
+ // When composing a wide-char trigger (e.g. /), intercept the Enter key
114
+ // that confirms the composition so we can open the typeahead instead.
115
+ if (pendingWideSlashHandler && event.isComposing && (event.key === 'Enter' || event.keyCode === 13)) {
116
+ var handler = pendingWideSlashHandler;
117
+ pendingWideSlashHandler = null;
118
+ // Defer until ProseMirror has flushed the composed text into its state.
119
+ setTimeout(function () {
120
+ var command = (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
121
+ triggerHandler: handler,
122
+ inputMethod: _analytics.INPUT_METHOD.KEYBOARD
123
+ });
124
+ var tr = command({
125
+ tr: view.state.tr
126
+ });
127
+ if (tr) {
128
+ view.dispatch(tr);
129
+ }
130
+ }, 0);
131
+ return true;
132
+ }
133
+ return false;
134
+ },
104
135
  handleDOMEvents: {
136
+ compositionupdate: function compositionupdate(view, event) {
137
+ // When the experiment is on, track whether the current composition
138
+ // exactly matches a wide-char trigger (e.g. / from Japanese keyboard).
139
+ // We can't open the typeahead yet because composition is still active,
140
+ // but we record the matching handler so the next keydown (Enter) can use it.
141
+ if ((0, _expValEquals.expValEquals)('platform_editor_wide_slash_trigger', 'isEnabled', true)) {
142
+ var _event$data, _typeAheadHandlers$fi;
143
+ var pendingData = (_event$data = event.data) !== null && _event$data !== void 0 ? _event$data : '';
144
+ pendingWideSlashHandler = (_typeAheadHandlers$fi = typeAheadHandlers.find(function (handler) {
145
+ if (!handler.customRegex) {
146
+ return false;
147
+ }
148
+ // Only match if the entire composition is a trigger character
149
+ var pattern = new RegExp("^(".concat(handler.customRegex, ")$"), 'u');
150
+ return pattern.test(pendingData);
151
+ })) !== null && _typeAheadHandlers$fi !== void 0 ? _typeAheadHandlers$fi : null;
152
+ }
153
+ return false;
154
+ },
105
155
  compositionend: function compositionend(view, event) {
156
+ // Clear the pending handler when composition ends (cancelled or committed
157
+ // via a non-Enter key like Space, which we don't want to intercept).
158
+ pendingWideSlashHandler = null;
106
159
  return false;
107
160
  },
108
161
  click: function click(view, event) {
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { openTypeAhead, openTypeAheadAtCursor } from '../pm-plugins/commands/open-typeahead-at-cursor';
@@ -1,5 +1,6 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { ACTIONS } from '../actions';
4
5
  import { pluginKey } from '../key';
5
6
  export const openTypeAhead = props => tr => {
@@ -46,7 +47,7 @@ export const openTypeAheadAtCursor = ({
46
47
  // delete 1 pos before wherever selection is now - that will delete the empty space
47
48
  tr.delete(tr.selection.from - 1, tr.selection.from);
48
49
  } else {
49
- var _selection$$head, _selection$$head$pare, _selection$$head$pare2, _selection$$head$pare3;
50
+ var _selection$$head$pare, _selection$$head$pare2, _selection$$head, _selection$$head$pare3;
50
51
  if (selection instanceof NodeSelection) {
51
52
  if (isInline) {
52
53
  tr.deleteSelection();
@@ -75,7 +76,11 @@ export const openTypeAheadAtCursor = ({
75
76
  // being inserted due to composition by checking if we have the trigger
76
77
  // directly before the typeahead. This should not happen unless it has
77
78
  // been eroneously added because we require whitespace/newline for typeahead.
78
- if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, triggerHandler.trigger)) {
79
+ // Check if the text ends with the trigger character (or any character matched
80
+ // by customRegex, to support wide-char variants like fullwidth slash /)
81
+ const triggerPattern = expValEquals('platform_editor_wide_slash_trigger', 'isEnabled', true) && triggerHandler.customRegex ? new RegExp(`(${triggerHandler.customRegex})$`, 'u') : null;
82
+ const endsWithTrigger = ((_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) === null || _selection$$head$pare === void 0 ? void 0 : _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) || triggerPattern && triggerPattern.test(selection.$head.parent.textContent);
83
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare3 = _selection$$head.parent) !== null && _selection$$head$pare3 !== void 0 && _selection$$head$pare3.textContent) && endsWithTrigger) {
79
84
  tr.delete(cursorPos - 1, cursorPos);
80
85
  }
81
86
  }
@@ -1,9 +1,12 @@
1
1
  import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
4
  import { closest } from '@atlaskit/editor-common/utils';
4
5
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
8
  import { ACTIONS } from './actions';
9
+ import { openTypeAheadAtCursor } from './commands/open-typeahead-at-cursor';
7
10
  import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from './constants';
8
11
  import { factoryDecorations } from './decorations';
9
12
  import { isInsertionTransaction } from './isInsertionTransaction';
@@ -43,6 +46,11 @@ export function createPlugin({
43
46
  typeAheadHandlers,
44
47
  popupMountRef
45
48
  });
49
+
50
+ // Tracks a wide-char trigger handler detected during IME composition (e.g. /).
51
+ // Set by compositionupdate, cleared by compositionend. Used by handleKeyDown
52
+ // to intercept Enter that confirms the composition.
53
+ let pendingWideSlashHandler = null;
46
54
  return new SafePlugin({
47
55
  key: pluginKey,
48
56
  state: {
@@ -95,8 +103,53 @@ export function createPlugin({
95
103
  var _pluginKey$getState;
96
104
  return (_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
97
105
  },
106
+ handleKeyDown: (view, event) => {
107
+ // When composing a wide-char trigger (e.g. /), intercept the Enter key
108
+ // that confirms the composition so we can open the typeahead instead.
109
+ if (pendingWideSlashHandler && event.isComposing && (event.key === 'Enter' || event.keyCode === 13)) {
110
+ const handler = pendingWideSlashHandler;
111
+ pendingWideSlashHandler = null;
112
+ // Defer until ProseMirror has flushed the composed text into its state.
113
+ setTimeout(() => {
114
+ const command = openTypeAheadAtCursor({
115
+ triggerHandler: handler,
116
+ inputMethod: INPUT_METHOD.KEYBOARD
117
+ });
118
+ const tr = command({
119
+ tr: view.state.tr
120
+ });
121
+ if (tr) {
122
+ view.dispatch(tr);
123
+ }
124
+ }, 0);
125
+ return true;
126
+ }
127
+ return false;
128
+ },
98
129
  handleDOMEvents: {
130
+ compositionupdate: (view, event) => {
131
+ // When the experiment is on, track whether the current composition
132
+ // exactly matches a wide-char trigger (e.g. / from Japanese keyboard).
133
+ // We can't open the typeahead yet because composition is still active,
134
+ // but we record the matching handler so the next keydown (Enter) can use it.
135
+ if (expValEquals('platform_editor_wide_slash_trigger', 'isEnabled', true)) {
136
+ var _event$data, _typeAheadHandlers$fi;
137
+ const pendingData = (_event$data = event.data) !== null && _event$data !== void 0 ? _event$data : '';
138
+ pendingWideSlashHandler = (_typeAheadHandlers$fi = typeAheadHandlers.find(handler => {
139
+ if (!handler.customRegex) {
140
+ return false;
141
+ }
142
+ // Only match if the entire composition is a trigger character
143
+ const pattern = new RegExp(`^(${handler.customRegex})$`, 'u');
144
+ return pattern.test(pendingData);
145
+ })) !== null && _typeAheadHandlers$fi !== void 0 ? _typeAheadHandlers$fi : null;
146
+ }
147
+ return false;
148
+ },
99
149
  compositionend: (view, event) => {
150
+ // Clear the pending handler when composition ends (cancelled or committed
151
+ // via a non-Enter key like Space, which we don't want to intercept).
152
+ pendingWideSlashHandler = null;
100
153
  return false;
101
154
  },
102
155
  click: (view, event) => {
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { openTypeAhead, openTypeAheadAtCursor } from '../pm-plugins/commands/open-typeahead-at-cursor';
@@ -1,5 +1,6 @@
1
1
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { ACTIONS } from '../actions';
4
5
  import { pluginKey } from '../key';
5
6
  export var openTypeAhead = function openTypeAhead(props) {
@@ -43,7 +44,7 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
43
44
  // delete 1 pos before wherever selection is now - that will delete the empty space
44
45
  tr.delete(tr.selection.from - 1, tr.selection.from);
45
46
  } else {
46
- var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
47
+ var _selection$$head$pare, _selection$$head$pare2, _selection$$head;
47
48
  if (selection instanceof NodeSelection) {
48
49
  if (isInline) {
49
50
  tr.deleteSelection();
@@ -72,7 +73,11 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
72
73
  // being inserted due to composition by checking if we have the trigger
73
74
  // directly before the typeahead. This should not happen unless it has
74
75
  // been eroneously added because we require whitespace/newline for typeahead.
75
- if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && (_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) {
76
+ // Check if the text ends with the trigger character (or any character matched
77
+ // by customRegex, to support wide-char variants like fullwidth slash /)
78
+ var triggerPattern = expValEquals('platform_editor_wide_slash_trigger', 'isEnabled', true) && triggerHandler.customRegex ? new RegExp("(".concat(triggerHandler.customRegex, ")$"), 'u') : null;
79
+ var endsWithTrigger = ((_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) === null || _selection$$head$pare === void 0 ? void 0 : _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) || triggerPattern && triggerPattern.test(selection.$head.parent.textContent);
80
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && endsWithTrigger) {
76
81
  tr.delete(cursorPos - 1, cursorPos);
77
82
  }
78
83
  }
@@ -1,9 +1,12 @@
1
1
  import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
4
  import { closest } from '@atlaskit/editor-common/utils';
4
5
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
8
  import { ACTIONS } from './actions';
9
+ import { openTypeAheadAtCursor } from './commands/open-typeahead-at-cursor';
7
10
  import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from './constants';
8
11
  import { factoryDecorations } from './decorations';
9
12
  import { isInsertionTransaction } from './isInsertionTransaction';
@@ -43,6 +46,11 @@ export function createPlugin(_ref) {
43
46
  typeAheadHandlers: typeAheadHandlers,
44
47
  popupMountRef: popupMountRef
45
48
  });
49
+
50
+ // Tracks a wide-char trigger handler detected during IME composition (e.g. /).
51
+ // Set by compositionupdate, cleared by compositionend. Used by handleKeyDown
52
+ // to intercept Enter that confirms the composition.
53
+ var pendingWideSlashHandler = null;
46
54
  return new SafePlugin({
47
55
  key: pluginKey,
48
56
  state: {
@@ -95,8 +103,53 @@ export function createPlugin(_ref) {
95
103
  var _pluginKey$getState;
96
104
  return (_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
97
105
  },
106
+ handleKeyDown: function handleKeyDown(view, event) {
107
+ // When composing a wide-char trigger (e.g. /), intercept the Enter key
108
+ // that confirms the composition so we can open the typeahead instead.
109
+ if (pendingWideSlashHandler && event.isComposing && (event.key === 'Enter' || event.keyCode === 13)) {
110
+ var handler = pendingWideSlashHandler;
111
+ pendingWideSlashHandler = null;
112
+ // Defer until ProseMirror has flushed the composed text into its state.
113
+ setTimeout(function () {
114
+ var command = openTypeAheadAtCursor({
115
+ triggerHandler: handler,
116
+ inputMethod: INPUT_METHOD.KEYBOARD
117
+ });
118
+ var tr = command({
119
+ tr: view.state.tr
120
+ });
121
+ if (tr) {
122
+ view.dispatch(tr);
123
+ }
124
+ }, 0);
125
+ return true;
126
+ }
127
+ return false;
128
+ },
98
129
  handleDOMEvents: {
130
+ compositionupdate: function compositionupdate(view, event) {
131
+ // When the experiment is on, track whether the current composition
132
+ // exactly matches a wide-char trigger (e.g. / from Japanese keyboard).
133
+ // We can't open the typeahead yet because composition is still active,
134
+ // but we record the matching handler so the next keydown (Enter) can use it.
135
+ if (expValEquals('platform_editor_wide_slash_trigger', 'isEnabled', true)) {
136
+ var _event$data, _typeAheadHandlers$fi;
137
+ var pendingData = (_event$data = event.data) !== null && _event$data !== void 0 ? _event$data : '';
138
+ pendingWideSlashHandler = (_typeAheadHandlers$fi = typeAheadHandlers.find(function (handler) {
139
+ if (!handler.customRegex) {
140
+ return false;
141
+ }
142
+ // Only match if the entire composition is a trigger character
143
+ var pattern = new RegExp("^(".concat(handler.customRegex, ")$"), 'u');
144
+ return pattern.test(pendingData);
145
+ })) !== null && _typeAheadHandlers$fi !== void 0 ? _typeAheadHandlers$fi : null;
146
+ }
147
+ return false;
148
+ },
99
149
  compositionend: function compositionend(view, event) {
150
+ // Clear the pending handler when composition ends (cancelled or committed
151
+ // via a non-Enter key like Space, which we don't want to intercept).
152
+ pendingWideSlashHandler = null;
100
153
  return false;
101
154
  },
102
155
  click: function click(view, event) {
@@ -0,0 +1 @@
1
+ export { openTypeAhead, openTypeAheadAtCursor } from '../pm-plugins/commands/open-typeahead-at-cursor';
@@ -0,0 +1 @@
1
+ export { openTypeAhead, openTypeAheadAtCursor } from '../pm-plugins/commands/open-typeahead-at-cursor';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "10.3.0",
3
+ "version": "10.3.2",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,8 +44,8 @@
44
44
  "@atlaskit/primitives": "^19.0.0",
45
45
  "@atlaskit/prosemirror-history": "^0.2.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.7.0",
47
- "@atlaskit/tmp-editor-statsig": "^84.3.0",
48
- "@atlaskit/tokens": "^13.0.0",
47
+ "@atlaskit/tmp-editor-statsig": "^85.0.0",
48
+ "@atlaskit/tokens": "^13.1.0",
49
49
  "@atlaskit/visually-hidden": "^3.1.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",