| 3 | import {defaultValue, getSchemaTpl} from 'amis-editor-core'; |
| 4 | |
| 5 | export class MarkdownPlugin extends BasePlugin { |
| 6 | static id = 'MarkdownPlugin'; |
| 7 | static scene = ['layout']; |
| 8 | // 关联渲染器名字 |
| 9 | rendererName = 'markdown'; |
| 10 | $schema = '/schemas/MarkdownSchema.json'; |
| 11 | |
| 12 | // 组件名称 |
| 13 | name = 'Markdown'; |
| 14 | isBaseComponent = true; |
| 15 | description = '展示 markdown 内容'; |
| 16 | docLink = '/amis/zh-CN/components/markdown'; |
| 17 | tags = ['展示']; |
| 18 | icon = 'fa fa-file-text'; |
| 19 | pluginIcon = 'markdown-plugin'; |
| 20 | scaffold = { |
| 21 | type: 'markdown', |
| 22 | value: '## 这是标题' |
| 23 | }; |
| 24 | previewSchema = { |
| 25 | ...this.scaffold |
| 26 | }; |
| 27 | |
| 28 | panelTitle = 'MD'; |
| 29 | panelBodyCreator = (context: BaseEventContext) => { |
| 30 | const isUnderField = /\/field\/\w+$/.test(context.path as string); |
| 31 | return [ |
| 32 | getSchemaTpl('tabs', [ |
| 33 | { |
| 34 | title: '常规', |
| 35 | body: [ |
| 36 | getSchemaTpl('layout:originPosition', {value: 'left-top'}), |
| 37 | getSchemaTpl('markdownBody') |
| 38 | ] |
| 39 | }, |
| 40 | { |
| 41 | title: '外观', |
| 42 | body: [getSchemaTpl('className')] |
| 43 | }, |
| 44 | { |
| 45 | title: '显隐', |
| 46 | body: [getSchemaTpl('ref'), getSchemaTpl('visible')] |
| 47 | } |
| 48 | ]) |
| 49 | ]; |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | registerEditorPlugin(MarkdownPlugin); |
nothing calls this directly
no test coverage detected