@atlaskit/editor-plugin-mentions
Version:
Mentions plugin for @atlaskit/editor-core
52 lines (51 loc) • 2.14 kB
TypeScript
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
import type { Providers, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
import type { MentionDescription, MentionProvider } from '@atlaskit/mention';
export declare const MENTION_PROVIDER_REJECTED = "REJECTED";
export declare const MENTION_PROVIDER_UNDEFINED = "UNDEFINED";
export interface TeamInfoAttrAnalytics {
includesYou: boolean;
memberCount: number;
teamId: string;
}
export interface MentionPluginConfig {
HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
insertDisplayName?: boolean;
profilecardProvider?: Promise<ProfilecardProvider>;
}
export type MentionsChangedHandler = (changes: {
id: string;
localId: string;
taskLocalId?: string;
type: 'added' | 'deleted';
}[]) => void;
export interface MentionsPluginOptions extends MentionPluginConfig {
allowZeroWidthSpaceAfter?: boolean;
handleMentionsChanged?: MentionsChangedHandler;
/**
* User ID to highlight as a self-mention (typically the current user).
*
* When provided, mentions matching this ID will be highlighted immediately,
* without waiting for the mention provider to load. This enables instant highlighting on initial render.
* Takes priority over `MentionProvider.shouldHighlightMention()` if both are present.
*/
currentUserId?: string;
mentionProvider?: Providers['mentionProvider'];
sanitizePrivateContent?: boolean;
}
/**
* @private
* @deprecated Use {@link MentionsPluginOptions} instead.
* @see https://product-fabric.atlassian.net/browse/ED-27496
*/
export type MentionPluginOptions = MentionsPluginOptions;
export type MentionPluginState = {
canInsertMention?: boolean;
mentionProvider?: MentionProvider;
mentions?: Array<MentionDescription>;
};
export type FireElementsChannelEvent = (payload: AnalyticsEventPayload, channel?: string) => void;
export type MentionSharedState = MentionPluginState & {
typeAheadHandler: TypeAheadHandler;
};