From 122f6bfdb703f4d33c8d9a4adbe48285af3dfff7 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 26 Mar 2021 10:03:54 +0800 Subject: [PATCH] feat: markdown field --- .../src/components/form.fields/markdown/index.tsx | 11 +++++++++++ packages/app/src/components/form.fields/registry.ts | 2 ++ packages/plugin-collections/src/interfaces/types.ts | 13 +++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 packages/app/src/components/form.fields/markdown/index.tsx diff --git a/packages/app/src/components/form.fields/markdown/index.tsx b/packages/app/src/components/form.fields/markdown/index.tsx new file mode 100644 index 000000000..00552ff3a --- /dev/null +++ b/packages/app/src/components/form.fields/markdown/index.tsx @@ -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) => )) + +export default Markdown diff --git a/packages/app/src/components/form.fields/registry.ts b/packages/app/src/components/form.fields/registry.ts index 99f3aec70..7a64e0143 100644 --- a/packages/app/src/components/form.fields/registry.ts +++ b/packages/app/src/components/form.fields/registry.ts @@ -25,6 +25,7 @@ import { DraggableTable } from './draggable-table' import { Values } from './values' import { Automations } from './automations' import { Wysiwyg } from './wysiwyg' +import { Markdown } from './markdown' export const setup = () => { registerFormFields({ @@ -63,6 +64,7 @@ export const setup = () => { draggableTable: DraggableTable, values: Values, wysiwyg: Wysiwyg, + markdown: Markdown, 'permissions.actions': Permissions.Actions, 'permissions.fields': Permissions.Fields, 'permissions.tabs': Permissions.Tabs, diff --git a/packages/plugin-collections/src/interfaces/types.ts b/packages/plugin-collections/src/interfaces/types.ts index 40c7f9cee..a4c1db089 100644 --- a/packages/plugin-collections/src/interfaces/types.ts +++ b/packages/plugin-collections/src/interfaces/types.ts @@ -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 = { title: '可视化编辑器', group: 'media',