{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "rich-text-editor-mention",
  "title": "Mention",
  "description": "Mention nodes fed by your own records through a suggestion list.",
  "dependencies": [
    "@tiptap/extension-mention@3.32.2"
  ],
  "registryDependencies": [
    "litingyes/blocove/rich-text-editor",
    "litingyes/blocove/rich-text-editor-extension",
    "litingyes/blocove/rich-text-editor-suggestion"
  ],
  "files": [
    {
      "path": "src/registry/blocove/ui/rich-text-editor/mention.tsx",
      "content": "import type { MentionNodeAttrs } from '@tiptap/extension-mention'\nimport type { ExtensionComponent } from '@/lib/blocove/rich-text-editor-extension'\nimport { Mention } from '@tiptap/extension-mention'\nimport { defineExtensionComponent } from '@/lib/blocove/rich-text-editor-extension'\nimport { createSuggestionRenderer } from '@/lib/blocove/rich-text-editor-suggestion'\n\nexport interface MentionUser {\n  id: string\n  label: string\n}\n\nconst defaultUsers: MentionUser[] = [\n  { id: 'ada', label: 'Ada Lovelace' },\n  { id: 'alan', label: 'Alan Turing' },\n  { id: 'grace', label: 'Grace Hopper' },\n]\n\nconst suggestionLimit = 8\n\nexport interface EditorMentionProps {\n  /** Records the suggestion list can insert. */\n  users?: MentionUser[]\n  /** Character that opens the suggestion list. */\n  char?: string\n  /** Accessible name of the suggestion list. */\n  ariaLabel?: string\n  /** HTML attributes applied to every mention node. */\n  HTMLAttributes?: Record<string, string>\n}\n\n/**\n * Registers the Tiptap mention node. The suggestion list is built from the\n * `users` prop, so the item only exposes plain data.\n */\nexport const EditorMention: ExtensionComponent<EditorMentionProps> = defineExtensionComponent(\n  'mention',\n  ({\n    users = defaultUsers,\n    char = '@',\n    ariaLabel = 'Mention',\n    HTMLAttributes = {},\n  }: EditorMentionProps) => [\n    Mention.configure({\n      HTMLAttributes,\n      suggestion: {\n        char,\n        items: ({ query }: { query: string }) =>\n          users\n            .filter(user => user.label.toLowerCase().includes(query.toLowerCase()))\n            .slice(0, suggestionLimit),\n        render: createSuggestionRenderer({ ariaLabel }),\n        command: ({ editor, range, props }) => {\n          editor\n            .chain()\n            .focus()\n            .insertContentAt(range, [\n              { type: 'mention', attrs: props as MentionNodeAttrs },\n              { type: 'text', text: ' ' },\n            ])\n            .run()\n        },\n      },\n    }),\n  ],\n)\n",
      "type": "registry:ui",
      "target": "components/blocove/rich-text-editor/mention.tsx"
    }
  ],
  "categories": [
    "rich-text-editor",
    "node"
  ],
  "type": "registry:ui"
}