@atlaskit/editor-plugin-mentions
Version:
Mentions plugin for @atlaskit/editor-core
41 lines (40 loc) • 2.09 kB
TypeScript
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
import type { ResolvingMentionProvider } from '@atlaskit/mention/resource';
import type { MentionPluginOptions, MentionPluginState } from '../types';
/**
* Resolves the name of a pasted agent mention via the mention provider and
* dispatches the appropriate action to update plugin state.
*/
export declare const resolveAndDispatchPastedAgentMentionName: (agentId: string, mentionProvider: ResolvingMentionProvider, pendingResolveMentionIds: Set<string>, view: EditorView) => void;
type ApplyAgentMentionStateParams = {
getIsRovoPanelOpen?: () => boolean;
newState: EditorState;
oldState: EditorState;
pluginState: MentionPluginState;
tr: ReadonlyTransaction;
};
export declare const applyAgentMentionState: ({ tr, pluginState, oldState, newState, getIsRovoPanelOpen, }: ApplyAgentMentionStateParams) => {
hasPublicPluginStateChanged: boolean;
pluginState: MentionPluginState;
};
type CreateAgentMentionPluginViewParams = {
editorView: EditorView;
getIsRovoPanelOpen?: () => boolean;
stateKey: PluginKey<MentionPluginState>;
};
type AgentMentionPluginView = {
destroy: () => void;
update: (view: EditorView, prevState: EditorState) => void;
};
export declare const createAgentMentionPluginView: ({ editorView, getIsRovoPanelOpen, stateKey, }: CreateAgentMentionPluginViewParams) => AgentMentionPluginView;
export declare const agentMentionPluginKey: PluginKey<MentionPluginState>;
type CreateAgentMentionPluginParams = {
options?: MentionPluginOptions;
pmPluginFactoryParams: PMPluginFactoryParams;
};
export declare const createAgentMentionPlugin: ({ options, pmPluginFactoryParams, }: CreateAgentMentionPluginParams) => SafePlugin<MentionPluginState>;
export {};