UNPKG

@atlaskit/editor-plugin-mentions

Version:

Mentions plugin for @atlaskit/editor-core

51 lines (50 loc) 2.07 kB
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal'; import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model'; import type { NodeView } from '@atlaskit/editor-prosemirror/view'; import type { MentionsPlugin } from '../mentionsPluginType'; import type { MentionPluginOptions } from '../types'; interface MentionNodeViewProps { api: ExtractInjectionAPI<MentionsPlugin> | undefined; options?: MentionPluginOptions; portalProviderAPI: PortalProviderAPI; } export declare class MentionNodeView implements NodeView { dom: Node; domElement: HTMLElement | undefined; contentDOM: HTMLElement | undefined; private config; private node; private cleanup; private destroyProfileCard; private removeProfileCard; private mentionPrimitiveElement; private disabledTooltip; private unsubscribeFromDisabledStateChanges; private subscribedProvider; constructor(node: PMNode, config: MentionNodeViewProps); private setClassList; private getDisabledState; /** * Subscribes this NodeView to disabled-state-change notifications on the * supplied provider so already-rendered chips can re-evaluate themselves * when the consumer's predicate inputs change (e.g. the active agent * selection toggling in Rovo Chat). No-op for providers that don't * implement `subscribeToDisabledStateChanges`. * * Idempotent: re-calling with the same provider keeps the existing * subscription; passing a different provider tears the old subscription * down before attaching the new one. Safe to call from the sharedState * `onChange` handler when the editor swaps providers. */ private subscribeToProviderDisabledStateChanges; private syncDisabledTooltip; private setTextContent; private shouldHighlightMention; private updateState; private nodeIsEqual; update(node: PMNode): boolean; destroy(): void; deselectNode(): void; } export {};