@atlaskit/editor-plugin-mentions 18.1.0 → 18.1.1

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,14 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 18.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`243f04087ceef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/243f04087ceef) -
8
+ Dismiss the agent profile card and clear the mention's node selection when opening Rovo chat from
9
+ the mention card's chat action, gated behind platform_editor_agent_card_close_on_chat.
10
+ - Updated dependencies
11
+
3
12
  ## 18.1.0
4
13
 
5
14
  ### Minor Changes
@@ -103,7 +103,14 @@ var profileCardRenderer = exports.profileCardRenderer = function profileCardRend
103
103
  profilecardProvider: options === null || options === void 0 ? void 0 : options.profilecardProvider,
104
104
  onAgentMentionChatClick: options !== null && options !== void 0 && options.onAgentMentionChatClick && (0, _fg.fg)('platform_editor_agent_mentions_drop_one_fixes') ? function (agentId) {
105
105
  var _options$onAgentMenti;
106
- return (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 ? void 0 : _options$onAgentMenti.call(options, agentId, agentMentionContext);
106
+ (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 || _options$onAgentMenti.call(options, agentId, agentMentionContext);
107
+ // The mention stays node-selected after the chat opens; collapse the
108
+ // selection to a cursor just after it so it is no longer left selected.
109
+ // Selection-only change, so it does not move focus (EDITOR-8257).
110
+ if (editorView && (0, _fg.fg)('platform_editor_agent_card_close_on_chat')) {
111
+ var state = editorView.state;
112
+ editorView.dispatch(state.tr.setSelection(_state.TextSelection.create(state.doc, state.selection.to)));
113
+ }
107
114
  } : undefined,
108
115
  dom: referenceElement,
109
116
  closeComponent: removeProfileCard
@@ -74,7 +74,7 @@ var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
74
74
  var AGENT_MENTION_INACTIVITY_MS = 3000;
75
75
  var MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
76
76
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
77
- var PACKAGE_VERSION = "18.0.6";
77
+ var PACKAGE_VERSION = "18.1.0";
78
78
  var setProvider = function setProvider(provider) {
79
79
  return function (state, dispatch) {
80
80
  if (dispatch) {
@@ -209,11 +209,13 @@ function ProfileCardComponent(_ref5) {
209
209
  hideActions: hideActions,
210
210
  text: (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
211
211
  onChatClick: onAgentMentionChatClick && (0, _fg.fg)('platform_editor_agent_mentions_drop_one_fixes') ? function (event, agentStudioId) {
212
- return (
213
- // agentMentionContext is already captured in the onAgentMentionChatClick
214
- // closure built by profileCardRenderer at chip-click time via doc.descendants()
215
- onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id)
216
- );
212
+ // agentMentionContext is already captured in the onAgentMentionChatClick
213
+ // closure built by profileCardRenderer at chip-click time via doc.descendants()
214
+ onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id);
215
+ // Dismiss the profile card once the Rovo chat panel opens (EDITOR-8257).
216
+ if ((0, _fg.fg)('platform_editor_agent_card_close_on_chat')) {
217
+ closeComponent();
218
+ }
217
219
  } : undefined
218
220
  }) : /*#__PURE__*/React.createElement(UserProfileCardContent, {
219
221
  accessLevel: accessLevel,
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { bind } from 'bind-event-listener';
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
4
  import uuid from 'uuid/v4';
5
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findChildrenByAttr } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
8
  import { fg } from '@atlaskit/platform-feature-flags/fg';
@@ -92,7 +92,16 @@ export const profileCardRenderer = ({
92
92
  profilecardProvider: options === null || options === void 0 ? void 0 : options.profilecardProvider,
93
93
  onAgentMentionChatClick: options !== null && options !== void 0 && options.onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? agentId => {
94
94
  var _options$onAgentMenti;
95
- return (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 ? void 0 : _options$onAgentMenti.call(options, agentId, agentMentionContext);
95
+ (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 ? void 0 : _options$onAgentMenti.call(options, agentId, agentMentionContext);
96
+ // The mention stays node-selected after the chat opens; collapse the
97
+ // selection to a cursor just after it so it is no longer left selected.
98
+ // Selection-only change, so it does not move focus (EDITOR-8257).
99
+ if (editorView && fg('platform_editor_agent_card_close_on_chat')) {
100
+ const {
101
+ state
102
+ } = editorView;
103
+ editorView.dispatch(state.tr.setSelection(TextSelection.create(state.doc, state.selection.to)));
104
+ }
96
105
  } : undefined,
97
106
  dom: referenceElement,
98
107
  closeComponent: removeProfileCard
@@ -58,7 +58,7 @@ const AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
58
58
  const AGENT_MENTION_INACTIVITY_MS = 3000;
59
59
  const MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
60
60
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
61
- const PACKAGE_VERSION = "18.0.6";
61
+ const PACKAGE_VERSION = "18.1.0";
62
62
  const setProvider = provider => (state, dispatch) => {
63
63
  if (dispatch) {
64
64
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -138,10 +138,15 @@ export function ProfileCardComponent({
138
138
  provider: provider,
139
139
  hideActions: hideActions,
140
140
  text: expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
141
- onChatClick: onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? (event, agentStudioId) =>
142
- // agentMentionContext is already captured in the onAgentMentionChatClick
143
- // closure built by profileCardRenderer at chip-click time via doc.descendants()
144
- onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id) : undefined
141
+ onChatClick: onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? (event, agentStudioId) => {
142
+ // agentMentionContext is already captured in the onAgentMentionChatClick
143
+ // closure built by profileCardRenderer at chip-click time via doc.descendants()
144
+ onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id);
145
+ // Dismiss the profile card once the Rovo chat panel opens (EDITOR-8257).
146
+ if (fg('platform_editor_agent_card_close_on_chat')) {
147
+ closeComponent();
148
+ }
149
+ } : undefined
145
150
  }) : /*#__PURE__*/React.createElement(UserProfileCardContent, {
146
151
  accessLevel: accessLevel,
147
152
  id: id,
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import { bind } from 'bind-event-listener';
6
6
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
7
7
  import uuid from 'uuid/v4';
8
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
8
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { findChildrenByAttr } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
11
  import { fg } from '@atlaskit/platform-feature-flags/fg';
@@ -97,7 +97,14 @@ export var profileCardRenderer = function profileCardRenderer(_ref) {
97
97
  profilecardProvider: options === null || options === void 0 ? void 0 : options.profilecardProvider,
98
98
  onAgentMentionChatClick: options !== null && options !== void 0 && options.onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? function (agentId) {
99
99
  var _options$onAgentMenti;
100
- return (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 ? void 0 : _options$onAgentMenti.call(options, agentId, agentMentionContext);
100
+ (_options$onAgentMenti = options.onAgentMentionChatClick) === null || _options$onAgentMenti === void 0 || _options$onAgentMenti.call(options, agentId, agentMentionContext);
101
+ // The mention stays node-selected after the chat opens; collapse the
102
+ // selection to a cursor just after it so it is no longer left selected.
103
+ // Selection-only change, so it does not move focus (EDITOR-8257).
104
+ if (editorView && fg('platform_editor_agent_card_close_on_chat')) {
105
+ var state = editorView.state;
106
+ editorView.dispatch(state.tr.setSelection(TextSelection.create(state.doc, state.selection.to)));
107
+ }
101
108
  } : undefined,
102
109
  dom: referenceElement,
103
110
  closeComponent: removeProfileCard
@@ -65,7 +65,7 @@ var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
65
65
  var AGENT_MENTION_INACTIVITY_MS = 3000;
66
66
  var MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
67
67
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
68
- var PACKAGE_VERSION = "18.0.6";
68
+ var PACKAGE_VERSION = "18.1.0";
69
69
  var setProvider = function setProvider(provider) {
70
70
  return function (state, dispatch) {
71
71
  if (dispatch) {
@@ -198,11 +198,13 @@ export function ProfileCardComponent(_ref5) {
198
198
  hideActions: hideActions,
199
199
  text: expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
200
200
  onChatClick: onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? function (event, agentStudioId) {
201
- return (
202
- // agentMentionContext is already captured in the onAgentMentionChatClick
203
- // closure built by profileCardRenderer at chip-click time via doc.descendants()
204
- onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id)
205
- );
201
+ // agentMentionContext is already captured in the onAgentMentionChatClick
202
+ // closure built by profileCardRenderer at chip-click time via doc.descendants()
203
+ onAgentMentionChatClick(agentStudioId !== null && agentStudioId !== void 0 ? agentStudioId : id);
204
+ // Dismiss the profile card once the Rovo chat panel opens (EDITOR-8257).
205
+ if (fg('platform_editor_agent_card_close_on_chat')) {
206
+ closeComponent();
207
+ }
206
208
  } : undefined
207
209
  }) : /*#__PURE__*/React.createElement(UserProfileCardContent, {
208
210
  accessLevel: accessLevel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "18.1.0",
3
+ "version": "18.1.1",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/section-message": "^10.1.0",
48
48
  "@atlaskit/teams-app-config": "^3.0.0",
49
49
  "@atlaskit/theme": "^28.1.0",
50
- "@atlaskit/tmp-editor-statsig": "^163.0.0",
50
+ "@atlaskit/tmp-editor-statsig": "^164.0.0",
51
51
  "@atlaskit/tokens": "^16.8.0",
52
52
  "@atlaskit/tooltip": "^24.2.0",
53
53
  "@atlaskit/user-picker": "^13.10.0",
@@ -129,6 +129,9 @@
129
129
  "platform_editor_agent_mentions_drop_one_fixes": {
130
130
  "type": "boolean"
131
131
  },
132
+ "platform_editor_agent_card_close_on_chat": {
133
+ "type": "boolean"
134
+ },
132
135
  "platform_editor_mention_typeahead_profilecard": {
133
136
  "type": "boolean"
134
137
  },