@atlaskit/editor-plugin-mentions 2.3.1 → 2.4.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,13 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#131937](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131937)
8
+ [`64414d9668409`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/64414d9668409) -
9
+ Adding configuration to mentions plugin from confluence
10
+
3
11
  ## 2.3.1
4
12
 
5
13
  ### Patch Changes
@@ -39,6 +39,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
39
39
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
40
40
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
41
41
  HighlightComponent: options === null || options === void 0 ? void 0 : options.HighlightComponent,
42
+ handleMentionsInserted: options === null || options === void 0 ? void 0 : options.handleMentionsInserted,
42
43
  fireEvent: fireEvent,
43
44
  api: api
44
45
  });
@@ -75,6 +76,11 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
75
76
  triggerHandler: typeAhead,
76
77
  inputMethod: inputMethod
77
78
  }));
79
+ },
80
+ announceMentionsInsertion: function announceMentionsInsertion(mentionIds) {
81
+ if (options !== null && options !== void 0 && options.handleMentionsInserted) {
82
+ options.handleMentionsInserted(mentionIds);
83
+ }
78
84
  }
79
85
  },
80
86
  getSharedState: function getSharedState(editorState) {
@@ -197,7 +197,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
197
197
  mentionInsertDisplayName = _ref6.mentionInsertDisplayName,
198
198
  fireEvent = _ref6.fireEvent,
199
199
  HighlightComponent = _ref6.HighlightComponent,
200
- api = _ref6.api;
200
+ api = _ref6.api,
201
+ handleMentionsInserted = _ref6.handleMentionsInserted;
201
202
  var sessionId = (0, _uuid.default)();
202
203
  var firstQueryWithoutResults = null;
203
204
  var subscriptionKeys = new Set();
@@ -318,6 +319,12 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
318
319
  }
319
320
  }
320
321
  var mentionLocalId = (0, _uuid.default)();
322
+ if (handleMentionsInserted) {
323
+ handleMentionsInserted([{
324
+ localId: mentionLocalId,
325
+ id: id
326
+ }]);
327
+ }
321
328
  fireEvent((0, _analytics.buildTypeAheadInsertedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(function (x) {
322
329
  return x.mention;
323
330
  }), query, contextIdentifierProvider, taskListId, taskItemId));
@@ -31,6 +31,7 @@ const mentionsPlugin = ({
31
31
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
32
32
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
33
33
  HighlightComponent: options === null || options === void 0 ? void 0 : options.HighlightComponent,
34
+ handleMentionsInserted: options === null || options === void 0 ? void 0 : options.handleMentionsInserted,
34
35
  fireEvent,
35
36
  api
36
37
  });
@@ -66,6 +67,11 @@ const mentionsPlugin = ({
66
67
  triggerHandler: typeAhead,
67
68
  inputMethod
68
69
  }));
70
+ },
71
+ announceMentionsInsertion: mentionIds => {
72
+ if (options !== null && options !== void 0 && options.handleMentionsInserted) {
73
+ options.handleMentionsInserted(mentionIds);
74
+ }
69
75
  }
70
76
  },
71
77
  getSharedState(editorState) {
@@ -173,7 +173,8 @@ export const createTypeAheadConfig = ({
173
173
  mentionInsertDisplayName,
174
174
  fireEvent,
175
175
  HighlightComponent,
176
- api
176
+ api,
177
+ handleMentionsInserted
177
178
  }) => {
178
179
  let sessionId = uuid();
179
180
  let firstQueryWithoutResults = null;
@@ -304,6 +305,12 @@ export const createTypeAheadConfig = ({
304
305
  }
305
306
  }
306
307
  const mentionLocalId = uuid();
308
+ if (handleMentionsInserted) {
309
+ handleMentionsInserted([{
310
+ localId: mentionLocalId,
311
+ id: id
312
+ }]);
313
+ }
307
314
  fireEvent(buildTypeAheadInsertedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(x => x.mention), query, contextIdentifierProvider, taskListId, taskItemId));
308
315
  sessionId = uuid();
309
316
  if (mentionProvider && isTeamType(userType)) {
@@ -32,6 +32,7 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
32
32
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
33
33
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
34
34
  HighlightComponent: options === null || options === void 0 ? void 0 : options.HighlightComponent,
35
+ handleMentionsInserted: options === null || options === void 0 ? void 0 : options.handleMentionsInserted,
35
36
  fireEvent: fireEvent,
36
37
  api: api
37
38
  });
@@ -68,6 +69,11 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
68
69
  triggerHandler: typeAhead,
69
70
  inputMethod: inputMethod
70
71
  }));
72
+ },
73
+ announceMentionsInsertion: function announceMentionsInsertion(mentionIds) {
74
+ if (options !== null && options !== void 0 && options.handleMentionsInserted) {
75
+ options.handleMentionsInserted(mentionIds);
76
+ }
71
77
  }
72
78
  },
73
79
  getSharedState: function getSharedState(editorState) {
@@ -185,7 +185,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
185
185
  mentionInsertDisplayName = _ref6.mentionInsertDisplayName,
186
186
  fireEvent = _ref6.fireEvent,
187
187
  HighlightComponent = _ref6.HighlightComponent,
188
- api = _ref6.api;
188
+ api = _ref6.api,
189
+ handleMentionsInserted = _ref6.handleMentionsInserted;
189
190
  var sessionId = uuid();
190
191
  var firstQueryWithoutResults = null;
191
192
  var subscriptionKeys = new Set();
@@ -306,6 +307,12 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
306
307
  }
307
308
  }
308
309
  var mentionLocalId = uuid();
310
+ if (handleMentionsInserted) {
311
+ handleMentionsInserted([{
312
+ localId: mentionLocalId,
313
+ id: id
314
+ }]);
315
+ }
309
316
  fireEvent(buildTypeAheadInsertedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(function (x) {
310
317
  return x.mention;
311
318
  }), query, contextIdentifierProvider, taskListId, taskItemId));
@@ -13,6 +13,10 @@ type Props = {
13
13
  HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
14
14
  fireEvent: FireElementsChannelEvent;
15
15
  api: ExtractInjectionAPI<MentionsPlugin> | undefined;
16
+ handleMentionsInserted?: (mentionIds: {
17
+ localId: string;
18
+ id: string;
19
+ }[]) => void;
16
20
  };
17
- export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, }: Props) => TypeAheadHandler;
21
+ export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsInserted, }: Props) => TypeAheadHandler;
18
22
  export {};
@@ -19,6 +19,10 @@ export interface MentionPluginConfig {
19
19
  export interface MentionPluginOptions extends MentionPluginConfig {
20
20
  sanitizePrivateContent?: boolean;
21
21
  allowZeroWidthSpaceAfter?: boolean;
22
+ handleMentionsInserted?: (mentionIds: {
23
+ localId: string;
24
+ id: string;
25
+ }[]) => void;
22
26
  }
23
27
  export type MentionPluginState = {
24
28
  mentionProvider?: MentionProvider;
@@ -39,5 +43,9 @@ export type MentionsPlugin = NextEditorPlugin<'mention', {
39
43
  sharedState: MentionSharedState | undefined;
40
44
  actions: {
41
45
  openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
46
+ announceMentionsInsertion: (mentionIds: {
47
+ localId: string;
48
+ id: string;
49
+ }[]) => void;
42
50
  };
43
51
  }>;
@@ -13,6 +13,10 @@ type Props = {
13
13
  HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
14
14
  fireEvent: FireElementsChannelEvent;
15
15
  api: ExtractInjectionAPI<MentionsPlugin> | undefined;
16
+ handleMentionsInserted?: (mentionIds: {
17
+ localId: string;
18
+ id: string;
19
+ }[]) => void;
16
20
  };
17
- export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, }: Props) => TypeAheadHandler;
21
+ export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsInserted, }: Props) => TypeAheadHandler;
18
22
  export {};
@@ -19,6 +19,10 @@ export interface MentionPluginConfig {
19
19
  export interface MentionPluginOptions extends MentionPluginConfig {
20
20
  sanitizePrivateContent?: boolean;
21
21
  allowZeroWidthSpaceAfter?: boolean;
22
+ handleMentionsInserted?: (mentionIds: {
23
+ localId: string;
24
+ id: string;
25
+ }[]) => void;
22
26
  }
23
27
  export type MentionPluginState = {
24
28
  mentionProvider?: MentionProvider;
@@ -39,5 +43,9 @@ export type MentionsPlugin = NextEditorPlugin<'mention', {
39
43
  sharedState: MentionSharedState | undefined;
40
44
  actions: {
41
45
  openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
46
+ announceMentionsInsertion: (mentionIds: {
47
+ localId: string;
48
+ id: string;
49
+ }[]) => void;
42
50
  };
43
51
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,16 +35,16 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^40.8.1",
37
37
  "@atlaskit/analytics-gas-types": "^5.1.0",
38
- "@atlaskit/editor-common": "^87.10.0",
38
+ "@atlaskit/editor-common": "^87.13.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.7.0",
40
- "@atlaskit/editor-plugin-context-identifier": "^1.2.0",
41
- "@atlaskit/editor-plugin-type-ahead": "^1.7.0",
40
+ "@atlaskit/editor-plugin-context-identifier": "^1.3.0",
41
+ "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
42
42
  "@atlaskit/editor-prosemirror": "5.0.1",
43
- "@atlaskit/icon": "^22.12.0",
43
+ "@atlaskit/icon": "^22.13.0",
44
44
  "@atlaskit/mention": "^23.2.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/theme": "^13.0.0",
47
- "@atlaskit/tokens": "^1.58.0",
47
+ "@atlaskit/tokens": "^1.59.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "uuid": "^3.1.0"