diff --git a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.tsx b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.tsx index f840953a82..cd218ac0d5 100644 --- a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.tsx +++ b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.tsx @@ -155,7 +155,7 @@ export const MarkdownVoid: any = withDynamicSchemaProps( engine, content, compile(variables), - compile(localVariables), + compile(JSON.parse(JSON.stringify(localVariables))), parseMarkdown, ); setHtml(replacedContent); diff --git a/packages/core/client/src/schema-component/common/utils/uitls.tsx b/packages/core/client/src/schema-component/common/utils/uitls.tsx index d23e8cf5ee..8f0cf07acf 100644 --- a/packages/core/client/src/schema-component/common/utils/uitls.tsx +++ b/packages/core/client/src/schema-component/common/utils/uitls.tsx @@ -190,6 +190,7 @@ export async function getRenderContent(templateEngine, content, variables, local const html = await replaceVariableValue(content, variables, localVariables); return await defaultParse(html); } catch (error) { + console.log(error); return content; } } diff --git a/packages/core/client/src/variables/VariablesProvider.tsx b/packages/core/client/src/variables/VariablesProvider.tsx index ff6bd121b6..50a02cb00f 100644 --- a/packages/core/client/src/variables/VariablesProvider.tsx +++ b/packages/core/client/src/variables/VariablesProvider.tsx @@ -117,7 +117,7 @@ const VariablesProvider = ({ children, filterVariables }: any) => { const key = list[index]; const { fieldPath } = getFieldPath(list.slice(0, index + 1).join('.'), _variableToCollectionName); const associationField: CollectionFieldOptions_deprecated = getCollectionJoinField(fieldPath, dataSource); - const collectionPrimaryKey = getCollection(collectionName)?.getPrimaryKey(); + const collectionPrimaryKey = getCollection(collectionName, dataSource)?.getPrimaryKey(); if (Array.isArray(current)) { const result = current.map((item) => { if (!options?.doNotRequest && shouldToRequest(item?.[key]) && item?.[collectionPrimaryKey] != null) { diff --git a/packages/core/client/src/variables/hooks/useLocalVariables.tsx b/packages/core/client/src/variables/hooks/useLocalVariables.tsx index cd909c936d..5d7f08b62b 100644 --- a/packages/core/client/src/variables/hooks/useLocalVariables.tsx +++ b/packages/core/client/src/variables/hooks/useLocalVariables.tsx @@ -96,6 +96,7 @@ const useLocalVariables = (props?: Props) => { name: '$nRecord', ctx: currentRecordCtx, collectionName: collectionNameOfRecord, + dataSource: currentParentRecordDataSource, }, { name: '$nParentRecord',