@atlaskit/editor-plugin-mentions 13.1.1 → 13.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 13.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3bb54917f1df6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3bb54917f1df6) -
8
+ Add a gated API for updating mention typeahead section metadata.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 13.1.1
4
15
 
5
16
  ### Patch Changes
@@ -19,6 +19,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
19
19
  var _resource = require("@atlaskit/mention/resource");
20
20
  var _types = require("@atlaskit/mention/types");
21
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
+ var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
22
23
  var _editorCommands = require("./editor-commands");
23
24
  var _mentionNodeSpec = require("./nodeviews/mentionNodeSpec");
24
25
  var _key = require("./pm-plugins/key");
@@ -195,6 +196,13 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
195
196
  options.handleMentionsChanged(mentionChanges);
196
197
  }
197
198
  },
199
+ updateSectionTitle: function updateSectionTitle(props) {
200
+ var _api$typeAhead$action, _api$typeAhead2, _api$typeAhead2$updat;
201
+ if (!(0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false)) {
202
+ return false;
203
+ }
204
+ return (_api$typeAhead$action = api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2 = _api$typeAhead2.actions) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2$updat = _api$typeAhead2.updateSectionTitle) === null || _api$typeAhead2$updat === void 0 ? void 0 : _api$typeAhead2$updat.call(_api$typeAhead2, props)) !== null && _api$typeAhead$action !== void 0 ? _api$typeAhead$action : false;
205
+ },
198
206
  setProvider: function () {
199
207
  var _setProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
200
208
  var _api$core$actions$exe;
@@ -263,13 +271,13 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
263
271
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconMention, null);
264
272
  },
265
273
  action: function action(insert, state) {
266
- var _api$typeAhead2;
274
+ var _api$typeAhead3;
267
275
  var tr = insert(undefined);
268
276
  var pluginState = _key.mentionPluginKey.getState(state);
269
277
  if (pluginState && pluginState.canInsertMention === false) {
270
278
  return false;
271
279
  }
272
- api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
280
+ api === null || api === void 0 || (_api$typeAhead3 = api.typeAhead) === null || _api$typeAhead3 === void 0 || _api$typeAhead3.actions.openAtTransaction({
273
281
  triggerHandler: typeAhead,
274
282
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
275
283
  })(tr);
@@ -32,7 +32,7 @@ var ACTIONS = exports.ACTIONS = {
32
32
  var AGENT_USER_TYPES = new Set(['APP', 'AGENT']);
33
33
  var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
34
34
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
35
- var PACKAGE_VERSION = "13.1.0";
35
+ var PACKAGE_VERSION = "13.1.1";
36
36
  var setProvider = function setProvider(provider) {
37
37
  return function (state, dispatch) {
38
38
  if (dispatch) {
@@ -9,6 +9,7 @@ import { IconMention } from '@atlaskit/editor-common/quick-insert';
9
9
  import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
10
10
  import { MentionNameStatus, isPromise } from '@atlaskit/mention/types';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
12
13
  import { insertMention } from './editor-commands';
13
14
  import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
14
15
  import { mentionPluginKey } from './pm-plugins/key';
@@ -192,6 +193,13 @@ const mentionsPlugin = ({
192
193
  options.handleMentionsChanged(mentionChanges);
193
194
  }
194
195
  },
196
+ updateSectionTitle: props => {
197
+ var _api$typeAhead$action2, _api$typeAhead2, _api$typeAhead2$actio, _api$typeAhead2$actio2;
198
+ if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
199
+ return false;
200
+ }
201
+ return (_api$typeAhead$action2 = api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : (_api$typeAhead2$actio = _api$typeAhead2.actions) === null || _api$typeAhead2$actio === void 0 ? void 0 : (_api$typeAhead2$actio2 = _api$typeAhead2$actio.updateSectionTitle) === null || _api$typeAhead2$actio2 === void 0 ? void 0 : _api$typeAhead2$actio2.call(_api$typeAhead2$actio, props)) !== null && _api$typeAhead$action2 !== void 0 ? _api$typeAhead$action2 : false;
202
+ },
195
203
  setProvider: async providerPromise => {
196
204
  var _api$core$actions$exe;
197
205
  if (!fg('platform_editor_mention_provider_via_plugin_config')) {
@@ -235,13 +243,13 @@ const mentionsPlugin = ({
235
243
  keyshortcut: '@',
236
244
  icon: () => /*#__PURE__*/React.createElement(IconMention, null),
237
245
  action(insert, state) {
238
- var _api$typeAhead2;
246
+ var _api$typeAhead3;
239
247
  const tr = insert(undefined);
240
248
  const pluginState = mentionPluginKey.getState(state);
241
249
  if (pluginState && pluginState.canInsertMention === false) {
242
250
  return false;
243
251
  }
244
- api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.openAtTransaction({
252
+ api === null || api === void 0 ? void 0 : (_api$typeAhead3 = api.typeAhead) === null || _api$typeAhead3 === void 0 ? void 0 : _api$typeAhead3.actions.openAtTransaction({
245
253
  triggerHandler: typeAhead,
246
254
  inputMethod: INPUT_METHOD.QUICK_INSERT
247
255
  })(tr);
@@ -17,7 +17,7 @@ export const ACTIONS = {
17
17
  const AGENT_USER_TYPES = new Set(['APP', 'AGENT']);
18
18
  const AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
19
19
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
20
- const PACKAGE_VERSION = "13.1.0";
20
+ const PACKAGE_VERSION = "13.1.1";
21
21
  const setProvider = provider => (state, dispatch) => {
22
22
  if (dispatch) {
23
23
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -14,6 +14,7 @@ import { IconMention } from '@atlaskit/editor-common/quick-insert';
14
14
  import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
15
15
  import { MentionNameStatus, isPromise } from '@atlaskit/mention/types';
16
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
+ import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
17
18
  import { insertMention } from './editor-commands';
18
19
  import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
19
20
  import { mentionPluginKey } from './pm-plugins/key';
@@ -187,6 +188,13 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
187
188
  options.handleMentionsChanged(mentionChanges);
188
189
  }
189
190
  },
191
+ updateSectionTitle: function updateSectionTitle(props) {
192
+ var _api$typeAhead$action, _api$typeAhead2, _api$typeAhead2$updat;
193
+ if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
194
+ return false;
195
+ }
196
+ return (_api$typeAhead$action = api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2 = _api$typeAhead2.actions) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2$updat = _api$typeAhead2.updateSectionTitle) === null || _api$typeAhead2$updat === void 0 ? void 0 : _api$typeAhead2$updat.call(_api$typeAhead2, props)) !== null && _api$typeAhead$action !== void 0 ? _api$typeAhead$action : false;
197
+ },
190
198
  setProvider: function () {
191
199
  var _setProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(providerPromise) {
192
200
  var _api$core$actions$exe;
@@ -255,13 +263,13 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
255
263
  return /*#__PURE__*/React.createElement(IconMention, null);
256
264
  },
257
265
  action: function action(insert, state) {
258
- var _api$typeAhead2;
266
+ var _api$typeAhead3;
259
267
  var tr = insert(undefined);
260
268
  var pluginState = mentionPluginKey.getState(state);
261
269
  if (pluginState && pluginState.canInsertMention === false) {
262
270
  return false;
263
271
  }
264
- api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
272
+ api === null || api === void 0 || (_api$typeAhead3 = api.typeAhead) === null || _api$typeAhead3 === void 0 || _api$typeAhead3.actions.openAtTransaction({
265
273
  triggerHandler: typeAhead,
266
274
  inputMethod: INPUT_METHOD.QUICK_INSERT
267
275
  })(tr);
@@ -24,7 +24,7 @@ export var ACTIONS = {
24
24
  var AGENT_USER_TYPES = new Set(['APP', 'AGENT']);
25
25
  var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
26
26
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
27
- var PACKAGE_VERSION = "13.1.0";
27
+ var PACKAGE_VERSION = "13.1.1";
28
28
  var setProvider = function setProvider(provider) {
29
29
  return function (state, dispatch) {
30
30
  if (dispatch) {
@@ -1,4 +1,4 @@
1
- import type { NextEditorPlugin, OptionalPlugin, EditorCommand } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin, EditorCommand, TypeAheadSectionTitleUpdate } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BasePlugin } from '@atlaskit/editor-plugin-base';
4
4
  import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
@@ -16,10 +16,12 @@ export type MentionActionAnnounceMentionsInsertion = (mentionIds: {
16
16
  type: 'added' | 'deleted';
17
17
  }[]) => void;
18
18
  export type MentionActionSetProvider = (provider: Promise<MentionProvider>) => Promise<boolean>;
19
+ export type MentionActionUpdateSectionTitle = (props: TypeAheadSectionTitleUpdate) => boolean;
19
20
  export type MentionActions = {
20
21
  announceMentionsInsertion: MentionActionAnnounceMentionsInsertion;
21
22
  openTypeAhead: MentionActionOpenTypeAhead;
22
23
  setProvider: MentionActionSetProvider;
24
+ updateSectionTitle: MentionActionUpdateSectionTitle;
23
25
  };
24
26
  export type MentionPluginDependencies = [
25
27
  OptionalPlugin<AnalyticsPlugin>,
@@ -1,4 +1,4 @@
1
- import type { NextEditorPlugin, OptionalPlugin, EditorCommand } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin, EditorCommand, TypeAheadSectionTitleUpdate } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BasePlugin } from '@atlaskit/editor-plugin-base';
4
4
  import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
@@ -16,10 +16,12 @@ export type MentionActionAnnounceMentionsInsertion = (mentionIds: {
16
16
  type: 'added' | 'deleted';
17
17
  }[]) => void;
18
18
  export type MentionActionSetProvider = (provider: Promise<MentionProvider>) => Promise<boolean>;
19
+ export type MentionActionUpdateSectionTitle = (props: TypeAheadSectionTitleUpdate) => boolean;
19
20
  export type MentionActions = {
20
21
  announceMentionsInsertion: MentionActionAnnounceMentionsInsertion;
21
22
  openTypeAhead: MentionActionOpenTypeAhead;
22
23
  setProvider: MentionActionSetProvider;
24
+ updateSectionTitle: MentionActionUpdateSectionTitle;
23
25
  };
24
26
  export type MentionPluginDependencies = [
25
27
  OptionalPlugin<AnalyticsPlugin>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "13.1.1",
3
+ "version": "13.2.0",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/editor-plugin-base": "^12.0.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^11.0.0",
37
37
  "@atlaskit/editor-plugin-selection": "^11.0.0",
38
- "@atlaskit/editor-plugin-type-ahead": "^11.0.0",
38
+ "@atlaskit/editor-plugin-type-ahead": "^11.1.0",
39
39
  "@atlaskit/editor-prosemirror": "^7.3.0",
40
40
  "@atlaskit/icon": "^35.4.0",
41
41
  "@atlaskit/insm": "^0.4.0",
@@ -59,7 +59,7 @@
59
59
  "uuid": "^3.1.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@atlaskit/editor-common": "^115.2.0",
62
+ "@atlaskit/editor-common": "^115.3.0",
63
63
  "react": "^18.2.0",
64
64
  "react-dom": "^18.2.0",
65
65
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"