UNPKG

edit-on-slate

Version:

Slate 기반의 직관적이고 강력한 리액트 텍스트 에디터 라이브러리

33 lines (29 loc) 879 B
import { BaseEditor } from 'slate'; import { ReactEditor } from 'slate-react'; import { HistoryEditor } from 'slate-history'; // 커스텀 텍스트 타입 정의 export type CustomText = { text: string; bold?: boolean; italic?: boolean; underline?: boolean; code?: boolean; fontFamily?: string; color?: string; }; // 커스텀 요소 타입 정의 export type CustomElement = { type: 'paragraph' | 'heading-one' | 'heading-two' | 'heading-three' | 'block-quote' | 'bulleted-list' | 'numbered-list' | 'list-item'; children: (CustomElement | CustomText)[]; textAlign?: 'center' | 'right' | 'justify'; }; // 에디터 타입 정의 export type CustomEditor = BaseEditor & ReactEditor & HistoryEditor; // Slate 타입 확장 declare module 'slate' { interface CustomTypes { Editor: CustomEditor; Element: CustomElement; Text: CustomText; } }