feat: markdown field

This commit is contained in:
chenos 2021-03-26 10:03:54 +08:00
parent ed296cfc5f
commit 122f6bfdb7
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import { connect } from '@formily/react-schema-renderer'
import React from 'react';
import { Input as AntdInput } from 'antd'
import { acceptEnum, mapStyledProps, mapTextComponent } from '../shared'
export const Markdown = connect({
getProps: mapStyledProps,
getComponent: mapTextComponent
})(acceptEnum((props) => <AntdInput.TextArea autoSize={{minRows: 2, maxRows: 12}} {...props}/>))
export default Markdown

View File

@ -25,6 +25,7 @@ import { DraggableTable } from './draggable-table'
import { Values } from './values' import { Values } from './values'
import { Automations } from './automations' import { Automations } from './automations'
import { Wysiwyg } from './wysiwyg' import { Wysiwyg } from './wysiwyg'
import { Markdown } from './markdown'
export const setup = () => { export const setup = () => {
registerFormFields({ registerFormFields({
@ -63,6 +64,7 @@ export const setup = () => {
draggableTable: DraggableTable, draggableTable: DraggableTable,
values: Values, values: Values,
wysiwyg: Wysiwyg, wysiwyg: Wysiwyg,
markdown: Markdown,
'permissions.actions': Permissions.Actions, 'permissions.actions': Permissions.Actions,
'permissions.fields': Permissions.Fields, 'permissions.fields': Permissions.Fields,
'permissions.tabs': Permissions.Tabs, 'permissions.tabs': Permissions.Tabs,

View File

@ -98,6 +98,19 @@ export const percent = {
}, },
}; };
export const markdown = {
title: 'Markdown',
group: 'media',
options: {
interface: 'markdown',
type: 'json',
component: {
type: 'markdown',
},
},
};
export const wysiwyg = { export const wysiwyg = {
title: '可视化编辑器', title: '可视化编辑器',
group: 'media', group: 'media',