@atlaskit/editor-common 74.51.6 → 74.52.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/insert/index.js +1 -1
  3. package/dist/cjs/lists/analytics.js +10 -10
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/preset/editor-commands.js +36 -4
  6. package/dist/cjs/preset/index.js +6 -0
  7. package/dist/cjs/quick-insert/assets/images.js +28 -54
  8. package/dist/cjs/quick-insert/assets/mention.js +27 -9
  9. package/dist/cjs/quick-insert/index.js +20 -1
  10. package/dist/cjs/quick-insert/utils.js +79 -0
  11. package/dist/cjs/ui/DropList/index.js +1 -1
  12. package/dist/cjs/utils/dedupe.js +37 -0
  13. package/dist/cjs/utils/index.js +7 -0
  14. package/dist/es2019/insert/index.js +1 -1
  15. package/dist/es2019/lists/analytics.js +6 -6
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/preset/editor-commands.js +21 -3
  18. package/dist/es2019/preset/index.js +1 -1
  19. package/dist/es2019/quick-insert/assets/images.js +29 -53
  20. package/dist/es2019/quick-insert/assets/mention.js +28 -8
  21. package/dist/es2019/quick-insert/index.js +2 -1
  22. package/dist/es2019/quick-insert/utils.js +58 -0
  23. package/dist/es2019/ui/DropList/index.js +1 -1
  24. package/dist/es2019/utils/dedupe.js +25 -0
  25. package/dist/es2019/utils/index.js +2 -1
  26. package/dist/esm/insert/index.js +1 -1
  27. package/dist/esm/lists/analytics.js +10 -10
  28. package/dist/esm/monitoring/error.js +1 -1
  29. package/dist/esm/preset/editor-commands.js +33 -4
  30. package/dist/esm/preset/index.js +1 -1
  31. package/dist/esm/quick-insert/assets/images.js +28 -53
  32. package/dist/esm/quick-insert/assets/mention.js +27 -8
  33. package/dist/esm/quick-insert/index.js +2 -1
  34. package/dist/esm/quick-insert/utils.js +69 -0
  35. package/dist/esm/ui/DropList/index.js +1 -1
  36. package/dist/esm/utils/dedupe.js +31 -0
  37. package/dist/esm/utils/index.js +2 -1
  38. package/dist/types/insert/index.d.ts +4 -3
  39. package/dist/types/link/LinkSearch/index.d.ts +4 -4
  40. package/dist/types/link/LinkSearch/withActivityProvider.d.ts +4 -4
  41. package/dist/types/lists/analytics.d.ts +4 -4
  42. package/dist/types/preset/editor-commands.d.ts +8 -0
  43. package/dist/types/preset/index.d.ts +1 -1
  44. package/dist/types/quick-insert/index.d.ts +1 -0
  45. package/dist/types/quick-insert/utils.d.ts +12 -0
  46. package/dist/types/types/editor-command.d.ts +1 -1
  47. package/dist/types/types/index.d.ts +1 -1
  48. package/dist/types/types/quick-insert.d.ts +13 -0
  49. package/dist/types/ui/OverflowShadow/index.d.ts +4 -4
  50. package/dist/types/utils/dedupe.d.ts +1 -0
  51. package/dist/types/utils/index.d.ts +1 -0
  52. package/dist/types-ts4.5/insert/index.d.ts +4 -3
  53. package/dist/types-ts4.5/link/LinkSearch/index.d.ts +4 -4
  54. package/dist/types-ts4.5/link/LinkSearch/withActivityProvider.d.ts +4 -4
  55. package/dist/types-ts4.5/lists/analytics.d.ts +4 -4
  56. package/dist/types-ts4.5/preset/editor-commands.d.ts +8 -0
  57. package/dist/types-ts4.5/preset/index.d.ts +1 -1
  58. package/dist/types-ts4.5/quick-insert/index.d.ts +1 -0
  59. package/dist/types-ts4.5/quick-insert/utils.d.ts +12 -0
  60. package/dist/types-ts4.5/types/editor-command.d.ts +1 -1
  61. package/dist/types-ts4.5/types/index.d.ts +1 -1
  62. package/dist/types-ts4.5/types/quick-insert.d.ts +13 -0
  63. package/dist/types-ts4.5/ui/OverflowShadow/index.d.ts +4 -4
  64. package/dist/types-ts4.5/utils/dedupe.d.ts +1 -0
  65. package/dist/types-ts4.5/utils/index.d.ts +1 -0
  66. package/package.json +3 -3
@@ -0,0 +1,31 @@
1
+ export function dedupe() {
2
+ var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3
+ var iteratee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (p) {
4
+ return p;
5
+ };
6
+ /**
7
+ .,
8
+ . _,'f----.._
9
+ |\ ,-'"/ | ,'
10
+ |,_ ,--. /
11
+ /,-. ,'`. (_
12
+ f o| o|__ "`-.
13
+ ,-._.,--'_ `. _.,-`
14
+ `"' ___.,'` j,-'
15
+ `-.__.,--'
16
+ Gotta go fast!
17
+ */
18
+
19
+ var seen = new Set();
20
+ list.forEach(function (l) {
21
+ return seen.add(iteratee(l));
22
+ });
23
+ return list.filter(function (l) {
24
+ var it = iteratee(l);
25
+ if (seen.has(it)) {
26
+ seen.delete(it);
27
+ return true;
28
+ }
29
+ return false;
30
+ });
31
+ }
@@ -198,4 +198,5 @@ export function isNodeEmpty(node) {
198
198
  return !nonBlock.length && !block.filter(function (childNode) {
199
199
  return !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom;
200
200
  }).length;
201
- }
201
+ }
202
+ export { dedupe } from './dedupe';
@@ -1,5 +1,6 @@
1
- import { Fragment, Node, NodeType } from '@atlaskit/editor-prosemirror/model';
2
- import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
4
  export type InsertableContent = Node | Fragment;
4
5
  export declare enum LookDirection {
5
6
  Before = "before",
@@ -8,7 +9,7 @@ export declare enum LookDirection {
8
9
  export declare const normaliseNestedLayout: ({ selection, doc }: EditorState | Transaction, node: Node) => Node;
9
10
  export declare const safeInsert: (content: InsertableContent, position?: number) => (tr: Transaction) => Transaction | null;
10
11
  /**
11
- * Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
12
+ * Method extracted from typeahead plugin to be shared with the element browser on handling element insertion.
12
13
  */
13
14
  export declare const insertSelectedItem: (maybeNode?: Node | Object | string | Fragment, opts?: {
14
15
  selectInlineNode?: boolean;
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { RecentSearchProps } from './types';
3
3
  import { WithActivityProviderProps } from './withActivityProvider';
4
4
  declare const _default: {
5
- new (props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>): {
5
+ new (props: (import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps) | Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>): {
6
6
  renderNode: (providers: import("../../provider-factory").Providers) => JSX.Element;
7
7
  render(): JSX.Element;
8
8
  context: any;
9
9
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
10
- forceUpdate(callBack?: (() => void) | undefined): void;
10
+ forceUpdate(callback?: (() => void) | undefined): void;
11
11
  readonly props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps> & Readonly<{
12
12
  children?: React.ReactNode;
13
13
  }>;
@@ -28,12 +28,12 @@ declare const _default: {
28
28
  componentWillUpdate?(nextProps: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
29
29
  UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
30
30
  };
31
- new (props: import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps, context?: any): {
31
+ new (props: import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps, context: any): {
32
32
  renderNode: (providers: import("../../provider-factory").Providers) => JSX.Element;
33
33
  render(): JSX.Element;
34
34
  context: any;
35
35
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
36
- forceUpdate(callBack?: (() => void) | undefined): void;
36
+ forceUpdate(callback?: (() => void) | undefined): void;
37
37
  readonly props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps> & Readonly<{
38
38
  children?: React.ReactNode;
39
39
  }>;
@@ -10,12 +10,12 @@ export interface WithActivityProviderProps {
10
10
  activityProvider: ActivityProvider;
11
11
  }
12
12
  export default function withActivityProvider<Props>(WrappedComponent: React.ComponentType<Props & WithActivityProviderProps>): {
13
- new (props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>): {
13
+ new (props: (Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps) | Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>): {
14
14
  renderNode: (providers: Providers) => JSX.Element;
15
15
  render(): JSX.Element;
16
16
  context: any;
17
17
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
18
- forceUpdate(callBack?: (() => void) | undefined): void;
18
+ forceUpdate(callback?: (() => void) | undefined): void;
19
19
  readonly props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps> & Readonly<{
20
20
  children?: React.ReactNode;
21
21
  }>;
@@ -36,12 +36,12 @@ export default function withActivityProvider<Props>(WrappedComponent: React.Comp
36
36
  componentWillUpdate?(nextProps: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
37
37
  UNSAFE_componentWillUpdate?(nextProps: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
38
38
  };
39
- new (props: Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps, context?: any): {
39
+ new (props: Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps, context: any): {
40
40
  renderNode: (providers: Providers) => JSX.Element;
41
41
  render(): JSX.Element;
42
42
  context: any;
43
43
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
44
- forceUpdate(callBack?: (() => void) | undefined): void;
44
+ forceUpdate(callback?: (() => void) | undefined): void;
45
45
  readonly props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps> & Readonly<{
46
46
  children?: React.ReactNode;
47
47
  }>;
@@ -1,4 +1,4 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import { CommonListAnalyticsAttributes } from '../analytics';
3
- export declare const getCommonListAnalyticsAttributes: (state: EditorState) => CommonListAnalyticsAttributes;
4
- export declare const countListItemsInSelection: (state: EditorState) => number;
1
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { CommonListAnalyticsAttributes } from '../analytics';
3
+ export declare const getCommonListAnalyticsAttributes: (tr: Transaction) => CommonListAnalyticsAttributes;
4
+ export declare const countListItemsInSelection: (tr: Transaction) => number;
@@ -1,3 +1,4 @@
1
+ import { Transaction } from '@atlaskit/editor-prosemirror/state';
1
2
  import type { Command } from '../types/command';
2
3
  import type { EditorCommand } from '../types/editor-command';
3
4
  /**
@@ -11,3 +12,10 @@ import type { EditorCommand } from '../types/editor-command';
11
12
  * @returns Command
12
13
  */
13
14
  export declare function editorCommandToPMCommand(command: EditorCommand | undefined): Command;
15
+ /**
16
+ * PassiveTransaction is used only to indicate that
17
+ * an `EditorCommand` should return `true` but should not dispatch.
18
+ */
19
+ export declare class PassiveTransaction extends Transaction {
20
+ constructor();
21
+ }
@@ -1,3 +1,3 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
2
  export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
- export { editorCommandToPMCommand } from './editor-commands';
3
+ export { editorCommandToPMCommand, PassiveTransaction, } from './editor-commands';
@@ -1 +1,2 @@
1
1
  export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects, } from './assets';
2
+ export { memoProcessQuickInsertItems, getQuickInsertSuggestions, find, } from './utils';
@@ -0,0 +1,12 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { QuickInsertItem } from '../provider-factory';
3
+ import type { QuickInsertHandler, QuickInsertSearchOptions } from '../types';
4
+ declare const processQuickInsertItems: (items: Array<QuickInsertHandler | QuickInsertItem>, intl: IntlShape) => QuickInsertItem[];
5
+ export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems;
6
+ export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
7
+ export declare const getQuickInsertSuggestions: ({ searchOptions, lazyDefaultItems, providedItems, }: {
8
+ searchOptions: QuickInsertSearchOptions;
9
+ lazyDefaultItems?: (() => QuickInsertItem[]) | undefined;
10
+ providedItems?: QuickInsertItem[] | undefined;
11
+ }) => QuickInsertItem[];
12
+ export {};
@@ -2,4 +2,4 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
2
  export type EditorCommand = (props: {
3
3
  tr: Transaction;
4
4
  }) => Transaction | null;
5
- export type EditorCommandWithMetadata = (args: any) => EditorCommand;
5
+ export type EditorCommandWithMetadata = (...args: any) => EditorCommand;
@@ -47,4 +47,4 @@ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './inpu
47
47
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
48
48
  export type { LayoutPluginOptions } from './layout';
49
49
  export type { LongPressSelectionPluginOptions } from './selection';
50
- export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, } from './quick-insert';
50
+ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, } from './quick-insert';
@@ -8,12 +8,20 @@ export type QuickInsertHandler = Array<QuickInsertItem> | ((intl: IntlShape) =>
8
8
  export type IconProps = {
9
9
  label?: string;
10
10
  };
11
+ export type QuickInsertSearchOptions = {
12
+ query?: string;
13
+ category?: string;
14
+ disableDefaultItems?: boolean;
15
+ featuredItems?: boolean;
16
+ };
11
17
  export type QuickInsertPluginState = {
12
18
  isElementBrowserModalOpen: boolean;
13
19
  lazyDefaultItems: () => QuickInsertItem[];
14
20
  providedItems?: QuickInsertItem[];
15
21
  provider?: QuickInsertProvider;
16
22
  emptyStateHandler?: EmptyStateHandler;
23
+ suggestions?: QuickInsertItem[];
24
+ searchOptions?: QuickInsertSearchOptions;
17
25
  };
18
26
  export type QuickInsertPluginStateKeys = keyof QuickInsertPluginState;
19
27
  export interface QuickInsertPluginOptions {
@@ -23,3 +31,8 @@ export interface QuickInsertPluginOptions {
23
31
  elementBrowserHelpUrl?: string;
24
32
  emptyStateHandler?: EmptyStateHandler;
25
33
  }
34
+ export type QuickInsertSharedState = {
35
+ suggestions: QuickInsertItem[];
36
+ lazyDefaultItems: () => QuickInsertItem[];
37
+ emptyStateHandler?: EmptyStateHandler;
38
+ };
@@ -17,7 +17,7 @@ export interface OverflowShadowOptions {
17
17
  useShadowObserver?: boolean;
18
18
  }
19
19
  export default function overflowShadow<P>(Component: React.ComponentType<P & OverflowShadowProps> | React.StatelessComponent<P & OverflowShadowProps>, options: OverflowShadowOptions): {
20
- new (props: Readonly<P>): {
20
+ new (props: P | Readonly<P>): {
21
21
  overflowContainer?: HTMLElement | null | undefined;
22
22
  container?: HTMLElement | undefined;
23
23
  shadowObserver?: ShadowObserver | undefined;
@@ -40,7 +40,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
40
40
  render(): JSX.Element;
41
41
  context: any;
42
42
  setState<K extends keyof OverflowShadowState>(state: OverflowShadowState | ((prevState: Readonly<OverflowShadowState>, props: Readonly<P>) => OverflowShadowState | Pick<OverflowShadowState, K> | null) | Pick<OverflowShadowState, K> | null, callback?: (() => void) | undefined): void;
43
- forceUpdate(callBack?: (() => void) | undefined): void;
43
+ forceUpdate(callback?: (() => void) | undefined): void;
44
44
  readonly props: Readonly<P> & Readonly<{
45
45
  children?: React.ReactNode;
46
46
  }>;
@@ -58,7 +58,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
58
58
  componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<OverflowShadowState>, nextContext: any): void;
59
59
  UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<OverflowShadowState>, nextContext: any): void;
60
60
  };
61
- new (props: P, context?: any): {
61
+ new (props: P, context: any): {
62
62
  overflowContainer?: HTMLElement | null | undefined;
63
63
  container?: HTMLElement | undefined;
64
64
  shadowObserver?: ShadowObserver | undefined;
@@ -81,7 +81,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
81
81
  render(): JSX.Element;
82
82
  context: any;
83
83
  setState<K extends keyof OverflowShadowState>(state: OverflowShadowState | ((prevState: Readonly<OverflowShadowState>, props: Readonly<P>) => OverflowShadowState | Pick<OverflowShadowState, K> | null) | Pick<OverflowShadowState, K> | null, callback?: (() => void) | undefined): void;
84
- forceUpdate(callBack?: (() => void) | undefined): void;
84
+ forceUpdate(callback?: (() => void) | undefined): void;
85
85
  readonly props: Readonly<P> & Readonly<{
86
86
  children?: React.ReactNode;
87
87
  }>;
@@ -0,0 +1 @@
1
+ export declare function dedupe<T>(list?: T[], iteratee?: (p: T) => T[keyof T] | T): T[];
@@ -79,3 +79,4 @@ export declare const isEmptyNode: (schema: Schema) => (node: PMNode) => boolean;
79
79
  * Checks if a node has any content. Ignores node that only contain empty block nodes.
80
80
  */
81
81
  export declare function isNodeEmpty(node?: PMNode): boolean;
82
+ export { dedupe } from './dedupe';
@@ -1,5 +1,6 @@
1
- import { Fragment, Node, NodeType } from '@atlaskit/editor-prosemirror/model';
2
- import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
1
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
4
  export type InsertableContent = Node | Fragment;
4
5
  export declare enum LookDirection {
5
6
  Before = "before",
@@ -8,7 +9,7 @@ export declare enum LookDirection {
8
9
  export declare const normaliseNestedLayout: ({ selection, doc }: EditorState | Transaction, node: Node) => Node;
9
10
  export declare const safeInsert: (content: InsertableContent, position?: number) => (tr: Transaction) => Transaction | null;
10
11
  /**
11
- * Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
12
+ * Method extracted from typeahead plugin to be shared with the element browser on handling element insertion.
12
13
  */
13
14
  export declare const insertSelectedItem: (maybeNode?: Node | Object | string | Fragment, opts?: {
14
15
  selectInlineNode?: boolean;
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { RecentSearchProps } from './types';
3
3
  import { WithActivityProviderProps } from './withActivityProvider';
4
4
  declare const _default: {
5
- new (props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>): {
5
+ new (props: (import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps) | Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>): {
6
6
  renderNode: (providers: import("../../provider-factory").Providers) => JSX.Element;
7
7
  render(): JSX.Element;
8
8
  context: any;
9
9
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
10
- forceUpdate(callBack?: (() => void) | undefined): void;
10
+ forceUpdate(callback?: (() => void) | undefined): void;
11
11
  readonly props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps> & Readonly<{
12
12
  children?: React.ReactNode;
13
13
  }>;
@@ -28,12 +28,12 @@ declare const _default: {
28
28
  componentWillUpdate?(nextProps: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
29
29
  UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
30
30
  };
31
- new (props: import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps, context?: any): {
31
+ new (props: import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps, context: any): {
32
32
  renderNode: (providers: import("../../provider-factory").Providers) => JSX.Element;
33
33
  render(): JSX.Element;
34
34
  context: any;
35
35
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
36
- forceUpdate(callBack?: (() => void) | undefined): void;
36
+ forceUpdate(callback?: (() => void) | undefined): void;
37
37
  readonly props: Readonly<import("../../utils").Diff<RecentSearchProps & WithActivityProviderProps, WithActivityProviderProps> & import("./withActivityProvider").ExpandedActivityProviderProps> & Readonly<{
38
38
  children?: React.ReactNode;
39
39
  }>;
@@ -10,12 +10,12 @@ export interface WithActivityProviderProps {
10
10
  activityProvider: ActivityProvider;
11
11
  }
12
12
  export default function withActivityProvider<Props>(WrappedComponent: React.ComponentType<Props & WithActivityProviderProps>): {
13
- new (props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>): {
13
+ new (props: (Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps) | Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>): {
14
14
  renderNode: (providers: Providers) => JSX.Element;
15
15
  render(): JSX.Element;
16
16
  context: any;
17
17
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
18
- forceUpdate(callBack?: (() => void) | undefined): void;
18
+ forceUpdate(callback?: (() => void) | undefined): void;
19
19
  readonly props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps> & Readonly<{
20
20
  children?: React.ReactNode;
21
21
  }>;
@@ -36,12 +36,12 @@ export default function withActivityProvider<Props>(WrappedComponent: React.Comp
36
36
  componentWillUpdate?(nextProps: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
37
37
  UNSAFE_componentWillUpdate?(nextProps: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>, nextState: Readonly<{}>, nextContext: any): void;
38
38
  };
39
- new (props: Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps, context?: any): {
39
+ new (props: Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps, context: any): {
40
40
  renderNode: (providers: Providers) => JSX.Element;
41
41
  render(): JSX.Element;
42
42
  context: any;
43
43
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
44
- forceUpdate(callBack?: (() => void) | undefined): void;
44
+ forceUpdate(callback?: (() => void) | undefined): void;
45
45
  readonly props: Readonly<Diff<Props, WithActivityProviderProps> & ExpandedActivityProviderProps> & Readonly<{
46
46
  children?: React.ReactNode;
47
47
  }>;
@@ -1,4 +1,4 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import { CommonListAnalyticsAttributes } from '../analytics';
3
- export declare const getCommonListAnalyticsAttributes: (state: EditorState) => CommonListAnalyticsAttributes;
4
- export declare const countListItemsInSelection: (state: EditorState) => number;
1
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { CommonListAnalyticsAttributes } from '../analytics';
3
+ export declare const getCommonListAnalyticsAttributes: (tr: Transaction) => CommonListAnalyticsAttributes;
4
+ export declare const countListItemsInSelection: (tr: Transaction) => number;
@@ -1,3 +1,4 @@
1
+ import { Transaction } from '@atlaskit/editor-prosemirror/state';
1
2
  import type { Command } from '../types/command';
2
3
  import type { EditorCommand } from '../types/editor-command';
3
4
  /**
@@ -11,3 +12,10 @@ import type { EditorCommand } from '../types/editor-command';
11
12
  * @returns Command
12
13
  */
13
14
  export declare function editorCommandToPMCommand(command: EditorCommand | undefined): Command;
15
+ /**
16
+ * PassiveTransaction is used only to indicate that
17
+ * an `EditorCommand` should return `true` but should not dispatch.
18
+ */
19
+ export declare class PassiveTransaction extends Transaction {
20
+ constructor();
21
+ }
@@ -1,3 +1,3 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
2
  export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
- export { editorCommandToPMCommand } from './editor-commands';
3
+ export { editorCommandToPMCommand, PassiveTransaction, } from './editor-commands';
@@ -1 +1,2 @@
1
1
  export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects, } from './assets';
2
+ export { memoProcessQuickInsertItems, getQuickInsertSuggestions, find, } from './utils';
@@ -0,0 +1,12 @@
1
+ import type { IntlShape } from 'react-intl-next';
2
+ import type { QuickInsertItem } from '../provider-factory';
3
+ import type { QuickInsertHandler, QuickInsertSearchOptions } from '../types';
4
+ declare const processQuickInsertItems: (items: Array<QuickInsertHandler | QuickInsertItem>, intl: IntlShape) => QuickInsertItem[];
5
+ export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems;
6
+ export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
7
+ export declare const getQuickInsertSuggestions: ({ searchOptions, lazyDefaultItems, providedItems, }: {
8
+ searchOptions: QuickInsertSearchOptions;
9
+ lazyDefaultItems?: (() => QuickInsertItem[]) | undefined;
10
+ providedItems?: QuickInsertItem[] | undefined;
11
+ }) => QuickInsertItem[];
12
+ export {};
@@ -2,4 +2,4 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
2
  export type EditorCommand = (props: {
3
3
  tr: Transaction;
4
4
  }) => Transaction | null;
5
- export type EditorCommandWithMetadata = (args: any) => EditorCommand;
5
+ export type EditorCommandWithMetadata = (...args: any) => EditorCommand;
@@ -47,4 +47,4 @@ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './inpu
47
47
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
48
48
  export type { LayoutPluginOptions } from './layout';
49
49
  export type { LongPressSelectionPluginOptions } from './selection';
50
- export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, } from './quick-insert';
50
+ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, } from './quick-insert';
@@ -8,12 +8,20 @@ export type QuickInsertHandler = Array<QuickInsertItem> | ((intl: IntlShape) =>
8
8
  export type IconProps = {
9
9
  label?: string;
10
10
  };
11
+ export type QuickInsertSearchOptions = {
12
+ query?: string;
13
+ category?: string;
14
+ disableDefaultItems?: boolean;
15
+ featuredItems?: boolean;
16
+ };
11
17
  export type QuickInsertPluginState = {
12
18
  isElementBrowserModalOpen: boolean;
13
19
  lazyDefaultItems: () => QuickInsertItem[];
14
20
  providedItems?: QuickInsertItem[];
15
21
  provider?: QuickInsertProvider;
16
22
  emptyStateHandler?: EmptyStateHandler;
23
+ suggestions?: QuickInsertItem[];
24
+ searchOptions?: QuickInsertSearchOptions;
17
25
  };
18
26
  export type QuickInsertPluginStateKeys = keyof QuickInsertPluginState;
19
27
  export interface QuickInsertPluginOptions {
@@ -23,3 +31,8 @@ export interface QuickInsertPluginOptions {
23
31
  elementBrowserHelpUrl?: string;
24
32
  emptyStateHandler?: EmptyStateHandler;
25
33
  }
34
+ export type QuickInsertSharedState = {
35
+ suggestions: QuickInsertItem[];
36
+ lazyDefaultItems: () => QuickInsertItem[];
37
+ emptyStateHandler?: EmptyStateHandler;
38
+ };
@@ -17,7 +17,7 @@ export interface OverflowShadowOptions {
17
17
  useShadowObserver?: boolean;
18
18
  }
19
19
  export default function overflowShadow<P>(Component: React.ComponentType<P & OverflowShadowProps> | React.StatelessComponent<P & OverflowShadowProps>, options: OverflowShadowOptions): {
20
- new (props: Readonly<P>): {
20
+ new (props: P | Readonly<P>): {
21
21
  overflowContainer?: HTMLElement | null | undefined;
22
22
  container?: HTMLElement | undefined;
23
23
  shadowObserver?: ShadowObserver | undefined;
@@ -40,7 +40,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
40
40
  render(): JSX.Element;
41
41
  context: any;
42
42
  setState<K extends keyof OverflowShadowState>(state: OverflowShadowState | ((prevState: Readonly<OverflowShadowState>, props: Readonly<P>) => OverflowShadowState | Pick<OverflowShadowState, K> | null) | Pick<OverflowShadowState, K> | null, callback?: (() => void) | undefined): void;
43
- forceUpdate(callBack?: (() => void) | undefined): void;
43
+ forceUpdate(callback?: (() => void) | undefined): void;
44
44
  readonly props: Readonly<P> & Readonly<{
45
45
  children?: React.ReactNode;
46
46
  }>;
@@ -58,7 +58,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
58
58
  componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<OverflowShadowState>, nextContext: any): void;
59
59
  UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<OverflowShadowState>, nextContext: any): void;
60
60
  };
61
- new (props: P, context?: any): {
61
+ new (props: P, context: any): {
62
62
  overflowContainer?: HTMLElement | null | undefined;
63
63
  container?: HTMLElement | undefined;
64
64
  shadowObserver?: ShadowObserver | undefined;
@@ -81,7 +81,7 @@ export default function overflowShadow<P>(Component: React.ComponentType<P & Ove
81
81
  render(): JSX.Element;
82
82
  context: any;
83
83
  setState<K extends keyof OverflowShadowState>(state: OverflowShadowState | ((prevState: Readonly<OverflowShadowState>, props: Readonly<P>) => OverflowShadowState | Pick<OverflowShadowState, K> | null) | Pick<OverflowShadowState, K> | null, callback?: (() => void) | undefined): void;
84
- forceUpdate(callBack?: (() => void) | undefined): void;
84
+ forceUpdate(callback?: (() => void) | undefined): void;
85
85
  readonly props: Readonly<P> & Readonly<{
86
86
  children?: React.ReactNode;
87
87
  }>;
@@ -0,0 +1 @@
1
+ export declare function dedupe<T>(list?: T[], iteratee?: (p: T) => T[keyof T] | T): T[];
@@ -79,3 +79,4 @@ export declare const isEmptyNode: (schema: Schema) => (node: PMNode) => boolean;
79
79
  * Checks if a node has any content. Ignores node that only contain empty block nodes.
80
80
  */
81
81
  export declare function isNodeEmpty(node?: PMNode): boolean;
82
+ export { dedupe } from './dedupe';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.51.6",
3
+ "version": "74.52.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/"
@@ -124,6 +124,7 @@
124
124
  "classnames": "^2.2.5",
125
125
  "date-fns": "^2.17.0",
126
126
  "focus-trap": "^2.4.5",
127
+ "fuse.js": "^6.6.2",
127
128
  "linkify-it": "^2.0.3",
128
129
  "lodash": "^4.17.21",
129
130
  "markdown-it": "^12.3.2",
@@ -143,7 +144,6 @@
143
144
  "react-intl-next": "npm:react-intl@^5.18.1"
144
145
  },
145
146
  "devDependencies": {
146
- "@atlaskit/editor-test-helpers": "^18.11.0",
147
147
  "@atlaskit/media-core": "^34.1.0",
148
148
  "@atlaskit/media-test-helpers": "^33.0.0",
149
149
  "@atlaskit/smart-card": "^26.16.0",
@@ -200,4 +200,4 @@
200
200
  "type": "boolean"
201
201
  }
202
202
  }
203
- }
203
+ }