@atlaskit/editor-core 188.0.9 → 188.0.11

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 (28) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/mentions/analytics.js +0 -5
  3. package/dist/cjs/plugins/mentions/index.js +6 -7
  4. package/dist/cjs/plugins/mentions/ui/Mention/index.js +13 -2
  5. package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +4 -4
  6. package/dist/cjs/plugins/type-ahead/index.js +2 -1
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/plugins/mentions/analytics.js +0 -5
  9. package/dist/es2019/plugins/mentions/index.js +3 -4
  10. package/dist/es2019/plugins/mentions/ui/Mention/index.js +13 -1
  11. package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +2 -2
  12. package/dist/es2019/plugins/type-ahead/index.js +3 -2
  13. package/dist/es2019/version-wrapper.js +1 -1
  14. package/dist/esm/plugins/mentions/analytics.js +0 -5
  15. package/dist/esm/plugins/mentions/index.js +3 -4
  16. package/dist/esm/plugins/mentions/ui/Mention/index.js +13 -1
  17. package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +2 -2
  18. package/dist/esm/plugins/type-ahead/index.js +3 -2
  19. package/dist/esm/version-wrapper.js +1 -1
  20. package/dist/types/labs/next/presets/default.d.ts +4 -0
  21. package/dist/types/plugins/mentions/analytics.d.ts +5 -5
  22. package/dist/types/plugins/mentions/index.d.ts +1 -1
  23. package/dist/types/plugins/mentions/type-ahead/index.d.ts +1 -1
  24. package/dist/types-ts4.5/labs/next/presets/default.d.ts +4 -0
  25. package/dist/types-ts4.5/plugins/mentions/analytics.d.ts +5 -5
  26. package/dist/types-ts4.5/plugins/mentions/index.d.ts +1 -1
  27. package/dist/types-ts4.5/plugins/mentions/type-ahead/index.d.ts +1 -1
  28. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 188.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#40955](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40955) [`30dc2b1e6c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30dc2b1e6c9) - [ED-19746] Decoupling mentions plugin from Editor-core libraries
8
+ - Updated dependencies
9
+
3
10
  ## 188.0.9
4
11
 
5
12
  ### Patch Changes
@@ -8,7 +8,6 @@ exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPa
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
10
10
  var _resource = require("@atlaskit/mention/resource");
11
- var _versionWrapper = require("../../version-wrapper");
12
11
  var _utils = require("./utils");
13
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -21,8 +20,6 @@ var buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action
21
20
  actionSubject: actionSubject,
22
21
  eventType: eventType,
23
22
  attributes: _objectSpread({
24
- packageName: _versionWrapper.name,
25
- packageVersion: _versionWrapper.version,
26
23
  componentName: componentName,
27
24
  sessionId: sessionId
28
25
  }, otherAttributes),
@@ -155,8 +152,6 @@ var buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayload(durat
155
152
  actionSubject: actionSubject,
156
153
  eventType: _analyticsGasTypes.OPERATIONAL_EVENT_TYPE,
157
154
  attributes: {
158
- packageName: _versionWrapper.name,
159
- packageVersion: _versionWrapper.version,
160
155
  componentName: componentName,
161
156
  duration: duration,
162
157
  userIds: userIds,
@@ -15,12 +15,11 @@ var _react = _interopRequireDefault(require("react"));
15
15
  var _uuid = _interopRequireDefault(require("uuid"));
16
16
  var _resource = require("@atlaskit/mention/resource");
17
17
  var _adfSchema = require("@atlaskit/adf-schema");
18
- var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
19
- var _utils = require("../type-ahead/utils");
18
+ var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
20
19
  var _ToolbarMention = _interopRequireDefault(require("./ui/ToolbarMention"));
21
20
  var _analytics = require("@atlaskit/editor-common/analytics");
22
21
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
23
- var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
22
+ var _messages = require("@atlaskit/editor-common/messages");
24
23
  var _typeAhead = require("./type-ahead");
25
24
  var _key = require("./pm-plugins/key");
26
25
  var _main = require("./pm-plugins/main");
@@ -71,7 +70,7 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
71
70
  secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
72
71
  var editorView = _ref3.editorView,
73
72
  disabled = _ref3.disabled;
74
- return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
73
+ return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
75
74
  editorView: editorView,
76
75
  plugins: {
77
76
  mentionState: _key.mentionPluginKey
@@ -81,7 +80,7 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
81
80
  mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
82
81
  return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
83
82
  editorView: editorView,
84
- isDisabled: disabled || (0, _utils.isTypeAheadAllowed)(editorView.state)
83
+ isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
85
84
  });
86
85
  }
87
86
  });
@@ -92,8 +91,8 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
92
91
  var formatMessage = _ref5.formatMessage;
93
92
  return [{
94
93
  id: 'mention',
95
- title: formatMessage(_messages.messages.mention),
96
- description: formatMessage(_messages.messages.mentionDescription),
94
+ title: formatMessage(_messages.toolbarInsertBlockMessages.mention),
95
+ description: formatMessage(_messages.toolbarInsertBlockMessages.mentionDescription),
97
96
  keywords: ['team', 'user'],
98
97
  priority: 400,
99
98
  keyshortcut: '@',
@@ -18,11 +18,22 @@ var _react = _interopRequireWildcard(require("react"));
18
18
  var _element = require("@atlaskit/mention/element");
19
19
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
- var _refreshBrowserSelection = require("../../../code-block/refresh-browser-selection");
22
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
23
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
24
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
+ // Workaround for a firefox issue where dom selection is off sync
26
+ // https://product-fabric.atlassian.net/browse/ED-12442
27
+ var refreshBrowserSelection = function refreshBrowserSelection() {
28
+ var domSelection = window.getSelection();
29
+ if (domSelection) {
30
+ var domRange = domSelection && domSelection.rangeCount === 1 && domSelection.getRangeAt(0).cloneRange();
31
+ if (domRange) {
32
+ domSelection.removeAllRanges();
33
+ domSelection.addRange(domRange);
34
+ }
35
+ }
36
+ };
26
37
  var Mention = /*#__PURE__*/function (_PureComponent) {
27
38
  (0, _inherits2.default)(Mention, _PureComponent);
28
39
  var _super = _createSuper(Mention);
@@ -60,7 +71,7 @@ var Mention = /*#__PURE__*/function (_PureComponent) {
60
71
  // This affects both insertion and paste behaviour it is applied to the component.
61
72
  // https://product-fabric.atlassian.net/browse/ED-14859
62
73
  if (_utils.browser.safari) {
63
- setTimeout(_refreshBrowserSelection.refreshBrowserSelection, 0);
74
+ setTimeout(refreshBrowserSelection, 0);
64
75
  }
65
76
  }
66
77
  }, {
@@ -15,8 +15,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
  var _mention = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/mention"));
18
- var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
19
- var _analytics = require("../../../analytics");
18
+ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
19
+ var _analytics = require("@atlaskit/editor-common/analytics");
20
20
  var _api = require("../../../type-ahead/api");
21
21
  var _reactIntlNext = require("react-intl-next");
22
22
  var _messages = require("../../messages");
@@ -47,9 +47,9 @@ var ToolbarMention = /*#__PURE__*/function (_PureComponent) {
47
47
  key: "render",
48
48
  value: function render() {
49
49
  var mentionStringTranslated = this.props.intl.formatMessage(_messages.messages.mentionsIconLabel);
50
- return /*#__PURE__*/_react.default.createElement(_ToolbarButton.default, {
50
+ return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
51
51
  testId: this.props.testId,
52
- buttonId: _ToolbarButton.TOOLBAR_BUTTON.MENTION,
52
+ buttonId: _uiMenu.TOOLBAR_BUTTON.MENTION,
53
53
  spacing: "none",
54
54
  onClick: this.handleInsertMention,
55
55
  disabled: this.props.isDisabled,
@@ -174,7 +174,8 @@ var typeAheadPlugin = function typeAheadPlugin(_ref4) {
174
174
  openTypeAheadAtCursor: _openTypeaheadAtCursor.openTypeAheadAtCursor
175
175
  },
176
176
  actions: {
177
- isOpen: _utils.isTypeAheadOpen
177
+ isOpen: _utils.isTypeAheadOpen,
178
+ isAllowed: _utils.isTypeAheadAllowed
178
179
  },
179
180
  contentComponent: function contentComponent(_ref7) {
180
181
  var editorView = _ref7.editorView,
@@ -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 = "188.0.9";
9
+ var version = "188.0.11";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,6 +1,5 @@
1
1
  import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
2
2
  import { isSpecialMention } from '@atlaskit/mention/resource';
3
- import { name as packageName, version as packageVersion } from '../../version-wrapper';
4
3
  import { isTeamType } from './utils';
5
4
  const componentName = 'mention';
6
5
  export const buildAnalyticsPayload = (actionSubject, action, eventType, sessionId, otherAttributes = {}, tags = []) => ({
@@ -8,8 +7,6 @@ export const buildAnalyticsPayload = (actionSubject, action, eventType, sessionI
8
7
  actionSubject,
9
8
  eventType,
10
9
  attributes: {
11
- packageName,
12
- packageVersion,
13
10
  componentName,
14
11
  sessionId,
15
12
  ...otherAttributes
@@ -139,8 +136,6 @@ export const buildTypeAheadRenderedPayload = (duration, userIds, query, teams) =
139
136
  actionSubject,
140
137
  eventType: OPERATIONAL_EVENT_TYPE,
141
138
  attributes: {
142
- packageName,
143
- packageVersion,
144
139
  componentName,
145
140
  duration,
146
141
  userIds,
@@ -2,12 +2,11 @@ import React from 'react';
2
2
  import uuid from 'uuid';
3
3
  import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
4
4
  import { mention } from '@atlaskit/adf-schema';
5
- import WithPluginState from '../../ui/WithPluginState';
6
- import { isTypeAheadAllowed } from '../type-ahead/utils';
5
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
7
6
  import ToolbarMention from './ui/ToolbarMention';
8
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
8
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
10
- import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
9
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
11
10
  import { createTypeAheadConfig } from './type-ahead';
12
11
  import { mentionPluginKey } from './pm-plugins/key';
13
12
  import { createMentionPlugin } from './pm-plugins/main';
@@ -69,7 +68,7 @@ const mentionsPlugin = ({
69
68
  mentionState = {}
70
69
  }) => !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
71
70
  editorView: editorView,
72
- isDisabled: disabled || isTypeAheadAllowed(editorView.state)
71
+ isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
73
72
  })
74
73
  });
75
74
  },
@@ -5,7 +5,19 @@ import { PureComponent } from 'react';
5
5
  import { ResourcedMention } from '@atlaskit/mention/element';
6
6
  import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
7
7
  import { browser } from '@atlaskit/editor-common/utils';
8
- import { refreshBrowserSelection } from '../../../code-block/refresh-browser-selection';
8
+
9
+ // Workaround for a firefox issue where dom selection is off sync
10
+ // https://product-fabric.atlassian.net/browse/ED-12442
11
+ const refreshBrowserSelection = () => {
12
+ const domSelection = window.getSelection();
13
+ if (domSelection) {
14
+ const domRange = domSelection && domSelection.rangeCount === 1 && domSelection.getRangeAt(0).cloneRange();
15
+ if (domRange) {
16
+ domSelection.removeAllRanges();
17
+ domSelection.addRange(domRange);
18
+ }
19
+ }
20
+ };
9
21
  export default class Mention extends PureComponent {
10
22
  constructor(props) {
11
23
  super(props);
@@ -2,8 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { PureComponent } from 'react';
4
4
  import MentionIcon from '@atlaskit/icon/glyph/editor/mention';
5
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
6
- import { INPUT_METHOD } from '../../../analytics';
5
+ import { ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
6
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import { createTypeAheadTools } from '../../../type-ahead/api';
8
8
  import { injectIntl } from 'react-intl-next';
9
9
  import { messages } from '../../messages';
@@ -15,7 +15,7 @@ import { typeAheadQuery } from '@atlaskit/adf-schema';
15
15
  import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
16
16
  import { inputRulePlugin } from './pm-plugins/input-rules';
17
17
  import { TypeAheadPopup } from './ui/TypeAheadPopup';
18
- import { getPluginState, isTypeAheadOpen } from './utils';
18
+ import { getPluginState, isTypeAheadOpen, isTypeAheadAllowed } from './utils';
19
19
  import { useItemInsert } from './ui/hooks/use-item-insert';
20
20
  import { updateSelectedIndex } from './commands/update-selected-index';
21
21
  import { StatsModifier } from './stats-modifier';
@@ -156,7 +156,8 @@ const typeAheadPlugin = ({
156
156
  openTypeAheadAtCursor
157
157
  },
158
158
  actions: {
159
- isOpen: isTypeAheadOpen
159
+ isOpen: isTypeAheadOpen,
160
+ isAllowed: isTypeAheadAllowed
160
161
  },
161
162
  contentComponent({
162
163
  editorView,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "188.0.9";
2
+ export const version = "188.0.11";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -3,7 +3,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
5
5
  import { isSpecialMention } from '@atlaskit/mention/resource';
6
- import { name as packageName, version as packageVersion } from '../../version-wrapper';
7
6
  import { isTeamType } from './utils';
8
7
  var componentName = 'mention';
9
8
  export var buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
@@ -14,8 +13,6 @@ export var buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject,
14
13
  actionSubject: actionSubject,
15
14
  eventType: eventType,
16
15
  attributes: _objectSpread({
17
- packageName: packageName,
18
- packageVersion: packageVersion,
19
16
  componentName: componentName,
20
17
  sessionId: sessionId
21
18
  }, otherAttributes),
@@ -142,8 +139,6 @@ export var buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayloa
142
139
  actionSubject: actionSubject,
143
140
  eventType: OPERATIONAL_EVENT_TYPE,
144
141
  attributes: {
145
- packageName: packageName,
146
- packageVersion: packageVersion,
147
142
  componentName: componentName,
148
143
  duration: duration,
149
144
  userIds: userIds,
@@ -2,12 +2,11 @@ import React from 'react';
2
2
  import uuid from 'uuid';
3
3
  import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
4
4
  import { mention } from '@atlaskit/adf-schema';
5
- import WithPluginState from '../../ui/WithPluginState';
6
- import { isTypeAheadAllowed } from '../type-ahead/utils';
5
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
7
6
  import ToolbarMention from './ui/ToolbarMention';
8
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
8
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
10
- import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
9
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
11
10
  import { createTypeAheadConfig } from './type-ahead';
12
11
  import { mentionPluginKey } from './pm-plugins/key';
13
12
  import { createMentionPlugin } from './pm-plugins/main';
@@ -69,7 +68,7 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
69
68
  mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
70
69
  return !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
71
70
  editorView: editorView,
72
- isDisabled: disabled || isTypeAheadAllowed(editorView.state)
71
+ isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
73
72
  });
74
73
  }
75
74
  });
@@ -13,7 +13,19 @@ import { PureComponent } from 'react';
13
13
  import { ResourcedMention } from '@atlaskit/mention/element';
14
14
  import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
15
15
  import { browser } from '@atlaskit/editor-common/utils';
16
- import { refreshBrowserSelection } from '../../../code-block/refresh-browser-selection';
16
+
17
+ // Workaround for a firefox issue where dom selection is off sync
18
+ // https://product-fabric.atlassian.net/browse/ED-12442
19
+ var refreshBrowserSelection = function refreshBrowserSelection() {
20
+ var domSelection = window.getSelection();
21
+ if (domSelection) {
22
+ var domRange = domSelection && domSelection.rangeCount === 1 && domSelection.getRangeAt(0).cloneRange();
23
+ if (domRange) {
24
+ domSelection.removeAllRanges();
25
+ domSelection.addRange(domRange);
26
+ }
27
+ }
28
+ };
17
29
  var Mention = /*#__PURE__*/function (_PureComponent) {
18
30
  _inherits(Mention, _PureComponent);
19
31
  var _super = _createSuper(Mention);
@@ -10,8 +10,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
  import React from 'react';
11
11
  import { PureComponent } from 'react';
12
12
  import MentionIcon from '@atlaskit/icon/glyph/editor/mention';
13
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
14
- import { INPUT_METHOD } from '../../../analytics';
13
+ import { ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
14
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
15
15
  import { createTypeAheadTools } from '../../../type-ahead/api';
16
16
  import { injectIntl } from 'react-intl-next';
17
17
  import { messages } from '../../messages';
@@ -16,7 +16,7 @@ import { typeAheadQuery } from '@atlaskit/adf-schema';
16
16
  import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
17
17
  import { inputRulePlugin } from './pm-plugins/input-rules';
18
18
  import { TypeAheadPopup } from './ui/TypeAheadPopup';
19
- import { getPluginState, isTypeAheadOpen } from './utils';
19
+ import { getPluginState, isTypeAheadOpen, isTypeAheadAllowed } from './utils';
20
20
  import { useItemInsert } from './ui/hooks/use-item-insert';
21
21
  import { updateSelectedIndex } from './commands/update-selected-index';
22
22
  import { StatsModifier } from './stats-modifier';
@@ -160,7 +160,8 @@ var typeAheadPlugin = function typeAheadPlugin(_ref4) {
160
160
  openTypeAheadAtCursor: openTypeAheadAtCursor
161
161
  },
162
162
  actions: {
163
- isOpen: isTypeAheadOpen
163
+ isOpen: isTypeAheadOpen,
164
+ isAllowed: isTypeAheadAllowed
164
165
  },
165
166
  contentComponent: function contentComponent(_ref7) {
166
167
  var editorView = _ref7.editorView,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "188.0.9";
2
+ export var version = "188.0.11";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -274,6 +274,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
274
274
  pluginConfiguration: TypeAheadPluginOptions | undefined;
275
275
  actions: {
276
276
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
277
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
277
278
  };
278
279
  commands: {
279
280
  openTypeAheadAtCursor: (props: {
@@ -287,6 +288,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
287
288
  pluginConfiguration: TypeAheadPluginOptions | undefined;
288
289
  actions: {
289
290
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
291
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
290
292
  };
291
293
  commands: {
292
294
  openTypeAheadAtCursor: (props: {
@@ -599,6 +601,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
599
601
  pluginConfiguration: TypeAheadPluginOptions | undefined;
600
602
  actions: {
601
603
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
604
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
602
605
  };
603
606
  commands: {
604
607
  openTypeAheadAtCursor: (props: {
@@ -612,6 +615,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
612
615
  pluginConfiguration: TypeAheadPluginOptions | undefined;
613
616
  actions: {
614
617
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
618
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
615
619
  };
616
620
  commands: {
617
621
  openTypeAheadAtCursor: (props: {
@@ -1,8 +1,8 @@
1
- import { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
2
- import { MentionDescription } from '@atlaskit/mention/resource';
3
- import { InviteExperimentCohort, UserRole } from '@atlaskit/mention';
4
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
- import { TeamInfoAttrAnalytics } from './types';
1
+ import type { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
2
+ import type { MentionDescription } from '@atlaskit/mention/resource';
3
+ import type { InviteExperimentCohort, UserRole } from '@atlaskit/mention';
4
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
+ import type { TeamInfoAttrAnalytics } from './types';
6
6
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
7
7
  export declare const buildAnalyticsPayload: (actionSubject: string, action: string, eventType: EventType, sessionId: string, otherAttributes?: {}, tags?: Array<string>) => GasPayload;
8
8
  export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => GasPayload;
@@ -2,7 +2,7 @@ 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
+ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
6
6
  export { mentionPluginKey };
7
7
  declare const mentionsPlugin: NextEditorPlugin<'mention', {
8
8
  pluginConfiguration: MentionPluginOptions | undefined;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { MentionDescription } from '@atlaskit/mention/resource';
3
- import type { TypeAheadHandler, TypeAheadItem } from '../../type-ahead/types';
3
+ import type { TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
4
4
  import type { FireElementsChannelEvent } from '../types';
5
5
  export declare const mentionToTypeaheadItem: (mention: MentionDescription) => TypeAheadItem;
6
6
  export declare function memoize<ResultFn extends (mention: MentionDescription) => TypeAheadItem>(fn: ResultFn): {
@@ -362,6 +362,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
362
362
  pluginConfiguration: TypeAheadPluginOptions | undefined;
363
363
  actions: {
364
364
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
365
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
365
366
  };
366
367
  commands: {
367
368
  openTypeAheadAtCursor: (props: {
@@ -377,6 +378,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
377
378
  pluginConfiguration: TypeAheadPluginOptions | undefined;
378
379
  actions: {
379
380
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
381
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
380
382
  };
381
383
  commands: {
382
384
  openTypeAheadAtCursor: (props: {
@@ -792,6 +794,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
792
794
  pluginConfiguration: TypeAheadPluginOptions | undefined;
793
795
  actions: {
794
796
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
797
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
795
798
  };
796
799
  commands: {
797
800
  openTypeAheadAtCursor: (props: {
@@ -807,6 +810,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
807
810
  pluginConfiguration: TypeAheadPluginOptions | undefined;
808
811
  actions: {
809
812
  isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
813
+ isAllowed: (editorState: import("prosemirror-state").EditorState) => boolean;
810
814
  };
811
815
  commands: {
812
816
  openTypeAheadAtCursor: (props: {
@@ -1,8 +1,8 @@
1
- import { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
2
- import { MentionDescription } from '@atlaskit/mention/resource';
3
- import { InviteExperimentCohort, UserRole } from '@atlaskit/mention';
4
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
- import { TeamInfoAttrAnalytics } from './types';
1
+ import type { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
2
+ import type { MentionDescription } from '@atlaskit/mention/resource';
3
+ import type { InviteExperimentCohort, UserRole } from '@atlaskit/mention';
4
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
+ import type { TeamInfoAttrAnalytics } from './types';
6
6
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
7
7
  export declare const buildAnalyticsPayload: (actionSubject: string, action: string, eventType: EventType, sessionId: string, otherAttributes?: {}, tags?: Array<string>) => GasPayload;
8
8
  export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => GasPayload;
@@ -2,7 +2,7 @@ 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
+ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
6
6
  export { mentionPluginKey };
7
7
  declare const mentionsPlugin: NextEditorPlugin<'mention', {
8
8
  pluginConfiguration: MentionPluginOptions | undefined;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { MentionDescription } from '@atlaskit/mention/resource';
3
- import type { TypeAheadHandler, TypeAheadItem } from '../../type-ahead/types';
3
+ import type { TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
4
4
  import type { FireElementsChannelEvent } from '../types';
5
5
  export declare const mentionToTypeaheadItem: (mention: MentionDescription) => TypeAheadItem;
6
6
  export declare function memoize<ResultFn extends (mention: MentionDescription) => TypeAheadItem>(fn: ResultFn): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "188.0.9",
3
+ "version": "188.0.11",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -85,7 +85,7 @@
85
85
  "@atlaskit/editor-plugin-rule": "^0.1.0",
86
86
  "@atlaskit/editor-plugin-table": "^4.0.0",
87
87
  "@atlaskit/editor-plugin-text-formatting": "^0.4.0",
88
- "@atlaskit/editor-plugin-type-ahead": "^0.3.0",
88
+ "@atlaskit/editor-plugin-type-ahead": "^0.4.0",
89
89
  "@atlaskit/editor-plugin-unsupported-content": "^0.2.0",
90
90
  "@atlaskit/editor-plugin-width": "^0.2.0",
91
91
  "@atlaskit/editor-prosemirror": "1.1.0",