evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a small adapter around a rich text editor that uses the dependency's mention feature to import and export HTML mention spans.
<p><span class="mention" data-mention='{"id":"@ada","_text":"@ada","uid":"m1"}'>@ada</span> rocks</p> and immediately exporting preserves the mention span with the same id, _text, and uid in the data payload. @testid field, whose id does not start with the trigger marker (e.g., @), or whose payload is not valid JSON, exporting should emit plain text with no mention attribute or class. @testdata-mention (e.g., userId, role) should survive a load/export cycle and remain serialized in the outgoing JSON. @testexport interface MentionAdapterOptions {
marker?: string;
feedItems?: Array<string | { id: string; text?: string; [key: string]: unknown }>;
}
export interface MentionAdapter {
load(html: string): Promise<void>;
insertTextInsideFirstMention(text: string, offset?: number): Promise<void>;
export(): Promise<string>;
destroy(): Promise<void>;
}
/**
* Create a mention-enabled adapter bound to a provided DOM element.
* The adapter should configure the dependency's mention feature so that mention spans are interpreted and serialized by the default converters.
*/
export function createMentionAdapter(root: HTMLElement, options?: MentionAdapterOptions): Promise<MentionAdapter>;Provides mention span recognition and conversion between HTML and the editor model.