Features
Libraries
Installation#
bash
pnpm dlx shadcn@latest add @zui/document-editor @zui/editor-mentionUsage#
tsx
import type { DocJSON, IEditor } from '@zeroxsolutions/editor-core/document/core/index';
import { mention } from '@/components/editor/document/features/mention';
import { standardKit } from '@/components/editor/document/features/standard';
import { Editor } from '@/components/editor/document/react';tsx
const features = [standardKit(), mention()];
function NotesEditor({ content }: { content: DocJSON }) {
return <Editor features={features} content={content} />;
}mention adds the inline mention node, a pill that carries an id and a label and which the text treats as one unit. It has no slash item: your code inserts one with the command insertMention, which takes both.
Run the command on the editor that Editor hands to onReady, as Document Editor shows:
tsx
function insert(editor: IEditor) {
editor.run('insertMention', { id: 'u-linh', label: 'Linh' });
}The Viewer draws the same block, with the same feature in its features, wherever a stored document is only read.