Features
Libraries
A highlighted block that sets a note apart in one of five variants: note, info, success, warning or danger.
Installation#
bash
pnpm dlx shadcn@latest add @zui/document-editor @zui/editor-calloutUsage#
tsx
import type { DocJSON, IEditor } from '@zeroxsolutions/editor-core/document/core/index';
import { callout } from '@/components/editor/document/features/callout';
import { standardKit } from '@/components/editor/document/features/standard';
import { Editor } from '@/components/editor/document/react';tsx
const features = [standardKit(), callout()];
function NotesEditor({ content }: { content: DocJSON }) {
return <Editor features={features} content={content} />;
}Callout adds the callout block, a bordered box with an icon and room for further blocks, in the variants note, info, success, warning and danger. Its slash item is "Callout" and its command insertCallout takes an optional variant, info by default.
Run the command on the editor that Editor hands to onReady, as Document Editor shows:
tsx
function insert(editor: IEditor) {
editor.run('insertCallout', { variant: 'warning' });
}The Viewer draws the same block, with the same feature in its features, wherever a stored document is only read.