mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-01 03:38:32 +08:00
fix: can use markdown in field description
This commit is contained in:
parent
f1c0503916
commit
e36415330f
@ -25,7 +25,7 @@ marked.setOptions({
|
||||
const renderer = new marked.Renderer();
|
||||
renderer.link = ( href, title, text ) => `<a target="_blank" href="${ href }" title="${ title||'' }">${ text }</a>`;
|
||||
|
||||
function markdown(text: string) {
|
||||
export function markdown(text: string) {
|
||||
return marked(text, {
|
||||
renderer,
|
||||
});
|
||||
|
@ -1,13 +1,15 @@
|
||||
import React from 'react';
|
||||
import { Tooltip } from 'antd';
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { markdown } from '../Field';
|
||||
|
||||
export default {
|
||||
text(...args: any[]) {
|
||||
return React.createElement('span', {}, ...args)
|
||||
},
|
||||
html(html: string) {
|
||||
return <div dangerouslySetInnerHTML={{__html: html}}></div>
|
||||
const text = decodeURIComponent(html);
|
||||
return <div dangerouslySetInnerHTML={{__html: markdown(text)}}></div>
|
||||
},
|
||||
tooltip(title: string, offset = 3) {
|
||||
return (
|
||||
|
@ -49,8 +49,8 @@ const transforms = {
|
||||
const dataSource = field.get('dataSource').filter(item => item.key !== 'developerMode');
|
||||
field.set('dataSource', dataSource);
|
||||
}
|
||||
if (field.get('component.type') === 'filter') {
|
||||
const { values } = ctx.action.params;
|
||||
const { values } = ctx.action.params;
|
||||
if (field.get('component.type') === 'filter' && get(values, 'associatedKey')) {
|
||||
const options = Field.parseApiJson(ctx.state.developerMode ? {
|
||||
filter: {
|
||||
collection_name: get(values, 'associatedKey'),
|
||||
@ -70,7 +70,7 @@ const transforms = {
|
||||
prop.type = 'string'
|
||||
}
|
||||
if (field.get('component.tooltip')) {
|
||||
prop.description = `{{html('${field.get('component.tooltip')}')}}`;
|
||||
prop.description = `{{html('${encodeURIComponent(field.get('component.tooltip'))}')}}`;
|
||||
}
|
||||
if (field.get('name') === 'dataSource') {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user