@atlaskit/editor-core 187.24.3 → 187.25.0

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 (33) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/plugins/emoji/index.js +4 -3
  3. package/dist/cjs/plugins/mentions/index.js +4 -3
  4. package/dist/cjs/plugins/type-ahead/api.js +3 -1
  5. package/dist/cjs/plugins/type-ahead/index.js +4 -1
  6. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  7. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +2 -1
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/plugins/emoji/index.js +4 -3
  10. package/dist/es2019/plugins/mentions/index.js +4 -3
  11. package/dist/es2019/plugins/type-ahead/api.js +3 -1
  12. package/dist/es2019/plugins/type-ahead/index.js +4 -1
  13. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  14. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +3 -1
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/plugins/emoji/index.js +4 -3
  17. package/dist/esm/plugins/mentions/index.js +4 -3
  18. package/dist/esm/plugins/type-ahead/api.js +3 -1
  19. package/dist/esm/plugins/type-ahead/index.js +4 -1
  20. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  21. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +2 -1
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/labs/next/presets/default.d.ts +28 -0
  24. package/dist/types/plugins/emoji/index.d.ts +2 -1
  25. package/dist/types/plugins/mentions/index.d.ts +2 -1
  26. package/dist/types/plugins/type-ahead/index.d.ts +8 -3
  27. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +2 -1
  28. package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -0
  29. package/dist/types-ts4.5/plugins/emoji/index.d.ts +3 -1
  30. package/dist/types-ts4.5/plugins/mentions/index.d.ts +3 -1
  31. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +8 -3
  32. package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +2 -1
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`af2e8676033`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af2e8676033) - Create new command for typeahead plugin which exposes openTypeAheadAtCursor. Typeahead plugin is now a dependency for both emoji and mention plugins.
8
+
3
9
  ## 187.24.3
4
10
 
5
11
  ### Patch Changes
@@ -24,7 +24,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
24
24
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
25
25
  var _emoji3 = require("./nodeviews/emoji");
26
26
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
27
- var _openTypeaheadAtCursor = require("../type-ahead/transforms/open-typeahead-at-cursor");
28
27
  var _insertEmoji = require("./commands/insert-emoji");
29
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
30
29
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -222,10 +221,12 @@ var emojiPlugin = function emojiPlugin(options, api) {
222
221
  action: function action(insert, state) {
223
222
  var _api$dependencies$ana10;
224
223
  var tr = insert(undefined);
225
- (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
224
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
226
225
  triggerHandler: typeAhead,
227
226
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
228
- })(tr);
227
+ })({
228
+ tr: tr
229
+ });
229
230
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions.attachAnalyticsEvent({
230
231
  action: _analytics.ACTION.INVOKED,
231
232
  actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
@@ -21,7 +21,6 @@ var _ToolbarMention = _interopRequireDefault(require("./ui/ToolbarMention"));
21
21
  var _analytics = require("@atlaskit/editor-common/analytics");
22
22
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
23
23
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
24
- var _openTypeaheadAtCursor = require("../type-ahead/transforms/open-typeahead-at-cursor");
25
24
  var _typeAhead = require("./type-ahead");
26
25
  var _key = require("./pm-plugins/key");
27
26
  var _main = require("./pm-plugins/main");
@@ -106,10 +105,12 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
106
105
  if (pluginState && pluginState.canInsertMention === false) {
107
106
  return false;
108
107
  }
109
- (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
108
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
110
109
  triggerHandler: typeAhead,
111
110
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
112
- })(tr);
111
+ })({
112
+ tr: tr
113
+ });
113
114
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
114
115
  action: _analytics.ACTION.INVOKED,
115
116
  actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
@@ -24,7 +24,9 @@ var open = function open(_ref) {
24
24
  (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
25
25
  triggerHandler: handler,
26
26
  inputMethod: inputMethod
27
- })(tr);
27
+ })({
28
+ tr: tr
29
+ });
28
30
  editorView.dispatch(tr);
29
31
  return true;
30
32
  };
@@ -26,6 +26,7 @@ var _useItemInsert3 = require("./ui/hooks/use-item-insert");
26
26
  var _updateSelectedIndex = require("./commands/update-selected-index");
27
27
  var _statsModifier = require("./stats-modifier");
28
28
  var _analytics = require("@atlaskit/editor-common/analytics");
29
+ var _openTypeaheadAtCursor = require("./transforms/open-typeahead-at-cursor");
29
30
  /**
30
31
  *
31
32
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -117,7 +118,6 @@ var TypeAheadMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
117
118
  cancel: cancel
118
119
  });
119
120
  });
120
-
121
121
  /**
122
122
  *
123
123
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -168,6 +168,9 @@ var typeAheadPlugin = function typeAheadPlugin(options) {
168
168
  }
169
169
  }];
170
170
  },
171
+ commands: {
172
+ openTypeAheadAtCursor: _openTypeaheadAtCursor.openTypeAheadAtCursor
173
+ },
171
174
  contentComponent: function contentComponent(_ref6) {
172
175
  var editorView = _ref6.editorView,
173
176
  containerElement = _ref6.containerElement,
@@ -22,7 +22,9 @@ function inputRulePlugin(schema, typeAheads, featureFlags) {
22
22
  return (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
23
23
  triggerHandler: typeAhead,
24
24
  inputMethod: _analytics.INPUT_METHOD.KEYBOARD
25
- })(state.tr);
25
+ })({
26
+ tr: state.tr
27
+ });
26
28
  }));
27
29
  return acc;
28
30
  }, []);
@@ -28,7 +28,8 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
28
28
  var triggerHandler = _ref.triggerHandler,
29
29
  inputMethod = _ref.inputMethod,
30
30
  query = _ref.query;
31
- return function (tr) {
31
+ return function (_ref2) {
32
+ var tr = _ref2.tr;
32
33
  openTypeAhead({
33
34
  triggerHandler: triggerHandler,
34
35
  inputMethod: inputMethod,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.24.3";
9
+ var version = "187.25.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -11,7 +11,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
11
11
  import { IconEmoji } from '@atlaskit/editor-common/quick-insert';
12
12
  import { EmojiNodeView } from './nodeviews/emoji';
13
13
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
14
- import { openTypeAheadAtCursor } from '../type-ahead/transforms/open-typeahead-at-cursor';
15
14
  import { insertEmoji } from './commands/insert-emoji';
16
15
  export const emojiToTypeaheadItem = (emoji, emojiProvider) => ({
17
16
  title: emoji.shortName || '',
@@ -199,10 +198,12 @@ export const emojiPlugin = (options, api) => {
199
198
  action(insert, state) {
200
199
  var _api$dependencies$ana10;
201
200
  const tr = insert(undefined);
202
- openTypeAheadAtCursor({
201
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
203
202
  triggerHandler: typeAhead,
204
203
  inputMethod: INPUT_METHOD.QUICK_INSERT
205
- })(tr);
204
+ })({
205
+ tr
206
+ });
206
207
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions.attachAnalyticsEvent({
207
208
  action: ACTION.INVOKED,
208
209
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
@@ -8,7 +8,6 @@ import ToolbarMention from './ui/ToolbarMention';
8
8
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
9
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
10
10
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
11
- import { openTypeAheadAtCursor } from '../type-ahead/transforms/open-typeahead-at-cursor';
12
11
  import { createTypeAheadConfig } from './type-ahead';
13
12
  import { mentionPluginKey } from './pm-plugins/key';
14
13
  import { createMentionPlugin } from './pm-plugins/main';
@@ -90,10 +89,12 @@ const mentionsPlugin = (options, api) => {
90
89
  if (pluginState && pluginState.canInsertMention === false) {
91
90
  return false;
92
91
  }
93
- openTypeAheadAtCursor({
92
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
94
93
  triggerHandler: typeAhead,
95
94
  inputMethod: INPUT_METHOD.QUICK_INSERT
96
- })(tr);
95
+ })({
96
+ tr
97
+ });
97
98
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
98
99
  action: ACTION.INVOKED,
99
100
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
@@ -21,7 +21,9 @@ const open = ({
21
21
  openTypeAheadAtCursor({
22
22
  triggerHandler: handler,
23
23
  inputMethod
24
- })(tr);
24
+ })({
25
+ tr
26
+ });
25
27
  editorView.dispatch(tr);
26
28
  return true;
27
29
  };
@@ -20,6 +20,7 @@ import { useItemInsert } from './ui/hooks/use-item-insert';
20
20
  import { updateSelectedIndex } from './commands/update-selected-index';
21
21
  import { StatsModifier } from './stats-modifier';
22
22
  import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
23
+ import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
23
24
  const TypeAheadMenu = /*#__PURE__*/React.memo(({
24
25
  editorView,
25
26
  popupMountRef,
@@ -101,7 +102,6 @@ const TypeAheadMenu = /*#__PURE__*/React.memo(({
101
102
  cancel: cancel
102
103
  });
103
104
  });
104
-
105
105
  /**
106
106
  *
107
107
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -149,6 +149,9 @@ const typeAheadPlugin = options => {
149
149
  }) => inputRulePlugin(schema, typeAhead, featureFlags)
150
150
  }];
151
151
  },
152
+ commands: {
153
+ openTypeAheadAtCursor
154
+ },
152
155
  contentComponent({
153
156
  editorView,
154
157
  containerElement,
@@ -15,7 +15,9 @@ export function inputRulePlugin(schema, typeAheads, featureFlags) {
15
15
  return openTypeAheadAtCursor({
16
16
  triggerHandler: typeAhead,
17
17
  inputMethod: INPUT_METHOD.KEYBOARD
18
- })(state.tr);
18
+ })({
19
+ tr: state.tr
20
+ });
19
21
  }));
20
22
  return acc;
21
23
  }, []);
@@ -21,7 +21,9 @@ export const openTypeAheadAtCursor = ({
21
21
  triggerHandler,
22
22
  inputMethod,
23
23
  query
24
- }) => tr => {
24
+ }) => ({
25
+ tr
26
+ }) => {
25
27
  openTypeAhead({
26
28
  triggerHandler,
27
29
  inputMethod,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.24.3";
2
+ export const version = "187.25.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -14,7 +14,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
14
14
  import { IconEmoji } from '@atlaskit/editor-common/quick-insert';
15
15
  import { EmojiNodeView } from './nodeviews/emoji';
16
16
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
17
- import { openTypeAheadAtCursor } from '../type-ahead/transforms/open-typeahead-at-cursor';
18
17
  import { insertEmoji } from './commands/insert-emoji';
19
18
  export var emojiToTypeaheadItem = function emojiToTypeaheadItem(emoji, emojiProvider) {
20
19
  return {
@@ -208,10 +207,12 @@ export var emojiPlugin = function emojiPlugin(options, api) {
208
207
  action: function action(insert, state) {
209
208
  var _api$dependencies$ana10;
210
209
  var tr = insert(undefined);
211
- openTypeAheadAtCursor({
210
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
212
211
  triggerHandler: typeAhead,
213
212
  inputMethod: INPUT_METHOD.QUICK_INSERT
214
- })(tr);
213
+ })({
214
+ tr: tr
215
+ });
215
216
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions.attachAnalyticsEvent({
216
217
  action: ACTION.INVOKED,
217
218
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
@@ -8,7 +8,6 @@ import ToolbarMention from './ui/ToolbarMention';
8
8
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
9
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
10
10
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
11
- import { openTypeAheadAtCursor } from '../type-ahead/transforms/open-typeahead-at-cursor';
12
11
  import { createTypeAheadConfig } from './type-ahead';
13
12
  import { mentionPluginKey } from './pm-plugins/key';
14
13
  import { createMentionPlugin } from './pm-plugins/main';
@@ -94,10 +93,12 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
94
93
  if (pluginState && pluginState.canInsertMention === false) {
95
94
  return false;
96
95
  }
97
- openTypeAheadAtCursor({
96
+ api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
98
97
  triggerHandler: typeAhead,
99
98
  inputMethod: INPUT_METHOD.QUICK_INSERT
100
- })(tr);
99
+ })({
100
+ tr: tr
101
+ });
101
102
  api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
102
103
  action: ACTION.INVOKED,
103
104
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
@@ -18,7 +18,9 @@ var open = function open(_ref) {
18
18
  openTypeAheadAtCursor({
19
19
  triggerHandler: handler,
20
20
  inputMethod: inputMethod
21
- })(tr);
21
+ })({
22
+ tr: tr
23
+ });
22
24
  editorView.dispatch(tr);
23
25
  return true;
24
26
  };
@@ -21,6 +21,7 @@ import { useItemInsert } from './ui/hooks/use-item-insert';
21
21
  import { updateSelectedIndex } from './commands/update-selected-index';
22
22
  import { StatsModifier } from './stats-modifier';
23
23
  import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
24
+ import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
24
25
  var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
25
26
  var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
26
27
  var editorView = _ref.editorView,
@@ -103,7 +104,6 @@ var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
103
104
  cancel: cancel
104
105
  });
105
106
  });
106
-
107
107
  /**
108
108
  *
109
109
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -154,6 +154,9 @@ var typeAheadPlugin = function typeAheadPlugin(options) {
154
154
  }
155
155
  }];
156
156
  },
157
+ commands: {
158
+ openTypeAheadAtCursor: openTypeAheadAtCursor
159
+ },
157
160
  contentComponent: function contentComponent(_ref6) {
158
161
  var editorView = _ref6.editorView,
159
162
  containerElement = _ref6.containerElement,
@@ -15,7 +15,9 @@ export function inputRulePlugin(schema, typeAheads, featureFlags) {
15
15
  return openTypeAheadAtCursor({
16
16
  triggerHandler: typeAhead,
17
17
  inputMethod: INPUT_METHOD.KEYBOARD
18
- })(state.tr);
18
+ })({
19
+ tr: state.tr
20
+ });
19
21
  }));
20
22
  return acc;
21
23
  }, []);
@@ -21,7 +21,8 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
21
21
  var triggerHandler = _ref.triggerHandler,
22
22
  inputMethod = _ref.inputMethod,
23
23
  query = _ref.query;
24
- return function (tr) {
24
+ return function (_ref2) {
25
+ var tr = _ref2.tr;
25
26
  openTypeAhead({
26
27
  triggerHandler: triggerHandler,
27
28
  inputMethod: inputMethod,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.24.3";
2
+ export var version = "187.25.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -221,8 +221,22 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
221
221
  sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
222
222
  }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
223
223
  pluginConfiguration: TypeAheadPluginOptions | undefined;
224
+ commands: {
225
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
226
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
227
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
228
+ query?: string | undefined;
229
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
230
+ };
224
231
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
225
232
  pluginConfiguration: TypeAheadPluginOptions | undefined;
233
+ commands: {
234
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
235
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
236
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
237
+ query?: string | undefined;
238
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
239
+ };
226
240
  }>, (config?: QuickInsertPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"quickInsert", {
227
241
  pluginConfiguration: QuickInsertPluginOptions | undefined;
228
242
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"quickInsert", {
@@ -592,8 +606,22 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
592
606
  sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
593
607
  }>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
594
608
  pluginConfiguration: TypeAheadPluginOptions | undefined;
609
+ commands: {
610
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
611
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
612
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
613
+ query?: string | undefined;
614
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
615
+ };
595
616
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
596
617
  pluginConfiguration: TypeAheadPluginOptions | undefined;
618
+ commands: {
619
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
620
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
621
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
622
+ query?: string | undefined;
623
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
624
+ };
597
625
  }>, (config?: QuickInsertPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"quickInsert", {
598
626
  pluginConfiguration: QuickInsertPluginOptions | undefined;
599
627
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"quickInsert", {
@@ -7,6 +7,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import type { TypeAheadItem } from '../type-ahead/types';
8
8
  import type { EmojiPluginOptions, EmojiPluginState } from './types';
9
9
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
10
+ import type { TypeAheadPlugin } from '../type-ahead';
10
11
  export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
11
12
  export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
12
13
  call: ResultFn;
@@ -15,7 +16,7 @@ export declare function memoize<ResultFn extends (emoji: EmojiDescription, emoji
15
16
  export declare const defaultListLimit = 50;
16
17
  export type EmojiPlugin = NextEditorPlugin<'emoji', {
17
18
  pluginConfiguration: EmojiPluginOptions | undefined;
18
- dependencies: [OptionalPlugin<typeof analyticsPlugin>];
19
+ dependencies: [OptionalPlugin<typeof analyticsPlugin>, TypeAheadPlugin];
19
20
  sharedState: EmojiPluginState | undefined;
20
21
  commands: {
21
22
  insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
@@ -2,10 +2,11 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { MentionPluginOptions, MentionPluginState } from './types';
3
3
  import { mentionPluginKey } from './pm-plugins/key';
4
4
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { TypeAheadPlugin } from '../type-ahead';
5
6
  export { mentionPluginKey };
6
7
  declare const mentionsPlugin: NextEditorPlugin<'mention', {
7
8
  pluginConfiguration: MentionPluginOptions | undefined;
8
- dependencies: [OptionalPlugin<typeof analyticsPlugin>];
9
+ dependencies: [OptionalPlugin<typeof analyticsPlugin>, TypeAheadPlugin];
9
10
  sharedState: MentionPluginState | undefined;
10
11
  }>;
11
12
  export default mentionsPlugin;
@@ -1,10 +1,17 @@
1
1
  import type { NextEditorPlugin } from '../../types/editor-plugin';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
3
  import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
4
+ import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
4
5
  export type TypeAheadPluginOptions = {
5
6
  isMobile?: boolean;
6
7
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
7
8
  };
9
+ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
10
+ pluginConfiguration: TypeAheadPluginOptions | undefined;
11
+ commands: {
12
+ openTypeAheadAtCursor: typeof openTypeAheadAtCursor;
13
+ };
14
+ }>;
8
15
  /**
9
16
  *
10
17
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -13,9 +20,7 @@ export type TypeAheadPluginOptions = {
13
20
  *
14
21
  *
15
22
  */
16
- declare const typeAheadPlugin: NextEditorPlugin<'typeAhead', {
17
- pluginConfiguration: TypeAheadPluginOptions | undefined;
18
- }>;
23
+ declare const typeAheadPlugin: TypeAheadPlugin;
19
24
  export default typeAheadPlugin;
20
25
  export { typeAheadPluginKey };
21
26
  export type { TypeAheadHandler, TypeAheadPluginState } from './types';
@@ -1,4 +1,5 @@
1
1
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
2
3
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
3
4
  type Props = {
4
5
  triggerHandler: TypeAheadHandler;
@@ -6,5 +7,5 @@ type Props = {
6
7
  query?: string;
7
8
  };
8
9
  export declare const openTypeAhead: (props: Props) => (tr: Transaction) => void;
9
- export declare const openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: Props) => (tr: Transaction) => Transaction | null;
10
+ export declare const openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: Props) => EditorCommand;
10
11
  export {};
@@ -269,8 +269,22 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
269
269
  (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>,
270
270
  (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
271
271
  pluginConfiguration: TypeAheadPluginOptions | undefined;
272
+ commands: {
273
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
274
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
275
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
276
+ query?: string | undefined;
277
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
278
+ };
272
279
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
273
280
  pluginConfiguration: TypeAheadPluginOptions | undefined;
281
+ commands: {
282
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
283
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
284
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
285
+ query?: string | undefined;
286
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
287
+ };
274
288
  }>,
275
289
  (config?: QuickInsertPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"quickInsert", {
276
290
  pluginConfiguration: QuickInsertPluginOptions | undefined;
@@ -720,8 +734,22 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
720
734
  (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>,
721
735
  (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
722
736
  pluginConfiguration: TypeAheadPluginOptions | undefined;
737
+ commands: {
738
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
739
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
740
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
741
+ query?: string | undefined;
742
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
743
+ };
723
744
  }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
724
745
  pluginConfiguration: TypeAheadPluginOptions | undefined;
746
+ commands: {
747
+ openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: {
748
+ triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
749
+ inputMethod: import("../../../plugins/type-ahead/types").TypeAheadInputMethod;
750
+ query?: string | undefined;
751
+ }) => import("@atlaskit/editor-common/types").EditorCommand;
752
+ };
725
753
  }>,
726
754
  (config?: QuickInsertPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"quickInsert", {
727
755
  pluginConfiguration: QuickInsertPluginOptions | undefined;
@@ -7,6 +7,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import type { TypeAheadItem } from '../type-ahead/types';
8
8
  import type { EmojiPluginOptions, EmojiPluginState } from './types';
9
9
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
10
+ import type { TypeAheadPlugin } from '../type-ahead';
10
11
  export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
11
12
  export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
12
13
  call: ResultFn;
@@ -16,7 +17,8 @@ export declare const defaultListLimit = 50;
16
17
  export type EmojiPlugin = NextEditorPlugin<'emoji', {
17
18
  pluginConfiguration: EmojiPluginOptions | undefined;
18
19
  dependencies: [
19
- OptionalPlugin<typeof analyticsPlugin>
20
+ OptionalPlugin<typeof analyticsPlugin>,
21
+ TypeAheadPlugin
20
22
  ];
21
23
  sharedState: EmojiPluginState | undefined;
22
24
  commands: {
@@ -2,11 +2,13 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { MentionPluginOptions, MentionPluginState } from './types';
3
3
  import { mentionPluginKey } from './pm-plugins/key';
4
4
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { TypeAheadPlugin } from '../type-ahead';
5
6
  export { mentionPluginKey };
6
7
  declare const mentionsPlugin: NextEditorPlugin<'mention', {
7
8
  pluginConfiguration: MentionPluginOptions | undefined;
8
9
  dependencies: [
9
- OptionalPlugin<typeof analyticsPlugin>
10
+ OptionalPlugin<typeof analyticsPlugin>,
11
+ TypeAheadPlugin
10
12
  ];
11
13
  sharedState: MentionPluginState | undefined;
12
14
  }>;
@@ -1,10 +1,17 @@
1
1
  import type { NextEditorPlugin } from '../../types/editor-plugin';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
3
  import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
4
+ import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
4
5
  export type TypeAheadPluginOptions = {
5
6
  isMobile?: boolean;
6
7
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
7
8
  };
9
+ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
10
+ pluginConfiguration: TypeAheadPluginOptions | undefined;
11
+ commands: {
12
+ openTypeAheadAtCursor: typeof openTypeAheadAtCursor;
13
+ };
14
+ }>;
8
15
  /**
9
16
  *
10
17
  * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
@@ -13,9 +20,7 @@ export type TypeAheadPluginOptions = {
13
20
  *
14
21
  *
15
22
  */
16
- declare const typeAheadPlugin: NextEditorPlugin<'typeAhead', {
17
- pluginConfiguration: TypeAheadPluginOptions | undefined;
18
- }>;
23
+ declare const typeAheadPlugin: TypeAheadPlugin;
19
24
  export default typeAheadPlugin;
20
25
  export { typeAheadPluginKey };
21
26
  export type { TypeAheadHandler, TypeAheadPluginState } from './types';
@@ -1,4 +1,5 @@
1
1
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
2
3
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
3
4
  type Props = {
4
5
  triggerHandler: TypeAheadHandler;
@@ -6,5 +7,5 @@ type Props = {
6
7
  query?: string;
7
8
  };
8
9
  export declare const openTypeAhead: (props: Props) => (tr: Transaction) => void;
9
- export declare const openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: Props) => (tr: Transaction) => Transaction | null;
10
+ export declare const openTypeAheadAtCursor: ({ triggerHandler, inputMethod, query }: Props) => EditorCommand;
10
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.24.3",
3
+ "version": "187.25.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"