diff --git a/app/client/components/BookSearchList.tsx b/app/client/components/BookSearchList.tsx index d219200..0f6d881 100644 --- a/app/client/components/BookSearchList.tsx +++ b/app/client/components/BookSearchList.tsx @@ -36,7 +36,7 @@ export function BookSearchList() { - {data.bookMany.items.length != 0 && ( + {data.bookMany.items.length !== 0 && ( + + {/* + Editor + */} + + + + + + ); +} + +const HOTKEYS: Record = { + 'mod+b': 'bold', + 'mod+i': 'italic', + 'mod+u': 'underline', + 'mod+`': 'code' +}; + +const LIST_TYPES = ['numbered-list', 'bulleted-list'] as const; +const TEXT_ALIGN_TYPES = ['left', 'center', 'right', 'justify'] as const; + +type AlignType = (typeof TEXT_ALIGN_TYPES)[number]; +type ListType = (typeof LIST_TYPES)[number]; +type CustomElementFormat = CustomElementType | AlignType | ListType; + +const RichTextExample = () => { + const renderElement = useCallback((props: RenderElementProps) => , []); + const renderLeaf = useCallback((props: RenderLeafProps) => , []); + const editor = useMemo(() => withHistory(withReact(createEditor())), []); + + const initialValue: Descendant[] = [ + { + type: 'paragraph', + children: [ + { text: 'This is editable ' }, + { text: 'rich', bold: true }, + { text: ' text, ' }, + { text: 'much', italic: true }, + { text: ' better than a ' }, + { text: '