import BlockComponent from '../BlockComponent'; import { Slate, Editable } from 'slate-react'; import Leaf from './Leaf'; import HoveringToolbar from '$app/components/HoveringToolbar'; import { TreeNode } from '@/appflowy_app/block_editor/view/tree_node'; import { useTextBlock } from './index.hooks'; import { BlockCommonProps, TextBlockToolbarProps } from '@/appflowy_app/interfaces'; import { toolbarDefaultProps } from '@/appflowy_app/constants/toolbar'; export default function TextBlock({ node, needRenderChildren = true, toolbarProps, ...props }: { needRenderChildren?: boolean; toolbarProps?: TextBlockToolbarProps; } & BlockCommonProps & React.HTMLAttributes) { const { editor, value, onChange, onKeyDownCapture, onDOMBeforeInput } = useTextBlock({ node }); const { showGroups } = toolbarProps || toolbarDefaultProps; return (
{showGroups.length > 0 && } } placeholder='Enter some text...' /> {needRenderChildren && node.children.length > 0 ? (
{node.children.map((item) => ( ))}
) : null}
); }