@atlaskit/editor-plugin-mentions 15.0.2 → 15.0.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 15.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e993d47ab501d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e993d47ab501d) -
8
+ Refactor agent mention tracking into a separate ProseMirror plugin behind an experiment.
9
+ - Updated dependencies
10
+
3
11
  ## 15.0.2
4
12
 
5
13
  ### Patch Changes
@@ -19,9 +19,12 @@ var _providerFactory = require("@atlaskit/editor-common/provider-factory");
19
19
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
20
20
  var _resource = require("@atlaskit/mention/resource");
21
21
  var _types = require("@atlaskit/mention/types");
22
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
22
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
23
25
  var _editorCommands = require("./editor-commands");
24
26
  var _mentionNodeSpec = require("./nodeviews/mentionNodeSpec");
27
+ var _agent = require("./pm-plugins/agent");
25
28
  var _key = require("./pm-plugins/key");
26
29
  var _main = require("./pm-plugins/main");
27
30
  var _mentionPlaceholder = require("./pm-plugins/mentionPlaceholder");
@@ -131,6 +134,17 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
131
134
  });
132
135
  }
133
136
  }];
137
+ if ((0, _experiments.editorExperiment)('platform_editor_agent_mentions', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_agent_mentions_separate_pm_plugin')) {
138
+ plugins.push({
139
+ name: 'agentMention',
140
+ plugin: function plugin(pmPluginFactoryParams) {
141
+ return (0, _agent.createAgentMentionPlugin)({
142
+ pmPluginFactoryParams: pmPluginFactoryParams,
143
+ options: options
144
+ });
145
+ }
146
+ });
147
+ }
134
148
  if ((0, _platformFeatureFlags.fg)('jira_invites_auto_tag_new_user_in_mentions_fg')) {
135
149
  plugins.push({
136
150
  name: 'mentionPlaceholder',
@@ -256,13 +270,22 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
256
270
  return undefined;
257
271
  }
258
272
  var mentionPluginState = _key.mentionPluginKey.getState(editorState);
273
+ var agentMentionPluginState = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_agent_mentions_separate_pm_plugin') ? _agent.agentMentionPluginKey.getState(editorState) : undefined;
259
274
  // Exclude pendingPastedAgentMention — it is an @internal transient field and
260
275
  // should not be part of the public shared state API. Exposing it would cause
261
276
  // unnecessary re-renders in subscribers and leak implementation details.
262
277
  var _ref8 = mentionPluginState !== null && mentionPluginState !== void 0 ? mentionPluginState : {},
263
278
  _excluded = _ref8.pendingPastedAgentMention,
264
279
  publicPluginState = (0, _objectWithoutProperties2.default)(_ref8, _excluded2);
265
- return _objectSpread(_objectSpread({}, publicPluginState), {}, {
280
+ return _objectSpread(_objectSpread(_objectSpread({}, publicPluginState), agentMentionPluginState ? {
281
+ lastAgentMentionInsertionCount: agentMentionPluginState.lastAgentMentionInsertionCount,
282
+ lastInsertedAgentMentionContext: agentMentionPluginState.lastInsertedAgentMentionContext,
283
+ lastInsertedAgentMentionId: agentMentionPluginState.lastInsertedAgentMentionId,
284
+ lastInsertedAgentMentionLocalId: agentMentionPluginState.lastInsertedAgentMentionLocalId,
285
+ lastInsertedAgentMentionName: agentMentionPluginState.lastInsertedAgentMentionName,
286
+ lastInsertedAgentMentionParentNodeType: agentMentionPluginState.lastInsertedAgentMentionParentNodeType,
287
+ lastInsertedAgentMentionPrompt: agentMentionPluginState.lastInsertedAgentMentionPrompt
288
+ } : {}), {}, {
266
289
  typeAheadHandler: typeAhead
267
290
  });
268
291
  },