Enhance placeholder replacement logic to ensure valid placeholders are used
This commit is contained in:
parent
5ccc312695
commit
904550f6e6
1 changed files with 5 additions and 1 deletions
|
|
@ -263,8 +263,12 @@ export const placeholdersUtils = {
|
||||||
if (skip_additional_text && (p1 === 'additional_text')) {
|
if (skip_additional_text && (p1 === 'additional_text')) {
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
const currPlaceholder = defaultPlaceholders.find(ph => ph.id === p1);
|
||||||
|
if (!currPlaceholder) {
|
||||||
|
return match;
|
||||||
|
}
|
||||||
// Replace if found, otherwise keep the original or substitute with default value
|
// Replace if found, otherwise keep the original or substitute with default value
|
||||||
return replacements[p1] || (use_default_value ? defaultPlaceholders.find(ph => ph.id === p1).default_value : match);
|
return replacements[p1] || (use_default_value ? currPlaceholder.default_value : match);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue