@atlaskit/editor-common 94.0.0 → 94.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,26 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 94.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#152897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152897)
8
+ [`ecafb0e3e4fdf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ecafb0e3e4fdf) -
9
+ [ux] [ED-25418] Fix z-indexes for media badges in renderer
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 94.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#154398](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154398)
20
+ [`ca1591355d790`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ca1591355d790) -
21
+ [ux] Allows for passing functions to the quickInsert plugin that allow for capturing element
22
+ insertion metrics and then using that data to change the element sort order
23
+
3
24
  ## 94.0.0
4
25
 
5
26
  ### Major Changes
@@ -146,9 +146,6 @@
146
146
  {
147
147
  "path": "../../../design-system/tooltip/afm-jira/tsconfig.json"
148
148
  },
149
- {
150
- "path": "../../../data/ufo-external/afm-jira/tsconfig.json"
151
- },
152
149
  {
153
150
  "path": "../../../design-system/width-detector/afm-jira/tsconfig.json"
154
151
  },
@@ -146,9 +146,6 @@
146
146
  {
147
147
  "path": "../../../design-system/tooltip/afm-post-office/tsconfig.json"
148
148
  },
149
- {
150
- "path": "../../../data/ufo-external/afm-post-office/tsconfig.json"
151
- },
152
149
  {
153
150
  "path": "../../../design-system/width-detector/afm-post-office/tsconfig.json"
154
151
  },
@@ -24,6 +24,15 @@ var containerStyles = (0, _primitives.xcss)({
24
24
  width: 'fit-content',
25
25
  margin: 'space.075'
26
26
  });
27
+
28
+ // The above styles are used for both editor and renderer, and in renderer the
29
+ // document body is the main scroll area. This means it overscrolls the primary
30
+ // toolbar, where the z-index is "2". We have to hack in our own z-index less
31
+ // than that to ensure our badge appears under the toolbar when scrolled.
32
+ var hackedZIndexStyles = (0, _primitives.xcss)({
33
+ // @ts-ignore
34
+ zIndex: '1'
35
+ });
27
36
  var resizeOffsetStyles = (0, _primitives.xcss)({
28
37
  right: 'space.150'
29
38
  });
@@ -39,7 +48,9 @@ var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
39
48
  mediaElement = _ref.mediaElement,
40
49
  mediaWidth = _ref.mediaWidth,
41
50
  mediaHeight = _ref.mediaHeight,
42
- extendedResizeOffset = _ref.extendedResizeOffset;
51
+ extendedResizeOffset = _ref.extendedResizeOffset,
52
+ _ref$useMinimumZIndex = _ref.useMinimumZIndex,
53
+ useMinimumZIndex = _ref$useMinimumZIndex === void 0 ? false : _ref$useMinimumZIndex;
43
54
  var _useState = (0, _react.useState)(getBadgeSize(mediaWidth, mediaHeight)),
44
55
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
45
56
  badgeSize = _useState2[0],
@@ -73,6 +84,6 @@ var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
73
84
  testId: "media-badges",
74
85
  "data-media-badges": "true",
75
86
  contentEditable: false,
76
- xcss: [containerStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
87
+ xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
77
88
  }, children);
78
89
  };
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "94.0.0";
20
+ var packageVersion = "94.2.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.find = find;
8
8
  exports.memoProcessQuickInsertItems = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _fuse = _interopRequireDefault(require("fuse.js"));
10
11
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
14
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
12
15
  return items.reduce(function (acc, item) {
13
16
  if (typeof item === 'function' &&
@@ -35,6 +38,7 @@ var memoProcessQuickInsertItems = exports.memoProcessQuickInsertItems = function
35
38
  };
36
39
  var options = {
37
40
  threshold: 0.3,
41
+ includeScore: true,
38
42
  keys: [{
39
43
  name: 'title',
40
44
  weight: 0.57
@@ -61,8 +65,12 @@ var options = {
61
65
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
62
66
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
63
67
  */
64
- function find(query, items) {
65
- var fuse = new _fuse.default(items, options);
68
+ function find(query, items, prioritySortingFn) {
69
+ var fuseOptions = _objectSpread({}, options);
70
+ if (prioritySortingFn) {
71
+ fuseOptions.sortFn = prioritySortingFn(items);
72
+ }
73
+ var fuse = new _fuse.default(items, fuseOptions);
66
74
  if (query === '') {
67
75
  // Copy and sort list by priority
68
76
  return items.slice(0).sort(function (a, b) {
@@ -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 = "94.0.0";
27
+ var packageVersion = "94.2.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -13,6 +13,15 @@ const containerStyles = xcss({
13
13
  width: 'fit-content',
14
14
  margin: 'space.075'
15
15
  });
16
+
17
+ // The above styles are used for both editor and renderer, and in renderer the
18
+ // document body is the main scroll area. This means it overscrolls the primary
19
+ // toolbar, where the z-index is "2". We have to hack in our own z-index less
20
+ // than that to ensure our badge appears under the toolbar when scrolled.
21
+ const hackedZIndexStyles = xcss({
22
+ // @ts-ignore
23
+ zIndex: '1'
24
+ });
16
25
  const resizeOffsetStyles = xcss({
17
26
  right: 'space.150'
18
27
  });
@@ -28,7 +37,8 @@ export const MediaBadges = ({
28
37
  mediaElement,
29
38
  mediaWidth,
30
39
  mediaHeight,
31
- extendedResizeOffset
40
+ extendedResizeOffset,
41
+ useMinimumZIndex = false
32
42
  }) => {
33
43
  const [badgeSize, setBadgeSize] = useState(getBadgeSize(mediaWidth, mediaHeight));
34
44
  useEffect(() => {
@@ -60,6 +70,6 @@ export const MediaBadges = ({
60
70
  testId: "media-badges",
61
71
  "data-media-badges": "true",
62
72
  contentEditable: false,
63
- xcss: [containerStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
73
+ xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
64
74
  }, children);
65
75
  };
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "94.0.0";
4
+ const packageVersion = "94.2.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -23,6 +23,7 @@ export const memoProcessQuickInsertItems = (items, intl) => {
23
23
  };
24
24
  const options = {
25
25
  threshold: 0.3,
26
+ includeScore: true,
26
27
  keys: [{
27
28
  name: 'title',
28
29
  weight: 0.57
@@ -49,8 +50,14 @@ const options = {
49
50
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
50
51
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
51
52
  */
52
- export function find(query, items) {
53
- const fuse = new Fuse(items, options);
53
+ export function find(query, items, prioritySortingFn) {
54
+ const fuseOptions = {
55
+ ...options
56
+ };
57
+ if (prioritySortingFn) {
58
+ fuseOptions.sortFn = prioritySortingFn(items);
59
+ }
60
+ const fuse = new Fuse(items, fuseOptions);
54
61
  if (query === '') {
55
62
  // Copy and sort list by priority
56
63
  return items.slice(0).sort((a, b) => (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY));
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "94.0.0";
16
+ const packageVersion = "94.2.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -14,6 +14,15 @@ var containerStyles = xcss({
14
14
  width: 'fit-content',
15
15
  margin: 'space.075'
16
16
  });
17
+
18
+ // The above styles are used for both editor and renderer, and in renderer the
19
+ // document body is the main scroll area. This means it overscrolls the primary
20
+ // toolbar, where the z-index is "2". We have to hack in our own z-index less
21
+ // than that to ensure our badge appears under the toolbar when scrolled.
22
+ var hackedZIndexStyles = xcss({
23
+ // @ts-ignore
24
+ zIndex: '1'
25
+ });
17
26
  var resizeOffsetStyles = xcss({
18
27
  right: 'space.150'
19
28
  });
@@ -29,7 +38,9 @@ export var MediaBadges = function MediaBadges(_ref) {
29
38
  mediaElement = _ref.mediaElement,
30
39
  mediaWidth = _ref.mediaWidth,
31
40
  mediaHeight = _ref.mediaHeight,
32
- extendedResizeOffset = _ref.extendedResizeOffset;
41
+ extendedResizeOffset = _ref.extendedResizeOffset,
42
+ _ref$useMinimumZIndex = _ref.useMinimumZIndex,
43
+ useMinimumZIndex = _ref$useMinimumZIndex === void 0 ? false : _ref$useMinimumZIndex;
33
44
  var _useState = useState(getBadgeSize(mediaWidth, mediaHeight)),
34
45
  _useState2 = _slicedToArray(_useState, 2),
35
46
  badgeSize = _useState2[0],
@@ -63,6 +74,6 @@ export var MediaBadges = function MediaBadges(_ref) {
63
74
  testId: "media-badges",
64
75
  "data-media-badges": "true",
65
76
  contentEditable: false,
66
- xcss: [containerStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
77
+ xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles, badgeSize === 'small' && smallBadgeStyles]
67
78
  }, children);
68
79
  };
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.0.0";
10
+ var packageVersion = "94.2.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import Fuse from 'fuse.js';
2
5
  import memoizeOne from 'memoize-one';
3
6
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
@@ -27,6 +30,7 @@ export var memoProcessQuickInsertItems = function memoProcessQuickInsertItems(it
27
30
  };
28
31
  var options = {
29
32
  threshold: 0.3,
33
+ includeScore: true,
30
34
  keys: [{
31
35
  name: 'title',
32
36
  weight: 0.57
@@ -53,8 +57,12 @@ var options = {
53
57
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
54
58
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
55
59
  */
56
- export function find(query, items) {
57
- var fuse = new Fuse(items, options);
60
+ export function find(query, items, prioritySortingFn) {
61
+ var fuseOptions = _objectSpread({}, options);
62
+ if (prioritySortingFn) {
63
+ fuseOptions.sortFn = prioritySortingFn(items);
64
+ }
65
+ var fuse = new Fuse(items, fuseOptions);
58
66
  if (query === '') {
59
67
  // Copy and sort list by priority
60
68
  return items.slice(0).sort(function (a, b) {
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.0.0";
24
+ var packageVersion = "94.2.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -4,9 +4,10 @@ type ExternalImageBadgeProps = {
4
4
  mediaHeight?: number;
5
5
  mediaWidth?: number;
6
6
  extendedResizeOffset?: boolean;
7
+ useMinimumZIndex?: boolean;
7
8
  children: ReactNode | ((props: {
8
9
  badgeSize: 'medium' | 'small';
9
10
  }) => ReactNode);
10
11
  };
11
- export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, }: ExternalImageBadgeProps) => JSX.Element | null;
12
+ export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, useMinimumZIndex, }: ExternalImageBadgeProps) => JSX.Element | null;
12
13
  export {};
@@ -1,3 +1,4 @@
1
+ import Fuse from 'fuse.js';
1
2
  import type { IntlShape } from 'react-intl-next';
2
3
  import type { QuickInsertItem } from '../provider-factory';
3
4
  import type { QuickInsertHandler } from '../types';
@@ -10,4 +11,4 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
10
11
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
11
12
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
12
13
  */
13
- export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
14
+ export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction): QuickInsertItem[];
@@ -1,8 +1,11 @@
1
+ import type Fuse from 'fuse.js';
1
2
  import type { IntlShape } from 'react-intl-next';
2
3
  import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
3
4
  import type { EmptyStateHandler } from './empty-state-handler';
4
5
  export type QuickInsertOptions = boolean | {
5
- provider: Promise<QuickInsertProvider>;
6
+ provider?: Promise<QuickInsertProvider>;
7
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
8
+ onInsert?: (item: QuickInsertItem) => void;
6
9
  };
7
10
  export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
8
11
  disableMemo?: boolean;
@@ -16,6 +19,7 @@ export type QuickInsertSearchOptions = {
16
19
  category?: string;
17
20
  disableDefaultItems?: boolean;
18
21
  featuredItems?: boolean;
22
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
19
23
  };
20
24
  export type QuickInsertPluginState = {
21
25
  isElementBrowserModalOpen: boolean;
@@ -32,6 +36,8 @@ export interface QuickInsertPluginOptions {
32
36
  enableElementBrowser?: boolean;
33
37
  elementBrowserHelpUrl?: string;
34
38
  emptyStateHandler?: EmptyStateHandler;
39
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
40
+ onInsert?: (item: QuickInsertItem) => void;
35
41
  }
36
42
  export type QuickInsertSharedState = {
37
43
  lazyDefaultItems: () => QuickInsertItem[];
@@ -4,9 +4,10 @@ type ExternalImageBadgeProps = {
4
4
  mediaHeight?: number;
5
5
  mediaWidth?: number;
6
6
  extendedResizeOffset?: boolean;
7
+ useMinimumZIndex?: boolean;
7
8
  children: ReactNode | ((props: {
8
9
  badgeSize: 'medium' | 'small';
9
10
  }) => ReactNode);
10
11
  };
11
- export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, }: ExternalImageBadgeProps) => JSX.Element | null;
12
+ export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, useMinimumZIndex, }: ExternalImageBadgeProps) => JSX.Element | null;
12
13
  export {};
@@ -1,3 +1,4 @@
1
+ import Fuse from 'fuse.js';
1
2
  import type { IntlShape } from 'react-intl-next';
2
3
  import type { QuickInsertItem } from '../provider-factory';
3
4
  import type { QuickInsertHandler } from '../types';
@@ -10,4 +11,4 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
10
11
  * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
11
12
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
12
13
  */
13
- export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
14
+ export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction): QuickInsertItem[];
@@ -1,8 +1,11 @@
1
+ import type Fuse from 'fuse.js';
1
2
  import type { IntlShape } from 'react-intl-next';
2
3
  import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
3
4
  import type { EmptyStateHandler } from './empty-state-handler';
4
5
  export type QuickInsertOptions = boolean | {
5
- provider: Promise<QuickInsertProvider>;
6
+ provider?: Promise<QuickInsertProvider>;
7
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
8
+ onInsert?: (item: QuickInsertItem) => void;
6
9
  };
7
10
  export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
8
11
  disableMemo?: boolean;
@@ -16,6 +19,7 @@ export type QuickInsertSearchOptions = {
16
19
  category?: string;
17
20
  disableDefaultItems?: boolean;
18
21
  featuredItems?: boolean;
22
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
19
23
  };
20
24
  export type QuickInsertPluginState = {
21
25
  isElementBrowserModalOpen: boolean;
@@ -32,6 +36,8 @@ export interface QuickInsertPluginOptions {
32
36
  enableElementBrowser?: boolean;
33
37
  elementBrowserHelpUrl?: string;
34
38
  emptyStateHandler?: EmptyStateHandler;
39
+ prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
40
+ onInsert?: (item: QuickInsertItem) => void;
35
41
  }
36
42
  export type QuickInsertSharedState = {
37
43
  lazyDefaultItems: () => QuickInsertItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "94.0.0",
3
+ "version": "94.2.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/"
@@ -115,11 +115,11 @@
115
115
  "@atlaskit/analytics-namespaced-context": "^6.12.0",
116
116
  "@atlaskit/analytics-next": "^10.1.0",
117
117
  "@atlaskit/atlassian-context": "^0.0.2",
118
- "@atlaskit/button": "^20.2.0",
118
+ "@atlaskit/button": "^20.3.0",
119
119
  "@atlaskit/code": "^15.6.0",
120
120
  "@atlaskit/codemod-utils": "^4.2.0",
121
121
  "@atlaskit/custom-steps": "^0.8.0",
122
- "@atlaskit/dropdown-menu": "^12.20.0",
122
+ "@atlaskit/dropdown-menu": "^12.21.0",
123
123
  "@atlaskit/editor-json-transformer": "^8.20.0",
124
124
  "@atlaskit/editor-palette": "1.6.1",
125
125
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -137,20 +137,20 @@
137
137
  "@atlaskit/media-file-preview": "^0.9.0",
138
138
  "@atlaskit/media-picker": "^66.7.0",
139
139
  "@atlaskit/media-ui": "^25.16.0",
140
- "@atlaskit/media-viewer": "49.2.1",
140
+ "@atlaskit/media-viewer": "49.2.2",
141
141
  "@atlaskit/mention": "^23.3.0",
142
142
  "@atlaskit/menu": "^2.13.0",
143
143
  "@atlaskit/onboarding": "^11.2.0",
144
144
  "@atlaskit/platform-feature-flags": "^0.3.0",
145
145
  "@atlaskit/primitives": "^12.2.0",
146
- "@atlaskit/profilecard": "^20.6.0",
146
+ "@atlaskit/profilecard": "^20.7.0",
147
147
  "@atlaskit/section-message": "^6.6.0",
148
148
  "@atlaskit/smart-card": "^30.1.0",
149
149
  "@atlaskit/smart-user-picker": "^6.11.0",
150
150
  "@atlaskit/spinner": "^16.3.0",
151
151
  "@atlaskit/task-decision": "^17.11.0",
152
152
  "@atlaskit/textfield": "^6.5.0",
153
- "@atlaskit/tmp-editor-statsig": "^2.7.0",
153
+ "@atlaskit/tmp-editor-statsig": "^2.8.0",
154
154
  "@atlaskit/tokens": "^2.0.0",
155
155
  "@atlaskit/tooltip": "^18.8.0",
156
156
  "@atlaskit/width-detector": "^4.3.0",