@atlaskit/editor-plugin-mentions 0.1.18 → 0.1.19

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 0.1.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#67238](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67238) [`40533849b2ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40533849b2ec) - [ED-21835] Change EditorAPI type to always union with undefined
8
+
3
9
  ## 0.1.18
4
10
 
5
11
  ### Patch Changes
@@ -99,12 +99,13 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
99
99
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconMention, null);
100
100
  },
101
101
  action: function action(insert, state) {
102
+ var _api$typeAhead2;
102
103
  var tr = insert(undefined);
103
104
  var pluginState = _key.mentionPluginKey.getState(state);
104
105
  if (pluginState && pluginState.canInsertMention === false) {
105
106
  return false;
106
107
  }
107
- api === null || api === void 0 || api.typeAhead.actions.openAtTransaction({
108
+ api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
108
109
  triggerHandler: typeAhead,
109
110
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
110
111
  })(tr);
@@ -13,6 +13,7 @@ var _ToolbarMention = _interopRequireDefault(require("./ToolbarMention"));
13
13
  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); }
14
14
  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; }
15
15
  function SecondaryToolbarComponent(_ref) {
16
+ var _api$typeAhead2;
16
17
  var editorView = _ref.editorView,
17
18
  api = _ref.api,
18
19
  typeAhead = _ref.typeAhead,
@@ -29,6 +30,6 @@ function SecondaryToolbarComponent(_ref) {
29
30
  return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
30
31
  editorView: editorView,
31
32
  onInsertMention: openMentionTypeAhead,
32
- isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
33
+ isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
33
34
  });
34
35
  }
@@ -89,12 +89,13 @@ const mentionsPlugin = ({
89
89
  keyshortcut: '@',
90
90
  icon: () => /*#__PURE__*/React.createElement(IconMention, null),
91
91
  action(insert, state) {
92
+ var _api$typeAhead2;
92
93
  const tr = insert(undefined);
93
94
  const pluginState = mentionPluginKey.getState(state);
94
95
  if (pluginState && pluginState.canInsertMention === false) {
95
96
  return false;
96
97
  }
97
- api === null || api === void 0 ? void 0 : api.typeAhead.actions.openAtTransaction({
98
+ api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.openAtTransaction({
98
99
  triggerHandler: typeAhead,
99
100
  inputMethod: INPUT_METHOD.QUICK_INSERT
100
101
  })(tr);
@@ -8,6 +8,7 @@ export function SecondaryToolbarComponent({
8
8
  typeAhead,
9
9
  disabled
10
10
  }) {
11
+ var _api$typeAhead2;
11
12
  const {
12
13
  mentionState
13
14
  } = useSharedPluginState(api, ['mention']);
@@ -21,6 +22,6 @@ export function SecondaryToolbarComponent({
21
22
  return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
22
23
  editorView: editorView,
23
24
  onInsertMention: openMentionTypeAhead,
24
- isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
25
+ isDisabled: disabled || (api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
25
26
  });
26
27
  }
@@ -92,12 +92,13 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
92
92
  return /*#__PURE__*/React.createElement(IconMention, null);
93
93
  },
94
94
  action: function action(insert, state) {
95
+ var _api$typeAhead2;
95
96
  var tr = insert(undefined);
96
97
  var pluginState = mentionPluginKey.getState(state);
97
98
  if (pluginState && pluginState.canInsertMention === false) {
98
99
  return false;
99
100
  }
100
- api === null || api === void 0 || api.typeAhead.actions.openAtTransaction({
101
+ api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
101
102
  triggerHandler: typeAhead,
102
103
  inputMethod: INPUT_METHOD.QUICK_INSERT
103
104
  })(tr);
@@ -3,6 +3,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
4
  import ToolbarMention from './ToolbarMention';
5
5
  export function SecondaryToolbarComponent(_ref) {
6
+ var _api$typeAhead2;
6
7
  var editorView = _ref.editorView,
7
8
  api = _ref.api,
8
9
  typeAhead = _ref.typeAhead,
@@ -19,6 +20,6 @@ export function SecondaryToolbarComponent(_ref) {
19
20
  return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
20
21
  editorView: editorView,
21
22
  onInsertMention: openMentionTypeAhead,
22
- isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
23
+ isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
23
24
  });
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",