mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:05:45 +00:00
fix: bug (#5009)
Some checks failed
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, false) (push) Has been cancelled
NocoBase Backend Test / sqlite-test (20, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, true) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled
Some checks failed
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, false) (push) Has been cancelled
NocoBase Backend Test / sqlite-test (20, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, true) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled
This commit is contained in:
parent
f696c67b5e
commit
9c44e0b229
@ -151,9 +151,9 @@ const getVariablesData = (localVariables) => {
|
||||
|
||||
export async function getRenderContent(templateEngine, content, variables, localVariables, defaultParse) {
|
||||
if (content && templateEngine === 'handlebars') {
|
||||
const renderedContent = Handlebars.compile(content);
|
||||
// 处理渲染后的内容
|
||||
try {
|
||||
const renderedContent = Handlebars.compile(content);
|
||||
// 处理渲染后的内容
|
||||
const data = getVariablesData(localVariables);
|
||||
const html = renderedContent({ ...variables.ctxRef.current, ...data });
|
||||
return await defaultParse(html);
|
||||
|
@ -87,6 +87,17 @@ const commonOptions: any = {
|
||||
},
|
||||
});
|
||||
};
|
||||
// 外部定义 description 的内容
|
||||
const descriptionContent = (
|
||||
<>
|
||||
<span style={{ marginLeft: '.25em' }} className={'ant-formily-item-extra'}>
|
||||
{t('Syntax references')}:
|
||||
</span>
|
||||
<a href="https://handlebarsjs.com/guide/" target="_blank" rel="noreferrer">
|
||||
Handlebars.js
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
|
||||
return {
|
||||
title: t('Edit iframe'),
|
||||
@ -129,6 +140,7 @@ const commonOptions: any = {
|
||||
title: '{{t("Template engine")}}',
|
||||
'x-component': 'Radio.Group',
|
||||
'x-decorator': 'FormItem',
|
||||
default: 'string',
|
||||
enum: [
|
||||
{ value: 'string', label: t('String template') },
|
||||
{ value: 'handlebars', label: t('Handlebars') },
|
||||
@ -151,24 +163,25 @@ const commonOptions: any = {
|
||||
rows: 10,
|
||||
},
|
||||
required: true,
|
||||
description: (
|
||||
<>
|
||||
<span style={{ marginLeft: '.25em' }} className={'ant-formily-item-extra'}>
|
||||
{t('Syntax references')}:
|
||||
</span>
|
||||
<a href="https://handlebarsjs.com/guide/" target="_blank" rel="noreferrer">
|
||||
Handlebars.js
|
||||
</a>
|
||||
</>
|
||||
),
|
||||
'x-reactions': {
|
||||
dependencies: ['mode'],
|
||||
fulfill: {
|
||||
state: {
|
||||
hidden: '{{$deps[0] === "url"}}',
|
||||
description: descriptionContent,
|
||||
'x-reactions': [
|
||||
{
|
||||
dependencies: ['mode'],
|
||||
fulfill: {
|
||||
state: {
|
||||
hidden: '{{$deps[0] === "url"}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
(field) => {
|
||||
const { engine } = field.form.values;
|
||||
if (engine === 'handlebars') {
|
||||
field.description = descriptionContent;
|
||||
} else {
|
||||
field.description = null;
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
} as ISchema,
|
||||
|
Loading…
Reference in New Issue
Block a user