🚑 Fix text styling parsing on variables
This commit is contained in:
@@ -230,18 +230,30 @@ const parseVariablesInRichText = (
|
|||||||
? variableInText.value
|
? variableInText.value
|
||||||
: variableInText.value.replace(/[\n]+/g, ' ')
|
: variableInText.value.replace(/[\n]+/g, ' ')
|
||||||
)
|
)
|
||||||
|
const variableElementsWithStyling = variableElements.map(
|
||||||
|
(variableElement) => ({
|
||||||
|
...variableElement,
|
||||||
|
children: [
|
||||||
|
...(variableElement.children as TDescendant[]).map((child) => ({
|
||||||
|
...element,
|
||||||
|
...child,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
)
|
||||||
if (isStandaloneElement) {
|
if (isStandaloneElement) {
|
||||||
parsedElements.push(...variableElements)
|
parsedElements.push(...variableElementsWithStyling)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const children: TDescendant[] = []
|
const children: TDescendant[] = []
|
||||||
if (isNotEmpty(textBeforeVariable))
|
if (isNotEmpty(textBeforeVariable))
|
||||||
children.push({
|
children.push({
|
||||||
|
...element,
|
||||||
text: textBeforeVariable,
|
text: textBeforeVariable,
|
||||||
})
|
})
|
||||||
children.push({
|
children.push({
|
||||||
type: 'inline-variable',
|
type: 'inline-variable',
|
||||||
children: variableElements,
|
children: variableElementsWithStyling,
|
||||||
})
|
})
|
||||||
if (isNotEmpty(textAfterVariable))
|
if (isNotEmpty(textAfterVariable))
|
||||||
children.push({
|
children.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user