tachybase_todo/packages/client/src/schema-initializer/Initializers/BlockInitializer/MarkdownBlock.tsx

30 lines
764 B
TypeScript
Raw Normal View History

2022-02-18 20:29:24 +08:00
import { FormOutlined } from '@ant-design/icons';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { SchemaInitializer } from '../..';
const itemWrap = SchemaInitializer.itemWrap;
export const MarkdownBlock = itemWrap((props) => {
const { insert } = props;
const { t } = useTranslation();
return (
<SchemaInitializer.Item
{...props}
icon={<FormOutlined />}
onClick={() => {
insert({
type: 'void',
'x-designer': 'Markdown.Void.Designer',
'x-decorator': 'CardItem',
'x-component': 'Markdown.Void',
'x-editable': false,
'x-component-props': {
content: '# Markdown content',
},
});
}}
/>
);
});