@atlaskit/editor-core 187.24.2 → 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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  3. package/dist/cjs/plugins/emoji/index.js +4 -3
  4. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -7
  5. package/dist/cjs/plugins/mentions/index.js +4 -3
  6. package/dist/cjs/plugins/type-ahead/api.js +3 -1
  7. package/dist/cjs/plugins/type-ahead/index.js +4 -1
  8. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  9. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +2 -1
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +4 -0
  12. package/dist/es2019/plugins/emoji/index.js +4 -3
  13. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -6
  14. package/dist/es2019/plugins/mentions/index.js +4 -3
  15. package/dist/es2019/plugins/type-ahead/api.js +3 -1
  16. package/dist/es2019/plugins/type-ahead/index.js +4 -1
  17. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  18. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +3 -1
  19. package/dist/es2019/version-wrapper.js +1 -1
  20. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  21. package/dist/esm/plugins/emoji/index.js +4 -3
  22. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -6
  23. package/dist/esm/plugins/mentions/index.js +4 -3
  24. package/dist/esm/plugins/type-ahead/api.js +3 -1
  25. package/dist/esm/plugins/type-ahead/index.js +4 -1
  26. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +3 -1
  27. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +2 -1
  28. package/dist/esm/version-wrapper.js +1 -1
  29. package/dist/types/labs/next/presets/default.d.ts +28 -0
  30. package/dist/types/plugins/emoji/index.d.ts +2 -1
  31. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -1
  32. package/dist/types/plugins/mentions/index.d.ts +2 -1
  33. package/dist/types/plugins/type-ahead/index.d.ts +8 -3
  34. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +2 -1
  35. package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -0
  36. package/dist/types-ts4.5/plugins/emoji/index.d.ts +3 -1
  37. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -1
  38. package/dist/types-ts4.5/plugins/mentions/index.d.ts +3 -1
  39. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +8 -3
  40. package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +2 -1
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
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
+
9
+ ## 187.24.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`72e552fe076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/72e552fe076) - [ux] ED-17954: Fix inline node selections for mentions and emojis in iOS. Previously, the visually hidden assistive text would also be shown as a selection in iOS which would often make the selection look larger than the actual node itself.
14
+ - [`048717e2a19`](https://bitbucket.org/atlassian/atlassian-frontend/commits/048717e2a19) - fix janky media toolbar when resize
15
+
3
16
  ## 187.24.2
4
17
 
5
18
  ### Patch Changes
@@ -13,5 +13,5 @@ var _templateObject;
13
13
  // For reasoning behind styles, see comments in:
14
14
  // ./getInlineNodeViewProducer -> portalChildren()
15
15
 
16
- var InlineNodeViewSharedStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline;\n user-select: all;\n /* Collapses zero width spaces inside the inline node view\n to prevent the node from line breaking too early.\n */\n white-space: nowrap;\n /* Then reset to the Editor default so we don't interfere\n with any component styling. */\n & > *:not(span[aria-hidden='true'].zeroWidthSpaceContainer) {\n white-space: pre-wrap;\n }\n }\n /** Remove browser deafult selections style. This prevents\n unexpected visual artefacts in Safari when navigating\n with the keyboard or making range selections. */\n &.ua-safari {\n .", " {\n ::selection,\n *::selection {\n background: transparent;\n }\n }\n }\n\n &.ua-chrome .", " > span {\n user-select: none;\n }\n\n .", "AddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _utils.ZERO_WIDTH_SPACE);
16
+ var InlineNodeViewSharedStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline;\n user-select: all;\n /* Collapses zero width spaces inside the inline node view\n to prevent the node from line breaking too early.\n */\n white-space: nowrap;\n /* Then reset to the Editor default so we don't interfere\n with any component styling. */\n & > *:not(span[aria-hidden='true'].zeroWidthSpaceContainer) {\n white-space: pre-wrap;\n }\n // Prevent visually hidden assistive text from being selected.\n & > .assistive {\n user-select: none;\n }\n }\n /** Remove browser deafult selections style. This prevents\n unexpected visual artefacts in Safari when navigating\n with the keyboard or making range selections. */\n &.ua-safari {\n .", " {\n ::selection,\n *::selection {\n background: transparent;\n }\n }\n }\n\n &.ua-chrome .", " > span {\n user-select: none;\n }\n\n .", "AddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _reactNodeView.inlineNodeViewClassname, _utils.ZERO_WIDTH_SPACE);
17
17
  exports.InlineNodeViewSharedStyles = InlineNodeViewSharedStyles;
@@ -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,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.resizerNextTestId = exports.default = exports.ResizableMediaSingleNext = void 0;
7
+ exports.resizerNextTestId = exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -140,14 +140,14 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
140
140
  tr.setMeta(_main.MEDIA_PLUGIN_IS_RESIZING_KEY, isResizing);
141
141
  return dispatch(tr);
142
142
  });
143
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateSizeInPluginState", function (width) {
143
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateSizeInPluginState", (0, _throttle.default)(function (width) {
144
144
  var _this$props$view2 = _this.props.view,
145
145
  state = _this$props$view2.state,
146
146
  dispatch = _this$props$view2.dispatch;
147
147
  var tr = state.tr;
148
148
  tr.setMeta(_main.MEDIA_PLUGIN_RESIZING_WIDTH_KEY, width);
149
149
  return dispatch(tr);
150
- });
150
+ }, _mediaSingle.MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
151
151
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcMaxWidth", (0, _memoizeOne.default)(function (contentWidth, containerWidth, fullWidthMode) {
152
152
  if (_this.isNestedNode() || fullWidthMode) {
153
153
  return contentWidth;
@@ -235,9 +235,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
235
235
  _this.updateSizeInPluginState(_this.state.size.width);
236
236
  // re-calucate guidelines
237
237
  _this.updateGuidelines();
238
- return 0;
239
238
  });
240
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResize", (0, _throttle.default)(function (size, delta) {
239
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResize", function (size, delta) {
241
240
  var _this$props4 = _this.props,
242
241
  originalWidth = _this$props4.width,
243
242
  originalHeight = _this$props4.height,
@@ -264,7 +263,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
264
263
  if (calculatedWidthWithLayout.layout !== layout) {
265
264
  updateSize(width, calculatedWidthWithLayout.layout);
266
265
  }
267
- }, _mediaSingle.MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
266
+ });
268
267
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResizeStop", function (size, delta) {
269
268
  var _this$props5 = _this.props,
270
269
  originalWidth = _this$props5.width,
@@ -603,6 +602,5 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
603
602
  }]);
604
603
  return ResizableMediaSingleNext;
605
604
  }(_react.default.Component);
606
- exports.ResizableMediaSingleNext = ResizableMediaSingleNext;
607
605
  var _default = ResizableMediaSingleNext;
608
606
  exports.default = _default;
@@ -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.2";
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('.');
@@ -18,6 +18,10 @@ export const InlineNodeViewSharedStyles = css`
18
18
  & > *:not(span[aria-hidden='true'].zeroWidthSpaceContainer) {
19
19
  white-space: pre-wrap;
20
20
  }
21
+ // Prevent visually hidden assistive text from being selected.
22
+ & > .assistive {
23
+ user-select: none;
24
+ }
21
25
  }
22
26
  /** Remove browser deafult selections style. This prevents
23
27
  unexpected visual artefacts in Safari when navigating
@@ -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,
@@ -18,7 +18,7 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
18
18
  import throttle from 'lodash/throttle';
19
19
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
20
20
  export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
21
- export class ResizableMediaSingleNext extends React.Component {
21
+ class ResizableMediaSingleNext extends React.Component {
22
22
  constructor(props) {
23
23
  super(props);
24
24
  _defineProperty(this, "lastSnappedGuidelineKeys", []);
@@ -126,7 +126,7 @@ export class ResizableMediaSingleNext extends React.Component {
126
126
  tr.setMeta(MEDIA_PLUGIN_IS_RESIZING_KEY, isResizing);
127
127
  return dispatch(tr);
128
128
  });
129
- _defineProperty(this, "updateSizeInPluginState", width => {
129
+ _defineProperty(this, "updateSizeInPluginState", throttle(width => {
130
130
  const {
131
131
  state,
132
132
  dispatch
@@ -134,7 +134,7 @@ export class ResizableMediaSingleNext extends React.Component {
134
134
  const tr = state.tr;
135
135
  tr.setMeta(MEDIA_PLUGIN_RESIZING_WIDTH_KEY, width);
136
136
  return dispatch(tr);
137
- });
137
+ }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
138
138
  _defineProperty(this, "calcMaxWidth", memoizeOne((contentWidth, containerWidth, fullWidthMode) => {
139
139
  if (this.isNestedNode() || fullWidthMode) {
140
140
  return contentWidth;
@@ -214,9 +214,8 @@ export class ResizableMediaSingleNext extends React.Component {
214
214
  this.updateSizeInPluginState(this.state.size.width);
215
215
  // re-calucate guidelines
216
216
  this.updateGuidelines();
217
- return 0;
218
217
  });
219
- _defineProperty(this, "handleResize", throttle((size, delta) => {
218
+ _defineProperty(this, "handleResize", (size, delta) => {
220
219
  const {
221
220
  width: originalWidth,
222
221
  height: originalHeight,
@@ -245,7 +244,7 @@ export class ResizableMediaSingleNext extends React.Component {
245
244
  if (calculatedWidthWithLayout.layout !== layout) {
246
245
  updateSize(width, calculatedWidthWithLayout.layout);
247
246
  }
248
- }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
247
+ });
249
248
  _defineProperty(this, "handleResizeStop", (size, delta) => {
250
249
  const {
251
250
  width: originalWidth,
@@ -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.2";
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
  };
@@ -7,4 +7,4 @@ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
7
7
  // For reasoning behind styles, see comments in:
8
8
  // ./getInlineNodeViewProducer -> portalChildren()
9
9
 
10
- export var InlineNodeViewSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline;\n user-select: all;\n /* Collapses zero width spaces inside the inline node view\n to prevent the node from line breaking too early.\n */\n white-space: nowrap;\n /* Then reset to the Editor default so we don't interfere\n with any component styling. */\n & > *:not(span[aria-hidden='true'].zeroWidthSpaceContainer) {\n white-space: pre-wrap;\n }\n }\n /** Remove browser deafult selections style. This prevents\n unexpected visual artefacts in Safari when navigating\n with the keyboard or making range selections. */\n &.ua-safari {\n .", " {\n ::selection,\n *::selection {\n background: transparent;\n }\n }\n }\n\n &.ua-chrome .", " > span {\n user-select: none;\n }\n\n .", "AddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), inlineNodeViewClassname, inlineNodeViewClassname, inlineNodeViewClassname, inlineNodeViewClassname, ZERO_WIDTH_SPACE);
10
+ export var InlineNodeViewSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline;\n user-select: all;\n /* Collapses zero width spaces inside the inline node view\n to prevent the node from line breaking too early.\n */\n white-space: nowrap;\n /* Then reset to the Editor default so we don't interfere\n with any component styling. */\n & > *:not(span[aria-hidden='true'].zeroWidthSpaceContainer) {\n white-space: pre-wrap;\n }\n // Prevent visually hidden assistive text from being selected.\n & > .assistive {\n user-select: none;\n }\n }\n /** Remove browser deafult selections style. This prevents\n unexpected visual artefacts in Safari when navigating\n with the keyboard or making range selections. */\n &.ua-safari {\n .", " {\n ::selection,\n *::selection {\n background: transparent;\n }\n }\n }\n\n &.ua-chrome .", " > span {\n user-select: none;\n }\n\n .", "AddZeroWidthSpace {\n ::after {\n content: '", "';\n }\n }\n"])), inlineNodeViewClassname, inlineNodeViewClassname, inlineNodeViewClassname, inlineNodeViewClassname, ZERO_WIDTH_SPACE);
@@ -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,
@@ -29,7 +29,7 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
29
29
  import throttle from 'lodash/throttle';
30
30
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
31
31
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
32
- export var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
32
+ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
33
33
  _inherits(ResizableMediaSingleNext, _React$Component);
34
34
  var _super = _createSuper(ResizableMediaSingleNext);
35
35
  function ResizableMediaSingleNext(props) {
@@ -133,14 +133,14 @@ export var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
133
133
  tr.setMeta(MEDIA_PLUGIN_IS_RESIZING_KEY, isResizing);
134
134
  return dispatch(tr);
135
135
  });
136
- _defineProperty(_assertThisInitialized(_this), "updateSizeInPluginState", function (width) {
136
+ _defineProperty(_assertThisInitialized(_this), "updateSizeInPluginState", throttle(function (width) {
137
137
  var _this$props$view2 = _this.props.view,
138
138
  state = _this$props$view2.state,
139
139
  dispatch = _this$props$view2.dispatch;
140
140
  var tr = state.tr;
141
141
  tr.setMeta(MEDIA_PLUGIN_RESIZING_WIDTH_KEY, width);
142
142
  return dispatch(tr);
143
- });
143
+ }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
144
144
  _defineProperty(_assertThisInitialized(_this), "calcMaxWidth", memoizeOne(function (contentWidth, containerWidth, fullWidthMode) {
145
145
  if (_this.isNestedNode() || fullWidthMode) {
146
146
  return contentWidth;
@@ -228,9 +228,8 @@ export var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
228
228
  _this.updateSizeInPluginState(_this.state.size.width);
229
229
  // re-calucate guidelines
230
230
  _this.updateGuidelines();
231
- return 0;
232
231
  });
233
- _defineProperty(_assertThisInitialized(_this), "handleResize", throttle(function (size, delta) {
232
+ _defineProperty(_assertThisInitialized(_this), "handleResize", function (size, delta) {
234
233
  var _this$props4 = _this.props,
235
234
  originalWidth = _this$props4.width,
236
235
  originalHeight = _this$props4.height,
@@ -257,7 +256,7 @@ export var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
257
256
  if (calculatedWidthWithLayout.layout !== layout) {
258
257
  updateSize(width, calculatedWidthWithLayout.layout);
259
258
  }
260
- }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
259
+ });
261
260
  _defineProperty(_assertThisInitialized(_this), "handleResizeStop", function (size, delta) {
262
261
  var _this$props5 = _this.props,
263
262
  originalWidth = _this$props5.width,
@@ -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.2";
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;
@@ -18,7 +18,7 @@ type State = {
18
18
  };
19
19
  export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
20
20
  type ResizableMediaSingleNextProps = Props;
21
- export declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
21
+ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
22
22
  private lastSnappedGuidelineKeys;
23
23
  constructor(props: ResizableMediaSingleNextProps);
24
24
  /**
@@ -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: {
@@ -18,7 +18,7 @@ type State = {
18
18
  };
19
19
  export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
20
20
  type ResizableMediaSingleNextProps = Props;
21
- export declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
21
+ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
22
22
  private lastSnappedGuidelineKeys;
23
23
  constructor(props: ResizableMediaSingleNextProps);
24
24
  /**
@@ -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.2",
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/"