From 07af1ca08d584ad421c37e2451be8e19808e3c83 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 26 Mar 2021 10:05:55 +0800 Subject: [PATCH] fix: form expression scope --- .../components/pages/AdminLoader/View/Form.tsx | 16 ++-------------- .../app/src/components/views/Form/scopes.tsx | 3 +++ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/app/src/components/pages/AdminLoader/View/Form.tsx b/packages/app/src/components/pages/AdminLoader/View/Form.tsx index ac6956a550..196583d9c5 100644 --- a/packages/app/src/components/pages/AdminLoader/View/Form.tsx +++ b/packages/app/src/components/pages/AdminLoader/View/Form.tsx @@ -22,6 +22,7 @@ import set from 'lodash/set'; import cloneDeep from 'lodash/cloneDeep' import { Spin } from '@nocobase/client'; import { markdown } from '@/components/views/Field'; +import scopes from '@/components/views/Form/scopes'; export function fields2properties(fields = [], options: any = {}) { const { mode } = options; @@ -161,20 +162,7 @@ export function Form(props: any) { } onFinish && await onFinish(values); }} - expressionScope={{ - text(...args: any[]) { - return React.createElement('span', {}, ...args) - }, - tooltip(title: string, offset = 3) { - return ( - - - - ); - }, - }} + expressionScope={scopes} > 取消 diff --git a/packages/app/src/components/views/Form/scopes.tsx b/packages/app/src/components/views/Form/scopes.tsx index 1ef016e9f9..fca844786a 100644 --- a/packages/app/src/components/views/Form/scopes.tsx +++ b/packages/app/src/components/views/Form/scopes.tsx @@ -11,6 +11,9 @@ export default { const text = decodeURIComponent(html); return
}, + markdown(text: string) { + return + }, tooltip(title: string, offset = 3) { return ( }>