diff --git a/packages/app/src/components/views/Field/index.tsx b/packages/app/src/components/views/Field/index.tsx index ff6884980..a55856dd8 100644 --- a/packages/app/src/components/views/Field/index.tsx +++ b/packages/app/src/components/views/Field/index.tsx @@ -25,7 +25,7 @@ marked.setOptions({ const renderer = new marked.Renderer(); renderer.link = ( href, title, text ) => `${ text }`; -function markdown(text: string) { +export function markdown(text: string) { return marked(text, { renderer, }); diff --git a/packages/app/src/components/views/Form/scopes.tsx b/packages/app/src/components/views/Form/scopes.tsx index de5e02e64..1ef016e9f 100644 --- a/packages/app/src/components/views/Form/scopes.tsx +++ b/packages/app/src/components/views/Form/scopes.tsx @@ -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
+ const text = decodeURIComponent(html); + return }, tooltip(title: string, offset = 3) { return ( diff --git a/packages/plugin-pages/src/actions/getView.ts b/packages/plugin-pages/src/actions/getView.ts index dabe91598..19c355099 100644 --- a/packages/plugin-pages/src/actions/getView.ts +++ b/packages/plugin-pages/src/actions/getView.ts @@ -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') {