@atlaskit/editor-plugin-type-ahead 1.11.2 → 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 (35) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/pm-plugins/api.js +2 -0
  3. package/dist/cjs/pm-plugins/input-rules.js +3 -0
  4. package/dist/cjs/pm-plugins/main.js +2 -0
  5. package/dist/cjs/pm-plugins/utils.js +4 -1
  6. package/dist/cjs/ui/AssistiveText.js +7 -0
  7. package/dist/cjs/ui/InputQuery.js +24 -0
  8. package/dist/cjs/ui/TypeAheadList.js +6 -0
  9. package/dist/cjs/ui/TypeAheadMenu.js +4 -1
  10. package/dist/cjs/ui/TypeAheadPopup.js +18 -0
  11. package/dist/cjs/ui/WrapperTypeAhead.js +3 -0
  12. package/dist/cjs/ui/hooks/use-item-insert.js +4 -1
  13. package/dist/es2019/pm-plugins/api.js +2 -0
  14. package/dist/es2019/pm-plugins/input-rules.js +3 -0
  15. package/dist/es2019/pm-plugins/main.js +2 -0
  16. package/dist/es2019/pm-plugins/utils.js +4 -1
  17. package/dist/es2019/ui/AssistiveText.js +7 -0
  18. package/dist/es2019/ui/InputQuery.js +25 -1
  19. package/dist/es2019/ui/TypeAheadList.js +6 -0
  20. package/dist/es2019/ui/TypeAheadMenu.js +4 -1
  21. package/dist/es2019/ui/TypeAheadPopup.js +18 -0
  22. package/dist/es2019/ui/WrapperTypeAhead.js +3 -0
  23. package/dist/es2019/ui/hooks/use-item-insert.js +4 -1
  24. package/dist/esm/pm-plugins/api.js +2 -0
  25. package/dist/esm/pm-plugins/input-rules.js +3 -0
  26. package/dist/esm/pm-plugins/main.js +2 -0
  27. package/dist/esm/pm-plugins/utils.js +4 -1
  28. package/dist/esm/ui/AssistiveText.js +7 -0
  29. package/dist/esm/ui/InputQuery.js +24 -0
  30. package/dist/esm/ui/TypeAheadList.js +6 -0
  31. package/dist/esm/ui/TypeAheadMenu.js +4 -1
  32. package/dist/esm/ui/TypeAheadPopup.js +18 -0
  33. package/dist/esm/ui/WrapperTypeAhead.js +3 -0
  34. package/dist/esm/ui/hooks/use-item-insert.js +4 -1
  35. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 1.11.2
4
10
 
5
11
  ### 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));
@@ -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)) {
@@ -37,6 +37,9 @@ var assitiveTextStyles = (0, _react2.css)({
37
37
  whitespace: 'nowrap',
38
38
  width: '1px'
39
39
  });
40
+
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line @repo/internal/react/no-class-components
40
43
  var AssistveTextOld = /*#__PURE__*/function (_React$Component) {
41
44
  function AssistveTextOld() {
42
45
  var _this;
@@ -190,8 +193,12 @@ var AssistiveTextNew = exports.AssistiveTextNew = function AssistiveTextNew(_ref
190
193
  };
191
194
  var AssistiveText = exports.AssistiveText = function AssistiveText(props) {
192
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
193
198
  return (0, _react2.jsx)(AssistiveTextNew, props);
194
199
  } else {
200
+ // Ignored via go/ees005
201
+ // eslint-disable-next-line react/jsx-props-no-spreading
195
202
  return (0, _react2.jsx)(AssistveTextOld, props);
196
203
  }
197
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) {
@@ -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));
@@ -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(({
@@ -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));
@@ -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);
@@ -39,7 +39,10 @@ export var findHandler = function findHandler(id, state) {
39
39
  return h.id === id;
40
40
  }) || null;
41
41
  };
42
- export var skipForwardToSafeItem = function skipForwardToSafeItem(currentIndex, nextIndex, listSize, itemIsDisabled) {
42
+ export var skipForwardToSafeItem = function 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 (var idx = nextIndex; idx < listSize; idx++) {
45
48
  if (!itemIsDisabled(idx)) {
@@ -31,6 +31,9 @@ var assitiveTextStyles = css({
31
31
  whitespace: 'nowrap',
32
32
  width: '1px'
33
33
  });
34
+
35
+ // Ignored via go/ees005
36
+ // eslint-disable-next-line @repo/internal/react/no-class-components
34
37
  var AssistveTextOld = /*#__PURE__*/function (_React$Component) {
35
38
  function AssistveTextOld() {
36
39
  var _this;
@@ -184,8 +187,12 @@ export var AssistiveTextNew = function AssistiveTextNew(_ref3) {
184
187
  };
185
188
  export var AssistiveText = function AssistiveText(props) {
186
189
  if (fg('platform_editor_react18_phase2_v2')) {
190
+ // Ignored via go/ees005
191
+ // eslint-disable-next-line react/jsx-props-no-spreading
187
192
  return jsx(AssistiveTextNew, props);
188
193
  } else {
194
+ // Ignored via go/ees005
195
+ // eslint-disable-next-line react/jsx-props-no-spreading
189
196
  return jsx(AssistveTextOld, props);
190
197
  }
191
198
  };
@@ -321,18 +321,40 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
321
321
  return;
322
322
  }
323
323
  };
324
+
325
+ // Ignored via go/ees005
326
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
324
327
  element.addEventListener('input', _onInput);
325
328
  }
329
+
330
+ // Ignored via go/ees005
331
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
326
332
  element.addEventListener('focusout', onFocusOut);
333
+ // Ignored via go/ees005
334
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
327
335
  element.addEventListener('focusin', onFocusIn);
336
+ // Ignored via go/ees005
337
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
328
338
  element.addEventListener('keydown', keyDown);
339
+ // Ignored via go/ees005
340
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
329
341
  element.addEventListener('beforeinput', beforeinput);
330
342
  return function () {
343
+ // Ignored via go/ees005
344
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
331
345
  element.removeEventListener('focusout', onFocusOut);
346
+ // Ignored via go/ees005
347
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
332
348
  element.removeEventListener('focusin', onFocusIn);
349
+ // Ignored via go/ees005
350
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
333
351
  element.removeEventListener('keydown', keyDown);
352
+ // Ignored via go/ees005
353
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
334
354
  element.removeEventListener('beforeinput', beforeinput);
335
355
  if (browser.safari) {
356
+ // Ignored via go/ees005
357
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
336
358
  element.removeEventListener('input', onInput);
337
359
  }
338
360
  };
@@ -340,6 +362,8 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
340
362
  useLayoutEffect(function () {
341
363
  var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
342
364
  if (ref.current && forceFocus) {
365
+ // Ignored via go/ees005
366
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
343
367
  setQuery(hasReopenQuery ? reopenQuery : null);
344
368
  requestAnimationFrame(function () {
345
369
  if (!(ref !== null && ref !== void 0 && ref.current)) {
@@ -167,6 +167,8 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
167
167
  requestAnimationFrame(function () {
168
168
  var _listContainerRef$cur;
169
169
  if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
170
+ // Ignored via go/ees005
171
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
170
172
  listContainerRef.current.firstChild.scrollTo(0, 0);
171
173
  }
172
174
  });
@@ -223,8 +225,12 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
223
225
  focusTargetElement();
224
226
  }
225
227
  };
228
+ // Ignored via go/ees005
229
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
226
230
  element === null || element === void 0 || element.addEventListener('keydown', handleKeyDown);
227
231
  return function () {
232
+ // Ignored via go/ees005
233
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
228
234
  element === null || element === void 0 || element.removeEventListener('keydown', handleKeyDown);
229
235
  };
230
236
  }, [editorView.state, focusTargetElement, selectNextItem, selectPreviousItem, selectedIndex, onItemClick, items.length]);
@@ -17,7 +17,10 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
17
17
  decorationElement = typeAheadState.decorationElement,
18
18
  decorationSet = typeAheadState.decorationSet,
19
19
  query = typeAheadState.query;
20
- var _useItemInsert = useItemInsert(triggerHandler, editorView, items, api),
20
+ var _useItemInsert = useItemInsert(
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23
+ triggerHandler, editorView, items, api),
21
24
  _useItemInsert2 = _slicedToArray(_useItemInsert, 3),
22
25
  onItemInsert = _useItemInsert2[0],
23
26
  onTextInsert = _useItemInsert2[1],
@@ -153,15 +153,25 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
153
153
  }, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
154
154
  var getFitHeightDebounced = rafSchedule(getFitHeight);
155
155
  useLayoutEffect(function () {
156
+ // Ignored via go/ees005
157
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
156
158
  var scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
157
159
  getFitHeight();
160
+ // Ignored via go/ees005
161
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
158
162
  window.addEventListener('resize', getFitHeightDebounced);
159
163
  if (scrollableElement) {
164
+ // Ignored via go/ees005
165
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
160
166
  scrollableElement.addEventListener('scroll', getFitHeightDebounced);
161
167
  }
162
168
  return function () {
169
+ // Ignored via go/ees005
170
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
163
171
  window.removeEventListener('resize', getFitHeightDebounced);
164
172
  if (scrollableElement) {
173
+ // Ignored via go/ees005
174
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
165
175
  scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
166
176
  }
167
177
  };
@@ -187,8 +197,12 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
187
197
  });
188
198
  };
189
199
  var element = ref.current;
200
+ // Ignored via go/ees005
201
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
190
202
  element === null || element === void 0 || element.addEventListener('focusout', focusOut);
191
203
  return function () {
204
+ // Ignored via go/ees005
205
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
192
206
  element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
193
207
  };
194
208
  }, [ref, cancel]);
@@ -206,8 +220,12 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
206
220
  }
207
221
  };
208
222
  var element = ref.current;
223
+ // Ignored via go/ees005
224
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
209
225
  element === null || element === void 0 || element.addEventListener('keydown', escape);
210
226
  return function () {
227
+ // Ignored via go/ees005
228
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
211
229
  element === null || element === void 0 || element.removeEventListener('keydown', escape);
212
230
  };
213
231
  }, [ref, cancel]);
@@ -69,6 +69,9 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
69
69
  var insertSelectedItem = useCallback(function () {
70
70
  var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SelectItemMode.SELECTED;
71
71
  var view = editorViewRef.current;
72
+
73
+ // Ignored via go/ees005
74
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
72
75
  var _ref3 = getPluginState(view.state),
73
76
  selectedIndex = _ref3.selectedIndex;
74
77
  var safeSelectedIndex = skipForwardToSafeItem(selectedIndex, 1, items.length, function (idx) {
@@ -25,7 +25,10 @@ var insertRawQuery = function insertRawQuery(_ref) {
25
25
  view.focus();
26
26
  }
27
27
  };
28
- export var useItemInsert = function useItemInsert(triggerHandler, editorView, items, api) {
28
+ export var useItemInsert = function useItemInsert(triggerHandler, editorView, items, api
29
+ // Ignored via go/ees005
30
+ // eslint-disable-next-line @typescript-eslint/max-params
31
+ ) {
29
32
  var editorViewRef = useRef(editorView);
30
33
  var itemsRef = useRef(items);
31
34
  var onTextInsert = useCallback(function (_ref2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "1.11.2",
3
+ "version": "1.11.3",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^97.0.0",
35
+ "@atlaskit/editor-common": "^98.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-connectivity": "^1.1.0",
38
38
  "@atlaskit/editor-prosemirror": "6.2.1",