@atlaskit/editor-plugin-mentions 0.1.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/.eslintrc.js +7 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +9 -0
- package/dist/cjs/analytics.js +157 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/messages.js +29 -0
- package/dist/cjs/nodeviews/mention.js +117 -0
- package/dist/cjs/plugin.js +135 -0
- package/dist/cjs/pm-plugins/key.js +8 -0
- package/dist/cjs/pm-plugins/main.js +156 -0
- package/dist/cjs/pm-plugins/utils.js +23 -0
- package/dist/cjs/type-ahead/index.js +362 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/InviteItem/index.js +76 -0
- package/dist/cjs/ui/InviteItem/styles.js +19 -0
- package/dist/cjs/ui/Mention/index.js +98 -0
- package/dist/cjs/ui/ToolbarMention/index.js +63 -0
- package/dist/cjs/utils.js +32 -0
- package/dist/es2019/analytics.js +147 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/messages.js +23 -0
- package/dist/es2019/nodeviews/mention.js +80 -0
- package/dist/es2019/plugin.js +123 -0
- package/dist/es2019/pm-plugins/key.js +2 -0
- package/dist/es2019/pm-plugins/main.js +143 -0
- package/dist/es2019/pm-plugins/utils.js +14 -0
- package/dist/es2019/type-ahead/index.js +338 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/InviteItem/index.js +67 -0
- package/dist/es2019/ui/InviteItem/styles.js +47 -0
- package/dist/es2019/ui/Mention/index.js +70 -0
- package/dist/es2019/ui/ToolbarMention/index.js +33 -0
- package/dist/es2019/utils.js +20 -0
- package/dist/esm/analytics.js +150 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/messages.js +23 -0
- package/dist/esm/nodeviews/mention.js +107 -0
- package/dist/esm/plugin.js +129 -0
- package/dist/esm/pm-plugins/key.js +2 -0
- package/dist/esm/pm-plugins/main.js +148 -0
- package/dist/esm/pm-plugins/utils.js +16 -0
- package/dist/esm/type-ahead/index.js +350 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/InviteItem/index.js +66 -0
- package/dist/esm/ui/InviteItem/styles.js +12 -0
- package/dist/esm/ui/Mention/index.js +90 -0
- package/dist/esm/ui/ToolbarMention/index.js +53 -0
- package/dist/esm/utils.js +26 -0
- package/dist/types/analytics.d.ts +13 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/messages.d.ts +22 -0
- package/dist/types/nodeviews/mention.d.ts +9 -0
- package/dist/types/plugin.d.ts +3 -0
- package/dist/types/pm-plugins/key.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +6 -0
- package/dist/types/pm-plugins/utils.d.ts +4 -0
- package/dist/types/type-ahead/index.d.ts +17 -0
- package/dist/types/types.d.ts +38 -0
- package/dist/types/ui/InviteItem/index.d.ts +24 -0
- package/dist/types/ui/InviteItem/styles.d.ts +8 -0
- package/dist/types/ui/Mention/index.d.ts +19 -0
- package/dist/types/ui/ToolbarMention/index.d.ts +13 -0
- package/dist/types/utils.d.ts +8 -0
- package/dist/types-ts4.5/analytics.d.ts +13 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/messages.d.ts +22 -0
- package/dist/types-ts4.5/nodeviews/mention.d.ts +9 -0
- package/dist/types-ts4.5/plugin.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +4 -0
- package/dist/types-ts4.5/type-ahead/index.d.ts +17 -0
- package/dist/types-ts4.5/types.d.ts +41 -0
- package/dist/types-ts4.5/ui/InviteItem/index.d.ts +24 -0
- package/dist/types-ts4.5/ui/InviteItem/styles.d.ts +8 -0
- package/dist/types-ts4.5/ui/Mention/index.d.ts +19 -0
- package/dist/types-ts4.5/ui/ToolbarMention/index.d.ts +13 -0
- package/dist/types-ts4.5/utils.d.ts +8 -0
- package/package.json +112 -0
- package/report.api.md +92 -0
- package/tmp/api-report-tmp.d.ts +63 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { Command, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MentionPluginOptions, MentionPluginState } from '../types';
|
|
5
|
+
export declare const setContext: (context: ContextIdentifierProvider | undefined) => Command;
|
|
6
|
+
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: any) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { MentionPluginState } from '../types';
|
|
3
|
+
export declare function getMentionPluginState(state: EditorState): MentionPluginState;
|
|
4
|
+
export declare const canMentionBeCreatedInRange: (from: number, to: number) => (state: EditorState) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
4
|
+
import type { FireElementsChannelEvent } from '../types';
|
|
5
|
+
export declare const mentionToTypeaheadItem: (mention: MentionDescription) => TypeAheadItem;
|
|
6
|
+
export declare function memoize<ResultFn extends (mention: MentionDescription) => TypeAheadItem>(fn: ResultFn): {
|
|
7
|
+
call: ResultFn;
|
|
8
|
+
clear(): void;
|
|
9
|
+
};
|
|
10
|
+
type Props = {
|
|
11
|
+
sanitizePrivateContent?: boolean;
|
|
12
|
+
mentionInsertDisplayName?: boolean;
|
|
13
|
+
HighlightComponent?: React.ComponentType;
|
|
14
|
+
fireEvent: FireElementsChannelEvent;
|
|
15
|
+
};
|
|
16
|
+
export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, }: Props) => TypeAheadHandler;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
3
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
7
|
+
import type { MentionDescription, MentionProvider } from '@atlaskit/mention';
|
|
8
|
+
export interface TeamInfoAttrAnalytics {
|
|
9
|
+
teamId: string;
|
|
10
|
+
includesYou: boolean;
|
|
11
|
+
memberCount: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MentionPluginConfig {
|
|
14
|
+
HighlightComponent?: React.ComponentType;
|
|
15
|
+
insertDisplayName?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
18
|
+
sanitizePrivateContent?: boolean;
|
|
19
|
+
allowZeroWidthSpaceAfter?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type MentionPluginState = {
|
|
22
|
+
mentionProvider?: MentionProvider;
|
|
23
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
24
|
+
mentions?: Array<MentionDescription>;
|
|
25
|
+
canInsertMention?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type FireElementsChannelEvent = <T extends AnalyticsEventPayload>(payload: T) => void;
|
|
28
|
+
export type MentionSharedState = MentionPluginState & {
|
|
29
|
+
typeAheadHandler: TypeAheadHandler;
|
|
30
|
+
};
|
|
31
|
+
export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
32
|
+
pluginConfiguration: MentionPluginOptions | undefined;
|
|
33
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
34
|
+
sharedState: MentionSharedState | undefined;
|
|
35
|
+
actions: {
|
|
36
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { SyntheticEvent } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import type { UserRole } from '@atlaskit/mention';
|
|
6
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
7
|
+
interface OnMentionEvent {
|
|
8
|
+
(mention: MentionDescription, event?: SyntheticEvent<any>): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const INVITE_ITEM_DESCRIPTION: {
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
interface Props {
|
|
14
|
+
productName?: string;
|
|
15
|
+
onMount?: () => void;
|
|
16
|
+
onMouseEnter?: OnMentionEvent;
|
|
17
|
+
onSelection?: OnMentionEvent;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
userRole?: UserRole;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
22
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ROW_SIDE_PADDING = 14;
|
|
2
|
+
export declare const rowStyle: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const AVATAR_HEIGHT = 36;
|
|
4
|
+
export declare const avatarStyle: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const nameSectionStyle: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const mentionItemStyle: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const mentionItemSelectedStyle: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const capitalizedStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { MentionEventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
|
+
export interface MentionProps {
|
|
5
|
+
id: string;
|
|
6
|
+
providers?: ProviderFactory;
|
|
7
|
+
eventHandlers?: MentionEventHandlers;
|
|
8
|
+
text: string;
|
|
9
|
+
accessLevel?: string;
|
|
10
|
+
}
|
|
11
|
+
export default class Mention extends PureComponent<MentionProps, {}> {
|
|
12
|
+
static displayName: string;
|
|
13
|
+
private providerFactory;
|
|
14
|
+
constructor(props: MentionProps);
|
|
15
|
+
componentDidMount(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
private renderWithProvider;
|
|
18
|
+
render(): JSX.Element;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
interface Props {
|
|
5
|
+
onInsertMention: () => void;
|
|
6
|
+
editorView?: EditorView;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
11
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MentionDescription } from '@atlaskit/mention';
|
|
2
|
+
export declare const isTeamType: (userType: any) => boolean;
|
|
3
|
+
export declare const isTeamStats: (stat: any) => boolean;
|
|
4
|
+
export declare const isInviteItem: (mention: MentionDescription) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Actions
|
|
7
|
+
*/
|
|
8
|
+
export declare const shouldKeepInviteItem: (query: string, firstQueryWithoutResults: string) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
|
|
2
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
+
import type { InviteExperimentCohort, UserRole } from '@atlaskit/mention';
|
|
5
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
6
|
+
import type { TeamInfoAttrAnalytics } from './types';
|
|
7
|
+
export declare const buildAnalyticsPayload: (actionSubject: string, action: string, eventType: EventType, sessionId: string, otherAttributes?: {}, tags?: Array<string>) => GasPayload;
|
|
8
|
+
export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => GasPayload;
|
|
9
|
+
export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
|
|
10
|
+
export declare const buildTypeAheadInviteExposurePayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, inviteExperimentCohort?: InviteExperimentCohort, userRole?: UserRole) => GasPayload;
|
|
11
|
+
export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
|
|
12
|
+
export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider) => GasPayload;
|
|
13
|
+
export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null) => GasPayload;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
inviteItemTitle: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
mentionsAddLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
mentionsIconLabel: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
mentionsNodeLabel: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import type { MentionPluginOptions } from '../types';
|
|
5
|
+
export type Props = InlineNodeViewComponentProps & {
|
|
6
|
+
options: MentionPluginOptions | undefined;
|
|
7
|
+
providerFactory: ProviderFactory;
|
|
8
|
+
};
|
|
9
|
+
export declare const MentionNodeView: React.FC<Props>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { Command, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MentionPluginOptions, MentionPluginState } from '../types';
|
|
5
|
+
export declare const setContext: (context: ContextIdentifierProvider | undefined) => Command;
|
|
6
|
+
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: any) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { MentionPluginState } from '../types';
|
|
3
|
+
export declare function getMentionPluginState(state: EditorState): MentionPluginState;
|
|
4
|
+
export declare const canMentionBeCreatedInRange: (from: number, to: number) => (state: EditorState) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
4
|
+
import type { FireElementsChannelEvent } from '../types';
|
|
5
|
+
export declare const mentionToTypeaheadItem: (mention: MentionDescription) => TypeAheadItem;
|
|
6
|
+
export declare function memoize<ResultFn extends (mention: MentionDescription) => TypeAheadItem>(fn: ResultFn): {
|
|
7
|
+
call: ResultFn;
|
|
8
|
+
clear(): void;
|
|
9
|
+
};
|
|
10
|
+
type Props = {
|
|
11
|
+
sanitizePrivateContent?: boolean;
|
|
12
|
+
mentionInsertDisplayName?: boolean;
|
|
13
|
+
HighlightComponent?: React.ComponentType;
|
|
14
|
+
fireEvent: FireElementsChannelEvent;
|
|
15
|
+
};
|
|
16
|
+
export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, }: Props) => TypeAheadHandler;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
3
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
7
|
+
import type { MentionDescription, MentionProvider } from '@atlaskit/mention';
|
|
8
|
+
export interface TeamInfoAttrAnalytics {
|
|
9
|
+
teamId: string;
|
|
10
|
+
includesYou: boolean;
|
|
11
|
+
memberCount: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MentionPluginConfig {
|
|
14
|
+
HighlightComponent?: React.ComponentType;
|
|
15
|
+
insertDisplayName?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
18
|
+
sanitizePrivateContent?: boolean;
|
|
19
|
+
allowZeroWidthSpaceAfter?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type MentionPluginState = {
|
|
22
|
+
mentionProvider?: MentionProvider;
|
|
23
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
24
|
+
mentions?: Array<MentionDescription>;
|
|
25
|
+
canInsertMention?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type FireElementsChannelEvent = <T extends AnalyticsEventPayload>(payload: T) => void;
|
|
28
|
+
export type MentionSharedState = MentionPluginState & {
|
|
29
|
+
typeAheadHandler: TypeAheadHandler;
|
|
30
|
+
};
|
|
31
|
+
export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
32
|
+
pluginConfiguration: MentionPluginOptions | undefined;
|
|
33
|
+
dependencies: [
|
|
34
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
35
|
+
TypeAheadPlugin
|
|
36
|
+
];
|
|
37
|
+
sharedState: MentionSharedState | undefined;
|
|
38
|
+
actions: {
|
|
39
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { SyntheticEvent } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import type { UserRole } from '@atlaskit/mention';
|
|
6
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
7
|
+
interface OnMentionEvent {
|
|
8
|
+
(mention: MentionDescription, event?: SyntheticEvent<any>): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const INVITE_ITEM_DESCRIPTION: {
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
interface Props {
|
|
14
|
+
productName?: string;
|
|
15
|
+
onMount?: () => void;
|
|
16
|
+
onMouseEnter?: OnMentionEvent;
|
|
17
|
+
onSelection?: OnMentionEvent;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
userRole?: UserRole;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
22
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ROW_SIDE_PADDING = 14;
|
|
2
|
+
export declare const rowStyle: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const AVATAR_HEIGHT = 36;
|
|
4
|
+
export declare const avatarStyle: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const nameSectionStyle: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const mentionItemStyle: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const mentionItemSelectedStyle: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const capitalizedStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { MentionEventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
|
+
export interface MentionProps {
|
|
5
|
+
id: string;
|
|
6
|
+
providers?: ProviderFactory;
|
|
7
|
+
eventHandlers?: MentionEventHandlers;
|
|
8
|
+
text: string;
|
|
9
|
+
accessLevel?: string;
|
|
10
|
+
}
|
|
11
|
+
export default class Mention extends PureComponent<MentionProps, {}> {
|
|
12
|
+
static displayName: string;
|
|
13
|
+
private providerFactory;
|
|
14
|
+
constructor(props: MentionProps);
|
|
15
|
+
componentDidMount(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
private renderWithProvider;
|
|
18
|
+
render(): JSX.Element;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
interface Props {
|
|
5
|
+
onInsertMention: () => void;
|
|
6
|
+
editorView?: EditorView;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
11
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MentionDescription } from '@atlaskit/mention';
|
|
2
|
+
export declare const isTeamType: (userType: any) => boolean;
|
|
3
|
+
export declare const isTeamStats: (stat: any) => boolean;
|
|
4
|
+
export declare const isInviteItem: (mention: MentionDescription) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Actions
|
|
7
|
+
*/
|
|
8
|
+
export declare const shouldKeepInviteItem: (query: string, firstQueryWithoutResults: string) => boolean;
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor: Lego",
|
|
12
|
+
"inPublicMirror": false,
|
|
13
|
+
"releaseModel": "continuous",
|
|
14
|
+
"website": {
|
|
15
|
+
"name": "EditorPluginMentions",
|
|
16
|
+
"category": "Components"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
20
|
+
"main": "dist/cjs/index.js",
|
|
21
|
+
"module": "dist/esm/index.js",
|
|
22
|
+
"module:es2019": "dist/es2019/index.js",
|
|
23
|
+
"types": "dist/types/index.d.ts",
|
|
24
|
+
"typesVersions": {
|
|
25
|
+
">=4.5 <4.9": {
|
|
26
|
+
"*": [
|
|
27
|
+
"dist/types-ts4.5/*",
|
|
28
|
+
"dist/types-ts4.5/index.d.ts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"atlaskit:src": "src/index.ts",
|
|
34
|
+
"af:exports": {
|
|
35
|
+
".": "./src/index.ts"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@atlaskit/adf-schema": "^32.0.0",
|
|
39
|
+
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
40
|
+
"@atlaskit/editor-common": "^76.11.0",
|
|
41
|
+
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
42
|
+
"@atlaskit/editor-plugin-type-ahead": "^0.7.0",
|
|
43
|
+
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
44
|
+
"@atlaskit/icon": "^21.12.0",
|
|
45
|
+
"@atlaskit/mention": "^22.1.0",
|
|
46
|
+
"@atlaskit/theme": "^12.6.0",
|
|
47
|
+
"@atlaskit/tokens": "^1.26.0",
|
|
48
|
+
"@babel/runtime": "^7.0.0",
|
|
49
|
+
"@emotion/react": "^11.7.1",
|
|
50
|
+
"uuid": "^3.1.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": "^16.8.0",
|
|
54
|
+
"react-dom": "^16.8.0",
|
|
55
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@af/visual-regression": "*",
|
|
59
|
+
"@atlaskit/ssr": "*",
|
|
60
|
+
"@atlaskit/visual-regression": "*",
|
|
61
|
+
"@atlaskit/webdriver-runner": "*",
|
|
62
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
63
|
+
"@testing-library/react": "^12.1.5",
|
|
64
|
+
"react-dom": "^16.8.0",
|
|
65
|
+
"typescript": "~4.9.5",
|
|
66
|
+
"wait-for-expect": "^1.2.0"
|
|
67
|
+
},
|
|
68
|
+
"techstack": {
|
|
69
|
+
"@atlassian/frontend": {
|
|
70
|
+
"code-structure": [
|
|
71
|
+
"tangerine-next"
|
|
72
|
+
],
|
|
73
|
+
"import-structure": [
|
|
74
|
+
"atlassian-conventions"
|
|
75
|
+
],
|
|
76
|
+
"circular-dependencies": [
|
|
77
|
+
"file-and-folder-level"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"@repo/internal": {
|
|
81
|
+
"dom-events": "use-bind-event-listener",
|
|
82
|
+
"analytics": [
|
|
83
|
+
"analytics-next"
|
|
84
|
+
],
|
|
85
|
+
"design-tokens": [
|
|
86
|
+
"color"
|
|
87
|
+
],
|
|
88
|
+
"theming": [
|
|
89
|
+
"react-context"
|
|
90
|
+
],
|
|
91
|
+
"ui-components": [
|
|
92
|
+
"lite-mode"
|
|
93
|
+
],
|
|
94
|
+
"deprecation": [
|
|
95
|
+
"no-deprecated-imports"
|
|
96
|
+
],
|
|
97
|
+
"styling": [
|
|
98
|
+
"static",
|
|
99
|
+
"emotion"
|
|
100
|
+
],
|
|
101
|
+
"imports": [
|
|
102
|
+
"import-no-extraneous-disable-for-examples-and-docs"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"techstackIgnore": {
|
|
107
|
+
"stricter": [
|
|
108
|
+
"@atlassian/tangerine/project-structure"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
112
|
+
}
|
package/report.api.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
3
|
+
## API Report File for "@atlaskit/editor-plugin-mentions"
|
|
4
|
+
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
12
|
+
|
|
13
|
+
### Main Entry Types
|
|
14
|
+
|
|
15
|
+
<!--SECTION START: Main Entry Types-->
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
/// <reference types="react" />
|
|
19
|
+
|
|
20
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
21
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
22
|
+
import type { MentionDescription } from '@atlaskit/mention';
|
|
23
|
+
import type { MentionProvider } from '@atlaskit/mention';
|
|
24
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
25
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
26
|
+
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
27
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
28
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
29
|
+
|
|
30
|
+
// @public (undocumented)
|
|
31
|
+
export interface MentionPluginConfig {
|
|
32
|
+
// (undocumented)
|
|
33
|
+
HighlightComponent?: React.ComponentType;
|
|
34
|
+
// (undocumented)
|
|
35
|
+
insertDisplayName?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// @public (undocumented)
|
|
39
|
+
interface MentionPluginOptions extends MentionPluginConfig {
|
|
40
|
+
// (undocumented)
|
|
41
|
+
allowZeroWidthSpaceAfter?: boolean;
|
|
42
|
+
// (undocumented)
|
|
43
|
+
sanitizePrivateContent?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// @public (undocumented)
|
|
47
|
+
type MentionPluginState = {
|
|
48
|
+
mentionProvider?: MentionProvider;
|
|
49
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
50
|
+
mentions?: Array<MentionDescription>;
|
|
51
|
+
canInsertMention?: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// @public (undocumented)
|
|
55
|
+
type MentionSharedState = MentionPluginState & {
|
|
56
|
+
typeAheadHandler: TypeAheadHandler;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// @public (undocumented)
|
|
60
|
+
export type MentionsPlugin = NextEditorPlugin<
|
|
61
|
+
'mention',
|
|
62
|
+
{
|
|
63
|
+
pluginConfiguration: MentionPluginOptions | undefined;
|
|
64
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
65
|
+
sharedState: MentionSharedState | undefined;
|
|
66
|
+
actions: {
|
|
67
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
// @public (undocumented)
|
|
73
|
+
export const mentionsPlugin: MentionsPlugin;
|
|
74
|
+
|
|
75
|
+
// (No @packageDocumentation comment for this package)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<!--SECTION END: Main Entry Types-->
|
|
79
|
+
|
|
80
|
+
### Peer Dependencies
|
|
81
|
+
|
|
82
|
+
<!--SECTION START: Peer Dependencies-->
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"react": "^16.8.0",
|
|
87
|
+
"react-dom": "^16.8.0",
|
|
88
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<!--SECTION END: Peer Dependencies-->
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-mentions"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
|
|
9
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
10
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
11
|
+
import type { MentionDescription } from '@atlaskit/mention';
|
|
12
|
+
import type { MentionProvider } from '@atlaskit/mention';
|
|
13
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
15
|
+
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
16
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
17
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
18
|
+
|
|
19
|
+
// @public (undocumented)
|
|
20
|
+
export interface MentionPluginConfig {
|
|
21
|
+
// (undocumented)
|
|
22
|
+
HighlightComponent?: React.ComponentType;
|
|
23
|
+
// (undocumented)
|
|
24
|
+
insertDisplayName?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// @public (undocumented)
|
|
28
|
+
interface MentionPluginOptions extends MentionPluginConfig {
|
|
29
|
+
// (undocumented)
|
|
30
|
+
allowZeroWidthSpaceAfter?: boolean;
|
|
31
|
+
// (undocumented)
|
|
32
|
+
sanitizePrivateContent?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @public (undocumented)
|
|
36
|
+
type MentionPluginState = {
|
|
37
|
+
mentionProvider?: MentionProvider;
|
|
38
|
+
contextIdentifierProvider?: ContextIdentifierProvider;
|
|
39
|
+
mentions?: Array<MentionDescription>;
|
|
40
|
+
canInsertMention?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// @public (undocumented)
|
|
44
|
+
type MentionSharedState = MentionPluginState & {
|
|
45
|
+
typeAheadHandler: TypeAheadHandler;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
50
|
+
pluginConfiguration: MentionPluginOptions | undefined;
|
|
51
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, TypeAheadPlugin];
|
|
52
|
+
sharedState: MentionSharedState | undefined;
|
|
53
|
+
actions: {
|
|
54
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
export const mentionsPlugin: MentionsPlugin;
|
|
60
|
+
|
|
61
|
+
// (No @packageDocumentation comment for this package)
|
|
62
|
+
|
|
63
|
+
```
|