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 '../..';
|
|
|
|
|
2022-02-22 11:17:24 +08:00
|
|
|
export const MarkdownBlockInitializer = (props) => {
|
2022-02-18 20:29:24 +08:00
|
|
|
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': {
|
2022-02-20 17:58:46 +08:00
|
|
|
content: t('This is a demo text, **supports Markdown syntax**.'),
|
2022-02-18 20:29:24 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
2022-02-22 11:17:24 +08:00
|
|
|
};
|