@atlaskit/editor-common 114.49.0 → 114.50.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,25 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 114.50.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`beab4fffee103`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/beab4fffee103) -
8
+ EDITOR-7318: Add type-ahead sections support with getSections handler API.
9
+
10
+ Adds `TypeAheadSection` and `TypeAheadSectionUpdate` types and an optional `getSections()` method
11
+ to `TypeAheadHandler` in `editor-common`. Implements section grouping in
12
+ `editor-plugin-type-ahead` via `buildSectionedResult`. Adds People/Agents section split to
13
+ `editor-plugin-mentions`.
14
+
15
+ Removes the `updateSection` action and associated `sectionOverrides`/`sectionsRefreshKey`
16
+ pm-plugin state — section definitions are now derived directly from `getSections()` at load time
17
+ rather than being mutated at runtime.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 114.49.0
4
24
 
5
25
  ### Minor Changes
@@ -45,5 +45,15 @@ var mentionMessages = exports.mentionMessages = (0, _reactIntl.defineMessages)({
45
45
  id: 'fabric.editor.inviteItem.inviteButton',
46
46
  defaultMessage: 'Invite',
47
47
  description: 'Label for the invite button shown in the mention typeahead invite item.'
48
+ },
49
+ typeAheadSectionPeople: {
50
+ id: 'fabric.editor.typeAhead.mentionSection.people',
51
+ defaultMessage: 'People',
52
+ description: 'Section header for people (non-agent) results in the mention type-ahead menu'
53
+ },
54
+ typeAheadSectionAgents: {
55
+ id: 'fabric.editor.typeAhead.mentionSection.agents',
56
+ defaultMessage: 'Agents',
57
+ description: 'Section header for agent results in the mention type-ahead menu'
48
58
  }
49
59
  });
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "114.48.1";
22
+ var packageVersion = "114.49.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "114.48.1";
27
+ var packageVersion = "114.49.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -39,5 +39,15 @@ export const mentionMessages = defineMessages({
39
39
  id: 'fabric.editor.inviteItem.inviteButton',
40
40
  defaultMessage: 'Invite',
41
41
  description: 'Label for the invite button shown in the mention typeahead invite item.'
42
+ },
43
+ typeAheadSectionPeople: {
44
+ id: 'fabric.editor.typeAhead.mentionSection.people',
45
+ defaultMessage: 'People',
46
+ description: 'Section header for people (non-agent) results in the mention type-ahead menu'
47
+ },
48
+ typeAheadSectionAgents: {
49
+ id: 'fabric.editor.typeAhead.mentionSection.agents',
50
+ defaultMessage: 'Agents',
51
+ description: 'Section header for agent results in the mention type-ahead menu'
42
52
  }
43
53
  });
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "114.48.1";
7
+ const packageVersion = "114.49.0";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "114.48.1";
17
+ const packageVersion = "114.49.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -39,5 +39,15 @@ export var mentionMessages = defineMessages({
39
39
  id: 'fabric.editor.inviteItem.inviteButton',
40
40
  defaultMessage: 'Invite',
41
41
  description: 'Label for the invite button shown in the mention typeahead invite item.'
42
+ },
43
+ typeAheadSectionPeople: {
44
+ id: 'fabric.editor.typeAhead.mentionSection.people',
45
+ defaultMessage: 'People',
46
+ description: 'Section header for people (non-agent) results in the mention type-ahead menu'
47
+ },
48
+ typeAheadSectionAgents: {
49
+ id: 'fabric.editor.typeAhead.mentionSection.agents',
50
+ defaultMessage: 'Agents',
51
+ description: 'Section header for agent results in the mention type-ahead menu'
42
52
  }
43
53
  });
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "114.48.1";
13
+ var packageVersion = "114.49.0";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "114.48.1";
24
+ var packageVersion = "114.49.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -39,4 +39,14 @@ export declare const mentionMessages: {
39
39
  description: string;
40
40
  id: string;
41
41
  };
42
+ typeAheadSectionPeople: {
43
+ defaultMessage: string;
44
+ description: string;
45
+ id: string;
46
+ };
47
+ typeAheadSectionAgents: {
48
+ defaultMessage: string;
49
+ description: string;
50
+ id: string;
51
+ };
42
52
  };
@@ -7,7 +7,7 @@ export { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './annotation/emi
7
7
  export type { AnnotationState, AnnotationUpdateEventPayloads, OnAnnotationClickPayload, } from './annotation/emitter';
8
8
  export type { AnnotationProviders, InlineCommentSelectionComponentProps, InlineCommentHoverComponentProps, InlineCommentViewComponentProps, InlineCommentAnnotationProvider, AnnotationByMatches, AnnotationActionResult, } from './annotation';
9
9
  export type { ContextUpdateHandler, EditorActionsOptions, ReplaceRawValue, GetResolvedEditorStateReason, } from './editor-actions';
10
- export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, } from './type-ahead';
10
+ export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadSection, } from './type-ahead';
11
11
  export type { CommandDispatch, Command, HigherOrderCommand, Predicate } from './command';
12
12
  export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags } from './feature-flags';
13
13
  export type { Browsers, Range, DisableSpellcheckByBrowser } from './supported-browsers';
@@ -45,6 +45,12 @@ export type TypeAheadItem = {
45
45
  testId?: string;
46
46
  title: string;
47
47
  };
48
+ export type TypeAheadSection = {
49
+ filter: (item: TypeAheadItem) => boolean;
50
+ id: string;
51
+ limit?: number;
52
+ title: string;
53
+ };
48
54
  export type TypeAheadForceSelect = (props: TypeAheadForceSelectProps) => TypeAheadItem | undefined;
49
55
  export type MoreOptionsButtonConfig = {
50
56
  ariaLabel?: string;
@@ -78,6 +84,10 @@ export type TypeAheadHandler = {
78
84
  editorState: EditorState;
79
85
  query: string;
80
86
  }) => Promise<Array<TypeAheadItem>>;
87
+ /** Optional section definitions used by type-ahead menu to group items */
88
+ getSections?: (props: {
89
+ intl: IntlShape;
90
+ }) => Array<TypeAheadSection>;
81
91
  getMoreOptionsButtonConfig?: (intl: IntlShape) => MoreOptionsButtonConfig;
82
92
  headless?: boolean;
83
93
  id: TypeAheadAvailableNodes;
@@ -39,4 +39,14 @@ export declare const mentionMessages: {
39
39
  description: string;
40
40
  id: string;
41
41
  };
42
+ typeAheadSectionPeople: {
43
+ defaultMessage: string;
44
+ description: string;
45
+ id: string;
46
+ };
47
+ typeAheadSectionAgents: {
48
+ defaultMessage: string;
49
+ description: string;
50
+ id: string;
51
+ };
42
52
  };
@@ -7,7 +7,7 @@ export { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './annotation/emi
7
7
  export type { AnnotationState, AnnotationUpdateEventPayloads, OnAnnotationClickPayload, } from './annotation/emitter';
8
8
  export type { AnnotationProviders, InlineCommentSelectionComponentProps, InlineCommentHoverComponentProps, InlineCommentViewComponentProps, InlineCommentAnnotationProvider, AnnotationByMatches, AnnotationActionResult, } from './annotation';
9
9
  export type { ContextUpdateHandler, EditorActionsOptions, ReplaceRawValue, GetResolvedEditorStateReason, } from './editor-actions';
10
- export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, } from './type-ahead';
10
+ export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadSection, } from './type-ahead';
11
11
  export type { CommandDispatch, Command, HigherOrderCommand, Predicate } from './command';
12
12
  export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags } from './feature-flags';
13
13
  export type { Browsers, Range, DisableSpellcheckByBrowser } from './supported-browsers';
@@ -45,6 +45,12 @@ export type TypeAheadItem = {
45
45
  testId?: string;
46
46
  title: string;
47
47
  };
48
+ export type TypeAheadSection = {
49
+ filter: (item: TypeAheadItem) => boolean;
50
+ id: string;
51
+ limit?: number;
52
+ title: string;
53
+ };
48
54
  export type TypeAheadForceSelect = (props: TypeAheadForceSelectProps) => TypeAheadItem | undefined;
49
55
  export type MoreOptionsButtonConfig = {
50
56
  ariaLabel?: string;
@@ -78,6 +84,10 @@ export type TypeAheadHandler = {
78
84
  editorState: EditorState;
79
85
  query: string;
80
86
  }) => Promise<Array<TypeAheadItem>>;
87
+ /** Optional section definitions used by type-ahead menu to group items */
88
+ getSections?: (props: {
89
+ intl: IntlShape;
90
+ }) => Array<TypeAheadSection>;
81
91
  getMoreOptionsButtonConfig?: (intl: IntlShape) => MoreOptionsButtonConfig;
82
92
  headless?: boolean;
83
93
  id: TypeAheadAvailableNodes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "114.49.0",
3
+ "version": "114.50.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"