文档

显示可编辑区域

把 EditorContent 放在 EditorProvider 里面。后代使用 useEditorContext() 取得实例。className 设置样式类,ariaLabel 命名输入区,ariaDescribedBy 指向说明元素 ID。使用同一实例重新挂载时,内容和历史记录会保留。编辑器禁用拖放。

import { Bold, EditorContent, EditorProvider, useEditor } from 'yurich';

export function ArticleEditor() {
  const editor = useEditor({ extensions: [Bold] });

  return (
    <EditorProvider editor={editor}>
      <EditorContent ariaLabel="Article" />
    </EditorProvider>
  );
}

快速开始