or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-9/

Mention Command Insertion Helper

Build a helper that inserts marker-based mentions into an editor by delegating to the dependency's mention insertion behavior instead of manually editing text. The helper should trust the dependency to validate markers, merge selection attributes, and manage spacing rules.

Capabilities

Insert mention with custom text

  • Given marker #, id #team, label Team, and custom text Team Blue, calling the helper inserts the mention text at the caret and appends a single trailing space when the next character is not whitespace. @test

Skip trailing space inside brackets

  • When the caret sits immediately before a closing parenthesis, inserting a mention leaves the bracket directly after the mention without adding a space. @test

Reject mismatched markers

  • Providing a marker that does not match the mention id prefix raises an error and leaves editor content unchanged. @test

Preserve formatting

  • Inserting a mention into text that is already bold keeps the inserted mention bold after the operation. @test

Implementation

@generates

API

export interface MentionRequest {
  marker: string;
  id: string;
  label: string;
  text?: string;
}

export function insertMention(editor: unknown, mention: MentionRequest): void;

Dependencies { .dependencies }

@ckeditor/ckeditor5-mention { .dependency }

Provides marker-aware mention insertion and validation.