Features
Libraries
Installation#
bash
pnpm dlx shadcn@latest add @zui/document-editor @zui/editor-linkUsage#
tsx
import type { DocJSON, IEditor } from '@zeroxsolutions/editor-core/document/core/index';
import { link } from '@/components/editor/document/features/link';
import { standardKit } from '@/components/editor/document/features/standard';
import { Editor } from '@/components/editor/document/react';tsx
const features = [standardKit(), link()];
function NotesEditor({ content }: { content: DocJSON }) {
return <Editor features={features} content={content} />;
}link adds the link mark and the "Link" item of the bubble menu, which asks for an address. The commands are setLink, which takes an href, and unsetLink; both act on the selection.
Run the command on the editor that Editor hands to onReady, as Document Editor shows:
tsx
function insert(editor: IEditor) {
editor.run('setLink', { href: 'https://example.com' });
}The Viewer draws the same block, with the same feature in its features, wherever a stored document is only read.