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,
|
engine,
|
||||||
content,
|
content,
|
||||||
compile(variables),
|
compile(variables),
|
||||||
compile(localVariables),
|
compile(JSON.parse(JSON.stringify(localVariables))),
|
||||||
parseMarkdown,
|
parseMarkdown,
|
||||||
);
|
);
|
||||||
setHtml(replacedContent);
|
setHtml(replacedContent);
|
||||||
|
@ -190,6 +190,7 @@ export async function getRenderContent(templateEngine, content, variables, local
|
|||||||
const html = await replaceVariableValue(content, variables, localVariables);
|
const html = await replaceVariableValue(content, variables, localVariables);
|
||||||
return await defaultParse(html);
|
return await defaultParse(html);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ const VariablesProvider = ({ children, filterVariables }: any) => {
|
|||||||
const key = list[index];
|
const key = list[index];
|
||||||
const { fieldPath } = getFieldPath(list.slice(0, index + 1).join('.'), _variableToCollectionName);
|
const { fieldPath } = getFieldPath(list.slice(0, index + 1).join('.'), _variableToCollectionName);
|
||||||
const associationField: CollectionFieldOptions_deprecated = getCollectionJoinField(fieldPath, dataSource);
|
const associationField: CollectionFieldOptions_deprecated = getCollectionJoinField(fieldPath, dataSource);
|
||||||
const collectionPrimaryKey = getCollection(collectionName)?.getPrimaryKey();
|
const collectionPrimaryKey = getCollection(collectionName, dataSource)?.getPrimaryKey();
|
||||||
if (Array.isArray(current)) {
|
if (Array.isArray(current)) {
|
||||||
const result = current.map((item) => {
|
const result = current.map((item) => {
|
||||||
if (!options?.doNotRequest && shouldToRequest(item?.[key]) && item?.[collectionPrimaryKey] != null) {
|
if (!options?.doNotRequest && shouldToRequest(item?.[key]) && item?.[collectionPrimaryKey] != null) {
|
||||||
|
@ -96,6 +96,7 @@ const useLocalVariables = (props?: Props) => {
|
|||||||
name: '$nRecord',
|
name: '$nRecord',
|
||||||
ctx: currentRecordCtx,
|
ctx: currentRecordCtx,
|
||||||
collectionName: collectionNameOfRecord,
|
collectionName: collectionNameOfRecord,
|
||||||
|
dataSource: currentParentRecordDataSource,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '$nParentRecord',
|
name: '$nParentRecord',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user