@atlaskit/editor-plugin-type-ahead 1.11.1 → 1.11.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/pm-plugins/api.js +2 -0
  3. package/dist/cjs/pm-plugins/decorations.js +8 -1
  4. package/dist/cjs/pm-plugins/input-rules.js +3 -0
  5. package/dist/cjs/pm-plugins/main.js +2 -0
  6. package/dist/cjs/pm-plugins/utils.js +4 -1
  7. package/dist/cjs/ui/AssistiveText.js +13 -9
  8. package/dist/cjs/ui/InputQuery.js +24 -0
  9. package/dist/cjs/ui/TypeAheadList.js +6 -0
  10. package/dist/cjs/ui/TypeAheadMenu.js +4 -1
  11. package/dist/cjs/ui/TypeAheadPopup.js +18 -0
  12. package/dist/cjs/ui/WrapperTypeAhead.js +3 -0
  13. package/dist/cjs/ui/hooks/use-item-insert.js +4 -1
  14. package/dist/es2019/index.js +3 -0
  15. package/dist/es2019/pm-plugins/api.js +2 -0
  16. package/dist/es2019/pm-plugins/decorations.js +8 -1
  17. package/dist/es2019/pm-plugins/input-rules.js +3 -0
  18. package/dist/es2019/pm-plugins/main.js +2 -0
  19. package/dist/es2019/pm-plugins/utils.js +4 -1
  20. package/dist/es2019/ui/AssistiveText.js +7 -0
  21. package/dist/es2019/ui/InputQuery.js +25 -1
  22. package/dist/es2019/ui/TypeAheadList.js +6 -0
  23. package/dist/es2019/ui/TypeAheadMenu.js +4 -1
  24. package/dist/es2019/ui/TypeAheadPopup.js +18 -0
  25. package/dist/es2019/ui/WrapperTypeAhead.js +3 -0
  26. package/dist/es2019/ui/hooks/use-item-insert.js +4 -1
  27. package/dist/esm/index.js +3 -0
  28. package/dist/esm/pm-plugins/api.js +2 -0
  29. package/dist/esm/pm-plugins/decorations.js +8 -1
  30. package/dist/esm/pm-plugins/input-rules.js +3 -0
  31. package/dist/esm/pm-plugins/main.js +2 -0
  32. package/dist/esm/pm-plugins/utils.js +4 -1
  33. package/dist/esm/ui/AssistiveText.js +13 -9
  34. package/dist/esm/ui/InputQuery.js +24 -0
  35. package/dist/esm/ui/TypeAheadList.js +6 -0
  36. package/dist/esm/ui/TypeAheadMenu.js +4 -1
  37. package/dist/esm/ui/TypeAheadPopup.js +18 -0
  38. package/dist/esm/ui/WrapperTypeAhead.js +3 -0
  39. package/dist/esm/ui/hooks/use-item-insert.js +4 -1
  40. package/dist/types/pm-plugins/commands/insert-type-ahead-item.d.ts +1 -1
  41. package/dist/types/pm-plugins/commands/update-list-items.d.ts +1 -2
  42. package/dist/types/pm-plugins/item-is-disabled.d.ts +1 -2
  43. package/dist/types/pm-plugins/utils.d.ts +2 -2
  44. package/dist/types/types/index.d.ts +2 -2
  45. package/dist/types/ui/InputQuery.d.ts +1 -1
  46. package/dist/types/ui/TypeAheadList.d.ts +2 -2
  47. package/dist/types/ui/TypeAheadListItem.d.ts +1 -2
  48. package/dist/types/ui/TypeAheadPopup.d.ts +2 -2
  49. package/dist/types/ui/hooks/use-item-insert.d.ts +2 -2
  50. package/dist/types/ui/hooks/use-load-items.d.ts +1 -1
  51. package/dist/types/ui/hooks/use-on-force-select.d.ts +1 -1
  52. package/dist/types-ts4.5/pm-plugins/commands/insert-type-ahead-item.d.ts +1 -1
  53. package/dist/types-ts4.5/pm-plugins/commands/update-list-items.d.ts +1 -2
  54. package/dist/types-ts4.5/pm-plugins/item-is-disabled.d.ts +1 -2
  55. package/dist/types-ts4.5/pm-plugins/utils.d.ts +2 -2
  56. package/dist/types-ts4.5/types/index.d.ts +2 -2
  57. package/dist/types-ts4.5/ui/InputQuery.d.ts +1 -1
  58. package/dist/types-ts4.5/ui/TypeAheadList.d.ts +2 -2
  59. package/dist/types-ts4.5/ui/TypeAheadListItem.d.ts +1 -2
  60. package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +2 -2
  61. package/dist/types-ts4.5/ui/hooks/use-item-insert.d.ts +2 -2
  62. package/dist/types-ts4.5/ui/hooks/use-load-items.d.ts +1 -1
  63. package/dist/types-ts4.5/ui/hooks/use-on-force-select.d.ts +1 -1
  64. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.11.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.11.1
4
16
 
5
17
  ### Patch Changes
@@ -50,6 +50,8 @@ var close = function close(_ref2) {
50
50
  }
51
51
  (0, _closeTypeAhead.closeTypeAhead)(tr);
52
52
  if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
53
+ // Ignored via go/ees005
54
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
53
55
  var handler = (0, _utils.getTypeAheadHandler)(state);
54
56
  var text = handler.trigger.concat(currentQuery);
55
57
  tr.replaceSelectionWith(state.schema.text(text));
@@ -42,7 +42,14 @@ var factoryDecorations = exports.factoryDecorations = function factoryDecoration
42
42
  var typeaheadComponent = document.createElement('mark');
43
43
  var stats = new _statsModifier.StatsModifier();
44
44
  var shouldFocusCursorInsideQuery = true;
45
- var deco = _view.Decoration.widget($cursor.pos, function (editorView, getDecorationPosition) {
45
+ var deco = _view.Decoration.widget($cursor.pos, function (editorView, getDecorationPositionUnsafe) {
46
+ var getDecorationPosition = function getDecorationPosition() {
47
+ try {
48
+ return getDecorationPositionUnsafe();
49
+ } catch (e) {
50
+ return undefined;
51
+ }
52
+ };
46
53
  typeaheadComponent.setAttribute('id', decorationId);
47
54
  typeaheadComponent.setAttribute('role', 'search');
48
55
  typeaheadComponent.dataset.typeAheadQuery = 'true';
@@ -19,6 +19,9 @@ function inputRulePlugin(schema, typeAheads, featureFlags) {
19
19
  if (!trigger) {
20
20
  return acc;
21
21
  }
22
+
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line require-unicode-regexp
22
25
  var regex = new RegExp("(^|[.!?\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(").concat(trigger, ")$"));
23
26
  acc.push((0, _utils.createRule)(regex, function (state, match) {
24
27
  return (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
@@ -63,6 +63,8 @@ function createPlugin(_ref) {
63
63
  inputMethod: null
64
64
  };
65
65
  },
66
+ // Ignored via go/ees005
67
+ // eslint-disable-next-line @typescript-eslint/max-params
66
68
  apply: function apply(tr, currentPluginState, oldEditorState, state) {
67
69
  var customStep = hasValidTypeAheadStep(tr);
68
70
  var nextPluginState = reducer(tr, currentPluginState, customStep);
@@ -45,7 +45,10 @@ var findHandler = exports.findHandler = function findHandler(id, state) {
45
45
  return h.id === id;
46
46
  }) || null;
47
47
  };
48
- var skipForwardToSafeItem = exports.skipForwardToSafeItem = function skipForwardToSafeItem(currentIndex, nextIndex, listSize, itemIsDisabled) {
48
+ var skipForwardToSafeItem = exports.skipForwardToSafeItem = function skipForwardToSafeItem(currentIndex, nextIndex, listSize, itemIsDisabled
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line @typescript-eslint/max-params
51
+ ) {
49
52
  // Use a loop to find the next selectable item
50
53
  for (var idx = nextIndex; idx < listSize; idx++) {
51
54
  if (!itemIsDisabled(idx)) {
@@ -9,10 +9,9 @@ exports.AssistiveTextNew = exports.AssistiveText = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
15
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
16
  var _react = _interopRequireWildcard(require("react"));
18
17
  var _react2 = require("@emotion/react");
@@ -20,7 +19,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
20
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
22
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
24
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
25
24
  * @jsxRuntime classic
26
25
  * @jsx jsx
@@ -38,17 +37,18 @@ var assitiveTextStyles = (0, _react2.css)({
38
37
  whitespace: 'nowrap',
39
38
  width: '1px'
40
39
  });
40
+
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line @repo/internal/react/no-class-components
41
43
  var AssistveTextOld = /*#__PURE__*/function (_React$Component) {
42
- (0, _inherits2.default)(AssistveTextOld, _React$Component);
43
- var _super = _createSuper(AssistveTextOld);
44
44
  function AssistveTextOld() {
45
45
  var _this;
46
46
  (0, _classCallCheck2.default)(this, AssistveTextOld);
47
47
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
48
  args[_key] = arguments[_key];
49
49
  }
50
- _this = _super.call.apply(_super, [this].concat(args));
51
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
50
+ _this = _callSuper(this, AssistveTextOld, [].concat(args));
51
+ (0, _defineProperty2.default)(_this, "state", {
52
52
  bump: false,
53
53
  //when the same text needs to be read again, Hence it needs to be toggled between __status--A and __status--B
54
54
  debounced: false,
@@ -56,7 +56,8 @@ var AssistveTextOld = /*#__PURE__*/function (_React$Component) {
56
56
  });
57
57
  return _this;
58
58
  }
59
- (0, _createClass2.default)(AssistveTextOld, [{
59
+ (0, _inherits2.default)(AssistveTextOld, _React$Component);
60
+ return (0, _createClass2.default)(AssistveTextOld, [{
60
61
  key: "UNSAFE_componentWillMount",
61
62
  value: function UNSAFE_componentWillMount() {
62
63
  var _this2 = this;
@@ -118,7 +119,6 @@ var AssistveTextOld = /*#__PURE__*/function (_React$Component) {
118
119
  }, "".concat(!silenced && debounced && !bump ? assistiveText : '')));
119
120
  }
120
121
  }]);
121
- return AssistveTextOld;
122
122
  }(_react.default.Component);
123
123
  (0, _defineProperty2.default)(AssistveTextOld, "defaultProps", {
124
124
  statusDebounceMillis: 1400,
@@ -193,8 +193,12 @@ var AssistiveTextNew = exports.AssistiveTextNew = function AssistiveTextNew(_ref
193
193
  };
194
194
  var AssistiveText = exports.AssistiveText = function AssistiveText(props) {
195
195
  if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
196
+ // Ignored via go/ees005
197
+ // eslint-disable-next-line react/jsx-props-no-spreading
196
198
  return (0, _react2.jsx)(AssistiveTextNew, props);
197
199
  } else {
200
+ // Ignored via go/ees005
201
+ // eslint-disable-next-line react/jsx-props-no-spreading
198
202
  return (0, _react2.jsx)(AssistveTextOld, props);
199
203
  }
200
204
  };
@@ -332,18 +332,40 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
332
332
  return;
333
333
  }
334
334
  };
335
+
336
+ // Ignored via go/ees005
337
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
335
338
  element.addEventListener('input', _onInput);
336
339
  }
340
+
341
+ // Ignored via go/ees005
342
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
337
343
  element.addEventListener('focusout', onFocusOut);
344
+ // Ignored via go/ees005
345
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
338
346
  element.addEventListener('focusin', onFocusIn);
347
+ // Ignored via go/ees005
348
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
339
349
  element.addEventListener('keydown', keyDown);
350
+ // Ignored via go/ees005
351
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
340
352
  element.addEventListener('beforeinput', beforeinput);
341
353
  return function () {
354
+ // Ignored via go/ees005
355
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
342
356
  element.removeEventListener('focusout', onFocusOut);
357
+ // Ignored via go/ees005
358
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
343
359
  element.removeEventListener('focusin', onFocusIn);
360
+ // Ignored via go/ees005
361
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
344
362
  element.removeEventListener('keydown', keyDown);
363
+ // Ignored via go/ees005
364
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
345
365
  element.removeEventListener('beforeinput', beforeinput);
346
366
  if (_browser.browser.safari) {
367
+ // Ignored via go/ees005
368
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
347
369
  element.removeEventListener('input', onInput);
348
370
  }
349
371
  };
@@ -351,6 +373,8 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
351
373
  (0, _react.useLayoutEffect)(function () {
352
374
  var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
353
375
  if (ref.current && forceFocus) {
376
+ // Ignored via go/ees005
377
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
354
378
  setQuery(hasReopenQuery ? reopenQuery : null);
355
379
  requestAnimationFrame(function () {
356
380
  if (!(ref !== null && ref !== void 0 && ref.current)) {
@@ -177,6 +177,8 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
177
177
  requestAnimationFrame(function () {
178
178
  var _listContainerRef$cur;
179
179
  if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
180
+ // Ignored via go/ees005
181
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
180
182
  listContainerRef.current.firstChild.scrollTo(0, 0);
181
183
  }
182
184
  });
@@ -233,8 +235,12 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
233
235
  focusTargetElement();
234
236
  }
235
237
  };
238
+ // Ignored via go/ees005
239
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
236
240
  element === null || element === void 0 || element.addEventListener('keydown', handleKeyDown);
237
241
  return function () {
242
+ // Ignored via go/ees005
243
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
238
244
  element === null || element === void 0 || element.removeEventListener('keydown', handleKeyDown);
239
245
  };
240
246
  }, [editorView.state, focusTargetElement, selectNextItem, selectPreviousItem, selectedIndex, onItemClick, items.length]);
@@ -24,7 +24,10 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
24
24
  decorationElement = typeAheadState.decorationElement,
25
25
  decorationSet = typeAheadState.decorationSet,
26
26
  query = typeAheadState.query;
27
- var _useItemInsert = (0, _useItemInsert3.useItemInsert)(triggerHandler, editorView, items, api),
27
+ var _useItemInsert = (0, _useItemInsert3.useItemInsert)(
28
+ // Ignored via go/ees005
29
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
30
+ triggerHandler, editorView, items, api),
28
31
  _useItemInsert2 = (0, _slicedToArray2.default)(_useItemInsert, 3),
29
32
  onItemInsert = _useItemInsert2[0],
30
33
  onTextInsert = _useItemInsert2[1],
@@ -164,15 +164,25 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
164
164
  }, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
165
165
  var getFitHeightDebounced = (0, _rafSchd.default)(getFitHeight);
166
166
  (0, _react.useLayoutEffect)(function () {
167
+ // Ignored via go/ees005
168
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
167
169
  var scrollableElement = popupsScrollableElement || (0, _ui.findOverflowScrollParent)(anchorElement);
168
170
  getFitHeight();
171
+ // Ignored via go/ees005
172
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
169
173
  window.addEventListener('resize', getFitHeightDebounced);
170
174
  if (scrollableElement) {
175
+ // Ignored via go/ees005
176
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
171
177
  scrollableElement.addEventListener('scroll', getFitHeightDebounced);
172
178
  }
173
179
  return function () {
180
+ // Ignored via go/ees005
181
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
174
182
  window.removeEventListener('resize', getFitHeightDebounced);
175
183
  if (scrollableElement) {
184
+ // Ignored via go/ees005
185
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
176
186
  scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
177
187
  }
178
188
  };
@@ -198,8 +208,12 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
198
208
  });
199
209
  };
200
210
  var element = ref.current;
211
+ // Ignored via go/ees005
212
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
201
213
  element === null || element === void 0 || element.addEventListener('focusout', focusOut);
202
214
  return function () {
215
+ // Ignored via go/ees005
216
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
203
217
  element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
204
218
  };
205
219
  }, [ref, cancel]);
@@ -217,8 +231,12 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
217
231
  }
218
232
  };
219
233
  var element = ref.current;
234
+ // Ignored via go/ees005
235
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
220
236
  element === null || element === void 0 || element.addEventListener('keydown', escape);
221
237
  return function () {
238
+ // Ignored via go/ees005
239
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
222
240
  element === null || element === void 0 || element.removeEventListener('keydown', escape);
223
241
  };
224
242
  }, [ref, cancel]);
@@ -79,6 +79,9 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
79
79
  var insertSelectedItem = (0, _react.useCallback)(function () {
80
80
  var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _typeAhead.SelectItemMode.SELECTED;
81
81
  var view = editorViewRef.current;
82
+
83
+ // Ignored via go/ees005
84
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
82
85
  var _ref3 = (0, _utils.getPluginState)(view.state),
83
86
  selectedIndex = _ref3.selectedIndex;
84
87
  var safeSelectedIndex = (0, _utils.skipForwardToSafeItem)(selectedIndex, 1, items.length, function (idx) {
@@ -31,7 +31,10 @@ var insertRawQuery = function insertRawQuery(_ref) {
31
31
  view.focus();
32
32
  }
33
33
  };
34
- var useItemInsert = exports.useItemInsert = function useItemInsert(triggerHandler, editorView, items, api) {
34
+ var useItemInsert = exports.useItemInsert = function useItemInsert(triggerHandler, editorView, items, api
35
+ // Ignored via go/ees005
36
+ // eslint-disable-next-line @typescript-eslint/max-params
37
+ ) {
35
38
  var editorViewRef = (0, _react.useRef)(editorView);
36
39
  var itemsRef = (0, _react.useRef)(items);
37
40
  var onTextInsert = (0, _react.useCallback)(function (_ref2) {
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { typeAheadPlugin } from './typeAheadPlugin';
@@ -46,6 +46,8 @@ const close = ({
46
46
  }
47
47
  closeTypeAhead(tr);
48
48
  if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
51
  const handler = getTypeAheadHandler(state);
50
52
  const text = handler.trigger.concat(currentQuery);
51
53
  tr.replaceSelectionWith(state.schema.text(text));
@@ -41,7 +41,14 @@ export const factoryDecorations = ({
41
41
  const typeaheadComponent = document.createElement('mark');
42
42
  const stats = new StatsModifier();
43
43
  let shouldFocusCursorInsideQuery = true;
44
- const deco = Decoration.widget($cursor.pos, (editorView, getDecorationPosition) => {
44
+ const deco = Decoration.widget($cursor.pos, (editorView, getDecorationPositionUnsafe) => {
45
+ const getDecorationPosition = () => {
46
+ try {
47
+ return getDecorationPositionUnsafe();
48
+ } catch (e) {
49
+ return undefined;
50
+ }
51
+ };
45
52
  typeaheadComponent.setAttribute('id', decorationId);
46
53
  typeaheadComponent.setAttribute('role', 'search');
47
54
  typeaheadComponent.dataset.typeAheadQuery = 'true';
@@ -12,6 +12,9 @@ export function inputRulePlugin(schema, typeAheads, featureFlags) {
12
12
  if (!trigger) {
13
13
  return acc;
14
14
  }
15
+
16
+ // Ignored via go/ees005
17
+ // eslint-disable-next-line require-unicode-regexp
15
18
  const regex = new RegExp(`(^|[.!?\\s${leafNodeReplacementCharacter}])(${trigger})$`);
16
19
  acc.push(createRule(regex, (state, match) => {
17
20
  return openTypeAheadAtCursor({
@@ -57,6 +57,8 @@ export function createPlugin({
57
57
  inputMethod: null
58
58
  };
59
59
  },
60
+ // Ignored via go/ees005
61
+ // eslint-disable-next-line @typescript-eslint/max-params
60
62
  apply(tr, currentPluginState, oldEditorState, state) {
61
63
  const customStep = hasValidTypeAheadStep(tr);
62
64
  const nextPluginState = reducer(tr, currentPluginState, customStep);
@@ -39,7 +39,10 @@ export const findHandler = (id, state) => {
39
39
  } = pluginState;
40
40
  return typeAheadHandlers.find(h => h.id === id) || null;
41
41
  };
42
- export const skipForwardToSafeItem = (currentIndex, nextIndex, listSize, itemIsDisabled) => {
42
+ export const skipForwardToSafeItem = (currentIndex, nextIndex, listSize, itemIsDisabled
43
+ // Ignored via go/ees005
44
+ // eslint-disable-next-line @typescript-eslint/max-params
45
+ ) => {
43
46
  // Use a loop to find the next selectable item
44
47
  for (let idx = nextIndex; idx < listSize; idx++) {
45
48
  if (!itemIsDisabled(idx)) {
@@ -23,6 +23,9 @@ const assitiveTextStyles = css({
23
23
  whitespace: 'nowrap',
24
24
  width: '1px'
25
25
  });
26
+
27
+ // Ignored via go/ees005
28
+ // eslint-disable-next-line @repo/internal/react/no-class-components
26
29
  class AssistveTextOld extends React.Component {
27
30
  constructor(...args) {
28
31
  super(...args);
@@ -141,8 +144,12 @@ export const AssistiveTextNew = ({
141
144
  };
142
145
  export const AssistiveText = props => {
143
146
  if (fg('platform_editor_react18_phase2_v2')) {
147
+ // Ignored via go/ees005
148
+ // eslint-disable-next-line react/jsx-props-no-spreading
144
149
  return jsx(AssistiveTextNew, props);
145
150
  } else {
151
+ // Ignored via go/ees005
152
+ // eslint-disable-next-line react/jsx-props-no-spreading
146
153
  return jsx(AssistveTextOld, props);
147
154
  }
148
155
  };
@@ -304,7 +304,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
304
304
  }
305
305
  }
306
306
  };
307
- let onInput = () => {};
307
+ const onInput = () => {};
308
308
  if (browser.safari) {
309
309
  // On Safari, for reasons beyond my understanding,
310
310
  // The undo behavior is totally different from other browsers
@@ -324,18 +324,40 @@ export const InputQuery = /*#__PURE__*/React.memo(({
324
324
  return;
325
325
  }
326
326
  };
327
+
328
+ // Ignored via go/ees005
329
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
327
330
  element.addEventListener('input', onInput);
328
331
  }
332
+
333
+ // Ignored via go/ees005
334
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
329
335
  element.addEventListener('focusout', onFocusOut);
336
+ // Ignored via go/ees005
337
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
330
338
  element.addEventListener('focusin', onFocusIn);
339
+ // Ignored via go/ees005
340
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
331
341
  element.addEventListener('keydown', keyDown);
342
+ // Ignored via go/ees005
343
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
332
344
  element.addEventListener('beforeinput', beforeinput);
333
345
  return () => {
346
+ // Ignored via go/ees005
347
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
334
348
  element.removeEventListener('focusout', onFocusOut);
349
+ // Ignored via go/ees005
350
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
335
351
  element.removeEventListener('focusin', onFocusIn);
352
+ // Ignored via go/ees005
353
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
336
354
  element.removeEventListener('keydown', keyDown);
355
+ // Ignored via go/ees005
356
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
337
357
  element.removeEventListener('beforeinput', beforeinput);
338
358
  if (browser.safari) {
359
+ // Ignored via go/ees005
360
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
339
361
  element.removeEventListener('input', onInput);
340
362
  }
341
363
  };
@@ -343,6 +365,8 @@ export const InputQuery = /*#__PURE__*/React.memo(({
343
365
  useLayoutEffect(() => {
344
366
  const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
345
367
  if (ref.current && forceFocus) {
368
+ // Ignored via go/ees005
369
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
346
370
  setQuery(hasReopenQuery ? reopenQuery : null);
347
371
  requestAnimationFrame(() => {
348
372
  if (!(ref !== null && ref !== void 0 && ref.current)) {
@@ -157,6 +157,8 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
157
157
  requestAnimationFrame(() => {
158
158
  var _listContainerRef$cur;
159
159
  if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
160
+ // Ignored via go/ees005
161
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
160
162
  listContainerRef.current.firstChild.scrollTo(0, 0);
161
163
  }
162
164
  });
@@ -215,8 +217,12 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
215
217
  focusTargetElement();
216
218
  }
217
219
  };
220
+ // Ignored via go/ees005
221
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
218
222
  element === null || element === void 0 ? void 0 : element.addEventListener('keydown', handleKeyDown);
219
223
  return () => {
224
+ // Ignored via go/ees005
225
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
220
226
  element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', handleKeyDown);
221
227
  };
222
228
  }, [editorView.state, focusTargetElement, selectNextItem, selectPreviousItem, selectedIndex, onItemClick, items.length]);
@@ -19,7 +19,10 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
19
19
  decorationSet,
20
20
  query
21
21
  } = typeAheadState;
22
- const [onItemInsert, onTextInsert, onItemMatch] = useItemInsert(triggerHandler, editorView, items, api);
22
+ const [onItemInsert, onTextInsert, onItemMatch] = useItemInsert(
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
25
+ triggerHandler, editorView, items, api);
23
26
  const setSelectedItem = React.useCallback(({
24
27
  index: nextIndex
25
28
  }) => {
@@ -151,15 +151,25 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
151
151
  }, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
152
152
  const getFitHeightDebounced = rafSchedule(getFitHeight);
153
153
  useLayoutEffect(() => {
154
+ // Ignored via go/ees005
155
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
154
156
  const scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
155
157
  getFitHeight();
158
+ // Ignored via go/ees005
159
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
156
160
  window.addEventListener('resize', getFitHeightDebounced);
157
161
  if (scrollableElement) {
162
+ // Ignored via go/ees005
163
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
158
164
  scrollableElement.addEventListener('scroll', getFitHeightDebounced);
159
165
  }
160
166
  return () => {
167
+ // Ignored via go/ees005
168
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
161
169
  window.removeEventListener('resize', getFitHeightDebounced);
162
170
  if (scrollableElement) {
171
+ // Ignored via go/ees005
172
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
163
173
  scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
164
174
  }
165
175
  };
@@ -189,8 +199,12 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
189
199
  const {
190
200
  current: element
191
201
  } = ref;
202
+ // Ignored via go/ees005
203
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
192
204
  element === null || element === void 0 ? void 0 : element.addEventListener('focusout', focusOut);
193
205
  return () => {
206
+ // Ignored via go/ees005
207
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
194
208
  element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
195
209
  };
196
210
  }, [ref, cancel]);
@@ -210,8 +224,12 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
210
224
  const {
211
225
  current: element
212
226
  } = ref;
227
+ // Ignored via go/ees005
228
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
213
229
  element === null || element === void 0 ? void 0 : element.addEventListener('keydown', escape);
214
230
  return () => {
231
+ // Ignored via go/ees005
232
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
215
233
  element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
216
234
  };
217
235
  }, [ref, cancel]);
@@ -58,6 +58,9 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
58
58
  const {
59
59
  current: view
60
60
  } = editorViewRef;
61
+
62
+ // Ignored via go/ees005
63
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
64
  const {
62
65
  selectedIndex
63
66
  } = getPluginState(view.state);
@@ -27,7 +27,10 @@ const insertRawQuery = ({
27
27
  view.focus();
28
28
  }
29
29
  };
30
- export const useItemInsert = (triggerHandler, editorView, items, api) => {
30
+ export const useItemInsert = (triggerHandler, editorView, items, api
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @typescript-eslint/max-params
33
+ ) => {
31
34
  const editorViewRef = useRef(editorView);
32
35
  const itemsRef = useRef(items);
33
36
  const onTextInsert = useCallback(({
package/dist/esm/index.js CHANGED
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { typeAheadPlugin } from './typeAheadPlugin';
@@ -44,6 +44,8 @@ var close = function close(_ref2) {
44
44
  }
45
45
  closeTypeAhead(tr);
46
46
  if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
47
+ // Ignored via go/ees005
48
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
49
  var handler = getTypeAheadHandler(state);
48
50
  var text = handler.trigger.concat(currentQuery);
49
51
  tr.replaceSelectionWith(state.schema.text(text));
@@ -35,7 +35,14 @@ export var factoryDecorations = function factoryDecorations(_ref) {
35
35
  var typeaheadComponent = document.createElement('mark');
36
36
  var stats = new StatsModifier();
37
37
  var shouldFocusCursorInsideQuery = true;
38
- var deco = Decoration.widget($cursor.pos, function (editorView, getDecorationPosition) {
38
+ var deco = Decoration.widget($cursor.pos, function (editorView, getDecorationPositionUnsafe) {
39
+ var getDecorationPosition = function getDecorationPosition() {
40
+ try {
41
+ return getDecorationPositionUnsafe();
42
+ } catch (e) {
43
+ return undefined;
44
+ }
45
+ };
39
46
  typeaheadComponent.setAttribute('id', decorationId);
40
47
  typeaheadComponent.setAttribute('role', 'search');
41
48
  typeaheadComponent.dataset.typeAheadQuery = 'true';
@@ -12,6 +12,9 @@ export function inputRulePlugin(schema, typeAheads, featureFlags) {
12
12
  if (!trigger) {
13
13
  return acc;
14
14
  }
15
+
16
+ // Ignored via go/ees005
17
+ // eslint-disable-next-line require-unicode-regexp
15
18
  var regex = new RegExp("(^|[.!?\\s".concat(leafNodeReplacementCharacter, "])(").concat(trigger, ")$"));
16
19
  acc.push(createRule(regex, function (state, match) {
17
20
  return openTypeAheadAtCursor({
@@ -57,6 +57,8 @@ export function createPlugin(_ref) {
57
57
  inputMethod: null
58
58
  };
59
59
  },
60
+ // Ignored via go/ees005
61
+ // eslint-disable-next-line @typescript-eslint/max-params
60
62
  apply: function apply(tr, currentPluginState, oldEditorState, state) {
61
63
  var customStep = hasValidTypeAheadStep(tr);
62
64
  var nextPluginState = reducer(tr, currentPluginState, customStep);