mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
fix: issue with Markdown string templates not loading data of association variable (#5791)
* fix: issue with Markdown string templates not loading data of association variables * fix: bug
This commit is contained in:
parent
df055e0b8e
commit
bda94f9c1b
@ -155,7 +155,7 @@ export const MarkdownVoid: any = withDynamicSchemaProps(
|
||||
engine,
|
||||
content,
|
||||
compile(variables),
|
||||
compile(localVariables),
|
||||
compile(JSON.parse(JSON.stringify(localVariables))),
|
||||
parseMarkdown,
|
||||
);
|
||||
setHtml(replacedContent);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -96,6 +96,7 @@ const useLocalVariables = (props?: Props) => {
|
||||
name: '$nRecord',
|
||||
ctx: currentRecordCtx,
|
||||
collectionName: collectionNameOfRecord,
|
||||
dataSource: currentParentRecordDataSource,
|
||||
},
|
||||
{
|
||||
name: '$nParentRecord',
|
||||
|
Loading…
x
Reference in New Issue
Block a user